fixed unselecting entity when cursor goes from ImGui to viewport while click is held

This commit is contained in:
Erris
2026-03-03 09:38:52 +01:00
parent 4a624cfe70
commit 282eeeabda
4 changed files with 7 additions and 15 deletions

View File

@@ -3,9 +3,6 @@
#include <open_engine.hpp>
#include "open_engine/renderer/renderer3d.hpp"
#include "open_engine/scene/components.hpp"
#include "open_engine/scene/scene_serializer.hpp"
#include "panels/content_browser.hpp"
#include "panels/scene_hierarchy.hpp"
@@ -181,7 +178,6 @@ namespace OpenEngine {
RenderCommand::Clear();
framebuffer->ClearBufferI(1, -1);
switch (state) {
case PlayState::Play: {
scene->OnUpdateRuntime();
@@ -208,6 +204,7 @@ namespace OpenEngine {
static bool clicked = false;
// Mouse Picking
if (Input::IsMouseButtonPressed(MouseCode::ButtonLeft)
&& !Application::Get().GetImGuiLayer()->GetBlockEvents()
&& mouse_x >= 0 && mouse_y >= 0
&& mouse_x < (int)viewport_size.x
&& mouse_y < (int)viewport_size.y

View File

@@ -227,15 +227,10 @@ namespace OpenEngine {
auto& ambient = material.ambient_strength;
auto& specular = material.specular_strength;
if (ImGui::SliderFloat4("Albedo", glm::value_ptr(albedo), 0, 1))
material.albedo = albedo;
if (ImGui::SliderFloat("Roughness", &roughness, 0, 1))
material.roughness = roughness;
if (ImGui::SliderFloat("Metallic", &metallic, 0, 1))
material.metallic = metallic;
if (ImGui::SliderFloat("Ambient strength", &ambient, 0, 1))
material.ambient_strength = ambient;
if (ImGui::SliderFloat("Specular strength", &specular, 0, 10))
material.specular_strength = specular;
ImGui::SliderFloat4("Albedo", glm::value_ptr(albedo), 0, 1);
ImGui::SliderFloat("Roughness", &roughness, 0, 1);
ImGui::SliderFloat("Metallic", &metallic, 0, 1);
ImGui::SliderFloat("Ambient strength", &ambient, 0, 1);
ImGui::SliderFloat("Specular strength", &specular, 0, 10);
}
}

View File

@@ -19,6 +19,7 @@ namespace OpenEngine {
bool CloseWindow(OpenEngine::KeyPressedEvent& event);
void SetBlockEvents(bool block) { block_events = block; };
bool GetBlockEvents() { return block_events; };
void Begin();
void End();

View File

@@ -2,7 +2,6 @@
#define INPUT_HPP
#include "open_engine/input/mouse_codes.hpp"
#include "open_engine/ref_scope.hpp"
#include "open_engine/input/keycodes.hpp"
#include <string>