diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 8d7b45883a..c28cbd37fb 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -878,8 +878,9 @@ class OverrideDelete(bpy.types.Operator): tool.Ifc.set(data["new_file"]) def process_arrays(self, context: bpy.types.Context) -> None: + ifc_file = tool.Ifc.get() selected_objects = set(context.selected_objects) - array_parents = set() + array_parents: set[ifcopenshell.entity_instance] = set() for obj in context.selected_objects: element = tool.Ifc.get_entity(obj) if not element: @@ -887,7 +888,7 @@ class OverrideDelete(bpy.types.Operator): pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array") if not pset: continue - array_parents.add(tool.Ifc.get().by_guid(pset["Parent"])) + array_parents.add(ifc_file.by_guid(pset["Parent"])) for array_parent in array_parents: array_parent_obj = tool.Ifc.get_object(array_parent) @@ -923,8 +924,8 @@ class OverrideOutlinerDelete(bpy.types.Operator): if tool.Ifc.get(): return IfcStore.execute_ifc_operator(self, context) # https://blender.stackexchange.com/questions/203729/python-get-selected-objects-in-outliner - objects_to_delete = set() - collections_to_delete = set() + objects_to_delete: set[bpy.types.Object] = set() + collections_to_delete: set[bpy.types.Collection] = set() for item in context.selected_ids: if item.bl_rna.identifier == "Collection": collection = bpy.data.collections.get(item.name) diff --git a/src/bonsai/bonsai/bim/module/style/operator.py b/src/bonsai/bonsai/bim/module/style/operator.py index 12d1ca9f37..1a4f9b1f8f 100644 --- a/src/bonsai/bonsai/bim/module/style/operator.py +++ b/src/bonsai/bonsai/bim/module/style/operator.py @@ -740,6 +740,7 @@ class EnableEditingSurfaceStyle(bpy.types.Operator): if self.ifc_class == "IfcSurfaceStyleLighting": def callback(attribute_name, _, data): + assert attributes color = attributes.add() color.name = attribute_name color_value = data[attribute_name] diff --git a/src/bonsai/bonsai/tool/blender.py b/src/bonsai/bonsai/tool/blender.py index cb7f05c844..1bcc6a7663 100644 --- a/src/bonsai/bonsai/tool/blender.py +++ b/src/bonsai/bonsai/tool/blender.py @@ -291,7 +291,7 @@ class Blender(bonsai.core.tool.Blender): return area.spaces.active @classmethod - def get_blender_prop_default_value(cls, props, prop_name: str) -> Any: + def get_blender_prop_default_value(cls, props: bpy.types.bpy_struct, prop_name: str) -> Any: prop_bl_rna = props.bl_rna.properties[prop_name] if getattr(prop_bl_rna, "array_length", 0) > 0: prop_value = prop_bl_rna.default_array diff --git a/src/bonsai/bonsai/tool/style.py b/src/bonsai/bonsai/tool/style.py index bf124e23a2..631f3b01f6 100644 --- a/src/bonsai/bonsai/tool/style.py +++ b/src/bonsai/bonsai/tool/style.py @@ -31,7 +31,8 @@ from mathutils import Color from typing import Union, Any, Optional, Literal, TYPE_CHECKING, Sequence if TYPE_CHECKING: - from bonsai.bim.module.style.prop import BIMStylesProperties, BIMStyleProperties + from bonsai.bim.prop import Attribute + from bonsai.bim.module.style.prop import BIMStylesProperties, BIMStyleProperties, ColourRgb # fmt: off TEXTURE_MAPS_BY_METHODS = { @@ -516,7 +517,11 @@ class Style(bonsai.core.tool.Style): return results @classmethod - def get_style_ui_props_attributes(cls, style_type: str) -> Union[bpy.types.PropertyGroup, None]: + def get_style_ui_props_attributes(cls, style_type: str) -> Union[ + bpy.types.bpy_prop_collection_idprop[Attribute], + bpy.types.bpy_prop_collection_idprop[ColourRgb], + None, + ]: props = tool.Style.get_style_props() if style_type == "IfcExternallyDefinedSurfaceStyle": return props.external_style_attributes