diff options
author | Jacques Guignot <guignot@wanadoo.fr> | 2003-08-05 14:19:28 +0400 |
---|---|---|
committer | Jacques Guignot <guignot@wanadoo.fr> | 2003-08-05 14:19:28 +0400 |
commit | 05187adc2fff9d6c6dcc7c1b7ddf5151ec0a9982 (patch) | |
tree | c5c661457657e262991c11b9762e8b83dbc7d810 /source/blender/python/api2_2x/Ipocurve.c | |
parent | 683c322b0ebf7f407bb79f775f592e8ebfeef078 (diff) |
removed unuseful function calls in BezTriple.[ch]
general cleaning of Ipocurve.c Ipocurve.h Ipo.h Ipo.c
updated doc
Diffstat (limited to 'source/blender/python/api2_2x/Ipocurve.c')
-rw-r--r-- | source/blender/python/api2_2x/Ipocurve.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/source/blender/python/api2_2x/Ipocurve.c b/source/blender/python/api2_2x/Ipocurve.c index d0580cb780d..dc7aefd0101 100644 --- a/source/blender/python/api2_2x/Ipocurve.c +++ b/source/blender/python/api2_2x/Ipocurve.c @@ -85,41 +85,73 @@ static PyObject *IpoCurve_setInterpolation( C_IpoCurve * self, PyObject *args) if (!strcmp(interpolationtype,"Constant"))id = IPO_CONST; if (!strcmp(interpolationtype,"Linear"))id = IPO_LIN; if (id == -1) - return (EXPP_ReturnPyObjError (PyExc_TypeError,"bad interpolation ytpe")); + return (EXPP_ReturnPyObjError (PyExc_TypeError,"bad interpolation type")); + + self->ipocurve->ipo = id; Py_INCREF(Py_None); return Py_None; } + static PyObject *IpoCurve_getInterpolation( C_IpoCurve * self) -{ +{ char*str = 0; + IpoCurve *icu = self->ipocurve; + if (icu->ipo == IPO_BEZ) str = "Bezier"; + if (icu->ipo == IPO_CONST) str = "Bonstant"; + if (icu->ipo == IPO_LIN) str = "Linear"; - Py_INCREF(Py_None); - return Py_None; + if (!str) + return (EXPP_ReturnPyObjError (PyExc_TypeError,"unknown interpolation type")); +return PyString_FromString(str); } + static PyObject *IpoCurve_setExtrapolation( C_IpoCurve * self, PyObject *args) { + char*extrapolationtype = 0; + int id = -1; + if (!PyArg_ParseTuple(args, "s", &extrapolationtype)) + return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected string argument")); + if (!strcmp(extrapolationtype,"Constant"))id = 0; + if (!strcmp(extrapolationtype,"Extrapolation"))id = 1; + if (!strcmp(extrapolationtype,"Cyclic"))id = 2; + if (!strcmp(extrapolationtype,"Cyclic_extrapolation"))id = 3; + + if (id == -1) + return (EXPP_ReturnPyObjError (PyExc_TypeError,"bad interpolation type")); + self->ipocurve->extrap = id; Py_INCREF(Py_None); return Py_None; } + + + static PyObject *IpoCurve_getExtrapolation( C_IpoCurve * self) { + char*str; + IpoCurve *icu = self->ipocurve; + if (icu->extrap == 0) str = "Constant"; + if (icu->extrap == 1) str = "Extrapolation"; + if (icu->extrap == 2) str = "Cyclic"; + if (icu->extrap == 3) str = "Cyclic_extrapolation"; - Py_INCREF(Py_None); - return Py_None; +return PyString_FromString(str); } + + + + static PyObject *IpoCurve_addBezier( C_IpoCurve * self, PyObject *args) { short MEM_freeN(void *vmemh) ; void *MEM_mallocN(unsigned int len, char *str); - char *str=0; float x,y; int npoints; IpoCurve *icu; BezTriple *bzt,*tmp; static char name[10] = "mlml"; PyObject*popo = 0; - if (!PyArg_ParseTuple(args, "Os", &popo,&str)) - return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument")); + if (!PyArg_ParseTuple(args, "O", &popo)) + return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected tuple argument")); x = PyFloat_AsDouble(PyTuple_GetItem(popo,0)); y = PyFloat_AsDouble(PyTuple_GetItem(popo,1)); icu = self->ipocurve; |