Improve case consistency.
[OpenColorIO-Configs.git] / aces_1.0.0 / python / aces_ocio / create_aces_config.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 """
5 Defines objects creating the *ACES* configuration.
6 """
7
8 import os
9 import sys
10
11 import PyOpenColorIO as ocio
12
13 import aces_ocio.create_aces_colorspaces as aces
14 import aces_ocio.create_arri_colorspaces as arri
15 import aces_ocio.create_canon_colorspaces as canon
16 import aces_ocio.create_red_colorspaces as red
17 import aces_ocio.create_sony_colorspaces as sony
18 import aces_ocio.create_general_colorspaces as general
19
20 from aces_ocio.process import Process
21
22 __author__ = 'ACES Developers'
23 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
24 __license__ = ''
25 __maintainer__ = 'ACES Developers'
26 __email__ = 'aces@oscars.org'
27 __status__ = 'Production'
28
29 __all__ = ['ACES_OCIO_CTL_DIRECTORY_ENVIRON',
30            'ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON',
31            'set_config_default_roles',
32            'write_config',
33            'generate_OCIO_transform',
34            'add_colorspace_alias',
35            'create_config',
36            'generate_LUTs',
37            'generate_baked_LUTs',
38            'create_config_dir',
39            'create_ACES_config',
40            'main']
41
42 ACES_OCIO_CTL_DIRECTORY_ENVIRON = 'ACES_OCIO_CTL_DIRECTORY'
43 ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON = 'ACES_OCIO_CONFIGURATION_DIRECTORY'
44
45
46 def set_config_default_roles(config,
47                              color_picking='',
48                              color_timing='',
49                              compositing_log='',
50                              data='',
51                              default='',
52                              matte_paint='',
53                              reference='',
54                              scene_linear='',
55                              texture_paint=''):
56     """
57     Sets given *OCIO* configuration default roles.
58
59     Parameters
60     ----------
61     config : config
62         *OCIO* configuration.
63     color_picking : str or unicode
64         Color picking role title.
65     color_timing : str or unicode
66         Color timing role title.
67     compositing_log : str or unicode
68         Compositing log role title.
69     data : str or unicode
70         Data role title.
71     default : str or unicode
72         Default role title.
73     matte_paint : str or unicode
74         Matte painting role title.
75     reference : str or unicode
76         Reference role title.
77     scene_linear : str or unicode
78         Scene linear role title.
79     texture_paint : str or unicode
80         Texture painting role title.
81
82     Returns
83     -------
84     bool
85          Definition success.
86     """
87
88     if color_picking:
89         config.setRole(ocio.Constants.ROLE_COLOR_PICKING, color_picking)
90     if color_timing:
91         config.setRole(ocio.Constants.ROLE_COLOR_TIMING, color_timing)
92     if compositing_log:
93         config.setRole(ocio.Constants.ROLE_COMPOSITING_LOG, compositing_log)
94     if data:
95         config.setRole(ocio.Constants.ROLE_DATA, data)
96     if default:
97         config.setRole(ocio.Constants.ROLE_DEFAULT, default)
98     if matte_paint:
99         config.setRole(ocio.Constants.ROLE_MATTE_PAINT, matte_paint)
100     if reference:
101         config.setRole(ocio.Constants.ROLE_REFERENCE, reference)
102     if scene_linear:
103         config.setRole(ocio.Constants.ROLE_SCENE_LINEAR, scene_linear)
104     if texture_paint:
105         config.setRole(ocio.Constants.ROLE_TEXTURE_PAINT, texture_paint)
106
107     return True
108
109
110 def write_config(config, config_path, sanity_check=True):
111     """
112     Writes the configuration to given path.
113
114     Parameters
115     ----------
116     parameter : type
117         Parameter description.
118
119     Returns
120     -------
121     type
122          Return value description.
123     """
124
125     if sanity_check:
126         try:
127             config.sanityCheck()
128         except Exception, e:
129             print e
130             print 'Configuration was not written due to a failed Sanity Check'
131             return
132
133     with open(config_path, mode='w') as fp:
134         fp.write(config.serialize())
135
136
137 def generate_OCIO_transform(transforms):
138     """
139     Object description.
140
141     Parameters
142     ----------
143     parameter : type
144         Parameter description.
145
146     Returns
147     -------
148     type
149          Return value description.
150     """
151
152     interpolation_options = {
153         'linear': ocio.Constants.INTERP_LINEAR,
154         'nearest': ocio.Constants.INTERP_NEAREST,
155         'tetrahedral': ocio.Constants.INTERP_TETRAHEDRAL}
156
157     direction_options = {
158         'forward': ocio.Constants.TRANSFORM_DIR_FORWARD,
159         'inverse': ocio.Constants.TRANSFORM_DIR_INVERSE}
160
161     ocio_transforms = []
162
163     for transform in transforms:
164
165         # lutFile transform
166         if transform['type'] == 'lutFile':
167             ocio_transform = ocio.FileTransform(
168                 src=transform['path'],
169                 interpolation=interpolation_options[
170                     transform['interpolation']],
171                 direction=direction_options[transform['direction']])
172             ocio_transforms.append(ocio_transform)
173
174         # matrix transform
175         elif transform['type'] == 'matrix':
176             ocio_transform = ocio.MatrixTransform()
177             # MatrixTransform member variables can't be initialized directly.
178             # Each must be set individually.
179             ocio_transform.setMatrix(transform['matrix'])
180
181             if 'offset' in transform:
182                 ocio_transform.setOffset(transform['offset'])
183
184             if 'direction' in transform:
185                 ocio_transform.setDirection(
186                     direction_options[transform['direction']])
187
188             ocio_transforms.append(ocio_transform)
189
190         # exponent transform
191         elif transform['type'] == 'exponent':
192             ocio_transform = ocio.ExponentTransform()
193             ocio_transform.setValue(transform['value'])
194             ocio_transforms.append(ocio_transform)
195
196         # log transform
197         elif transform['type'] == 'log':
198             ocio_transform = ocio.LogTransform(
199                 base=transform['base'],
200                 direction=direction_options[transform['direction']])
201
202             ocio_transforms.append(ocio_transform)
203
204         # color space transform
205         elif transform['type'] == 'colorspace':
206             ocio_transform = ocio.ColorSpaceTransform(src=transform['src'],
207                                                       dst=transform['dst'],
208                                                       direction=
209                                                       direction_options[
210                                                           'forward'])
211             ocio_transforms.append(ocio_transform)
212         # unknown type
213         else:
214             print("Ignoring unknown transform type : %s" % transform['type'])
215
216     if len(ocio_transforms) > 1:
217         group_transform = ocio.GroupTransform()
218         for transform in ocio_transforms:
219             group_transform.push_back(transform)
220         transform = group_transform
221     else:
222         transform = ocio_transforms[0]
223
224     return transform
225
226
227 def add_colorspace_alias(config,
228                          reference_colorspace,
229                          colorspace,
230                          colorspace_alias_names):
231     """
232     Object description.
233
234     Parameters
235     ----------
236     parameter : type
237         Parameter description.
238
239     Returns
240     -------
241     type
242          Return value description.
243     """
244
245     for alias_name in colorspace_alias_names:
246         if alias_name == colorspace.name.lower():
247             return
248
249         print('Adding alias colorspace space %s, alias to %s' % (
250             alias_name, colorspace.name))
251
252         compact_family_name = 'Aliases'
253
254         ocio_colorspace_alias = ocio.ColorSpace(
255             name=alias_name,
256             bitDepth=colorspace.bit_depth,
257             description=colorspace.description,
258             equalityGroup=colorspace.equality_group,
259             family=compact_family_name,
260             isData=colorspace.is_data,
261             allocation=colorspace.allocation_type,
262             allocationVars=colorspace.allocation_vars)
263
264         if not colorspace.to_reference_transforms:
265             print('Generating To-Reference transforms')
266             ocio_transform = generate_OCIO_transform(
267                 [{'type': 'colorspace',
268                   'src': colorspace.name,
269                   'dst': reference_colorspace.name,
270                   'direction': 'forward'}])
271             ocio_colorspace_alias.setTransform(
272                 ocio_transform,
273                 ocio.Constants.COLORSPACE_DIR_TO_REFERENCE)
274
275         if not colorspace.from_reference_transforms:
276             print('Generating From-Reference transforms')
277             ocio_transform = generate_OCIO_transform(
278                 [{'type': 'colorspace',
279                   'src': reference_colorspace.name,
280                   'dst': colorspace.name,
281                   'direction': 'forward'}])
282             ocio_colorspace_alias.setTransform(
283                 ocio_transform,
284                 ocio.Constants.COLORSPACE_DIR_FROM_REFERENCE)
285
286         config.addColorSpace(ocio_colorspace_alias)
287
288
289 def create_config(config_data, nuke=False):
290     """
291     Object description.
292
293     Parameters
294     ----------
295     parameter : type
296         Parameter description.
297
298     Returns
299     -------
300     type
301          Return value description.
302     """
303
304     # Creating the *OCIO* configuration.
305     config = ocio.Config()
306
307     # Setting configuration overall values.
308     config.setDescription('An ACES config generated from python')
309     config.setSearchPath('luts')
310
311     # Defining the reference colorspace.
312     reference_data = config_data['referenceColorSpace']
313     print('Adding the reference color space : %s' % reference_data.name)
314
315     reference = ocio.ColorSpace(
316         name=reference_data.name,
317         bitDepth=reference_data.bit_depth,
318         description=reference_data.description,
319         equalityGroup=reference_data.equality_group,
320         family=reference_data.family,
321         isData=reference_data.is_data,
322         allocation=reference_data.allocation_type,
323         allocationVars=reference_data.allocation_vars)
324
325     config.addColorSpace(reference)
326
327     # Add alias
328     if reference_data.aliases != []:
329         add_colorspace_alias(config, reference_data,
330                              reference_data, reference_data.aliases)
331
332     print("")
333
334     # Creating the remaining colorspaces.
335     for colorspace in sorted(config_data['colorSpaces']):
336         print('Creating new color space : %s' % colorspace.name)
337
338         ocio_colorspace = ocio.ColorSpace(
339             name=colorspace.name,
340             bitDepth=colorspace.bit_depth,
341             description=colorspace.description,
342             equalityGroup=colorspace.equality_group,
343             family=colorspace.family,
344             isData=colorspace.is_data,
345             allocation=colorspace.allocation_type,
346             allocationVars=colorspace.allocation_vars)
347
348         if colorspace.to_reference_transforms:
349             print('Generating To-Reference transforms')
350             ocio_transform = generate_OCIO_transform(
351                 colorspace.to_reference_transforms)
352             ocio_colorspace.setTransform(
353                 ocio_transform,
354                 ocio.Constants.COLORSPACE_DIR_TO_REFERENCE)
355
356         if colorspace.from_reference_transforms:
357             print('Generating From-Reference transforms')
358             ocio_transform = generate_OCIO_transform(
359                 colorspace.from_reference_transforms)
360             ocio_colorspace.setTransform(
361                 ocio_transform,
362                 ocio.Constants.COLORSPACE_DIR_FROM_REFERENCE)
363
364         config.addColorSpace(ocio_colorspace)
365
366         #
367         # Add alias to normal colorspace, using compact name
368         #
369         if colorspace.aliases != []:
370             add_colorspace_alias(config, reference_data,
371                                  colorspace, colorspace.aliases)
372
373         print('')
374
375     # Defining the *views* and *displays*.
376     displays = []
377     views = []
378
379     # Defining a *generic* *display* and *view* setup.
380     if not nuke:
381         for display, view_list in config_data['displays'].iteritems():
382             for view_name, colorspace in view_list.iteritems():
383                 config.addDisplay(display, view_name, colorspace.name)
384                 if not (view_name in views):
385                     views.append(view_name)
386             displays.append(display)
387
388     # Defining the *Nuke* specific set of *views* and *displays*.
389     else:
390         for display, view_list in config_data['displays'].iteritems():
391             for view_name, colorspace in view_list.iteritems():
392                 if view_name == 'Output Transform':
393                     view_name = 'View'
394                     config.addDisplay(display, view_name, colorspace.name)
395                     if not (view_name in views):
396                         views.append(view_name)
397             displays.append(display)
398
399         linear_display_space_name = config_data['linearDisplaySpace'].name
400         log_display_space_name = config_data['logDisplaySpace'].name
401
402         config.addDisplay('linear', 'View', linear_display_space_name)
403         displays.append('linear')
404         config.addDisplay('log', 'View', log_display_space_name)
405         displays.append('log')
406
407     # Setting the active *displays* and *views*.
408     config.setActiveDisplays(','.join(sorted(displays)))
409     config.setActiveViews(','.join(views))
410
411     set_config_default_roles(
412         config,
413         color_picking=reference.getName(),
414         color_timing=reference.getName(),
415         compositing_log=reference.getName(),
416         data=reference.getName(),
417         default=reference.getName(),
418         matte_paint=reference.getName(),
419         reference=reference.getName(),
420         scene_linear=reference.getName(),
421         texture_paint=reference.getName())
422
423     config.sanityCheck()
424
425     return config
426
427
428 def generate_LUTs(odt_info,
429                   lmt_info,
430                   shaper_name,
431                   aces_ctl_directory,
432                   lut_directory,
433                   lut_resolution_1d=4096,
434                   lut_resolution_3d=64,
435                   cleanup=True):
436     """
437     Object description.
438
439     Parameters
440     ----------
441     parameter : type
442         Parameter description.
443
444     Returns
445     -------
446     dict
447          Colorspaces and transforms converting between those colorspaces and
448          the reference colorspace, *ACES*.
449     """
450
451     print('generateLUTs - begin')
452     config_data = {}
453
454     # Initialize a few variables
455     config_data['displays'] = {}
456     config_data['colorSpaces'] = []
457
458     # -------------------------------------------------------------------------
459     # *ACES Color Spaces*
460     # -------------------------------------------------------------------------
461
462     # *ACES* colorspaces
463     (aces_reference,
464      aces_colorspaces,
465      aces_displays,
466      aces_log_display_space) = aces.create_colorspaces(aces_ctl_directory,
467                                                        lut_directory,
468                                                        lut_resolution_1d,
469                                                        lut_resolution_3d,
470                                                        lmt_info,
471                                                        odt_info,
472                                                        shaper_name,
473                                                        cleanup)
474
475     config_data['referenceColorSpace'] = aces_reference
476
477     for cs in aces_colorspaces:
478         config_data['colorSpaces'].append(cs)
479
480     for name, data in aces_displays.iteritems():
481         config_data['displays'][name] = data
482
483     config_data['linearDisplaySpace'] = aces_reference
484     config_data['logDisplaySpace'] = aces_log_display_space
485
486     # -------------------------------------------------------------------------
487     # *Camera Input Transforms*
488     # -------------------------------------------------------------------------
489
490     # *Log-C* to *ACES*.
491     arri_colorSpaces = arri.create_colorspaces(lut_directory,
492                                                lut_resolution_1d)
493     for cs in arri_colorSpaces:
494         config_data['colorSpaces'].append(cs)
495
496     # *Canon-Log* to *ACES*.
497     canon_colorspaces = canon.create_colorspaces(lut_directory,
498                                                  lut_resolution_1d)
499     for cs in canon_colorspaces:
500         config_data['colorSpaces'].append(cs)
501
502     # *RED* colorspaces to *ACES*.
503     red_colorspaces = red.create_colorspaces(lut_directory,
504                                              lut_resolution_1d)
505     for cs in red_colorspaces:
506         config_data['colorSpaces'].append(cs)
507
508     # *S-Log* to *ACES*.
509     sony_colorSpaces = sony.create_colorspaces(lut_directory,
510                                                lut_resolution_1d)
511     for cs in sony_colorSpaces:
512         config_data['colorSpaces'].append(cs)
513
514     # -------------------------------------------------------------------------
515     # General Color Spaces
516     # -------------------------------------------------------------------------
517     general_colorSpaces = general.create_colorspaces(lut_directory,
518                                                      lut_resolution_1d,
519                                                      lut_resolution_3d)
520     for cs in general_colorSpaces:
521         config_data['colorSpaces'].append(cs)
522
523     print('generateLUTs - end')
524     return config_data
525
526
527 def generate_baked_LUTs(odt_info,
528                         shaper_name,
529                         baked_directory,
530                         config_path,
531                         lut_resolution_1d,
532                         lut_resolution_3d,
533                         lut_resolution_shaper=1024):
534     """
535     Object description.
536
537     Parameters
538     ----------
539     parameter : type
540         Parameter description.
541
542     Returns
543     -------
544     type
545          Return value description.
546     """
547
548     # Create two entries for ODTs that have full and legal range support
549     odt_info_C = dict(odt_info)
550     for odt_ctl_name, odt_values in odt_info.iteritems():
551         if odt_values['transformHasFullLegalSwitch']:
552             odt_name = odt_values['transformUserName']
553
554             odt_values_legal = dict(odt_values)
555             odt_values_legal['transformUserName'] = '%s - Legal' % odt_name
556             odt_info_C['%s - Legal' % odt_ctl_name] = odt_values_legal
557
558             odt_values_full = dict(odt_values)
559             odt_values_full['transformUserName'] = '%s - Full' % odt_name
560             odt_info_C['%s - Full' % odt_ctl_name] = odt_values_full
561
562             del (odt_info_C[odt_ctl_name])
563
564     # Generate appropriate LUTs for each ODT
565     for odt_ctl_name, odt_values in odt_info_C.iteritems():
566         odt_prefix = odt_values['transformUserNamePrefix']
567         odt_name = odt_values['transformUserName']
568
569         # *Photoshop*
570         for input_space in ['ACEScc', 'ACESproxy']:
571             args = ['--iconfig', config_path,
572                     '-v',
573                     '--inputspace', input_space]
574             args += ['--outputspace', '%s' % odt_name]
575             args += ['--description',
576                      '%s - %s for %s data' % (odt_prefix,
577                                               odt_name,
578                                               input_space)]
579             args += ['--shaperspace', shaper_name,
580                      '--shapersize', str(lut_resolution_shaper)]
581             args += ['--cubesize', str(lut_resolution_3d)]
582             args += ['--format',
583                      'icc',
584                      os.path.join(baked_directory,
585                                   'photoshop',
586                                   '%s for %s.icc' % (odt_name, input_space))]
587
588             bake_lut = Process(description='bake a LUT',
589                                cmd='ociobakelut',
590                                args=args)
591             bake_lut.execute()
592
593         # *Flame*, *Lustre*
594         for input_space in ['ACEScc', 'ACESproxy']:
595             args = ['--iconfig', config_path,
596                     '-v',
597                     '--inputspace', input_space]
598             args += ['--outputspace', '%s' % odt_name]
599             args += ['--description',
600                      '%s - %s for %s data' % (
601                          odt_prefix, odt_name, input_space)]
602             args += ['--shaperspace', shaper_name,
603                      '--shapersize', str(lut_resolution_shaper)]
604             args += ['--cubesize', str(lut_resolution_3d)]
605
606             fargs = ['--format',
607                      'flame',
608                      os.path.join(
609                          baked_directory,
610                          'flame',
611                          '%s for %s Flame.3dl' % (odt_name, input_space))]
612             bake_lut = Process(description='bake a LUT',
613                                cmd='ociobakelut',
614                                args=(args + fargs))
615             bake_lut.execute()
616
617             largs = ['--format',
618                      'lustre',
619                      os.path.join(
620                          baked_directory,
621                          'lustre',
622                          '%s for %s Lustre.3dl' % (odt_name, input_space))]
623             bake_lut = Process(description='bake a LUT',
624                                cmd='ociobakelut',
625                                args=(args + largs))
626             bake_lut.execute()
627
628         # *Maya*, *Houdini*
629         for input_space in ['ACEScg', 'ACES2065-1']:
630             args = ['--iconfig', config_path,
631                     '-v',
632                     '--inputspace', input_space]
633             args += ['--outputspace', '%s' % odt_name]
634             args += ['--description',
635                      '%s - %s for %s data' % (
636                          odt_prefix, odt_name, input_space)]
637             if input_space == 'ACEScg':
638                 lin_shaper_name = '%s - AP1' % shaper_name
639             else:
640                 lin_shaper_name = shaper_name
641             args += ['--shaperspace', lin_shaper_name,
642                      '--shapersize', str(lut_resolution_shaper)]
643
644             args += ['--cubesize', str(lut_resolution_3d)]
645
646             margs = ['--format',
647                      'cinespace',
648                      os.path.join(
649                          baked_directory,
650                          'maya',
651                          '%s for %s Maya.csp' % (odt_name, input_space))]
652             bake_lut = Process(description='bake a LUT',
653                                cmd='ociobakelut',
654                                args=(args + margs))
655             bake_lut.execute()
656
657             hargs = ['--format',
658                      'houdini',
659                      os.path.join(
660                          baked_directory,
661                          'houdini',
662                          '%s for %s Houdini.lut' % (odt_name, input_space))]
663             bake_lut = Process(description='bake a LUT',
664                                cmd='ociobakelut',
665                                args=(args + hargs))
666             bake_lut.execute()
667
668
669 def create_config_dir(config_directory, bake_secondary_LUTs):
670     """
671     Object description.
672
673     Parameters
674     ----------
675     parameter : type
676         Parameter description.
677
678     Returns
679     -------
680     type
681          Return value description.
682     """
683
684     lut_directory = os.path.join(config_directory, 'luts')
685     dirs = [config_directory, lut_directory]
686     if bake_secondary_LUTs:
687         dirs.extend([os.path.join(config_directory, 'baked'),
688                      os.path.join(config_directory, 'baked', 'flame'),
689                      os.path.join(config_directory, 'baked', 'photoshop'),
690                      os.path.join(config_directory, 'baked', 'houdini'),
691                      os.path.join(config_directory, 'baked', 'lustre'),
692                      os.path.join(config_directory, 'baked', 'maya')])
693
694     for d in dirs:
695         not os.path.exists(d) and os.mkdir(d)
696
697     return lut_directory
698
699
700 def create_ACES_config(aces_ctl_directory,
701                        config_directory,
702                        lut_resolution_1d=4096,
703                        lut_resolution_3d=64,
704                        bake_secondary_LUTs=True,
705                        cleanup=True):
706     """
707     Creates the ACES configuration.
708
709     Parameters
710     ----------
711     parameter : type
712         Parameter description.
713
714     Returns
715     -------
716     type
717          Return value description.
718     """
719
720     lut_directory = create_config_dir(config_directory, bake_secondary_LUTs)
721
722     odt_info = aces.get_ODTs_info(aces_ctl_directory)
723     lmt_info = aces.get_LMTs_info(aces_ctl_directory)
724
725     shaper_name = 'Output Shaper'
726     config_data = generate_LUTs(odt_info,
727                                 lmt_info,
728                                 shaper_name,
729                                 aces_ctl_directory,
730                                 lut_directory,
731                                 lut_resolution_1d,
732                                 lut_resolution_3d,
733                                 cleanup)
734
735     print('Creating "generic" config')
736     config = create_config(config_data)
737     print('\n\n\n')
738
739     write_config(config,
740                  os.path.join(config_directory, 'config.ocio'))
741
742     print('Creating "Nuke" config')
743     nuke_config = create_config(config_data, nuke=True)
744     print('\n\n\n')
745
746     write_config(nuke_config,
747                  os.path.join(config_directory, 'nuke_config.ocio'))
748
749     if bake_secondary_LUTs:
750         generate_baked_LUTs(odt_info,
751                             shaper_name,
752                             os.path.join(config_directory, 'baked'),
753                             os.path.join(config_directory, 'config.ocio'),
754                             lut_resolution_1d,
755                             lut_resolution_3d,
756                             lut_resolution_1d)
757
758     return True
759
760
761 def main():
762     """
763     Object description.
764
765     Parameters
766     ----------
767     parameter : type
768         Parameter description.
769
770     Returns
771     -------
772     type
773          Return value description.
774     """
775
776     import optparse
777
778     p = optparse.OptionParser(description='An OCIO config generation script',
779                               prog='createACESConfig',
780                               version='createACESConfig 0.1',
781                               usage='%prog [options]')
782     p.add_option('--acesCTLDir', '-a', default=os.environ.get(
783         ACES_OCIO_CTL_DIRECTORY_ENVIRON, None))
784     p.add_option('--configDir', '-c', default=os.environ.get(
785         ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON, None))
786     p.add_option('--lutResolution1d', default=4096)
787     p.add_option('--lutResolution3d', default=64)
788     p.add_option('--dontBakeSecondaryLUTs', action='store_true')
789     p.add_option('--keepTempImages', action='store_true')
790
791     options, arguments = p.parse_args()
792
793     aces_ctl_directory = options.acesCTLDir
794     config_directory = options.configDir
795     lut_resolution_1d = int(options.lutResolution1d)
796     lut_resolution_3d = int(options.lutResolution3d)
797     bake_secondary_luts = not options.dontBakeSecondaryLUTs
798     cleanup_temp_images = not options.keepTempImages
799
800     # TODO: Investigate the following statements.
801     try:
802         args_start = sys.argv.index('--') + 1
803         args = sys.argv[args_start:]
804     except:
805         args_start = len(sys.argv) + 1
806         args = []
807
808     print('command line : \n%s\n' % ' '.join(sys.argv))
809
810     assert aces_ctl_directory is not None, (
811         'process: No "{0}" environment variable defined or no "ACES CTL" '
812         'directory specified'.format(
813             ACES_OCIO_CTL_DIRECTORY_ENVIRON))
814
815     assert config_directory is not None, (
816         'process: No "{0}" environment variable defined or no configuration '
817         'directory specified'.format(
818             ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON))
819
820     return create_ACES_config(aces_ctl_directory,
821                               config_directory,
822                               lut_resolution_1d,
823                               lut_resolution_3d,
824                               bake_secondary_luts,
825                               cleanup_temp_images)
826
827
828 if __name__ == '__main__':
829     main()