Esempio n. 1
0
    def renderProcedure(self):
        log.debug("mtmRenderProcedure")

        pm.mel.trace(
            "================ Start MayaToMantra Rendering ======================"
        )
        # TODO: get directorys and filenames
        #    outputPath = pm.workspace.path + "/mantra/" + realSceneName()
        #    imagePath = pm.workspace.path + "/images"
        #    imageName = realSceneName()
        #    try:
        #        mantraGlobals = pm.ls(type="mayaToMantraGlobals")[0]
        #    except:
        #        log.error("mayaToMantraGlobals not found")
        #        return
        #
        #    mantraGlobals.basePath.set(outputPath)
        #    mantraGlobals.imagePath.set(imagePath)
        #    mantraGlobals.imageName.set(imageName)

        imageName = pm.sceneName().basename().replace(".ma",
                                                      "").replace(".mb", "")
        # check for mayabatch name like sceneName_number
        numberPart = imageName.split("__")[-1]
        try:
            number = int(numberPart)
            if number > 999:
                imageName = imageName.replace("__" + numberPart, "")
        except:
            pass

        self.createGlobalsNode()
        self.preRenderProcedure()
        self.renderGlobalsNode.basePath.set(pm.workspace.path + "/mantra/" +
                                            imageName)
        self.renderGlobalsNode.imagePath.set(pm.workspace.path +
                                             pm.workspace.fileRules['images'])
        self.renderGlobalsNode.imageName.set(imageName)

        outputPath = pm.workspace.path + "/mantra/" + realSceneName()
        imagePath = pm.workspace.path + "/images"

        if not os.path.exists(outputPath):
            os.makedirs(outputPath)
        if not os.path.exists(imagePath):
            os.makedirs(imagePath)

        shaderOutputPath = outputPath + "/shaders"
        if not os.path.exists(shaderOutputPath):
            os.makedirs(shaderOutputPath)
        geoOutputPath = outputPath + "/geo"
        if not os.path.exists(geoOutputPath):
            os.makedirs(geoOutputPath)

        pm.mayatomantra()
Esempio n. 2
0
    def renderProcedure(self):
        log.debug("mtmRenderProcedure")
    
        pm.mel.trace("================ Start MayaToMantra Rendering ======================")
        # TODO: get directorys and filenames
#    outputPath = pm.workspace.path + "/mantra/" + realSceneName()
#    imagePath = pm.workspace.path + "/images"
#    imageName = realSceneName()
#    try:
#        mantraGlobals = pm.ls(type="mayaToMantraGlobals")[0]
#    except:
#        log.error("mayaToMantraGlobals not found")
#        return 
#    
#    mantraGlobals.basePath.set(outputPath)
#    mantraGlobals.imagePath.set(imagePath)
#    mantraGlobals.imageName.set(imageName)

        imageName = pm.sceneName().basename().replace(".ma", "").replace(".mb", "")
        # check for mayabatch name like sceneName_number 
        numberPart = imageName.split("__")[-1]
        try:
            number = int(numberPart)
            if number > 999:
                imageName = imageName.replace("__" + numberPart, "")
        except:
            pass
        
        self.createGlobalsNode()    
        self.preRenderProcedure()
        self.renderGlobalsNode.basePath.set(pm.workspace.path +"/mantra/" + imageName)
        self.renderGlobalsNode.imagePath.set(pm.workspace.path + pm.workspace.fileRules['images'])
        self.renderGlobalsNode.imageName.set(imageName)        
        
        outputPath = pm.workspace.path + "/mantra/" + realSceneName()
        imagePath = pm.workspace.path + "/images"
        
        if not os.path.exists(outputPath):
            os.makedirs(outputPath)
        if not os.path.exists(imagePath):
            os.makedirs(imagePath)
    
        shaderOutputPath = outputPath + "/shaders"
        if not os.path.exists(shaderOutputPath):
            os.makedirs(shaderOutputPath)
        geoOutputPath = outputPath + "/geo"
        if not os.path.exists(geoOutputPath):
            os.makedirs(geoOutputPath)
        
        pm.mayatomantra()
Esempio n. 3
0
def renderProcedure():
    log.debug("RenderProcedure")
    
    pm.mel.trace("================ Start MayaToMantra Rendering ======================")
    # TODO: get directorys and filenames
    currentTime = pm.currentTime(query = True)
    outputPath = pm.workspace.path + "/mantra/" + pm.sceneName().basename().split(".")[0]
    imagePath = pm.workspace.path + "/images"
    imageName = pm.sceneName().basename().split(".")[0]
    try:
        mantraGlobals = pm.ls(type="mayaToMantraGlobals")[0]
    except:
        log.error("mayaToMantraGlobals not found")
        return 
    
    mantraGlobals.basePath.set(outputPath)
    mantraGlobals.imagePath.set(imagePath)
    mantraGlobals.imageName.set(imageName)
    if not os.path.exists(outputPath):
        os.makedirs(outputPath)
    if not os.path.exists(imagePath):
        os.makedirs(imagePath)

    shaderOutputPath = outputPath + "/shaders"
    if not os.path.exists(shaderOutputPath):
        os.makedirs(shaderOutputPath)
    geoOutputPath = outputPath + "/geo"
    if not os.path.exists(geoOutputPath):
        os.makedirs(geoOutputPath)
    
    pm.mayatomantra()
    
    mantraGlobals.basePath.set("")
    mantraGlobals.imagePath.set("")
    mantraGlobals.imageName.set("")
    pm.currentTime(currentTime)