fix(bonsai): resolve TypeError when importing Quick Favorites with Enum values (Resolves #7773)#7933
Open
dipayansardar73-decode wants to merge 4 commits intoIfcOpenShell:v0.8.0from
Conversation
added 4 commits
April 11, 2026 12:21
…structure of void or symbolic nodes (Resolves IfcOpenShell#7801, Resolves IfcOpenShell#7861)
…um values (Resolves IfcOpenShell#7773)
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 #7773
Description
This PR resolves a TypeError that occurred when running bim.import_quick_favorites in Bonsai.
The Bug:
Blender's internal metadata for the Quick Favorites menu sometimes stores property values as integer indices for EnumProperty fields. However, when Bonsai attempts to synchronize these values into its own internal PropertyGroup representations, it uses setattr on EnumProperty fields which expects a string identifier, not an integer. This caused a fatal TypeError: expected a string enum, not int, preventing the import from completing successfully.
The Fix:
I've added a robust guard in QuickFavoriteProperty.set_value. It now checks if a value is being assigned to an enum_value field. If the value provided is an integer, it automatically looks up the corresponding string identifier from the enum_items collection before performing the assignment.
This ensures a seamless import of user settings from Blender into Bonsai without traceback errors.