Skip to content

Fix IfcSurfaceStyleRendering colour reset on save#7882

Open
falken10vdl wants to merge 1 commit intoIfcOpenShell:v0.8.0from
falken10vdl:fix/surface-style-null-colour-reset
Open

Fix IfcSurfaceStyleRendering colour reset on save#7882
falken10vdl wants to merge 1 commit intoIfcOpenShell:v0.8.0from
falken10vdl:fix/surface-style-null-colour-reset

Conversation

@falken10vdl
Copy link
Copy Markdown
Contributor

@falken10vdl falken10vdl commented Apr 1, 2026

Problem

When an IfcSurfaceStyleRendering had DiffuseColour, SpecularColour, or SpecularHighlight set to null in the IFC file, loading the style into the Bonsai panel set the corresponding is_*_null flag to True. Editing the colour picker did not clear the flag. On save, get_shading_style_data_from_props read the flag and wrote None back, discarding the user's change and resetting the material to its default colour.

  1. tool/style.pyget_shading_style_data_from_props: before reading a colour prop, check the corresponding null flag. If it is set, write None and skip. This makes live-preview and save agree on null vs. non-null.

  2. bim/module/style/prop.py: a _make_clear_null_updater factory produces named callbacks that clear the null flag via dict access (self[is_..._null] = False) before delegating to update_shader_graph. The three aliases (update_diffuse_colour, update_specular_colour, update_specular_highlight_value) are wired to all colour/ratio/class pickers. The null BoolProperty toggles are also wired to update_shader_graph so toggling them triggers an immediate preview rebuild.

Cheers!

@falken10vdl falken10vdl force-pushed the fix/surface-style-null-colour-reset branch from d4f280d to 38a660e Compare April 1, 2026 14:07
@theoryshaw
Copy link
Copy Markdown
Member

Nice! I ran into this quite a bit. It's funny how some bugs you just live with, without reporting. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants