IPOCurve.addBezier creates bad handles
Closed, ArchivedPublic


Resolution: Fixed
Category: Python

When creating bezier points in the IPOCurve module of the Python API,
the addBezier method as it currently stands creates useless handles
that lead to non-smooth animation regardless of the curve's
interpolation type. This makes creating smooth IPOCurves via Python
impossible. The addBezier functionality should mimic what happens
when you ctrl-click in the IPO window to add new points. I have heard
from two other Python scripters who had to abandon projects because
of this lack of functionality.

I have a two line patch for this problem, but obviously no commit
priveleges. I've posted this fix to the bf-Python board but seen no
action, so I'm posting it here.

Code snippet, with my fix, from IpoCurve_addBezier in bf-blender/

bzt = icu->bezt + npoints;
bzt->vec[0][0] = x-1;
bzt->vec[1][0] = x;
bzt->vec[2][0] = x+1;
bzt->vec[0][1] = y-1;
bzt->vec[1][1] = y;
bzt->vec[2][1] = y+1;
bzt->h1= HD_AUTO; // new line - my fix
bzt->h2= HD_AUTO; // new line - my fix
return Py_None;

These two lines set the just-created handles to the Autosmooth type.
Using this fix, smooth curves can be achieved via the Python API.


Stephen Swaney (stiv) closed this task as Archived.Mar 5 2004, 9:22 AM

This task was automatically closed as archived as part of migration, because the project or tracker this task belonged to is no longer active.