示例#1
0
    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.
示例#2
0
 def __init__(self):
     self.project = ''
     self.result = []
     self.toBake = []
     self.shaders = Shader.instances
     self.renderAttr = {
         'resolution': 2048,
         'alpha': 0,
         'merge': 1,
         'tbBilinearFilter': 0,
         'tbEdgeDilation': 0,
         'tbUvRange': 2,
         'tbDirectory': '/tmp/'
     }
     self.shaderAttr = {
         'OCC': {
             'minSamples': 128,
             'maxSamples': 256,
             'coneAngle': 180.0,
             'maxDistance': 5,
             'contrast': 1.0,
             'scale': 1.0,
             'selfOcclusion': 0
         },
         'THICK': {
             'numberOfRays': 16,
             'coneAngle': 80,
             'maxDistance': 0.75
         },
         'DIRT': {
             'LeaksOn': 1,
             'LeaksGlobalScale': 1,
             'LeaksDistance': 40,
             'LeaksGamma': 1,
             'LeaksLacunarity': 0,
             'LeaksLacunarityScale': 1,
             'LeaksYmultiplier': 1.5,
             'LeaksYScaleMult': 1,
             'LeaksOcclusionScale': 1,
             'ThicknessOn': 1,
             'ThicknessDistance': 0.1,
             'OmniDirtOn': 1,
             'OmniDirtPatternScale': 1,
             'OmniDirtMaxDistance': 5,
             'OmniDirtGamma': 0.8,
             'VertexPaintDirt': 0,
             'VertexPaintDirtScale': 0.2,
             'SplitToRGB': 0,
         },
         'RGB': {},
     }
     self.toolName = 'The Bakery'
     self.prepared = False
     self.scenePath = cmds.file(query=True, sceneName=True)
     try:
         tdLib.loadPlugin('Turtle')
         self.turtle = True
     except RuntimeError:
         self.turtle = False
示例#3
0
文件: bakery.py 项目: Regnareb/Maya
 def __init__(self):
     self.project = ''
     self.result = []
     self.toBake = []
     self.shaders = Shader.instances
     self.renderAttr = {'resolution': 2048,
                        'alpha': 0,
                        'merge': 1,
                        'tbBilinearFilter': 0,
                        'tbEdgeDilation': 0,
                        'tbUvRange': 2,
                        'tbDirectory': '/tmp/'
                        }
     self.shaderAttr = {'OCC': {'minSamples': 128,
                                'maxSamples': 256,
                                'coneAngle': 180.0,
                                'maxDistance': 5,
                                'contrast': 1.0,
                                'scale': 1.0,
                                'selfOcclusion': 0
                                },
                        'THICK': {'numberOfRays': 16,
                                  'coneAngle': 80,
                                  'maxDistance': 0.75
                                  },
                        'DIRT': {'LeaksOn': 1,
                                 'LeaksGlobalScale': 1,
                                 'LeaksDistance': 40,
                                 'LeaksGamma': 1,
                                 'LeaksLacunarity': 0,
                                 'LeaksLacunarityScale': 1,
                                 'LeaksYmultiplier': 1.5,
                                 'LeaksYScaleMult': 1,
                                 'LeaksOcclusionScale': 1,
                                 'ThicknessOn': 1,
                                 'ThicknessDistance': 0.1,
                                 'OmniDirtOn': 1,
                                 'OmniDirtPatternScale': 1,
                                 'OmniDirtMaxDistance': 5,
                                 'OmniDirtGamma': 0.8,
                                 'VertexPaintDirt': 0,
                                 'VertexPaintDirtScale': 0.2,
                                 'SplitToRGB': 0,
                                 },
                        'RGB': {},
                         }
     self.toolName = 'The Bakery'
     self.prepared = False
     self.scenePath = cmds.file(query=True, sceneName=True)
     try:
         tdLib.loadPlugin('Turtle')
         self.turtle = True
     except RuntimeError:
         self.turtle = False
示例#4
0
文件: bakery.py 项目: Regnareb/Maya
    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.