Notifications
Clear all

[Closed] polyop.SetMapVert not working?

Right now I’m working on a simple test script to shift the UVWs of an object over by a scalar value, just to get myself familiar with UVW coordinates from the perspective of maxscript. The script has been functioning fine up until the point of actually setting the vert values, at which point it simply seems to do nothing. Here’s the code:


 
 -- Get the object
 p = getNodeByName "Box02"
 
 -- Use map channel 1
 c = 1
 
 -- Get the number of UVW verts
 vert_count = polyop.getNumMapVerts p c
 
 -- Loop through each vert in the object
 for v = 1 to vert_count do
 (
 	-- Get the next vert and print it out
 	vert = polyop.getMapVert p c v
 	print vert to:gd
 
 	-- Shift the vert by a scalar value in the X axis
 	vert.x += 10
 
 	-- Update the vert in the object
 	polyop.setMapVert p c v vert
 ) -- End for
 

The map vertices all print out fine, so I know everything is working up until that point. The only thing that’s not working is the call to setMapVert (). There’s no error message in the listener, no exception, nothing. The verts simply don’t change. I don’t see a visual change in the UVW editor, not do I see a numeric change if I run the script again to print the values a second time.

Is there something I’m missing here? Is it necessary to call some kind of an update function or something?

Thanks!

1 Reply

the problem is the UVW_Unwrap modifier you’ve got on top. the basic code you have works just fine, but the UVW_Unwrap is going to override it.

If there’s a UVW_Unwrap modifier at play, you would have to set the UV vertex positions through that modifier, a la:

<void><Unwrap_UVW>.[b][b]SetVertexPosition[/b][/b] <time>time  <integer>index <point3>pos