PDA

View Full Version : scripting UVW editing....


3rd Dimentia
07-23-2008, 04:49 AM
Can anyone shed some light on how to modify UVW's with maxscript?

I've tried using polyop.setMapVert to assign a new value to the UVW position of the vert and when that didn't work, I added a UVWunwrap and tried Unwrap_UVW.setVertexPosition2 to try to do the same thing.

But I'm not getting the results I was looking for...I'm trying to modify UV vert positions based on modified values of other UV vert positions.

It seems that SOME verts are moving to thr right spots, but it appears that they are the wrong verts. So the vert positions that it's generating are mostly correct, but the verts in those positions are the wrong ones. I've tripple checked that I'm using the correct relative vert numbers to get the vert position values from.

I know when I've scripted the recreation of UV channels from one object to another, that I've used polyop.setmapface but not sure if I need to be looking into that as it seems that that function is to assign which verts are used with what face. which actually seems like it's the same vert numbers that the faces of the poly are using. So I'm assuming that if it's already setup, I don't need to bother with this.

Anyone?

What am I missing? Besides a clue.


Cg.

Bobo
07-23-2008, 05:02 AM
How do you determine which map vertex to move? (Hint - map vertices correspond to mesh vertices through their respective faces). If you are using mesh vertex indices in any way without going through the map faces, you will get to the wrong map vertices...

3rd Dimentia
07-23-2008, 05:39 AM
Hi Bobo, thanks for replying. Yeah, I was just using poly vertex index. Can you give me a little more of a hint when you say : map vertices correspond to mesh vertices through their respective faces

Cause as I mentioned, I did try looking at the get/setmapface, but the vert numbers just seemed to correspond to the actual verts were in the poly object related to that face... Or am I looking in the wrong direction here?

I did have a look at the vert index in unwrap compared to the vert index on the poly and they seemed to be the same..

I'm more confused than ever now but will try to dig thru any related stuff in the helpfile when I get a chance. Since you gave me that hint.

Cheers,

Cg.

Haamu
07-23-2008, 10:32 AM
Mapvert may have same index as the original, but as soon as you have different amount of mapverts and originals, at least some of the indices will differ.

When you take polyop.getfaceverts and again getmapface of the same face you might get something like
#(2,4,6,8) and #(14,46,43,22), vertex 2 would have corresponding mapvertex 14 and so on. Vertex can of course have as many equivalent mapverts as there are faces sharing the original vert. You can use finditem() to get the array position of the vert and use that position to pick the mapvert index from the other array.

It does get a bit complicated and involved for such a simple task.

CGTalk Moderation
07-23-2008, 10:32 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.