zbw_randomSelection.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:zTools 作者: zethwillie 项目源码 文件源码
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"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号