mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
You can now flip clipping planes
This commit is contained in:
@@ -33,6 +33,7 @@ classes = (
|
||||
operator.EnableCulling,
|
||||
operator.EnableEditingHeader,
|
||||
operator.ExportIFC,
|
||||
operator.FlipClippingPlane,
|
||||
operator.ImportIFC,
|
||||
operator.LinkIfc,
|
||||
operator.LoadLink,
|
||||
|
||||
@@ -37,6 +37,7 @@ from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.ui import IFCFileSelector
|
||||
from blenderbim.bim import import_ifc
|
||||
from blenderbim.bim import export_ifc
|
||||
from math import radians
|
||||
from pathlib import Path
|
||||
from mathutils import Vector, Matrix
|
||||
from bpy.app.handlers import persistent
|
||||
@@ -1876,3 +1877,20 @@ class CreateClippingPlane(bpy.types.Operator):
|
||||
self.mouse_x = event.mouse_region_x
|
||||
self.mouse_y = event.mouse_region_y
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
class FlipClippingPlane(bpy.types.Operator):
|
||||
bl_idname = "bim.flip_clipping_plane"
|
||||
bl_label = "Flip Clipping Plane"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.area.type == "VIEW_3D"
|
||||
|
||||
def execute(self, context):
|
||||
obj = bpy.context.active_object
|
||||
if obj in [cp.obj for cp in bpy.context.scene.BIMProjectProperties.clipping_planes]:
|
||||
obj.rotation_euler[0] += radians(180)
|
||||
bpy.context.view_layer.update()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -33,6 +33,7 @@ class QueryTool(bpy.types.WorkSpaceTool):
|
||||
bl_keymap = (
|
||||
("bim.query_linked_element", {"type": "RIGHTMOUSE", "value": "PRESS"}, None),
|
||||
("bim.query_hotkey", {"type": "C", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_C")]}),
|
||||
("bim.query_hotkey", {"type": "F", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_F")]}),
|
||||
("bim.query_hotkey", {"type": "C", "value": "PRESS", "alt": True}, {"properties": [("hotkey", "A_C")]}),
|
||||
)
|
||||
|
||||
@@ -43,6 +44,9 @@ class QueryTool(bpy.types.WorkSpaceTool):
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Add Clipping Plane", icon="EVENT_C")
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Flip Clipping Plane", icon="EVENT_F")
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_ALT")
|
||||
row.label(text="Disable Culling" if LinksData.enable_culling else "Enable Culling", icon="EVENT_C")
|
||||
|
||||
@@ -65,6 +69,9 @@ class QueryHotkey(bpy.types.Operator):
|
||||
def hotkey_S_C(self):
|
||||
bpy.ops.bim.create_clipping_plane("INVOKE_DEFAULT")
|
||||
|
||||
def hotkey_S_F(self):
|
||||
bpy.ops.bim.flip_clipping_plane("INVOKE_DEFAULT")
|
||||
|
||||
def hotkey_A_C(self):
|
||||
if LinksData.enable_culling:
|
||||
bpy.ops.bim.disable_culling()
|
||||
|
||||
Reference in New Issue
Block a user