Skip to content

Commit 61d7a52

Browse files
committed
shift+click, to quickly switch the drawing view without turning anything on or off in the scene. as discussed: https://community.osarch.org/discussion/2196/quick-way-to-switch-between-drawing-views#latest
shift+click, to quickly switch the drawing view without turning anything on or off in the scene. as discussed: https://community.osarch.org/discussion/2196/quick-way-to-switch-between-drawing-views#latest
1 parent c006c8e commit 61d7a52

File tree

1 file changed

+33
-25
lines changed
  • src/blenderbim/blenderbim/bim/module/drawing

1 file changed

+33
-25
lines changed

src/blenderbim/blenderbim/bim/module/drawing/operator.py

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,16 +1519,20 @@ class ActivateDrawing(bpy.types.Operator):
15191519
bl_idname = "bim.activate_drawing"
15201520
bl_label = "Activate Drawing"
15211521
bl_options = {"REGISTER", "UNDO"}
1522-
bl_description = "Activates the selected drawing view.\n\n" + "ALT+CLICK to keep the viewport position"
1522+
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."
15231523

15241524
drawing: bpy.props.IntProperty()
15251525
camera_view_point: bpy.props.BoolProperty(name="Camera View Point", default=True, options={"SKIP_SAVE"})
1526+
switch_camera_only: bpy.props.BoolProperty(name="Only Changes Camera View", default=False, options={"SKIP_SAVE"})
15261527

15271528
def invoke(self, context, event):
15281529
# keep the viewport position on alt+click
15291530
# make sure to use SKIP_SAVE on property, otherwise it might get stuck
15301531
if event.type == "LEFTMOUSE" and event.alt:
15311532
self.camera_view_point = False
1533+
# Only activates the camera view on shift+click. Does not turn on/off objects in scene
1534+
if event.type == "LEFTMOUSE" and event.shift:
1535+
self.switch_camera_only = True
15321536
return self.execute(context)
15331537

15341538
def execute(self, context):
@@ -1537,30 +1541,34 @@ def execute(self, context):
15371541
drawing = tool.Ifc.get().by_id(self.drawing)
15381542
dprops = bpy.context.scene.DocProperties
15391543

1540-
if not self.camera_view_point:
1541-
viewport_position = tool.Blender.get_viewport_position()
1542-
1543-
core.activate_drawing_view(tool.Ifc, tool.Blender, tool.Drawing, drawing=drawing)
1544-
1545-
if not self.camera_view_point:
1546-
tool.Blender.set_viewport_position(viewport_position)
1547-
1548-
dprops.active_drawing_id = self.drawing
1549-
# reset DrawingsData to reload_drawing_styles work correctly
1550-
DrawingsData.is_loaded = False
1551-
dprops.drawing_styles.clear()
1552-
if ifcopenshell.util.element.get_pset(drawing, "EPset_Drawing", "HasUnderlay"):
1553-
bpy.ops.bim.reload_drawing_styles()
1554-
bpy.ops.bim.activate_drawing_style()
1555-
core.sync_references(tool.Ifc, tool.Collector, tool.Drawing, drawing=tool.Ifc.get().by_id(self.drawing))
1556-
CutDecorator.install(context)
1557-
tool.Drawing.show_decorations()
1558-
1559-
# Save drawing bounds to the .ifc file
1560-
camera = context.scene.camera
1561-
camera_props = camera.data.BIMCameraProperties
1562-
if camera_props.update_representation(camera):
1563-
bpy.ops.bim.update_representation(obj=camera.name, ifc_representation_class="")
1544+
if self.switch_camera_only:
1545+
camera = tool.Drawing.import_drawing(drawing)
1546+
tool.Blender.activate_camera(camera)
1547+
else:
1548+
if not self.camera_view_point:
1549+
viewport_position = tool.Blender.get_viewport_position()
1550+
1551+
core.activate_drawing_view(tool.Ifc, tool.Blender, tool.Drawing, drawing=drawing)
1552+
1553+
if not self.camera_view_point:
1554+
tool.Blender.set_viewport_position(viewport_position)
1555+
1556+
dprops.active_drawing_id = self.drawing
1557+
# reset DrawingsData to reload_drawing_styles work correctly
1558+
DrawingsData.is_loaded = False
1559+
dprops.drawing_styles.clear()
1560+
if ifcopenshell.util.element.get_pset(drawing, "EPset_Drawing", "HasUnderlay"):
1561+
bpy.ops.bim.reload_drawing_styles()
1562+
bpy.ops.bim.activate_drawing_style()
1563+
core.sync_references(tool.Ifc, tool.Collector, tool.Drawing, drawing=tool.Ifc.get().by_id(self.drawing))
1564+
CutDecorator.install(context)
1565+
tool.Drawing.show_decorations()
1566+
1567+
# Save drawing bounds to the .ifc file
1568+
camera = context.scene.camera
1569+
camera_props = camera.data.BIMCameraProperties
1570+
if camera_props.update_representation(camera):
1571+
bpy.ops.bim.update_representation(obj=camera.name, ifc_representation_class="")
15641572

15651573

15661574
return {"FINISHED"}

0 commit comments

Comments
 (0)