diff --git a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp index 2a24ad0e..cf545223 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp @@ -345,10 +345,18 @@ namespace SHADE void SHHierarchyPanel::ParentSelectedEntities(EntityID parentEID, std::vector const& entities) const noexcept { auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph(); + + std::vector 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(); SHEntityParentCommand::EntityParentData entityParentData; std::vector parentedEIDS; - for (auto const& eid : entities) + for (auto const& eid : entitiesToParent) { if(eid == parentEID) continue; diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp index 6091556e..146e36c3 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp @@ -68,10 +68,10 @@ namespace SHADE { if (!component) return; + const auto componentType = rttr::type::get(); ImGui::PushID(SHFamilyID::GetID()); 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::GetID()); + 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::GetID()); 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::GetID()); 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(); } } diff --git a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp index 223f9b83..2912a0bc 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp @@ -35,7 +35,7 @@ namespace SHADE constexpr ImGuiWindowFlags dockspaceFlags = ImGuiDockNodeFlags_PassthruCentralNode; - //#==============================================================# + //#==============================================================# //|| Public Member Functions || //#==============================================================# SHEditorMenuBar::SHEditorMenuBar() @@ -221,13 +221,20 @@ namespace SHADE ImGui::BeginDisabled(editor->editorState == SHEditor::State::PLAY); if(ImGui::SmallButton(ICON_MD_PLAY_ARROW)) { - if(editor->SaveScene()) + if(editor->editorState == SHEditor::State::STOP) + { + if (editor->SaveScene()) + { + editor->Play(); + } + } + else { editor->Play(); } } ImGui::EndDisabled(); - ImGui::BeginDisabled(editor->editorState == SHEditor::State::PAUSE); + ImGui::BeginDisabled(editor->editorState == SHEditor::State::STOP || editor->editorState == SHEditor::State::PAUSE); if(ImGui::SmallButton(ICON_MD_PAUSE)) { editor->Pause(); diff --git a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp index d0b32ff5..564731d6 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp @@ -85,7 +85,7 @@ namespace SHADE shouldUpdateCamArm = ImGui::IsWindowHovered() && ImGui::IsKeyDown(ImGuiKey_LeftAlt) && ImGui::IsMouseDown(ImGuiMouseButton_Left); - if (editor->editorState != SHEditor::State::PLAY && ImGui::IsWindowFocused() && !ImGui::IsMouseDown(ImGuiMouseButton_Right)) + if (editor->editorState != SHEditor::State::PLAY && !ImGui::IsAnyItemActive() && !ImGui::IsMouseDown(ImGuiMouseButton_Right)) { if (ImGui::IsKeyReleased(ImGuiKey_W)) { @@ -151,7 +151,7 @@ namespace SHADE if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::BeginTooltip(); - ImGui::Text("Translate [Q]"); + ImGui::Text("Translate [W]"); ImGui::EndTooltip(); } if (isTranslate) @@ -169,7 +169,7 @@ namespace SHADE if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::BeginTooltip(); - ImGui::Text("Rotate [W]"); + ImGui::Text("Rotate [E]"); ImGui::EndTooltip(); } if (isRotate) @@ -187,7 +187,7 @@ namespace SHADE if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::BeginTooltip(); - ImGui::Text("Scale [E]"); + ImGui::Text("Scale [R]"); ImGui::EndTooltip(); } if (isScale) diff --git a/SHADE_Engine/src/Serialization/SHSerialization.cpp b/SHADE_Engine/src/Serialization/SHSerialization.cpp index 8e4e350c..6933fbb5 100644 --- a/SHADE_Engine/src/Serialization/SHSerialization.cpp +++ b/SHADE_Engine/src/Serialization/SHSerialization.cpp @@ -179,7 +179,9 @@ namespace SHADE { if (ComponentType* component = SHComponentManager::GetComponent_s(eid)) { - componentsNode[rttr::type::get().get_name().data()] = YAML::convert::encode(*component); + auto componentNode = YAML::convert::encode(*component); + componentNode[IsActive.data()] = component->isActive; + componentsNode[rttr::type::get().get_name().data()] = componentNode; } } diff --git a/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp b/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp index 84e99345..b560acae 100644 --- a/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp +++ b/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp @@ -14,6 +14,8 @@ namespace SHADE { + static constexpr std::string_view IsActive = "IsActive"; + using AssetQueue = std::unordered_map; struct SHSerializationHelper { @@ -118,9 +120,9 @@ namespace SHADE YAML::Node node{}; if (!component) return node; - auto componentType = rttr::type::get(); node = RTTRToNode(*component); + node[IsActive.data()] = component->isActive; return node; } @@ -198,6 +200,9 @@ namespace SHADE auto componentNode = componentsNode[rttrType.get_name().data()]; if (!componentNode.IsDefined()) return; + if(componentNode[IsActive.data()].IsDefined()) + component->isActive = componentNode[IsActive.data()].as(); + auto properties = rttrType.get_properties(); for (auto const& prop : properties) { @@ -227,8 +232,10 @@ namespace SHADE auto component = SHComponentManager::GetComponent_s(eid); if (componentsNode.IsNull() && !component) return; - - YAML::convert::decode(GetComponentNode(componentsNode, eid), *component); + auto componentNode = GetComponentNode(componentsNode, eid); + if (componentNode[IsActive.data()].IsDefined()) + component->isActive = componentNode[IsActive.data()].as(); + YAML::convert::decode(componentNode, *component); } template , bool> = true> diff --git a/SHADE_Engine/src/Tools/Logger/SHLog.cpp b/SHADE_Engine/src/Tools/Logger/SHLog.cpp index 30a79338..139a731e 100644 --- a/SHADE_Engine/src/Tools/Logger/SHLog.cpp +++ b/SHADE_Engine/src/Tools/Logger/SHLog.cpp @@ -44,13 +44,6 @@ namespace SHADE SHLOG_FLOOR() } -#ifdef _DEBUG - void SHLog::Trace(const std::string& msg) noexcept - { - SHLOG_TRACE(msg) - } -#endif - void SHLog_Info(const char* msg) noexcept { SHLOG_INFO(msg) diff --git a/SHADE_Engine/src/Tools/Logger/SHLogger.cpp b/SHADE_Engine/src/Tools/Logger/SHLogger.cpp index 9c1e76fc..72791eb1 100644 --- a/SHADE_Engine/src/Tools/Logger/SHLogger.cpp +++ b/SHADE_Engine/src/Tools/Logger/SHLogger.cpp @@ -323,34 +323,6 @@ namespace SHADE SHLOG_FLOOR() } - #ifdef _DEBUG - void SHLogger::LogTrace(const std::string& msg) noexcept - { - SHLOG_TRACE(msg) - } - - void SHLogger::LogVerboseTrace(const std::string& msg, const std::source_location& src) noexcept - { - const bool SHOW_SRC_FILE = configFlags & (1U << 3); - const bool SHOW_SRC_LINE = configFlags & (1U << 4); - - std::stringstream ss; - ss << "["; - if (SHOW_SRC_FILE) - { - ss << std::filesystem::path(src.file_name()).filename().string() << ", "; - if (SHOW_SRC_LINE) - { - ss << src.line() << ", "; - } - } - - ss << src.function_name() << "] " << msg; - - SHLOG_TRACE(ss.str()) - } - #endif - /*-----------------------------------------------------------------------------------*/ /* Private Function Member Definitions */ /*-----------------------------------------------------------------------------------*/