diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 9110238370..30a2a2143c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2041,18 +2041,6 @@ void EditorNode::_dialog_action(String p_file) { } } -bool EditorNode::item_has_editor(Object *p_object) { - if (_is_class_editor_disabled_by_feature_profile(p_object->get_class())) { - return false; - } - - return editor_data.get_subeditors(p_object).size() > 0; -} - -void EditorNode::edit_item_resource(Ref<Resource> p_resource) { - edit_item(p_resource.ptr()); -} - bool EditorNode::_is_class_editor_disabled_by_feature_profile(const StringName &p_class) { Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); if (profile.is_null()) { @@ -2075,37 +2063,43 @@ bool EditorNode::_is_class_editor_disabled_by_feature_profile(const StringName & } void EditorNode::edit_item(Object *p_object) { - Vector<EditorPlugin *> sub_plugins; + if (p_object && _is_class_editor_disabled_by_feature_profile(p_object->get_class())) { + return; + } + Vector<EditorPlugin *> top_plugins = editor_plugins_over->get_plugins_list(); + Vector<EditorPlugin *> item_plugins; if (p_object) { - if (_is_class_editor_disabled_by_feature_profile(p_object->get_class())) { - return; - } - sub_plugins = editor_data.get_subeditors(p_object); + item_plugins = editor_data.get_subeditors(p_object); } - if (!sub_plugins.is_empty()) { + if (!item_plugins.is_empty()) { bool same = true; - if (sub_plugins.size() == editor_plugins_over->get_plugins_list().size()) { - for (int i = 0; i < sub_plugins.size(); i++) { - if (sub_plugins[i] != editor_plugins_over->get_plugins_list()[i]) { + if (item_plugins.size() == top_plugins.size()) { + for (int i = 0; i < item_plugins.size(); i++) { + if (item_plugins[i] != top_plugins[i]) { same = false; } } } else { same = false; } + if (!same) { _display_top_editors(false); - _set_top_editors(sub_plugins); + _set_top_editors(item_plugins); } _set_editing_top_editors(p_object); _display_top_editors(true); - } else { + } else if (!top_plugins.is_empty()) { hide_top_editors(); } } +void EditorNode::edit_item_resource(Ref<Resource> p_resource) { + edit_item(p_resource.ptr()); +} + void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) { if (!p_object) { InspectorDock::get_inspector_singleton()->edit(nullptr); @@ -2351,21 +2345,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) { } } - Vector<EditorPlugin *> sub_plugins; - - if (!_is_class_editor_disabled_by_feature_profile(current_obj->get_class())) { - sub_plugins = editor_data.get_subeditors(current_obj); - } - - if (!sub_plugins.is_empty()) { - _display_top_editors(false); - - _set_top_editors(sub_plugins); - _set_editing_top_editors(current_obj); - _display_top_editors(true); - } else if (!editor_plugins_over->get_plugins_list().is_empty()) { - hide_top_editors(); - } + edit_item(current_obj); } InspectorDock::get_singleton()->update(current_obj); @@ -5939,8 +5919,6 @@ void EditorNode::_bind_methods() { ClassDB::bind_method("_set_main_scene_state", &EditorNode::_set_main_scene_state); ClassDB::bind_method("_update_recent_scenes", &EditorNode::_update_recent_scenes); - ClassDB::bind_method("edit_item_resource", &EditorNode::edit_item_resource); - ClassDB::bind_method(D_METHOD("get_gui_base"), &EditorNode::get_gui_base); ADD_SIGNAL(MethodInfo("play_pressed")); |