2 # -*- coding: utf-8 -*-
7 import PyOpenColorIO as OCIO
9 __author__ = 'ACES Developers'
10 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
12 __maintainer__ = 'ACES Developers'
13 __email__ = 'aces@oscars.org'
14 __status__ = 'Production'
16 __all__ = ['ColorSpace',
22 # Utility classes and functions
27 A container for data needed to define an OCIO 'Color Space'
33 bitDepth=OCIO.Constants.BIT_DEPTH_F32,
37 toReferenceTransforms=[],
38 fromReferenceTransforms=[],
39 allocationType=OCIO.Constants.ALLOCATION_UNIFORM,
40 allocationVars=[0.0, 1.0]):
42 Initialize the standard class variables
45 self.bitDepth = bitDepth
46 self.description = description
47 self.equalityGroup = equalityGroup
50 self.toReferenceTransforms = toReferenceTransforms
51 self.fromReferenceTransforms = fromReferenceTransforms
52 self.allocationType = allocationType
53 self.allocationVars = allocationVars
56 # Create a 4x4 matrix (list) based on a 3x3 matrix (list) input
57 def mat44FromMat33(mat33):
58 return [mat33[0], mat33[1], mat33[2], 0.0,
59 mat33[3], mat33[4], mat33[5], 0.0,
60 mat33[6], mat33[7], mat33[8], 0.0,
64 # TODO: Worth moving to *util.py*.
65 def filter_words(words, filters_in=None, filters_out=None, flags=0):
72 filter_matched = False
73 for filter in filters_in:
74 if re.search(filter, word, flags):
77 if not filter_matched:
81 filter_matched = False
82 for filter in filters_out:
83 if re.search(filter, word, flags):
88 filtered_words.append(word)
92 def files_walker(directory, filters_in=None, filters_out=None, flags=0):
96 for parent_directory, directories, files in os.walk(directory,
100 path = os.path.join(parent_directory, file)
101 if os.path.isfile(path):
102 if not filter_words((path,), filters_in, filters_out, flags):