Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fixing descriptions of inversed NamedTransforms #117

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions opencolorio_config_aces/config/cg/generate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def clf_transform_to_description(
clf_transform,
describe=DescriptionStyle.LONG_UNION,
amf_components=None,
direction="Forward",
):
"""
Generate the *OpenColorIO* `Colorspace` or `NamedTransform` description for
Expand All @@ -180,6 +181,10 @@ def clf_transform_to_description(
amf_components : mapping, optional
*ACES* *AMF* components used to extend the *ACES* *CTL* transform
description.
direction : str, optional
Direction of transform -- determines order of transform descriptors.
{"Forward", "Reverse"}
Default: "Forward" (i.e., assume 'Forward' direction)

Returns
-------
Expand All @@ -200,10 +205,16 @@ def clf_transform_to_description(
DescriptionStyle.SHORT_UNION,
):
if clf_transform.description is not None:
description.append(
f"Convert {clf_transform.input_descriptor} "
f"to {clf_transform.output_descriptor}"
)
if direction.lower() == "forward":
description.append(
f"Convert {clf_transform.output_descriptor} "
f"to {clf_transform.input_descriptor}"
)
else:
description.append(
f"Convert {clf_transform.input_descriptor} "
f"to {clf_transform.output_descriptor}"
)
elif describe in ( # noqa: SIM102
DescriptionStyle.OPENCOLORIO,
DescriptionStyle.LONG,
Expand Down Expand Up @@ -389,9 +400,6 @@ 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, amf_components
),
}

file_transform = {
Expand All @@ -401,8 +409,14 @@ def clf_transform_to_named_transform(
}
if is_reference(clf_transform.source):
signature["inverse_transform"] = file_transform
signature["description"] = clf_transform_to_description(
clf_transform, describe, amf_components, direction="Reverse"
)
else:
signature["forward_transform"] = file_transform
signature["description"] = clf_transform_to_description(
clf_transform, describe, amf_components, direction="Forward"
)

signature.update(kwargs)

Expand Down
Loading