jpi...@gmail.com
unread,Sep 28, 2016, 3:18:21 AM9/28/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Python Programming for Autodesk Maya
Hi Guys,
I need to create .command file with an automatic rendering in Maya where I can import multiple Obj files, to different render layers, apply materials and create a batch render for them.
I have the following script:
import maya.cmds as cmds
import glob
def importFile(i):
cmds.file(i, i=True, groupReference=True, groupName="myobj")
def moveFile():
cmds.select("myobj")
cmds.scale(1,1,1, r=True)
cmds.move (0, 14, 0, r=True)
cmds.rotate (-90, 0, 0, r=True)
def materialFile():
cmds.select("myobj")
myMaterial = "blinn1"
cmds.sets( e=True, forceElement= myMaterial + 'SG' )
def renderFile(i):
cmds.setAttr("defaultRenderGlobals.imageFilePrefix", i, type="string")
cmds.render(batch=True)
def deleteFile():
cmds.select("myobj")
cmds.delete()
myglob = glob.glob("/Users/MyMacbook/Documents/maya/projects/default/assets/Ring exports/Obj/*.obj")
for i in myglob:
importFile(i)
moveFile()
materialFile()
renderFile(i)
deleteFile()
The problem with this script is that it applies the material to the whole obj element. I need to apply different shaders to specifit pieces on the element.
The other problem is, it renders in the UI and I need to create a bach render.
After that I need to call all of this actions from a .command file because I will go to a render farm.