X Tutup
Skip to content

Add support for copy/paste of section/category properties#111469

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
Raftatul:Copy/PasteGroup/CategoryProperties
Feb 26, 2026
Merged

Add support for copy/paste of section/category properties#111469
Repiteo merged 1 commit intogodotengine:masterfrom
Raftatul:Copy/PasteGroup/CategoryProperties

Conversation

@Raftatul
Copy link
Contributor

@Raftatul Raftatul commented Oct 10, 2025

Fixes: godotengine/godot-proposals#13343

Screen.Recording.2025-10-10.025134.mp4

@AThousandShips AThousandShips added this to the 4.x milestone Oct 10, 2025
@AThousandShips AThousandShips changed the title Copy/paste group/category properties Add support for copy/paste of group/category properties Oct 10, 2025
@Raftatul Raftatul force-pushed the Copy/PasteGroup/CategoryProperties branch from 6c550c1 to e4d829f Compare October 11, 2025 01:35
@Raftatul Raftatul marked this pull request as ready for review October 11, 2025 22:03
@Raftatul Raftatul requested review from a team October 11, 2025 22:03
@YeldhamDev
Copy link
Member

YeldhamDev commented Oct 12, 2025

Pasting when there was nothing copied creates an action named "Set category/group <null>".

Also, the fact that the paste action in the popup uses "category" or "group" in the name is odd since "Paste Group Values" will actually paste a category if that's what you have copied. It should just be "Paste Copied Values" instead.

@Raftatul
Copy link
Contributor Author

Pasting when there was nothing copied creates an action named "Set category/group ".

Also, the fact that the paste action in the popup uses "category" or "group" in the name is odd since "Paste Group Values" will actually paste a category if that's what you have copied. It should just be "Paste Copied Values" instead.

I think copying properties from a category and pasting them into a group within that category should only paste the group's properties. This allows you to paste multiple groups within a single category without having to copy each group individually.

But if the properties of a category are pasted into a group that is in another category, nothing should happen.

@Raftatul Raftatul force-pushed the Copy/PasteGroup/CategoryProperties branch 2 times, most recently from 1024aac to b54c883 Compare October 12, 2025 06:58
@YeldhamDev
Copy link
Member

Feature seems to be working well. Those commits need to be squashed, however.

@Raftatul Raftatul force-pushed the Copy/PasteGroup/CategoryProperties branch from b54c883 to 79b3fa4 Compare October 12, 2025 16:41
Copy link
Member

@YeldhamDev YeldhamDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature-wise, everything seems to be working fine.

@Raftatul Raftatul force-pushed the Copy/PasteGroup/CategoryProperties branch from 1934d9b to 23cc324 Compare October 12, 2025 20:27
@Raftatul Raftatul force-pushed the Copy/PasteGroup/CategoryProperties branch 2 times, most recently from 8f29df4 to 4ccf52b Compare October 13, 2025 00:44
@Raftatul
Copy link
Contributor Author

I found unexpected behavior when pasting on multiple nodes.

Screen.Recording.2025-10-13.130423.mp4

@Raftatul
Copy link
Contributor Author

I found unexpected behavior when pasting on multiple nodes.
Screen.Recording.2025-10-13.130423.mp4

Could this come from the way I'm doing the undo/redo ?
image

@KoBeWi
Copy link
Member

KoBeWi commented Oct 13, 2025

The undo/redo usage looks correct, but for some reason it creates "Set category" as global action and makes individual action for each property. Something is wrong.

@Raftatul
Copy link
Contributor Author

Raftatul commented Oct 13, 2025

Yeah, the thing is, this code

LocalVector<String> properties;
const String action_name = vformat(TTR("Set group %s on node %s"), group_name, object->get("name"));

_collect_properties(properties);

EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(action_name);

for (const String &property_name : properties) {
	undo_redo->add_do_property(object, property_name, clipboard[property_name]);
	undo_redo->add_undo_property(object, property_name, object->get(property_name));
}

undo_redo->commit_action();

Is only called for the object that is selected in the inspector (so the last one selected?). So the values pasted onto the other object are handled by something else.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 14, 2025

Ok I see what's the problem, but fixing it will involve modifying MultiNodeEdit.
MultiNodeEdit has undo/redo built-in in its _set() method. If you call add_do_property() on it, the undo action will cause another undo action. MultiNodeEdit itself is not recognized as part of the scene, hence there is history mismatch on to of that.

This is a bit messy, so I think you can just put a big FIXME comment and I will do a follow-up PR once this is merged.

EDIT:
Actually I came up with how to implement it independently. I will open a fix later today.

@Raftatul Raftatul requested review from a team as code owners February 25, 2026 18:51
@Raftatul
Copy link
Contributor Author

Could you squash your commits? See our pull request guidelines for more information

Done

Co-Authored-By: Tomasz Chabora <2223172+KoBeWi@users.noreply.github.com>
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
@Repiteo
Copy link
Contributor

Repiteo commented Feb 26, 2026

Thanks!

@Foyezes
Copy link

Foyezes commented Mar 5, 2026

Does not seem to work on ShaderMaterial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy/Paste Group/Category Properties

8 participants

X Tutup