diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp index 45964930..3e1fdc44 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp @@ -77,7 +77,7 @@ namespace SHADE ImGui::PushID(SHFamilyID::GetID()); SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active"); ImGui::SameLine(); - if (ImGui::CollapsingHeader(componentType.get_name().data())) + if (ImGui::CollapsingHeader(componentType.get_name().data(), ImGuiTreeNodeFlags_DefaultOpen)) { DrawContextMenu(component); auto const& properties = componentType.get_properties(); @@ -234,7 +234,7 @@ namespace SHADE const auto componentType = rttr::type::get(); SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active"); ImGui::SameLine(); - if (ImGui::CollapsingHeader(componentType.get_name().data())) + if (ImGui::CollapsingHeader(componentType.get_name().data(), ImGuiTreeNodeFlags_DefaultOpen)) { DrawContextMenu(component); @@ -328,7 +328,7 @@ namespace SHADE 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(); - if (ImGui::CollapsingHeader(componentType.get_name().data())) + if (ImGui::CollapsingHeader(componentType.get_name().data(), ImGuiTreeNodeFlags_DefaultOpen)) { DrawContextMenu(component); @@ -446,7 +446,7 @@ namespace SHADE 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(); - if (ImGui::CollapsingHeader(componentType.get_name().data())) + if (ImGui::CollapsingHeader(componentType.get_name().data(), ImGuiTreeNodeFlags_DefaultOpen)) { DrawContextMenu(component); @@ -478,7 +478,7 @@ namespace SHADE 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(); - if (ImGui::CollapsingHeader(componentType.get_name().data())) + if (ImGui::CollapsingHeader(componentType.get_name().data(), ImGuiTreeNodeFlags_DefaultOpen)) { DrawContextMenu(component); Handle const& mesh = component->GetMesh(); @@ -536,7 +536,7 @@ namespace SHADE 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(); - if (ImGui::CollapsingHeader(componentType.get_name().data())) + if (ImGui::CollapsingHeader(componentType.get_name().data(), ImGuiTreeNodeFlags_DefaultOpen)) { DrawContextMenu(component); Handle const& font = component->GetFont(); diff --git a/SHADE_Engine/src/Editor/SHEditorWidgets.hpp b/SHADE_Engine/src/Editor/SHEditorWidgets.hpp index 441f95aa..f3dfe194 100644 --- a/SHADE_Engine/src/Editor/SHEditorWidgets.hpp +++ b/SHADE_Engine/src/Editor/SHEditorWidgets.hpp @@ -13,6 +13,8 @@ #include "Command/SHCommandManager.h" #include "SHImGuiHelpers.hpp" #include "SH_API.h" +#include "Assets/SHAssetMacros.h" +#include "ECS_Base/SHECSMacros.h" //#==============================================================# //|| Library Includes || @@ -454,7 +456,33 @@ namespace SHADE ImGui::BeginGroup(); ImGui::PushID(label.data()); TextLabel(label); - const bool hasChange = ImGui::InputScalar("##dragScalar", data_type, &value); + bool hasChange = ImGui::DragScalar("##dragScalar", data_type, &value); + if constexpr(std::is_same_v) //EID or Resource + { + if (SHDragDrop::BeginTarget()) + { + if(AssetID * payload = SHDragDrop::AcceptPayload(SHDragDrop::DRAG_RESOURCE)) + { + value = *payload; + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), value, set)), false); + hasChange = true; + SHDragDrop::EndTarget(); + } + else if (std::vector* payload = SHDragDrop::AcceptPayload>(SHDragDrop::DRAG_EID)) + { + value = payload->back(); + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), value, set)), false); + hasChange = true; + SHDragDrop::EndTarget(); + } + if(hasChange) + { + ImGui::PopID(); + ImGui::EndGroup(); + return true; + } + } + } static bool startRecording = false; if (hasChange) {