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:
authorStephen Swaney <sswaney@centurytel.net>2003-11-11 13:13:04 +0300
committerStephen Swaney <sswaney@centurytel.net>2003-11-11 13:13:04 +0300
commit011203c45f7ce01e03ee90edd2b14ffcba627a97 (patch)
treee9e11fa03fb1f44e8f851380fb64d16e3dbd99b7 /source/blender/python/api2_2x/Ipo.c
parent1018943b3d14e4bd30f0ea7416bdeeb4fc7cea83 (diff)
fixed the bug Joseph Gilbert found in numerous python files.
newly created data objs had incorrect user counts.
Diffstat (limited to 'source/blender/python/api2_2x/Ipo.c')
-rw-r--r--source/blender/python/api2_2x/Ipo.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
index 15117c39c9d..5bc5741d7be 100644
--- a/source/blender/python/api2_2x/Ipo.c
+++ b/source/blender/python/api2_2x/Ipo.c
@@ -45,19 +45,27 @@ static PyObject *M_Ipo_New(PyObject *self, PyObject *args)
BPy_Ipo *pyipo;
Ipo *blipo;
- if (!PyArg_ParseTuple(args, "ss", &code,&name))
+ if (!PyArg_ParseTuple(args, "ss", &code,&name))
return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected string int arguments"));
- if (!strcmp(code,"Object"))idcode = ID_OB;
- if (!strcmp(code,"Camera"))idcode = ID_CA;
- if (!strcmp(code,"World"))idcode = ID_WO;
- if (!strcmp(code,"Material"))idcode = ID_MA;
- if (idcode == -1)
+
+ if (!strcmp(code,"Object"))idcode = ID_OB;
+ if (!strcmp(code,"Camera"))idcode = ID_CA;
+ if (!strcmp(code,"World"))idcode = ID_WO;
+ if (!strcmp(code,"Material"))idcode = ID_MA;
+
+ if (idcode == -1)
return (EXPP_ReturnPyObjError (PyExc_TypeError,"Bad code"));
- printf("%d %d %d \n", ID_OB, ID_CA, ID_WO);
+
+ printf("%d %d %d \n", ID_OB, ID_CA, ID_WO);
+
blipo = add_ipo(name,idcode);
- if (blipo)
- pyipo = (BPy_Ipo *)PyObject_NEW(BPy_Ipo, &Ipo_Type);
+ if (blipo){
+ /* return user count to zero because add_ipo() inc'd it */
+ blipo->id.us = 0;
+ /* create python wrapper obj */
+ pyipo = (BPy_Ipo *)PyObject_NEW(BPy_Ipo, &Ipo_Type);
+ }
else
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't create Ipo Data in Blender"));