mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
Don't burn CPU cycles recalculating the door every draw call in parametric door interface
This commit is contained in:
@@ -26,6 +26,7 @@ from bonsai.bim.module.model.data import AuthoringData
|
||||
from bpy.types import PropertyGroup, NodeTree
|
||||
from math import pi, radians
|
||||
from bonsai.bim.module.model.decorator import WallAxisDecorator, SlabDirectionDecorator
|
||||
from bonsai.bim.module.model.door import update_door_modifier_bmesh
|
||||
from typing import TYPE_CHECKING, Literal, get_args
|
||||
|
||||
|
||||
@@ -125,6 +126,10 @@ def update_x_angle(self, context):
|
||||
self.x_angle = 0
|
||||
|
||||
|
||||
def update_door(self, context):
|
||||
update_door_modifier_bmesh(context)
|
||||
|
||||
|
||||
class BIMModelProperties(PropertyGroup):
|
||||
ifc_class: bpy.props.EnumProperty(items=get_ifc_class, name="Construction Class", update=update_ifc_class)
|
||||
relating_type_id: bpy.props.EnumProperty(
|
||||
@@ -600,14 +605,19 @@ class BIMDoorProperties(PropertyGroup):
|
||||
non_si_units_props = ("is_editing", "door_type", "panel_width_ratio")
|
||||
is_editing: bpy.props.BoolProperty(default=False)
|
||||
door_type: bpy.props.EnumProperty(
|
||||
name="Door Operation Type", items=tuple((i, i, "") for i in get_args(DoorType)), default="SINGLE_SWING_LEFT"
|
||||
name="Door Operation Type",
|
||||
items=tuple((i, i, "") for i in get_args(DoorType)),
|
||||
default="SINGLE_SWING_LEFT",
|
||||
update=update_door,
|
||||
)
|
||||
overall_height: bpy.props.FloatProperty(name="Overall Height", default=2.0, subtype="DISTANCE")
|
||||
overall_width: bpy.props.FloatProperty(name="Overall Width", default=0.9, subtype="DISTANCE")
|
||||
overall_height: bpy.props.FloatProperty(name="Overall Height", default=2.0, subtype="DISTANCE", update=update_door)
|
||||
overall_width: bpy.props.FloatProperty(name="Overall Width", default=0.9, subtype="DISTANCE", update=update_door)
|
||||
|
||||
# lining properties
|
||||
lining_depth: bpy.props.FloatProperty(name="Lining Depth", default=0.050, subtype="DISTANCE")
|
||||
lining_thickness: bpy.props.FloatProperty(name="Lining Thickness", default=0.050, subtype="DISTANCE")
|
||||
lining_depth: bpy.props.FloatProperty(name="Lining Depth", default=0.050, subtype="DISTANCE", update=update_door)
|
||||
lining_thickness: bpy.props.FloatProperty(
|
||||
name="Lining Thickness", default=0.050, subtype="DISTANCE", update=update_door
|
||||
)
|
||||
lining_offset: bpy.props.FloatProperty(
|
||||
name="Lining Offset",
|
||||
description="Offset from the outer side of the wall (by Y-axis). "
|
||||
@@ -615,12 +625,13 @@ class BIMDoorProperties(PropertyGroup):
|
||||
"`0.025 mm` is good as default value",
|
||||
default=0.0,
|
||||
subtype="DISTANCE",
|
||||
update=update_door,
|
||||
)
|
||||
lining_to_panel_offset_x: bpy.props.FloatProperty(
|
||||
name="Lining to Panel Offset X", default=0.025, subtype="DISTANCE"
|
||||
name="Lining to Panel Offset X", default=0.025, subtype="DISTANCE", update=update_door
|
||||
)
|
||||
lining_to_panel_offset_y: bpy.props.FloatProperty(
|
||||
name="Lining to Panel Offset Y", default=0.025, subtype="DISTANCE"
|
||||
name="Lining to Panel Offset Y", default=0.025, subtype="DISTANCE", update=update_door
|
||||
)
|
||||
|
||||
transom_thickness: bpy.props.FloatProperty(
|
||||
@@ -628,12 +639,14 @@ class BIMDoorProperties(PropertyGroup):
|
||||
description="Set values > 0 to add a transom.\n" "`0.050 mm` is good as default value",
|
||||
default=0.000,
|
||||
subtype="DISTANCE",
|
||||
update=update_door,
|
||||
)
|
||||
transom_offset: bpy.props.FloatProperty(
|
||||
name="Transom Offset",
|
||||
description="Distance from the bottom door opening to the beginning of the transom (unlike windows)",
|
||||
default=1.525,
|
||||
subtype="DISTANCE",
|
||||
update=update_door,
|
||||
)
|
||||
|
||||
casing_thickness: bpy.props.FloatProperty(
|
||||
@@ -641,28 +654,44 @@ class BIMDoorProperties(PropertyGroup):
|
||||
description="Set values > 0 and LiningOffset = 0 to add a casing.",
|
||||
default=0.075,
|
||||
subtype="DISTANCE",
|
||||
update=update_door,
|
||||
)
|
||||
casing_depth: bpy.props.FloatProperty(name="Casing Depth", default=0.005, subtype="DISTANCE")
|
||||
casing_depth: bpy.props.FloatProperty(name="Casing Depth", default=0.005, subtype="DISTANCE", update=update_door)
|
||||
|
||||
threshold_thickness: bpy.props.FloatProperty(
|
||||
name="Threshold Thickness", description="Set values > 0 to add a threshold.", default=0.025, subtype="DISTANCE"
|
||||
name="Threshold Thickness",
|
||||
description="Set values > 0 to add a threshold.",
|
||||
default=0.025,
|
||||
subtype="DISTANCE",
|
||||
update=update_door,
|
||||
)
|
||||
threshold_depth: bpy.props.FloatProperty(
|
||||
name="Threshold Depth", default=0.1, subtype="DISTANCE", update=update_door
|
||||
)
|
||||
threshold_depth: bpy.props.FloatProperty(name="Threshold Depth", default=0.1, subtype="DISTANCE")
|
||||
threshold_offset: bpy.props.FloatProperty(
|
||||
name="Threshold Offset", description="`0.025 mm` is good as default value", default=0.000, subtype="DISTANCE"
|
||||
name="Threshold Offset",
|
||||
description="`0.025 mm` is good as default value",
|
||||
default=0.000,
|
||||
subtype="DISTANCE",
|
||||
update=update_door,
|
||||
)
|
||||
|
||||
# panel properties
|
||||
panel_depth: bpy.props.FloatProperty(name="Panel Depth", default=0.035, subtype="DISTANCE")
|
||||
panel_depth: bpy.props.FloatProperty(name="Panel Depth", default=0.035, subtype="DISTANCE", update=update_door)
|
||||
panel_width_ratio: bpy.props.FloatProperty(
|
||||
name="Panel Width Ratio",
|
||||
description="Width of this panel, given as ratio " "relative to the total clear opening width of the door",
|
||||
default=1.0,
|
||||
soft_min=0,
|
||||
soft_max=1,
|
||||
update=update_door,
|
||||
)
|
||||
frame_thickness: bpy.props.FloatProperty(
|
||||
name="Window Frame Thickness", default=0.035, subtype="DISTANCE", update=update_door
|
||||
)
|
||||
frame_depth: bpy.props.FloatProperty(
|
||||
name="Window Frame Depth", default=0.035, subtype="DISTANCE", update=update_door
|
||||
)
|
||||
frame_thickness: bpy.props.FloatProperty(name="Window Frame Thickness", default=0.035, subtype="DISTANCE")
|
||||
frame_depth: bpy.props.FloatProperty(name="Window Frame Depth", default=0.035, subtype="DISTANCE")
|
||||
|
||||
# Material properties
|
||||
panel_material: bpy.props.EnumProperty(name="Panel Material", items=get_materials, options=set())
|
||||
|
||||
@@ -33,10 +33,8 @@ from bonsai.bim.module.model.data import (
|
||||
from bonsai.bim.module.model.prop import get_ifc_class
|
||||
from bonsai.bim.module.model.stair import regenerate_stair_mesh
|
||||
from bonsai.bim.module.model.window import update_window_modifier_bmesh
|
||||
from bonsai.bim.module.model.door import update_door_modifier_bmesh
|
||||
from bonsai.bim.module.model.railing import update_railing_modifier_bmesh
|
||||
from bonsai.bim.module.model.roof import update_roof_modifier_bmesh
|
||||
from bonsai.bim.helper import prop_with_search
|
||||
from collections.abc import Iterable
|
||||
|
||||
|
||||
@@ -551,9 +549,6 @@ class BIM_PT_door(bpy.types.Panel):
|
||||
self.layout.prop(props, "panel_material")
|
||||
if props.transom_thickness:
|
||||
self.layout.prop(props, "glazing_material")
|
||||
|
||||
update_door_modifier_bmesh(context)
|
||||
|
||||
else:
|
||||
row.operator("bim.enable_editing_door", icon="GREASEPENCIL", text="")
|
||||
row.operator("bim.remove_door", icon="X", text="")
|
||||
|
||||
Reference in New Issue
Block a user