def executeMayabatch(self): """The final method used to bake the textures on the deported machine. It will only bake the shaders in self.toBake if there is any (if a shader is selected in the UI for example), otherwise it will bake all the shaders added. """ tdLib.loadPlugin('Turtle') for shader in self.toBake or self.shaders: print 'SHADER NAME: ', shader print 'SHADER MODE: ', shader.mode print 'Render Attr: ', shader.renderAttr print 'Shader Attr: ', shader.shaderAttr # Assign surfaceshader noir sur tous les meshes ? for shader in self.toBake or self.shaders: for udim in shader.udims: filename = '{}.10{}{}.tga'.format(shader.fileName, udim[1], udim[0] + 1) cmd = self.constructTurtleCommand(shader, udim, filename) tdLib.createDir(shader.texturePath) # Create directory? self.bakeShader(shader, cmd) fullpath = tdLib.normpath( os.path.join(shader.texturePath, filename)) self.result.append( '<a href="file://{0}" {1}>{0}</a> - <a href="rvlink://{0}" {1}>Open in RV</a>' .format(fullpath, 'style="text-decoration: none"')) print '<br />'.join( self.result ) # This is used by the Mayabatch lib to send the result by mail.
def executeMayabatch(self): """The final method used to bake the textures on the deported machine. It will only bake the shaders in self.toBake if there is any (if a shader is selected in the UI for example), otherwise it will bake all the shaders added. """ tdLib.loadPlugin('Turtle') for shader in self.toBake or self.shaders: print 'SHADER NAME: ', shader print 'SHADER MODE: ', shader.mode print 'Render Attr: ', shader.renderAttr print 'Shader Attr: ', shader.shaderAttr # Assign surfaceshader noir sur tous les meshes ? for shader in self.toBake or self.shaders: for udim in shader.udims: filename = '{}.10{}{}.tga'.format(shader.fileName, udim[1], udim[0]+1) cmd = self.constructTurtleCommand(shader, udim, filename) tdLib.createDir(shader.texturePath) # Create directory? self.bakeShader(shader, cmd) fullpath = tdLib.normpath(os.path.join(shader.texturePath, filename)) self.result.append('<a href="file://{0}" {1}>{0}</a> - <a href="rvlink://{0}" {1}>Open in RV</a>'.format(fullpath, 'style="text-decoration: none"')) print '<br />'.join(self.result) # This is used by the Mayabatch lib to send the result by mail.
def __init__(self, shaders, fillColor=(255, 255, 255)): self.fillColor = fillColor self.exportPath, self.assetName = getExportPath() tdLib.createDir(self.exportPath) self.shaders = dict.fromkeys(shaders)