-
Notifications
You must be signed in to change notification settings - Fork 10
vray getAHint
The getAHint functions gets information about a V-ray element. I've mainly seen it being used to get information about RenderElements.
mc.vray("getAHint", dataType, dataName, data)
The function always seems to return the data as a list
.
If you specify invalid dataType, dataName and data combination then the result will be None
.
It will not raise any errors.
The dataType
refers to an internal v-ray data type. The ones i've seen used is:
- RenderElement
- RenderElementAttribute
The dataName
refers to the name for the v-ray object to get the information from.
The data
refers to what data you want to get from the dataType and dataName object.
For RenderElement
dataType I've seen the following data values:
- label
- type
- attribute_N (where N is a continuous integer starting at zero)
For RenderElementAttribute
dataType I've seen the following data values:
- vray_parameter
import maya.cmds as mc
renderElementNames = mc.vray("getRenderElements")
for renderElement in renderElementNames:
print "renderElement:", renderElement
print "label:", mc.vray("getAHint", "RenderElement", renderElement, "label")
print "type:", mc.vray("getAHint", "RenderElement", renderElement, "type")
Returns the following:
renderElement: MultiMatteElement
label: [u'Multi Matte']
type: [u'RenderChannelMultiMatte']
renderElement: atmosphereChannel
label: [u'Atmospheric Effects']
type: [u'RenderChannelColor']
renderElement: diffuseChannel
label: [u'Diffuse']
type: [u'RenderChannelColor']
renderElement: reflectChannel
label: [u'Reflection']
type: [u'RenderChannelColor']
renderElement: refractChannel
label: [u'Refraction']
type: [u'RenderChannelColor']
renderElement: sampleRateChannel
label: [u'Sample Rate']
type: [u'RenderChannelColor']
renderElement: selfIllumChannel
label: [u'Self Illumination']
type: [u'RenderChannelColor']
renderElement: shadowChannel
label: [u'Shadow']
type: [u'RenderChannelColor']
renderElement: specularChannel
label: [u'Specular']
type: [u'RenderChannelColor']
renderElement: lightingChannel
label: [u'Lighting']
type: [u'RenderChannelColor']
renderElement: giChannel
label: [u'GI']
type: [u'RenderChannelColor']
renderElement: causticsChannel
label: [u'Caustics']
type: [u'RenderChannelColor']
renderElement: rawGiChannel
label: [u'Raw GI']
type: [u'RenderChannelColor']
renderElement: rawLightChannel
label: [u'Raw Light']
type: [u'RenderChannelColor']
renderElement: rawShadowChannel
label: [u'Raw Shadow']
type: [u'RenderChannelColor']
renderElement: totalLightChannel
label: [u'Total Light']
type: [u'RenderChannelColor']
renderElement: rawTotalLightChannel
label: [u'Raw Total Light']
type: [u'RenderChannelColor']
renderElement: reflectionFilterChannel
label: [u'Reflection Filter']
type: [u'RenderChannelColor']
renderElement: rawReflectionChannel
label: [u'Raw Reflection']
type: [u'RenderChannelColor']
renderElement: refractionFilterChannel
label: [u'Refraction Filter']
type: [u'RenderChannelColor']
renderElement: rawRefractionChannel
label: [u'Raw Refraction']
type: [u'RenderChannelColor']
renderElement: backgroundChannel
label: [u'Background']
type: [u'RenderChannelColor']
renderElement: matteShadowChannel
label: [u'Matte shadow']
type: [u'RenderChannelColor']
renderElement: materialIDChannel
label: [u'Material ID']
type: [u'RenderChannelColor']
renderElement: normalsChannel
label: [u'Normals']
type: [u'RenderChannelNormals']
renderElement: bumpNormalsChannel
label: [u'BumpNormals']
type: [u'RenderChannelBumpNormals']
renderElement: zdepthChannel
label: [u'Z-depth']
type: [u'RenderChannelZDepth']
renderElement: renderIDChannel
label: [u'Render ID']
type: [u'RenderChannelRenderID']
renderElement: velocityChannel
label: [u'Velocity']
type: [u'RenderChannelVelocity']
renderElement: MaterialSelectElement
label: [u'Material Select']
type: [u'RenderChannelColor']
renderElement: ExtraTexElement
label: [u'Extra Tex']
type: [u'RenderChannelExtraTex']
renderElement: FastSSS2Channel
label: [u'SSS']
type: [u'RenderChannelColor']
renderElement: drBucketChannel
label: [u'DR Bucket']
type: [u'RenderChannelDRBucket']
renderElement: LightSelectElement
label: [u'Light Select']
type: [u'RenderChannelColor']
renderElement: CoverageChannel
label: [u'Coverage']
type: [u'RenderChannelCoverage']
renderElement: nodeIDChannel
label: [u'Object ID']
type: [u'RenderChannelNodeID']
renderElement: customColor
label: [u'Custom Color']
type: [u'RenderChannelColor']
And here's a more extended version that also shows the renderElements' attributes data.
import maya.cmds as mc
renderElementNames = mc.vray("getRenderElements")
for renderElement in renderElementNames:
print '-----------'
print "renderElement:", renderElement
print "label:", mc.vray("getAHint", "RenderElement", renderElement, "label")
print "type:", mc.vray("getAHint", "RenderElement", renderElement, "type")
# Since the attribute names are continuous unsigned integers we can loop over them
# until we receive no more data. There's no other way to know up front how many attributes
# the render element holds as attributes.
i = 0
while True:
attributeName = "attribute_{0}".format(i)
value = mc.vray("getAHint", "RenderElement", renderElement, attributeName)
if not value:
break
else:
print "{0}: ".format(attributeName), value
i += 1