Created
June 16, 2021 13:10
-
-
Save BigRoy/d5e12f9fd682b97ce70a28d47a0536c4 to your computer and use it in GitHub Desktop.
Get custom attributes for each VRayRenderElement class type using vray "getAHint" similar to how V-Ray MEL procedure 'vrayAddRenderElementImpl' does it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import cmds | |
import itertools | |
def get_render_element_attributes(name): | |
"""Get attributes for VRayRenderElement based on class type""" | |
attrs = [] | |
for i in itertools.count(): | |
buffer = cmds.vray("getAHint", | |
"RenderElement", | |
name, | |
"attribute_%s" % i) | |
if not buffer: | |
break | |
attr = buffer[0] | |
attrs.append(attr) | |
return attrs | |
def get_render_element_attr_parameter(attr): | |
return cmds.vray("getAHint", | |
"RenderElementAttribute", | |
attr, | |
"vray_parameter") | |
# Example usage | |
for attr in get_render_element_attributes("ExtraTexElement"): | |
parameter = get_render_element_attr_parameter(attr) | |
print("{0: <45} - {1}".format(attr, parameter)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
Example output:
To do the same for all V-Ray Render Elements class types: