Heya
Smashing my head here... How can I add a Reflection/refraction/etc layer using python command ?
Thanks, ciao.
Smashing my head here... How can I add a Reflection/refraction/etc layer using python command ?
Thanks, ciao.
Important: Update Your Chaos Licensing by January 28, 2025
To ensure uninterrupted access to your licenses, an essential update is required by January 28, 2025. Failure to update your Chaos licensing will result in the loss of access to your licenses.import pymel.all as pm reflection = pm.mel.eval('vrayAddRenderElement("reflectChannel")') refraction = pm.mel.eval('vrayAddRenderElement("refractChannel")')
import maya.mel as mel reflection = mel.eval('vrayAddRenderElement("reflectChannel")') refraction = mel.eval('vrayAddRenderElement("refractChannel")')
cmds.addAttr('vrayAddRenderElement("reflectChannel ")')
import maya.mel as mel reflection = mel.eval('vrayAddRenderElement("reflectChannel")') refraction = mel.eval('vrayAddRenderElement("refractChannel")')
import pymel.all as pm reflection = pm.mel.eval('vrayAddRenderElement("reflectChannel")') refraction = pm.mel.eval('vrayAddRenderElement("refractChannel")')
import maya.cmds as cmds allRenderLayers = cmds.ls(type = "renderLayer")
allLights = cmds.ls(type = "renderLayer")
import maya.cmds as cmds import maya.mel as mel allRenderLayers = cmds.ls(type = "renderLayer")#get all renderLayers for myLayer in allRenderLayers: cmds.editRenderLayerGlobals( currentRenderLayer=myLayer )#swtich to current renderLayer lightType = cmds.listNodeTypes( 'light' )#get all lights type for eachType in lightType: for myLight in cmds.ls(type = eachType):#get all lights for each of type light transform = cmds.listRelatives(myLight, p = True)#transform of the light renderElement = mel.eval('vrayAddRenderElement("LightSelectElement")')#create the light select cmds.sets(myLight, addElement = renderElement)#connect the light to the render element cmds.rename(renderElement, "lightSelect_" + myLayer + "_" + transform[0])#rename your renderElement
import pymel.all as pm for myLayer in pm.RenderLayer.listAllRenderLayers(): myLayer.setCurrent() for eachType in pm.listNodeTypes( 'light' ): for myLight in pm.ls(type = eachType): renderElement = pm.mel.eval('vrayAddRenderElement("LightSelectElement")') set = pm.PyNode(renderElement) set.add(myLight) set.rename("lightSelect_" + myLayer.name() + "_" + myLight.firstParent())
import vray.utils as vr for myLight in vr.findByType("Light*") + vr.findByType("MayaLight*"): name = "lightSelect_" + myLight.name() vr.create("RenderChannelColor", name) lightSelect = vr.findByName(name) lightSelect[0].set("name", name) myLight.set("channels", [lightSelect[0]])
import maya.cmds as cmds def subD(*args): textFieldAinput = cmds.textField('subDiv',q=True,text=True) #print textFieldAinput lightlist = cmds.ls(sl=1) print lightlist for relatives in lightlist: litShape = cmds.listRelatives(relatives, c=True) #hierlist = cmds.select(lightlist, hi=1) for lights in litShape: #try: #test = cmds.setAttr('%s.%s'%(lights, 'intensityMult'), textFieldAinput) test = cmds.setAttr('%s.%s'%(lights, 'subdivs'),textFieldAinput) print test #except: # pass ''' ba=cmds.ls(sl=1) da=cmds.select(ba,hi=1) print ba for objects in ba: try: cmds.setAttr('%s.%s'%(objects,'intensityMult'), 5025) except: pass ''' if cmds.window(window, exists=True): cmds.deleteUI(window) cmds.window(w=200,h=200) cmds.showWindow() cmds.columnLayout() cmds.text(l='Subdivision') cmds.textField('subDiv',cc=subD)
Comment