Wednesday, August 1, 2012

"kmFeatherConstraint" MEL Script {

Here's a little MEL script I wrote a while back. It creates a series of constraints down a chain of items with a falloff. A simple GUI allows for changing of ordering and falloff ease modes ( Linear, Ease-In, Ease-Out, Ease-In-Out ). Eased modes use S-curve interpolation for a nice smooth gradient.

There's a few things I'd like to add to make this better, but I thought I'd throw up version 1 and see if it's useful to anyone.

Here's a video demonstrating its use:


Download kmFeatherConstraint

"kmCurveBtwnPts" MEL Script {

I present a very simple, clean, and useful MEL script that does exactly what the name implies. Given a selection of objects, the script creates a NURBS curve that intersects with each point in the order they were selected. Additionally, the curve is constrained to the selected objects, so it will always go through every point.

This can be useful for a multitude of practical rigging setups, as well as just to add some simple flair to improve the visual interface for a rig. I'm excited to have this in my back pocket!

Here's a video demonstrating its use:


Download kmCurveBtwnPts

After much trial and error, I was able to find a simple and clean way to constrain Edit Points of a NURBS curve, so the curve follows through the control points. Edit Points (EP) are much less accessible than Control Points (CP), as moving any given EP has a much greater influence on the curve than a CP. In data they are just read-only vectors. But it looks much nicer to have the curve actually go through your control point, rather than just be influenced by it.

I used two useful tricks here that I'd like to highlight:
  1. MEL command "eval()" interprets a given string as a command and executes that command. This allows me to iterative-ly compile my curve command, since a single curve command requires all the points to be known. Once I loop through objects, obtain my points, and add it to my command string, I can use "eval( $curveCommand )" to run it!
  2. "pointCurveConstraint" is a very useful constraint that cleanly constrains a curve to an object. Constraining EPs is not possible, constraining CPs or clusters of them doesn't work either, and binding the curve to joints (my first approach) produces non-smooth and undesirable results. This solved all my problems!
-K