abTwoFace

September 23rd, 2004

Useful for breaking a symmetrical blend target into a smoothly blending left/right, up/down (whatever/whatever) pair.

How To Use The Script

The base object will be your character's head (or whatever) in its default expression, and the target object will be a modified duplicate of the same mesh that you want to split into two asymmetrical meshes.  There can only be one set of blend joints per scene, but you can weight multiple Base Objects to them.

Duplicate your (unskinned) base object and then run abTwoFace at the command line.  The taper value determines the width of the transition between the joint weights as a percentage of the width (x dimension) of the base object (or the guide object, if one is selected).  Increase the value to widen (and smooth) the transition between the left and right joint weights.  Leave the "Follow Guide Object" textfield empty for now.

Now, select the duplicated object and click "Create Weighted Base Object".  Once created, you should have two joints, abLeftBlendJNT and abRightBlendJNT, on your newly weighted base object.  If you want to adjust the weight taper on an existing base object, just enter a new value in the field and click the "Taper Weights" button.

The "Follow Guide Object" is useful if you have, say, a separate mouth mesh for which you want to create blends that follow your head mesh.  The weighting will follow that of the Guide Object (assuming the same taper value was used for each mesh).  The result mesh will be placed relative to its Guide result meshes.  Clear this field for default (no guide object) behavior.

Once you're happy with the weighting, select your newly weighted mesh and click "Select Base Object".  Now select your target mesh (the blend target that you want to split into two meshes).  Click "Swap Left/Right Names" if you, like me, have an object facing -z -- it swaps the naming on the result objects.  The left object will now be prefixed with an "rt_" and vice versa.

Now just click "Create Meshes" to create the new objects, and you're off...

note: To change your default naming prefixes, search the script for one of the following two strings:

string $lfDefPrefix = "lf_";
string $rtDefPrefix = "rt_";

and change their values ("lf_" and "rt_") to your desired left and right prefixes.


Updates

Update/Bug Fix
September 20th, 2004 Fixed non origin weighting, and random 6.0 issues, redesigned interface.
Update/Bug Fix
September 23rd, 2004 Much improved performance.
Update/Bug Fix
September 23rd, 2004 Removed three lines of code that cause the occasional unreliable result.
Update/Bug Fix
March 14th, 2004 Added ability to specify left and right naming prefixes; tweaked interface.
Update/Bug Fix
April 1st, 2005 Fixed placement of result meshes.  Existing result meshes are now updated instead of being replaced (so you can now tweak your original symmetrical mesh and the script will modify your blendshape targets).
Update/Bug Fix
June 13th, 2006 Removed an optimization that resulted in incorrect weighting in Maya 7.
Version 1.5
May 26th, 2011 Updated the script to work in 2012.
Version 1.6
October 23rd, 2012 Fixes and tweaks for 2013.

"abTwoFace" was posted on October 1st, 2004 under Mel Scripts.  It was created using Maya.  It is tagged with Rigging.

This entry was last updated on October 23rd, 2012.

Subscribe to the Comments Feed or Updates Feed for this entry.

Share |

comments

Dan
September 15th, 2008 said:

Absolutely Awesome Script, Thanks a bunch!

Adar
January 2nd, 2012 said:

Seems like the perfect script for me though I run it and nothing opens up.. no window or anything, how do I use it? Thanks

January 5th, 2012 said:

Adar,

Did you ever get it working?  If it's not showing up, you need to make sure that the script is in your scripts path, which usually means your scripts directory.

To bring up the UI try entering:

source abTwoFace;abTwoFace;

into the mel tab of your command line, and hitting enter.  If that doesn't work, take note of any error you get in the script editor and send it to me.  I should be able to figure it out .

October 14th, 2012 said:

i am trying to wrap my head around your script, not sure if i understood the workflow completely...

1- select base head(default expression)

2-"create weighted base object"

3-click "select base object" so the base heads name is filled in, which it already was...

4-select target object (or select base shift select target?)

5-"create meshes"

either way.. i always get the following error

abWeightedBlendCTl("createBn");
// Error: cannot convert data of type undefined to type string. //

im on maya2012sp2

thanks, phil

October 15th, 2012 said:

Hey Philip,

I'm not sure how it broke like that.  I've tried several different ways, and I can't get the same error message.  I did manage to break it another way (hint: don't leave the prefix fields blank).  I'll get to that one sometime this week.

It sounds like you've got the workflow mostly right.  Here's how I just did it:

  • You should start with a duplicate of your default mesh, which you will use as your base mesh, and at least one target mesh that you wish to split into left and right meshes.  The base and target(s) must share the same exact topology.

  • Select your base head and click "Weighted Base Object" since this is the first time that you're using the script with this mesh.  Once you've created a weighted base object, you won't have to do it again for this mesh (unless you close the file without saving).

  • The "Select Base Object" field will be filled in automatically when you create the weighted base object.  If you had previously created a weighted base object and were just reloading it, you would use the "Select Base Object" button to select it.

  • The last step is to select your target mesh (the one that you want to split) and click the "Create Meshes" button.  Two new meshes should appear below your target mesh.

Did this help at all or are you still encountering the same error?

October 16th, 2012 said:

hey,

thanks for the follow up, unfortunately i am still stuck with the same error message, checked it this time with a simple cube. let me know if there is a way to enable some debug mode so i could provide u with better feedback. im on linux.... maybe thats the reason?

October 19th, 2012 said:

Sorry for not getting back to you sooner, but I've checked it again and again and I still can't get the error that you're experiencing.

Your error text has the function as "abWeightedBlendCTl" where the last "t" should be lower case.  I assume that was just a typo, though (it would make no sense, otherwise).

Is a set of three joints created when you create the weighted base object (with the root joint named "abBlendRootJNT")?  I expect that the script isn't creating them for you (which would be consistent with the error message).  But, if the joints are being created, I recommend that you try circumventing the script UI by selecting your target mesh and running the following mel in the command line:

abWeightedBlendCtl("createBn");
October 20th, 2012 said:

hey crumbly,

no problem, thanks for the feedback. yes was a typo its lower case ...BlendCtl

the joints are created(for the time being, i exported the weightmaps and did the rest manually)

abBlendRootJNT ->abRightBlendJNT ->abLeftBlendJNT

executing abWeightedBlendCtl("createBn"); unfortunately produces the same error message. i tried the script with the original maya2012(without any service packs / hotfixes)... same error as with sp2 maya2013 spits out the same error but also tells me that it doesn't like line 157

greets, phil

ps.: this might be a good time to thank you for your scripts ;)

October 23rd, 2012 said:

Hey Phil,

I just uploaded an new version of the script (1.6) that might (maybe, perhaps, with any luck) take care of that line 157 error that you're encountering.  Here's hoping.

Regarding the scripts: thanks!  I'm just happy that so many people have found them useful.

October 24th, 2012 said:

awesome! you nailed it! thanks for the update, all is working fine now :)

greets, phil

October 24th, 2012 said:

Good, I'm glad it worked!


just say it






    

Related Posts