def preciseRemovePercent(keepNum, *args):
"""selects the exact amount of things to remove and randomly selects which from the selection list"""
sel = cmds.ls(sl=True, fl=True)
remNum = (100.0-keepNum)/100.0
remCount = int(remNum*len(sel))
count = 0
ch = []
if sel:
while len(ch)<remCount:
x = random.choice(sel)
if x not in ch:
ch.append(x)
newSel = [g for g in sel if g not in ch]
cmds.select(newSel, r=True)
print len(newSel), "objects remaining"
评论列表
文章目录