Skip to content

Instantly share code, notes, and snippets.

@fredrikaverpil
Last active April 28, 2016 07:19
Show Gist options
  • Save fredrikaverpil/310145480e5de0618d8a428afe161b11 to your computer and use it in GitHub Desktop.
Save fredrikaverpil/310145480e5de0618d8a428afe161b11 to your computer and use it in GitHub Desktop.
Set V-Ray proxy geometry type
import maya.cmds as cmds
def set_selected_geotype(n):
""" Source this function in Maya, then run one of the following:
set_selected_geotype(n=0) # Placeholder
set_selected_geotype(n=1) # Bounding box
set_selected_geotype(n=2) # Preview
set_selected_geotype(n=3) # Maya mesh
set_selected_geotype(n=4) # GPU Cache
"""
for proxy in cmds.ls(sl=True, long=True):
relatives = cmds.listRelatives(proxy, fullPath=True)
for relative in relatives:
connections = cmds.listConnections(relative, type='VRayMesh')
if not isinstance(connections, type(None)):
for obj in connections:
cmds.setAttr(obj+'.geomType', n)
import maya.cmds as cmds
def set_all_geotype(n):
""" Source this function in Maya, then run one of the following:
set_all_geotype(n=0) # Placeholder
set_all_geotype(n=1) # Bounding box
set_all_geotype(n=2) # Preview
set_all_geotype(n=3) # Maya mesh
set_all_geotype(n=4) # GPU Cache
"""
for proxy in cmds.ls(type='VRayMesh', long=True):
cmds.setAttr(proxy+'.geomType', n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment