* Applied a small fix to a bug reported by Guignot:

When a script that used setAttr for Camera Data objs (the bug also
    affected some other modules) was executed multiple times, Blender
    would crash after, let's say, the first 5 or 6 tries.  Problem, as
    Guignot pointed, was with reference counting.  Should be ok now, all
    affected modules were fixed.
* The Scene module is now "complete" (= 2.25).
* Made some necessary updates to Object and NMesh.
This commit is contained in:
2003-06-09 04:01:48 +00:00
parent 51850586a8
commit 864e5640f7
15 changed files with 723 additions and 225 deletions

View File

@@ -38,7 +38,8 @@
* given, all preceding ones must be given, too. Of course, this only relates
* to the Python functions and methods described here and only inside Python
* code. [ This will go to another file later, probably the main exppython
* doc file].
* doc file]. XXX Better: put optional args with their default value:
* (self, name = "MyName")
*/
#include <BKE_main.h>
@@ -257,6 +258,10 @@ static PyObject *M_Camera_New(PyObject *self, PyObject *args, PyObject *kwords)
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't create Camera Data in Blender"));
/* let's return user count to zero, because ... */
blcam->id.us = 0; /* ... add_camera() right above incref'ed it */
/* XXX XXX Do this in other modules, too */
if (pycam == NULL)
return (EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create Camera Data object"));
@@ -876,8 +881,8 @@ static int Camera_SetAttr (BPy_Camera *self, char *name, PyObject *value)
* interval and updates the Blender Camera structure when necessary. */
/* First we put "value" in a tuple, because we want to pass it to functions
* that only accept PyTuples. Using "N" doesn't increment value's ref count */
valtuple = Py_BuildValue("(N)", value);
* that only accept PyTuples. */
valtuple = Py_BuildValue("(O)", value);
if (!valtuple) /* everything OK with our PyObject? */
return EXPP_ReturnIntError(PyExc_MemoryError,