[FIXED] Parenting of entities selected using Shift+Select

[FIXED] Component Active Checkbox not working for non reflected components
This commit is contained in:
Sri Sham Haran 2022-11-15 16:22:48 +08:00
parent e7a66eed08
commit d3be8127cd
2 changed files with 18 additions and 3 deletions

View File

@ -345,10 +345,18 @@ namespace SHADE
void SHHierarchyPanel::ParentSelectedEntities(EntityID parentEID, std::vector<EntityID> const& entities) const noexcept
{
auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph();
std::vector<EntityID> entitiesToParent{};
std::ranges::copy_if(entities, std::back_inserter(entitiesToParent), [&sceneGraph](EntityID const& eid)
{
if (sceneGraph.GetParent(eid)->GetEntityID() == MAX_EID)
return true;
return false;
});
//auto const editor = SHSystemManager::GetSystem<SHEditor>();
SHEntityParentCommand::EntityParentData entityParentData;
std::vector<EntityID> parentedEIDS;
for (auto const& eid : entities)
for (auto const& eid : entitiesToParent)
{
if(eid == parentEID)
continue;

View File

@ -68,10 +68,10 @@ namespace SHADE
{
if (!component)
return;
const auto componentType = rttr::type::get<T>();
ImGui::PushID(SHFamilyID<SHComponent>::GetID<T>());
SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active");
ImGui::PopID();
ImGui::SameLine();
if (ImGui::CollapsingHeader(componentType.get_name().data()))
{
@ -216,6 +216,8 @@ namespace SHADE
}
}
else DrawContextMenu(component);
ImGui::PopID();
}
template<>
@ -223,7 +225,8 @@ namespace SHADE
{
if (!component)
return;
ImGui::PushID(component);
ImGui::PushID(SHFamilyID<SHComponent>::GetID<SHColliderComponent>());
const auto componentType = rttr::type::get(*component);
SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active");
ImGui::SameLine();
@ -330,6 +333,7 @@ namespace SHADE
{
if (!component)
return;
ImGui::PushID(SHFamilyID<SHComponent>::GetID<SHLightComponent>());
const auto componentType = rttr::type::get(*component);
SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active");
ImGui::SameLine();
@ -353,6 +357,7 @@ namespace SHADE
{
DrawContextMenu(component);
}
ImGui::PopID();
}
template<>
@ -360,6 +365,7 @@ namespace SHADE
{
if (!component)
return;
ImGui::PushID(SHFamilyID<SHComponent>::GetID<SHRenderable>());
const auto componentType = rttr::type::get(*component);
SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active");
ImGui::SameLine();
@ -397,5 +403,6 @@ namespace SHADE
{
DrawContextMenu(component);
}
ImGui::PopID();
}
}