diff options
author | Stephen Swaney <sswaney@centurytel.net> | 2003-11-11 13:13:04 +0300 |
---|---|---|
committer | Stephen Swaney <sswaney@centurytel.net> | 2003-11-11 13:13:04 +0300 |
commit | 011203c45f7ce01e03ee90edd2b14ffcba627a97 (patch) | |
tree | e9e11fa03fb1f44e8f851380fb64d16e3dbd99b7 /source/blender/python/api2_2x/World.c | |
parent | 1018943b3d14e4bd30f0ea7416bdeeb4fc7cea83 (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/World.c')
-rw-r--r-- | source/blender/python/api2_2x/World.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 5b488e1688b..ba3b3e1eea3 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -116,13 +116,17 @@ static PyObject *M_World_New(PyObject *self, PyObject *args, PyObject *kwords) if (!PyArg_ParseTuple(args, "s", &name)) return (EXPP_ReturnPyObjError (PyExc_TypeError, - "expected int argument")); + "expected int argument")); blworld = add_world(name); - if (blworld) - pyworld = (BPy_World *)PyObject_NEW(BPy_World, &World_Type); + if (blworld){ + /* return user count to zero because add_world() inc'd it */ + blworld->id.us = 0; + /* create python wrapper obj */ + pyworld = (BPy_World *)PyObject_NEW(BPy_World, &World_Type); + } else return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create World Data in Blender")); |