diff options
| author | George Marques | 2016-09-16 15:02:01 -0300 |
|---|---|---|
| committer | Rémi Verschelde | 2016-10-09 17:12:15 +0200 |
| commit | 6a0d47f34cdbbcfcf19eaa79de410814c841ce21 (patch) | |
| tree | e809b751880de7f8ba44fd6c9aefc9f431d9b408 | |
| parent | e6d49fb54c2a7896fc95b6063cfead178f1540b7 (diff) | |
| download | godot-6a0d47f34cdbbcfcf19eaa79de410814c841ce21.tar.gz godot-6a0d47f34cdbbcfcf19eaa79de410814c841ce21.tar.zst godot-6a0d47f34cdbbcfcf19eaa79de410814c841ce21.zip | |
Add a function to plugin get the main screen parent
- Fix a bug where the main screen button did not disappear when the plugin
was deactivated.
(cherry picked from commit 98e7c1edbab6605a7578643485e1e88b61fd83d7)
Diffstat (limited to '')
| -rw-r--r-- | doc/base/classes.xml | 7 | ||||
| -rw-r--r-- | tools/editor/editor_node.cpp | 2 | ||||
| -rw-r--r-- | tools/editor/editor_plugin.cpp | 6 | ||||
| -rw-r--r-- | tools/editor/editor_plugin.h | 1 |
4 files changed, 15 insertions, 1 deletions
diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 83d7830f8..83b478500 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -11477,6 +11477,13 @@ Get the general settings for the editor (the same window that appears in the Settings menu). </description> </method> + <method name="get_editor_viewport"> + <return type="Control"> + </return> + <description> + Get the main editor control. Use this as a parent for main screens. + </description> + </method> <method name="get_name" qualifiers="virtual"> <return type="String"> </return> diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index ea39b0313..90f793cf7 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3013,7 +3013,7 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { for(int i=0;i<singleton->main_editor_buttons.size();i++) { - if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_name()) { + if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_text()) { memdelete( singleton->main_editor_buttons[i] ); singleton->main_editor_buttons.remove(i); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 5e671549e..9a093b049 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -70,6 +70,11 @@ void EditorPlugin::remove_control_from_bottom_panel(Control *p_control) { } +Control * EditorPlugin::get_editor_viewport() { + + return EditorNode::get_singleton()->get_viewport(); +} + void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Control *p_control) { switch(p_location) { @@ -308,6 +313,7 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("remove_control_from_bottom_panel","control:Control"),&EditorPlugin::remove_control_from_bottom_panel); ObjectTypeDB::bind_method(_MD("add_custom_type","type","base","script:Script","icon:Texture"),&EditorPlugin::add_custom_type); ObjectTypeDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type); + ObjectTypeDB::bind_method(_MD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport); ObjectTypeDB::bind_method(_MD("add_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::add_import_plugin); ObjectTypeDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::remove_import_plugin); diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index 9a9c32357..e2722296e 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -97,6 +97,7 @@ public: void add_control_to_dock(DockSlot p_slot,Control *p_control); void remove_control_from_docks(Control *p_control); void remove_control_from_bottom_panel(Control *p_control); + Control* get_editor_viewport(); virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); virtual bool forward_input_event(const InputEvent& p_event); |
