Hi,
I've been trying to copy the alpha value of a selected vert in 3dsmax (via a tool UI) and I'm almost there but something isn't working how I expected. It seems that I need to get the index of that vert in its array and not its ID# ?
Here is the code that I have so far for the "Copy Alpha" button; the variable
"sV" is the ID of the selected vert but I think I need its
index position in the array and not its ID...but I don't know how to do get it.
I did a test to get all the alpha values of the selected mesh (with 1 selected vertex that I manually set with a different value (88.0) while the rest are at 0.0). The selected vert ID is
#3, but it shows up at index 15 in that array (so manually setting
sV to "15" returns the proper alpha value of 88.0).
However, If I leave
sV as-is (so in this case its value will be its ID #3), it will return the wrong alpha value
sCopiedVal of 0.0...(I guess it selects another vert).
What am I doing wrong, how can I fix this?
--------------------------------------
sCopiedVal = #()
selVert = #{}
selVert = polyop.getVertSelection $ as array
if selVert.count != 1 then messageBox "Select just one vertex to copy alpha values"
else
(
sV = selVert[1]
obj = selection[1]
polyOp.setMapSupport obj -2 true
sCopiedVal = (polyOp.getMapVert obj -2 sV)[1] * 100.0
rlSetVertexAlpha.sldVA.value = sCopiedVal
rlSetVertexAlpha.spVA.value = sCopiedVal
)
Replies
to get the correct vert and it's associated mapping vert you go by face and corner
so in psuedo code...
geo_face[1].vert[2] <=> map_face[1].vert[2]
and in mxs