Bonsai - use main version part to avoid creating too many IfcApplications

This commit is contained in:
Andrej730
2025-06-17 17:56:02 +05:00
parent 96bdda305e
commit 71d469a271
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -259,7 +259,8 @@ def redo_post(scene: bpy.types.Scene) -> None:
def get_application(ifc: ifcopenshell.file) -> ifcopenshell.entity_instance: def get_application(ifc: ifcopenshell.file) -> ifcopenshell.entity_instance:
# TODO: cache this for even faster application retrieval. It honestly makes a difference on long scripts. # TODO: cache this for even faster application retrieval. It honestly makes a difference on long scripts.
version = tool.Blender.get_bonsai_version() # Use only main part from the version to avoid flooding advanced users projects with IfcApplications.
version = tool.Blender.get_bonsai_version().split("-")[0]
for element in ifc.by_type("IfcApplication"): for element in ifc.by_type("IfcApplication"):
if element.ApplicationIdentifier == "Bonsai" and element.Version == version: if element.ApplicationIdentifier == "Bonsai" and element.Version == version:
return element return element
+1
View File
@@ -1268,6 +1268,7 @@ class Blender(bonsai.core.tool.Blender):
@classmethod @classmethod
@cache @cache
def get_bonsai_version(cls) -> str: def get_bonsai_version(cls) -> str:
"""E.g. `0.8.3-alpha250617-15453a9`"""
version = None version = None
# Try to retrieve actual version for live-dev environment. # Try to retrieve actual version for live-dev environment.