perf(scene): incremental tessellation for MOVE / COPY / ERASE

Extends the Phase 2.2 per-entity memo to the common modify commands, which
still did a full bump_geometry (whole-model re-tess + block rebuild):

- transform_entities (MOVE / ROTATE / SCALE / MIRROR) marks each
  transformed handle dirty, then bump_geometry_no_blocks;
- erase_entities drops the deleted handles from the memo and
  bump_geometry_no_blocks;
- copy_entities' new handles are natural memo misses, so just
  bump_geometry_no_blocks.

All three are top-level operations (including on inserts) that can't change
a block definition, so keeping the block cache is sound. Each now
re-tessellates only the touched entities and reuses the memoized wires for
the rest, matching the grip / line-commit path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-05 16:16:44 +03:00
1 parent eb89717b47
commit 99b7ab1176
2 files changed
+21 -6

No files matched your search

+14 -3
View File
@@ -4711,6 +4711,7 @@ impl Scene {
self.hatches.remove(&h);
self.meshes.remove(&h);
self.model_solids.remove(&h);
self.mark_entity_dirty(h);
}
// Remove erased handles from all groups; delete groups that become empty.
let group_dict_handle = self.document.header.acad_group_dict_handle;
@@ -4738,7 +4739,9 @@ impl Scene {
}
self.document.objects.remove(gh);
}
self.bump_geometry();
// Deleting top-level entities/inserts leaves block definitions intact;
// the erased handles were already dropped from the memo above.
self.bump_geometry_no_blocks();
}
// ── Group helpers ──────────────────────────────────────────────────────
@@ -4908,7 +4911,13 @@ impl Scene {
}
}
}
self.bump_geometry();
// Only the transformed entities changed (a top-level move/rotate/scale/
// mirror never edits a block definition) — re-tessellate just those and
// keep the block cache + every other entity's memoized wires.
for &h in handles {
self.mark_entity_dirty(h);
}
self.bump_geometry_no_blocks();
}
pub fn copy_entities(&mut self, handles: &[Handle], t: &EntityTransform) -> Vec<Handle> {
@@ -4939,7 +4948,9 @@ impl Scene {
}
new_handles.push(h);
}
self.bump_geometry();
// The copies are new handles (natural memo misses, tessellated fresh)
// and reference only already-cached blocks — no block defn changes.
self.bump_geometry_no_blocks();
new_handles
}