1
$\begingroup$

I am importing a VRML file using Blender command line. I need to change the focal length of the camera using the command line.

How can I do that? I cannot find Python api for this.

Thanks.

$\endgroup$
3
$\begingroup$

It's in bpy.data.cameras['name of your camera object'].lens, or camera.angle (thanks @ideasman42).

Note that you must have a camera in the scene.

$\endgroup$
1
$\begingroup$

Ok, I think I got it ..

We can get the focal length by using bpy.data.cameras.values()[0].lens. We can set this value as well.

$\endgroup$
  • 1
    $\begingroup$ bpy.data.cameras.values()[0].lens is better written as bpy.data.cameras[0].lens $\endgroup$ – ideasman42 Aug 5 '14 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.