Skip to content

virtucamera.VCBase Camera Methods

shycats edited this page May 14, 2021 · 5 revisions

get_scene_cameras( vcserver )
Must Return a list or tuple with the names of all the scene cameras.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.

Returns
-------
tuple or list
    names of all the scene cameras.

get_camera_exists( vcserver, camera_name )
Must Return True if the specified camera exists in the scene,
False otherwise.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to check for.

Returns
-------
bool
    'True' if the camera 'camera_name' exists, 'False' otherwise.

get_camera_has_keys( vcserver, camera_name )
Must Return whether the specified camera has animation keyframes
in the transform or flocal length parameters, as a tuple or list,
in the following order: (transform_has_keys, focal_length_has_keys)
* transform_has_keys (bool) - True if the transform has keyframes.
* focal_length_has_keys (bool) - True if the flen has keyframes.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to check for.

Returns
-------
tuple or list of 2 bool
    whether the camera 'camera_name' has keys or not as
    (transform_has_keys, focal_length_has_keys)

get_camera_focal_length( vcserver, camera_name )
Must Return the focal length value of the specified camera.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to get the data from.

Returns
-------
float
    focal length value of the camera 'camera_name'.

get_camera_transform( vcserver, camera_name )
Must return a tuple or list of 16 floats with the 4x4
transform matrix of the specified camera.

* The up axis must be Y+
* The order must be:
    (rxx, rxy, rxz, 0,
    ryx, ryy, ryz, 0,
    rzx, rzy, rzz, 0,
    tx,  ty,  tz,  1)
    Being 'r' rotation and 't' translation,

Is your responsability to rotate or transpose the matrix if needed,
most 3D softwares offer fast APIs to do so.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to get the data from.

Returns
-------
tuple or list of 16 float
    4x4 transform matrix as
    (rxx, rxy, rxz, 0, ryx, ryy, ryz, 0, rzx, rzy, rzz, 0 , tx, ty, tz, 1)

set_camera_focal_length( vcserver, camera_name, focal_length )
Must set the focal length of the specified camera.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to set the focal length to.
focal_length : float
    focal length value to be set on the camera 'camera_name'

set_camera_transform( vcserver, camera_name, transform_matrix )
Must set the transform of the specified camera.
The transform matrix is provided as a tuple of 16 floats
with a 4x4 transform matrix.

* The up axis is Y+
* The order is:
    (rxx, rxy, rxz, 0,
    ryx, ryy, ryz, 0,
    rzx, rzy, rzz, 0,
    tx,  ty,  tz,  1)
    Being 'r' rotation and 't' translation,

Is your responsability to rotate or transpose the matrix if needed,
most 3D softwares offer fast APIs to do so.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to set the transform to.
transform_matrix : tuple of 16 floats
    transformation matrix to be set on the camera 'camera_name'

set_camera_flen_keys( vcserver, camera_name, keyframes, focal_length_values )
Must set keyframes on the focal length of the specified camera.
The frame numbers are provided as a tuple of floats and
the focal length values are provided as a tuple of floats
with a focal length value for every keyframe.

The first element of the 'keyframes' tuple corresponds to the first
element of the 'focal_length_values' tuple, the second to the second,
and so on.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to set the keyframes to.
keyframes : tuple of floats
    Frame numbers to create the keyframes on.
focal_length_values : tuple of floats
    focal length values to be set as keyframes on the camera 'camera_name'

set_camera_transform_keys( vcserver, camera_name, keyframes, transform_matrix_values )
Must set keyframes on the transform of the specified camera.
The frame numbers are provided as a tuple of floats and
the transform matrixes are provided as a tuple of tuples of 16 floats
with 4x4 transform matrixes, with a matrix for every keyframe.

The first element of the 'keyframes' tuple corresponds to the first
element of the 'transform_matrix_values' tuple, the second to the second,
and so on.

* The up axis is Y+
* The order is:
    (rxx, rxy, rxz, 0,
    ryx, ryy, ryz, 0,
    rzx, rzy, rzz, 0,
    tx,  ty,  tz,  1)
    Being 'r' rotation and 't' translation,

Is your responsability to rotate or transpose the matrixes if needed,
most 3D softwares offer fast APIs to do so.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to set the keyframes to.
keyframes : tuple of floats
    Frame numbers to create the keyframes on.
transform_matrix_values : tuple of tuples of 16 floats
    transformation matrixes to be set as keyframes on the camera 'camera_name'

remove_camera_keys( vcserver, camera_name )
This method must remove all transform
and focal length keyframes in the specified camera.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
camera_name : str
    Name of the camera to remove the keyframes from.

create_new_camera( vcserver )
This method must create a new camera in the scene
and return its name.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.

Returns
-------
str
    Newly created camera name.

Clone this wiki locally