zbw_randomSelection.py 文件源码

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

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


问题


面经


文章

微信
公众号

扫码关注公众号