You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Make the editor dimming smarter
This commit is contained in:
@@ -5171,14 +5171,20 @@ void EditorNode::_open_imported() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::dim_editor(bool p_dimming, bool p_force_dim) {
|
void EditorNode::dim_editor(bool p_dimming, bool p_force_dim) {
|
||||||
// Dimming can be forced regardless of the editor setting, which is useful when quitting the editor
|
// Dimming can be forced regardless of the editor setting, which is useful when quitting the editor.
|
||||||
if ((p_force_dim || EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup")) && p_dimming) {
|
if ((p_force_dim || EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup")) && p_dimming) {
|
||||||
|
dimmed = true;
|
||||||
gui_base->set_modulate(Color(0.5, 0.5, 0.5));
|
gui_base->set_modulate(Color(0.5, 0.5, 0.5));
|
||||||
} else {
|
} else {
|
||||||
|
dimmed = false;
|
||||||
gui_base->set_modulate(Color(1, 1, 1));
|
gui_base->set_modulate(Color(1, 1, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EditorNode::is_editor_dimmed() const {
|
||||||
|
return dimmed;
|
||||||
|
}
|
||||||
|
|
||||||
void EditorNode::open_export_template_manager() {
|
void EditorNode::open_export_template_manager() {
|
||||||
|
|
||||||
export_template_manager->popup_manager();
|
export_template_manager->popup_manager();
|
||||||
@@ -5487,6 +5493,7 @@ EditorNode::EditorNode() {
|
|||||||
|
|
||||||
singleton = this;
|
singleton = this;
|
||||||
exiting = false;
|
exiting = false;
|
||||||
|
dimmed = false;
|
||||||
last_checked_version = 0;
|
last_checked_version = 0;
|
||||||
changing_scene = false;
|
changing_scene = false;
|
||||||
_initializing_addons = false;
|
_initializing_addons = false;
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ private:
|
|||||||
int tab_closing;
|
int tab_closing;
|
||||||
|
|
||||||
bool exiting;
|
bool exiting;
|
||||||
|
bool dimmed;
|
||||||
|
|
||||||
int old_split_ofs;
|
int old_split_ofs;
|
||||||
VSplitContainer *top_split;
|
VSplitContainer *top_split;
|
||||||
@@ -850,6 +851,7 @@ public:
|
|||||||
void restart_editor();
|
void restart_editor();
|
||||||
|
|
||||||
void dim_editor(bool p_dimming, bool p_force_dim = false);
|
void dim_editor(bool p_dimming, bool p_force_dim = false);
|
||||||
|
bool is_editor_dimmed() const;
|
||||||
|
|
||||||
void edit_current() { _edit_current(); };
|
void edit_current() { _edit_current(); };
|
||||||
|
|
||||||
|
|||||||
@@ -239,13 +239,15 @@ void WindowDialog::_notification(int p_what) {
|
|||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
case NOTIFICATION_POST_POPUP: {
|
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);
|
EditorNode::get_singleton()->dim_editor(true);
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_POPUP_HIDE: {
|
case NOTIFICATION_POPUP_HIDE: {
|
||||||
if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton() && !get_viewport()->gui_has_modal_stack())
|
if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton())
|
||||||
EditorNode::get_singleton()->dim_editor(false);
|
EditorNode::get_singleton()->dim_editor(was_editor_dimmed);
|
||||||
} break;
|
} break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -345,6 +347,10 @@ WindowDialog::WindowDialog() {
|
|||||||
close_button = memnew(TextureButton);
|
close_button = memnew(TextureButton);
|
||||||
add_child(close_button);
|
add_child(close_button);
|
||||||
close_button->connect("pressed", this, "_closed");
|
close_button->connect("pressed", this, "_closed");
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
was_editor_dimmed = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowDialog::~WindowDialog() {
|
WindowDialog::~WindowDialog() {
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ class WindowDialog : public Popup {
|
|||||||
Point2 drag_offset_far;
|
Point2 drag_offset_far;
|
||||||
bool resizable;
|
bool resizable;
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
bool was_editor_dimmed;
|
||||||
|
#endif
|
||||||
|
|
||||||
void _gui_input(const Ref<InputEvent> &p_event);
|
void _gui_input(const Ref<InputEvent> &p_event);
|
||||||
void _closed();
|
void _closed();
|
||||||
int _drag_hit_test(const Point2 &pos) const;
|
int _drag_hit_test(const Point2 &pos) const;
|
||||||
@@ -106,7 +110,6 @@ class AcceptDialog : public WindowDialog {
|
|||||||
HBoxContainer *hbc;
|
HBoxContainer *hbc;
|
||||||
Label *label;
|
Label *label;
|
||||||
Button *ok;
|
Button *ok;
|
||||||
//Button *cancel; no more cancel (there is X on that titlebar)
|
|
||||||
bool hide_on_ok;
|
bool hide_on_ok;
|
||||||
|
|
||||||
void _custom_action(const String &p_action);
|
void _custom_action(const String &p_action);
|
||||||
|
|||||||
Reference in New Issue
Block a user