From ff1153a39c8c151dfb6e80b670fb1b08da7dccc6 Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 30 Mar 2026 13:34:25 +0200 Subject: [PATCH] Rework copy-pasting section/category values --- editor/inspector/editor_inspector.cpp | 168 ++++++++------------------ editor/inspector/editor_inspector.h | 8 ++ 2 files changed, 60 insertions(+), 116 deletions(-) diff --git a/editor/inspector/editor_inspector.cpp b/editor/inspector/editor_inspector.cpp index c1532f5c68..a49d15fc04 100644 --- a/editor/inspector/editor_inspector.cpp +++ b/editor/inspector/editor_inspector.cpp @@ -703,6 +703,28 @@ void EditorProperty::_notification(int p_what) { get_parent()->connect(SceneStringName(theme_changed), callable_mp(this, &EditorProperty::_update_property_bg)); _update_property_bg(); } + + Node *parent = get_parent(); + Node *prev_parent = nullptr; + while (parent && parent != inspector) { + if (prev_parent && parent->get_meta(SNAME("_has_categories"), false).operator bool()) { + for (int i = prev_parent->get_index() - 1; i >= 0; i--) { + EditorInspectorCategory *category = Object::cast_to(parent->get_child(i)); + if (category) { + category->register_property(this); + break; + } + } + break; + } + + EditorInspectorSection *section = Object::cast_to(parent); + if (section) { + section->register_property(this); + } + prev_parent = parent; + parent = parent->get_parent(); + } } break; case NOTIFICATION_EXIT_TREE: { @@ -1740,6 +1762,13 @@ void EditorInspectorCategory::_notification(int p_what) { connect(SceneStringName(theme_changed), callable_mp(this, &EditorInspectorCategory::_theme_changed)); } break; + case NOTIFICATION_ENTER_TREE: { + VBoxContainer *parent_vbox = Object::cast_to(get_parent()); + if (parent_vbox) { + parent_vbox->set_meta(SNAME("_has_categories"), true); + } + } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { RID ae = get_accessibility_element(); ERR_FAIL_COND(ae.is_null()); @@ -1894,20 +1923,9 @@ void EditorInspectorCategory::_collect_properties(const Object *p_object, LocalV void EditorInspectorCategory::_handle_menu_option(int p_option) { switch (p_option) { case MENU_COPY_VALUE: { - const Object *object = EditorInterface::get_singleton()->get_inspector()->get_edited_object(); - String category_name = info.name; - if (!EditorNode::get_editor_data().is_type_recognized(info.name) && ResourceLoader::exists(info.hint_string, "Script")) { - Ref