From f7cfb93a81a6a0ee7cedb2debb0de1dfb9f7fd63 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Sun, 25 Feb 2024 23:08:29 +0100 Subject: [PATCH] [#194]: Don't make the recently selected GameObject a main selected one, when we're doing group select --- editor/editor.cpp | 4 ++-- editor/gui/editor_gui.cpp | 11 +++++++---- editor/gui/editor_gui.hpp | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/editor/editor.cpp b/editor/editor.cpp index 8d20910b..598ce141 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -181,7 +181,7 @@ Editor::MouseButtonCallback(MouseButtonEvent& event) for (const auto object : selectedObjects) { - gui_.ObjectSelected(object); + gui_.ObjectSelected(object, true); const auto& objectPos = currentLevel_->GetGameObjectRef(object).GetCenteredPosition(); @@ -570,7 +570,7 @@ Editor::SelectGameObject(Object::ID newSelectedGameObject) } currentSelectedGameObject_ = newSelectedGameObject; - gui_.ObjectSelected(currentSelectedGameObject_); + gui_.ObjectSelected(currentSelectedGameObject_, false); // Make sure to render animation points if needed auto& gameObject = currentLevel_->GetGameObjectRef(newSelectedGameObject); diff --git a/editor/gui/editor_gui.cpp b/editor/gui/editor_gui.cpp index 46320236..41fe5606 100644 --- a/editor/gui/editor_gui.cpp +++ b/editor/gui/editor_gui.cpp @@ -4,6 +4,7 @@ #include "game_object.hpp" #include "helpers.hpp" #include "icons.hpp" +#include "input/input_manager.hpp" #include "renderer/renderer.hpp" #include "renderer/shader.hpp" #include "renderer/texture.hpp" @@ -11,7 +12,6 @@ #include "renderer/vulkan_common.hpp" #include "types.hpp" #include "utils/file_manager.hpp" -#include "input/input_manager.hpp" #include #include @@ -146,7 +146,7 @@ EditorGUI::UpdateUI() } ImGui::Render(); - + setScrollTo_ = {}; } @@ -183,12 +183,15 @@ EditorGUI::LevelLoaded(const std::shared_ptr< Level >& loadedLevel) } void -EditorGUI::ObjectSelected(Object::ID ID) +EditorGUI::ObjectSelected(Object::ID ID, bool groupSelect) { objectsInfo_[ID].second = true; setScrollTo_ = ID; - currentlySelectedGameObject_ = ID; + if (not groupSelect) + { + currentlySelectedGameObject_ = ID; + } } void diff --git a/editor/gui/editor_gui.hpp b/editor/gui/editor_gui.hpp index 09dd830c..2643503c 100644 --- a/editor/gui/editor_gui.hpp +++ b/editor/gui/editor_gui.hpp @@ -54,7 +54,7 @@ class EditorGUI : public InputListener LevelLoaded(const std::shared_ptr< Level >& loadedLevel); void - ObjectSelected(Object::ID ID); + ObjectSelected(Object::ID ID, bool groupSelect); void ObjectUnselected(Object::ID ID);