Index: source/blender/python/api2_2x/doc/IpoCurve.py =================================================================== --- source/blender/python/api2_2x/doc/IpoCurve.py (revisión: 21042) +++ source/blender/python/api2_2x/doc/IpoCurve.py (copia de trabajo) @@ -67,6 +67,8 @@ @type name: string @ivar bezierPoints: The list of the curve's bezier points. @type bezierPoints: list of BezTriples. + @ivar bezierPointsSelected: The list of the curve's selected bezier points. + @type bezierPointsSelected: list of BezTriples. @ivar interpolation: The curve's interpolation mode. See L{InterpTypes} for values. @type interpolation: int Index: source/blender/python/api2_2x/Ipocurve.c =================================================================== --- source/blender/python/api2_2x/Ipocurve.c (revisión: 21042) +++ source/blender/python/api2_2x/Ipocurve.c (copia de trabajo) @@ -81,6 +81,7 @@ static PyObject *IpoCurve_newgetExtend( C_IpoCurve * self ); static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * args ); static PyObject *IpoCurve_getPoints( C_IpoCurve * self ); +static PyObject *IpoCurve_getSelectedPoints( C_IpoCurve * self ); static PyObject *IpoCurve_clean( C_IpoCurve * self, PyObject *value ); static PyObject *IpoCurve_evaluate( C_IpoCurve * self, PyObject * args ); static PyObject *IpoCurve_getDriver( C_IpoCurve * self ); @@ -127,6 +128,8 @@ METH_NOARGS, "() - Gets the extend mode of the curve"}, {"getPoints", ( PyCFunction ) IpoCurve_getPoints, METH_NOARGS, "() - Returns list of all bezTriples of the curve"}, + {"getSelectedPoints", ( PyCFunction ) IpoCurve_getSelectedPoints, METH_NOARGS, + "() - Returns list of all selected bezTriples of the curve"}, {"evaluate", ( PyCFunction ) IpoCurve_evaluate, METH_VARARGS, "(float) - Evaluate curve at given time"}, {"clean", ( PyCFunction ) IpoCurve_clean, METH_VARARGS, @@ -147,6 +150,10 @@ (getter)IpoCurve_getPoints, (setter)NULL, "list of all bezTriples of the curve", NULL}, + {"bezierPointsSelected", + (getter)IpoCurve_getSelectedPoints, (setter)NULL, + "list of all selected bezTriples of the curve", + NULL}, {"driver", (getter)IpoCurve_getDriver, (setter)IpoCurve_setDriver, "The status of the driver 1-object, 2-py expression, 0-off", @@ -650,6 +657,40 @@ return list; } +static PyObject *IpoCurve_getSelectedPoints( C_IpoCurve * self ) +{ + BezTriple *bezt; + PyObject *po; + int i, npoints = 0; + PyObject *list; + + /* get number of selected points */ + for( bezt = self->ipocurve->bezt, i = 0; + i < self->ipocurve->totvert; i++, bezt++ ) { + if( bezt->f2 ) npoints++; + } + + list = PyList_New( npoints ); + + if( !list ) + return EXPP_ReturnPyObjError( PyExc_MemoryError, + "PyList_New() failed" ); + + i = 0; + for( bezt = self->ipocurve->bezt; i < npoints; bezt++ ) { + if( bezt->f2 ){ + po = BezTriple_CreatePyObject( bezt ); + if( !po ) { + Py_DECREF( list ); + return NULL; /* This is okay since the error is alredy set */ + } + PyList_SET_ITEM( list, i, po ); + i++; + } + } + return list; +} + /*****************************************************************************/ /* Function: IpoCurve_compare */ /* Description: This compares 2 python types, == or != only. */