本文整理汇总了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)