Skip to content

Commit

Permalink
[#194]: Don't make the recently selected GameObject a main selected o…
Browse files Browse the repository at this point in the history
…ne, when we're doing group select
  • Loading branch information
JacobDomagala committed Feb 25, 2024
1 parent 9d8007e commit f7cfb93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down
11 changes: 7 additions & 4 deletions editor/gui/editor_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#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"
#include "renderer/types.hpp"
#include "renderer/vulkan_common.hpp"
#include "types.hpp"
#include "utils/file_manager.hpp"
#include "input/input_manager.hpp"

#include <GLFW/glfw3.h>
#include <fmt/format.h>
Expand Down Expand Up @@ -146,7 +146,7 @@ EditorGUI::UpdateUI()
}

ImGui::Render();

setScrollTo_ = {};
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion editor/gui/editor_gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f7cfb93

Please sign in to comment.