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]
#################################
评论列表
文章目录