Skip to content

Commit a4a9ed4

Browse files
authored
Prevent repeated paste from nesting actors as children (#766)
1 parent 980938b commit a4a9ed4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Sources/OvEditor/include/OvEditor/Core/EditorActions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ namespace OvEditor::Core
235235
void CopyActor(OvCore::ECS::Actor& p_actor);
236236

237237
/**
238-
* Paste the copied actor, optionally as a child of the given parent
238+
* Paste the copied actor next to the given actor (same parent), or at root if null
239239
* @param p_parent
240240
*/
241241
void PasteActor(OvCore::ECS::Actor* p_parent = nullptr);

Sources/OvEditor/src/OvEditor/Core/EditorActions.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,11 +907,11 @@ void OvEditor::Core::EditorActions::PasteActor(OvCore::ECS::Actor* p_parent)
907907
{
908908
auto* destinationParent = p_parent;
909909

910-
// Pasting on the copied actor itself falls back to its current parent,
911-
// preserving the "duplicate-like" behavior by default.
912-
if (destinationParent && destinationParent->GetGUID() == copiedActor->GetGUID())
910+
// Pasted actors are always inserted next to the target actor (same parent),
911+
// never as children.
912+
if (destinationParent)
913913
{
914-
destinationParent = copiedActor->GetParent();
914+
destinationParent = destinationParent->GetParent();
915915
}
916916

917917
DuplicateActor(*copiedActor, destinationParent, true);

0 commit comments

Comments
 (0)