mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Bonsai - use main version part to avoid creating too many IfcApplications
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user