Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Guignot <guignot@wanadoo.fr>2003-12-17 17:15:14 +0300
committerJacques Guignot <guignot@wanadoo.fr>2003-12-17 17:15:14 +0300
commit4b813c5c8101740b2ac82a9e170a9d98e2eee3db (patch)
treeb6cc646180ececd3ec10c1d84580d136a6aa7144 /source/blender/python/api2_2x/Ipo.c
parented6709260152f43478160d235bfd227b6036887b (diff)
Modification of the function getCurvecurval suggested by Jiba. This function can take an integer argument (the position of the curve) or a string (the name of the curve)
Updated documentation in doc/Ipo.py
Diffstat (limited to 'source/blender/python/api2_2x/Ipo.c')
-rw-r--r--source/blender/python/api2_2x/Ipo.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
index 5bc5741d7be..8549201b03d 100644
--- a/source/blender/python/api2_2x/Ipo.c
+++ b/source/blender/python/api2_2x/Ipo.c
@@ -344,7 +344,7 @@ static PyObject *Ipo_addCurve(BPy_Ipo *self, PyObject *args)
IpoCurve *ptr;
int typenumber = -1;
char*type = 0;
- static char *name="mmm";
+ static char *name="mmmppp";
if (!PyArg_ParseTuple(args, "s",&type))
return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected string argument"));
@@ -549,20 +549,32 @@ static PyObject *Ipo_EvaluateCurveOn(BPy_Ipo *self, PyObject *args)
static PyObject *Ipo_getCurvecurval(BPy_Ipo *self, PyObject *args)
{
- int num = 0,i;
- IpoCurve *icu;
+ int numcurve = 0,i;
+ IpoCurve *icu;
+ char*stringname = 0;
- if (!PyArg_ParseTuple(args, "i",&num))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected int argument"));
- icu =self->ipo->curve.first;
- if(!icu) return (EXPP_ReturnPyObjError (PyExc_TypeError,"No IPO curve"));
- for(i = 0;i<num;i++)
- {
- if(!icu) return (EXPP_ReturnPyObjError (PyExc_TypeError,"Bad ipo number"));
- icu=icu->next;
+ if (!PyArg_ParseTuple(args, "i",&numcurve))
+ if (!PyArg_ParseTuple(args, "s",&stringname))
+ return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected int or string argument"));
+ icu =self->ipo->curve.first;
+ if(!icu) return (EXPP_ReturnPyObjError (PyExc_TypeError,"No IPO curve"));
+ if (!stringname)
+ for(i = 0;i<numcurve;i++)
+ {
+ puts(type_from_num(icu->adrcode,icu->blocktype));
+ if(!icu) return (EXPP_ReturnPyObjError (PyExc_TypeError,"Bad ipo number"));
+ icu=icu->next;
- }
- return PyFloat_FromDouble(icu->curval);
+ }
+ else
+ while (icu){
+ if (!strcmp(type_from_num(icu->adrcode,icu->blocktype),stringname))break;
+ icu=icu->next;
+ }
+ if (icu) return PyFloat_FromDouble(icu->curval);
+ else { Py_INCREF(Py_None);
+ return Py_None;
+ }
}