BindPoints


Description:

This is a collection of modifiers that lets you link points on an object to other points, faces, splines, or objects. They can be thought of as weighted Linked XForm modifiers that let you link to any number of sub-object parts of another object.

All the modifiers have no properties and essentially no UI. They are entirely operated through a set of MaxScript functions. Things to keep in mind when working with these modifiers:

Back To Top...


MaxScript Access Overview:

-A global struct (bindOps) contains all the functions used to control the bind modifiers.
-The first argument for all the functions is always an instance of the modifier you're working with.
-All the functions work exactly the same with any of the four bind modifiers, with the exception of the actual Bind function (whose arguments vary depending on the type of bind modifier).

For people who used the older version of this plugin, the toFaceOps and toPointOps structs no longer exist, and have been rolled into the bindOps struct.

-Each modifier keeps track of a certain number of points (set with the SetNumPoints function).
-Each point can have any number of weighted "binds" (set with the Bind function), which link that point to follow a specified object feature (depending on the type of bind modifier).
-In general, workflow is as follows:

  1. Create a bind modifier:
    myMod = BindToShape()
  2. Add the modifier to your object you want to deform (you can actually do this after you set up the binds as well):
    AddModifier $MyObject myMod
  3. Set the number of points used by the modifier:
    bindOps.SetNumPoints myMod $MyObject.numVerts
  4. Add any number of nodes you want to use as "bones":
    bindOps.AddNode myMod $MyObject $MyBoneObject
  5. Actually bind the points on your object to any of the bones:
    bindOps.Bind myMod pointIndex boneNodeIndex subSplineIndex lengthParam weight
More complete examples are in the included BindPoints_Samples.ms file. This was used to create the included sample scene.
Simply load the scene, and run the script to see how to work with the modifiers.

Back To Top...


bindOps Functions:

AddNode <bindModifier> <thisNode> <bindNode>
Adds a node (or "bone") to be used for deformation.
thisNode is the node that will be deformed (read: has the BindTo modifier applied).
bindNode is a node that will drive the deformation.
GetNumNodes <bindModifier>
Returns the number of bind nodes ("bones") used by the modifier.
RemoveNode <bindModifier> <bindNodeIndex>
Removed the specified node from the list of bind nodes.
bindNodeIndex must be less than or equal to GetNumBindNodes.
GetNode <bindModifier> <bindNodeIndex>
Returns the specified bind node.
bindNodeIndex must be less than or equal to GetNumBindNodes.
GetNumPoints <bindModifier>
Gets the number of points controlled by the bind modifier (defaults to 0).
SetNumPoints <bindModifier> <pointCount>
Sets the number of points controlled by the bind modifier. Returns OK.
Bind <bindToPointModifier> <thisNode> <pointIndex> <bindNodeIndex> <toPointIndex> <weight>
Bind <bindToFaceModifier> <thisNode> <pointIndex> <bindNodeIndex> <faceIndex> <weight>
Bind <bindToShapeModifier> <thisNode> <pointIndex> <bindNodeIndex> <splineIndex> <lengthParam> <absolute> <weight>
Bind <bindToNodeModifier> <thisNode> <pointIndex> <bindNodeIndex> <weight>
Binds a point to a specified feature on the specified bind node. Returns TRUE on success, otherwise FALSE.
The first three arguments are always:
  1. thisNode is the node that the bind modifier is applied to.
  2. pointIndex is the point you want to bind on the object with the bind modifier applied.
  3. bindNodeIndex is the node you want to bind pointIndex to. Must be less than or equal to GetNumBindNodes.
The remaining arguments depend on the type of bind modifier being used, and can be a combination of:
UnBind <bindModifier> <pointIndex> <bindIndex>
Removes the specified bind from the specified point.
GetNumBinds <bindModifier> <pointIndex>
Gets the number of binds assigned to the specified point.
GetBindInfo <bindModifier> <pointIndex> <bindIndex>
Returns an array containing info on the specified bind.
pointIndex must be less than or equal to GetNumPoints.
bindIndex must be less than or equal to GetNumBinds for the given pointIndex.
What the array contains depends on the type of bind modifier passed in:
GetBindWeight <bindModifier> <pointIndex> <bindIndex>
Gets the weight of a bind on the specified point, or undefined if it doesn't exist.
pointIndex must be less than or equal to GetNumPoints.
bindIndex must be less than or equal to GetNumBinds for the given pointIndex.
SetBindWeight <bindModifier> <pointIndex> <bindIndex> <weight>
Sets the weight of a bind on the specified point, returns TRUE on success, FALSE on failure.
pointIndex must be less than or equal to GetNumPoints.
bindIndex must be less than or equal to GetNumBinds for the given pointIndex.
weight is expected to be a normalized weight value between 0.0 and 1.0, though it can be outside of that range if desired.
Update <bindModifier>
Updates any changes you've made via MaxScript and forces a scene refresh.
This isn't strictly necessary, but any changes you make won't be visible until either this function is called, or the modifier is refreshed in some other way (ie. scrubbing the time slider).
It's a good idea just to call this when you're done doing stuff, regardless.

Back To Top...


Known Bugs/Limitations:

Back To Top...


History:

2001.03.07 - Created.
2001.04.19 - Finished BindToShape and BindToNode.
           - Updated BindToFace and BindToPoint to support multiple binds per point.
           - Deformation respects selections passed up the stack now.
2001.04.26 - Finalized script interface.
           - Tweaked user interface.
           - Small problem with old version loading fixed.
2001.04.27 - Added absolute mode to BindToShape.
2001.05.01 - Bugfix.
2001.05.08 - Added Update
2001.05.13 - Added global animatable strength
2001.05.24 - Clone works now (fun typo crash bug).
2003.04.15 - Might have fixed a bug with ToFace accessing invalid meshes.
2007.02.20 - Updating for public 3dsmax9 release.
2008.04.05 - Updated to 64 bit and 3dsmax 2008.  Thanks to David Baker for the help.

Back To Top...


Contact / Disclaimer / License:

Bug reports/comments/suggestions: http://www.footools.com/. If you use this software on a project, sending an e-mail/postcard indicating such would be appreciated.
This software is provided 'as-is', without any express or implied warranty. In no
event will the author be held liable for any damages arising from the use of this
software.

Permission is granted to anyone to use this software, subject to the following
restrictions:

1. The origin of this software must NOT be misrepresented; you must not claim that
   you wrote the original software.

2. This software may NOT be bundled with any other product or included in any
   compilation without the express permission of the author.

3. This notice must NOT be removed or altered from any distribution of this
   software.

Back To Top...