Skip to content

Commit 6e8169f

Browse files
sheazywiclaude
andcommitted
Scene: carry TagComponent lock/label on copy and duplicate
TagComponent is excluded from AllComponents/DuplicateComponents (its name is copied specially at entity creation), so the editor-only Locked and LabelColor fields were dropped by Scene::Copy and DuplicateEntity — Ctrl+D on a locked or colour-labelled entity produced a bare duplicate. Carry both fields explicitly in both paths, alongside the name copy. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZz1zmqCagPaqQwAu6Ci9x
1 parent fc613f3 commit 6e8169f

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

Core/Source/Lux/Scene/Scene.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,12 @@ namespace Lux {
228228
for (auto e : idView)
229229
{
230230
UUID uuid = srcSceneRegistry.get<IDComponent>(e).ID;
231-
const auto& name = srcSceneRegistry.get<TagComponent>(e).Tag;
232-
Entity newEntity = newScene->CreateEntityWithUUID(uuid, name);
231+
const auto& srcTag = srcSceneRegistry.get<TagComponent>(e);
232+
Entity newEntity = newScene->CreateEntityWithUUID(uuid, srcTag.Tag);
233+
// TagComponent is created by name above; carry its editor-only lock/label state too.
234+
auto& dstTag = newEntity.GetComponent<TagComponent>();
235+
dstTag.Locked = srcTag.Locked;
236+
dstTag.LabelColor = srcTag.LabelColor;
233237
enttMap[uuid] = (entt::entity)newEntity;
234238
}
235239

@@ -956,6 +960,12 @@ namespace Lux {
956960
Entity destination = CreateEntity(source.GetName());
957961
CopyComponentIfExists(DuplicateComponents{}, destination, source);
958962

963+
// TagComponent isn't in DuplicateComponents (name is set above); carry the editor lock/label.
964+
const auto& srcTag = source.GetComponent<TagComponent>();
965+
auto& dstTag = destination.GetComponent<TagComponent>();
966+
dstTag.Locked = srcTag.Locked;
967+
dstTag.LabelColor = srcTag.LabelColor;
968+
959969
if (parent)
960970
ParentEntity(destination, parent);
961971

0 commit comments

Comments
 (0)