diff options
author | Michael Alexsander <michaelalexsander@protonmail.com> | 2019-10-31 16:58:53 -0300 |
---|---|---|
committer | Michael Alexsander <michaelalexsander@protonmail.com> | 2019-10-31 16:58:53 -0300 |
commit | 36c4fd8935596f0d67a3eaa7d8779e6891d58564 (patch) | |
tree | 16c445e6a009b2405589a28d8729c187d7c1972e /scene | |
parent | 23a381d8827dbcb2d295fa393a5400f7a7e0a1c1 (diff) |
Make the editor dimming smarter
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/dialogs.cpp | 12 | ||||
-rw-r--r-- | scene/gui/dialogs.h | 5 |
2 files changed, 13 insertions, 4 deletions
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 062089d80b..19bac5e5ac 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -239,13 +239,15 @@ void WindowDialog::_notification(int p_what) { #ifdef TOOLS_ENABLED case NOTIFICATION_POST_POPUP: { - if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) { + was_editor_dimmed = EditorNode::get_singleton()->is_editor_dimmed(); EditorNode::get_singleton()->dim_editor(true); + } } break; case NOTIFICATION_POPUP_HIDE: { - if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton() && !get_viewport()->gui_has_modal_stack()) - EditorNode::get_singleton()->dim_editor(false); + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) + EditorNode::get_singleton()->dim_editor(was_editor_dimmed); } break; #endif } @@ -345,6 +347,10 @@ WindowDialog::WindowDialog() { close_button = memnew(TextureButton); add_child(close_button); close_button->connect("pressed", this, "_closed"); + +#ifdef TOOLS_ENABLED + was_editor_dimmed = false; +#endif } WindowDialog::~WindowDialog() { diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index afd1173f28..2eb0978e9b 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -59,6 +59,10 @@ class WindowDialog : public Popup { Point2 drag_offset_far; bool resizable; +#ifdef TOOLS_ENABLED + bool was_editor_dimmed; +#endif + void _gui_input(const Ref<InputEvent> &p_event); void _closed(); int _drag_hit_test(const Point2 &pos) const; @@ -106,7 +110,6 @@ class AcceptDialog : public WindowDialog { HBoxContainer *hbc; Label *label; Button *ok; - //Button *cancel; no more cancel (there is X on that titlebar) bool hide_on_ok; void _custom_action(const String &p_action); |