GeneratorsΒΆ

Generator module to be used by Processors and Renderers.

class lablib.generators.OCIOConfigFileGenerator(context, family=None, ocio_objects=None, config_path=None, working_space=None, target_view_space=None, views=None, description=None, staging_dir=None, environment_variables=None, search_paths=None, logger=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]

ocio_objectsΒΆ

A list of OCIO Transform objects.

Type:

Optional[List[OCIO.Transform]]

working_spaceΒΆ

The working space of the OCIO Config file.

Type:

Optional[str]

target_view_spaceΒΆ

The target view space of the OCIO Config file. For views to be using specific color spaces different from working space.

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]

search_pathsΒΆ

A list of search paths.

Type:

Optional[List[str]]

Example

>>> from lablib.operators import LUT
>>> from lablib.generators import OCIOConfigFileGenerator
>>> lut = LUT(src="src", dst="dst").to_ocio_obj()
>>> ocio = OCIOConfigFileGenerator(
...     context="context",
...     config_path="config.ocio",
...     ocio_objects=[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_ocio_objects(*args)[source]ΒΆ

Append ocio_objects.

Parameters:

*args – A list of OCIO.Transform objects.

append_search_paths(*args)[source]ΒΆ

Append search paths.

Parameters:

*args – A list of search paths.

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_ocio_objects()[source]ΒΆ

Clear the ocio_objects.

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_ocio_objects(*args)[source]ΒΆ

Set ocio_objects.

Attention

This will clear any existing ocio_objects.

Parameters:

*args – A list of OCIO.Transform 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.SlateFillMode(value)[source]ΒΆ

Slate fill mode (fill up template from data).

class lablib.generators.SlateHtmlGenerator(data, slate_template_path, width=None, height=None, staging_dir=None, source_files=None, is_source_linear=None, slate_fill_mode=None)[source]ΒΆ

Class to generate a slate from a template.

dataΒΆ

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

Type:

dict

slate_template_pathΒΆ

The path to the template.

Type:

str

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

source_filesΒΆ

A list of source files.

Type:

list

is_source_linearΒΆ

A boolean to set whether the source files are linear.

Type:

bool

slate_fill_modeΒΆ

The template fill mode.

Type:

SlateFillMode

Raises:

ValueError – When the provided slate template path is invalid.

create_base_slate()[source]ΒΆ

Prepare and create base slate.

get_oiiotool_cmd()[source]ΒΆ

Get the oiiotool command to run for slate generation.

Returns:

The oiiotool command to run.

Return type:

list

set_size(width, height)[source]ΒΆ

Set the slate resolution.

Parameters:
  • width (int) – The width of the slate.

  • height (int) – The height of the slate.

property slate_filenameΒΆ

Return the slate filename.

Returns:

The slate filename.

Return type:

str

property staging_dirΒΆ

Return the path to the staging directory.

Returns:

The path to the staging directory.

Return type:

str

property template_pathΒΆ

Return the slate template path.

Returns:

The slate template path.

Return type:

str