This commit is contained in:
Andrej730
2025-05-02 12:20:47 +05:00
parent 4aaaf6e8f5
commit 839b2c9c1f
4 changed files with 14 additions and 7 deletions
@@ -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)
@@ -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]
+1 -1
View File
@@ -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
+7 -2
View File
@@ -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