Hello! I am playing around with writing a script to edit UVs, and am not having any luck getting meshop.setMapVert to result in any change to UVs.
Is there some sort of update function that needs to get called after setting a coordinate? Because setting a new coordinate appears to have no effect.
Take this example script. For each map UV vert in the selected mesh, I should be setting a totally random UV coordinate.
numverts = meshop.getNumMapVerts $.mesh 1
for i in 1 to numverts do
(
RandomCoord = [random 0.0 1.0, random 0.0 1.0, 0.0]
meshop.setMapVert $.mesh 1 i RandomCoord
)
But running this has no visible affect on the selected mesh's UV coords.
Here's a version that shows that the meshop.getMapVert function returns the same original coordinate, both before and after being set.
msg = "";
numverts = meshop.getNumMapVerts $.mesh 1
for i in 1 to numverts do
(
CoordPre = meshop.getMapVert $.mesh 1 i
RandomCoord = [random 0.0 1.0, random 0.0 1.0, 0.0];
meshop.setMapVert $.mesh 1 i RandomCoord
CoordPost = meshop.getMapVert $.mesh 1 i
msg += (i as string) + " | same: " +((CoordPre == CoordPost) as string)+" | Pre: " + (CoordPre as string) + " | Post: " + (CoordPost as string)+ " | RadomCoord: "+(RandomCoord as string)+"\n";
)
msg
Any idea what I'm missing here? Thanks!
By J450N · 2017-07-19
Swordslayer · 2017-08-01