mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
shift + click with bim.activate_drawing switches view without turning off/off objects in scene
This commit is contained in:
@@ -1518,22 +1518,31 @@ class ActivateDrawing(bpy.types.Operator):
|
|||||||
bl_idname = "bim.activate_drawing"
|
bl_idname = "bim.activate_drawing"
|
||||||
bl_label = "Activate Drawing"
|
bl_label = "Activate Drawing"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = "Activates the selected drawing view.\n\n" + "ALT+CLICK to keep the viewport position"
|
bl_description = "Activates the selected drawing view.\n\n" + "ALT+CLICK to keep the viewport position.\n\n" + "SHIFT+CLICK activiate drawing without turning objects on/off."
|
||||||
|
|
||||||
drawing: bpy.props.IntProperty()
|
drawing: bpy.props.IntProperty()
|
||||||
camera_view_point: bpy.props.BoolProperty(name="Camera View Point", default=True, options={"SKIP_SAVE"})
|
camera_view_point: bpy.props.BoolProperty(name="Camera View Point", default=True, options={"SKIP_SAVE"})
|
||||||
|
switch_camera_only: bpy.props.BoolProperty(name="Only Changes Camera View", default=False, options={"SKIP_SAVE"})
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
# keep the viewport position on alt+click
|
# keep the viewport position on alt+click
|
||||||
# make sure to use SKIP_SAVE on property, otherwise it might get stuck
|
# make sure to use SKIP_SAVE on property, otherwise it might get stuck
|
||||||
if event.type == "LEFTMOUSE" and event.alt:
|
if event.type == "LEFTMOUSE" and event.alt:
|
||||||
self.camera_view_point = False
|
self.camera_view_point = False
|
||||||
|
# Only activates the camera view on alt+shift. Does not turn on/off objects in scene
|
||||||
|
if event.type == "LEFTMOUSE" and event.shift:
|
||||||
|
self.switch_camera_only = True
|
||||||
return self.execute(context)
|
return self.execute(context)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
drawing = tool.Ifc.get().by_id(self.drawing)
|
drawing = tool.Ifc.get().by_id(self.drawing)
|
||||||
dprops = bpy.context.scene.DocProperties
|
dprops = bpy.context.scene.DocProperties
|
||||||
|
|
||||||
|
camera = tool.Drawing.import_drawing(drawing)
|
||||||
|
|
||||||
|
if self.switch_camera_only:
|
||||||
|
tool.Blender.activate_camera(camera)
|
||||||
|
else:
|
||||||
if not self.camera_view_point:
|
if not self.camera_view_point:
|
||||||
viewport_position = tool.Blender.get_viewport_position()
|
viewport_position = tool.Blender.get_viewport_position()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user