133133})
134134
135135LOOK_NAME_SUBSTITUTION_PATTERNS = {
136+ # TODO: Implement support for callable patterns.
137+ # The following one should be a dedicated definition/callable.
136138 'BlueLightArtifactFix' : 'Blue Light Artifact Fix'
137139}
138140"""
150152 'vendorSupplied[/\\ \\ ]' : '' ,
151153 'arri' : 'ARRI' ,
152154 'alexa' : 'Alexa' ,
155+ 'canon' : 'Canon' ,
156+ 'panasonic' : 'Panasonic' ,
157+ 'red' : 'RED' ,
153158 'sony' : 'Sony' ,
154159}
155160"""
@@ -443,7 +448,7 @@ def ctl_transform_to_look_name(ctl_transform):
443448 return beautify_look_name (name )
444449
445450
446- def ctl_transform_to_transform_family (ctl_transform ):
451+ def ctl_transform_to_transform_family (ctl_transform , analytical = True ):
447452 """
448453 Generates the *OpenColorIO* transform family for given *ACES* *CTL*
449454 transform.
@@ -453,22 +458,43 @@ def ctl_transform_to_transform_family(ctl_transform):
453458 ctl_transform : CTLTransform
454459 *ACES* *CTL* transform to generate the *OpenColorIO* transform family
455460 for.
461+ analytical : bool, optional
462+ Whether to generate the *OpenColorIO* transform family that
463+ analytically matches the given *ACES* *CTL* transform, i.e. true to
464+ the *aces-dev* reference but not necessarily user friendly.
456465
457466 Returns
458467 -------
459468 unicode
460469 *OpenColorIO* transform family.
461470 """
462471
463- if ctl_transform .family == 'csc' and ctl_transform .namespace == 'Academy' :
464- family = 'CSC'
465- elif ctl_transform .family == 'input_transform' :
466- family = (f'Input{ ACES_CONFIG_COLORSPACE_FAMILY_SEPARATOR } '
467- f'{ ctl_transform .genus } ' )
468- elif ctl_transform .family == 'output_transform' :
469- family = 'Output'
470- elif ctl_transform .family == 'lmt' :
471- family = 'LMT'
472+ if analytical :
473+ if (ctl_transform .family == 'csc'
474+ and ctl_transform .namespace == 'Academy' ):
475+ family = 'CSC'
476+ elif ctl_transform .family == 'input_transform' :
477+ family = (f'Input{ ACES_CONFIG_COLORSPACE_FAMILY_SEPARATOR } '
478+ f'{ ctl_transform .genus } ' )
479+ elif ctl_transform .family == 'output_transform' :
480+ family = 'Output'
481+ elif ctl_transform .family == 'lmt' :
482+ family = 'LMT'
483+ else :
484+ if (ctl_transform .family == 'csc'
485+ and ctl_transform .namespace == 'Academy' ):
486+ if re .match ('ACES|ADX' , ctl_transform .name ):
487+ family = 'ACES'
488+ else :
489+ family = (f'Input{ ACES_CONFIG_COLORSPACE_FAMILY_SEPARATOR } '
490+ f'{ ctl_transform .genus } ' )
491+ elif ctl_transform .family == 'input_transform' :
492+ family = (f'Input{ ACES_CONFIG_COLORSPACE_FAMILY_SEPARATOR } '
493+ f'{ ctl_transform .genus } ' )
494+ elif ctl_transform .family == 'output_transform' :
495+ family = 'Output'
496+ elif ctl_transform .family == 'lmt' :
497+ family = 'LMT'
472498
473499 return beautify_transform_family (family )
474500
@@ -562,6 +588,7 @@ def ctl_transform_to_description(
562588
563589def ctl_transform_to_colorspace (ctl_transform ,
564590 describe = ColorspaceDescriptionStyle .LONG_UNION ,
591+ analytical = True ,
565592 ** kwargs ):
566593 """
567594 Generates the *OpenColorIO* colorspace for given *ACES* *CTL* transform.
@@ -573,6 +600,10 @@ def ctl_transform_to_colorspace(ctl_transform,
573600 describe : bool, optional
574601 Whether to use the full *ACES* *CTL* transform description or just the
575602 first line.
603+ analytical : bool, optional
604+ Whether to generate the *OpenColorIO* transform family that
605+ analytically matches the given *ACES* *CTL* transform, i.e. true to
606+ the *aces-dev* reference but not necessarily user friendly.
576607
577608 Other Parameters
578609 ----------------
@@ -587,7 +618,7 @@ def ctl_transform_to_colorspace(ctl_transform,
587618 """
588619
589620 name = ctl_transform_to_colorspace_name (ctl_transform )
590- family = ctl_transform_to_transform_family (ctl_transform )
621+ family = ctl_transform_to_transform_family (ctl_transform , analytical )
591622
592623 description = ctl_transform_to_description (ctl_transform , describe ,
593624 colorspace_factory , ** kwargs )
@@ -610,6 +641,7 @@ def ctl_transform_to_colorspace(ctl_transform,
610641
611642def ctl_transform_to_look (ctl_transform ,
612643 describe = ColorspaceDescriptionStyle .LONG_UNION ,
644+ analytical = True ,
613645 ** kwargs ):
614646 """
615647 Generates the *OpenColorIO* look for given *ACES* *CTL* transform.
@@ -621,6 +653,10 @@ def ctl_transform_to_look(ctl_transform,
621653 describe : bool, optional
622654 Whether to use the full *ACES* *CTL* transform description or just the
623655 first line.
656+ analytical : bool, optional
657+ Whether to generate the *OpenColorIO* transform family that
658+ analytically matches the given *ACES* *CTL* transform, i.e. true to
659+ the *aces-dev* reference but not necessarily user friendly.
624660
625661 Other Parameters
626662 ----------------
@@ -635,7 +671,7 @@ def ctl_transform_to_look(ctl_transform,
635671 """
636672
637673 name = ctl_transform_to_look_name (ctl_transform )
638- family = ctl_transform_to_transform_family (ctl_transform )
674+ family = ctl_transform_to_transform_family (ctl_transform , analytical )
639675
640676 description = ctl_transform_to_description (ctl_transform , describe ,
641677 look_factory , ** kwargs )
@@ -813,6 +849,7 @@ def generate_config_aces(
813849 validate = True ,
814850 describe = ColorspaceDescriptionStyle .SHORT_UNION ,
815851 config_mapping_file_path = ACES_CONFIG_REFERENCE_MAPPING_FILE_PATH ,
852+ analytical = True ,
816853 additional_data = False ):
817854 """
818855 Generates the *aces-dev* reference implementation *OpenColorIO* Config
@@ -840,6 +877,10 @@ def generate_config_aces(
840877 :class:`opencolorio_config_aces.ColorspaceDescriptionStyle` enum.
841878 config_mapping_file_path : unicode, optional
842879 Path to the *CSV* mapping file used by the *Mapping* method.
880+ analytical : bool, optional
881+ Whether to generate *OpenColorIO* transform families that analytically
882+ match the given *ACES* *CTL* transform, i.e. true to the *aces-dev*
883+ reference but not necessarily user friendly.
843884 additional_data : bool, optional
844885 Whether to return additional data.
845886
@@ -923,8 +964,10 @@ def generate_config_aces(
923964 view_transforms , view_transform_names = [], []
924965 shared_views = []
925966
967+ aces_family_prefix = 'CSC' if analytical else 'ACES'
968+
926969 scene_reference_colorspace = colorspace_factory (
927- f'CSC - { ACES_CONFIG_REFERENCE_COLORSPACE } ' ,
970+ f'{ aces_family_prefix } - { ACES_CONFIG_REFERENCE_COLORSPACE } ' ,
928971 'ACES' ,
929972 description = (
930973 'The "Academy Color Encoding System" reference colorspace.' ))
@@ -980,13 +1023,15 @@ def generate_config_aces(
9801023 look = ctl_transform_to_look (
9811024 ctl_transform ,
9821025 describe ,
1026+ analytical = analytical ,
9831027 forward_transform = create_builtin_transform (style ))
9841028
9851029 looks .append (look )
9861030 else :
9871031 colorspace = ctl_transform_to_colorspace (
9881032 ctl_transform ,
9891033 describe ,
1034+ analytical = analytical ,
9901035 to_reference = create_builtin_transform (style ))
9911036
9921037 colorspaces .append (colorspace )
@@ -1007,16 +1052,16 @@ def generate_config_aces(
10071052 data = ConfigData (
10081053 description = 'The "Academy Color Encoding System" reference config.' ,
10091054 roles = {
1010- ocio .ROLE_COLOR_TIMING : 'CSC - ACEScct' ,
1011- ocio .ROLE_COMPOSITING_LOG : 'CSC - ACEScct' ,
1055+ ocio .ROLE_COLOR_TIMING : f' { aces_family_prefix } - ACEScct' ,
1056+ ocio .ROLE_COMPOSITING_LOG : f' { aces_family_prefix } - ACEScct' ,
10121057 ocio .ROLE_DATA : 'Utility - Raw' ,
10131058 ocio .ROLE_DEFAULT : scene_reference_colorspace .getName (),
10141059 ocio .ROLE_INTERCHANGE_DISPLAY :
10151060 display_reference_colorspace .getName (),
10161061 ocio .ROLE_INTERCHANGE_SCENE : scene_reference_colorspace .getName (),
10171062 ocio .ROLE_REFERENCE : scene_reference_colorspace .getName (),
1018- ocio .ROLE_RENDERING : 'CSC - ACEScg' ,
1019- ocio .ROLE_SCENE_LINEAR : 'CSC - ACEScg' ,
1063+ ocio .ROLE_RENDERING : f' { aces_family_prefix } - ACEScg' ,
1064+ ocio .ROLE_SCENE_LINEAR : f' { aces_family_prefix } - ACEScg' ,
10201065 },
10211066 colorspaces = colorspaces + displays ,
10221067 looks = looks ,
@@ -1060,4 +1105,5 @@ def generate_config_aces(
10601105 config , data = generate_config_aces (
10611106 config_name = os .path .join (build_directory ,
10621107 'config-aces-reference.ocio' ),
1108+ analytical = False ,
10631109 additional_data = True )
0 commit comments