mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 14:33:28 +00:00
typing
This commit is contained in:
@@ -878,8 +878,9 @@ class OverrideDelete(bpy.types.Operator):
|
|||||||
tool.Ifc.set(data["new_file"])
|
tool.Ifc.set(data["new_file"])
|
||||||
|
|
||||||
def process_arrays(self, context: bpy.types.Context) -> None:
|
def process_arrays(self, context: bpy.types.Context) -> None:
|
||||||
|
ifc_file = tool.Ifc.get()
|
||||||
selected_objects = set(context.selected_objects)
|
selected_objects = set(context.selected_objects)
|
||||||
array_parents = set()
|
array_parents: set[ifcopenshell.entity_instance] = set()
|
||||||
for obj in context.selected_objects:
|
for obj in context.selected_objects:
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if not element:
|
if not element:
|
||||||
@@ -887,7 +888,7 @@ class OverrideDelete(bpy.types.Operator):
|
|||||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||||
if not pset:
|
if not pset:
|
||||||
continue
|
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:
|
for array_parent in array_parents:
|
||||||
array_parent_obj = tool.Ifc.get_object(array_parent)
|
array_parent_obj = tool.Ifc.get_object(array_parent)
|
||||||
@@ -923,8 +924,8 @@ class OverrideOutlinerDelete(bpy.types.Operator):
|
|||||||
if tool.Ifc.get():
|
if tool.Ifc.get():
|
||||||
return IfcStore.execute_ifc_operator(self, context)
|
return IfcStore.execute_ifc_operator(self, context)
|
||||||
# https://blender.stackexchange.com/questions/203729/python-get-selected-objects-in-outliner
|
# https://blender.stackexchange.com/questions/203729/python-get-selected-objects-in-outliner
|
||||||
objects_to_delete = set()
|
objects_to_delete: set[bpy.types.Object] = set()
|
||||||
collections_to_delete = set()
|
collections_to_delete: set[bpy.types.Collection] = set()
|
||||||
for item in context.selected_ids:
|
for item in context.selected_ids:
|
||||||
if item.bl_rna.identifier == "Collection":
|
if item.bl_rna.identifier == "Collection":
|
||||||
collection = bpy.data.collections.get(item.name)
|
collection = bpy.data.collections.get(item.name)
|
||||||
|
|||||||
@@ -740,6 +740,7 @@ class EnableEditingSurfaceStyle(bpy.types.Operator):
|
|||||||
if self.ifc_class == "IfcSurfaceStyleLighting":
|
if self.ifc_class == "IfcSurfaceStyleLighting":
|
||||||
|
|
||||||
def callback(attribute_name, _, data):
|
def callback(attribute_name, _, data):
|
||||||
|
assert attributes
|
||||||
color = attributes.add()
|
color = attributes.add()
|
||||||
color.name = attribute_name
|
color.name = attribute_name
|
||||||
color_value = data[attribute_name]
|
color_value = data[attribute_name]
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ class Blender(bonsai.core.tool.Blender):
|
|||||||
return area.spaces.active
|
return area.spaces.active
|
||||||
|
|
||||||
@classmethod
|
@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]
|
prop_bl_rna = props.bl_rna.properties[prop_name]
|
||||||
if getattr(prop_bl_rna, "array_length", 0) > 0:
|
if getattr(prop_bl_rna, "array_length", 0) > 0:
|
||||||
prop_value = prop_bl_rna.default_array
|
prop_value = prop_bl_rna.default_array
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ from mathutils import Color
|
|||||||
from typing import Union, Any, Optional, Literal, TYPE_CHECKING, Sequence
|
from typing import Union, Any, Optional, Literal, TYPE_CHECKING, Sequence
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
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
|
# fmt: off
|
||||||
TEXTURE_MAPS_BY_METHODS = {
|
TEXTURE_MAPS_BY_METHODS = {
|
||||||
@@ -516,7 +517,11 @@ class Style(bonsai.core.tool.Style):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
@classmethod
|
@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()
|
props = tool.Style.get_style_props()
|
||||||
if style_type == "IfcExternallyDefinedSurfaceStyle":
|
if style_type == "IfcExternallyDefinedSurfaceStyle":
|
||||||
return props.external_style_attributes
|
return props.external_style_attributes
|
||||||
|
|||||||
Reference in New Issue
Block a user