Skip to content

vray getRenderElements

Roy Nieterau edited this page Dec 9, 2013 · 3 revisions

The vray("getRenderElements") command returns a list of all the vrayClassTypes there are for render elements.

These names can be used by the vrayAddRenderElement command (Note that this command is a function from a .mel script) to create them.

Also, a render element is of node type: VRayRenderElement. The vrayClassType is defined by an attribute on that node called: vrayClassType.

Examples

Print the list of all possible vrayClassTypes:

import maya.cmds as mc
print mc.vray("getRenderElements")

Assuming X is the name of the vrayClassType of the Render Element you want to create you can do:

import maya.mel as mel
print mel.eval("vrayAddRenderElement X")

Creating a single render element of each available type:

import maya.cmds as mc
import maya.mel as mel

for renderElement in mc.vray("getRenderElements"):
    mel.eval("vrayAddRenderElement {0}".format(renderElement))

Printing the vrayClassType from all Render Elements in your scene:

import maya.cmds as mc
allRenderElements = mc.ls(type="VRayRenderElement")
for renderElement in allRenderElements:
    print renderElement, ":", mc.getAttr("{0}.vrayClassType".format(renderElement))
Clone this wiki locally