diff --git a/docs/opencolorio_config_aces.config.rst b/docs/opencolorio_config_aces.config.rst index be3aa095..ba9df4d4 100644 --- a/docs/opencolorio_config_aces.config.rst +++ b/docs/opencolorio_config_aces.config.rst @@ -70,6 +70,7 @@ Reference Configuration classify_aces_ctl_transforms discover_aces_ctl_transforms filter_ctl_transforms + generate_amf_components print_aces_taxonomy unclassify_ctl_transforms @@ -100,7 +101,7 @@ Reference Configuration .. autosummary:: :toctree: generated/ - ColorspaceDescriptionStyle + DescriptionStyle version_config_mapping_file generate_config_aces diff --git a/opencolorio_config_aces/__init__.py b/opencolorio_config_aces/__init__.py index 3cd5674b..d1d03893 100644 --- a/opencolorio_config_aces/__init__.py +++ b/opencolorio_config_aces/__init__.py @@ -57,7 +57,7 @@ version_config_mapping_file, ) from .config import ( - ColorspaceDescriptionStyle, + DescriptionStyle, generate_config_aces, ) from .config import generate_config_cg, generate_config_studio @@ -114,7 +114,7 @@ "version_config_mapping_file", ] __all__ += [ - "ColorspaceDescriptionStyle", + "DescriptionStyle", "generate_config_aces", ] __all__ += ["generate_config_cg", "generate_config_studio"] diff --git a/opencolorio_config_aces/clf/discover/classify.py b/opencolorio_config_aces/clf/discover/classify.py index d7dbfb1a..8becb938 100644 --- a/opencolorio_config_aces/clf/discover/classify.py +++ b/opencolorio_config_aces/clf/discover/classify.py @@ -21,6 +21,9 @@ from collections import defaultdict from collections.abc import Mapping +from opencolorio_config_aces.config.reference.discover.classify import ( + ACESTransformID, +) from opencolorio_config_aces.utilities import ( attest, message_box, @@ -475,6 +478,8 @@ class CLFTransform: *CLF* transform family, e.g. *aces* genus : unicode, optional *CLF* transform genus, e.g. *undefined* + siblings : array_like, optional + *CLF* transform siblings, e.g. inverse transform. Attributes ---------- @@ -497,7 +502,10 @@ class CLFTransform: __ne__ """ - def __init__(self, path, family=None, genus=None): + def __init__(self, path, family=None, genus=None, siblings=None): + if siblings is None: + siblings = [] + self._path = os.path.abspath(os.path.normpath(path)) self._code = None @@ -510,6 +518,7 @@ def __init__(self, path, family=None, genus=None): self._family = family self._genus = genus + self._siblings = siblings self._parse() @@ -692,6 +701,24 @@ def genus(self): return self._genus + @property + def siblings(self): + """ + Getter property for the *CLF* transform siblings, e.g. inverse + transform. + + Returns + ------- + unicode + *CLF* transform siblings. + + Notes + ----- + - This property is read only. + """ + + return self._siblings + def __getattr__(self, item): """ Reimplement the :meth:`object.__getattr__` so that unsuccessful @@ -809,7 +836,9 @@ def _parse(self): iter(information.findall("./ACEStransformID")), None ) if aces_transform_id is not None: - self._information["ACEStransformID"] = aces_transform_id.text + self._information["ACEStransformID"] = ACESTransformID( + aces_transform_id.text + ) builtin_transform = next( iter(information.findall("./BuiltinTransform")), None @@ -999,7 +1028,12 @@ def stem(path): clf_transform_pairs[basename][ "inverse_transform" ] = clf_transforms[1] - + clf_transform_pairs[basename]["forward_transform"].siblings.append( + clf_transform_pairs[basename]["inverse_transform"] + ) + clf_transform_pairs[basename]["inverse_transform"].siblings.append( + clf_transform_pairs[basename]["forward_transform"] + ) return clf_transform_pairs @@ -1295,12 +1329,24 @@ def print_clf_taxonomy(): clf_transform.source, clf_transform.target, ) + logger.info( + '\t\tCLFtransformID : "%s"', + clf_transform.clf_transform_id.clf_transform_id, + ) elif isinstance(clf_transform, CLFTransformPair): logger.info( '\t\t"%s" <--> "%s"', clf_transform.forward_transform.source, clf_transform.forward_transform.target, ) + logger.info( + '\t\tACEStransformID : "%s"', + clf_transform.forward_transform.clf_transform_id.clf_transform_id, + ) + logger.info( + '\t\tACEStransformID : "%s"', + clf_transform.inverse_transform.clf_transform_id.clf_transform_id, + ) if __name__ == "__main__": diff --git a/opencolorio_config_aces/config/__init__.py b/opencolorio_config_aces/config/__init__.py index 1e871551..0f8597e9 100644 --- a/opencolorio_config_aces/config/__init__.py +++ b/opencolorio_config_aces/config/__init__.py @@ -30,6 +30,7 @@ discover_aces_ctl_transforms, filter_ctl_transforms, filter_nodes, + generate_amf_components, node_to_ctl_transform, plot_aces_conversion_graph, print_aces_taxonomy, @@ -38,7 +39,7 @@ version_config_mapping_file, ) from .reference import ( - ColorspaceDescriptionStyle, + DescriptionStyle, generate_config_aces, ) from .cg import generate_config_cg @@ -73,6 +74,7 @@ "discover_aces_ctl_transforms", "filter_ctl_transforms", "filter_nodes", + "generate_amf_components", "node_to_ctl_transform", "plot_aces_conversion_graph", "print_aces_taxonomy", @@ -81,7 +83,7 @@ "version_config_mapping_file", ] __all__ += [ - "ColorspaceDescriptionStyle", + "DescriptionStyle", "generate_config_aces", ] __all__ += ["generate_config_cg"] diff --git a/opencolorio_config_aces/config/cg/generate/config.py b/opencolorio_config_aces/config/cg/generate/config.py index 541795fc..7a94dfc2 100644 --- a/opencolorio_config_aces/config/cg/generate/config.py +++ b/opencolorio_config_aces/config/cg/generate/config.py @@ -36,13 +36,15 @@ named_transform_factory, ) from opencolorio_config_aces.config.reference import ( - ColorspaceDescriptionStyle, + DescriptionStyle, version_aces_dev, version_config_mapping_file, generate_config_aces, ) from opencolorio_config_aces.config.reference.generate.config import ( COLORSPACE_SCENE_ENCODING_REFERENCE, + HEADER_AMF_COMPONENTS, + TEMPLATE_ACES_TRANSFORM_ID, format_optional_prefix, transform_data_aliases, ) @@ -64,6 +66,7 @@ "URL_EXPORT_TRANSFORMS_MAPPING_FILE_CG", "PATH_TRANSFORMS_MAPPING_FILE_CG", "FILTERED_NAMESPACES", + "TEMPLATE_CLF_TRANSFORM_ID", "is_reference", "clf_transform_to_colorspace_name", "clf_transform_to_description", @@ -108,6 +111,13 @@ FILTERED_NAMESPACES : tuple """ +TEMPLATE_CLF_TRANSFORM_ID = "CLFtransformID: {}" +""" +Template for the description of an *CLFtransformID*. + +TEMPLATE_CLF_TRANSFORM_ID : unicode +""" + def is_reference(name): """ @@ -155,7 +165,9 @@ def clf_transform_to_colorspace_name(clf_transform): def clf_transform_to_description( - clf_transform, describe=ColorspaceDescriptionStyle.LONG_UNION + clf_transform, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, ): """ Generate the *OpenColorIO* `Colorspace` or `NamedTransform` description for @@ -168,6 +180,9 @@ def clf_transform_to_description( describe : bool, optional Whether to use the full *CLF* transform description or just the first line. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *ACES* *CTL* transform + description. Returns ------- @@ -175,14 +190,17 @@ def clf_transform_to_description( *OpenColorIO* `Colorspace` or `NamedTransform` description. """ + if amf_components is None: + amf_components = {} + description = None - if describe != ColorspaceDescriptionStyle.NONE: + if describe != DescriptionStyle.NONE: description = [] if describe in ( - ColorspaceDescriptionStyle.OPENCOLORIO, - ColorspaceDescriptionStyle.SHORT, - ColorspaceDescriptionStyle.SHORT_UNION, + DescriptionStyle.OPENCOLORIO, + DescriptionStyle.SHORT, + DescriptionStyle.SHORT_UNION, ): if clf_transform.description is not None: description.append( @@ -191,18 +209,44 @@ def clf_transform_to_description( ) elif describe in ( # noqa: SIM102 - ColorspaceDescriptionStyle.OPENCOLORIO, - ColorspaceDescriptionStyle.LONG, - ColorspaceDescriptionStyle.LONG_UNION, + DescriptionStyle.OPENCOLORIO, + DescriptionStyle.LONG, + DescriptionStyle.LONG_UNION, ): if clf_transform.description is not None: description.append("\n" + clf_transform.description) - description.append( - f"\nCLFtransformID: " - f"{clf_transform.clf_transform_id.clf_transform_id}" + description.extend( + [ + "", + TEMPLATE_CLF_TRANSFORM_ID.format( + clf_transform.clf_transform_id.clf_transform_id + ), + ] ) + aces_transform_id = clf_transform.information.get("ACEStransformID") + if aces_transform_id: + aces_transform_id = aces_transform_id.aces_transform_id + description.append( + TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id) + ) + + if describe in ( + DescriptionStyle.AMF, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, + ): + amf_components_description = [ + TEMPLATE_ACES_TRANSFORM_ID.format(amf_aces_transform_id) + for amf_aces_transform_id in amf_components.get( + aces_transform_id, [] + ) + ] + if amf_components_description: + description.append(HEADER_AMF_COMPONENTS) + description.extend(amf_components_description) + description = "\n".join(description).strip() return description @@ -243,7 +287,8 @@ def clf_transform_to_family( def clf_transform_to_colorspace( clf_transform, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, signature_only=False, **kwargs, ): @@ -255,7 +300,10 @@ def clf_transform_to_colorspace( clf_transform : CLFTransform *CLF* transform. describe : bool, optional - Whether to use the full *CLF* transform description or just its ID. + *CLF* transform description style. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *ACES* *CTL* transform + description. signature_only : bool, optional Whether to return the *OpenColorIO* `Colorspace` signature only, i.e. the arguments for its instantiation. @@ -275,7 +323,9 @@ def clf_transform_to_colorspace( signature = { "name": clf_transform_to_colorspace_name(clf_transform), "family": clf_transform_to_family(clf_transform), - "description": clf_transform_to_description(clf_transform, describe), + "description": clf_transform_to_description( + clf_transform, describe, amf_components + ), } file_transform = { @@ -306,7 +356,8 @@ def clf_transform_to_colorspace( def clf_transform_to_named_transform( clf_transform, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, signature_only=False, **kwargs, ): @@ -318,7 +369,10 @@ def clf_transform_to_named_transform( clf_transform : CLFTransform *CLF* transform. describe : bool, optional - Whether to use the full *CLF* transform description or just its ID. + *CLF* transform description style. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *ACES* *CTL* transform + description. signature_only : bool, optional Whether to return the *OpenColorIO* `NamedTransform` signature only, i.e. the arguments for its instantiation. @@ -338,7 +392,9 @@ def clf_transform_to_named_transform( signature = { "name": clf_transform_to_colorspace_name(clf_transform), "family": clf_transform_to_family(clf_transform), - "description": clf_transform_to_description(clf_transform, describe), + "description": clf_transform_to_description( + clf_transform, describe, amf_components + ), } file_transform = { @@ -369,7 +425,8 @@ def clf_transform_to_named_transform( def style_to_colorspace( style, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, signature_only=False, scheme="Modern 1", # noqa: ARG001 **kwargs, @@ -383,7 +440,10 @@ def style_to_colorspace( *OpenColorIO* builtin transform style. describe : int, optional Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + :class:`opencolorio_config_aces.DescriptionStyle` enum. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *ACES* *CTL* transform + description. signature_only : bool, optional Whether to return the *OpenColorIO* view `Colorspace` signature only, i.e. the arguments for its instantiation. @@ -407,13 +467,13 @@ def style_to_colorspace( builtin_transform = ocio.BuiltinTransform(style) description = None - if describe != ColorspaceDescriptionStyle.NONE: + if describe != DescriptionStyle.NONE: description = [] if describe in ( - ColorspaceDescriptionStyle.OPENCOLORIO, - ColorspaceDescriptionStyle.SHORT_UNION, - ColorspaceDescriptionStyle.LONG_UNION, + DescriptionStyle.OPENCOLORIO, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, ): description.append(builtin_transform.getDescription()) @@ -422,11 +482,11 @@ def style_to_colorspace( signature = {} clf_transform = kwargs.pop("clf_transform", None) if clf_transform: - signature.update( - clf_transform_to_colorspace( - clf_transform, signature_only=True, **kwargs - ) + colorspace_signature = clf_transform_to_colorspace( + clf_transform, describe, amf_components, True, **kwargs ) + description = colorspace_signature["description"] + signature.update(colorspace_signature) source = clf_transform.source else: # TODO: Implement solid "BuiltinTransform" source detection. @@ -477,7 +537,8 @@ def style_to_colorspace( def style_to_named_transform( style, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, signature_only=False, scheme="Modern 1", # noqa: ARG001 **kwargs, @@ -491,7 +552,10 @@ def style_to_named_transform( *OpenColorIO* builtin transform style. describe : int, optional Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + :class:`opencolorio_config_aces.DescriptionStyle` enum. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *ACES* *CTL* transform + description. signature_only : bool, optional Whether to return the *OpenColorIO* view `Colorspace` signature only, i.e. the arguments for its instantiation. @@ -515,13 +579,13 @@ def style_to_named_transform( builtin_transform = ocio.BuiltinTransform(style) description = None - if describe != ColorspaceDescriptionStyle.NONE: + if describe != DescriptionStyle.NONE: description = [] if describe in ( - ColorspaceDescriptionStyle.OPENCOLORIO, - ColorspaceDescriptionStyle.SHORT_UNION, - ColorspaceDescriptionStyle.LONG_UNION, + DescriptionStyle.OPENCOLORIO, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, ): description.append(builtin_transform.getDescription()) @@ -530,11 +594,11 @@ def style_to_named_transform( signature = {} clf_transform = kwargs.pop("clf_transform", None) if clf_transform: - signature.update( - clf_transform_to_colorspace( - clf_transform, signature_only=True, **kwargs - ) + colorspace_signature = clf_transform_to_colorspace( + clf_transform, describe, amf_components, True, **kwargs ) + description = colorspace_signature["description"] + signature.update(colorspace_signature) signature.pop("from_reference", None) source = clf_transform.source else: @@ -723,7 +787,7 @@ def generate_config_cg( config_name=None, profile_version=PROFILE_VERSION_DEFAULT, validate=True, - describe=ColorspaceDescriptionStyle.SHORT_UNION, + describe=DescriptionStyle.SHORT_UNION, config_mapping_file_path=PATH_TRANSFORMS_MAPPING_FILE_CG, scheme="Modern 1", additional_data=False, @@ -768,7 +832,7 @@ def generate_config_cg( Whether to validate the config. describe : int, optional Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + :class:`opencolorio_config_aces.DescriptionStyle` enum. config_mapping_file_path : unicode, optional Path to the *CSV* mapping file used to describe the transforms mapping. scheme : str, optional @@ -781,18 +845,25 @@ def generate_config_cg( ------- Config or tuple *OpenColorIO* config or tuple of *OpenColorIO* config and - :class:`opencolorio_config_aces.ConfigData` class instance. + :class:`opencolorio_config_aces.ConfigData` class instance, *ACES* + *CTL* transforms, *CLF* transforms and *ACES* *AMF* components. """ + scheme = validate_method(scheme, ["Legacy", "Modern 1"]) + logger.info( 'Generating "%s" config...', config_name_cg(config_mapping_file_path, profile_version), ) - scheme = validate_method(scheme, ["Legacy", "Modern 1"]) + clf_transforms = unclassify_clf_transforms( + classify_clf_transforms(discover_clf_transforms()) + ) + + logger.debug('Using %s "CLF" transforms...', clf_transforms) if data is None: - _config, data = generate_config_aces( + _config, data, ctl_transforms, amf_components = generate_config_aces( profile_version=profile_version, describe=describe, analytical=False, @@ -800,16 +871,6 @@ def generate_config_cg( additional_data=True, ) - clf_transforms = unclassify_clf_transforms( - classify_clf_transforms(discover_clf_transforms()) - ) - - logger.debug('Using %s "CLF" transforms...', clf_transforms) - - logger.debug( - 'Using %s "Builtin" transforms...', list(BUILTIN_TRANSFORMS.keys()) - ) - def clf_transform_from_id(clf_transform_id): """ Filter the "CLFTransform" instances matching given "CLFtransformID". @@ -1054,6 +1115,7 @@ def view_filterer(transform): kwargs = { "describe": describe, + "amf_components": amf_components, "signature_only": True, "aliases": transform_data_aliases(transform_data), "encoding": transform_data.get("encoding"), @@ -1191,7 +1253,7 @@ def view_filterer(transform): ) if additional_data: - return config, data + return config, data, ctl_transforms, clf_transforms, amf_components else: return config @@ -1214,7 +1276,13 @@ def view_filterer(transform): for profile_version in SUPPORTED_PROFILE_VERSIONS: config_basename = config_basename_cg(profile_version=profile_version) - config, data = generate_config_cg( + ( + config, + data, + ctl_transforms, + clf_transforms, + amf_components, + ) = generate_config_cg( config_name=build_directory / config_basename, profile_version=profile_version, additional_data=True, diff --git a/opencolorio_config_aces/config/reference/__init__.py b/opencolorio_config_aces/config/reference/__init__.py index adfd8fdb..6597d9c9 100644 --- a/opencolorio_config_aces/config/reference/__init__.py +++ b/opencolorio_config_aces/config/reference/__init__.py @@ -7,6 +7,7 @@ classify_aces_ctl_transforms, unclassify_ctl_transforms, filter_ctl_transforms, + generate_amf_components, print_aces_taxonomy, build_aces_conversion_graph, node_to_ctl_transform, @@ -16,7 +17,7 @@ plot_aces_conversion_graph, ) from .generate import ( - ColorspaceDescriptionStyle, + DescriptionStyle, version_config_mapping_file, generate_config_aces, ) @@ -27,6 +28,7 @@ "classify_aces_ctl_transforms", "unclassify_ctl_transforms", "filter_ctl_transforms", + "generate_amf_components", "print_aces_taxonomy", "build_aces_conversion_graph", "node_to_ctl_transform", @@ -36,7 +38,7 @@ "plot_aces_conversion_graph", ] __all__ += [ - "ColorspaceDescriptionStyle", + "DescriptionStyle", "version_config_mapping_file", "generate_config_aces", ] diff --git a/opencolorio_config_aces/config/reference/discover/__init__.py b/opencolorio_config_aces/config/reference/discover/__init__.py index 7bdcec42..39ffe4b3 100644 --- a/opencolorio_config_aces/config/reference/discover/__init__.py +++ b/opencolorio_config_aces/config/reference/discover/__init__.py @@ -7,6 +7,7 @@ classify_aces_ctl_transforms, unclassify_ctl_transforms, filter_ctl_transforms, + generate_amf_components, print_aces_taxonomy, ) from .graph import ( @@ -24,6 +25,7 @@ "classify_aces_ctl_transforms", "unclassify_ctl_transforms", "filter_ctl_transforms", + "generate_amf_components", "print_aces_taxonomy", ] __all__ += [ diff --git a/opencolorio_config_aces/config/reference/discover/classify.py b/opencolorio_config_aces/config/reference/discover/classify.py index 72c9f9ad..743204c1 100644 --- a/opencolorio_config_aces/config/reference/discover/classify.py +++ b/opencolorio_config_aces/config/reference/discover/classify.py @@ -12,6 +12,7 @@ - :func:`opencolorio_config_aces.unclassify_ctl_transforms` - :func:`opencolorio_config_aces.filter_ctl_transforms` - :func:`opencolorio_config_aces.print_aces_taxonomy` +- :func:`opencolorio_config_aces.generate_amf_components` """ import itertools @@ -62,6 +63,8 @@ "unclassify_ctl_transforms", "filter_ctl_transforms", "print_aces_taxonomy", + "COMPONENTS_AMF_IMPLICIT", + "generate_amf_components", ] logger = logging.getLogger(__name__) @@ -698,9 +701,11 @@ class CTLTransform: path : unicode *ACES* *CTL* transform path. family : unicode, optional - *ACES* *CTL* transform family, e.g. *output_transform* + *ACES* *CTL* transform family, e.g. *output_transform*. genus : unicode, optional - *ACES* *CTL* transform genus, e.g. *dcdm* + *ACES* *CTL* transform genus, e.g. *dcdm*. + siblings : array_like, optional + *ACES* *CTL* transform siblings, e.g. inverse transform. Attributes ---------- @@ -722,7 +727,10 @@ class CTLTransform: __ne__ """ - def __init__(self, path, family=None, genus=None): + def __init__(self, path, family=None, genus=None, siblings=None): + if siblings is None: + siblings = [] + self._path = os.path.abspath(os.path.normpath(path)) self._code = None @@ -732,6 +740,7 @@ def __init__(self, path, family=None, genus=None): self._family = family self._genus = genus + self._siblings = siblings self._parse() @@ -861,6 +870,24 @@ def genus(self): return self._genus + @property + def siblings(self): + """ + Getter property for the *ACES* *CTL* transform siblings, e.g. inverse + transform. + + Returns + ------- + unicode + *ACES* *CTL* transform siblings. + + Notes + ----- + - This property is read only. + """ + + return self._siblings + def __getattr__(self, item): """ Reimplement the :meth:`object.__getattr__` so that unsuccessful @@ -1311,6 +1338,9 @@ def classify_aces_ctl_transforms(unclassified_ctl_transforms): pairs["inverse_transform"], family, genus ) + forward_ctl_transform.siblings.append(inverse_ctl_transform) + inverse_ctl_transform.siblings.append(forward_ctl_transform) + ctl_transform = CTLTransformPair( forward_ctl_transform, inverse_ctl_transform ) @@ -1328,7 +1358,7 @@ def classify_aces_ctl_transforms(unclassified_ctl_transforms): def unclassify_ctl_transforms(classified_ctl_transforms): """ - Unclassifie given *ACES* *CTL* transforms. + Unclassify given *ACES* *CTL* transforms. Parameters ---------- @@ -1458,12 +1488,169 @@ def print_aces_taxonomy(): ctl_transform.source, ctl_transform.target, ) + logger.info( + '\t\tACEStransformID : "%s"', + ctl_transform.aces_transform_id.aces_transform_id, + ) elif isinstance(ctl_transform, CTLTransformPair): logger.info( '\t\t"%s" <--> "%s"', ctl_transform.forward_transform.source, - ctl_transform.forward_transform.target, + ctl_transform.inverse_transform.target, + ) + logger.info( + '\t\tACEStransformID : "%s"', + ctl_transform.forward_transform.aces_transform_id.aces_transform_id, + ) + logger.info( + '\t\tACEStransformID : "%s"', + ctl_transform.inverse_transform.aces_transform_id.aces_transform_id, + ) + + +COMPONENTS_AMF_IMPLICIT = { + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.BMDFilm_WideGamut_Gen5_to_ACES.a1.v1": [ + "urn:ampas:aces:transformId:v1.5:" + "IDT.BlackmagicDesign.BMDFilm_WideGamut_Gen5.a1.v1" + ], + # NOTE: Not a published "ACEStransformID" but was approved by + # "Graeme Natress" during private discussions with "Carol Payne" and + # "Doug Walker" in March 2022. + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.Log3G10_RWG_to_ACES.a1.1.0": [ + "urn:ampas:aces:transformId:v1.5:IDT.RED.Log3G10_REDWideGamutRGB.a1.v1" + ], + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.LogC_EI800_AWG_to_ACES.a1.1.0": [ + "urn:ampas:aces:transformId:v1.5:IDT.ARRI.Alexa-v3-logC-EI800.a1.v2" + ], + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.ACES_to_Log3G10_RWG.a1.1.0": [], + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.SLog3_SGamut3_to_ACES.a1.1.0": [ + "urn:ampas:aces:transformId:v1.5:IDT.Sony.SLog3_SGamut3.a1.v1" + ], + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.SLog3_SGamut3Cine_to_ACES.a1.1.0": [ + "urn:ampas:aces:transformId:v1.5:IDT.Sony.SLog3_SGamut3Cine.a1.v1" + ], + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.SLog3_Venice_SGamut3_to_ACES.a1.1.0": [ + "urn:ampas:aces:transformId:v1.5:" + "IDT.Sony.Venice_SLog3_SGamut3.a1.v1" + ], + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.SLog3_Venice_SGamut3Cine_to_ACES.a1.1.0": [ + "urn:ampas:aces:transformId:v1.5:" + "IDT.Sony.Venice_SLog3_SGamut3Cine.a1.v1" + ], + # NOTE: The related "ACEStransformID" is not in "aces-dev" but available + # online in the following "IDT" : https://pro-av.panasonic.net/en/\ + # cinema_camera_varicam_eva/support/download_data/\ + # idt_panasonic_forV35_ver100.zip + "urn:ampas:aces:transformId:v1.5:" + "ACEScsc.Academy.VLog_VGamut_to_ACES.a1.1.0": [ + "urn:ampas:aces:transformId:v1.5:IDT.Panasonic.VLog_VGamut.a1.v1" + ], +} +""" +Implicit *ACES* *AMF* components. + +Notes +----- +Those are currently hardcoded as there is no trivial way to build a +relationship between an *ACES* *CSC* and an *ACES* *IDT*. + +COMPONENTS_AMF_IMPLICIT : dict +""" + + +def generate_amf_components(ctl_transforms, raise_exception=False): + """ + Generate the *ACES* *AMF* components from given *ACES* *CTL* transforms. + + Parameters + ---------- + ctl_transforms : dict or list + *ACES* *CTL* transforms as returned by + :func:`opencolorio_config_aces.classify_aces_ctl_transforms` or + :func:`opencolorio_config_aces.unclassify_aces_ctl_transforms` + definitions. + raise_exception : bool, optional + Whether to raise an exception if an *ACES* *ACEStransformID* is + missing. + + Returns + ------- + dict + *ACES* *AMF* components. + """ + mapping = defaultdict(list) + + if isinstance(ctl_transforms, Mapping): + ctl_transforms = unclassify_ctl_transforms(ctl_transforms) + + # Checking that the explicit "ACEStransformID" do exist. + for aces_transform_id, relations in COMPONENTS_AMF_IMPLICIT.items(): + explicit_aces_transform_ids = [aces_transform_id] + explicit_aces_transform_ids.extend(relations) + + for explicit_aces_transform_id in explicit_aces_transform_ids: + filtered_ctl_transforms = filter_ctl_transforms( + ctl_transforms, + [ + lambda x, y=explicit_aces_transform_id: ( + x.aces_transform_id.aces_transform_id == y + ) + ], + ) + + ctl_transform = next(iter(filtered_ctl_transforms), None) + + if ctl_transform is None: + exception_message = ( + f'"aces-dev" has no transform with ' + f'"{explicit_aces_transform_id}" "ACEStransformID!' + ) + + if raise_exception: + attest(False, exception_message) + else: + logger.critical(exception_message) + + for ctl_transform in ctl_transforms: + aces_transform_id = ctl_transform.aces_transform_id.aces_transform_id + + for siblings in [ + ctl_transform.siblings + for ctl_transform in filter_ctl_transforms( + ctl_transforms, + [ + lambda x, y=aces_transform_id: ( + x.aces_transform_id.aces_transform_id == y ) + ], + ) + ]: + for sibling in siblings: + mapping[aces_transform_id].append( + sibling.aces_transform_id.aces_transform_id + ) + + # Extending with explicit relations. + for aces_transform_id, relations in COMPONENTS_AMF_IMPLICIT.items(): + mapping[aces_transform_id].extend(relations) + + # Generating the permutations. + for aces_transform_id, relations in mapping.copy().items(): + for relation in relations: + mapping[relation] = sorted( + {*relations, *mapping[relation], aces_transform_id} + - {relation} + ) + + return dict(mapping) if __name__ == "__main__": diff --git a/opencolorio_config_aces/config/reference/generate/__init__.py b/opencolorio_config_aces/config/reference/generate/__init__.py index 89f6a76b..a9278e18 100644 --- a/opencolorio_config_aces/config/reference/generate/__init__.py +++ b/opencolorio_config_aces/config/reference/generate/__init__.py @@ -2,13 +2,13 @@ # Copyright Contributors to the OpenColorIO Project. from .config import ( - ColorspaceDescriptionStyle, + DescriptionStyle, version_config_mapping_file, generate_config_aces, ) __all__ = [ - "ColorspaceDescriptionStyle", + "DescriptionStyle", "version_config_mapping_file", "generate_config_aces", ] diff --git a/opencolorio_config_aces/config/reference/generate/analytical.py b/opencolorio_config_aces/config/reference/generate/analytical.py index 254d6cf3..c74b8c18 100644 --- a/opencolorio_config_aces/config/reference/generate/analytical.py +++ b/opencolorio_config_aces/config/reference/generate/analytical.py @@ -27,7 +27,7 @@ SEPARATOR_NODE_NAME_CTL, ) from opencolorio_config_aces.config.reference import ( - ColorspaceDescriptionStyle, + DescriptionStyle, build_aces_conversion_graph, classify_aces_ctl_transforms, conversion_path, @@ -234,7 +234,7 @@ def node_to_colorspace( graph, node, profile_version=PROFILE_VERSION_DEFAULT, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, ): """ Generate the *OpenColorIO* `Colorspace` for given *aces-dev* conversion @@ -250,7 +250,7 @@ def node_to_colorspace( *OpenColorIO* config profile version. describe : int, optional Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + :class:`opencolorio_config_aces.DescriptionStyle` enum. Returns ------- @@ -356,7 +356,7 @@ def generate_config_aces( config_name=None, profile_version=PROFILE_VERSION_DEFAULT, validate=True, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, filterers=None, additional_data=False, ): @@ -381,7 +381,7 @@ def generate_config_aces( Whether to validate the config. describe : int, optional Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + :class:`opencolorio_config_aces.DescriptionStyle` enum. filterers : array_like, optional List of callables used to filter the *ACES* *CTL* transforms, each callable takes an *ACES* *CTL* transform as argument and returns diff --git a/opencolorio_config_aces/config/reference/generate/config.py b/opencolorio_config_aces/config/reference/generate/config.py index b1fbc9a9..442d2f65 100644 --- a/opencolorio_config_aces/config/reference/generate/config.py +++ b/opencolorio_config_aces/config/reference/generate/config.py @@ -39,6 +39,8 @@ from opencolorio_config_aces.config.reference import ( classify_aces_ctl_transforms, discover_aces_ctl_transforms, + filter_ctl_transforms, + generate_amf_components, unclassify_ctl_transforms, version_aces_dev, ) @@ -62,7 +64,9 @@ "COLORSPACE_SCENE_ENCODING_REFERENCE", "COLORSPACE_OUTPUT_ENCODING_REFERENCE", "FAMILY_DISPLAY_REFERENCE", - "ColorspaceDescriptionStyle", + "TEMPLATE_ACES_TRANSFORM_ID", + "HEADER_AMF_COMPONENTS", + "DescriptionStyle", "version_config_mapping_file", "format_optional_prefix", "format_swapped_affix", @@ -103,7 +107,6 @@ PATH_TRANSFORMS_MAPPING_FILE_REFERENCE : unicode """ - COLORSPACE_SCENE_ENCODING_REFERENCE = "ACES2065-1" """ *OpenColorIO* config reference colorspace. @@ -125,10 +128,24 @@ FAMILY_DISPLAY_REFERENCE : unicode """ +TEMPLATE_ACES_TRANSFORM_ID = "ACEStransformID: {}" +""" +Template for the description of an *ACEStransformID*. + +TEMPLATE_ACES_TRANSFORM_ID : unicode +""" -class ColorspaceDescriptionStyle(Flag): +HEADER_AMF_COMPONENTS = "\nAMF Components\n--------------" +""" +Header for the description of the *ACES* *AMF* components. + +HEADER_AMF_COMPONENTS : unicode +""" + + +class DescriptionStyle(Flag): """ - Enum storing the various *OpenColorIO* `Colorspace` description styles. + Enum storing the various *OpenColorIO* description styles. """ NONE = auto() @@ -136,8 +153,9 @@ class ColorspaceDescriptionStyle(Flag): OPENCOLORIO = auto() SHORT = auto() LONG = auto() - SHORT_UNION = ACES | OPENCOLORIO | SHORT - LONG_UNION = ACES | OPENCOLORIO | LONG + AMF = auto() + SHORT_UNION = ACES | OPENCOLORIO | SHORT | AMF + LONG_UNION = ACES | OPENCOLORIO | LONG | AMF def version_config_mapping_file(path=PATH_TRANSFORMS_MAPPING_FILE_REFERENCE): @@ -364,7 +382,8 @@ def ctl_transform_to_transform_family(ctl_transform, analytical=True): def ctl_transform_to_description( ctl_transform, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, factory=colorspace_factory, **kwargs, ): @@ -377,8 +396,11 @@ def ctl_transform_to_description( ctl_transform : CTLTransform *ACES* *CTL* transform to generate the *OpenColorIO* `Colorspace` for. describe : bool, optional - Whether to use the full *ACES* *CTL* transform description or just the - first line. + *ACES* *CTL* transform description style. Any value from the + :class:`opencolorio_config_aces.DescriptionStyle` enum. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *ACES* *CTL* transform + description. factory : callable, optional Factory used to adjust the code paths because of slight difference of signature between the *OpenColorIO* `Colorspace` and `Look`. @@ -395,14 +417,17 @@ def ctl_transform_to_description( *OpenColorIO* `Colorspace` or `Look` description. """ + if amf_components is None: + amf_components = {} + description = None - if describe != ColorspaceDescriptionStyle.NONE: + if describe != DescriptionStyle.NONE: description = [] if describe in ( - ColorspaceDescriptionStyle.OPENCOLORIO, - ColorspaceDescriptionStyle.SHORT_UNION, - ColorspaceDescriptionStyle.LONG_UNION, + DescriptionStyle.OPENCOLORIO, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, ): forward, inverse = ( [ @@ -425,10 +450,10 @@ def ctl_transform_to_description( description.append(transform.getDescription()) if describe in ( - ColorspaceDescriptionStyle.ACES, - ColorspaceDescriptionStyle.ACES | ColorspaceDescriptionStyle.SHORT, - ColorspaceDescriptionStyle.SHORT_UNION, - ColorspaceDescriptionStyle.LONG_UNION, + DescriptionStyle.ACES, + DescriptionStyle.ACES | DescriptionStyle.SHORT, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, ): if len(description) > 0: description.append("") @@ -438,18 +463,35 @@ def ctl_transform_to_description( ) if describe in ( - ColorspaceDescriptionStyle.ACES, - ColorspaceDescriptionStyle.ACES - | ColorspaceDescriptionStyle.SHORT, - ColorspaceDescriptionStyle.SHORT_UNION, + DescriptionStyle.ACES, + DescriptionStyle.ACES | DescriptionStyle.SHORT, + DescriptionStyle.SHORT_UNION, ): - description.append(f"ACEStransformID: {aces_transform_id}") + description.append( + TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id) + ) else: description.append("CTL Transform") description.append(f'{"=" * len(description[-1])}\n') - description.append(f"{ctl_transform.description}\n") - description.append(f"ACEStransformID: {aces_transform_id}") + description.append( + TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id) + ) + + if describe in ( + DescriptionStyle.AMF, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, + ): + amf_components_description = [ + TEMPLATE_ACES_TRANSFORM_ID.format(amf_aces_transform_id) + for amf_aces_transform_id in amf_components.get( + aces_transform_id, [] + ) + ] + if amf_components_description: + description.append(HEADER_AMF_COMPONENTS) + description.extend(amf_components_description) description = "\n".join(description) @@ -458,7 +500,8 @@ def ctl_transform_to_description( def ctl_transform_to_colorspace( ctl_transform, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, analytical=True, signature_only=False, scheme="Modern 1", @@ -473,8 +516,11 @@ def ctl_transform_to_colorspace( ctl_transform : CTLTransform *ACES* *CTL* transform to generate the *OpenColorIO* `Colorspace` for. describe : bool, optional - Whether to use the full *ACES* *CTL* transform description or just the - first line. + *ACES* *CTL* transform description style. Any value from the + :class:`opencolorio_config_aces.DescriptionStyle` enum. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *OpenColorIO* `Colorspace` + description. analytical : bool, optional Whether to generate the *OpenColorIO* transform family that analytically matches the given *ACES* *CTL* transform, i.e. true to @@ -501,7 +547,7 @@ def ctl_transform_to_colorspace( name = ctl_transform_to_colorspace_name(ctl_transform) family = ctl_transform_to_transform_family(ctl_transform, analytical) description = ctl_transform_to_description( - ctl_transform, describe, colorspace_factory, **kwargs + ctl_transform, describe, amf_components, colorspace_factory, **kwargs ) signature = { @@ -529,7 +575,8 @@ def ctl_transform_to_colorspace( def ctl_transform_to_look( ctl_transform, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, analytical=True, signature_only=False, scheme="Modern 1", @@ -544,8 +591,11 @@ def ctl_transform_to_look( ctl_transform : CTLTransform *ACES* *CTL* transform to generate the *OpenColorIO* `Look` for. describe : bool, optional - Whether to use the full *ACES* *CTL* transform description or just the - first line. + *ACES* *CTL* transform description style. Any value from the + :class:`opencolorio_config_aces.DescriptionStyle` enum. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *OpenColorIO* `Look` + description. analytical : bool, optional Whether to generate the *OpenColorIO* transform family that analytically matches the given *ACES* *CTL* transform, i.e. true to @@ -572,7 +622,7 @@ def ctl_transform_to_look( name = ctl_transform_to_look_name(ctl_transform) family = ctl_transform_to_transform_family(ctl_transform, analytical) description = ctl_transform_to_description( - ctl_transform, describe, look_factory, **kwargs + ctl_transform, describe, amf_components, look_factory, **kwargs ) signature = { @@ -594,7 +644,8 @@ def ctl_transform_to_look( def style_to_view_transform( style, ctl_transforms, - describe=ColorspaceDescriptionStyle.LONG_UNION, + describe=DescriptionStyle.LONG_UNION, + amf_components=None, signature_only=False, scheme="Modern 1", **kwargs, @@ -610,8 +661,11 @@ def style_to_view_transform( Array of :class:`opencolorio_config_aces.config.reference.CTLTransform` class instances corresponding to the given style. describe : int, optional - Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + Any value from the :class:`opencolorio_config_aces.DescriptionStyle` + enum. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *OpenColorIO* `ViewTransform` + description. signature_only : bool, optional Whether to return the *OpenColorIO* `ViewTransform` signature only, i.e. the arguments for its instantiation. @@ -635,21 +689,21 @@ class instances corresponding to the given style. builtin_transform = ocio.BuiltinTransform(style) description = None - if describe != ColorspaceDescriptionStyle.NONE: + if describe != DescriptionStyle.NONE: description = [] if describe in ( - ColorspaceDescriptionStyle.OPENCOLORIO, - ColorspaceDescriptionStyle.SHORT_UNION, - ColorspaceDescriptionStyle.LONG_UNION, + DescriptionStyle.OPENCOLORIO, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, ): description.append(builtin_transform.getDescription()) if describe in ( - ColorspaceDescriptionStyle.ACES, - ColorspaceDescriptionStyle.ACES | ColorspaceDescriptionStyle.SHORT, - ColorspaceDescriptionStyle.SHORT_UNION, - ColorspaceDescriptionStyle.LONG_UNION, + DescriptionStyle.ACES, + DescriptionStyle.ACES | DescriptionStyle.SHORT, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, ): aces_transform_ids, aces_descriptions = zip( *[ @@ -665,9 +719,8 @@ class instances corresponding to the given style. description.append("") if describe in ( - ColorspaceDescriptionStyle.ACES - | ColorspaceDescriptionStyle.SHORT, - ColorspaceDescriptionStyle.SHORT_UNION, + DescriptionStyle.ACES | DescriptionStyle.SHORT, + DescriptionStyle.SHORT_UNION, ): description.extend( [ @@ -696,6 +749,27 @@ class instances corresponding to the given style. ) ) + if describe in ( + DescriptionStyle.AMF, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, + ): + amf_components_description = [] + for aces_transform_id in aces_transform_ids: + amf_components_description.extend( + [ + TEMPLATE_ACES_TRANSFORM_ID.format( + amf_aces_transform_id + ) + for amf_aces_transform_id in amf_components.get( + aces_transform_id, [] + ) + ] + ) + if amf_components_description: + description.append(HEADER_AMF_COMPONENTS) + description.extend(amf_components_description) + description = "\n".join(description) version = style.split(SEPARATOR_COLORSPACE_NAME)[-1].split("_")[-1] @@ -724,7 +798,8 @@ class instances corresponding to the given style. def style_to_display_colorspace( style, - describe=ColorspaceDescriptionStyle.OPENCOLORIO, + describe=DescriptionStyle.OPENCOLORIO, + amf_components=None, signature_only=False, scheme="Modern 1", **kwargs, @@ -738,8 +813,11 @@ def style_to_display_colorspace( style : unicode *OpenColorIO* builtin transform style describe : int, optional - Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + Any value from the :class:`opencolorio_config_aces.DescriptionStyle` + enum. + amf_components : mapping, optional + *ACES* *AMF* components used to extend the *OpenColorIO* display + `Colorspace` description. signature_only : bool, optional Whether to return the *OpenColorIO* display `Colorspace` signature only, i.e. the arguments for its instantiation. @@ -765,16 +843,32 @@ def style_to_display_colorspace( builtin_transform = ocio.BuiltinTransform(style) description = None - if describe != ColorspaceDescriptionStyle.NONE: + if describe != DescriptionStyle.NONE: description = [] if describe in ( - ColorspaceDescriptionStyle.OPENCOLORIO, - ColorspaceDescriptionStyle.SHORT_UNION, - ColorspaceDescriptionStyle.LONG_UNION, + DescriptionStyle.OPENCOLORIO, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, ): description.append(builtin_transform.getDescription()) + if len(description) > 0: + description.append("") + + if describe in ( + DescriptionStyle.AMF, + DescriptionStyle.SHORT_UNION, + DescriptionStyle.LONG_UNION, + ): + amf_components_description = [ + TEMPLATE_ACES_TRANSFORM_ID.format(amf_aces_transform_id) + for amf_aces_transform_id in amf_components.get(style, []) + ] + if amf_components_description: + description.append(HEADER_AMF_COMPONENTS) + description.extend(amf_components_description) + description = "\n".join(description) signature = { @@ -971,7 +1065,7 @@ def generate_config_aces( config_name=None, profile_version=PROFILE_VERSION_DEFAULT, validate=True, - describe=ColorspaceDescriptionStyle.SHORT_UNION, + describe=DescriptionStyle.SHORT_UNION, config_mapping_file_path=PATH_TRANSFORMS_MAPPING_FILE_REFERENCE, analytical=True, scheme="Modern 1", @@ -1002,7 +1096,7 @@ def generate_config_aces( Whether to validate the config. describe : int, optional Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + :class:`opencolorio_config_aces.DescriptionStyle` enum. config_mapping_file_path : unicode, optional Path to the *CSV* mapping file used by the *Mapping* method. analytical : bool, optional @@ -1018,8 +1112,9 @@ def generate_config_aces( Returns ------- Config or tuple - *OpenColorIO* config or tuple of *OpenColorIO* config and - :class:`opencolorio_config_aces.ConfigData` class instance. + *OpenColorIO* config or tuple of *OpenColorIO* config, + :class:`opencolorio_config_aces.ConfigData` class instance, *ACES* + *CTL* transforms and *ACES* *AMF* components. """ logger.info( @@ -1027,16 +1122,17 @@ def generate_config_aces( config_name_aces(config_mapping_file_path, profile_version), ) + logger.debug( + 'Using %s "Builtin" transforms...', list(BUILTIN_TRANSFORMS.keys()) + ) + ctl_transforms = unclassify_ctl_transforms( classify_aces_ctl_transforms(discover_aces_ctl_transforms()) ) + amf_components = generate_amf_components(ctl_transforms) logger.debug('Using %s "CTL" transforms...', ctl_transforms) - logger.debug( - 'Using %s "Builtin" transforms...', list(BUILTIN_TRANSFORMS.keys()) - ) - logger.info( 'Parsing "%s" config mapping file...', config_mapping_file_path ) @@ -1103,12 +1199,14 @@ def generate_config_aces( # "ACEStransformID", if it does not exist, there is a critical # mismatch in the mapping with *aces-dev*. aces_transform_id = transform_data["aces_transform_id"] - filtered_ctl_transforms = [ - ctl_transform - for ctl_transform in ctl_transforms - if ctl_transform.aces_transform_id.aces_transform_id - == aces_transform_id - ] + filtered_ctl_transforms = filter_ctl_transforms( + ctl_transforms, + [ + lambda x, y=aces_transform_id: ( + x.aces_transform_id.aces_transform_id == y + ) + ], + ) ctl_transform = next(iter(filtered_ctl_transforms), None) @@ -1124,6 +1222,18 @@ def generate_config_aces( transform_data["ctl_transform"] = ctl_transform + # Extending the "AMF" relations. + if not amf_components.get(style): + amf_components[style] = [] + + amf_components[style].extend( + [ctl_transform.aces_transform_id.aces_transform_id] + + [ + sibling.aces_transform_id.aces_transform_id + for sibling in ctl_transform.siblings + ] + ) + config_mapping[transform_data["builtin_transform_style"]].append( transform_data ) @@ -1190,6 +1300,7 @@ def generate_config_aces( for transform_data in transforms_data ], describe, + amf_components, signature_only=True, scheme=scheme, ) @@ -1205,6 +1316,8 @@ def generate_config_aces( display = style_to_display_colorspace( display_style, + describe, + amf_components, signature_only=True, scheme=scheme, encoding=transform_data.get("encoding"), @@ -1242,6 +1355,7 @@ def generate_config_aces( look = ctl_transform_to_look( ctl_transform, describe, + amf_components, analytical=analytical, signature_only=True, scheme=scheme, @@ -1262,6 +1376,7 @@ def generate_config_aces( colorspace = ctl_transform_to_colorspace( ctl_transform, describe, + amf_components, analytical=analytical, signature_only=True, scheme=scheme, @@ -1362,7 +1477,7 @@ def generate_config_aces( ) if additional_data: - return config, data + return config, data, ctl_transforms, amf_components else: return config @@ -1387,7 +1502,7 @@ def generate_config_aces( for profile_version in SUPPORTED_PROFILE_VERSIONS: config_basename = config_basename_aces(profile_version=profile_version) - config, data = generate_config_aces( + (config, data, ctl_transforms, amf_components,) = generate_config_aces( config_name=build_directory / config_basename, profile_version=profile_version, analytical=False, diff --git a/opencolorio_config_aces/config/studio/generate/config.py b/opencolorio_config_aces/config/studio/generate/config.py index e5ae1b50..7eff0105 100644 --- a/opencolorio_config_aces/config/studio/generate/config.py +++ b/opencolorio_config_aces/config/studio/generate/config.py @@ -19,7 +19,7 @@ generate_config, ) from opencolorio_config_aces.config.reference import ( - ColorspaceDescriptionStyle, + DescriptionStyle, ) from opencolorio_config_aces.config.cg import ( generate_config_cg, @@ -172,7 +172,7 @@ def generate_config_studio( config_name=None, profile_version=PROFILE_VERSION_DEFAULT, validate=True, - describe=ColorspaceDescriptionStyle.SHORT_UNION, + describe=DescriptionStyle.SHORT_UNION, config_mapping_file_path=PATH_TRANSFORMS_MAPPING_FILE_STUDIO, scheme="Modern 1", additional_data=False, @@ -209,7 +209,7 @@ def generate_config_studio( Whether to validate the config. describe : int, optional Any value from the - :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum. + :class:`opencolorio_config_aces.DescriptionStyle` enum. config_mapping_file_path : unicode, optional Path to the *CSV* mapping file used to describe the transforms mapping. scheme : str, optional @@ -222,7 +222,8 @@ def generate_config_studio( ------- Config or tuple *OpenColorIO* config or tuple of *OpenColorIO* config and - :class:`opencolorio_config_aces.ConfigData` class instance. + :class:`opencolorio_config_aces.ConfigData` class instance, *ACES* + *CTL* transforms, *CLF* transforms and *ACES* *AMF* components. """ logger.info( @@ -233,7 +234,13 @@ def generate_config_studio( scheme = validate_method(scheme, ["Legacy", "Modern 1"]) if data is None: - _config, data = generate_config_cg( + ( + _config, + data, + ctl_transforms, + clf_transforms, + amf_components, + ) = generate_config_cg( profile_version=profile_version, describe=describe, scheme=scheme, @@ -257,7 +264,7 @@ def generate_config_studio( ) if additional_data: - return config, data + return config, data, ctl_transforms, clf_transforms, amf_components else: return config @@ -284,7 +291,13 @@ def generate_config_studio( config_basename = config_basename_studio( profile_version=profile_version ) - config, data = generate_config_studio( + ( + config, + data, + ctl_transforms, + clf_transforms, + amf_components, + ) = generate_config_studio( config_name=build_directory / config_basename, profile_version=profile_version, additional_data=True,