git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

commit82cb939af27263af50e920c50e5b42856037fe35
parent7e4d8b92c8
authorLucas Galante <[email protected]>
date2026-09-18 21:52
fix(export): borrow the target node, do not clone it

`--export <node>` cloned the node it found by name, then handed the clone
to the resolver. Several generators locate themselves in the scene with
`find_sphere_index`, which identifies the target by POINTER — so a clone
is a node the walk never recognizes, `find_sphere_index` returns None,
and the resolver returns nothing.

A sphere exported this way wrote an empty file and said nothing about it.

Co-Authored-By: Claude Opus 5 <[email protected]>

 src/export_cli.rs | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/export_cli.rs b/src/export_cli.rs
index cc9e0b3..1d0c243 100644
--- a/src/export_cli.rs
+++ b/src/export_cli.rs
@@ -41,13 +41,16 @@ pub fn run(
 
     let geom = match &node {
         Some(name) => {
+            // Borrowed, NOT cloned. Several generators find their place in the
+            // scene with `find_sphere_index`, which identifies the target by
+            // POINTER — so a clone is a node the walk never recognizes, and a
+            // sphere exported this way silently produced nothing.
             let target = crate::geometry::find_node_by_name(&proj.root, name)
-                .ok_or_else(|| format!("no node named '{name}'"))?
-                .clone();
+                .ok_or_else(|| format!("no node named '{name}'"))?;
             let mut visited = Vec::new();
             crate::geometry::generate_single_node_geometry_with_errors(
                 &proj.root,
-                &target,
+                target,
                 &mut visited,
                 &mut ocl_error,
                 &mut sim,