IPOCurve.addBezier creates bad handles
Closed, ArchivedPublic

Description

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/
blender/source/blender/python/api2_2x/ipocurve.c:

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
Py_INCREF(Py_None);
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.

Roland Hess (harkyman) set Type to Bug.Via Old WorldFeb 20 2004, 2:00 PM
Stephen Swaney (stiv) closed this task as "Archived".Via Old WorldMar 5 2004, 9:22 AM
Nobody (None) added a comment.Via Old WorldFeb 20 2004, 2:00 PM

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

Add Comment