I try to import an obj file and make a rendered image, by a python script. How to center the view to the mesh?
I've tried bpy.ops.view3d.view_selected() but i get this error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 43, in <module>
File "J:\Programmi\blender-2.75a-windows32\2.75\scripts\modules\bpy\ops.py", l
ine 189, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.action.view_selected.poll() failed, context is in
correct
view32.view_selected()-- which only controls the viewing angle of the viewport, in much the same way as you would use your mouse to position the view so you could see stuff better. ---- That being said you can allign the active camera to the view using another command.bpy.ops.view3d.camera_to_view_selected()– zeffii Aug 25 '15 at 08:14