forked from 1b-agent/opencadstudio-upstream
Block definitions tessellate their solids
A block defined from objects (imported STEP products, pasted blocks, recreated or redefined definitions) left its solids, surfaces and meshes without the instanced block meshes they draw through, so their inserts showed nothing until the drawing was reopened. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
659bb06cd6
commit
2019964591
1 file changed
+12
-4
+12
-4
@@ -1349,6 +1349,9 @@ impl Scene {
|
||||
.map_err(|e| e.to_string())?;
|
||||
entity_handles.push(handle);
|
||||
}
|
||||
// Solids, surfaces and meshes of a definition draw through their
|
||||
// instanced block meshes, which only a tessellation pass creates.
|
||||
self.refresh_meshes_for_handles(&entity_handles);
|
||||
// Block defns don't render on their own, but the geometry cache must
|
||||
// pick up the new definition so the interactive insert can preview it.
|
||||
self.bump_geometry();
|
||||
@@ -1391,12 +1394,14 @@ impl Scene {
|
||||
block_end.common.owner_handle = br_handle;
|
||||
let _ = self.document.add_entity(EntityType::BlockEnd(block_end));
|
||||
|
||||
let mut added = Vec::new();
|
||||
for mut entity in entities {
|
||||
Self::reset_clone_subhandles(&mut self.document, &mut entity);
|
||||
entity.common_mut().handle = Handle::NULL;
|
||||
entity.common_mut().owner_handle = br_handle;
|
||||
let _ = self.document.add_entity(entity);
|
||||
added.extend(self.document.add_entity(entity).ok());
|
||||
}
|
||||
self.refresh_meshes_for_handles(&added);
|
||||
self.bump_geometry();
|
||||
}
|
||||
|
||||
@@ -1446,18 +1451,21 @@ impl Scene {
|
||||
})
|
||||
.map(|e| e.common().handle)
|
||||
.collect();
|
||||
for h in owned {
|
||||
self.document.remove_entity(h);
|
||||
for h in &owned {
|
||||
self.document.remove_entity(*h);
|
||||
}
|
||||
if let Some(EntityType::Block(block)) = self.document.get_entity_mut(block_handle) {
|
||||
block.base_point = base_point;
|
||||
}
|
||||
// The old contents' meshes go with them; the new ones are built.
|
||||
let mut changed = owned;
|
||||
for mut entity in entities {
|
||||
Self::reset_clone_subhandles(&mut self.document, &mut entity);
|
||||
entity.common_mut().handle = Handle::NULL;
|
||||
entity.common_mut().owner_handle = br_handle;
|
||||
let _ = self.document.add_entity(entity);
|
||||
changed.extend(self.document.add_entity(entity).ok());
|
||||
}
|
||||
self.refresh_meshes_for_handles(&changed);
|
||||
self.bump_geometry();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user