PDA

View Full Version : Copying weights from 1 vertex to another (maya)?


rebo
06-14-2003, 07:00 PM
Well its my first time i gone thru painting weights on an entire mesh and im down to the stage of using the component editor to manually tweak out bits and its going really slow.

I wonder if teres a way to copy weights off of 1 vertex and paste them to another it would save me alot of time. right now im putting them in the component editor manually :(.


Ive tried selecting the cells in component editor and Ctrl-c then Ctrl-v as you would in a spread sheet, but that didnt work .

Im working on maya 4.0 btw, thanks again.

SheepFactory
06-14-2003, 07:15 PM
thats what the mirror skin weights is for. , take a look at it in your docs.

rebo
06-14-2003, 07:22 PM
Hmm Im probably being really dumb here but I dont want to mirror accross the entire mesh. Im working on some details in the mesh and need a fast way to transfer weights vertex to vertex.

Aken009
06-14-2003, 07:29 PM
hey man...I just went thru the same thing this morning actually...I"m working on my models for the animation challenge...and it's been too long since I've rigged a character...

here is what I did:

I wanted to copy the weights from one half of my character to the other half...and it's a single mesh model (poly's)
so I selected the mesh...and went into component mode...and selected the FACES of the half that i already weighted...and then I >shift-selected the other half of my model, and then I went to
Skin>Edit Smooth Skin> Mirror Skin Weights and I opened the option box and used the options that I needed...


I hope this helps...it took me a little bit to figure that out...if you are confused...just email me... aken009@hotmail.com

Aken009
06-14-2003, 07:38 PM
hmmm...sorry we must of just posted at the same time...to copy all you do is select vertice A and then vertice B, and go Copy weights found in Skin>Edit Smooth Skin>

and done...but I agree with Sheep Factory, when in doubt...check the documents quickly, sometimes it's a lot faster to read those than to post and wait for someone to explain it...

g'luck

rebo
06-14-2003, 07:40 PM
Argh thanks for the help guys, but that isnt what i want to do. Ill try to explain better.


I have pretty much finished the skin wieghting, however there are a few groups of verts or isolated verts whose weights are incorrect. I.e. when I scrub the time slider of my temp animation they deform badly, this is due probably due to skillless painting, but hey I have a slow computer:D.

So i want to tweak out these freak weights on the vertexes that deform badly, I cant just use smooth in the painting mode as this will destroy some of the fine details I have. So all I want to do is select one good vertex near the group that deforms badly, 'copy' the weights on that vertex, then 'paste' then to the group that deforms badly. This way the integrety of my details are kept and they deform nicely.

edit::

Thanks again, but ive tried that, when doing edit smooth skin > copy smooth weights > i get


select -r polySurface1CPSproxy1.vtx[1242] ;
select -tgl polySurface1CPSproxy1.vtx[1269] ;
doCopySkinWeightsArgList 1 { "" };
// Error: Must select a source and a destination skin. //




and done...but I agree with Sheep Factory, when in doubt...check the documents quickly, sometimes it's a lot faster to read those than to post and wait for someone to explain it...


I have checked the documentation, pls dont think I havent :( . As the docs say ..



Copying smooth skin weights
You can copy smooth skin weights from one smooth skin object to another, or from one group of smooth skin objects to another.


I dont think you can do it vert to vert.. Im probaly wrong tho

Aken009
06-14-2003, 08:02 PM
hey dude...as far as copy weights go...I think it's for separate geo, sorry 'bout that.

I tried the Ctrl+C Ctrl+V within the component editor, and it worked...but I could only copy one value at a time...but I can paste it to multiple places....(hope that made sense)

I was just wondering if you have "pruned" your weights before you started weighting...

I was also wondering if you could post a screenshot of your problem...cuz i"m not sure exactly what part of your model you are having issues with...this could help us understand your problems...
(an influence object could help out odd deformations as well)

rebo
06-14-2003, 08:14 PM
Here is a rather extrme example. Here is the undeformed bind pose control mesh, its an area under the arm where some detail is present due to the characters costume.

http://www.apat67.dsl.pipex.com/prob1.jpg


Now here is the situation deformed, as we can see we have 2 vertices that have incorrect weighting (for whatever reason, probably bad painting). A quick and easy way to solve this would be somehow copy the weights of the verts next to the freak ones and paste em over. However i dont know how to do this.

http://www.apat67.dsl.pipex.com/prob2.jpg

The only other way at present (and how im working now) is to use the component editor to enter the weights joint by joint. However when you have 30 + freak vertices or groups of vertices it gets a tad tedious.

Aken009
06-14-2003, 08:39 PM
well man...my only advice to this problem is, to continue doing this in the component editor, but only do half the body, then mirror the weights...I don't think there is any real fast way to do this...other than patience and persistence...

it's annoying I know, cuz I'm doing the same thing at the moment...

the only thing I can really suggest to help speed things up is...
to check off the "Show All Columns" option in the component editor this will only show vertices with values...the ones with the Value of Zero will no be loaded...
http://jakmreed.tripod.com/james/animchallenge/com_editor.jpg







then if you all your vertices selected that you want modified...you can click drag thru the cells you want and enter your values...like in the second image I'm I've posted...



http://jakmreed.tripod.com/james/animchallenge/com_editor02.jpg


g'luck...I"m out of suggestions...:surprised

SheepFactory
06-14-2003, 08:45 PM
it doesnt have to be seperate geometry for the mirror weights to work , just fix one side , select those vertex's , shift select the destination vertex's and mirror. thats pretty much it.

rebo
06-14-2003, 08:51 PM
Yea, its ok Sheep factory, we were refering to the Copy Weights command which does have to be seperate geometry. Also if you read above you will see that I didnt need mirror weights. Thanks for the advice anyway, it is appreciated.

rebo
06-14-2003, 10:10 PM
I got pissed at this and did a mel.. :D hope it helps others who have a similar problem :p

Save and source the script, then select the vert you want to copy weights from, and use the command rCopyWeights, then select the verts you want to copy the weights to and use rPasteWeights. Its probably helpful to have a hotkey or shelf button to these commands.




// rWeights.mel

global proc rCopyWeights(string $skincl)
{

// This script _heavily_ rips off saveWeights.mel by Big Idea Productions
// rebo, me, extracted useful parts so he could copy weights from one vertex to others
//
// useage, save this script then source it, use commands rCopyWeights and rPaste Weights
// to copy and paste as required


float $weights[];
string $cmd;
string $vsel;
string $joints[];

string $sel[0] = `ls -sl`; // gets the selected object components
// 28 means CV's and 31 means poly vertices..this expands it into
// 46 means lattice points a nice list 36 means SubD Points
string $expandedSel[0] = `filterExpand -ex 1 -sm 28 -sm 31 -sm 46 -sm 36 $sel`;

int $nVerts = `size $expandedSel`;

/*
* At this point the string array expandedSel[] has stuff like
* nurbsSphere1.cv[4][5] for NURBS
* pSphere1.vtx[361] for polys
* ffd1Lattice.pt[1][2][3] for lattices
* in it, so we can just use each of those for the stuff below!
*/

$cmd = "skinPercent -q -v "+$skincl+" "+$expandedSel[0];
// print($cmd);
// $cmd = "skinPercent -q -v "+$expandedSel[0];
$weights = eval($cmd);



$cmd = "skinPercent -q -t "+$skincl+" "+$expandedSel[0];
$joints = eval($cmd);

global string $output="";
for ($n=0; $n < size($joints); ++$n) {

$output = $output + ("-tv "+$joints[$n]+" "+$weights[$n]+" ");

}



}

global proc rPasteWeights(string $skincl){
string $vsel;
string $sel[0] = `ls -sl`;
global string $output;
string $expandedSel[0] = `filterExpand -ex 1 -sm 28 -sm 31 -sm 46 -sm 36 $sel`;

for ($vsel in $expandedSel) {


string $cmd = ("skinPercent "+$output+" "+$skincl+" "+$vsel);
eval ($cmd);

}
}

rebo
06-14-2003, 10:22 PM
Careful there is a small bug in it, it doesnt copy over zero values.

edit :: Ok fixed

MDuffy
06-16-2003, 06:20 PM
Whenever I'm weighting, I just use the component editor to do this. Select the vertex with the good weighting. Not its vertex number in the component editor so you can find its values again. Be sure that List->Show All Columns is unchecked. Now select all the verts you want to copy this weight to. Go to the first joint/influence column and select every entry except the one for the original vertex. Set the value to "1" so that it clears out all other values on those vertices. Since whatever value you type is set for all selected entries, you set values for multiple vertices at once. Now go to the next column and select all but the original vertex (now it is easier because you just select all the values that are 0. Type in the value for the original vertex and hit enter. All the other verts will get that weight and subtract it from the first column (which started at 1.0). If you have two bones, you are done. If you have multiple bones, turn on Hold for the second column and then set the values for the third column. The second column's weights won't change, and the third columns weights will be pulled from the first. If you have a fourth column, turn on Hold for the third column and set the fourth column's weights. etc, etc. Don't forget to turn off all the holds when you are done. It should be rare that you have more than 4 or 5 weights for a vertex, so this method works out pretty well.

If you have small weights across a ton of bones, you can use the Prune Weights command to get rid of the small weights. Anything that has less than 5% influence probably isn't significant enough to worry about.

I don't weight anything by painting weights. I work entirely in the component editor. But the geometry we work with here at work is kept fairly low poly to keep the geometry manageable. We skin the low res version, and apply smoothing on top of the animated object.


Hope this helps,
Michael Duffy
mduffy@ionet.net

CGTalk Moderation
01-15-2006, 11:00 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.