fixed unselecting entity when cursor goes from ImGui to viewport while click is held
This commit is contained in:
@@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
#include <open_engine.hpp>
|
#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/content_browser.hpp"
|
||||||
#include "panels/scene_hierarchy.hpp"
|
#include "panels/scene_hierarchy.hpp"
|
||||||
|
|
||||||
@@ -181,7 +178,6 @@ namespace OpenEngine {
|
|||||||
RenderCommand::Clear();
|
RenderCommand::Clear();
|
||||||
framebuffer->ClearBufferI(1, -1);
|
framebuffer->ClearBufferI(1, -1);
|
||||||
|
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case PlayState::Play: {
|
case PlayState::Play: {
|
||||||
scene->OnUpdateRuntime();
|
scene->OnUpdateRuntime();
|
||||||
@@ -208,6 +204,7 @@ namespace OpenEngine {
|
|||||||
static bool clicked = false;
|
static bool clicked = false;
|
||||||
// Mouse Picking
|
// Mouse Picking
|
||||||
if (Input::IsMouseButtonPressed(MouseCode::ButtonLeft)
|
if (Input::IsMouseButtonPressed(MouseCode::ButtonLeft)
|
||||||
|
&& !Application::Get().GetImGuiLayer()->GetBlockEvents()
|
||||||
&& mouse_x >= 0 && mouse_y >= 0
|
&& mouse_x >= 0 && mouse_y >= 0
|
||||||
&& mouse_x < (int)viewport_size.x
|
&& mouse_x < (int)viewport_size.x
|
||||||
&& mouse_y < (int)viewport_size.y
|
&& mouse_y < (int)viewport_size.y
|
||||||
|
|||||||
@@ -227,15 +227,10 @@ namespace OpenEngine {
|
|||||||
auto& ambient = material.ambient_strength;
|
auto& ambient = material.ambient_strength;
|
||||||
auto& specular = material.specular_strength;
|
auto& specular = material.specular_strength;
|
||||||
|
|
||||||
if (ImGui::SliderFloat4("Albedo", glm::value_ptr(albedo), 0, 1))
|
ImGui::SliderFloat4("Albedo", glm::value_ptr(albedo), 0, 1);
|
||||||
material.albedo = albedo;
|
ImGui::SliderFloat("Roughness", &roughness, 0, 1);
|
||||||
if (ImGui::SliderFloat("Roughness", &roughness, 0, 1))
|
ImGui::SliderFloat("Metallic", &metallic, 0, 1);
|
||||||
material.roughness = roughness;
|
ImGui::SliderFloat("Ambient strength", &ambient, 0, 1);
|
||||||
if (ImGui::SliderFloat("Metallic", &metallic, 0, 1))
|
ImGui::SliderFloat("Specular strength", &specular, 0, 10);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace OpenEngine {
|
|||||||
bool CloseWindow(OpenEngine::KeyPressedEvent& event);
|
bool CloseWindow(OpenEngine::KeyPressedEvent& event);
|
||||||
|
|
||||||
void SetBlockEvents(bool block) { block_events = block; };
|
void SetBlockEvents(bool block) { block_events = block; };
|
||||||
|
bool GetBlockEvents() { return block_events; };
|
||||||
|
|
||||||
void Begin();
|
void Begin();
|
||||||
void End();
|
void End();
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#define INPUT_HPP
|
#define INPUT_HPP
|
||||||
|
|
||||||
#include "open_engine/input/mouse_codes.hpp"
|
#include "open_engine/input/mouse_codes.hpp"
|
||||||
#include "open_engine/ref_scope.hpp"
|
|
||||||
#include "open_engine/input/keycodes.hpp"
|
#include "open_engine/input/keycodes.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
Reference in New Issue
Block a user