mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 14:33:28 +00:00
Fix #6593 - preference to turn on/off cut decorator
This commit is contained in:
@@ -1700,11 +1700,12 @@ class CutDecorator:
|
|||||||
self.shader.bind()
|
self.shader.bind()
|
||||||
|
|
||||||
black = (0, 0, 0, 1)
|
black = (0, 0, 0, 1)
|
||||||
|
model_props = tool.Model.get_model_props()
|
||||||
for colour, element_fills in fills.items():
|
if model_props.show_cut_decorator_fill:
|
||||||
for verts_tris in element_fills:
|
for colour, element_fills in fills.items():
|
||||||
for verts, tris in verts_tris:
|
for verts_tris in element_fills:
|
||||||
self.draw_batch("TRIS", verts, colour, tris)
|
for verts, tris in verts_tris:
|
||||||
|
self.draw_batch("TRIS", verts, colour, tris)
|
||||||
|
|
||||||
gpu.state.point_size_set(2)
|
gpu.state.point_size_set(2)
|
||||||
self.line_shader.uniform_float("lineWidth", 3.0)
|
self.line_shader.uniform_float("lineWidth", 3.0)
|
||||||
|
|||||||
@@ -2114,8 +2114,9 @@ class ActivateModel(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
dprops = tool.Drawing.get_document_props()
|
dprops = tool.Drawing.get_document_props()
|
||||||
dprops.active_drawing_id = 0
|
dprops.active_drawing_id = 0
|
||||||
|
model_props = tool.Model.get_model_props()
|
||||||
CutDecorator.uninstall()
|
if model_props.show_cut_decorator:
|
||||||
|
CutDecorator.uninstall()
|
||||||
|
|
||||||
# Preserve current visibility statuses for:
|
# Preserve current visibility statuses for:
|
||||||
# - non-ifc objects
|
# - non-ifc objects
|
||||||
@@ -2208,7 +2209,9 @@ class ActivateDrawingBase(tool.Ifc.Operator):
|
|||||||
|
|
||||||
if tool.Drawing.is_camera_orthographic():
|
if tool.Drawing.is_camera_orthographic():
|
||||||
core.sync_references(tool.Ifc, tool.Collector, tool.Drawing, drawing=tool.Ifc.get().by_id(self.drawing))
|
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()
|
tool.Drawing.show_decorations()
|
||||||
|
|
||||||
# Save drawing bounds to the .ifc file
|
# 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.decorator import WallAxisDecorator, SlabDirectionDecorator
|
||||||
from bonsai.bim.module.model.door import update_door_modifier_bmesh
|
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.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
|
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:
|
else:
|
||||||
SlabDirectionDecorator.uninstall()
|
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:
|
def update_search_name(self: "BIMModelProperties", context: bpy.types.Context) -> None:
|
||||||
AuthoringData.load()
|
AuthoringData.load()
|
||||||
@@ -240,6 +248,17 @@ class BIMModelProperties(PropertyGroup):
|
|||||||
default=False,
|
default=False,
|
||||||
update=update_slab_direction_decorator,
|
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:
|
if TYPE_CHECKING:
|
||||||
ifc_class: str
|
ifc_class: str
|
||||||
|
|||||||
@@ -1315,7 +1315,9 @@ class BIM_PT_decorators_overlay(Panel):
|
|||||||
row.prop(model_props, "show_wall_axis", text="Wall Axis")
|
row.prop(model_props, "show_wall_axis", text="Wall Axis")
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
row.prop(model_props, "show_slab_direction", text="Slab Direction")
|
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):
|
class BIM_PT_snappping(Panel):
|
||||||
bl_space_type = "VIEW_3D"
|
bl_space_type = "VIEW_3D"
|
||||||
|
|||||||
Reference in New Issue
Block a user