it looks simple but I can’t find the right info anywhere :
I want to be sure that the camera view is active in the viewport. the only way I found so far is :
bpy.ops.view3d.viewnumpad(type='FRONT') # select front view..
bpy.ops.view3d.viewnumpad(type='CAMERA') # ..to be sure to have the camera view after that
:eek::no:
is there a boolean or something that would give the viewport view status ?
… or is there a way to temporary freeze the blender ui refresh ?
<i>bpy.ops.wm.freezeUi()</i>
bpy.ops.view3d.viewnumpad(type='FRONT') # select front view..
bpy.ops.view3d.viewnumpad(type='CAMERA') # ..to be sure to have the camera view after that
<i>bpy.ops.wm.refreshUi()</i>
But i’d still like to know how to know what the active viewport is set to, say as in the case of zeffii’s dimensioning tool it could decide how to orient the text, or various situations it would be very helpful to know (allowing for more intuitive tools).
Excellent.
I have created a script with applicability.
use region_3d
import bpy
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
area.spaces.active.region_3d.view_perspective = 'CAMERA'
use ops
import bpy
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
override = {'area': area, 'region': area.regions} #override context
bpy.ops.view3d.view_camera(override)