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_pathis 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.Transformobjects.
- 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.
- 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.Transformobjects.
- 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.
- 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:
- Raises:
ValueError β When the provided slate template path is invalid.
- 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