Exppython:
- Fixed a problem with control of the global Python dictionary persistence:
Blender.ReleaseGlobalDict(bool) should now work fine.
- Trying to fix the sigsegv crashes on Windows:
They happen when we try to "print" our objects, like Lamps or Cameras.
Following advice from the Python Embedding doc, removed the tp_print
method from Camera and also improved its tp_repr one, that will be used
as print, repr() and str() for Cameras. If this test works all other objs
will be updated accordingly.
This commit is contained in:
@@ -50,8 +50,9 @@ PyTypeObject Camera_Type =
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)Camera_dealloc, /* tp_dealloc */
|
||||
(printfunc)Camera_print, /* tp_print */
|
||||
(getattrfunc)Camera_getAttr, /* tp_getattr */
|
||||
// (printfunc)Camera_print, /* tp_print */
|
||||
0, /* tp_print */
|
||||
(getattrfunc)Camera_getAttr, /* tp_getattr */
|
||||
(setattrfunc)Camera_setAttr, /* tp_setattr */
|
||||
(cmpfunc)Camera_compare, /* tp_compare */
|
||||
(reprfunc)Camera_repr, /* tp_repr */
|
||||
@@ -582,14 +583,14 @@ static int Camera_compare (BPy_Camera *a, BPy_Camera *b)
|
||||
Camera *pa = a->camera, *pb = b->camera;
|
||||
return (pa == pb) ? 0:-1;
|
||||
}
|
||||
|
||||
/*
|
||||
static int Camera_print(BPy_Camera *self, FILE *fp, int flags)
|
||||
{
|
||||
fprintf(fp, "[Camera \"%s\"]", self->camera->id.name+2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
static PyObject *Camera_repr (BPy_Camera *self)
|
||||
{
|
||||
return PyString_FromString(self->camera->id.name+2);
|
||||
return PyString_FromFormat("[Camera \"%s\"]", self->camera->id.name+2);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ static PyMethodDef BPy_Camera_methods[] = {
|
||||
/* Python Camera_Type callback function prototypes: */
|
||||
/*****************************************************************************/
|
||||
static void Camera_dealloc (BPy_Camera *self);
|
||||
static int Camera_print (BPy_Camera *self, FILE *fp, int flags);
|
||||
//static int Camera_print (BPy_Camera *self, FILE *fp, int flags);
|
||||
static int Camera_setAttr (BPy_Camera *self, char *name, PyObject *v);
|
||||
static int Camera_compare (BPy_Camera *a, BPy_Camera *b);
|
||||
static PyObject *Camera_getAttr (BPy_Camera *self, char *name);
|
||||
|
||||
@@ -167,6 +167,8 @@ static PyObject *M_Material_New(PyObject *self, PyObject *args,
|
||||
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
|
||||
"couldn't create Material Data in Blender"));
|
||||
|
||||
blmat->id.us = 0; /* was incref'ed by add_material() above */
|
||||
|
||||
if (pymat == NULL)
|
||||
return (EXPP_ReturnPyObjError (PyExc_MemoryError,
|
||||
"couldn't create Material Data object"));
|
||||
|
||||
@@ -15,6 +15,7 @@ Blender Python
|
||||
Submodules:
|
||||
-----------
|
||||
|
||||
- L{Material}
|
||||
- L{Camera}
|
||||
- L{Lamp}
|
||||
- L{BGL}
|
||||
|
||||
Reference in New Issue
Block a user