Hello guys!
I was looking for a python or mel script that apply a VRay Attributes "subdivision" level to each selected object at once.
I found something on the web, but looks like something is wrong.
Didnt work that script for me.
Do you have any idea how to write a script to turn on the subdivision for each selected object at once?
I tried also to apply this over the VRay Shelf but you need to do this also manually and it will make a lot of nodes.
I will appreciate any help because I have a lot of objects in my scene (just 2505 objects that require some time if I do one by one)
Cheers!
I was looking for a python or mel script that apply a VRay Attributes "subdivision" level to each selected object at once.
I found something on the web, but looks like something is wrong.
Didnt work that script for me.
import maya.cmds as cmds
import maya.mel as mel
def makeVrayAttributes(startID=1):
sel = cmds.ls(sl=1)
currentID=startID
for i in sel:
# get renderable shape nodes relative to transform, iterate through and apply subdivision
shapes = cmds.listRelatives(i,s=1,ni=1)
if shapes:
for s in shapes:
melCmd = "vray addAttributesFromGroup "+s+" vray_subdivision 1"
mel.eval(melCmd)
melCmd = "vray addAttributesFromGroup "+s+" vray_subquality 1"
mel.eval(melCmd)
# apply object ID to xform. i don't like giving individual shapes IDs.
melCmd = "vray addAttributesFromGroup "+i+" vray_objectID 1"
mel.eval(melCmd)
cmds.setAttr(i+'.vrayObjectID',currentID)
currentID += 1
import maya.mel as mel
def makeVrayAttributes(startID=1):
sel = cmds.ls(sl=1)
currentID=startID
for i in sel:
# get renderable shape nodes relative to transform, iterate through and apply subdivision
shapes = cmds.listRelatives(i,s=1,ni=1)
if shapes:
for s in shapes:
melCmd = "vray addAttributesFromGroup "+s+" vray_subdivision 1"
mel.eval(melCmd)
melCmd = "vray addAttributesFromGroup "+s+" vray_subquality 1"
mel.eval(melCmd)
# apply object ID to xform. i don't like giving individual shapes IDs.
melCmd = "vray addAttributesFromGroup "+i+" vray_objectID 1"
mel.eval(melCmd)
cmds.setAttr(i+'.vrayObjectID',currentID)
currentID += 1
I tried also to apply this over the VRay Shelf but you need to do this also manually and it will make a lot of nodes.
I will appreciate any help because I have a lot of objects in my scene (just 2505 objects that require some time if I do one by one)
Cheers!
Comment