Fix #6593 - preference to turn on/off cut decorator

This commit is contained in:
Ryan Schultz
2025-06-18 21:36:04 -05:00
parent cbd78506ce
commit 9dc75ece44
4 changed files with 34 additions and 9 deletions
@@ -1700,11 +1700,12 @@ class CutDecorator:
self.shader.bind()
black = (0, 0, 0, 1)
for colour, element_fills in fills.items():
for verts_tris in element_fills:
for verts, tris in verts_tris:
self.draw_batch("TRIS", verts, colour, tris)
model_props = tool.Model.get_model_props()
if model_props.show_cut_decorator_fill:
for colour, element_fills in fills.items():
for verts_tris in element_fills:
for verts, tris in verts_tris:
self.draw_batch("TRIS", verts, colour, tris)
gpu.state.point_size_set(2)
self.line_shader.uniform_float("lineWidth", 3.0)
@@ -2114,8 +2114,9 @@ class ActivateModel(bpy.types.Operator):
def execute(self, context):
dprops = tool.Drawing.get_document_props()
dprops.active_drawing_id = 0
CutDecorator.uninstall()
model_props = tool.Model.get_model_props()
if model_props.show_cut_decorator:
CutDecorator.uninstall()
# Preserve current visibility statuses for:
# - non-ifc objects
@@ -2208,7 +2209,9 @@ class ActivateDrawingBase(tool.Ifc.Operator):
if tool.Drawing.is_camera_orthographic():
core.sync_references(tool.Ifc, tool.Collector, tool.Drawing, drawing=tool.Ifc.get().by_id(self.drawing))
CutDecorator.install(context)
model_props = tool.Model.get_model_props()
if model_props.show_cut_decorator:
CutDecorator.install(context)
tool.Drawing.show_decorations()
# Save drawing bounds to the .ifc file
@@ -28,6 +28,7 @@ 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 bonsai.bim.module.model.window import update_window_modifier_bmesh
from bonsai.bim.module.drawing.decoration import CutDecorator
from typing import TYPE_CHECKING, Literal, get_args, Union, get_args, Any, Optional
@@ -112,6 +113,13 @@ def update_slab_direction_decorator(self: "BIMModelProperties", context: bpy.typ
else:
SlabDirectionDecorator.uninstall()
def update_cut_decorator(self: "BIMModelProperties", context: bpy.types.Context) -> None:
if self.show_cut_decorator:
CutDecorator.install(bpy.context)
else:
CutDecorator.uninstall()
def update_search_name(self: "BIMModelProperties", context: bpy.types.Context) -> None:
AuthoringData.load()
@@ -240,6 +248,17 @@ class BIMModelProperties(PropertyGroup):
default=False,
update=update_slab_direction_decorator,
)
show_cut_decorator: bpy.props.BoolProperty(
name="Show Cut Decorator",
default=True,
update=update_cut_decorator,
description="Shows the cut decorator",
)
show_cut_decorator_fill: bpy.props.BoolProperty(
name="Show Cut Decorator Fill",
default=True,
description="Show Cut Decorator Fill",
)
if TYPE_CHECKING:
ifc_class: str
+3 -1
View File
@@ -1315,7 +1315,9 @@ class BIM_PT_decorators_overlay(Panel):
row.prop(model_props, "show_wall_axis", text="Wall Axis")
row = col.row(align=True)
row.prop(model_props, "show_slab_direction", text="Slab Direction")
row = col.row(align=True)
row.prop(model_props, "show_cut_decorator", text="Cut Decorator")
row.prop(model_props, "show_cut_decorator_fill", text="Fill Cut Decorator")
class BIM_PT_snappping(Panel):
bl_space_type = "VIEW_3D"