Set geometry when transforming curve

This commit is contained in:
Hanno Braun 2024-04-30 12:39:46 +02:00
parent b143ffb8cf
commit 8d0739f0d5

View File

@ -18,7 +18,27 @@ impl TransformObject for Handle<Curve> {
// must be created to represent the new and transformed curve.
cache
.entry(self)
.or_insert_with(|| Curve::new().insert(core))
.or_insert_with(|| {
// We don't actually need to transform the curve, as its
// geometry is locally defined on a surface. We need to set that
// geometry for the new object though, that we created here to
// represent the transformed curve.
let curve = Curve::new().insert(core);
let curve_geom = core.layers.geometry.of_curve(self).cloned();
if let Some(curve_geom) = curve_geom {
for (surface, local_definition) in curve_geom.definitions {
core.layers.geometry.define_curve(
curve.clone(),
surface,
local_definition,
);
}
}
curve
})
.clone()
}
}