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]):
47 Parameter description.
52 Return value description.
56 self.bitDepth = bitDepth
57 self.description = description
58 self.equalityGroup = equalityGroup
61 self.toReferenceTransforms = toReferenceTransforms
62 self.fromReferenceTransforms = fromReferenceTransforms
63 self.allocationType = allocationType
64 self.allocationVars = allocationVars
67 def mat44FromMat33(mat33):
69 Creates a 4x4 matrix from given 3x3 matrix.
74 Parameter description.
79 Return value description.
82 return [mat33[0], mat33[1], mat33[2], 0.0,
83 mat33[3], mat33[4], mat33[5], 0.0,
84 mat33[6], mat33[7], mat33[8], 0.0,
88 def filter_words(words, filters_in=None, filters_out=None, flags=0):
95 Parameter description.
100 Return value description.
106 filter_matched = False
107 for filter in filters_in:
108 if re.search(filter, word, flags):
109 filter_matched = True
111 if not filter_matched:
115 filter_matched = False
116 for filter in filters_out:
117 if re.search(filter, word, flags):
118 filter_matched = True
122 filtered_words.append(word)
123 return filtered_words
126 def files_walker(directory, filters_in=None, filters_out=None, flags=0):
133 Parameter description.
138 Return value description.
141 for parent_directory, directories, files in os.walk(directory,
145 path = os.path.join(parent_directory, file)
146 if os.path.isfile(path):
147 if not filter_words((path,), filters_in, filters_out, flags):