Code for adjusting camera parameters

Hi can anybody help me find a python code on how to adjust the focal length and other intrinsic parameters of the camera in blender.

1 Like

http://www.blender.org/documentation/blender_python_api_2_62_release/bpy.types.Camera.html

It doesnot work i have tried all these bpy.types.Camera**** but none of them works in the python console

You have to get a specific instance of your camera.

If you load the default scene, then there is 1 camera called “Camera” in the scene. You can access it like this:


# Get the specific camera that is in the scene
camera = bpy.data.cameras["Camera"]

# Change the focal length to 15
camera.lens = 15.0

Once you have the camera instance that you want to change, then you can use the methods and members on that instance to modify whatever you want.

Thanks it is just what i wanted