+ look_name, look_colorspace, look_lut, look_cccid = unpack_default(look, 4)
+
+ print('Adding look %s - %s' % (look_name, ', '.join(look)))
+
+ # Copy *look LUT* if `custom_lut_dir` is provided.
+ if custom_lut_dir:
+ if '$' not in look_lut:
+ print('Getting ready to copy look lut : %s' % look_lut)
+ shutil.copy2(look_lut, custom_lut_dir)
+ look_lut = os.path.split(look_lut)[1]
+ else:
+ print('Skipping LUT copy because path contains a context variable')
+
+ print('Adding look to config')
+ ocio_look = ocio.Look()
+ ocio_look.setName(look_name)
+ ocio_look.setProcessSpace(look_colorspace)
+
+ keys = {'type': 'lutFile',
+ 'path': look_lut,
+ 'direction': 'forward'}
+ if look_cccid:
+ keys['cccid'] = look_cccid
+
+ ocio_transform = generate_OCIO_transform([keys])
+ ocio_look.setTransform(ocio_transform)
+
+ config.addLook(ocio_look)
+
+ print('Creating aliased colorspace')
+
+ # Creating *OCIO* colorspace referencing the look:
+ # - Needed for implementations that don't process looks properly.
+ # - Needed for implementations that don't expose looks properly.
+ look_aliases = ['look_%s' % compact(look_name)]
+ colorspace = ColorSpace(look_name,
+ aliases=look_aliases,
+ description='The %s Look colorspace' % look_name,
+ family='Look')
+
+ colorspace.from_reference_transforms = [{'type': 'look',
+ 'look': look_name,
+ 'src': reference_name,
+ 'dst': reference_name,
+ 'direction': 'forward'}]
+
+ print('Adding colorspace %s, alias to look %s to config data' % (
+ look_name, look_name))
+
+ config_data['colorSpaces'].append(colorspace)
+
+ print()
+
+
+def integrate_looks_into_views(looks,
+ reference_name,
+ config_data,
+ multiple_displays=False):
+ """
+ Object description.
+
+ Parameters
+ ----------
+ parameter : type
+ Parameter description.
+
+ Returns
+ -------
+ type
+ Return value description.
+ """
+ look_names = [look[0] for look in looks]
+
+ # Option 1
+ # - Adding a *look* per *Display*.
+ # - Assuming there is a *Display* for each *ACES* *Output Transform*.
+ if multiple_displays:
+ for look_name in look_names:
+ config_data['looks'].append(look_name)
+
+ # Option 2
+ # - Copy each *Output Transform* colorspace.
+ # - For each copy, add a *LookTransform* to the head of the
+ # `from_reference` transform list.
+ # - Add these the copy colorspaces for the *Displays* / *Views*.
+ else:
+ for display, view_list in config_data['displays'].iteritems():
+ colorspace_c = None
+ look_names_string = ''
+ for view_name, output_colorspace in view_list.iteritems():
+ if view_name == 'Output Transform':
+
+ print('Adding new View that incorporates looks')
+
+ colorspace_c = copy.deepcopy(output_colorspace)
+
+ for i, look_name in enumerate(look_names):
+ look_name = look_names[i]
+
+ # Add the `LookTransform` to the head of the
+ # `from_reference` transform list.
+ if colorspace_c.from_reference_transforms:
+ colorspace_c.from_reference_transforms.insert(
+ i,
+ {'type': 'look',
+ 'look': look_name,
+ 'src': reference_name,
+ 'dst': reference_name,
+ 'direction': 'forward'})
+
+ # Add the `LookTransform` to the end of
+ # the `to_reference` transform list.
+ if colorspace_c.to_reference_transforms:
+ inverse_look_name = look_names[
+ len(look_names) - 1 - i]
+
+ colorspace_c.to_reference_transforms.append(
+ {'type': 'look',
+ 'look': inverse_look_name,
+ 'src': reference_name,
+ 'dst': reference_name,
+ 'direction': 'inverse'})
+
+ if look_name not in config_data['looks']:
+ config_data['looks'].append(look_name)
+
+ look_names_string = ', '.join(look_names)
+ colorspace_c.name = '%s with %s' % (
+ output_colorspace.name, look_names_string)
+ colorspace_c.aliases = [
+ 'out_%s' % compact(colorspace_c.name)]
+
+ print('Colorspace that incorporates looks '
+ 'created : %s' % colorspace_c.name)
+
+ config_data['colorSpaces'].append(colorspace_c)
+
+ if colorspace_c:
+ print('Adding colorspace that incorporates looks '
+ 'into view list')
+
+ # Updating the *View* name.
+ view_list['Output Transform with %s' % look_names_string] = (
+ colorspace_c)
+ config_data['displays'][display] = view_list
+
+
+def create_config(config_data,
+ aliases=False,
+ prefix=False,
+ multiple_displays=False,
+ look_info=None,
+ custom_lut_dir=None):
+ """
+ Object description.
+
+ Parameters
+ ----------
+ parameter : type
+ Parameter description.
+
+ Returns
+ -------
+ type
+ Return value description.
+ """
+
+ if look_info is None:
+ look_info = []
+
+ prefixed_names = {}
+ alias_colorspaces = []
+