Search code examples
maxscript

Map face and face relationship in MaxScript


I know that single vertex can be assigned to several map verticles and vice versa.

But, does the faces and map faces has 1:1 relationship?

I mean, assuming that mesh uses only map channel 1:

local facesCount = polyOp.getNumFaces ePoly
for f = 1 to facesCount do ( 
    ...
)

local mapFacesCount = (polyop.getNumMapFaces ePoly 1)
for u = 1 to mapFacesCount do (
    ...
)

Will f and u iterate over same range? I've tested it and it mapFacesCount was always equal facesCount, but I am not sure if it's true.

Also, do faces indices and map faces indices correspond with each other?

I mean, will (polyOp.getFaceVerts ePoly 10) return the vertices of face #10 and (polyOp.getMapFace ePoly 1 10) will give me map vertices for the same face #10?

Or I cannot say it's still face #10? If so, how to "connect" this data? I want to get vertices' positions and vertices' map coordinates for given face.


Solution

  • Yes and yes, the number and indices of faces stay the same. Although you can have invisible edges define map seams when using editable mesh, it's a different case with editable poly which is not defined by triangle faces and instead has polygons of arbitrary degree. Because you cannot split a polygon like this, the polygon count and the order do not change.

    It's vertices that basically define the map seams and layout and there can be up to sum(face1VertCount..faceNVertCount) vertices – and there can also be just one vertex for all the faces.