GeneratorsΒΆ

Generator module to be used by Processors and Renderers.

class lablib.generators.OCIOConfigFileGenerator(context, family=None, operators=None, config_path=None, working_space=None, views=None, description=None, staging_dir=None, environment_variables=None)[source]ΒΆ

Class for generating and manipulating OCIO Config files.

contextΒΆ

The context of the OCIO Config file.

Type:

str

config_pathΒΆ

The path to the OCIO Config file.

Type:

Optional[str]

familyΒΆ

The family of the OCIO Config file.

Type:

Optional[str]

operatorsΒΆ

A list of OCIO Transform objects.

Type:

Optional[List[OCIO.Transform]]

working_spaceΒΆ

The working space of the OCIO Config file.

Type:

Optional[str]

viewsΒΆ

A list of views.

Type:

Optional[List[str]]

descriptionΒΆ

The description of the OCIO Config file.

Type:

Optional[str]

staging_dirΒΆ

The staging directory of the OCIO Config file.

Type:

Optional[str]

environment_variablesΒΆ

A dictionary of environment variables.

Type:

Optional[Dict]

Example

>>> from lablib.operators import LUT
>>> from lablib.generators import OCIOConfigFileGenerator
>>> lut = LUT(src="src", dst="dst")
>>> ocio = OCIOConfigFileGenerator(
...     context="context",
...     config_path="config.ocio",
...     operators=[lut],
...     working_space="working_space",
...     views=["view1", "view"],
...     description="description",
...     staging_dir="staging_dir",
...     environment_variables={"key": "value"},
... )
>>> ocio.create_config()
'<staging_dir_path>/config.ocio'
Raises:
  • ValueError – If config_path is not set and the OCIO environment variable is not set.

  • FileNotFoundError – If the OCIO Config file is not found.

append_operators(*args)[source]ΒΆ

Append operators.

Parameters:

*args – A list of lablib.operators objects.

append_vars(**kwargs)[source]ΒΆ

Append environment variables.

Parameters:

**kwargs – A key/value map of environment variables.

append_views(*args)[source]ΒΆ

Append views.

Parameters:

*args – A list of views.

clear_operators()[source]ΒΆ

Clear the operators.

clear_vars()[source]ΒΆ

Clear the environment variables.

clear_views()[source]ΒΆ

Clear the views.

create_config(dest=None)[source]ΒΆ

Create an OCIO Config file.

Parameters:

dest (str) – The destination path to write the OCIO Config file.

Returns:

The destination path to the OCIO Config file.

Return type:

str

get_config_path()[source]ΒΆ

Return the path to the OCIO Config file.

Returns:

The path to the OCIO Config file.

Return type:

str

get_description_from_config()[source]ΒΆ

Return the description from the OCIO Config file.

Returns:

The description text.

Return type:

str

get_oiiotool_cmd()[source]ΒΆ

Return arguments for the oiiotool command.

Returns:

The arguments for the oiiotool command.

Return type:

List

load_config_from_file(filepath)[source]ΒΆ

Load an OCIO Config file from a file.

Parameters:

filepath (str) – The path to the OCIO Config file.

process_config()[source]ΒΆ

Process the OCIO Config file.

This will add the environment variables, description, group transform, color space transform, color space, look, display view, active views, and validate the OCIO Config object.

set_ocio_config_name(name)[source]ΒΆ

Set the name of the OCIO Config file.

Parameters:

name (str) – The name of the OCIO Config file.

set_operators(*args)[source]ΒΆ

Set operators.

Attention

This will clear any existing operators.

Parameters:

*args – A list of lablib.operators objects.

set_vars(**kwargs)[source]ΒΆ

Set the environment variables for the OCIO Config file.

Attention

This will clear any existing environment variables.

Parameters:

**kwargs – A key/value map of environment variables.

set_views(*args)[source]ΒΆ

Set the views for the OCIO Config file.

Attention

This will clear any existing views.

Parameters:

*args – A list of views.

write_config(dest=None)[source]ΒΆ

Write the OCIO Config object to file.

Parameters:

dest (str) – The destination path to write the OCIO Config file.

class lablib.generators.SlateHtmlGenerator(data=<factory>, width=1920, height=1080, staging_dir=None, slate_template_path=None, source_files=<factory>, is_source_linear=True)[source]ΒΆ

Class to generate a slate from a template.

Attention

This class is functional but not yet tested.

Todo

  • refactor into a plain python class

  • add tests

dataΒΆ

A dictionary containing the data to be formatted in the template.

Type:

Dict

widthΒΆ

The width of the slate.

Type:

int

heightΒΆ

The height of the slate.

Type:

int

staging_dirΒΆ

The directory where the slate will be staged.

Type:

str

slate_template_pathΒΆ

The path to the template.

Type:

str

source_filesΒΆ

A list of source files.

Type:

List

is_source_linearΒΆ

A boolean to set whether the source files are linear.

Type:

bool