diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-03-06 20:11:56 +0100 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-03-06 20:14:41 +0100 |
commit | 9080232f1768e6a7a7ab1b5e9c65f59aa19b2cc0 (patch) | |
tree | 6cdd766bd1f70283b95c5bbcf9e0d291c14854b3 /scene/gui/dialogs.cpp | |
parent | 15c4d5006ee6982223777ababfbc2c040f3e344f (diff) | |
download | redot-engine-9080232f1768e6a7a7ab1b5e9c65f59aa19b2cc0.tar.gz |
Editor: Dim UI when a WindowDialog is shown.
Darkens the editor on WindowDialog popup.
This adds the following new Editor settings:
- interface/dim_editor_on_dialog_popup (true) # Enable/Disable editor dimming
- interface/dim_amount (0.6) # Percentage of how much the editor will be darkened (0-1)
- interface/dim_transition_time # The duration (in seconds) of the color blending effect (0-1), 0 is instant.
Please test this thoroughly, I haven't yet seen a case where it fails to work properly but I'm sure I didn't test all
windows of the editor :P
Diffstat (limited to 'scene/gui/dialogs.cpp')
-rw-r--r-- | scene/gui/dialogs.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index d081eda86d..89008b56bf 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -31,6 +31,10 @@ #include "print_string.h" #include "translation.h" +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#endif + void WindowDialog::_post_popup() { drag_type = DRAG_NONE; // just in case @@ -199,6 +203,16 @@ void WindowDialog::_notification(int p_what) { set_default_cursor_shape(CURSOR_ARROW); } } break; +#ifdef TOOLS_ENABLED + case NOTIFICATION_POST_POPUP: { + if (get_tree() && get_tree()->is_editor_hint()) + EditorNode::get_singleton()->dim_editor(true); + } break; + case NOTIFICATION_POPUP_HIDE: { + if (get_tree() && get_tree()->is_editor_hint()) + EditorNode::get_singleton()->dim_editor(false); + } break; +#endif } } |