Can now delete from prefab editor

This commit is contained in:
antopilo
2024-09-21 23:49:51 -04:00
parent 114adab73f
commit f1c403f94c
4 changed files with 19 additions and 3 deletions

View File

@@ -280,10 +280,22 @@ void PrefabEditorWindow::Draw()
DrawEntityTree(prefab->Root);
ImGui::PopStyleVar();
}
ImGui::EndTable();
if (QueueDeletion.GetHandle() != -1)
{
virtualScene->DestroyEntity(QueueDeletion);
// Clear Selection
Selection = EditorSelection();
QueueDeletion = Nuake::Entity{ (entt::entity)-1, scene.get() };
}
}
ImGui::EndChild();
ImGui::PopStyleVar();
@@ -511,7 +523,7 @@ void PrefabEditorWindow::DrawEntityTree(Nuake::Entity e)
if (!isRenaming && Selection.Type == EditorSelectionType::Entity && Input::IsKeyPressed(Key::DELETE_KEY))
{
//QueueDeletion = Selection.Entity;
QueueDeletion = Selection.Entity;
}
if (ImGui::BeginPopupContextItem())
@@ -534,7 +546,7 @@ void PrefabEditorWindow::DrawEntityTree(Nuake::Entity e)
if (ImGui::Selectable("Remove"))
{
//QueueDeletion = e;
QueueDeletion = e;
}
if (entity.GetComponent<ParentComponent>().HasParent && ImGui::Selectable("Move to root"))

View File

@@ -10,6 +10,7 @@ namespace Nuake
class Scene;
class FrameBuffer;
class Texture;
class Entity;
}
class PrefabEditorWindow
@@ -36,6 +37,7 @@ private:
EditorSelectionPanel SelectionPanel;
EditorSelection Selection;
Nuake::Entity QueueDeletion;
private:
void DrawViewportWindow();