forked from 1b-agent/opencadstudio-upstream
fix(properties): recolour solid meshes on a colour/layer change
ACIS solids bake their colour into the mesh, so a property-panel or ribbon colour (or layer) change left the solid showing its old colour — only the wires, which resolve colour at render time, updated. Run recolor_meshes (now covering block-definition meshes too) when property targets are invalidated, and route the ribbon colour change through the same path. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
a492ea6300
commit
5f3eaa621c
3 files changed
+10
-2
No files matched your search
+4
-1
@@ -1095,16 +1095,19 @@ impl Scene {
|
||||
pub fn recolor_meshes(&mut self) {
|
||||
// Cache colour lookups by handle to avoid borrowing the document
|
||||
// re-entrantly through `render_style` inside a `&mut self` loop.
|
||||
// Covers both top-level solid meshes and block-definition meshes
|
||||
// (instanced per INSERT), so a solid recolours wherever it lives.
|
||||
let colors: HashMap<Handle, [f32; 4]> = self
|
||||
.meshes
|
||||
.keys()
|
||||
.chain(self.block_meshes.keys())
|
||||
.filter_map(|&h| {
|
||||
self.document
|
||||
.get_entity(h)
|
||||
.map(|e| (h, self.render_style(e).0))
|
||||
})
|
||||
.collect();
|
||||
for (h, set) in self.meshes.iter_mut() {
|
||||
for (h, set) in self.meshes.iter_mut().chain(self.block_meshes.iter_mut()) {
|
||||
if let Some(&c) = colors.get(h) {
|
||||
for lod in &mut set.lods {
|
||||
lod.color = c;
|
||||
|
||||
Reference in new issue
Block a user