forked from 1b-agent/opencadstudio-upstream
fix(dimension): keep picture placement consistent with world-space edits
#1681 places a dimension's picture block by its insertion point, rotation and scale. Edits (move/rotate/scale/mirror, copy, paste) transform the picture's sub-entities in world space, and the codec's dimension transform moves the insertion point too, so a rotated or copied dimension would get the placement applied twice. Fold the placement into the subs before the edit and leave the dimension at the identity placement afterwards. The picture insert no longer takes the dimension's extrusion: OCS bakes picture sub-entities in world coordinates, so only the stored insertion point goes through the OCS. A zero insertion-scale component counts as 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7567724e14
commit
c5b1269cae
3 files changed
+106
-25
No files matched your search
@@ -512,9 +512,11 @@ pub(crate) fn paste_entities_kernel(
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|mut entity| {
|
||||
let picture_placement = crate::scene::render_graph::dim_picture_placement(&entity);
|
||||
if let Some(t) = translate {
|
||||
crate::scene::view::dispatch::apply_transform(&mut entity, t);
|
||||
}
|
||||
crate::scene::render_graph::clear_dim_picture_placement(&mut entity);
|
||||
// Same `*D`-block re-point as `finalize_paste` (#290, #161): the
|
||||
// baked dimension geometry lives in WCS, so the paste gets its own
|
||||
// transformed copy of the snapshotted block.
|
||||
@@ -527,6 +529,12 @@ pub(crate) fn paste_entities_kernel(
|
||||
.find(|b| b.name.eq_ignore_ascii_case(&bn))
|
||||
.map(|def| def.entities.clone())
|
||||
{
|
||||
let mut subs = subs;
|
||||
if let Some(placement) = &picture_placement {
|
||||
for sub in &mut subs {
|
||||
crate::scene::view::dispatch::apply_transform(sub, placement);
|
||||
}
|
||||
}
|
||||
let bt = translate.cloned().unwrap_or(
|
||||
crate::command::EntityTransform::Translate(glam::DVec3::ZERO),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user