Search ProofOfProgress Blog

Tuesday, March 22, 2011

Get UVW's of Geometry Face in Maxscript

Note to self:
This code currently in:
E:\TECH_ROOT\MaxScript\MyScripts\In_Developement\Image_Tube\Research\Gvert_To_Uvert_Plan.ms



--Code to get UVWvert ID from face.
Xnode = $;
faceIndex = 18;
ithVertex = 1;


--Step1: --Get UVW vertex index from face selection.
$.modifiers[#unwrap_uvw].getVertexIndexFromFace faceIndex ithVertex

--Step2: --Turn the index of the Uvert into a selection.
$.modifiers[#unwrap_uvw].selectVerticesByNode bitarray Xnode

--Step3: --Turn selection into Uvert index ID.
$.modifiers[#unwrap_uvw].getSelectedVerticesByNode Xnode


--How would you get faces from selected Uvert?

--Gvert to Uvert algorithm:

--Step1:
--Take geometry vert. Use geometry vert to get the 4 faces connected to that vert.

--Step2:
----------using getVertexIndexFromFace
----------[$.modifiers[#unwrap_uvw].getVertexIndexFromFace faceIndex ithVertex]
----------Collect all of the Uverts associated with each face.

--Step3:
--Return the Uverts that the all the faces have in common.
--Will be 1 to N number of u-verts.


--Simpler Way:
--1: setSelectedGeomVertsByNode #{Gvert_Index} Xnode
--2: getSelectedVerticesByNode Xnode

No comments:

Post a Comment