change entity active to scene node active

This commit is contained in:
Sri Sham Haran 2022-11-12 18:38:57 +08:00
parent 78ca464c65
commit 69ac074926
2 changed files with 4 additions and 3 deletions

View File

@ -93,13 +93,14 @@ namespace SHADE
{ {
EntityID const& eid = editor->selectedEntities[0]; EntityID const& eid = editor->selectedEntities[0];
SHEntity* entity = SHEntityManager::GetEntityByID(eid); SHEntity* entity = SHEntityManager::GetEntityByID(eid);
if(!entity) SHSceneNode* entityNode = SHSceneManager::GetCurrentSceneGraph().GetNode(eid);
if(!entity || !entityNode)
{ {
ImGui::End(); ImGui::End();
return; return;
} }
ImGui::TextColored(ImGuiColors::green, "EID: %zu", eid); 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::SameLine();
ImGui::InputText("##EntityName", &entity->name); ImGui::InputText("##EntityName", &entity->name);

View File

@ -136,7 +136,7 @@ namespace SHADE
for (auto* child : children) for (auto* child : children)
{ {
SetActive(newActiveState); child->SetActive(newActiveState);
} }
} }