OperatorsΒΆ

Operators for color and reposition effects.

class lablib.operators.BaseOperator[source]ΒΆ

Base class for all operators.

Currently this is only used for type checking.

class lablib.operators.ColorOperator[source]ΒΆ

Base class for color operators.

Currently this is only used for type checking.

abstract classmethod from_node_data(data)[source]ΒΆ

An abstract classmethod for returning a ColorOperator from node data.

Parameters:

data (dict) – The node data.

Returns:

The color operator object.

Return type:

ColorOperator

abstract to_ocio_obj()[source]ΒΆ

Converts the object to native OCIO object.

Raises:

NotImplementedError – This method must be implemented in the subclass.

class lablib.operators.CornerPin2D(from1=<factory>, from2=<factory>, from3=<factory>, from4=<factory>, to1=<factory>, to2=<factory>, to3=<factory>, to4=<factory>)[source]ΒΆ

Operator for corner pinning images.

Danger

This operator is not yet tested or used in the codebase.

from1ΒΆ

The first corner of the source image.

Type:

List[float]

from2ΒΆ

The second corner of the source image.

Type:

List[float]

from3ΒΆ

The third corner of the source image.

Type:

List[float]

from4ΒΆ

The fourth corner of the source image.

Type:

List[float]

to1ΒΆ

The first corner of the destination image.

Type:

List[float]

to2ΒΆ

The second corner of the destination image.

Type:

List[float]

to3ΒΆ

The third corner of the destination image.

Type:

List[float]

to4ΒΆ

The fourth corner of the destination image.

Type:

List[float]

classmethod from_node_data(data)[source]ΒΆ

Create CornerPin2D from node data.

dataΒΆ

The node data.

Type:

dict

Returns:

The corner pin object.

Return type:

CornerPin2D

to_oiio_args()[source]ΒΆ

Gets the arguments for oiiotool.

Returns:

Arguments for OIIO.

Return type:

List[str]

class lablib.operators.Crop(box=<factory>)[source]ΒΆ

Operator for cropping images.

boxΒΆ

The crop box.

Type:

List[int]

classmethod from_node_data(data)[source]ΒΆ

Create a Crop object from node data.

dataΒΆ

The node data.

Type:

dict

Returns:

The crop object.

Return type:

Crop

to_oiio_args()[source]ΒΆ

Gets the arguments for oiiotool.

Returns:

Arguments for OIIO.

Return type:

List[int]

class lablib.operators.Mirror2(flop=False, flip=False)[source]ΒΆ

Operator for mirroring images.

Todo

This should be Mirror2 -> Mirror2D looking at CornerPin2D.

flopΒΆ

Mirror vertically.

Type:

bool

flipΒΆ

Mirror horizontally.

Type:

bool

classmethod from_node_data(data)[source]ΒΆ

Create Mirror2 from node data.

dataΒΆ

The node data.

Type:

dict

Returns:

The mirror object.

Return type:

Mirror2

to_oiio_args()[source]ΒΆ

Gets the arguments for oiiotool.

Returns:

Arguments for OIIO.

Return type:

List[str]

class lablib.operators.OCIOCDLTransform(file=None, cccid='', direction=0, interpolation='linear', offset=<factory>, power=<factory>, slope=<factory>, saturation=1.0)[source]ΒΆ

Foundry Hiero Timeline soft effect node class.

Note

Since this node class combines two of OCIO classes (FileTransform and CDLTransform), we will separate them here within OCIOCDLTransform.to_ocio_obj().

fileΒΆ

Path to the LUT file.

Type:

Optional[str]

directionΒΆ

The direction. Defaults to 0.

Type:

int

cccidΒΆ

The cccid. Defaults to β€œβ€.

Type:

str

offsetΒΆ

The offset. Defaults to [0.0, 0.0, 0.0].

Type:

List[float]

powerΒΆ

The power. Defaults to [1.0, 1.0, 1.0].

Type:

List[float]

slopeΒΆ

The slope. Defaults to [0.0, 0.0, 0.0].

Type:

List[float]

saturationΒΆ

The saturation. Defaults to 1.0.

Type:

float

interpolationΒΆ

The interpolation. Defaults to β€œlinear”.

Type:

str

file = NoneΒΆ
classmethod from_node_data(data)[source]ΒΆ

Create OCIOCDLTransform from node data.

Parameters:

data (dict) –

The node data. List of expected but not required keys: - file (str): Path to the LUT file. - direction (int): The direction.

Defaults to 0.

  • cccid (str): The cccid.

    Defaults to β€œβ€.

  • offset (List[float]): The offset.

    Defaults to [0.0, 0.0, 0.0].

  • power (List[float]): The power.

    Defaults to [1.0, 1.0, 1.0].

  • slope (List[float]): The slope.

    Defaults to [0.0, 0.0, 0.0].

  • saturation (float): The saturation.

    Defaults to 1.0.

  • interpolation (str): The interpolation.

    Defaults to β€œlinear”.

Returns:

The OCIOCDLTransform object.

Return type:

OCIOCDLTransform

to_ocio_obj()[source]ΒΆ

Returns native OCIO FileTransform and CDLTransform object.

Returns:

Either OCIO

CDLTransform or FileTransform object. If file is not provided, CDLTransform will be returned.

Return type:

Union[OCIO.FileTransform, OCIO.CDLTransform]

class lablib.operators.OCIOColorSpace(in_colorspace='ACES - ACEScg', out_colorspace='ACES - ACEScg')[source]ΒΆ

Foundry Hiero Timeline soft effect node class.

in_colorspaceΒΆ

The input colorspace. Defaults to β€œACES - ACEScg”.

Type:

str

out_colorspaceΒΆ

The output colorspace. Defaults to β€œACES - ACEScg”.

Type:

str

classmethod from_node_data(data)[source]ΒΆ

Create OCIOColorSpace from node data.

Parameters:

data (dict) – The node data.

Return type:

OCIOColorSpace

to_ocio_obj()[source]ΒΆ

Returns native OCIO ColorSpaceTransform object.

Returns:

The OCIO ColorSpaceTransform object.

Return type:

OCIO.ColorSpaceTransform

class lablib.operators.OCIOFileTransform(file='', cccid='', direction=0, interpolation='linear')[source]ΒΆ

Class for handling OCIO FileTransform effects.

Note

Reads Foundry Hiero Timeline soft effect node class.

fileΒΆ

Path to the LUT file.

Type:

str

cccidΒΆ

Path to the cccid file.

Type:

str

directionΒΆ

The direction. Defaults to 0.

Type:

int

interpolationΒΆ

The interpolation. Defaults to β€œlinear”.

Type:

str

classmethod from_node_data(data)[source]ΒΆ

Create OCIOFileTransform from node data.

Note

Reads Foundry Hiero Timeline soft effect node data.

Would it be cool if we’d had a way to interface other DCC node data? Would they even be so much different?

Parameters:

data (dict) – The node data. List of expected but not required keys: - file (str): Path to the LUT file. - cccid (str): Path to the cccid file. - direction (int): The direction. Defaults to 0. - interpolation (str): The interpolation. Defaults to β€œlinear”.

Returns:

The OCIOFileTransform object.

Return type:

OCIOFileTransform

to_ocio_obj()[source]ΒΆ

Converts the object to native OCIO object.

Returns:

The OCIO FileTransform object in a list.

Return type:

OCIO.FileTransform

class lablib.operators.RepositionOperator[source]ΒΆ

Base class for reposition operators.

Currently this is only used for type checking.

abstract classmethod from_node_data(data)[source]ΒΆ

An abstract method for returning a reposition operator from node data.

dataΒΆ

The node data.

Type:

dict

Returns:

The reposition operator.

Return type:

RepositionOperator

abstract to_oiio_args()[source]ΒΆ

An abstract method for returning the arguments for oiiotool.

Returns:

Arguments for OIIO.

Return type:

List[str]

class lablib.operators.Transform(translate=<factory>, rotate=0.0, scale=<factory>, center=<factory>, invert=False, skewX=0.0, skewY=0.0, skew_order='XY')[source]ΒΆ

Transform operator for repositioning images.

Note

The transformations are applied in the following order: translate, rotate, scale, center, invert, skewX, skewY.

The Transform.skew_order parameter determines the order in which the skewX and skewY transformations are applied.

translateΒΆ

The translation vector.

Type:

List[float]

rotateΒΆ

The rotation angle in degrees.

Type:

float

scaleΒΆ

The scaling vector.

Type:

List[float]

centerΒΆ

The center of the transformation.

Type:

List[float]

invertΒΆ

Invert the transformation.

Type:

bool

skewXΒΆ

The skew in the X direction.

Type:

float

skewYΒΆ

The skew in the Y direction.

Type:

float

skew_orderΒΆ

The order in which the skewX and skewY transformations are applied.

Type:

str

classmethod from_node_data(data)[source]ΒΆ

Create a Transform object from node data.

dataΒΆ

The node data.

Type:

dict

Returns:

The transform object.

Return type:

Transform

to_oiio_args()[source]ΒΆ

Gets the arguments for oiiotool.

Uses lablib.lib to work with transformation matrices.

Returns:

Arguments for OIIO.

Return type:

List[str]

lablib.operators.get_direction(direction)[source]ΒΆ

Get the direction for OCIO FileTransform.

lablib.operators.directionΒΆ

The direction.

Type:

Union[str, int]

Returns:

The direction.

Return type:

int