0

How can I use Python to capture the whole mesh in the camera from an angle?

bpy.ops.view3d.camera_to_view_selected() will be a frontal angle. I want to capture the whole mesh in the camera while maintaining the angle like 3D viewport's "." button, but bpy.ops.view3d.view_selected() doesn't seem to work from python

Carboro
  • 184
  • 8
  • Do I understand your question: The camera is already in position, pointing along a line towards the selected mesh, and now you want to move it along that line to a point where the whole mesh is visible, preserving the angle? – Marty Fouts Dec 25 '21 at 17:07
  • Yes, sir. That's right. But it does not have to be strictly so. What I want to do is render from an oblique view in Python to create a thumbnail of the mesh. The front view doesn't really show the shape. – Carboro Dec 25 '21 at 23:10
  • I don't think there's a specific bpy op that does what you want, but there are questions here about calculating the viewing frustum, determining if the bounding box of an object is in it, and simply moving the camera. You might find an answer among them. – Marty Fouts Dec 25 '21 at 23:31
  • Thank you! I will check that and try – Carboro Dec 26 '21 at 00:07

0 Answers0