fix: preserve custom properties when boolean modifier is applied during export#2713
Open
Jefsky wants to merge 1 commit into
Open
fix: preserve custom properties when boolean modifier is applied during export#2713Jefsky wants to merge 1 commit into
Jefsky wants to merge 1 commit into
Conversation
…ng export When 'Apply Modifiers' is enabled with a boolean modifier active on an object, to_mesh() creates a new evaluated mesh that may contain auto-generated properties from the modifier evaluation pipeline. The original logic only copied custom properties when the evaluated mesh had zero keys(); any existing property (even irrelevant ones) would skip the copy entirely, silently dropping Python-registered custom properties on the mesh datablock. The fix unconditionally copies non-blacklisted custom properties from the original mesh data to the evaluated mesh, using try/except to gracefully skip Blender 4.2+ statically-typed properties that cannot be overwritten. Blacklisted properties introduced by the modifier evaluation are still cleaned up.
|
|
Collaborator
|
Hello, |
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.
When "Apply Modifiers" is enabled and a Boolean modifier is active on an object, the
to_mesh()call creates a new evaluated mesh datablock. If that evaluated mesh has any auto-generated properties (e.g. from the modifier evaluation pipeline),blender_data.keys()becomes non-empty, and the old code would skip copying custom properties from the original mesh — only removing blacklisted ones. This silently drops Python-registered custom properties on Mesh datablocks.Root cause: The
if len(blender_data.keys()) == 0condition guarded the custom property copy. Any property present on the evaluated mesh (even irrelevant ones) flipped the behavior to delete-only.Fix: Unconditionally copy non-blacklisted custom properties from the original mesh data to the evaluated mesh, using try/except to gracefully skip Blender 4.2+ statically-typed properties that cannot be overwritten. Blacklisted properties introduced by the modifier evaluation are still cleaned up.
How to test:
bpy.types.Mesh(e.g.bpy.types.Mesh.testProp = bpy.props.BoolProperty(name="Test"))extrasFixes #2700