Skip to content

Commit ff3f524

Browse files
authored
PR: Refactoring (#68)
* Refactor pattern beautifiers. Signed-off-by: Thomas Mansencal <[email protected]> * Fuse "CG" and "Studio" spreadsheets. Signed-off-by: Thomas Mansencal <[email protected]> Signed-off-by: Thomas Mansencal <[email protected]>
1 parent 765371d commit ff3f524

File tree

7 files changed

+580
-501
lines changed

7 files changed

+580
-501
lines changed

opencolorio_config_aces/config/cg/generate/config.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,15 @@
2525
unclassify_clf_transforms,
2626
)
2727
from opencolorio_config_aces.config.generation import (
28+
SEPARATOR_COLORSPACE_NAME,
29+
SEPARATOR_BUILTIN_TRANSFORM_NAME,
30+
SEPARATOR_COLORSPACE_FAMILY,
2831
VersionData,
32+
beautify_alias,
33+
beautify_colorspace_name,
2934
colorspace_factory,
30-
named_transform_factory,
3135
generate_config,
36+
named_transform_factory,
3237
)
3338
from opencolorio_config_aces.config.reference import (
3439
ColorspaceDescriptionStyle,
@@ -38,9 +43,6 @@
3843
)
3944
from opencolorio_config_aces.config.reference.generate.config import (
4045
COLORSPACE_SCENE_ENCODING_REFERENCE,
41-
SEPARATOR_COLORSPACE_FAMILY_REFERENCE,
42-
beautify_alias,
43-
beautify_colorspace_name,
4446
format_optional_prefix,
4547
format_swapped_affix,
4648
)
@@ -77,8 +79,8 @@
7779

7880
URL_EXPORT_TRANSFORMS_MAPPING_FILE_CG = (
7981
"https://docs.google.com/spreadsheets/d/"
80-
"1DqxmtZpnhL_9N1wayvcW0y3bZoHRom7A1c58YLlr89g/"
81-
"export?format=csv&gid=609660164"
82+
"1nE95DEVtxtEkcIEaJk0WekyEH0Rcs8z_3fdwUtqP8V4/"
83+
"export?format=csv&gid=365242296"
8284
)
8385
"""
8486
URL to the *ACES* *CTL* transforms to *OpenColorIO* colorspaces mapping file.
@@ -230,7 +232,7 @@ def clf_transform_to_colorspace(
230232
"name": clf_transform_to_colorspace_name(clf_transform),
231233
"family": (
232234
f"{clf_transform.clf_transform_id.type}"
233-
f"{SEPARATOR_COLORSPACE_FAMILY_REFERENCE}"
235+
f"{SEPARATOR_COLORSPACE_FAMILY}"
234236
f"{clf_transform.clf_transform_id.namespace}"
235237
),
236238
"description": clf_transform_to_description(clf_transform, describe),
@@ -297,7 +299,7 @@ def clf_transform_to_named_transform(
297299
"name": clf_transform_to_colorspace_name(clf_transform),
298300
"family": (
299301
f"{clf_transform.clf_transform_id.type}"
300-
f"{SEPARATOR_COLORSPACE_FAMILY_REFERENCE}"
302+
f"{SEPARATOR_COLORSPACE_FAMILY}"
301303
f"{clf_transform.clf_transform_id.namespace}"
302304
),
303305
"description": clf_transform_to_description(clf_transform, describe),
@@ -392,7 +394,11 @@ def style_to_colorspace(
392394
source = clf_transform.source
393395
else:
394396
# TODO: Implement solid "BuiltinTransform" source detection.
395-
source = style.lower().split(" - ", 1)[-1].split("_to_")[0]
397+
source = (
398+
style.lower()
399+
.split(SEPARATOR_COLORSPACE_NAME, 1)[-1]
400+
.split(SEPARATOR_BUILTIN_TRANSFORM_NAME)[0]
401+
)
396402

397403
if is_reference(source):
398404
signature.update(
@@ -497,7 +503,11 @@ def style_to_named_transform(
497503
source = clf_transform.source
498504
else:
499505
# TODO: Implement solid "BuiltinTransform" source detection.
500-
source = style.lower().split(" - ", 1)[-1].split("_to_")[0]
506+
source = (
507+
style.lower()
508+
.split(SEPARATOR_COLORSPACE_NAME, 1)[-1]
509+
.split(SEPARATOR_BUILTIN_TRANSFORM_NAME)[0]
510+
)
501511

502512
if is_reference(source):
503513
signature.update(
@@ -970,6 +980,13 @@ def view_filterer(transform):
970980

971981
# CLF Transforms & BuiltinTransform Creation
972982
for transform_data in yield_from_config_mapping():
983+
# Inherited from the "Reference" config.
984+
if (
985+
transform_data["aces_transform_id"]
986+
and not transform_data["clf_transform_id"]
987+
):
988+
continue
989+
973990
kwargs = {
974991
"describe": describe,
975992
"signature_only": True,

opencolorio_config_aces/config/cg/generate/resources/OpenColorIO-Config-ACES CG Transforms - v0.2.0 - CG Config - Mapping.csv renamed to opencolorio_config_aces/config/cg/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v0.2.0 - CG Config - Mapping.csv

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
Ordering,Legacy Name,ACEStransformID,CLFtransformID,Interface,BuiltinTransform Style,Aliases,Encoding,Categories
2-
100,ACES - ACEScc,urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.ACEScc_to_ACES.a1.0.3,,ColorSpace,,"acescc,acescc_ap1",,file-io
3-
100,ACES - ACEScct,urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.ACEScct_to_ACES.a1.0.3,,ColorSpace,,"acescct,acescct_ap1",,file-io
4-
100,ACES - ACEScg,urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.ACEScg_to_ACES.a1.0.3,,ColorSpace,,"acescg,lin_ap1",,file-io
5-
300,Output - P3-D65 ST2084 (1000 nits),urn:ampas:aces:transformId:v1.5:RRTODT.Academy.P3D65_1000nits_15nits_ST2084.a1.1.0,,ViewTransform,,,,
6-
300,Output - P3D65,urn:ampas:aces:transformId:v1.5:ODT.Academy.P3D65_48nits.a1.1.0,,ViewTransform,,,,
7-
300,Output - Rec.2020 ST2084 (1000 nits),urn:ampas:aces:transformId:v1.5:RRTODT.Academy.Rec2020_1000nits_15nits_ST2084.a1.1.0,,ViewTransform,,,,
8-
300,Output - Rec.709,urn:ampas:aces:transformId:v1.5:ODT.Academy.Rec709_100nits_dim.a1.0.3,,ViewTransform,,,,
9-
300,Output - sRGB,urn:ampas:aces:transformId:v1.5:ODT.Academy.RGBmonitor_100nits_dim.a1.0.3,,ViewTransform,,,,
10-
400,Utility - Curve - Rec.1886,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:Linear_to_Rec1886-Curve:1.0,NamedTransform,,crv_rec1886,sdr-video,file-io
11-
400,Utility - Curve - sRGB,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:Linear_to_sRGB-Curve:1.0,NamedTransform,,crv_srgb,sdr-video,file-io
12-
410,Utility - Linear - P3-D65,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_P3-D65:1.0,ColorSpace,,lin_p3d65,scene-linear,file-io
13-
410,Utility - Linear - Rec.2020,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_Rec2020:1.0,ColorSpace,,lin_rec2020,scene-linear,file-io
14-
410,Utility - Linear - Rec.709,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_Rec709:1.0,ColorSpace,,"lin_rec709,lin_srgb,Linear sRGB",scene-linear,"file-io,working-space"
15-
410,Utility - Linear - sRGB,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_Rec709:1.0,ColorSpace,,lin_srgb,scene-linear,"file-io,working-space"
2+
100,ACES - ACEScc,urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.ACEScc_to_ACES.a1.0.3,,ColorSpace,ACEScc_to_ACES2065-1,"acescc,acescc_ap1",log,ACES
3+
100,ACES - ACEScct,urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.ACEScct_to_ACES.a1.0.3,,ColorSpace,ACEScct_to_ACES2065-1,"acescct,acescct_ap1",log,ACES
4+
100,ACES - ACEScg,urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.ACEScg_to_ACES.a1.0.3,,ColorSpace,ACEScg_to_ACES2065-1,"acescg,lin_ap1",scene-linear,ACES
5+
300,Output - P3-D65 ST2084 (1000 nits),urn:ampas:aces:transformId:v1.5:RRTODT.Academy.P3D65_1000nits_15nits_ST2084.a1.1.0,,ViewTransform,DISPLAY - CIE-XYZ-D65_to_ST2084-P3-D65,,hdr-video,ACES
6+
300,Output - P3D65,urn:ampas:aces:transformId:v1.5:ODT.Academy.P3D65_48nits.a1.1.0,,ViewTransform,ACES-OUTPUT - ACES2065-1_to_CIE-XYZ-D65 - SDR-CINEMA_1.0,,sdr-video,ACES
7+
300,Output - Rec.2020 ST2084 (1000 nits),urn:ampas:aces:transformId:v1.5:RRTODT.Academy.Rec2020_1000nits_15nits_ST2084.a1.1.0,,ViewTransform,DISPLAY - CIE-XYZ-D65_to_REC.2100-PQ,,hdr-video,ACES
8+
300,Output - Rec.709,urn:ampas:aces:transformId:v1.5:ODT.Academy.Rec709_100nits_dim.a1.0.3,,ViewTransform,ACES-OUTPUT - ACES2065-1_to_CIE-XYZ-D65 - SDR-VIDEO_1.0,,sdr-video,ACES
9+
300,Output - sRGB,urn:ampas:aces:transformId:v1.5:ODT.Academy.RGBmonitor_100nits_dim.a1.0.3,,ViewTransform,ACES-OUTPUT - ACES2065-1_to_CIE-XYZ-D65 - SDR-VIDEO_1.0,,sdr-video,ACES
10+
400,Utility - Curve - Rec.1886,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:Linear_to_Rec1886-Curve:1.0,NamedTransform,,crv_rec1886,sdr-video,
11+
400,Utility - Curve - sRGB,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:Linear_to_sRGB-Curve:1.0,NamedTransform,,crv_srgb,sdr-video,
12+
410,Utility - Linear - P3-D65,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_P3-D65:1.0,ColorSpace,,lin_p3d65,scene-linear,
13+
410,Utility - Linear - Rec.2020,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_Rec2020:1.0,ColorSpace,,lin_rec2020,scene-linear,
14+
410,Utility - Linear - Rec.709,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_Rec709:1.0,ColorSpace,,"lin_rec709,lin_srgb,Linear sRGB",scene-linear,
15+
410,Utility - Linear - sRGB,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_Rec709:1.0,ColorSpace,,,scene-linear,
1616
420,Utility - Gamma 1.8 - Rec.709 - Texture,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma1.8_Rec709-Texture:1.0,ColorSpace,,g18_rec709,sdr-video,
1717
420,Utility - Gamma 2.2 - AP1 - Texture,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.2_AP1-Texture:1.0,ColorSpace,,g22_ap1,sdr-video,file-io
1818
420,Utility - Gamma 2.2 - Rec.709 - Texture,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.2_Rec709-Texture:1.0,ColorSpace,,g22_rec709,sdr-video,

opencolorio_config_aces/config/generation/__init__.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22
# Copyright Contributors to the OpenColorIO Project.
33

4+
from .beautifiers import (
5+
SEPARATOR_COLORSPACE_NAME,
6+
SEPARATOR_COLORSPACE_FAMILY,
7+
SEPARATOR_BUILTIN_TRANSFORM_NAME,
8+
PATTERNS_COLORSPACE_NAME,
9+
PATTERNS_LOOK_NAME,
10+
PATTERNS_TRANSFORM_FAMILY,
11+
PATTERNS_VIEW_TRANSFORM_NAME,
12+
PATTERNS_DISPLAY_NAME,
13+
PATTERNS_ALIAS,
14+
beautify_name,
15+
beautify_colorspace_name,
16+
beautify_look_name,
17+
beautify_transform_family,
18+
beautify_view_transform_name,
19+
beautify_display_name,
20+
beautify_alias,
21+
)
422
from .factories import (
523
group_transform_factory,
624
colorspace_factory,
@@ -21,6 +39,24 @@
2139
)
2240

2341
__all__ = [
42+
"SEPARATOR_COLORSPACE_NAME",
43+
"SEPARATOR_COLORSPACE_FAMILY",
44+
"SEPARATOR_BUILTIN_TRANSFORM_NAME",
45+
"PATTERNS_COLORSPACE_NAME",
46+
"PATTERNS_LOOK_NAME",
47+
"PATTERNS_TRANSFORM_FAMILY",
48+
"PATTERNS_VIEW_TRANSFORM_NAME",
49+
"PATTERNS_DISPLAY_NAME",
50+
"PATTERNS_ALIAS",
51+
"beautify_name",
52+
"beautify_colorspace_name",
53+
"beautify_look_name",
54+
"beautify_transform_family",
55+
"beautify_view_transform_name",
56+
"beautify_display_name",
57+
"beautify_alias",
58+
]
59+
__all__ += [
2460
"group_transform_factory",
2561
"colorspace_factory",
2662
"named_transform_factory",

0 commit comments

Comments
 (0)