Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Add `is_exiting` to the `EditorInterface`

Chris Cranfordf29110e19f81
diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml
index 3209f160e8b..656f81b80c8 100644
--- a/doc/classes/EditorInterface.xml
+++ b/doc/classes/EditorInterface.xml
@@ -264,6 +264,12 @@
Shows the given property on the given [param object] in the editor's Inspector dock. If [param inspector_only] is [code]true[/code], plugins will not attempt to edit [param object].
</description>
</method>
+ <method name="is_exiting" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if the editor is currently exiting.
+ </description>
+ </method>
<method name="is_multi_window_enabled" qualifiers="const">
<return type="bool" />
<description>
diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp
index fc149033520..3013152c70b 100644
--- a/editor/editor_interface.cpp
+++ b/editor/editor_interface.cpp
@@ -72,6 +72,10 @@
EditorInterface *EditorInterface::singleton = nullptr;
+bool EditorInterface::is_exiting() const {
+ return EditorNode::get_singleton()->is_exiting();
+}
+
void EditorInterface::restart_editor(bool p_save) {
if (p_save) {
EditorNode::get_singleton()->save_all_scenes();
@@ -848,6 +852,7 @@ void EditorInterface::get_argument_options(const StringName &p_function, int p_i
// Base.
void EditorInterface::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("is_exiting"), &EditorInterface::is_exiting);
ClassDB::bind_method(D_METHOD("restart_editor", "save"), &EditorInterface::restart_editor, DEFVAL(true));
// Editor tools.
diff --git a/editor/editor_interface.h b/editor/editor_interface.h
index 32d03fb7404..64b808cc0c5 100644
--- a/editor/editor_interface.h
+++ b/editor/editor_interface.h
@@ -96,6 +96,7 @@ protected:
public:
static EditorInterface *get_singleton() { return singleton; }
+ bool is_exiting() const;
void restart_editor(bool p_save = true);
// Editor tools.