UVShape.py 文件源码

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

项目:Modeling-Cloth 作者: the3dadvantage 项目源码 文件源码
def divide_garment(ob, dict):
    '''Creates a set of bool arrays and a set of number arrays
    for indexing a sub set of the uv coords. The nuber arrays can
    be used to look up wich bool array to use based on a vertex number'''
    if ob == 'empty':
        ob = bpy.context.object    
    #-----------------------------------    
    v_count = len(ob.data.vertices)
    idx = np.arange(v_count)
    full_set = np.array([])
    dict['islands'] = []
    v_list = [[i for i in poly.vertices] for poly in ob.data.polygons]
    v_in_faces = np.hstack(v_list)
    dict['v_in_faces'] = v_in_faces
    remaining = [1]
    vert = 0
    while len(remaining) > 0:
        linked = find_linked(ob, vert, v_list)
        selected = np.unique(np.hstack(np.array(v_list)[linked]).ravel())
        dict['islands'].append(selected)
        full_set = np.append(full_set, selected)
        remain_bool = np.in1d(idx, full_set, invert=True)
        remaining = idx[remain_bool] 
        if len(remaining) == 0:
            break
        vert = remaining[0]
#################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号