from Modules.BaseModule import BaseModule from Intermediaries import ShaderAAT from NGCCBase import NGCCException class NGCCSplitShadersException(NGCCException): pass class SplitShaders(BaseModule): __expects__ = ShaderAAT.ShaderAAT __returns__ = list def process(self, input): out = [] data = [] for elem in input: if elem.__class__ not in (ShaderAAT.Function, ShaderAAT.Technique): data.append(elem) for elem in input: if elem.__class__ in (ShaderAAT.Function, ShaderAAT.Technique): func = ShaderAAT.ShaderAAT() for other in data: func.append(other) func.append(elem) out.append((elem.__class__, func)) return out