fixed the bug Joseph Gilbert found in numerous python files.

newly created data objs had incorrect user counts.
This commit is contained in:
Stephen Swaney
2003-11-11 10:13:04 +00:00
parent 1018943b3d
commit 011203c45f
7 changed files with 56 additions and 25 deletions

View File

@@ -44,20 +44,23 @@ static PyObject *M_Curve_New(PyObject *self, PyObject *args)
Curve *blcurve = 0; /* for actual Curve Data we create in Blender */
if (!PyArg_ParseTuple(args, "|s", &name))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected string argument or no argument"));
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected string argument or no argument"));
blcurve = add_curve(OB_CURVE); /* first create the Curve Data in Blender */
if (blcurve == NULL)
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't create Curve Data in Blender"));
if (blcurve == NULL) /* bail out if add_curve() failed */
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't create Curve Data in Blender"));
/* return user count to zero because add_curve() inc'd it */
blcurve->id.us = 0;
/* create python wrapper obj */
pycurve = (BPy_Curve *)PyObject_NEW(BPy_Curve, &Curve_Type);
if (pycurve == NULL)
return (EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create Curve Data object"));
return (EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create Curve Data object"));
pycurve->curve = blcurve; /* link Python curve wrapper to Blender Curve */
if (name)