mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +00:00
typing
This commit is contained in:
@@ -48,6 +48,7 @@ class BIM_PT_profiles(Panel):
|
|||||||
self.props = tool.Profile.get_profile_props()
|
self.props = tool.Profile.get_profile_props()
|
||||||
|
|
||||||
active_profile = None
|
active_profile = None
|
||||||
|
assert self.layout
|
||||||
if self.props.is_editing and (active_profile := tool.Profile.get_active_profile_ui()):
|
if self.props.is_editing and (active_profile := tool.Profile.get_active_profile_ui()):
|
||||||
preview_collection = ProfileData.preview_collection
|
preview_collection = ProfileData.preview_collection
|
||||||
box = self.layout.box()
|
box = self.layout.box()
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import ifcopenshell.api
|
|||||||
import ifcopenshell.api.style
|
import ifcopenshell.api.style
|
||||||
import ifcopenshell.util.representation
|
import ifcopenshell.util.representation
|
||||||
import ifcopenshell.util.unit
|
import ifcopenshell.util.unit
|
||||||
|
from bonsai.bim.module.style.prop import ColourRgb
|
||||||
from bpy_extras.io_utils import ImportHelper
|
from bpy_extras.io_utils import ImportHelper
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
@@ -739,9 +740,10 @@ class EnableEditingSurfaceStyle(bpy.types.Operator):
|
|||||||
callback = None
|
callback = None
|
||||||
if self.ifc_class == "IfcSurfaceStyleLighting":
|
if self.ifc_class == "IfcSurfaceStyleLighting":
|
||||||
|
|
||||||
def callback(attribute_name, _, data):
|
def callback(attribute_name: str, _: object, data: dict[str, Any]) -> None:
|
||||||
assert attributes
|
assert attributes
|
||||||
color = attributes.add()
|
color = attributes.add()
|
||||||
|
assert isinstance(color, ColourRgb)
|
||||||
color.name = attribute_name
|
color.name = attribute_name
|
||||||
color_value = data[attribute_name]
|
color_value = data[attribute_name]
|
||||||
if color_value is None:
|
if color_value is None:
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class Style(PropertyGroup):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
name: str
|
||||||
ifc_definition_id: int
|
ifc_definition_id: int
|
||||||
total_elements: int
|
total_elements: int
|
||||||
style_classes: bpy.types.bpy_prop_collection_idprop[StrProperty]
|
style_classes: bpy.types.bpy_prop_collection_idprop[StrProperty]
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class BIM_PT_styles(Panel):
|
|||||||
StylesData.load()
|
StylesData.load()
|
||||||
|
|
||||||
self.props = tool.Style.get_style_props()
|
self.props = tool.Style.get_style_props()
|
||||||
|
assert self.layout
|
||||||
|
|
||||||
if not self.props.is_editing:
|
if not self.props.is_editing:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
|
|||||||
@@ -909,7 +909,7 @@ class FetchObjectPassport(bpy.types.Operator):
|
|||||||
context.active_object.data = bpy.data.meshes[reference.name]
|
context.active_object.data = bpy.data.meshes[reference.name]
|
||||||
|
|
||||||
|
|
||||||
def update_enum_property_search_prop(self, context):
|
def update_enum_property_search_prop(self: "BIM_OT_enum_property_search", context: bpy.types.Context) -> None:
|
||||||
for i, prop in enumerate(self.collection_names):
|
for i, prop in enumerate(self.collection_names):
|
||||||
if prop.name == self.dummy_name:
|
if prop.name == self.dummy_name:
|
||||||
setattr(context.data, self.prop_name, self.collection_identifiers[i].name)
|
setattr(context.data, self.prop_name, self.collection_identifiers[i].name)
|
||||||
@@ -933,6 +933,7 @@ class BIM_OT_enum_property_search(bpy.types.Operator):
|
|||||||
bl_label = "Search"
|
bl_label = "Search"
|
||||||
bl_description = "Search For Property"
|
bl_description = "Search For Property"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
first_launch: bpy.props.BoolProperty(default=True, options={"SKIP_SAVE"})
|
first_launch: bpy.props.BoolProperty(default=True, options={"SKIP_SAVE"})
|
||||||
dummy_name: bpy.props.StringProperty(name="Property", update=update_enum_property_search_prop)
|
dummy_name: bpy.props.StringProperty(name="Property", update=update_enum_property_search_prop)
|
||||||
collection_names: bpy.props.CollectionProperty(type=StrProperty)
|
collection_names: bpy.props.CollectionProperty(type=StrProperty)
|
||||||
@@ -1334,6 +1335,7 @@ class BIM_OT_attribute_search_values(bpy.types.Operator):
|
|||||||
bl_label = "Search Attribute Values"
|
bl_label = "Search Attribute Values"
|
||||||
bl_description = "Search for attribute values within a collection"
|
bl_description = "Search for attribute values within a collection"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
first_launch: bpy.props.BoolProperty(default=True, options={"SKIP_SAVE"})
|
first_launch: bpy.props.BoolProperty(default=True, options={"SKIP_SAVE"})
|
||||||
attribute_name: bpy.props.StringProperty(name="Attribute Name")
|
attribute_name: bpy.props.StringProperty(name="Attribute Name")
|
||||||
attribute_ifc_class: bpy.props.StringProperty(name="Attribute IFC Class")
|
attribute_ifc_class: bpy.props.StringProperty(name="Attribute IFC Class")
|
||||||
@@ -1352,7 +1354,13 @@ class BIM_OT_attribute_search_values(bpy.types.Operator):
|
|||||||
collection_values: bpy.props.CollectionProperty(type=StrProperty, options={"SKIP_SAVE"})
|
collection_values: bpy.props.CollectionProperty(type=StrProperty, options={"SKIP_SAVE"})
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
first_launch: bool
|
||||||
|
attribute_name: str
|
||||||
|
attribute_ifc_class: str
|
||||||
|
data_path: str
|
||||||
data_type: AttributeSearchDataType
|
data_type: AttributeSearchDataType
|
||||||
|
search_value: str
|
||||||
|
collection_values: bpy.types.bpy_prop_collection_idprop[StrProperty]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_data_path(data_path: str) -> tuple[str, "Attribute"]:
|
def resolve_data_path(data_path: str) -> tuple[str, "Attribute"]:
|
||||||
@@ -1406,7 +1414,7 @@ class BIM_OT_attribute_search_values(bpy.types.Operator):
|
|||||||
results_are_suggestions=True,
|
results_are_suggestions=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context) -> "set[rna_enums.OperatorReturnItems]":
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -1416,7 +1424,7 @@ class BIM_OT_attribute_add_subitem(bpy.types.Operator):
|
|||||||
bl_description = "Add subitem to the current attribute"
|
bl_description = "Add subitem to the current attribute"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
data_path: bpy.props.StringProperty()
|
data_path: bpy.props.StringProperty() # pyright: ignore[reportRedeclaration]
|
||||||
"""Full data path."""
|
"""Full data path."""
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -1435,9 +1443,9 @@ class BIM_OT_attribute_remove_subitem(bpy.types.Operator):
|
|||||||
bl_description = "Add subitem to the current attribute"
|
bl_description = "Add subitem to the current attribute"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
data_path: bpy.props.StringProperty()
|
data_path: bpy.props.StringProperty() # pyright: ignore[reportRedeclaration]
|
||||||
"""Full data path."""
|
"""Full data path."""
|
||||||
index: bpy.props.IntProperty()
|
index: bpy.props.IntProperty() # pyright: ignore[reportRedeclaration]
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
data_path: str
|
data_path: str
|
||||||
|
|||||||
@@ -621,6 +621,7 @@ class PsetQto(PropertyGroup):
|
|||||||
is_editable: BoolProperty(name="Is Editable")
|
is_editable: BoolProperty(name="Is Editable")
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
name: str
|
||||||
properties: bpy.types.bpy_prop_collection_idprop[Attribute]
|
properties: bpy.types.bpy_prop_collection_idprop[Attribute]
|
||||||
is_expanded: bool
|
is_expanded: bool
|
||||||
is_editable: bool
|
is_editable: bool
|
||||||
|
|||||||
Reference in New Issue
Block a user