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

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

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

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

Loading…
Cancel
Save