PDA

View Full Version : boneTool for Maya


WesHowe
08-03-2010, 08:51 PM
I finally followed through on my threats and wrote the tool I have been wanting for skinning. I named it after a plug-in I had written long ago for another package. It is a simple tool, done in MEL-script, that you use by selecting some vertices and running the tool (I have mine attached to a shelf button).
The influences can be viewed for each vertex, and can be changed either singly or set the whole selection to the same (six entries are all that is supported). I use this because it suits my work methods... I like to set assignments to each row of vertices along a joint chain, and tweak individual vertices after I start my test animations.
The tool is just for tweaking weights, like using the component editor, only more visually and with lots of menu shortcuts. You first need to use the smooth skinning tools to create a skinCluster before it will be of any use. The download page (from my personal website) is linked to the image below.

http://www.weshowe.com/dlds/boneTool.png (http://www.weshowe.com/dlds/boneTool.html)

frilansspion
08-04-2010, 01:17 AM
Im doing a bit of weight-painting right now so Ill give this a go! Ill let you know if it helped me laters. it looks good but I havent tried this type of tool before.

frilansspion
08-04-2010, 01:37 AM
Im getting these errors?


// Error: Cannot find procedure "floatEq". //
bt_setTotals();
// Error: Cannot find procedure "floatEq". //
bt_setTotals();
// Error: Cannot find procedure "floatEq". //
bt_setAll();
// Error: Invalid flag: -zri //

was there other script files i needed? I just copied the one.

and also the layout doesnt look a good as in your screenshots. I wonder why...made on another platform? Im on win7 with maya 2009. biggest problem is that when the influence name is too long it extends over the input field.

another thing is when I click a field the value isnt selected - so you cant just click and enter a new value. I havent found a way to do this in maya UI but have a little idea for a workaround (but havent tried it yet, wont have time until later). if you put an update script on the receive focus command and in that store the value in a variable and then clear the field (and if nothing is entered it restores the value), you could input directly. what do you think? could work or is just confusing for user? (maybe if you also have an extra label per field that says what the value was before changing?)
or maybe I should mind my own business =D

cheers

WesHowe
08-04-2010, 02:04 AM
It does not look good on Maya 2009 here.. I only wrote and tested it on 2011 (I use Win7 x64 here). Apparently some of the layout commands do not work the same on 2011 as they did on 2009.

floatEq() is a MEL script that is part of MEL, according to the documentation, and should be available on 2009 (again according to the docs). I'll replace that with something else. I used it instead of a plain equals because it allows some 'slop'... it returns equal if two floats are within 0.001 or something.

-zri is a flag on the skinPercent() command, which is supposed to zero the remaining influences. It is not listed in the 2009 docs, so I will look at doing it a different way, I want the tool to remove any extraneous weights on joints that are not specified.

Thanks for the feedback. I'll see what I can do for this.

frilansspion
08-04-2010, 02:54 AM
ok so its all to do with maya version.
well, layout is okay, its mostly just the text length thing that was bothersome. the other issues was just look-wise.

weird about floatEq. youre right, its in the docs.

whatIs floatEq;
// Result: Presumed Mel procedure; no definition seen yet. //

havent seen a whatIs result like this before either? usually it just comes up Unknown when things arent there, dont it? well...if it is purely a MEL proc maybe you can copy it from 2011 and have it as a local proc in your file. it cant be illegal if it -should- be there?

thanks and good luck!

Darksuit
08-04-2010, 03:24 PM
the command is also in maya 2008 but also returns the procedure not found. Which looks like Autodesk may have just not implemented it or thought that it was but it slipped through the cracks for a couple of releases, since 2008 and 2009 releases were fairly close together that doesn't surprise me too much. If you wanted to support versions prior to 2011 I would suggest just writing a simple procedure/function to do the comparision. =)

WesHowe
08-04-2010, 06:00 PM
The workaround for floatEq will be easy, since it was a static comparison with 1.0, I can replace it with (<0.999)||(>1.001) and get the same result.

I was playing with the field and row layouts this morning in 2009, it looks like a lot of changes happened during the switch to qt. Some parameters that did nothing in 2011 work fine in 2009. Aside from purely syntactical issues, my biggest problem writing this in the first place has been doing the UI. Buttons and widgets have been a hateful issue to me since Windows 3.1.

I am more concerned about the version differences and the -zri flag for skinPercent(). I don't want two script versions, and I do want the unspecified influences to be set to zero, as it would be problematic to change a vertex from joints 'A' and 'B' to joints 'B' and 'C' and end up with some weighting on all three. As it stands now, the command does not execute on older versions because of the error, making the script harmless but completely useless.

frilansspion
08-05-2010, 12:46 AM
I cant find the -zri flag is the 2011 command reference...so Im not sure exactly what it does. it makes sure that zero weighted influences are kept at zero when you change something? I dont really get it. isnt that the default behavior? pardon my ignorance.
but whatever it does cant you just turn off the normalization and do it all manually?

about the UI you can getApplicationVersionAsFloat() and have two versions of the UI in the same script? pre-qt and post. it doesnt sound like theres a universal way of doing it if theres been so many changes with qt. I dont know anything about it (have 2011 installed but arent allowed to use it for current project so havent looked at it much) but just from what youre saying.

WesHowe
08-05-2010, 01:50 AM
-zri is a flag on the skinPercent() MEL command (zero remaining influences). I have done some research here, and 2009 will zero all the other weights if what you are adding totals 1.0. So it's not so much of an issue, as -zri really just forces zeroes.

I have done much of what you suggested, in my own way, of course, the command `about -api` returns the version and revision in a string, like 200900 for the initial 2009 release, or 201103 for 2011 Hotfix 3. So I used that and strcmp() to flag pre-2011 versions. Only the background colors defaulting and the -zri flag are conditional on the version now, the rest of the changes apply to both, and involved some column width and alignment changes.

I just finished updating my website with the new package (and screenshot). It is at the same url, which is linked here (http://www.weshowe.com/dlds/boneTool.html).

Thanks for the feedback and testing.

frilansspion
08-05-2010, 02:46 AM
wow you move fast!
now everything seems to work. nice! it already is nice that you can set everything exactly over an edge loop easily for instance, but Ill use it more and see how it works out.

a tiny tiny thing I noticed is that it doesnt update the number of influences when you set one of them to zero?, you have to reselect to see the update. doesnt really matter in practice but is this how you intended it or is it supposed to update along with the total weight? otherwise the total influences and original is the same number always?

ah sorry, I didnt read properly and was looking under skinCluster for the flag. okay!

WesHowe
08-05-2010, 03:15 AM
I don't think I coded that (weight set to zero). I think it updates the total only when you set the influence name to "empty". I will think about that, because it does look at both entries when you click on one of the action buttons.

I already spent more time on it than I had planned... there are many ways to "skin a cat" in Maya, but I like my own way best, but didn't have the tool. You can do all this and more with the component editor anyway, but not as rapidly and with as few keystrokes. I like having the popup menus, so I don't have to type much.

I hope it works well for you on your projects.

<* Wes *>

frilansspion
08-05-2010, 03:37 AM
ok, no I was just wondering what the intent was. removing an influence is obviously faster and the same thing. gotcha! thanks!

frilansspion
08-05-2010, 07:17 AM
by the way, for me selecting "empty" in the popup doesnt remove the influence, it sets it to one of the other influences. in fact if you select "empty" over an already empty slot it also adds another copy of that same influence. ???

WesHowe
08-05-2010, 04:07 PM
I found that problem last night, but from a different symptom. The issue is that on the first invocation, the joint list was not being retrieved until after the menu was built, which made it all wrong until after you have made another selection.

I updated the plug-in to fix that, as well as having it not total the number of influences or total weight if the joint name is empty or if the weight is zero (your suggestion). Setting the joint name to empty will not clear the weight value, but that value is not included in the total shown (unless you then change the joint name back to something else).

When you click on an action button, only the influences that have a non-zero weight AND a name other than empty are actually passed back to Maya; this is unchanged since the first release. The download page is the same: http://www.weshowe.com/dlds/boneTool.html.

<* Wes *>

CSherwin
08-05-2010, 05:32 PM
I just tried this tool. Highly useful. It's nice even just for quick fix for a particular vertex is misbehaving in a deform.

I would suggest an addition, though, if you don't mind. A button to unlock/lock the weights for the vertices. It would make it easier than going into the paint weights tool to unlock/lock them. Also, it would be nice to have an indicator it the weights are locked.

With or without, I'm still going to use it. It's a handy tool to have around and much faster and cleaner than the component editor. Nice work.

WesHowe
08-05-2010, 06:04 PM
I could do that, but...

What you are asking for is available in the Comet plugins (specifically the Comet Skin Weight tool), Michael Comet's stuff at his site: http://www.comet-cartoons.com/. Besides all of the free plug-ins there (which I use a lot), Michael wrote the original version of Maya Muscle (now part of Maya). Pretty amazing story.

Anyway, his Skin Weight tool plug-in allows you to do the lock/unlock, and view the state, for each joint. I don't want to discount your suggestion, and I appreciate the feedback, but I want to avoid making a Swiss-army knife of this. I aimed to make exactly what you noted, a quick, easy tool to do a vertex weight tweak (also a block of vertices).

Again, thanks for the encouraging response.

<* Wes *>

CGTalk Moderation
08-05-2010, 06:04 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.