本文整理匯總了Python中BPyMesh.getFaceLoopEdges方法的典型用法代碼示例。如果您正苦於以下問題:Python BPyMesh.getFaceLoopEdges方法的具體用法?Python BPyMesh.getFaceLoopEdges怎麽用?Python BPyMesh.getFaceLoopEdges使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BPyMesh
的用法示例。
在下文中一共展示了BPyMesh.getFaceLoopEdges方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: extend
# 需要導入模塊: import BPyMesh [as 別名]
# 或者: from BPyMesh import getFaceLoopEdges [as 別名]
#.........這裏部分代碼省略.........
uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] +factor * (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
else:
# same as above but with no factor
uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]])
uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
if not me.faceUV:
me.faceUV= True
face_act = me.activeFace
if face_act == -1:
Draw.PupMenu('ERROR: No active face')
return
face_sel= [f for f in me.faces if len(f) == 4 and f.sel]
face_act_local_index = -1
for i, f in enumerate(face_sel):
if f.index == face_act:
face_act_local_index = i
break
if face_act_local_index == -1:
Draw.PupMenu('ERROR: Active face not selected')
return
# Modes
# 0 unsearched
# 1:mapped, use search from this face. - removed!!
# 2:all siblings have been searched. dont search again.
face_modes = [0] * len(face_sel)
face_modes[face_act_local_index] = 1 # extend UV's from this face.
# Edge connectivty
edge_faces = {}
for i, f in enumerate(face_sel):
for edkey in f.edge_keys:
try: edge_faces[edkey].append(i)
except: edge_faces[edkey] = [i]
SEAM = Mesh.EdgeFlags.SEAM
if EXTEND_MODE == 2:
edge_loops = BPyMesh.getFaceLoopEdges(face_sel, [ed.key for ed in me.edges if ed.flag & SEAM] )
me_verts = me.verts
for loop in edge_loops:
looplen = [0.0]
for ed in loop:
edge_average_lengths[ed] = looplen
looplen[0] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length
looplen[0] = looplen[0] / len(loop)
# remove seams, so we dont map accross seams.
for ed in me.edges:
if ed.flag & SEAM:
# remove the edge pair if we can
try: del edge_faces[ed.key]
except: pass
# Done finding seams
# face connectivity - faces around each face
# only store a list of indicies for each face.
face_faces = [[] for i in xrange(len(face_sel))]
for edge_key, faces in edge_faces.iteritems():
if len(faces) == 2: # Only do edges with 2 face users for now
face_faces[faces[0]].append((faces[1], edge_key))
face_faces[faces[1]].append((faces[0], edge_key))
# Now we know what face is connected to what other face, map them by connectivity
ok = True
while ok:
ok = False
for i in xrange(len(face_sel)):
if face_modes[i] == 1: # searchable
for f_sibling, edge_key in face_faces[i]:
if face_modes[f_sibling] == 0:
face_modes[f_sibling] = 1 # mapped and search from.
extend_uvs(face_sel[i], face_sel[f_sibling], edge_key)
face_modes[i] = 1 # we can map from this one now.
ok= True # keep searching
face_modes[i] = 2 # dont search again
print sys.time() - t
if is_editmode:
Window.EditMode(1)
else:
me.update()
Window.RedrawAll()
Window.WaitCursor(0)