Skip to content

fix(hierarchy): right-click Duplicate copies every component - #112

Open
Drima-code wants to merge 1 commit into
renzora:mainfrom
Drima-code:fix-hierarchy-duplicate
Open

Drima-code wants to merge 1 commit into
renzora:mainfrom
Drima-code:fix-hierarchy-duplicate

Conversation

@Drima-code

Copy link
Copy Markdown

Summary

Duplicate in the Hierarchy right-click menu did not duplicate anything: it spawned a new entity with only a Name and a default Transform. The "copy" had no mesh, collider, physics body or custom components and sat at the origin, so on an object at the origin it is invisible (it hides inside the original) and looks like it worked. Ctrl+D was fine. This makes the menu use the same deep clone as Ctrl+D.

Changes

  • renzora_hierarchy::native::context_menu::duplicate now deep-clones the target with EntityWorldMut::clone_and_spawn (the path renzora_gizmo::shortcuts::duplicate_entities uses for Ctrl+D) and appends (Copy) to the name, instead of spawning (Name, Transform::default()).
  • One RELEASE_NOTES.md line.

Related Issues

None filed; found while evaluating the editor for a project.

AI Assistance

Assisted-by: Claude Opus 5.5 (claude-opus-5-5)

Checklist

  • Code compiles cleanly (renzora check): not run in the container; see Testing
  • All existing tests pass (renzora test): not run in the container; see Testing
  • New tests added (if applicable): no test harness exists for the hierarchy context menu; validated in the running editor instead
  • No unrelated formatting or refactoring changes
  • Branch is up to date with main
  • I have read every line of this diff and can explain it in review
  • Any AI assistance is disclosed above and in an Assisted-by: commit trailer

Testing

Built and run natively on Linux (cargo renzora dist, Rust 1.95.0) from an r1-alpha7 checkout carrying the same change (the duplicate function is identical on main).

Repro before the fix: add a Cube, give it a Physics Body + Collision Shape (and any extra component), right-click it in the Hierarchy, Duplicate. Querying the copy over BRP (world.list_components) returned 4 components (Name, Transform, GlobalTransform, TransformTreeChanged); the original and a Ctrl+D copy had 53.

After the fix: the menu copy has the same 53 components as the Ctrl+D copy (mesh, PhysicsBodyData, CollisionShapeData, physics runtime state, custom reflected components) and survives save/reopen.

cargo clippy --profile dist --no-deps -p renzora_hierarchy -- -D warnings -A clippy::too_many_arguments -A clippy::type_complexity is clean.

The hierarchy context-menu Duplicate spawned only a Name and a default
Transform, so the "copy" had no mesh, collider or gameplay components and sat
at the origin (on top of nothing, or hidden inside the original). It now
deep-clones through clone_and_spawn, the same path the Ctrl+D shortcut uses
(renzora_gizmo::shortcuts::duplicate_entities), so both produce the same object.

Validated in a running editor: duplicating a mesh + static body + box collider
+ custom reflected components entity from the menu now yields the same
component set as Ctrl+D (53 components, previously 4).

Assisted-by: Claude Opus 5.5 (claude-opus-5-5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant