diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-06-03 23:08:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 23:08:43 +0200 |
commit | 243cb503e1b5d475e9f80349e7ee58592de68e99 (patch) | |
tree | 8c8b060110454a9b6acae885c91135ec36f9a8e6 | |
parent | 19dc5c42d81188b3941b5b16ddae63b094cdaf6e (diff) | |
parent | cc1859efed2da6587fa4bf3f567167a3c5f20fb6 (diff) |
Merge pull request #39204 from Calinou/distraction-free-property-getter
Add a getter and property for the editor distraction-free mode
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/editor_node.h | 2 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 7 | ||||
-rw-r--r-- | editor/editor_plugin.h | 1 |
4 files changed, 10 insertions, 2 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 8b7014fabe..4d69b3f0d6 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4782,7 +4782,7 @@ void EditorNode::set_distraction_free_mode(bool p_enter) { } } -bool EditorNode::get_distraction_free_mode() const { +bool EditorNode::is_distraction_free_mode_enabled() const { return distraction_free->is_pressed(); } diff --git a/editor/editor_node.h b/editor/editor_node.h index dfe3d91c07..7c9cf44d6c 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -693,7 +693,7 @@ public: bool get_docks_visible() const; void set_distraction_free_mode(bool p_enter); - bool get_distraction_free_mode() const; + bool is_distraction_free_mode_enabled() const; void add_control_to_dock(DockSlot p_slot, Control *p_control); void remove_control_from_dock(Control *p_control); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 2365090f03..6d93e92555 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -270,6 +270,10 @@ void EditorInterface::set_distraction_free_mode(bool p_enter) { EditorNode::get_singleton()->set_distraction_free_mode(p_enter); } +bool EditorInterface::is_distraction_free_mode_enabled() const { + return EditorNode::get_singleton()->is_distraction_free_mode_enabled(); +} + EditorInterface *EditorInterface::singleton = nullptr; void EditorInterface::_bind_methods() { @@ -302,6 +306,9 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("set_main_screen_editor", "name"), &EditorInterface::set_main_screen_editor); ClassDB::bind_method(D_METHOD("set_distraction_free_mode", "enter"), &EditorInterface::set_distraction_free_mode); + ClassDB::bind_method(D_METHOD("is_distraction_free_mode_enabled"), &EditorInterface::is_distraction_free_mode_enabled); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "distraction_free_mode"), "set_distraction_free_mode", "is_distraction_free_mode_enabled"); } EditorInterface::EditorInterface() { diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 2792c8bf19..aac36bfdfd 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -105,6 +105,7 @@ public: void set_main_screen_editor(const String &p_name); void set_distraction_free_mode(bool p_enter); + bool is_distraction_free_mode_enabled() const; EditorInterface(); }; |