From 69ac074926530530d640798462ecc170c2e7503d Mon Sep 17 00:00:00 2001 From: Sri Sham Haran Date: Sat, 12 Nov 2022 18:38:57 +0800 Subject: [PATCH] change entity active to scene node active --- .../src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp | 5 +++-- SHADE_Engine/src/Scene/SHSceneNode.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp index 2fecae25..dde49838 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp @@ -93,13 +93,14 @@ namespace SHADE { EntityID const& eid = editor->selectedEntities[0]; SHEntity* entity = SHEntityManager::GetEntityByID(eid); - if(!entity) + SHSceneNode* entityNode = SHSceneManager::GetCurrentSceneGraph().GetNode(eid); + if(!entity || !entityNode) { ImGui::End(); return; } ImGui::TextColored(ImGuiColors::green, "EID: %zu", eid); - SHEditorWidgets::CheckBox("##IsActive", [entity]()->bool {return entity->GetActive(); }, [entity](bool const& active) {entity->SetActive(active); }); + SHEditorWidgets::CheckBox("##IsActive", [entityNode]()->bool {return entityNode->IsActive(); }, [entityNode](bool const& active) {entityNode->SetActive(active); }); ImGui::SameLine(); ImGui::InputText("##EntityName", &entity->name); diff --git a/SHADE_Engine/src/Scene/SHSceneNode.cpp b/SHADE_Engine/src/Scene/SHSceneNode.cpp index b619d464..8dac20bd 100644 --- a/SHADE_Engine/src/Scene/SHSceneNode.cpp +++ b/SHADE_Engine/src/Scene/SHSceneNode.cpp @@ -136,7 +136,7 @@ namespace SHADE for (auto* child : children) { - SetActive(newActiveState); + child->SetActive(newActiveState); } }