Godot Engine – Multi-platform 2D and 3D game engine
Fix context menu not opening favorite sections in Editor Inspector and remove the unused inspector_path concept
Shadermancc4055c5a252
diff --git a/editor/inspector/editor_inspector.cpp b/editor/inspector/editor_inspector.cppindex 386ec6caa33..da0112d7f67 100644--- a/editor/inspector/editor_inspector.cpp+++ b/editor/inspector/editor_inspector.cpp@@ -2529,10 +2529,9 @@ Control *EditorInspectorSection::make_custom_tooltip(const String &p_text) constreturn nullptr;}-void EditorInspectorSection::setup(const String &p_inspector_path, const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth, int p_level) {+void EditorInspectorSection::setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth, int p_level) {section = p_section;label = p_label;- inspector_path = p_inspector_path;object = p_object;bg_color = p_bg_color;foldable = p_foldable;@@ -2634,7 +2633,7 @@ void EditorInspectorSection::gui_input(const Ref<InputEvent> &p_event) {fold();}}- } else if ((!checkable || checked) && !inspector_path.is_empty() && mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {+ } else if ((!checkable || checked) && mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {accept_event();_update_popup();menu->set_position(get_screen_position() + get_local_mouse_position());@@ -3633,7 +3632,7 @@ void EditorInspectorArray::setup_with_move_element_function(Object *p_object, copage_length = p_page_length;numbered = p_numbered;- EditorInspectorSection::setup(p_category + "/" + p_label.to_lower(), String(p_array_element_prefix) + "_array", p_label, p_object, p_bg_color, p_foldable, 0);+ EditorInspectorSection::setup(String(p_array_element_prefix) + "_array", p_label, p_object, p_bg_color, p_foldable, 0);_setup();}@@ -3650,7 +3649,7 @@ void EditorInspectorArray::setup_with_count_property(Object *p_object, const Strswap_method = p_swap_method;add_button->set_text(p_add_item_text);- EditorInspectorSection::setup(p_category + "/" + p_label.to_lower(), String(count_property) + "_array", p_label, p_object, p_bg_color, p_foldable, 0);+ EditorInspectorSection::setup(String(count_property) + "_array", p_label, p_object, p_bg_color, p_foldable, 0);_setup();}@@ -4616,7 +4615,7 @@ void EditorInspector::update_tree() {Color c = sscolor;c.a /= level;- section->setup((doc_name.is_empty() ? acc_path : String(doc_name) + (acc_path.is_empty() ? "" : "/" + acc_path)), acc_path, label, object, c, use_folding, section_depth, level);+ section->setup(acc_path, label, object, c, use_folding, section_depth, level);section->set_tooltip_text(tooltip);section->connect("section_toggled_by_user", callable_mp(this, &EditorInspector::_section_toggled_by_user));@@ -5044,7 +5043,7 @@ void EditorInspector::update_tree() {favorites_groups_vbox->add_child(section);parent_vbox = section->get_vbox();- section->setup("", "", section_name, object, sscolor, false);+ section->setup("", section_name, object, sscolor, false);section->set_tooltip_text(tooltip);if (togglable_editor_inspector_sections.has(section_name)) {@@ -5083,7 +5082,7 @@ void EditorInspector::update_tree() {get_root_inspector()->get_v_scroll_bar()->connect(SceneStringName(value_changed), callable_mp(section, &EditorInspectorSection::reset_timer).unbind(1));vbox->add_child(section);vbox = section->get_vbox();- section->setup("", "", section_name, object, sscolor, false);+ section->setup("", section_name, object, sscolor, false);section->set_tooltip_text(tooltip);if (togglable_editor_inspector_sections.has(KV.key + "/" + section_name)) {diff --git a/editor/inspector/editor_inspector.h b/editor/inspector/editor_inspector.hindex cc8801ecdcd..9355d094319 100644--- a/editor/inspector/editor_inspector.h+++ b/editor/inspector/editor_inspector.h@@ -458,7 +458,6 @@ class EditorInspectorSection : public Container {String label;String section;- String inspector_path;Color bg_color;bool vbox_added = false; // Optimization.bool foldable = false;@@ -548,10 +547,9 @@ public:virtual Size2 get_minimum_size() const override;virtual Control *make_custom_tooltip(const String &p_text) const override;- void setup(const String &p_inspector_path, const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth = 0, int p_level = 1);+ void setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth = 0, int p_level = 1);String get_section() const;String get_label() const { return label; }- String get_inspector_path() const { return inspector_path; }VBoxContainer *get_vbox();void unfold();void fold();diff --git a/editor/scene/3d/skeleton_3d_editor_plugin.cpp b/editor/scene/3d/skeleton_3d_editor_plugin.cppindex a7bc4c3cb21..8d60face3bb 100644--- a/editor/scene/3d/skeleton_3d_editor_plugin.cpp+++ b/editor/scene/3d/skeleton_3d_editor_plugin.cpp@@ -56,7 +56,7 @@void BonePropertiesEditor::create_editors() {section = memnew(EditorInspectorSection);- section->setup("", "trf_properties", label, this, Color(0.0f, 0.0f, 0.0f), true);+ section->setup("trf_properties", label, this, Color(0.0f, 0.0f, 0.0f), true);section->unfold();add_child(section);@@ -111,7 +111,7 @@ void BonePropertiesEditor::create_editors() {// Transform/Matrix section.rest_section = memnew(EditorInspectorSection);- rest_section->setup("", "trf_properties_transform", "Rest", this, Color(0.0f, 0.0f, 0.0f), true);+ rest_section->setup("trf_properties_transform", "Rest", this, Color(0.0f, 0.0f, 0.0f), true);section->get_vbox()->add_child(rest_section);// Transform/Matrix property.@@ -123,7 +123,7 @@ void BonePropertiesEditor::create_editors() {// Bone Metadata propertymeta_section = memnew(EditorInspectorSection);- meta_section->setup("", "bone_meta", TTR("Bone Metadata"), this, Color(.0f, .0f, .0f), true);+ meta_section->setup("bone_meta", TTR("Bone Metadata"), this, Color(.0f, .0f, .0f), true);section->get_vbox()->add_child(meta_section);EditorInspectorActionButton *add_metadata_button = memnew(EditorInspectorActionButton(TTRC("Add Bone Metadata"), SNAME("Add")));@@ -1185,7 +1185,7 @@ void Skeleton3DEditor::create_editors() {// Bone tree.bones_section = memnew(EditorInspectorSection);- bones_section->setup("", "bones", "Bones", skeleton, Color(0.0f, 0.0, 0.0f), true);+ bones_section->setup("bones", "Bones", skeleton, Color(0.0f, 0.0, 0.0f), true);add_child(bones_section);bones_section->unfold();