Free Stretchy Bones Creator


#1

I’ve created a script that will create chains of stretchy bones in Max. It’s free!

Here is link to v2.1 - updated on 11/17/10

old script below:
Here is link to v1.3 - updated on 10/01/10

                             [b]Why I created this script:[/b]
                             I've been rigging a few faces lately, and I found it was tedious to create the same stretchy bone constrained to point helpers over and over again.  Then I got tired of merging in a file with a stretchy bone already setup.  In addition to that I wanted a way to quickly create an arbitrary number of bones already linked together in a chain.  My introduction to stretchy bones came from Louis Marcoux ([http://www.louismarcoux.com/Videos/MuscleObjects.wmv](http://www.louismarcoux.com/Videos/MuscleObjects.wmv)), so these bones are based on his method of creation, however, I've removed the point helpers and instead used spheres.   I see tons of people using stretchy bones for all kinds of different things in Max, so I hope this takes the tedium out of them a little bit.
                             
                             [b]How this script works:[/b]
                             You have 1 input and 2 buttons, for now.  The input determines how many bones are created, and the first button creates X number of bones in a line at the origin.  The second button removes all the created spheres and bones from the scene (using a naming convention).  It's simple and to the point.
                            [img]http://www.garrickcampsey.com/media/stretchyBonesCreatorV03.jpg[/img]
                             [b]
                             What this script does:[/b]
                             For an input value of 1: creates a bone object between two spheres, unfreezes the length, color-codes the bone and spheres, renames the bone to stretchy bone, renames and hides the nub bone, locks all the transforms/flags on the bone and nubBone (you shouldn't be moving them anyway), sets up position constraints, and sets up lookAt constraints (turns off the viewline) from the bone to the spheres.  And it does that for any number of bones you want (I limited the spinner to a maximum of 100 bones in a single chain, for now).
                             
                             [b]Upcoming features:[/b]
                             Coming up soon, I hope to add in the ability to create the bone chain in a ring, for mouths.  
                             I also want to create a ring with stretchy bones branching off each animation control, just like the one pictured below and on the right (image © [tysonibele.com](http://www.tysonibele.com)): 
                             
                             [img]http://tysonibele.com/Main/Tutorials/Face/face7.jpg[/img]
                             
                          I may also add a button for creating stretchy bones in grids, for rigging a deforming wall or other type of object.
                          
                             [b]Support:[/b]
                             I started learning maxscript a few days ago, so I don't know if I can support this across all versions.  I can test on Max9, and will try to fix the script so it works for your version of Max, if you run into problems.  I hope there aren't any compatibility issues, as I didn't use any ActiveX or DotNET components/objects.  
                             
                             [b]Feedback:[/b]
                             Please feel free to tell me where my code sucks, as the code is not encrypted.    I want to make it better/faster and version independent, but I'm not sure how to go about doing that - so give me feedback and criticism and I will do the dirty work.   Happy Maxing! :)
                        
                        [img]http://www.garrickcampsey.com/media/stretchyBonesCreatorV03b.jpg[/img]

#2

Feel free to check out the code in this script (builds a stretchy bone chain based on the selection):
http://www.jasonlabbe3d.com/Files/Scripts/JDL_stretchyBones.zip

Don’t forget to support twisting in your chain.

Cheers.


#3

Jason - thanks for the script man! I’ll be digging through it for a while :slight_smile:


#4

Jason - the .MZP is encrypted, so I can’t really study it. I really like how it works though, it gives me a lot of ideas. :slight_smile:


#5

Just rename the .mzp to .zip. The purpose of the .mzp is so you can drag & drop it on the viewport to install it.


#6

Ohhh! Wow, I am such a n00b with this stuff. Thanks for taking the time to explain it, I would of been googling for weeks. :slight_smile:


#7

StretchyBones creator can now create circular bone chains! (Minimum of 3 bones).

 [img]http://www.garrickcampsey.com/media/stretchyBonesCreatorV04-circles.jpg[/img]
 
 The circle created is a closed loop, meaning the last bone is linked to and controlled by the first sphere.  I've also begun figuring out ways to target the bone chains and selectively remove them.  The first step is creating an 'undo' for the last bone chain created:
 
 [img]http://www.garrickcampsey.com/media/stretchyBonesCreatorV04-undo1.jpg[/img]

Voila!

Coming up soon, I hope to add a “Create Mouth Bone Chain” button, with bones branching off the animation controls. I also want to add in functionality for targeting any selected bone chain and deleting it. Eventually, I’d like to implement a DotNET listView or treeView that summarizes all created boneChains in the scene, with the ability to select a bone chain and delete it. Currently, deleting a bone chain is a little bit involved, so I’d like to simplify it with a UI.

I think my approach to this is aimed at creating StretchyBones “primitives”, along with a way to keep track of them and remove them (without resorting to using the ‘Select Objects’ dialogue). This may get renamed to ‘StretchyBones Manager’ or something else more descriptive.

It’s really fun learning MAXscript, and I hope some folks find this useful! :slight_smile:


#8

Added features:

[ul]
[li] Controls can now be Spheres or traditional Point Helpers.[/li][li] Controls and Bones now have color pickers that determine their appearance.[/li][li] Controls and Bones are now separated onto layers automatically.[/li][/ul]

Here’s a walkthrough of the new features:
First, let’s start with a bare scene with some spheres in it, on a separate layer…

      When StrechyBones Creator runs, it makes two layers to place bone chains into......
       [img]http://www.garrickcampsey.com/media/stretchyBonesv5-2.jpg[/img]
       
      Just click the radio button for pointHelpers if you'd prefer them as bone controls.  They inherit the Control Color picker's value just like the Spheres.
       [img]http://www.garrickcampsey.com/media/stretchyBonesv5-3.jpg[/img]
       
      Changing the color values affects the next chain of bones you create......
       [img]http://www.garrickcampsey.com/media/stretchyBonesv5-4.jpg[/img]
       
      These values correspond to what is displayed in the Layer Manager as well.
       [img]http://www.garrickcampsey.com/media/stretchyBonesv5-5.jpg[/img]
       
       I'm still working on the 'Delete Selected bone and chain' button, so it's there but not functional.

I’m having some trouble doing $.pos property comparisons with values from 2 different arrays :sad:

      I hope to wrap up the 'Delete Selected' button issues and move forward on coding a listView for all the created boneChains in the scene sometime this week.

#9

StretchyBones Creator now has a functional “Delete Selected Button”. Just click on any object that is part of a bonechain then press the button and it’s gone - removes hidden nubBones too!

Here is a test with 25 bone chains in a scene:

StretchyBones Creator now has the option to create bones with boxMode enabled.

Also included in this version of StretchyBones Creator is easyPlanes. Let’s start with a fresh scene:

Turning on easyPlanes creates two planes around the origin and assigns them materials with self illumination at 100% and a blank bitmap in the diffuse slot. The planes are organized into the layer manager and given unique names, with segments set to 20x20.
Turning off easyPlanes removes the planes from the scene and layerManager, along with resetting the materials the planes were assigned. It’s more or less an on/off switch for a front/side modeling environment.

Here is a scene I am field-testing StretchyBones Creator in. So far, so good.

The topology needs more work, but soon I’ll be using SBcreator to develop the stretchyBones necessary to drive the mesh and get her talking.

Also with this version, I’ve banged around with the controls a lot and tried to break them - then added in checks so they won’t break when you use them. I hope this version is more stable one for everyone. Happy Maxing! :slight_smile:


#10

I’m pretty proud of this update! :slight_smile: StretchyBones now has “TheSticker” included with it.
The following .gif explains the context and function of “TheSticker”:

First, I start with a face mesh (this mesh isn’t perfect, but works for a test). Open StretchyBones Creator, create some bone chains and move them into place over the face mesh. I’m doing this in the front viewport. Once the chains are setup how you’d like them, open up “TheSticker” and use the first pickbutton to select the face mesh. Now I select a boneCTRL and click “Stick It (Front)”, which projects the selected object along it’s yAxis until it hits the face mesh. This allows me to quickly and accurately project the entire set of boneChains onto the face mesh and move into skinning the bones. This entire setup took less than 10 minutes.

Coming up soon, I will add functionality for selecting multiple objects to ‘stick’, so you would just select all the boneCTRLs and press the button once, instead of individually projecting each boneCTRL. I don’t think I’m going to be putting the boneChains into a listView, as it’s not necessary for organization any longer. I also want to add a button for creating a single branch off a selected animCTRL, for quickly building custom mouths, or other things. Fun stuff! :slight_smile:


#11

awesome tool, but i tried it and it gives me a " no ““select”” funcition for undefined" error…and does nothing, am i doing something wrong? i just opened the script and ran the “generate bones in a line” option…

cheers


#12

Metamesh,
I think I have the error fixed, and I’ve updated the link in post #1.

The issue (I think) was that I was declaring an empty global array, then trying to access it when that button was pressed. Now the array is declared with a 0 value. Let me know what version of Max you’re running too, as that will help me to understand what kinds of coding standards I need to adopt to support this tool. :slight_smile:


#13

This update sees the UI reorganized using position values, allowing for a more custom layout. Hopefully this makes more sense and takes up less screen space than previous versions.

Still working on getting TheSticker to stick multiple objects.

Metamesh - Now I think that the global array problem was unrelated to your problem. I think your problem has to do with the way the bones are created, as the script targets the last created bone as $bone01 (the default name), and this default name may be different in later versions of Max, so that may be where the ‘No ‘select’ for undefined’ error is originating from. Let me ask, do the spheres or point helpers show up, then the message box - or is nothing built, and the message box pops up instantly? This will help me narrow down where the script is breaking. Thanks! :slight_smile:


#14

TheSticker can now project as many objects as your computer can handle.

Here is a “stress test” on the script, projecting 300 bone controls onto a 75x75 segment plane with noise applied:

This makes projecting the bone controls waaaaaay easier, as now the steps are simply:

  1. open the layer manager, right-click on bones_CTRLS layer > select (this selects all the bone’s controls).
  2. use the pickbutton to select the mesh to project onto.
  3. click ‘Stick along world yaxis to:’ button.

This process is accomplished by creating an array with a 0 value, then joining in the currently selected objects, sending it to a for loop which iterates through each selected object (ignoring the 0 value), projecting it across the world Yaxis until it hits the selectedMesh object. It’s pretty quick and stable too. I’ve put in checks so rays are sent in both the positive and negative y directions, then the script boils down the distances and compares them, eventually sending the selected object to the nearest ray intersection. Be aware that this script takes into account normals - so it WON’T find the surface of a mesh that is facing away from it.

Metamesh - I’m still working on figuring out a way to target the newest bone created without referring to it as ‘$bone01’. As soon as I find that answer, I will update the script. Cheers! :slight_smile:


#15

Metamesh - I’ve figured out a way to target the bone chain without referring to it by name, so this may fix the problem you were having. I’ve updated the script in post #1.

Here is the bits of code changed, if anyone else runs into a similar problem:

buildPOS1 = [0,0,0]
  buildPOS2 = [50,0,0]
  
  freshBone = BoneSys.createBone buildPOS1 buildPOS2 [0,0,1]
  select freshBone
  
  /* --previous code
  BoneSys.createBone buildPOS1 buildPOS2 [0,0,1]
  select $bone01
  */ 

#16

i´ve just tried the latest update, the error that is showing now is: “unknown property: “boneFreezeLength” in undefined”

im using max2011 if that´s of any help, and yes, the 3 spheres appear in the viewport but then it throws the error at me :slight_smile:

cheers!


#17

Try downloading the .ms from post #1 again. :slight_smile:


#18
  • StretchyBones creator now has the ability to add any number of stretchy bones and controls to any other object. The UNDO functionality works here to, with the ability to UNDO newly added bones and controls.

    • StretchyBones also now has the ability to Shrink&Link any control to another control, so you can create custom webs of stretchyBones. You can also mix between point helpers and spheres, boxMode and bones, and color code newly created bones, all within the same bone chain.

    Here is a screencap of the new features:

    Here is a screencap of a field test, setting up and projecting many stretchyBones onto a face mesh with a level of subdivision applied:

    The above bone setup took around 5 minutes to generate, get into place, and project.

    I think the most exciting aspect of this tool, for me, is really the ability to quickly explore new ways to use stretchyBones in rigging faces and other meshes. I’m sure there are undiscovered ways to use stretchyBones, so I’ve coded many of the buttons to work on any kind of object, not just bones or controls. For example, you can stick any object to any other object using TheSticker. You can also create a stretchyBone (with a control object) on any object as well. Just select the object and click the >ADD< button.

    There are some issues with the projecting that I will need to fix coming up soon, as the controls that get shrink&linked also get projected, then they are offset from the mesh by their parent objects when their parent objects get projected. I’ll just need to change the naming convention inside the shrink&link function.

    I’ve got lots more features planned, for example: I want to get TheSticker to project in real-time on a single control from the perspective’s screen zAxis, so a user can have a lot more freedom and feedback over the placement of the control on the mesh. :slight_smile:


#19

I have been field testing stretchyBones. Here are results so far:

I’m setting up the boneChains following certain edges that control the ‘smile line’, which also crease and overlap. This approach is really a process of modeling an expression, which gives a lot of control to the animator. I think the next step for stretchyBones will probably be a way of creating splines to path constrain certain animation controls to. And a custom GUI creator is only a step away from that. There’s a lot of possibilities, so I’m going to try and position the tool to be used in a variety of ways. :slight_smile:


#20

More field tests using StretchyBones Creator to generate and align bones onto a face mesh:

Here is video of animation: http://www.youtube.com/watch?v=AdRwKvxwW-Q

I’m happy to say that SBC is holding up rather well under all the field tests. For example, I forgot to project a bunch of controls but had already skinned them to the mesh, so I just selected the mesh and turned off ‘always deform’ in the skin modifier under the ‘advanced’ tab. I projected the controls onto the mesh, then turned skin back on. So, even if you aren’t following the steps correctly, SBC can still make it work. I’m also color-coding the boneChains, cause hey - why not keep it organized? The animation controls are multi-colored, and the bones are the far right image. I’m really concerned with visual organization as you can tell!

The main ingredients for the above setup are: proper topology, organized boneChains along deforming edgeloops, and careful skinning. Beyond that, it’s the skill of the animator.

Some new “wants” to SBC: a spinner to control the sphere’s creation radius, so the user can create smaller controls for finer detail. A button to help with organizing layers of bones (not sure how this will be implemented).
This is a very exciting time! :slight_smile: More features and examples coming soon!