Home Technical Talk

Map Vertex IDs

Hey,
friend of mine has got a problem with a 3dsmax tool he's attempting to create.
The tool is basically supposed to flatten a 3D Mesh into its seperate UV chunks, similar to the "Morph UVs"- function in ZBrush.

The problem occuring is that the mesh vertex IDs don't match the vertex IDs of the UV chunks, which forms the problem. His fix in theory would be renumbering the map vertex IDs to fit.


MyOeQ0P.png
base_obj = $

subobjectLevel = 1
actionMan.executeAction 0 "40021" --select all
AllVerticesBit = polyop.getVertSelection base_obj 
AllVerticesArray = AllVerticesBit as array;

subobjectLevel = 4
actionMan.executeAction 0 "40021" --select all
AllFacesBit = polyop.getFaceSelection base_obj 
AllFacesArray = AllFacesBit as array;

print AllFacesArray.count

ep = editable_mesh name:(uniquename"EPoly") --create an empty EMesh
convertTo ep Editable_Poly --convert to Editable_Poly 

-- Create Vertex
--*************************************************************************************************
for  i = 1 to AllVerticesArray.count do
(
 Z = 100
 Vertexpos = polyop.getVert base_obj AllVerticesArray[i]
 UVcoorSource = polyop.getMapVert base_obj 1 AllVerticesArray[i]
 UVcoorSource_coor = [UVcoorSource.x * Z, UVcoorSource.y * Z , UVcoorSource.z * Z ]
 polyop.createVert ep UVcoorSource_coor 
)

-- Create Faces
--*************************************************************************************************
for  i = 1 to AllFacesArray.count do
(
 FaceVertice = polyop.getFaceVerts base_obj AllFacesArray[i]
 FaceVertice_coor = polyop.getMapFace base_obj 1 i
 polyop.createPolygon ep FaceVertice
)

Thanks in advance.
Sign In or Register to comment.