blendersynth.blender.camera

class blendersynth.blender.camera.Camera(camera=None)[source]

Camera object, to handle movement, tracking, etc.

animate_path(frames=(0, 250), fracs=(0, 1))

Animate object along path.

Parameters:
  • frames (tuple) – tuple of keyframes to animate at - length N

  • fracs (tuple) – tuple of fractions along path to animate at - length N

property axes: ndarray

Return 3x3 rotation matrix (normalized) to represent axes

classmethod create(name='Camera', location=None, rotation=None)[source]

Create a new camera object.

Parameters:
  • name (str) – Name of camera

  • location (Union[list, tuple, ndarray]) – Location of camera

  • rotation_euler – Rotation of camera in euler angles

Return type:

Camera

property focal_length

Focal length in mm

follow_path(path, zero=True, animate=True, frames=(0, 250), fracs=(0, 1))

Follow path, with optional animation setting.

Parameters:
  • path (Curve) – Curve object

  • zero (bool) – If True, set camera location to (0, 0, 0) [aligns camera with path]

  • animate (bool) – If True, animate camera along path

  • frames (tuple) – tuple of keyframes to animate at - length N

  • fracs (tuple) – tuple of fractions along path to animate at - length N

property fov

Field of view in degrees

classmethod from_scene(name='Camera')[source]

Create from a named camera in scene

Parameters:

name (str) – Name of camera

Return type:

Camera

property location: mathutils.Vector

Location of object

look_at(at=mathutils.Vector, up=mathutils.Vector)[source]

Look at a point in space, with up vector.

Parameters:
  • at (Union[Vector, ndarray, List, Tuple]) – Point to look at

  • up (Union[Vector, ndarray, List, Tuple]) – Up vector

look_at_object(obj, up=mathutils.Vector)[source]

Look at an object, with up vector.

Parameters:
  • obj (Union[Mesh, Object]) – Object to look at

  • up (Union[Vector, ndarray, List, Tuple]) – Up vector

property matrix_world

Return world matrix of object(s).

path_keyframe(frame, offset)

Set keyframe for camera path offset

Parameters:
  • frame (int) – Frame number

  • offset (float) – Offset fraction (0-1)

remove()

Delete .obj from bpy.data if it exists

render_visibility(value, frame=None)

Show/hide object in render

Parameters:
  • value (bool) – True to show, False to hide

  • frame (int) – Optional frame for animating

rotate_by(rotation)

Add a rotation to the object. Must be in XYZ order, euler angles, radians.

property rotation_euler: mathutils.Euler

Rotation in euler XYZ angles

scale_by(scale)

Scale object

set_clip_end(clip_end, frame=None)
Parameters:

frame (int) – Optional frame for animating

set_clip_start(clip_start, frame=None)
Parameters:

frame (int) – Optional frame for animating

set_dimensions(dimensions, frame=None)

Set dimensions of object.

Parameters:
  • dimensions (VectorLikeOrScalar) – Dimensions to set. Either single value or 3 long vector

  • frame (int) – Optional frame for animating

set_focal_length(focal_length, frame=None)
Parameters:

frame (int) – Optional frame for animating

set_fov(fov, frame=None)
Parameters:

frame (int) – Optional frame for animating

set_location(location, frame=None)

Set location of object.

Parameters:
  • location (VectorLike) – Location vector to set

  • frame (int) – Optional frame for animating

set_rotation_euler(rotation, frame=None)

Set euler rotation of object.

Parameters:
  • rotation (VectorLike) – Rotation vector

  • frame (int) – Optional frame for animating

set_scale(scale, frame=None)

Set scale of object.

Parameters:
  • scale (VectorLikeOrScalar) – Scale to set. Either single value or 3 long vector

  • frame (int) – Optional frame for animating

track_to(obj)

Track to object.

Parameters:

obj (Union[BsynObject, Object]) – BsynObject or Blender Object to track to

translate(translation)

Translate object

untrack()

Remove track to constraint from object

update()[source]

Update view layer and depsgraph

viewport_visibility(value, frame=None)

Show/hide object in viewport

Parameters:
  • value (bool) – True to show, False to hide

  • frame (int) – Optional frame for animating