mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
typing
This commit is contained in:
@@ -139,6 +139,10 @@ class IfcExporter:
|
||||
|
||||
|
||||
class IfcExportSettings:
|
||||
"""
|
||||
Initialize only using `IfcExportSettings.factory()`.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.logger: Logger = None
|
||||
self.output_file: str = None
|
||||
|
||||
@@ -1177,8 +1177,12 @@ class IfcImporter:
|
||||
|
||||
|
||||
class IfcImportSettings:
|
||||
"""
|
||||
Initialize only using `IfcImportSettings.factory()`.
|
||||
"""
|
||||
|
||||
input_file: Union[str, None] = None
|
||||
logger: Union[logging.Logger, None] = None
|
||||
logger: logging.Logger
|
||||
|
||||
def __init__(self):
|
||||
self.diff_file = None
|
||||
|
||||
@@ -405,9 +405,13 @@ class BIMProjectProperties(PropertyGroup):
|
||||
queried_obj: bpy.props.PointerProperty(type=bpy.types.Object)
|
||||
queried_obj_root: bpy.props.PointerProperty(type=bpy.types.Object)
|
||||
clipping_planes: bpy.props.CollectionProperty(type=ObjProperty)
|
||||
clipping_planes_active: bpy.props.IntProperty(min=0, default=0, max=5)
|
||||
clipping_planes_active_index: bpy.props.IntProperty(min=0, default=0, max=5)
|
||||
edited_objs: bpy.props.CollectionProperty(type=EditedObj)
|
||||
|
||||
@property
|
||||
def active_clipping_plane(self) -> ObjProperty | None:
|
||||
return tool.Blender.get_active_uilist_element(self.clipping_planes, self.clipping_planes_active_index)
|
||||
|
||||
@property
|
||||
def clipping_planes_objs(self) -> list[bpy.types.Object]:
|
||||
return list({cp.obj for cp in self.clipping_planes if cp.obj})
|
||||
@@ -486,7 +490,7 @@ class BIMProjectProperties(PropertyGroup):
|
||||
queried_obj: Union[bpy.types.Object, None]
|
||||
queried_obj_root: Union[bpy.types.Object, None]
|
||||
clipping_planes: bpy.types.bpy_prop_collection_idprop[ObjProperty]
|
||||
clipping_planes_active: int
|
||||
clipping_planes_active_index: int
|
||||
edited_objs: bpy.types.bpy_prop_collection_idprop[EditedObj]
|
||||
|
||||
def get_active_library_breadcrumb(self) -> Union[LibraryBreadcrumb, None]:
|
||||
|
||||
@@ -40,6 +40,11 @@ from typing import Optional, TYPE_CHECKING, Literal
|
||||
from natsort import natsorted
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bonsai.bim.prop import ObjProperty
|
||||
from bonsai.bim.module.project.prop import BIMProjectProperties
|
||||
|
||||
|
||||
class IFCFileSelector:
|
||||
layout: bpy.types.UILayout
|
||||
|
||||
@@ -171,17 +176,26 @@ class BIM_PT_section_with_cappings(Panel):
|
||||
props,
|
||||
"clipping_planes",
|
||||
props,
|
||||
"clipping_planes_active",
|
||||
"clipping_planes_active_index",
|
||||
)
|
||||
|
||||
if props.clipping_planes_active < len(props.clipping_planes):
|
||||
active_clipping_plane_obj = props.clipping_planes[props.clipping_planes_active].obj
|
||||
if active_clipping_plane := props.active_clipping_plane:
|
||||
active_clipping_plane_obj = active_clipping_plane.obj
|
||||
box.prop(active_clipping_plane_obj, "location")
|
||||
box.prop(active_clipping_plane_obj, "rotation_euler")
|
||||
|
||||
|
||||
class BIM_UL_clipping_plane(bpy.types.UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||
def draw_item(
|
||||
self,
|
||||
context,
|
||||
layout: bpy.types.UILayout,
|
||||
data: "BIMProjectProperties",
|
||||
item: "ObjProperty",
|
||||
icon,
|
||||
active_data,
|
||||
active_propname,
|
||||
) -> None:
|
||||
if item and item.obj:
|
||||
obj = item.obj
|
||||
row = layout.row(align=True)
|
||||
@@ -199,7 +213,7 @@ class BIM_UL_generic(bpy.types.UIList):
|
||||
self,
|
||||
context,
|
||||
layout: bpy.types.UILayout,
|
||||
data,
|
||||
data: bpy.types.PropertyGroup,
|
||||
item: bpy.types.PropertyGroup,
|
||||
icon,
|
||||
active_data,
|
||||
|
||||
Reference in New Issue
Block a user