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.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/0d48a662-8231-4e30-9f4d-de87d268780b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.