View Full Version : saveWeights... simple question
bucktooth 01-26-2007, 05:21 PM Hi,
I am learning how to rig and found the useful mel script that everyone is talking about called "saveWights." I have not used mel scripts before and would like some how-to advice on how to use this script.
I have read as many of forum threads that I could about this script but not a single one explains what commands need to be typed to use its functions. Could someone kindly clue me in?
What I tried to do:
- I have two .mb files with exactly the same geo & bones, [A] has the geo & bones & weights, [B] has only geo & bones. I want to apply the weights of [A] to (B], so....
- I open [A] and in the command line I type:
"source "saveWeights.mel"; saveWeights();"
- That's when I get the following error message :
"Error: Cannot find file "saveWeights.mel" for source statement."
- This message tells me that the script has not been properly installed. I want to install it properly, please help. Since I am on a mac where should this script be placed so that maya can find it?
yours truely,
b.t.
|
|
tbaypaul
01-27-2007, 12:26 AM
the script has to go in your maya user directory scripts folder....not sure where on mac...but I am sure you have something similar (windows probably copied that concept too ) then restart maya so it can read it. then execute the save weights command.....you should make sure you understand what the script does first...usually the readme.txt or the top of the script will comment on usage and function....or at least it should...
whatever you do......do not open/save the script in a word processor that adds formatting code...open it in the lowest stupidest text pad thing you have....mel can't handle carriage returns and other formatting stuff that might get saved into it.....
bucktooth
01-29-2007, 02:20 PM
thanks, I got in the right dir. I got the gui dialog popping up and I
m just trying to figure out how to "save" from one and "load" to another. I don't see anything in the gui pulldowns about either of those functions so I'm just trying some different variations of syntax at the command line... lilke
source saveWeights.MEL; saveWeights();
... and...
source saveWeights.MEL; loadWeights();
I don't see any documentation at highend3d so if I firgure out the right syntax I'll post it up.
yours truely,
b.t
PS. I'll check out the script comments like you suggested for the right syntax and command strings, thx.
bucktooth
01-29-2007, 06:01 PM
Hi,
so looking at the script in a text editor was a fantastic suggestion. That's where I found the two commands that I need (i think so anyway):
dosaveWeights;
doloadWeights;
to use these commands I need to open the guibox and fill in the appropriate names in the skinCluster field. The default "skinCluster1" is not making it work so I am stuck looking around my outliner and hypergraphy for my skinCluster node so I can make a note of its name. I am sooo close to making this work. Can anybody give me a tip on how to locate my skinCluster names?
yours,
b.t.
bucktooth
01-30-2007, 04:42 PM
Hi,
I am happy to report that I got the script working! Here's what I did.
1) I put the script saveWeights.mel into the correct folder so maya can access it. This folder is the same folder thats used for placing scripts that are opened automatically at application launch, so I was able to access the "maya help" menu for .html instructions on finding it. (Note: it doesn't mean it will run the script at launch, but it just uses the same folder and loads it up for use.)
For me, this location is "macintosh HD> Users> admin> Library> Preferences> Alias> maya> 8.0> scripts> saveWeights.mel"
2) Next, I opened my maya file, "geo_A.mb", which has the correct weighing that I wish to transfer onto another file, "geo_B.mb". Then I opened the guibox, that allows access to the saveWeights preferences, by typing this at the command line:
saveWeights;
When the guibox pops up, I noticed that it has several variables. The only one that I needed to work with was the "Skin Cluster Node" field. This field needs to match the naming of the skinCluster which defines the weighing of the geometry for my "geo_A.mb." To get access to this name the geometry must be selected and the channel box must be visible (1st button @ upper right); there I found the skinCluster name and changed it to match the string inside the guibox (either one can be changed so long as they match).
For the "saving" part of this script to work, I needed to select all the vertices on my geometry. I did the following routine from the main perspective window: set the Show menu to "None", then selected to show only "Polygons", then rt-click-hold on the geo to display Vertices, and finally box-selected all the Vertices. With this accomplished I ran the dosaveWeights function by typing in the command line:
dosaveWeights;
After half a minute I knew I had succeeded in saving my weights to the temp file because the Script Editor returned:
// saveWeights ended successfully. //
At this point I closed "geo_A.mb" (I did "save as" to keep my new skinCluster names) and opened up "geo_B.mb"
3) To get the the saved weights from the temp file and onto the geometry of my "geo_B.mb" requires that a few things are already set up. Most importantly the target geo must already have a skincluser name of its own, meaning it needs to be skinned/weighted. This weighing will be replaced but, from what I understand, the geo doesn't have a skinCluster unless its weighted. If the guibox and the geometry don't have matching skinCluster names the operation won't work. So, I quickly gave my geometry an automatic skinning/weightin (Skin > Bind Skin > Smooth Bind ... ok!) Also, before the temp weight file can be applied, all the Vertices on the geometry must be selected (see above for routine). Now, at the command line I typed:
doloadweights;
I got many "warnings" but I knew it worked because after a minute or two the Script Editor returned:
reloadWeights - Generic, done.
I checked my results by opening the Paint Skin Weights Tool (Skin > Edit Smooth Skin > ).
All of it looks great despite the warnings. Maybe there is another way to use this script that doesn't return so many warnings. The message "Warning: Some weights could not be set to specific value. Weight total would exceed 1.0" makes me think that geo_B.mb doesn't need to be skinned/weighted beforehand, but I don't understand. The other warning that confused me was "Warning: Specific weight could not be set due to locked influence". I think this comes from the fact that my geo_A.mb file contained .fbx motion data that was locked, or maybe its because I have deleted my bindPose in both files. I need to learn more about how to use a bindPose. Does anybody have any good references to share?
Thanks again,
b.t.
CGTalk Moderation
01-30-2007, 04:42 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.