Bonsai: reload external styles from .blend in update_current_style - #9478
Open
theoryshaw wants to merge 1 commit into
Open
theoryshaw wants to merge 1 commit into
theoryshaw wants to merge 1 commit into
Conversation
Since the Flat/Pretty dual-branch change (IfcOpenShell#8342), setting a material's active_style_type to External only flips the cached BIM_Output_External / BIM_Output_Flat outputs, so the refresh button next to the style type dropdown no longer picked up edits made to the external .blend material. When the style type is External, re-append the external style via bim.activate_external_style (which replaces the external branch of dual-branch materials) for each updated material, and for all IFC materials on SHIFT+CLICK. switch_shading keeps its fast path so viewport shading changes and the Flat/Pretty toggle stay disk-free. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9477
The Update Current Style refresh button in the Styles panel (
bim.update_current_style, added for #3293) stopped reloading external.blendstyles after the Flat/Pretty dual-branch change in #8342. For a material that already has both branches, settingactive_style_typeonly switches betweenBIM_Output_ExternalandBIM_Output_Flat, sobim.activate_external_styleis never called and edits to the external material never come through.Changes
UpdateCurrentStylenow calls a newreload_external_style()for each material it updates when the style type is External, and for every IFC material on SHIFT+CLICK. It only runs for styles whose externalLocationis a.blendfile, and it reports a warning if loading fails.Style.update_external_branch(), which replaces only the external branch and leaves the flat branch alone.Style.switch_shading()is unchanged. Viewport shading changes and the Flat/Pretty toggle setactive_style_typeon every material, and they should keep switching without reading from disk..blendfile.Testing
Tested manually in Blender on a model whose materials use external styles from a shared
Materials.blend. After editing and saving materials in that file, clicking the button reloaded each selected object's materials (activate_external_stylereturned{'FINISHED'}for each), and the changes appeared in the viewport.🤖 Generated with Claude Code