File tree Expand file tree Collapse file tree
src/ifcblenderexport/blenderbim Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8181 operator .CreateSheets ,
8282 operator .GenerateDigitalTwin ,
8383 operator .CreateView ,
84+ operator .ActivateView ,
8485 prop .Subcontext ,
8586 prop .BIMProperties ,
8687 prop .DocProperties ,
Original file line number Diff line number Diff line change @@ -881,3 +881,22 @@ class GenerateDigitalTwin(bpy.types.Operator):
881881 def execute (self , context ):
882882 # Does absolutely nothing at all :D
883883 return {'FINISHED' }
884+
885+ class ActivateView (bpy .types .Operator ):
886+ bl_idname = 'bim.activate_view'
887+ bl_label = 'Activate View'
888+
889+ def execute (self , context ):
890+ camera = bpy .data .objects .get (bpy .context .scene .DocProperties .available_views )
891+ if not camera :
892+ return {'FINISHED' }
893+ bpy .context .scene .camera = camera
894+ area = next (area for area in bpy .context .screen .areas if area .type == 'VIEW_3D' )
895+ area .spaces [0 ].region_3d .view_perspective = 'CAMERA'
896+ views_collection = bpy .data .collections .get ('Views' )
897+ for collection in views_collection .children :
898+ bpy .context .view_layer .layer_collection .children ['Views' ].children [collection .name ].hide_viewport = True
899+ bpy .data .collections .get (collection .name ).hide_render = True
900+ bpy .context .view_layer .layer_collection .children ['Views' ].children [camera .users_collection [0 ].name ].hide_viewport = False
901+ bpy .data .collections .get (camera .users_collection [0 ].name ).hide_render = False
902+ return {'FINISHED' }
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ def __init__(self):
3838target_views_enum = []
3939persons_enum = []
4040organisations_enum = []
41+ views_enum = []
4142
4243@persistent
4344def setDefaultProperties (scene ):
@@ -209,6 +210,19 @@ def getTargetViews(self, context):
209210 return target_views_enum
210211
211212
213+ def getViews (self , context ):
214+ global views_enum
215+ views_enum .clear ()
216+ views_collection = bpy .data .collections .get ('Views' )
217+ if not views_collection :
218+ return views_enum
219+ for collection in views_collection .children :
220+ for obj in collection .objects :
221+ if obj .type == 'CAMERA' :
222+ views_enum .append ((obj .name , obj .name , '' ))
223+ return views_enum
224+
225+
212226class Subcontext (PropertyGroup ):
213227 name : StringProperty (name = 'Name' )
214228 target_view : StringProperty (name = 'Target View' )
@@ -217,6 +231,7 @@ class Subcontext(PropertyGroup):
217231class DocProperties (PropertyGroup ):
218232 should_recut : BoolProperty (name = "Should Recut" , default = True )
219233 view_name : StringProperty (name = "View Name" )
234+ available_views : EnumProperty (items = getViews , name = "Available Views" )
220235
221236
222237class BIMCameraProperties (PropertyGroup ):
Original file line number Diff line number Diff line change @@ -198,6 +198,10 @@ def draw(self, context):
198198 row .prop (props , 'view_name' )
199199 row .operator ('bim.create_view' , icon = 'ADD' , text = '' )
200200
201+ row = layout .row ()
202+ row .prop (props , 'available_views' )
203+ row .operator ('bim.activate_view' , icon = 'SCENE' , text = '' )
204+
201205 row = layout .row ()
202206 row .operator ('bim.create_sheets' )
203207
You can’t perform that action at this time.
0 commit comments