OperatorsΒΆ

Operators for color and reposition effects.

class lablib.operators.AYONOCIOLookProduct(ocioLookItems=<factory>, ocioLookWorkingSpace=<factory>)[source]ΒΆ

AYON ocioLook product dataclass

This class will hold all the necessary data for the ocioLook product, so it can be covered into FileTransform and ColorSpaceTransform during AYONOCIOLookProduct.to_ocio_obj() method.

Example of input data

{
    "ocioLookItems": [
        {
            "name": "LUTfile",
            "file: "path/to/lut.cube", # currently created via processor
            "ext": "cube",
            "input_colorspace": {
                "colorspace": "Output - sRGB",
                "name": "color_picking",
                "type": "roles"
            },
            "output_colorspace": {
                "colorspace": "ACES - ACEScc",
                "name": "color_timing",
                "type": "roles"
            },
            "direction": "forward",
            "interpolation": "tetrahedral",
            "config_data": {
                "path": "path/to/config.ocio",
                "template": "{BUILTIN_OCIO_ROOT}/aces_1.2/config.ocio",
                "colorspace": "compositing_linear"
            },
        },
    ],
    "ocioLookWorkingSpace": {
        "colorspace": "ACES - ACEScg",
        "name": "compositing_linear",
        "type": "roles"
    },
},
ocioLookItemsΒΆ

List of ocioLook items.

Type:

List[dict]

ocioLookWorkingSpaceΒΆ

The working space.

Type:

dict

classmethod from_node_data(data)[source]ΒΆ

Create AYONOCIOLookProduct from node data.

Parameters:

data (dict) – The node data.

Returns:

The AYONOCIOLookProduct object.

Return type:

AYONOCIOLookProduct

to_ocio_obj()[source]ΒΆ

Converts to list of native OCIO objects.

Returns:

The OCIO

ColorSpaceTransform and FileTransform objects in a list. The order of the objects is based on the order of the items in ocioLookItems.

Return type:

List[Union[OCIO.ColorSpaceTransform, OCIO.FileTransform]]

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, direction=0, cccid='', offset=<factory>, power=<factory>, slope=<factory>, saturation=1.0, interpolation='linear')[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

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:

The OCIO

CDLTransform and FileTransform object in a list. If file is not provided, only CDLTransform will be returned.

Return type:

List[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

in a list.

Return type:

List[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:

List[OCIO.FileTransform]

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]