Skip to content

Instantly share code, notes, and snippets.

@gregtemp
Created June 13, 2014 20:15
Show Gist options
  • Save gregtemp/a82292dff87c7348dc28 to your computer and use it in GitHub Desktop.
Save gregtemp/a82292dff87c7348dc28 to your computer and use it in GitHub Desktop.
Level of detail demo - maya python pymel
import pymel.core.runtime as pm
import maya.cmds as cmds
lodList = list()
lodList = cmds.ls('lodGroup*')
if len(lodList) > 0:
cmds.select('lodGroup1')
pm.LevelOfDetailUngroup()
else:
print('no group to ungroup')
sphereList = list()
sphereList = cmds.ls('pSphere*')
if len(sphereList) > 0:
cmds.delete(sphereList)
else:
print('no spheres to unsphere')
cmds.polySphere(r=1, sx=20, sy=20, ax=(0,1,0), cuv=2, ch=1)
cmds.polySphere(r=1, sx=7, sy=7, ax=(0,1,0), cuv=2, ch=1)
cmds.polySphere(r=1, sx=5, sy=5, ax=(0,1,0), cuv=2, ch=1)
cmds.polySphere(r=1, sx=3, sy=3, ax=(0,1,0), cuv=2, ch=1)
cmds.select('pSphere1', 'pSphere2', 'pSphere3', 'pSphere4',r=True)
pm.LevelOfDetailGroup()
for i in range (0, 3):
myThr = (i+1)*10
st = 'lodGroup1.threshold[%i]' %(i)
cmds.setAttr(st, myThr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment