Color API

Manage viewport color-space and clip color-corrections.

Color-Corrections can be set either be set on the entire clip or on a particular Frame.

Multiple Clip-level color-corrections can be set on a particular clip and multiple frame-level color-corrections can be set on a particular frame of a clip.

A color-correction can either be read-only or read-write.

class rpa.api.color_api.ColorApi(logger)[source]

Bases: QObject

A class that provides an interface for color operations.

SIG_CCS_MODIFIED
SIG_CC_MODIFIED
SIG_CC_NODE_MODIFIED
append_ccs(clip_id: str, names: List[str], frame: int | None = None, cc_ids: List[str] | None = None) List[str][source]

Creates color correction objects with the give names and optional ids.

Parameters:
  • clip_id (str) – id of the clip.

  • names (list) – list of names of each color correction.

  • frame (int, optional) – Specific frame at which to apply the color corrections. If not provided, the ccs are applied to the entire clip.

  • cc_ids (list(str), optional) – list of color correction unique ids

Returns:

list of color correction ids appended.

Return type:

cc_ids (str)

append_nodes(clip_id: str, cc_id: str, nodes: List[ColorTimer | Grade]) bool[source]

Appends multiple nodes(either a colortimer or grade node object) to the CC created for the specified clip and cc id.

Parameters:
  • clip_id (str) – Id of the clip.

  • cc_id (str) – Id of color correction to which the node(s) are to be added.

  • nodes (List[Union[ColorTimer, Grade]]) – List of ColorTimer or Grade nodes to append.

Returns:

True if success False otherwise

Return type:

(bool)

append_shape_to_region(clip_id: str, cc_id: str, points: List[Tuple[float]]) bool[source]

Appends a shape to the region in the specified clip and color correction ID.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

  • points (list) – list of (x, y) points representing any shape.

Returns:

True if success False otherwise

Return type:

(bool)

clear_nodes(clip_id: str, cc_id: str) bool[source]

Deletes all the nodes(Colortimer, Grade) in the color correction for the give clip and color correction ID.

Parameters:
  • clip_id (str) – Id of a clip

  • cc_id (str) – Id of Color-Correction

Returns:

True if success False otherwise

Return type:

(bool)

create_region(clip_id: str, cc_id: str) bool[source]

Create a mask/region to the specified clip and color correction.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

True if success False otherwise

Return type:

(bool)

property delegate_mngr
delete_ccs(clip_id: str, cc_ids: List[str], frame: int | None = None) bool[source]

Delete color corrections associated with the particular ids in the specified clip or frame.

Parameters:
  • clip_id (str) – Id of a clip

  • cc_ids (list) – List of color corrections to delete.

Returns:

True if success False otherwise

Return type:

(bool)

delete_node(clip_id: str, cc_id: str, node_index: int) bool[source]

Delete the specific node in the given index in the color correction settings for the give clip and color correction ID.

Parameters:
  • clip_id (str) – Id of a clip

  • cc_id (str) – Id of Color-Correction

  • node_index (int) – Index of node to delete

Returns:

True if success False otherwise

Return type:

(bool)

delete_region(clip_id: str, cc_id: str) bool[source]

Delete a mask/region in the specified clip and color correction.

Parameters:
  • clip_id (str) – Id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

True if success False otherwise

Return type:

(bool)

delete_ro_ccs(clips) bool[source]

Deletes all existing read only color corrections in the given clips.

Parameters:

clips (list) – List of clip ids to delete ro_ccs from.

Returns:

True if sucess, False otherwise.

Return type:

bool

get_cc_ids(clip_id: str, frame: int | None = None) List[str][source]

Returns the list of color correction ids for a specific clip or frame.

Parameters:
  • clip_id (str) – Id of the clip whose ccs is needed.

  • frame (int, optional) – If frame number is given, retrieve the color correction ids in that particular frame, or return for the entire clip.

Returns:

Ids of color corrections in that particular clip/frame.

Return type:

list (str)

get_channel() int[source]

Get the current color channel(s) to be shown. An integer denotining each of the respective color channel(s) will be returned. Following are the integers used to denote respective color channel(s). RED = 0 GREEN = 1 BLUE = 2 ALPHA = 3 RGB = 4 LUMINANCE = 5

Returns:

Integeter denoting the current color channel.

Return type:

int

get_frame_of_cc(clip_id: str, cc_id: str) int | None[source]

Get the frame of the given color correction.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

Frame of the given color-correction

Return type:

int

get_fstop() float[source]

Get the global fstop color value.

Returns:

the current fstop value set

Return type:

float

get_gamma() float[source]

Get the global gamma color value.

Returns:

the current gamma value set

Return type:

float

get_name(clip_id: str, cc_id: str) str[source]

Retrieves the name of the color correction in the specified clip and cc id.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

name of the color correction.

Return type:

str

get_node(clip_id: str, cc_id: str, node_index: int) ColorTimer | Grade[source]

Retrieve the node(colortimer or grade node) for the specified clip and color correction id and from the particular index.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

  • node_index (int) – index of the node to retrieve.

Returns:

Colortimer or grade node object.

Return type:

object

get_node_count(clip_id: str, cc_id: str)[source]

Get the current number of nodes in the color-correction of the given id in the clip of the given id.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

Number of ndodes in the given color-correction

Return type:

int

get_node_properties(clip_id: str, cc_id: str, node_index: int, property_names: List[str]) List[source]

For the provided node property name(s), gets the values of the node in the color correction for the give clip, color-correction and node-index.

Parameters:
  • clip_id (str) – Id of the clip.

  • cc_id (str) – Unique id for the color correction.

  • node_index (int) – Index of the node to update

  • property_names (list) – Name of the properties whose values need to be fetched. Example : [“offset”, “gain”]

Returns:

Values of the given property names in the same order as how the property names were given.

Return type:

List

get_nodes(clip_id: str, cc_id: str) List[ColorTimer | Grade][source]

Retrieves all nodes(colortimers and grade nodes) for the specified clip and color correction id.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

List of nodes in that particular cc id.

Return type:

List[Union[ColorTimer, Grade]]

get_ocio_colorspace(clip_id: str) str[source]

Get OCIO colorspace for given clip.

Parameters:

clip_id (str) – Id of the clip

Returns:

Name of of OCIO colorspace

Return type:

str

get_ocio_display() str[source]

Get the current OCIO display.

Returns:

Name of the display

Return type:

str

get_ocio_view() str[source]

Get the current OCIO view.

Returns:

Name of the view

Return type:

str

get_region_falloff(clip_id: str, cc_id: str) float[source]

Retrieves the falloff value associated with the region in a particular clip and color correction.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

falloff value

Return type:

float

get_ro_ccs(clip_id: str, frame: int | None = None) List[ColorCorrection][source]

Get the list of read-only color-corrctions that are present in the given clips on the given frames. If frame number is not given, then then the clip-level color-corrections are returned.

Parameters:
  • clip_id (str) – Id of the clip

  • frame (Optional[int]) – Frame of the clip. If None is give, clip level cc will be returned.

Returns:

RPA Color Correction Object.

Return type:

List[RPA ColorCorrection]

get_ro_frames(clip_id: str) List[int][source]

Retrieves the frames that contain read-only color corrections within a specified clip.

Parameters:

clip_id (str) – id of the clip.

Returns:

list of frame numbers

Return type:

List[int]

get_rw_ccs(clip_id: str, frame: int | None = None) List[ColorCorrection][source]

Get the list of read-only color-corrctions that are present in the given clips on the given frames. If frame number is not given, then then the clip-level color-corrections are returned.

Parameters:
  • clip_id (str) – Id of the clip

  • frame (Optional[int]) – Frame of the clip. If None is give, clip level cc will be returned.

Returns:

RPA Color Correction Object.

Return type:

List[RPA ColorCorrection]

get_rw_frames(clip_id: str) List[int][source]

Retrieves the frames that contain read-write color corrections within a specified clip.

Parameters:

clip_id (str) – id of the clip.

Returns:

list of frame numbers

Return type:

List[int]

has_region(clip_id: str, cc_id: str) bool[source]

Check if a particular region exists within the specified clip and color correction(id).

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

True if region exists, False otherwise.

Return type:

bool

is_modified(clip_id: str, cc_id: str) bool[source]

Checks if color correction values of that particular id in the specified clip has been modified.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

True if modified, False otherwise.

Return type:

bool

is_mute(clip_id: str, cc_id: str) bool[source]

Checks if color correction values of that particular id in the specified clip has been muted.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

True if muted, False otherwise.

Return type:

bool

is_mute_all(clip_id: str) bool[source]

Checks if all color correction values in the specified clip has been muted.

Parameters:

clip_id (str) – id of the clip.

Returns:

True if muted, False otherwise.

Return type:

bool

is_read_only(clip_id: str, cc_id: str) bool[source]

Checks if color correction values of that particular id in the specified clip is read_only.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

Returns:

True if read only, False otherwise.

Return type:

bool

move_cc(clip_id: str, from_index: int, to_index: int, frame: int | None = None) bool[source]

Moves a color correction setting within the list by changing its position from one index to another. :param clip_id: id of the clip. :type clip_id: str :param from_index: Current index of the color correction. :type from_index: int :param to_index: Target index to move the color correction. :type to_index: int :param frame: if frame move frame ccs, else move clip ccs. :type frame: int, optional

Returns:

True if success False otherwise

Return type:

(bool)

mute(clip_id: str, cc_id: str, value: bool) bool[source]

Sets mute value all color correction values in the specified clip associated with the specified color correction ID.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

  • value (bool) – True to mute the color correction, False otherwise.

Returns:

True if success False otherwise

Return type:

(bool)

mute_all(clip_id: str, value: bool) bool[source]

Sets mute value all color correction values in the specified clip associated with the specified color correction ID.

Parameters:
  • clip_id (str) – id of the clip.

  • value (bool) – True to mute all the color corrections, False otherwise.

Returns:

True if success False otherwise

Return type:

(bool)

set_channel(channel: int) bool[source]

Set the current color channel(s) to be shown. Following are the options available and the integer to be used to set them respectively, RED = 0 GREEN = 1 BLUE = 2 ALPHA = 3 RGB = 4 LUMINANCE = 5

Parameters:

channel (int) – Number to identify the channel(s) to set

Returns:

True if success False otherwise

Return type:

(bool)

set_fstop(value) bool[source]

Sets the global fstop color value.

Parameters:

value (float) – fstop value

Returns:

True if success False otherwise

Return type:

(bool)

set_gamma(value) bool[source]

Sets the global gamma color value.

Parameters:

value (float) – gamma value

Returns:

True if success False otherwise

Return type:

(bool)

set_name(clip_id: str, cc_id: str, name: str) bool[source]

Update the name of the color correction setting.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

  • name (str) – name to update to.

Returns:

True if success False otherwise

Return type:

(bool)

set_node_properties(clip_id: str, cc_id: str, node_index: int, properties: Dict) bool[source]

Sets the given node-properties of the node in the color correction for the give clip, color-correction and node-index.

Parameters:
  • clip_id (str) – Id of the clip.

  • cc_id (str) – Unique id for the color correction.

  • node_index (int) – Index of the node to update

  • properties (dict) – Key value pairs of the properties that need to be set. Example : {‘offset’ : [0.5, 0.3, 0.4], ‘mute’:True}

Returns:

True if success False otherwise

Return type:

(bool)

set_ocio_colorspace(clip_id: str, colorspace: str) bool[source]

Set OCIO colorspace for given clip.

Parameters:
  • clip_id (str) – Id of the clip

  • colorspace (str) – Name of the colorspace

Returns:

True if success False otherwise

Return type:

(bool)

set_ocio_display(display: str) bool[source]

Set current OCIO display.

Parameters:

display (str) – Name of the display

Returns:

True if success False otherwise

Return type:

(bool)

set_ocio_view(view: str) bool[source]

Set current OCIO view.

Parameters:

view (str) – Name of the view.

Returns:

True if success False otherwise

Return type:

(bool)

set_read_only(clip_id: str, cc_id: str, value: bool) bool[source]

Set if the color correction values of that particular id should be read-only or read-write.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

  • value (bool) – True if success False otherwise

Returns:

True if set, False otherwise.

Return type:

bool

set_region_falloff(clip_id: str, cc_id: str, falloff: float) bool[source]

Sets the falloff value associated with the region in a particular clip and color correction.

Parameters:
  • clip_id (str) – id of the clip.

  • cc_id (str) – Unique id for the color correction.

  • falloff (float) – falloff value

Returns:

True if success False otherwise

Return type:

(bool)

set_ro_ccs(ccs: dict) bool[source]

Removes all existing read only color corrections in the given clips and replaces them with the given ccs. If Frame number is None, then the color-correction will be added as a clip-level color-correction.

Here is an example of how the ccs dict should look like,

{
    clip_id_1 : [
        (None, color_correction),
        (frame_1, color_correction),
        (None, color_correction),
        (frame_5, color_correction),
        (frame_10, color_correction)
    ]
}
Parameters:

ccs (dict) – Color correction that need to be set for the given clips and their respective frames.

Returns:

True if sucess, False otherwise.

Return type:

bool

set_rw_ccs(ccs: dict) bool[source]

Removes all existing read write color corrections in the given clips and replaces them with the given ccs. If Frame number is None, then the color-correction will be added as a clip-level color-correction.

Here is an example of how the ccs dict should look like,

{
    clip_id_1 : [
        (None, color_correction),
        (frame_1, color_correction),
        (None, color_correction),
        (frame_5, color_correction),
        (frame_10, color_correction)
    ]
}
Parameters:

ccs (dict) – Color correction that need to be set for the given clips and their respective frames.

Returns:

True if sucess, False otherwise.

Return type:

bool

staticMetaObject = <PySide2.QtCore.QMetaObject object>