2 # -*- coding: utf-8 -*-
5 Defines objects creating the *ACES* configuration.
16 import PyOpenColorIO as ocio
18 import aces_ocio.create_aces_colorspaces as aces
19 import aces_ocio.create_arri_colorspaces as arri
20 import aces_ocio.create_canon_colorspaces as canon
21 import aces_ocio.create_red_colorspaces as red
22 import aces_ocio.create_sony_colorspaces as sony
23 import aces_ocio.create_general_colorspaces as general
25 from aces_ocio.generate_lut import (
26 generate_1d_LUT_from_CTL,
27 generate_3d_LUT_from_CTL,
29 from aces_ocio.process import Process
30 from aces_ocio.utilities import ColorSpace, mat44_from_mat33, sanitize_path, compact
32 __author__ = 'ACES Developers'
33 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
35 __maintainer__ = 'ACES Developers'
36 __email__ = 'aces@oscars.org'
37 __status__ = 'Production'
39 __all__ = ['ACES_OCIO_CTL_DIRECTORY_ENVIRON',
40 'ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON',
41 'set_config_default_roles',
43 'generate_OCIO_transform',
46 'generate_baked_LUTs',
54 ACES_OCIO_CTL_DIRECTORY_ENVIRON = 'ACES_OCIO_CTL_DIRECTORY'
55 ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON = 'ACES_OCIO_CONFIGURATION_DIRECTORY'
58 def set_config_default_roles(config,
69 Sets given *OCIO* configuration default roles.
75 color_picking : str or unicode
76 Color picking role title.
77 color_timing : str or unicode
78 Color timing role title.
79 compositing_log : str or unicode
80 Compositing log role title.
83 default : str or unicode
85 matte_paint : str or unicode
86 Matte painting role title.
87 reference : str or unicode
89 scene_linear : str or unicode
90 Scene linear role title.
91 texture_paint : str or unicode
92 Texture painting role title.
101 config.setRole(ocio.Constants.ROLE_COLOR_PICKING, color_picking)
103 config.setRole(ocio.Constants.ROLE_COLOR_TIMING, color_timing)
105 config.setRole(ocio.Constants.ROLE_COMPOSITING_LOG, compositing_log)
107 config.setRole(ocio.Constants.ROLE_DATA, data)
109 config.setRole(ocio.Constants.ROLE_DEFAULT, default)
111 config.setRole(ocio.Constants.ROLE_MATTE_PAINT, matte_paint)
113 config.setRole(ocio.Constants.ROLE_REFERENCE, reference)
115 config.setRole(ocio.Constants.ROLE_SCENE_LINEAR, scene_linear)
117 config.setRole(ocio.Constants.ROLE_TEXTURE_PAINT, texture_paint)
122 def write_config(config, config_path, sanity_check=True):
124 Writes the configuration to given path.
129 Parameter description.
134 Return value description.
142 print 'Configuration was not written due to a failed Sanity Check'
145 with open(config_path, mode='w') as fp:
146 fp.write(config.serialize())
149 def generate_OCIO_transform(transforms):
156 Parameter description.
161 Return value description.
164 interpolation_options = {
165 'linear': ocio.Constants.INTERP_LINEAR,
166 'nearest': ocio.Constants.INTERP_NEAREST,
167 'tetrahedral': ocio.Constants.INTERP_TETRAHEDRAL
169 direction_options = {
170 'forward': ocio.Constants.TRANSFORM_DIR_FORWARD,
171 'inverse': ocio.Constants.TRANSFORM_DIR_INVERSE
176 for transform in transforms:
179 if transform['type'] == 'lutFile':
180 ocio_transform = ocio.FileTransform(
181 src=transform['path'],
182 interpolation=interpolation_options[
183 transform['interpolation']],
184 direction=direction_options[transform['direction']])
185 ocio_transforms.append(ocio_transform)
188 elif transform['type'] == 'matrix':
189 ocio_transform = ocio.MatrixTransform()
190 # MatrixTransform member variables can't be initialized directly.
191 # Each must be set individually.
192 ocio_transform.setMatrix(transform['matrix'])
194 if 'offset' in transform:
195 ocio_transform.setOffset(transform['offset'])
197 if 'direction' in transform:
198 ocio_transform.setDirection(
199 direction_options[transform['direction']])
201 ocio_transforms.append(ocio_transform)
204 elif transform['type'] == 'exponent':
205 ocio_transform = ocio.ExponentTransform()
206 ocio_transform.setValue(transform['value'])
207 ocio_transforms.append(ocio_transform)
210 elif transform['type'] == 'log':
211 ocio_transform = ocio.LogTransform(
212 base=transform['base'],
213 direction=direction_options[transform['direction']])
215 ocio_transforms.append(ocio_transform)
217 # color space transform
218 elif transform['type'] == 'colorspace':
219 ocio_transform = ocio.ColorSpaceTransform( src=transform['src'],
220 dst=transform['dst'],
221 direction=direction_options['forward'] )
222 ocio_transforms.append(ocio_transform)
226 print("Ignoring unknown transform type : %s" % transform['type'])
228 if len(ocio_transforms) > 1:
229 group_transform = ocio.GroupTransform()
230 for transform in ocio_transforms:
231 group_transform.push_back(transform)
232 transform = group_transform
234 transform = ocio_transforms[0]
238 def add_colorspace_alias(config, reference_colorspace, colorspace, colorspace_alias_names):
245 Parameter description.
250 Return value description.
253 for alias_name in colorspace_alias_names:
254 if alias_name == colorspace.name.lower():
257 print( "Adding alias colorspace space %s, alias to %s" % (
258 alias_name, colorspace.name))
260 compact_family_name = "Aliases"
262 ocio_colorspace_alias = ocio.ColorSpace(
264 bitDepth=colorspace.bit_depth,
265 description=colorspace.description,
266 equalityGroup=colorspace.equality_group,
267 family=compact_family_name,
268 isData=colorspace.is_data,
269 allocation=colorspace.allocation_type,
270 allocationVars=colorspace.allocation_vars)
272 if colorspace.to_reference_transforms != []:
273 print("Generating To-Reference transforms")
274 ocio_transform = generate_OCIO_transform([{
275 'type': 'colorspace',
276 'src': colorspace.name,
277 'dst': reference_colorspace.name,
278 'direction': 'forward'
280 ocio_colorspace_alias.setTransform(
282 ocio.Constants.COLORSPACE_DIR_TO_REFERENCE)
284 if colorspace.from_reference_transforms != []:
285 print("Generating From-Reference transforms")
286 ocio_transform = generate_OCIO_transform([{
287 'type': 'colorspace',
288 'src': reference_colorspace.name,
289 'dst': colorspace.name,
290 'direction': 'forward'
292 ocio_colorspace_alias.setTransform(
294 ocio.Constants.COLORSPACE_DIR_FROM_REFERENCE)
296 config.addColorSpace(ocio_colorspace_alias)
299 def create_config(config_data, nuke=False):
306 Parameter description.
311 Return value description.
314 # Creating the *OCIO* configuration.
315 config = ocio.Config()
317 # Setting configuration overall values.
318 config.setDescription('An ACES config generated from python')
319 config.setSearchPath('luts')
321 # Defining the reference colorspace.
322 reference_data = config_data['referenceColorSpace']
323 print('Adding the reference color space : %s' % reference_data.name)
325 reference = ocio.ColorSpace(
326 name=reference_data.name,
327 bitDepth=reference_data.bit_depth,
328 description=reference_data.description,
329 equalityGroup=reference_data.equality_group,
330 family=reference_data.family,
331 isData=reference_data.is_data,
332 allocation=reference_data.allocation_type,
333 allocationVars=reference_data.allocation_vars)
335 config.addColorSpace(reference)
338 if reference_data.aliases != []:
339 add_colorspace_alias(config, reference_data,
340 reference_data, reference_data.aliases)
344 # Creating the remaining colorspaces.
345 for colorspace in sorted(config_data['colorSpaces']):
346 print('Creating new color space : %s' % colorspace.name)
348 ocio_colorspace = ocio.ColorSpace(
349 name=colorspace.name,
350 bitDepth=colorspace.bit_depth,
351 description=colorspace.description,
352 equalityGroup=colorspace.equality_group,
353 family=colorspace.family,
354 isData=colorspace.is_data,
355 allocation=colorspace.allocation_type,
356 allocationVars=colorspace.allocation_vars)
358 if colorspace.to_reference_transforms:
359 print('Generating To-Reference transforms')
360 ocio_transform = generate_OCIO_transform(
361 colorspace.to_reference_transforms)
362 ocio_colorspace.setTransform(
364 ocio.Constants.COLORSPACE_DIR_TO_REFERENCE)
366 if colorspace.from_reference_transforms:
367 print('Generating From-Reference transforms')
368 ocio_transform = generate_OCIO_transform(
369 colorspace.from_reference_transforms)
370 ocio_colorspace.setTransform(
372 ocio.Constants.COLORSPACE_DIR_FROM_REFERENCE)
374 config.addColorSpace(ocio_colorspace)
377 # Add alias to normal colorspace, using compact name
379 if colorspace.aliases != []:
380 add_colorspace_alias(config, reference_data,
381 colorspace, colorspace.aliases)
385 # Defining the *views* and *displays*.
389 # Defining a *generic* *display* and *view* setup.
391 for display, view_list in config_data['displays'].iteritems():
392 for view_name, colorspace in view_list.iteritems():
393 config.addDisplay(display, view_name, colorspace.name)
394 if not (view_name in views):
395 views.append(view_name)
396 displays.append(display)
398 # Defining the *Nuke* specific set of *views* and *displays*.
400 for display, view_list in config_data['displays'].iteritems():
401 for view_name, colorspace in view_list.iteritems():
402 if view_name == 'Output Transform':
404 config.addDisplay(display, view_name, colorspace.name)
405 if not (view_name in views):
406 views.append(view_name)
407 displays.append(display)
409 linear_display_space_name = config_data['linearDisplaySpace'].name
410 log_display_space_name = config_data['logDisplaySpace'].name
412 config.addDisplay('linear', 'View', linear_display_space_name)
413 displays.append('linear')
414 config.addDisplay('log', 'View', log_display_space_name)
415 displays.append('log')
417 # Setting the active *displays* and *views*.
418 config.setActiveDisplays(','.join(sorted(displays)))
419 config.setActiveViews(','.join(views))
421 set_config_default_roles(
423 color_picking=reference.getName(),
424 color_timing=reference.getName(),
425 compositing_log=reference.getName(),
426 data=reference.getName(),
427 default=reference.getName(),
428 matte_paint=reference.getName(),
429 reference=reference.getName(),
430 scene_linear=reference.getName(),
431 texture_paint=reference.getName())
437 def generate_LUTs(odt_info,
442 lut_resolution_1d=4096,
443 lut_resolution_3d=64,
451 Parameter description.
456 Colorspaces and transforms converting between those colorspaces and
457 the reference colorspace, *ACES*.
460 print('generateLUTs - begin')
463 # Initialize a few variables
464 config_data['displays'] = {}
465 config_data['colorSpaces'] = []
467 # -------------------------------------------------------------------------
468 # *ACES Color Spaces*
469 # -------------------------------------------------------------------------
475 aces_log_display_space) = aces.create_colorspaces(aces_CTL_directory,
484 config_data['referenceColorSpace'] = aces_reference
486 for cs in aces_colorspaces:
487 config_data['colorSpaces'].append(cs)
489 for name, data in aces_displays.iteritems():
490 config_data['displays'][name] = data
492 config_data['linearDisplaySpace'] = aces_reference
493 config_data['logDisplaySpace'] = aces_log_display_space
495 # -------------------------------------------------------------------------
496 # *Camera Input Transforms*
497 # -------------------------------------------------------------------------
500 arri_colorSpaces = arri.create_colorspaces(lut_directory,
502 for cs in arri_colorSpaces:
503 config_data['colorSpaces'].append(cs)
505 # *Canon-Log* to *ACES*.
506 canon_colorspaces = canon.create_colorspaces(lut_directory,
508 for cs in canon_colorspaces:
509 config_data['colorSpaces'].append(cs)
511 # *RED* colorspaces to *ACES*.
512 red_colorspaces = red.create_colorspaces(lut_directory,
514 for cs in red_colorspaces:
515 config_data['colorSpaces'].append(cs)
518 sony_colorSpaces = sony.create_colorspaces(lut_directory,
520 for cs in sony_colorSpaces:
521 config_data['colorSpaces'].append(cs)
523 # -------------------------------------------------------------------------
524 # General Color Spaces
525 # -------------------------------------------------------------------------
526 general_colorSpaces = general.create_colorspaces(lut_directory,
529 for cs in general_colorSpaces:
530 config_data['colorSpaces'].append(cs)
532 print('generateLUTs - end')
536 def generate_baked_LUTs(odt_info,
542 lut_resolution_shaper=1024):
549 Parameter description.
554 Return value description.
557 odt_info_C = dict(odt_info)
558 for odt_CTL_name, odt_values in odt_info.iteritems():
559 if odt_CTL_name in ['Academy.Rec2020_100nits_dim.a1.0.0',
560 'Academy.Rec709_100nits_dim.a1.0.0',
561 'Academy.Rec709_D60sim_100nits_dim.a1.0.0']:
562 odt_name = odt_values['transformUserName']
564 odt_values_legal = dict(odt_values)
565 odt_values_legal['transformUserName'] = '%s - Legal' % odt_name
566 odt_info_C['%s - Legal' % odt_CTL_name] = odt_values_legal
568 odt_values_full = dict(odt_values)
569 odt_values_full['transformUserName'] = '%s - Full' % odt_name
570 odt_info_C['%s - Full' % odt_CTL_name] = odt_values_full
572 del (odt_info_C[odt_CTL_name])
574 for odt_CTL_name, odt_values in odt_info_C.iteritems():
575 odt_prefix = odt_values['transformUserNamePrefix']
576 odt_name = odt_values['transformUserName']
579 for input_space in ['ACEScc', 'ACESproxy']:
580 args = ['--iconfig', config_path,
582 '--inputspace', input_space]
583 args += ['--outputspace', '%s' % odt_name]
584 args += ['--description',
585 '%s - %s for %s data' % (odt_prefix,
588 args += ['--shaperspace', shaper_name,
589 '--shapersize', str(lut_resolution_shaper)]
590 args += ['--cubesize', str(lut_resolution_3d)]
593 os.path.join(baked_directory,
595 '%s for %s.icc' % (odt_name, input_space))]
597 bake_LUT = Process(description='bake a LUT',
603 for input_space in ['ACEScc', 'ACESproxy']:
604 args = ['--iconfig', config_path,
606 '--inputspace', input_space]
607 args += ['--outputspace', '%s' % odt_name]
608 args += ['--description',
609 '%s - %s for %s data' % (
610 odt_prefix, odt_name, input_space)]
611 args += ['--shaperspace', shaper_name,
612 '--shapersize', str(lut_resolution_shaper)]
613 args += ['--cubesize', str(lut_resolution_3d)]
620 '%s for %s Flame.3dl' % (odt_name, input_space))]
621 bake_LUT = Process(description='bake a LUT',
631 '%s for %s Lustre.3dl' % (odt_name, input_space))]
632 bake_LUT = Process(description='bake a LUT',
638 for input_space in ['ACEScg', 'ACES2065-1']:
639 args = ['--iconfig', config_path,
641 '--inputspace', input_space]
642 args += ['--outputspace', '%s' % odt_name]
643 args += ['--description',
644 '%s - %s for %s data' % (
645 odt_prefix, odt_name, input_space)]
646 if input_space == 'ACEScg':
647 lin_shaper_name = '%s - AP1' % shaper_name
649 lin_shaper_name = shaper_name
650 args += ['--shaperspace', lin_shaper_name,
651 '--shapersize', str(lut_resolution_shaper)]
653 args += ['--cubesize', str(lut_resolution_3d)]
660 '%s for %s Maya.csp' % (odt_name, input_space))]
661 bake_LUT = Process(description='bake a LUT',
671 '%s for %s Houdini.lut' % (odt_name, input_space))]
672 bake_LUT = Process(description='bake a LUT',
678 def create_config_dir(config_directory, bake_secondary_LUTs):
685 Parameter description.
690 Return value description.
693 lut_directory = os.path.join(config_directory, 'luts')
694 dirs = [config_directory, lut_directory]
695 if bake_secondary_LUTs:
696 dirs.extend([os.path.join(config_directory, 'baked'),
697 os.path.join(config_directory, 'baked', 'flame'),
698 os.path.join(config_directory, 'baked', 'photoshop'),
699 os.path.join(config_directory, 'baked', 'houdini'),
700 os.path.join(config_directory, 'baked', 'lustre'),
701 os.path.join(config_directory, 'baked', 'maya')])
704 not os.path.exists(d) and os.mkdir(d)
708 def get_transform_info(ctl_transform):
715 Parameter description.
720 Return value description.
723 with open(ctl_transform, 'rb') as fp:
724 lines = fp.readlines()
726 # Retrieving the *transform ID* and *User Name*.
727 transform_id = lines[1][3:].split('<')[1].split('>')[1].strip()
728 transform_user_name = '-'.join(
729 lines[2][3:].split('<')[1].split('>')[1].split('-')[1:]).strip()
730 transform_user_name_prefix = (
731 lines[2][3:].split('<')[1].split('>')[1].split('-')[0].strip())
733 return transform_id, transform_user_name, transform_user_name_prefix
736 def get_ODT_info(aces_CTL_directory):
740 For versions after WGR9.
745 Parameter description.
750 Return value description.
753 # TODO: Investigate usage of *files_walker* definition here.
754 # Credit to *Alex Fry* for the original approach here.
755 odt_dir = os.path.join(aces_CTL_directory, 'odt')
757 for dir_name, subdir_list, file_list in os.walk(odt_dir):
758 for fname in file_list:
759 all_odt.append((os.path.join(dir_name, fname)))
761 odt_CTLs = [x for x in all_odt if
762 ('InvODT' not in x) and (os.path.split(x)[-1][0] != '.')]
766 for odt_CTL in odt_CTLs:
767 odt_tokens = os.path.split(odt_CTL)
769 # Handling nested directories.
770 odt_path_tokens = os.path.split(odt_tokens[-2])
771 odt_dir = odt_path_tokens[-1]
772 while odt_path_tokens[-2][-3:] != 'odt':
773 odt_path_tokens = os.path.split(odt_path_tokens[-2])
774 odt_dir = os.path.join(odt_path_tokens[-1], odt_dir)
776 # Building full name,
777 transform_CTL = odt_tokens[-1]
778 odt_name = string.join(transform_CTL.split('.')[1:-1], '.')
780 # Finding id, user name and user name prefix.
783 transform_user_name_prefix) = get_transform_info(
784 os.path.join(aces_CTL_directory, 'odt', odt_dir, transform_CTL))
787 transform_CTL_inverse = 'InvODT.%s.ctl' % odt_name
788 if not os.path.exists(
789 os.path.join(odt_tokens[-2], transform_CTL_inverse)):
790 transform_CTL_inverse = None
792 # Add to list of ODTs
794 odts[odt_name]['transformCTL'] = os.path.join(odt_dir, transform_CTL)
795 if transform_CTL_inverse is not None:
796 odts[odt_name]['transformCTLInverse'] = os.path.join(
797 odt_dir, transform_CTL_inverse)
799 odts[odt_name]['transformID'] = transform_ID
800 odts[odt_name]['transformUserNamePrefix'] = transform_user_name_prefix
801 odts[odt_name]['transformUserName'] = transform_user_name
803 forward_CTL = odts[odt_name]['transformCTL']
805 print('ODT : %s' % odt_name)
806 print('\tTransform ID : %s' % transform_ID)
807 print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
808 print('\tTransform User Name : %s' % transform_user_name)
809 print('\tForward ctl : %s' % forward_CTL)
810 if 'transformCTLInverse' in odts[odt_name]:
811 inverse_CTL = odts[odt_name]['transformCTLInverse']
812 print('\tInverse ctl : %s' % inverse_CTL)
814 print('\tInverse ctl : %s' % 'None')
821 def get_LMT_info(aces_CTL_directory):
825 For versions after WGR9.
830 Parameter description.
835 Return value description.
838 # TODO: Investigate refactoring with previous definition.
840 # Credit to Alex Fry for the original approach here
841 lmt_dir = os.path.join(aces_CTL_directory, 'lmt')
843 for dir_name, subdir_list, file_list in os.walk(lmt_dir):
844 for fname in file_list:
845 all_lmt.append((os.path.join(dir_name, fname)))
847 lmt_CTLs = [x for x in all_lmt if
848 ('InvLMT' not in x) and ('README' not in x) and (
849 os.path.split(x)[-1][0] != '.')]
853 for lmt_CTL in lmt_CTLs:
854 lmt_tokens = os.path.split(lmt_CTL)
856 # Handlimg nested directories.
857 lmt_path_tokens = os.path.split(lmt_tokens[-2])
858 lmt_dir = lmt_path_tokens[-1]
859 while lmt_path_tokens[-2][-3:] != 'ctl':
860 lmt_path_tokens = os.path.split(lmt_path_tokens[-2])
861 lmt_dir = os.path.join(lmt_path_tokens[-1], lmt_dir)
863 # Building full name.
864 transform_CTL = lmt_tokens[-1]
865 lmt_name = string.join(transform_CTL.split('.')[1:-1], '.')
867 # Finding id, user name and user name prefix.
870 transform_user_name_prefix) = get_transform_info(
871 os.path.join(aces_CTL_directory, lmt_dir, transform_CTL))
874 transform_CTL_inverse = 'InvLMT.%s.ctl' % lmt_name
875 if not os.path.exists(
876 os.path.join(lmt_tokens[-2], transform_CTL_inverse)):
877 transform_CTL_inverse = None
880 lmts[lmt_name]['transformCTL'] = os.path.join(lmt_dir, transform_CTL)
881 if transform_CTL_inverse is not None:
882 lmts[lmt_name]['transformCTLInverse'] = os.path.join(
883 lmt_dir, transform_CTL_inverse)
885 lmts[lmt_name]['transformID'] = transform_ID
886 lmts[lmt_name]['transformUserNamePrefix'] = transform_user_name_prefix
887 lmts[lmt_name]['transformUserName'] = transform_user_name
889 forward_CTL = lmts[lmt_name]['transformCTL']
891 print('LMT : %s' % lmt_name)
892 print('\tTransform ID : %s' % transform_ID)
893 print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
894 print('\tTransform User Name : %s' % transform_user_name)
895 print('\t Forward ctl : %s' % forward_CTL)
896 if 'transformCTLInverse' in lmts[lmt_name]:
897 inverse_CTL = lmts[lmt_name]['transformCTLInverse']
898 print('\t Inverse ctl : %s' % inverse_CTL)
900 print('\t Inverse ctl : %s' % 'None')
907 def create_ACES_config(aces_CTL_directory,
909 lut_resolution_1d=4096,
910 lut_resolution_3d=64,
911 bake_secondary_LUTs=True,
914 Creates the ACES configuration.
919 Parameter description.
924 Return value description.
927 lut_directory = create_config_dir(config_directory, bake_secondary_LUTs)
929 odt_info = get_ODT_info(aces_CTL_directory)
930 lmt_info = get_LMT_info(aces_CTL_directory)
932 shaper_name = 'Output Shaper'
933 config_data = generate_LUTs(odt_info,
942 print('Creating "generic" config')
943 config = create_config(config_data)
947 os.path.join(config_directory, 'config.ocio'))
949 print('Creating "Nuke" config')
950 nuke_config = create_config(config_data, nuke=True)
953 write_config(nuke_config,
954 os.path.join(config_directory, 'nuke_config.ocio'))
956 if bake_secondary_LUTs:
957 generate_baked_LUTs(odt_info,
959 os.path.join(config_directory, 'baked'),
960 os.path.join(config_directory, 'config.ocio'),
975 Parameter description.
980 Return value description.
985 p = optparse.OptionParser(description='An OCIO config generation script',
986 prog='createACESConfig',
987 version='createACESConfig 0.1',
988 usage='%prog [options]')
989 p.add_option('--acesCTLDir', '-a', default=os.environ.get(
990 ACES_OCIO_CTL_DIRECTORY_ENVIRON, None))
991 p.add_option('--configDir', '-c', default=os.environ.get(
992 ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON, None))
993 p.add_option('--lutResolution1d', default=4096)
994 p.add_option('--lutResolution3d', default=64)
995 p.add_option('--dontBakeSecondaryLUTs', action='store_true')
996 p.add_option('--keepTempImages', action='store_true')
998 options, arguments = p.parse_args()
1000 aces_CTL_directory = options.acesCTLDir
1001 config_directory = options.configDir
1002 lut_resolution_1d = int(options.lutResolution1d)
1003 lut_resolution_3d = int(options.lutResolution3d)
1004 bake_secondary_LUTs = not options.dontBakeSecondaryLUTs
1005 cleanup_temp_images = not options.keepTempImages
1007 # TODO: Investigate the following statements.
1009 args_start = sys.argv.index('--') + 1
1010 args = sys.argv[args_start:]
1012 args_start = len(sys.argv) + 1
1015 print('command line : \n%s\n' % ' '.join(sys.argv))
1017 assert aces_CTL_directory is not None, (
1018 'process: No "{0}" environment variable defined or no "ACES CTL" '
1019 'directory specified'.format(
1020 ACES_OCIO_CTL_DIRECTORY_ENVIRON))
1022 assert config_directory is not None, (
1023 'process: No "{0}" environment variable defined or no configuration '
1024 'directory specified'.format(
1025 ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON))
1027 return create_ACES_config(aces_CTL_directory,
1031 bake_secondary_LUTs,
1032 cleanup_temp_images)
1035 if __name__ == '__main__':