Created
December 29, 2015 20:05
-
-
Save borgfriend/127626b1732f677ab2b3 to your computer and use it in GitHub Desktop.
Create a Bat-File to Batch Render Maya Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
#Variables must be configured to the proper Path | |
projectName = "default" | |
path = os.environ['USERPROFILE'] + "\Documents\maya\projects" + "\\" + projectName + "\\" + "autosave" | |
#Camera selected | |
camera = "persp" | |
filename = "batchRender.bat" | |
fileoutput = path + "\\" + filename | |
file = open(fileoutput, "w") | |
file.write("@ECHO OFF") | |
file.write("TITLE Rendering AutoSaves") | |
outputpathCmd ="-rd " + path + "\img " | |
filelist = os.listdir(path) | |
filelist.remove(filename) | |
for item in filelist: | |
outputimgNameCmd = "-im " + os.path.splitext(item)[0] + " " | |
file.write("Render -r mr -of tga -cam " + camera + " " + outputimgNameCmd + outputpathCmd + path +"\\" + item) | |
file.write("\n") | |
file.write("ECHO Batchrendering Completed \n") | |
file.write("ECHO Press Any Key to Finish... \n") | |
file.write("PAUSE") | |
file.write("DEL " + fileoutput) | |
file.close() | |
os.startfile(fileoutput) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment