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:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-07-21 07:19:52 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2004-07-21 07:19:52 +0400
commitc04bec851cebc017ba6b144b879919fd1f1967a2 (patch)
tree78c249bf7b75dde60e3f6f56fd16a1a75bf860a9 /source/blender/python/api2_2x/Object.c
parentdf36d4c8e5ac74a15ceafaa93ad1b62c98a8f9fc (diff)
creator.c wasn't updated in my last commit, here it is (the change reverts my previous change to it, since it was made unnecessary by handling onload scriptlinks a little differently, as can be checked in blender.c and editscreen.c).
- BPython: finishing object and nmesh .setMaterials commit, fixing two bugs. Also fixed a crash with object.track (pointer wasn't checked for validity). All based on reports and patch by Yann Vernier, thanks again.
Diffstat (limited to 'source/blender/python/api2_2x/Object.c')
-rw-r--r--source/blender/python/api2_2x/Object.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 784b832f968..d150af636ef 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -1570,21 +1570,21 @@ static PyObject *Object_setMaterials (BPy_Object *self, PyObject *args)
if ((len < 0) || (len > MAXMAT))
{
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "illegal material index!"));
+ "material list should have at least 1, at most 16 entries"));
}
if (self->object->mat)
{
- EXPP_releaseMaterialList (self->object->mat, len);
+ EXPP_releaseMaterialList (self->object->mat, self->object->totcol);
}
/* Increase the user count on all materials */
for (i=0 ; i<len ; i++)
{
- id_us_plus ((ID *) matlist[i]);
+ if (matlist[i]) id_us_plus ((ID *) matlist[i]);
}
self->object->mat = matlist;
self->object->totcol = len;
- self->object->actcol = -1;
+ self->object->actcol = len;
switch (self->object->type)
{
@@ -1993,6 +1993,8 @@ PyObject* Object_CreatePyObject (struct Object *obj)
{
BPy_Object * blen_object;
+ if (!obj) return EXPP_incr_ret (Py_None);
+
blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
if (blen_object == NULL)