When I add a hook, calc_length() is calculated without modifiers.

I don't fully understand the purpose of calc_length() now, because it no longer appears to be functional.

Is there any other option to create custom squash for cartoon characters without spline_length?

Screen capture

  • $\begingroup$ Is the implication that bpy.types.Curve.calc_length() produced different results on a per object basis in previous versions? One way to estimate a curves length is with an arbitrarily small mesh given an array modifier set to fit curve and use its dimension. $\endgroup$
    – batFINGER
    Dec 1, 2019 at 16:10
  • $\begingroup$ well, but I think it can be very slow for a complex rig. It is building stone of whole Ik spline rig, so an animator will not have real-time preview. $\endgroup$
    – MRL
    Dec 1, 2019 at 16:17
  • $\begingroup$ Thought it quicker to demonstrate with answer than to to and fro (and so) re speed and real time previews in comments. $\endgroup$
    – batFINGER
    Dec 1, 2019 at 17:00

1 Answer 1


Array modifier fit to curve.

Am of the opinion that Spline.calc_length() would only return the length of the non deformed local coordinates of the curve. It is unaware of what of many objects it is the data part of... trying to bend it out of shape with modifiers and shapekeys etc.

Fortunately can estimate the length simply and quickly using method below.

Add an arbitrarily small "unit" object, could be single edge, or two verts, to the scene at the location of start of curve and assign it an array modifier and fit to curve. Using defaults of array modifier, it is as long in X direction as the curve. The smaller the size of unit object the better the precision of estimate.

enter image description here A little cube set to fit the length of curve

Now at any time the estimated length of curve is given by the array modified "unit" object's x dimension.

enter image description here Dragging a hook on curve changes dimension of cube. UI update a bit sluggish, but you get the gist

This can be attached to rig and hidden.

  • $\begingroup$ Thank you, do you have some experience how fast is it ? 2 arms, 2 legs, and spine...Can the rig with it be animated in a previewed in real-time ? (25fps) $\endgroup$
    – MRL
    Dec 1, 2019 at 17:05
  • $\begingroup$ No couldn't say. Doubt there is too much overhead, or a quicker way to estimate the modified curve length. ob.dimensions.x can be used as driver variable target for example. The example shown in question runs at scene fps on my old sh*tbox computer. $\endgroup$
    – batFINGER
    Dec 1, 2019 at 17:20
  • $\begingroup$ could we suggest to developers make it a default value for splines? What do you think about that? You are experienced maybe somebody tried it before, I don't know. Or modifier for only 1 spline in data. But if it will be computed in the core, it could be very fast in every solution. $\endgroup$
    – MRL
    Dec 1, 2019 at 17:27
  • 1
    $\begingroup$ The array mods count for fit curve length is computed in the core. Imagine the same code could be leveraged to get a curve objects length. (or an estimate given an input unit) Does array mod code calculate the modified curves "exact" length and then divide, or does it wind on the mesh down the curve till it hits the end to get the count... don't know. $\endgroup$
    – batFINGER
    Dec 1, 2019 at 17:50
  • $\begingroup$ Well then, thank you very much. An edge, 2 vertices, and anybody can set the accuracy of the measurement by the length of the edge. By the script, the length can be changed every time. $\endgroup$
    – MRL
    Dec 1, 2019 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .