Skip to content

Commit 7f0ccec

Browse files
committed
Copy/paste, deep-clone duplicate, floor-align paste, camera-facing gizmo
Duplicate (Ctrl+D) now uses Bevy's EntityWorldMut::clone_and_spawn so every component transfers (mesh, material, children, etc.). Previously only Name + Transform were copied, so the duplicate appeared in the hierarchy with no visible mesh. Copy / Paste: - EditorAction::Copy (Ctrl+C) and EditorAction::Paste (Ctrl+V), both rebindable in Settings -> Shortcuts under Edit. - Copy snapshots the current selection into an EditorClipboard resource. Paste deep-clones each entity, skipping ones that were despawned between copy and paste. - Cursor-aware paste: if the cursor is over the viewport, the pasted group's XZ centroid lands on the ground-plane hit and the group's lowest mesh AABB bottom sits at y=0 (so a Cuboid goes from 0..height instead of half below the floor). Over a panel, paste uses the sources' original positions. Camera-facing move gizmo: - Each of X / Y / Z arrows flips per-axis so the handle always points toward the viewing camera. Computed from cam-pivot direction; frozen while a drag is in progress so axes don't flip out from under the user mid-drag. - Applied via negative components of the gizmo root's scale; drag and hover detection use the signed axis so motion matches the visual. - GizmoMaterial now disables backface culling so the mirrored cone heads / scale cubes render correctly under inverted winding. Plane handles (XY / XZ / YZ) keep their original quadrant for v1.
1 parent 267bfa4 commit 7f0ccec

2 files changed

Lines changed: 268 additions & 36 deletions

File tree

crates/core/renzora_core/src/keybindings.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ pub enum EditorAction {
4242
Undo,
4343
Redo,
4444
CreateNode,
45+
Copy,
46+
Paste,
4547

4648
// File operations
4749
SaveScene,
@@ -96,6 +98,8 @@ impl EditorAction {
9698
EditorAction::Undo => "Undo",
9799
EditorAction::Redo => "Redo",
98100
EditorAction::CreateNode => "Create Node",
101+
EditorAction::Copy => "Copy",
102+
EditorAction::Paste => "Paste",
99103
EditorAction::SaveScene => "Save Scene",
100104
EditorAction::SaveSceneAs => "Save Scene As",
101105
EditorAction::OpenScene => "Open Scene",
@@ -139,7 +143,11 @@ impl EditorAction {
139143

140144
EditorAction::SelectUnderCursor | EditorAction::Delete | EditorAction::Duplicate | EditorAction::DuplicateAndMove | EditorAction::Deselect => "Selection",
141145

142-
EditorAction::Undo | EditorAction::Redo | EditorAction::CreateNode => "Edit",
146+
EditorAction::Undo
147+
| EditorAction::Redo
148+
| EditorAction::CreateNode
149+
| EditorAction::Copy
150+
| EditorAction::Paste => "Edit",
143151

144152
EditorAction::SaveScene
145153
| EditorAction::SaveSceneAs
@@ -189,6 +197,8 @@ impl EditorAction {
189197
EditorAction::Undo,
190198
EditorAction::Redo,
191199
EditorAction::CreateNode,
200+
EditorAction::Copy,
201+
EditorAction::Paste,
192202
EditorAction::SaveScene,
193203
EditorAction::SaveSceneAs,
194204
EditorAction::OpenScene,
@@ -322,6 +332,8 @@ impl Default for KeyBindings {
322332
bindings.insert(EditorAction::Undo, KeyBinding::new(KeyCode::KeyZ).ctrl());
323333
bindings.insert(EditorAction::Redo, KeyBinding::new(KeyCode::KeyY).ctrl());
324334
bindings.insert(EditorAction::CreateNode, KeyBinding::new(KeyCode::KeyA).ctrl());
335+
bindings.insert(EditorAction::Copy, KeyBinding::new(KeyCode::KeyC).ctrl());
336+
bindings.insert(EditorAction::Paste, KeyBinding::new(KeyCode::KeyV).ctrl());
325337

326338
// File defaults
327339
bindings.insert(EditorAction::SaveScene, KeyBinding::new(KeyCode::KeyS).ctrl());

0 commit comments

Comments
 (0)