Fixed #3624 - tools props were updating only for BIM Tool

It wasn't taking into account WallTool, BeamTool and all other tools we have.
This commit is contained in:
Andrej730
2023-08-24 15:41:50 +05:00
parent 5a4bc0909b
commit 13309cb8c4
2 changed files with 9 additions and 5 deletions
+5 -4
View File
@@ -27,6 +27,7 @@ from bpy.app.handlers import persistent
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.owner.prop import get_user_person, get_user_organisation from blenderbim.bim.module.owner.prop import get_user_person, get_user_organisation
from blenderbim.bim.module.model.data import AuthoringData from blenderbim.bim.module.model.data import AuthoringData
from blenderbim.bim.module.model.workspace import LIST_OF_TOOLS
from mathutils import Vector from mathutils import Vector
from math import cos, degrees from math import cos, degrees
@@ -116,7 +117,7 @@ def update_bim_tool_props():
return return
mode = bpy.context.mode mode = bpy.context.mode
current_tool = bpy.context.workspace.tools.from_space_view3d_mode(mode) current_tool = bpy.context.workspace.tools.from_space_view3d_mode(mode)
if not current_tool or current_tool.idname != "bim.bim_tool": if not current_tool or current_tool.idname not in LIST_OF_TOOLS:
return return
element = tool.Ifc.get_entity(obj) element = tool.Ifc.get_entity(obj)
if not element: if not element:
@@ -129,9 +130,9 @@ def update_bim_tool_props():
if element.is_a("IfcElementType") or element.is_a("IfcElement"): if element.is_a("IfcElementType") or element.is_a("IfcElement"):
element_type = ifcopenshell.util.element.get_type(element) element_type = ifcopenshell.util.element.get_type(element)
if element_type: if element_type:
props.ifc_class = element_type.is_a() if current_tool.idname == "bim.bim_tool":
props.relating_type_id = str(element_type.id() props.ifc_class = element_type.is_a()
) props.relating_type_id = str(element_type.id())
extrusion = tool.Model.get_extrusion(representation) extrusion = tool.Model.get_extrusion(representation)
if not extrusion: if not extrusion:
return return
@@ -761,3 +761,6 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.bim.edit_openings() bpy.ops.bim.edit_openings()
else: else:
bpy.ops.bim.show_openings() bpy.ops.bim.show_openings()
LIST_OF_TOOLS = [cls.bl_idname for cls in (BimTool.__subclasses__() + [BimTool])]