Overview

A deformer to limit NURBS curve length. Why have such a deformer? Well, it can be used in some scenarios where you don’t want to set up a whole spline IK rig or in situations where a spline IK or a motion path hack is not a practical solution. For example, you have a scene with many curves, you definitely wouldn’t want to set up complex rigs when your end goal is just to limit the curve length. Maya includes a curve lock length feature, however, it is not animatable. That is where this deformer might shine some light.

Demo

Node details

Defomer node name is bbxLimitCurveLength. Made in C++, tested in Maya 2018, 2019, 2020 (Windows and Linux).

Why is it called “limit curve length” and not “fixed curve length”? There might be differences in the resulting length depending on the curvature.

Works on non-periodic Linear and Cubic curves. Haven’t tested on any other curve orders. The result on a periodic/closed curve is undefined since it can’t slide curve through a specific direction.

There might be a major performance hit if the deformer is applied to way too many curves or if applied to curves with too many spans. This is a major drawback since Maya’s NURBS API is not thread-safe and curve evaluation is very expensive in general (For example, try using a curve with 100 CVs for a spline IK, or try creating too many spline IKs). (Disclaimer: This is my understanding of Maya API, I might be wrong!)

This deformer should ideally be positioned at the end of the deformer stack. (All other deformations should happen before this, or you will the benefit of limiting length)

Attributes

nametyperangedefaultdescription
baseCurve (bc)nurbsCurve []N/AnullDefine rest pose of the affecting curve.
This attribute is automatically set when you apply this deformer to curve(s)

globalScale (gs)doubleN/ADefines scale ratio.
If a base curve is not connected, this attribute is used for re-scaling cached base curve.
Can be used for scaling down curve along the curvature.
pinStartEnd (pse)double0.0 – 1.00.0Slide the resulting original curve along the stretched curve.
allowStretch (ast)double0.0 – 1.00.0If the curve is longer than initial length, disabling this option would keep resulting curve to match initial length. Enabling would stretch it along the stretched curve.
Note: this attribute does not have any effect when pinStartEnd is not zero.
allowSquash (asq)double0.0 – 1.00.0If the curve is shorter than initial length, disabling this attribute would extend curve along the last tangent to match initial length (Default behavior)
showWarning (sw)boolN/ATrueIf enabled, evaluation will show warnings when the base curve does not match input curve or if when the deformer is assigned to non-curve objects

How to use?

  1. Create/Select any number of curves
  2. With the curves selected and run the below in the script editor
    • MEL
      • deformer -typ "bbxLimitCurveLength";

    • Python
      • import maya.cmds as cmds
        cmds.deformer(typ="bbxLimitCurveLength")

  3. Make sure bbxLimitCurveLength is end of chain deformer;
    • Example:
      • deformerStack_bbxLimitCurveLength
  4. That’s it

Download

Since my expertise in WordPress is sub-par, I had to host downloads on gumroad. This plugin is available for 2018, 2019, 2020 versions of Maya on Windows and Linux platforms.

To make everyone’s life easier, no licenses are enforced within the plugin. Since it is up for a fair price, do consider getting more copies if possible. Thank you