def randRemovePercent(keepNum, *args):
"""gives each object the percentage chance to be removed. So will remove a variable number of objs"""
sel = cmds.ls(sl=True, fl=True)
remNum = (100.0 - keepNum)/100.00
#print remNum, "remove percent"
count = 0
ch = []
if sel:
for obj in sel:
x = random.uniform(0,1)
if x < (remNum):
# print x, "--->", remNum
ch.append(obj)
count = count + 1
newSel = [g for g in sel if g not in ch]
cmds.select(newSel, r=True)
print count, "objects removed"
#print len(sel), "objects remaining"
评论列表
文章目录