PDA

View Full Version : How to set skinweight value according uv coordinates


sambalbij
10-19-2009, 02:31 PM
Hi,

Having a bit of a problem over here. Don't know too much about MEL, and I wan't to make something.

I have a cube with some subdivisions skinned to two bones and i want the v-position of a uv to determine the influence of a vertex to one of those bones.

What i figured out so far from maya help:

// To query the u and v values of selected uvs:
polyEditUV -query ;


// Assign weights to a large number of vertices, several at a time to
// reduce the number of calls to the skinPercent command.
//
for ( $i = 0; $i <= 675; $i +=10 ) {
skinPercent -transformValue joint1 0.5
-transformValue joint2 0.5 skinCluster1 pPlane1.vtx[$i] pPlane1.vtx[$i+1] pPlane1.vtx[$i+2]
pPlane1.vtx[$i+3] pPlane1.vtx[$i+4] pPlane1.vtx[$i+5]
pPlane1.vtx[$i+6] pPlane1.vtx[$i+7] pPlane1.vtx[$i+8]
pPlane1.vtx[$i+9];
}

And at that time i also figured out i didn't know enough about MEL to make it work. :banghead:

So if anyone has a few suggestions, they would make me a happy man. :buttrock:

Cheers

Robert Bateman
10-20-2009, 04:47 PM
This:
`getAttr ("pPlane1.vtx["+$i+8 +"]")`

not this!
pPlane1.vtx[$i+8]

The latter is for *good* OOP languages, and mel is most certainly not one of those! You must construct a text string of the attribute to query that value via getAttr....

CGTalk Moderation
10-20-2009, 04:47 PM
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.