i want to create check list that detect which face is not correct direction
so i want to try to use another version from i code because it too slow when it check every face on polygon
def checkFaceFlip(face_list):
'''
return : flipface name and mesh name
'''
for face in face_list:
uvs = []
vtxFaces = cmds.ls(cmds.polyListComponentConversion(face, toVertexFace=True), flatten=True)
for vtxFace in vtxFaces:
uv = cmds.polyListComponentConversion(vtxFace, fromVertexFace=True, toUV=True)
uvs.append( uv[0] )
#get edge vectors and cross them to get the uv face normal
uvAPos = cmds.polyEditUV(uvs[0], q=True)
uvBPos = cmds.polyEditUV(uvs[1], q=True)
uvCPos = cmds.polyEditUV(uvs[2], q=True)
uvAB = dt.Vector([uvBPos[0] - uvAPos[0], uvBPos[1] - uvAPos[1]])
uvBC = dt.Vector([uvCPos[0] - uvBPos[0], uvCPos[1] - uvBPos[1]])
# if face is wrong direction
if not uvAB.cross(uvBC) * dt.Vector([0, 0, 1]) >= 0:
print face # show first face which broken
mesh = face.split('.')[0]
return mesh