diff options
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r-- | editor/editor_data.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 130c330f5a..975405aec4 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -30,10 +30,10 @@ #include "editor_data.h" +#include "core/config/project_settings.h" #include "core/io/resource_loader.h" #include "core/os/dir_access.h" #include "core/os/file_access.h" -#include "core/project_settings.h" #include "editor_node.h" #include "editor_settings.h" #include "scene/resources/packed_scene.h" @@ -262,7 +262,9 @@ EditorHistory::EditorHistory() { } EditorPlugin *EditorData::get_editor(Object *p_object) { - for (int i = 0; i < editor_plugins.size(); i++) { + // We need to iterate backwards so that we can check user-created plugins first. + // Otherwise, it would not be possible for plugins to handle CanvasItem and Spatial nodes. + for (int i = editor_plugins.size() - 1; i > -1; i--) { if (editor_plugins[i]->has_main_screen() && editor_plugins[i]->handles(p_object)) { return editor_plugins[i]; } @@ -272,7 +274,7 @@ EditorPlugin *EditorData::get_editor(Object *p_object) { } EditorPlugin *EditorData::get_subeditor(Object *p_object) { - for (int i = 0; i < editor_plugins.size(); i++) { + for (int i = editor_plugins.size() - 1; i > -1; i--) { if (!editor_plugins[i]->has_main_screen() && editor_plugins[i]->handles(p_object)) { return editor_plugins[i]; } @@ -283,7 +285,7 @@ EditorPlugin *EditorData::get_subeditor(Object *p_object) { Vector<EditorPlugin *> EditorData::get_subeditors(Object *p_object) { Vector<EditorPlugin *> sub_plugins; - for (int i = 0; i < editor_plugins.size(); i++) { + for (int i = editor_plugins.size() - 1; i > -1; i--) { if (!editor_plugins[i]->has_main_screen() && editor_plugins[i]->handles(p_object)) { sub_plugins.push_back(editor_plugins[i]); } @@ -292,7 +294,7 @@ Vector<EditorPlugin *> EditorData::get_subeditors(Object *p_object) { } EditorPlugin *EditorData::get_editor(String p_name) { - for (int i = 0; i < editor_plugins.size(); i++) { + for (int i = editor_plugins.size() - 1; i > -1; i--) { if (editor_plugins[i]->get_name() == p_name) { return editor_plugins[i]; } @@ -934,7 +936,13 @@ void EditorData::script_class_save_icon_paths() { } } - ProjectSettings::get_singleton()->set("_global_script_class_icons", d); + if (d.empty()) { + if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) { + ProjectSettings::get_singleton()->clear("_global_script_class_icons"); + } + } else { + ProjectSettings::get_singleton()->set("_global_script_class_icons", d); + } ProjectSettings::get_singleton()->save(); } |