The default display now drives the value of the 'color_picking' role
authorHaarm-Pieter Duiker <hpd1@duikerresearch.com>
Tue, 30 Jun 2015 20:30:57 +0000 (13:30 -0700)
committerHaarm-Pieter Duiker <hpd1@duikerresearch.com>
Tue, 30 Jun 2015 20:30:57 +0000 (13:30 -0700)
aces_1.0.0/python/aces_ocio/aces_config.py

index b7ceed1..3cc5727 100755 (executable)
@@ -782,11 +782,19 @@ def create_config(config_data,
 
     print('Adding the diplays and views')
 
+    # Set the color_picking role to be the first Display's Output Transform View
+    default_display_name = config_data['defaultDisplay']
+    default_display_views = config_data['displays'][default_display_name]
+    default_display_colorspace = default_display_views['Output Transform']
+
+    set_config_default_roles(
+        config,
+        color_picking=default_display_colorspace.name)
+
     # Defining the *views* and *displays*.
     displays = []
     views = []
 
-
     # Defining a *generic* *display* and *view* setup.
     if multiple_displays:
         # Built list of looks to add to Displays
@@ -794,6 +802,9 @@ def create_config(config_data,
         looks = ", ".join(looks)
         print( "Creating multiple displays, with looks : %s" % looks)
 
+        # Note: We don't reorder the Displays to put the 'defaultDisplay' first
+        # because OCIO will order them alphabetically when the config is written to disk.
+
         # Create Displays, Views
         for display, view_list in config_data['displays'].iteritems():
             for view_name, colorspace in view_list.iteritems():
@@ -817,11 +828,9 @@ def create_config(config_data,
         #single_display_name = config_data['roles']['scene_linear']
         displays.append(single_display_name)
 
-        display_names = sorted(config_data['displays'])
-
         # Make sure the default display is first
-        default_display = config_data['defaultDisplay']
-        display_names.insert(0, display_names.pop(display_names.index(default_display)))
+        display_names = sorted(config_data['displays'])
+        display_names.insert(0, display_names.pop(display_names.index(default_display_name)))
 
         # Built list of looks to add to Displays
         looks = config_data['looks'] if ('looks' in config_data) else []
@@ -834,15 +843,15 @@ def create_config(config_data,
             view_list = config_data['displays'][display]
             for view_name, colorspace in view_list.iteritems():
                 if 'Output Transform' in view_name:
-                    #print( "Adding view for %s" % view_name )
-
-                    # Maya 2016 doesn't like parentheses in View names
-                    display_cleaned = replace(display, {')': '', '(': ''})
+                    #print( "Adding view for %s" % colorspace.name )
 
                     # We use the Display names as the View names in this case
                     # as there is a single Display that contains all views.
                     # This works for more applications than not, as of the time of this implementation.
 
+                    # Maya 2016 doesn't like parentheses in View names
+                    display_cleaned = replace(display, {')': '', '(': ''})
+
                     # If View includes looks
                     if 'with' in view_name:
                         # Integrate looks into view name
@@ -871,6 +880,7 @@ def create_config(config_data,
                             views.append(display_cleaned)
 
         # Add to config any display, view combinations that were saved for later
+        # This list will be empty unless viewsWithLooksAtEnd is set to True above 
         for display_view_colorspace in displays_views_colorspaces:
             single_display_name, display_cleaned, colorspace_name = display_view_colorspace
 
@@ -930,7 +940,7 @@ def create_config(config_data,
 
             print( "\n")
 
-            print( "Inverse Lookup")
+            print( "Inverse Lookup of Prefixed names")
             for prefixed, original in prefixed_names_inverse.iteritems():
                 print( "%s, %s" % (prefixed, original) )
             raise