@@ -1790,7 +1790,7 @@ void EditorInspectorCategory::_handle_menu_option(int p_option) {
17901790 Vector<String> properties;
17911791 _collect_properties (object, properties);
17921792
1793- clipboard[" category_name " ] = label ;
1793+ clipboard[" path " ] = doc_class_name ;
17941794 for (String property_name : properties) {
17951795 clipboard[property_name] = object->get (property_name);
17961796 }
@@ -1800,7 +1800,12 @@ void EditorInspectorCategory::_handle_menu_option(int p_option) {
18001800 case MENU_PASTE_VALUE: {
18011801 Object *object = EditorInterface::get_singleton ()->get_inspector ()->get_edited_object ();
18021802 Dictionary clipboard = InspectorDock::get_inspector_singleton ()->get_property_clipboard ();
1803- String category_name = clipboard[" category_name" ];
1803+ String category_name = clipboard[" path" ];
1804+
1805+ if (category_name != doc_class_name) {
1806+ break ;
1807+ }
1808+
18041809 String action_name = " Set category " + category_name;
18051810
18061811 EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton ();
@@ -2548,7 +2553,6 @@ void EditorInspectorSection::_collect_properties(Vector<String> &p_properties) c
25482553 current_category = prop_info.name ;
25492554 current_group = " " ;
25502555 current_subgroup = " " ;
2551-
25522556 continue ;
25532557 }
25542558 if (!(prop_info.usage & PROPERTY_USAGE_EDITOR)) {
@@ -2573,28 +2577,36 @@ void EditorInspectorSection::_collect_properties(Vector<String> &p_properties) c
25732577 }
25742578}
25752579
2576- void EditorInspectorSection::menu_option (int p_option) {
2580+ void EditorInspectorSection::menu_option (int p_option) const {
25772581 switch (p_option) {
25782582 case MENU_COPY_VALUE: {
25792583 Vector<String> properties;
25802584 Dictionary clipboard;
25812585 _collect_properties (properties);
25822586
2583- clipboard[" group_name " ] = section ;
2587+ clipboard[" path " ] = get_inspector_path () ;
25842588 for (String property_name : properties) {
25852589 clipboard[property_name] = object->get (property_name);
25862590 }
25872591 InspectorDock::get_inspector_singleton ()->set_property_clipboard (clipboard);
25882592 } break ;
25892593 case MENU_PASTE_VALUE: {
25902594 Dictionary clipboard = InspectorDock::get_inspector_singleton ()->get_property_clipboard ();
2591- String group_name = clipboard[" group_name" ];
2595+ String group_name = clipboard[" path" ];
2596+
2597+ if (!get_inspector_path ().begins_with (group_name)) {
2598+ break ;
2599+ }
2600+
2601+ Vector<String> properties;
25922602 String action_name = " Set group " + group_name;
25932603
2604+ _collect_properties (properties);
2605+
25942606 EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton ();
25952607 undo_redo->create_action (action_name);
25962608
2597- for (String property_name : clipboard. keys () ) {
2609+ for (String property_name : properties ) {
25982610 Variant value = clipboard[property_name];
25992611 undo_redo->add_do_property (object, property_name, value);
26002612 undo_redo->add_undo_property (object, property_name, object->get (property_name));
0 commit comments