X-Git-Url: http://users.mur.at/ms/git/gitweb/?a=blobdiff_plain;f=aces_1.0.0%2Fpython%2Faces_ocio%2Fcreate_aces_config.py;h=0ad1278a8d4a72eec84e4dde93fe28ac74876627;hb=f4645c77f9ef867c32aa90d5143f252556456776;hp=525da6ba1865a9ad3dcaace01dccb356dde31cea;hpb=0c0c9313006b5436ae6e09f68d66196b8a48743b;p=OpenColorIO-Configs.git diff --git a/aces_1.0.0/python/aces_ocio/create_aces_config.py b/aces_1.0.0/python/aces_ocio/create_aces_config.py index 525da6b..0ad1278 100755 --- a/aces_1.0.0/python/aces_ocio/create_aces_config.py +++ b/aces_1.0.0/python/aces_ocio/create_aces_config.py @@ -5,6 +5,8 @@ Defines objects creating the *ACES* configuration. """ +from __future__ import division + import os import sys @@ -13,6 +15,8 @@ import PyOpenColorIO as ocio import aces_ocio.create_aces_colorspaces as aces import aces_ocio.create_arri_colorspaces as arri import aces_ocio.create_canon_colorspaces as canon +import aces_ocio.create_gopro_colorspaces as gopro +import aces_ocio.create_panasonic_colorspaces as panasonic import aces_ocio.create_red_colorspaces as red import aces_ocio.create_sony_colorspaces as sony import aces_ocio.create_general_colorspaces as general @@ -152,12 +156,11 @@ def generate_OCIO_transform(transforms): interpolation_options = { 'linear': ocio.Constants.INTERP_LINEAR, 'nearest': ocio.Constants.INTERP_NEAREST, - 'tetrahedral': ocio.Constants.INTERP_TETRAHEDRAL - } + 'tetrahedral': ocio.Constants.INTERP_TETRAHEDRAL} + direction_options = { 'forward': ocio.Constants.TRANSFORM_DIR_FORWARD, - 'inverse': ocio.Constants.TRANSFORM_DIR_INVERSE - } + 'inverse': ocio.Constants.TRANSFORM_DIR_INVERSE} ocio_transforms = [] @@ -210,7 +213,6 @@ def generate_OCIO_transform(transforms): direction_options[ 'forward']) ocio_transforms.append(ocio_transform) - # unknown type else: print("Ignoring unknown transform type : %s" % transform['type']) @@ -226,7 +228,9 @@ def generate_OCIO_transform(transforms): return transform -def add_colorspace_alias(config, reference_colorspace, colorspace, +def add_colorspace_alias(config, + reference_colorspace, + colorspace, colorspace_alias_names): """ Object description. @@ -246,10 +250,10 @@ def add_colorspace_alias(config, reference_colorspace, colorspace, if alias_name == colorspace.name.lower(): return - print( "Adding alias colorspace space %s, alias to %s" % ( + print('Adding alias colorspace space %s, alias to %s' % ( alias_name, colorspace.name)) - compact_family_name = "Aliases" + compact_family_name = 'Aliases' ocio_colorspace_alias = ocio.ColorSpace( name=alias_name, @@ -261,8 +265,8 @@ def add_colorspace_alias(config, reference_colorspace, colorspace, allocation=colorspace.allocation_type, allocationVars=colorspace.allocation_vars) - if colorspace.to_reference_transforms != []: - print("Generating To-Reference transforms") + if not colorspace.to_reference_transforms: + print('Generating To-Reference transforms') ocio_transform = generate_OCIO_transform( [{'type': 'colorspace', 'src': colorspace.name, @@ -272,8 +276,8 @@ def add_colorspace_alias(config, reference_colorspace, colorspace, ocio_transform, ocio.Constants.COLORSPACE_DIR_TO_REFERENCE) - if colorspace.from_reference_transforms != []: - print("Generating From-Reference transforms") + if not colorspace.from_reference_transforms: + print('Generating From-Reference transforms') ocio_transform = generate_OCIO_transform( [{'type': 'colorspace', 'src': reference_colorspace.name, @@ -387,22 +391,25 @@ def create_config(config_data, nuke=False): # Defining the *Nuke* specific set of *views* and *displays*. else: - for display, view_list in config_data['displays'].iteritems(): + display_name = 'ACES' + displays.append(display_name) + + display_names = sorted(config_data['displays']) + for display in display_names: + view_list = config_data['displays'][display] for view_name, colorspace in view_list.iteritems(): if view_name == 'Output Transform': - view_name = 'View' - config.addDisplay(display, view_name, colorspace.name) - if not (view_name in views): - views.append(view_name) - displays.append(display) + config.addDisplay(display_name, display, colorspace.name) + if not (display in views): + views.append(display) linear_display_space_name = config_data['linearDisplaySpace'].name log_display_space_name = config_data['logDisplaySpace'].name - config.addDisplay('linear', 'View', linear_display_space_name) - displays.append('linear') - config.addDisplay('log', 'View', log_display_space_name) - displays.append('log') + config.addDisplay(display_name, 'Linear', linear_display_space_name) + views.append('Linear') + config.addDisplay(display_name, 'Log', log_display_space_name) + views.append('Log') # Setting the active *displays* and *views*. config.setActiveDisplays(','.join(sorted(displays))) @@ -410,15 +417,15 @@ def create_config(config_data, nuke=False): set_config_default_roles( config, - color_picking=reference.getName(), - color_timing=reference.getName(), - compositing_log=reference.getName(), - data=reference.getName(), - default=reference.getName(), - matte_paint=reference.getName(), - reference=reference.getName(), - scene_linear=reference.getName(), - texture_paint=reference.getName()) + color_picking=config_data['roles']['color_picking'], + color_timing=config_data['roles']['color_timing'], + compositing_log=config_data['roles']['compositing_log'], + data=config_data['roles']['data'], + default=config_data['roles']['default'], + matte_paint=config_data['roles']['matte_paint'], + reference=config_data['roles']['reference'], + scene_linear=config_data['roles']['scene_linear'], + texture_paint=config_data['roles']['texture_paint']) config.sanityCheck() @@ -428,7 +435,7 @@ def create_config(config_data, nuke=False): def generate_LUTs(odt_info, lmt_info, shaper_name, - aces_CTL_directory, + aces_ctl_directory, lut_directory, lut_resolution_1d=4096, lut_resolution_3d=64, @@ -463,16 +470,18 @@ def generate_LUTs(odt_info, (aces_reference, aces_colorspaces, aces_displays, - aces_log_display_space) = aces.create_colorspaces(aces_CTL_directory, - lut_directory, - lut_resolution_1d, - lut_resolution_3d, - lmt_info, - odt_info, - shaper_name, - cleanup) + aces_log_display_space, + aces_roles) = aces.create_colorspaces(aces_ctl_directory, + lut_directory, + lut_resolution_1d, + lut_resolution_3d, + lmt_info, + odt_info, + shaper_name, + cleanup) config_data['referenceColorSpace'] = aces_reference + config_data['roles'] = aces_roles for cs in aces_colorspaces: config_data['colorSpaces'].append(cs) @@ -487,7 +496,7 @@ def generate_LUTs(odt_info, # *Camera Input Transforms* # ------------------------------------------------------------------------- - # *Log-C* to *ACES*. + # *ARRI Log-C* to *ACES*. arri_colorSpaces = arri.create_colorspaces(lut_directory, lut_resolution_1d) for cs in arri_colorSpaces: @@ -499,6 +508,18 @@ def generate_LUTs(odt_info, for cs in canon_colorspaces: config_data['colorSpaces'].append(cs) + # *GoPro Protune* to *ACES*. + gopro_colorspaces = gopro.create_colorspaces(lut_directory, + lut_resolution_1d) + for cs in gopro_colorspaces: + config_data['colorSpaces'].append(cs) + + # *Panasonic V-Log* to *ACES*. + panasonic_colorSpaces = panasonic.create_colorspaces(lut_directory, + lut_resolution_1d) + for cs in panasonic_colorSpaces: + config_data['colorSpaces'].append(cs) + # *RED* colorspaces to *ACES*. red_colorspaces = red.create_colorspaces(lut_directory, lut_resolution_1d) @@ -520,6 +541,15 @@ def generate_LUTs(odt_info, for cs in general_colorSpaces: config_data['colorSpaces'].append(cs) + # The *Raw* color space + raw = general.create_raw() + config_data['colorSpaces'].append(raw) + + # Override certain roles, for now + config_data['roles']['data'] = raw.name + config_data['roles']['reference'] = raw.name + config_data['roles']['texture_paint'] = raw.name + print('generateLUTs - end') return config_data @@ -547,22 +577,22 @@ def generate_baked_LUTs(odt_info, # Create two entries for ODTs that have full and legal range support odt_info_C = dict(odt_info) - for odt_CTL_name, odt_values in odt_info.iteritems(): + for odt_ctl_name, odt_values in odt_info.iteritems(): if odt_values['transformHasFullLegalSwitch']: odt_name = odt_values['transformUserName'] odt_values_legal = dict(odt_values) odt_values_legal['transformUserName'] = '%s - Legal' % odt_name - odt_info_C['%s - Legal' % odt_CTL_name] = odt_values_legal + odt_info_C['%s - Legal' % odt_ctl_name] = odt_values_legal odt_values_full = dict(odt_values) odt_values_full['transformUserName'] = '%s - Full' % odt_name - odt_info_C['%s - Full' % odt_CTL_name] = odt_values_full + odt_info_C['%s - Full' % odt_ctl_name] = odt_values_full - del (odt_info_C[odt_CTL_name]) + del (odt_info_C[odt_ctl_name]) # Generate appropriate LUTs for each ODT - for odt_CTL_name, odt_values in odt_info_C.iteritems(): + for odt_ctl_name, odt_values in odt_info_C.iteritems(): odt_prefix = odt_values['transformUserNamePrefix'] odt_name = odt_values['transformUserName'] @@ -585,10 +615,10 @@ def generate_baked_LUTs(odt_info, 'photoshop', '%s for %s.icc' % (odt_name, input_space))] - bake_LUT = Process(description='bake a LUT', + bake_lut = Process(description='bake a LUT', cmd='ociobakelut', args=args) - bake_LUT.execute() + bake_lut.execute() # *Flame*, *Lustre* for input_space in ['ACEScc', 'ACESproxy']: @@ -609,10 +639,10 @@ def generate_baked_LUTs(odt_info, baked_directory, 'flame', '%s for %s Flame.3dl' % (odt_name, input_space))] - bake_LUT = Process(description='bake a LUT', + bake_lut = Process(description='bake a LUT', cmd='ociobakelut', args=(args + fargs)) - bake_LUT.execute() + bake_lut.execute() largs = ['--format', 'lustre', @@ -620,10 +650,10 @@ def generate_baked_LUTs(odt_info, baked_directory, 'lustre', '%s for %s Lustre.3dl' % (odt_name, input_space))] - bake_LUT = Process(description='bake a LUT', + bake_lut = Process(description='bake a LUT', cmd='ociobakelut', args=(args + largs)) - bake_LUT.execute() + bake_lut.execute() # *Maya*, *Houdini* for input_space in ['ACEScg', 'ACES2065-1']: @@ -649,10 +679,10 @@ def generate_baked_LUTs(odt_info, baked_directory, 'maya', '%s for %s Maya.csp' % (odt_name, input_space))] - bake_LUT = Process(description='bake a LUT', + bake_lut = Process(description='bake a LUT', cmd='ociobakelut', args=(args + margs)) - bake_LUT.execute() + bake_lut.execute() hargs = ['--format', 'houdini', @@ -660,10 +690,10 @@ def generate_baked_LUTs(odt_info, baked_directory, 'houdini', '%s for %s Houdini.lut' % (odt_name, input_space))] - bake_LUT = Process(description='bake a LUT', + bake_lut = Process(description='bake a LUT', cmd='ociobakelut', args=(args + hargs)) - bake_LUT.execute() + bake_lut.execute() def create_config_dir(config_directory, bake_secondary_LUTs): @@ -697,7 +727,7 @@ def create_config_dir(config_directory, bake_secondary_LUTs): return lut_directory -def create_ACES_config(aces_CTL_directory, +def create_ACES_config(aces_ctl_directory, config_directory, lut_resolution_1d=4096, lut_resolution_3d=64, @@ -719,14 +749,14 @@ def create_ACES_config(aces_CTL_directory, lut_directory = create_config_dir(config_directory, bake_secondary_LUTs) - odt_info = aces.get_ODT_info(aces_CTL_directory) - lmt_info = aces.get_LMT_info(aces_CTL_directory) + odt_info = aces.get_ODTs_info(aces_ctl_directory) + lmt_info = aces.get_LMTs_info(aces_ctl_directory) shaper_name = 'Output Shaper' config_data = generate_LUTs(odt_info, lmt_info, shaper_name, - aces_CTL_directory, + aces_ctl_directory, lut_directory, lut_resolution_1d, lut_resolution_3d, @@ -790,11 +820,11 @@ def main(): options, arguments = p.parse_args() - aces_CTL_directory = options.acesCTLDir + aces_ctl_directory = options.acesCTLDir config_directory = options.configDir lut_resolution_1d = int(options.lutResolution1d) lut_resolution_3d = int(options.lutResolution3d) - bake_secondary_LUTs = not options.dontBakeSecondaryLUTs + bake_secondary_luts = not options.dontBakeSecondaryLUTs cleanup_temp_images = not options.keepTempImages # TODO: Investigate the following statements. @@ -807,7 +837,7 @@ def main(): print('command line : \n%s\n' % ' '.join(sys.argv)) - assert aces_CTL_directory is not None, ( + assert aces_ctl_directory is not None, ( 'process: No "{0}" environment variable defined or no "ACES CTL" ' 'directory specified'.format( ACES_OCIO_CTL_DIRECTORY_ENVIRON)) @@ -817,11 +847,11 @@ def main(): 'directory specified'.format( ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON)) - return create_ACES_config(aces_CTL_directory, + return create_ACES_config(aces_ctl_directory, config_directory, lut_resolution_1d, lut_resolution_3d, - bake_secondary_LUTs, + bake_secondary_luts, cleanup_temp_images)