Fixed bug with asset drag/drop

master
Joey Pollack 4 years ago
parent b49ae6484c
commit 5ada9d5e1c

@ -7,6 +7,7 @@ Build System:
✔ Modify .sh scripts to recognize the noeditor flag @done (1/25/2022, 3:59:23 PM)
Core:
☐ Figure out how to represent Unique Entities and entity instances - and how this will work with UUIDs @critical
☐ Implement generic serializeation system
☐ JSON serializeable base class
☐ JSON implementions should be stubbed out in non-editor builds

@ -271,6 +271,7 @@ namespace lunarium { namespace editor
mAssets[asset->mID] = asset;
id = asset->mID;
Save().LogIfFailed(Editor::LogCat, "Asset was created");
return OpRes::OK();
}
@ -331,7 +332,12 @@ namespace lunarium { namespace editor
void ContentManager::MoveAsset(EditorAsset* asset, std::filesystem::path to)
{
std::filesystem::path from = mpProject->GetAssetDirectory() / asset->GetFileLocation();
std::filesystem::rename(from, to);
// Not all assets will have files associated with them
if (std::filesystem::exists(from))
{
std::filesystem::rename(from, to);
}
std::filesystem::path r = mpProject->MakeRelativeToAssets(to);
asset->mLocation = r;

@ -108,7 +108,7 @@ namespace editor
mSelectedDir = dir;
ImGui::SetNextItemOpen(false);
}
HandleAssetDrop(mSelectedDir);
HandleAssetDrop(dir);
}
for(auto const& dir_entry: std::filesystem::directory_iterator{dir})

@ -69,9 +69,10 @@ namespace lunarium
void WorldTree::DoFrame()
{
Entity *pSelection = nullptr;
if (mpWorld)
if (!mpWorld)
{
ImGui::SetNextItemOpen(true);
ImGui::Text("No World Loaded");
return;
}
if (ImGui::TreeNode("World Root") && mpWorld)

Loading…
Cancel
Save