Beispiel #1
0
 def test_interface(self):
     
     OCIO.ClearAllCaches()
     #self.assertEqual("1.0.8", OCIO.version)
     #self.assertEqual(16779264, OCIO.hexversion)
     self.assertEqual(OCIO.Constants.LOGGING_LEVEL_INFO, OCIO.GetLoggingLevel())
     OCIO.SetLoggingLevel(OCIO.Constants.LOGGING_LEVEL_NONE)
     self.assertEqual(OCIO.Constants.LOGGING_LEVEL_NONE, OCIO.GetLoggingLevel())
     foo = OCIO.GetCurrentConfig()
     self.assertEqual(self.FOO, foo.serialize())
     OCIO.SetLoggingLevel(OCIO.Constants.LOGGING_LEVEL_INFO)
     bar = OCIO.Config().CreateFromStream(foo.serialize())
     OCIO.SetCurrentConfig(bar)
     wee = OCIO.GetCurrentConfig()
Beispiel #2
0
def build_ctf(amf_path):
    """ Build a color pipeline that implements the supplied AMF file and write out a CTF file. """
    print('\nProcessing file: ', amf_path, '\n')

    # Use Python to parse the AMF XML file and return an Element Tree object.
    tree = ET.parse(amf_path)
    root = tree.getroot()

    # Clear the OCIO file cache (helpful if someone is editing files in between running this).
    ocio.ClearAllCaches()

    # Load the ACES Reference config that will be used to implement any Transform ID strings
    # encountered in the AMF file.
    config = load_aces_ref_config()

    # Initialize a group transform to hold the results.
    gt = ocio.GroupTransform()

    #
    # Handle the AMF Input Transform.
    #
    input_elem = root.find('./aces:pipeline/aces:inputTransform', namespaces=NS)
    if must_apply(input_elem, 'Input'):
        load_input_transform(config, gt, amf_path, input_elem)
    #
    # Handle all the AMF Look Transforms.
    #
    for look_elem in root.findall('./aces:pipeline/aces:lookTransform', namespaces=NS):
        process_look(config, gt, amf_path, look_elem)
    #
    # Handle the AMF Output Transform.
    #
    output_elem = root.find('./aces:pipeline/aces:outputTransform', namespaces=NS)
    if must_apply(output_elem, 'Output'):
        load_output_transform(config, gt, amf_path, output_elem, is_inverse=False)

    # Print the OCIO transforms in the group transform.
    print('\n', gt)

    # Write the group transform using OCIO's native file format, CTF.
    ctf_path = name_ctf_output_file(amf_path)
    write_ctf(gt, config, amf_path, ctf_path, 'none')