- More renaming all around to follow our conventions

- Implemented partially Blender.Sys
- Worked on issues related to sys, path
- Took away most "debug" printfs
This commit is contained in:
Willian Padovani Germano 2003-06-28 07:38:21 +00:00
parent 569a32a2ea
commit eaf1cdd383
44 changed files with 1147 additions and 801 deletions

View File

@ -30,6 +30,8 @@
* ***** END GPL/BL DUAL LICENSE BLOCK ***** * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/ */
extern char bprogname[]; /* holds a copy of argv[0], from creator.c */
/* Global to control whether the global dictionary should be preserved or not /* Global to control whether the global dictionary should be preserved or not
* each time a script is executed by the Python Interpreter: */ * each time a script is executed by the Python Interpreter: */
extern short EXPP_releaseGlobalDict; /* defaults to TRUE */ extern short EXPP_releaseGlobalDict; /* defaults to TRUE */
@ -61,9 +63,5 @@ void BPY_copy_scriptlink(struct ScriptLink *scriptlink);
/* format importer hook */ /* format importer hook */
int BPY_call_importloader(char *name); int BPY_call_importloader(char *name);
/* XXX The 3 functions below are implemented in Draw.c */ void init_syspath(void);
/*
int BPY_spacetext_is_pywin(struct SpaceText *st);
void BPY_spacetext_do_pywin_draw(struct SpaceText *st);
void BPY_spacetext_do_pywin_event(struct SpaceText *st, unsigned short event, short val);
*/

View File

@ -40,6 +40,8 @@
#include <MEM_guardedalloc.h> #include <MEM_guardedalloc.h>
#include <BLI_blenlib.h> /* for BLI_last_slash() */
#include <BKE_global.h> #include <BKE_global.h>
#include <BKE_main.h> #include <BKE_main.h>
#include <BKE_text.h> #include <BKE_text.h>
@ -54,6 +56,8 @@
#include <DNA_text_types.h> #include <DNA_text_types.h>
#include <DNA_world_types.h> #include <DNA_world_types.h>
#include <DNA_userdef_types.h> /* for U.pythondir */
#include "BPY_extern.h" #include "BPY_extern.h"
#include "api2_2x/EXPP_interface.h" #include "api2_2x/EXPP_interface.h"
@ -89,7 +93,7 @@ void DoAllScriptsFromList (ListBase * list, short event);
/*****************************************************************************/ /*****************************************************************************/
void BPY_start_python(void) void BPY_start_python(void)
{ {
printf ("In BPY_start_python\n"); //printf ("In BPY_start_python\n");
/* TODO: Shouldn't "blender" be replaced by PACKAGE ?? (config.h) */ /* TODO: Shouldn't "blender" be replaced by PACKAGE ?? (config.h) */
Py_SetProgramName("blender"); Py_SetProgramName("blender");
@ -97,6 +101,8 @@ void BPY_start_python(void)
initBlenderApi2_2x (); initBlenderApi2_2x ();
init_syspath();
return; /* We could take away all these return; ... */ return; /* We could take away all these return; ... */
} }
@ -105,18 +111,94 @@ void BPY_start_python(void)
/*****************************************************************************/ /*****************************************************************************/
void BPY_end_python(void) void BPY_end_python(void)
{ {
printf ("In BPY_end_python\n"); //printf ("In BPY_end_python\n");
Py_Finalize(); Py_Finalize();
return; return;
} }
void syspath_append(PyObject *dir)
{
PyObject *mod_sys, *dict, *path;
PyErr_Clear();
mod_sys = PyImport_ImportModule("sys"); /* new ref */
dict = PyModule_GetDict(mod_sys); /* borrowed ref */
path = PyDict_GetItemString(dict, "path"); /* borrowed ref */
if (!PyList_Check(path)) return;
PyList_Append(path, dir);
if (PyErr_Occurred()) Py_FatalError("could not build sys.path");
Py_DECREF(mod_sys);
}
void init_syspath(void)
{
PyObject *path;
PyObject *mod, *d;
PyObject *p;
char *c, *progname;
char execdir[FILE_MAXDIR + FILE_MAXFILE];/*defines from DNA_space_types.h*/
int n;
path = Py_BuildValue("s", bprogname);
mod = PyImport_ImportModule("Blender.sys");
if (mod) {
d = PyModule_GetDict(mod);
PyDict_SetItemString(d, "progname", path);
Py_DECREF(mod);
}
else
printf("Warning: could not set Blender.sys.progname\n");
progname = BLI_last_slash(bprogname); /* looks for the last dir separator */
c = Py_GetPath(); /* get python system path */
PySys_SetPath(c); /* initialize */
n = progname - bprogname;
if (n > 0) {
strncpy(execdir, bprogname, n);
if (execdir[n-1] == '.') n--; /*fix for when run as ./blender */
execdir[n] = '\0';
p = Py_BuildValue("s", execdir);
syspath_append(p); /* append to module search path */
/* set Blender.sys.progname */
}
else
printf ("Warning: could not determine argv[0] path\n");
if (U.pythondir) { /* XXX not working, U.pythondir is NULL here ?!?*/
/* maybe it wasn't defined yet at this point in start-up ...*/
p = Py_BuildValue("s", U.pythondir);
syspath_append(p); /* append to module search path */
}
/* set sys.executable to the Blender exe */
mod = PyImport_ImportModule("sys"); /* new ref */
if (mod) {
d = PyModule_GetDict(mod); /* borrowed ref */
PyDict_SetItemString(d, "executable", Py_BuildValue("s", bprogname));
Py_DECREF(mod);
}
}
/*****************************************************************************/ /*****************************************************************************/
/* Description: This function will return the linenumber on which an error */ /* Description: This function will return the linenumber on which an error */
/* has occurred in the Python script. */ /* has occurred in the Python script. */
/*****************************************************************************/ /*****************************************************************************/
int BPY_Err_getLinenumber(void) int BPY_Err_getLinenumber(void)
{ {
printf ("In BPY_Err_getLinenumber\n"); //printf ("In BPY_Err_getLinenumber\n");
return g_script_error.lineno; return g_script_error.lineno;
} }
@ -125,7 +207,7 @@ int BPY_Err_getLinenumber(void)
/*****************************************************************************/ /*****************************************************************************/
const char *BPY_Err_getFilename(void) const char *BPY_Err_getFilename(void)
{ {
printf ("In BPY_Err_getFilename\n"); //printf ("In BPY_Err_getFilename\n");
return g_script_error.filename; return g_script_error.filename;
} }
@ -222,7 +304,7 @@ struct _object *BPY_txt_do_python(struct SpaceText* st)
{ {
PyObject *dict, *ret; PyObject *dict, *ret;
printf ("\nIn BPY_txt_do_python\n"); //printf ("\nIn BPY_txt_do_python\n");
if (!st->text) return NULL; if (!st->text) return NULL;
@ -290,7 +372,7 @@ struct _object *BPY_txt_do_python(struct SpaceText* st)
/*****************************************************************************/ /*****************************************************************************/
void BPY_free_compiled_text(struct Text* text) void BPY_free_compiled_text(struct Text* text)
{ {
printf ("In BPY_free_compiled_text\n"); //printf ("In BPY_free_compiled_text\n");
if (!text->compiled) return; if (!text->compiled) return;
Py_DECREF((PyObject*) text->compiled); Py_DECREF((PyObject*) text->compiled);
text->compiled = NULL; text->compiled = NULL;
@ -308,7 +390,7 @@ void BPY_free_compiled_text(struct Text* text)
/*****************************************************************************/ /*****************************************************************************/
void BPY_clear_bad_scriptlinks(struct Text *byebye) void BPY_clear_bad_scriptlinks(struct Text *byebye)
{ {
printf ("In BPY_clear_bad_scriptlinks\n"); //printf ("In BPY_clear_bad_scriptlinks\n");
/* /*
BPY_clear_bad_scriptlist(getObjectList(), byebye); BPY_clear_bad_scriptlist(getObjectList(), byebye);
BPY_clear_bad_scriptlist(getLampList(), byebye); BPY_clear_bad_scriptlist(getLampList(), byebye);
@ -330,7 +412,7 @@ void BPY_clear_bad_scriptlinks(struct Text *byebye)
/*****************************************************************************/ /*****************************************************************************/
void BPY_do_all_scripts(short event) void BPY_do_all_scripts(short event)
{ {
printf ("In BPY_do_all_scripts(event=%d)\n",event); /*printf ("In BPY_do_all_scripts(event=%d)\n",event);*/
DoAllScriptsFromList (&(G.main->object), event); DoAllScriptsFromList (&(G.main->object), event);
DoAllScriptsFromList (&(G.main->lamp), event); DoAllScriptsFromList (&(G.main->lamp), event);
@ -357,7 +439,7 @@ void BPY_do_pyscript(struct ID *id, short event)
PyObject * dict; PyObject * dict;
PyObject * ret; PyObject * ret;
printf ("In BPY_do_pyscript(id=%s, event=%d)\n",id->name, event); /*printf ("In BPY_do_pyscript(id=%s, event=%d)\n",id->name, event);*/
scriptlink = setScriptLinks (id, event); scriptlink = setScriptLinks (id, event);
@ -396,7 +478,7 @@ void BPY_do_pyscript(struct ID *id, short event)
/*****************************************************************************/ /*****************************************************************************/
void BPY_free_scriptlink(struct ScriptLink *slink) void BPY_free_scriptlink(struct ScriptLink *slink)
{ {
printf ("In BPY_free_scriptlink\n"); //printf ("In BPY_free_scriptlink\n");
if (slink->totscript) { if (slink->totscript) {
if(slink->flag) MEM_freeN(slink->flag); if(slink->flag) MEM_freeN(slink->flag);
@ -414,7 +496,7 @@ void BPY_copy_scriptlink(struct ScriptLink *scriptlink)
{ {
void *tmp; void *tmp;
printf ("In BPY_copy_scriptlink\n"); //printf ("In BPY_copy_scriptlink\n");
if (scriptlink->totscript) { if (scriptlink->totscript) {

View File

@ -42,12 +42,10 @@ static PyObject *M_Armature_New(PyObject *self, PyObject *args,
char *type_str = "Armature"; char *type_str = "Armature";
char *name_str = "ArmatureData"; char *name_str = "ArmatureData";
static char *kwlist[] = {"type_str", "name_str", NULL}; static char *kwlist[] = {"type_str", "name_str", NULL};
C_Armature *py_armature; /* for Armature Data object wrapper in Python */ BPy_Armature *py_armature; /* for Armature Data object wrapper in Python */
bArmature *bl_armature; /* for actual Armature Data we create in Blender */ bArmature *bl_armature; /* for actual Armature Data we create in Blender */
char buf[21]; char buf[21];
printf ("In Armature_New()\n");
if (!PyArg_ParseTupleAndKeywords(args, keywords, "|ss", kwlist, if (!PyArg_ParseTupleAndKeywords(args, keywords, "|ss", kwlist,
&type_str, &name_str)) &type_str, &name_str))
return (EXPP_ReturnPyObjError (PyExc_AttributeError, return (EXPP_ReturnPyObjError (PyExc_AttributeError,
@ -55,7 +53,7 @@ static PyObject *M_Armature_New(PyObject *self, PyObject *args,
bl_armature = add_armature(); /* first create in Blender */ bl_armature = add_armature(); /* first create in Blender */
if (bl_armature) /* now create the wrapper obj in Python */ if (bl_armature) /* now create the wrapper obj in Python */
py_armature = (C_Armature *)PyObject_NEW(C_Armature, &Armature_Type); py_armature = (BPy_Armature *)PyObject_NEW(BPy_Armature, &Armature_Type);
else else
return (EXPP_ReturnPyObjError (PyExc_RuntimeError, return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't create Armature Data in Blender")); "couldn't create Armature Data in Blender"));
@ -85,9 +83,8 @@ static PyObject *M_Armature_Get(PyObject *self, PyObject *args)
{ {
char *name = NULL; char *name = NULL;
bArmature *armature_iter; bArmature *armature_iter;
C_Armature *wanted_armature; BPy_Armature *wanted_armature;
printf ("In Armature_Get()\n");
if (!PyArg_ParseTuple(args, "|s", &name)) if (!PyArg_ParseTuple(args, "|s", &name))
return (EXPP_ReturnPyObjError (PyExc_TypeError, return (EXPP_ReturnPyObjError (PyExc_TypeError,
"expected string argument (or nothing)")); "expected string argument (or nothing)"));
@ -102,7 +99,7 @@ static PyObject *M_Armature_Get(PyObject *self, PyObject *args)
while ((armature_iter) && (wanted_armature == NULL)) { while ((armature_iter) && (wanted_armature == NULL)) {
if (strcmp (name, armature_iter->id.name+2) == 0) { if (strcmp (name, armature_iter->id.name+2) == 0) {
wanted_armature = (C_Armature *)PyObject_NEW(C_Armature, &Armature_Type); wanted_armature = (BPy_Armature *)PyObject_NEW(BPy_Armature, &Armature_Type);
if (wanted_armature) wanted_armature->armature = armature_iter; if (wanted_armature) wanted_armature->armature = armature_iter;
} }
@ -132,7 +129,7 @@ static PyObject *M_Armature_Get(PyObject *self, PyObject *args)
"couldn't create PyList")); "couldn't create PyList"));
while (armature_iter) { while (armature_iter) {
pyobj = M_ArmatureCreatePyObject (armature_iter); pyobj = Armature_CreatePyObject (armature_iter);
if (!pyobj) if (!pyobj)
return (PythonReturnErrorObject (PyExc_MemoryError, return (PythonReturnErrorObject (PyExc_MemoryError,
@ -150,15 +147,13 @@ static PyObject *M_Armature_Get(PyObject *self, PyObject *args)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_Armature_Init */ /* Function: Armature_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Armature_Init (void) PyObject *Armature_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
PyObject *dict; PyObject *dict;
printf ("In M_Armature_Init()\n");
Armature_Type.ob_type = &PyType_Type; Armature_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.Armature", submodule = Py_InitModule3("Blender.Armature",
@ -166,15 +161,15 @@ PyObject *M_Armature_Init (void)
/* Add the Bone submodule to this module */ /* Add the Bone submodule to this module */
dict = PyModule_GetDict (submodule); dict = PyModule_GetDict (submodule);
PyDict_SetItemString (dict, "Bone", M_Bone_Init()); PyDict_SetItemString (dict, "Bone", Bone_Init());
return (submodule); return (submodule);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Armature methods: */ /* Python BPy_Armature methods: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Armature_getName(C_Armature *self) static PyObject *Armature_getName(BPy_Armature *self)
{ {
PyObject *attr = PyString_FromString(self->armature->id.name+2); PyObject *attr = PyString_FromString(self->armature->id.name+2);
@ -186,7 +181,7 @@ static PyObject *Armature_getName(C_Armature *self)
/** Create and return a list of the root bones for this armature. */ /** Create and return a list of the root bones for this armature. */
static PyObject *Armature_getBones(C_Armature *self) static PyObject *Armature_getBones(BPy_Armature *self)
{ {
int totbones = 0; int totbones = 0;
PyObject *listbones = NULL; PyObject *listbones = NULL;
@ -202,7 +197,7 @@ static PyObject *Armature_getBones(C_Armature *self)
listbones = PyList_New(totbones); listbones = PyList_New(totbones);
for (i=0; i<totbones; i++) { for (i=0; i<totbones; i++) {
/* Wrap and set to corresponding element of the list. */ /* Wrap and set to corresponding element of the list. */
PyList_SetItem(listbones, i, M_BoneCreatePyObject(current) ); PyList_SetItem(listbones, i, Bone_CreatePyObject(current) );
current = current->next; current = current->next;
} }
@ -210,7 +205,7 @@ static PyObject *Armature_getBones(C_Armature *self)
} }
static PyObject *Armature_setName(C_Armature *self, PyObject *args) static PyObject *Armature_setName(BPy_Armature *self, PyObject *args)
{ {
char *name; char *name;
char buf[21]; char buf[21];
@ -228,7 +223,7 @@ static PyObject *Armature_setName(C_Armature *self, PyObject *args)
} }
/* /*
static PyObject *Armature_setBones(C_Armature *self, PyObject *args) static PyObject *Armature_setBones(BPy_Armature *self, PyObject *args)
{ {
// TODO: Implement me! // TODO: Implement me!
printf("ERROR: Armature_setBones NOT implemented yet!\n"); printf("ERROR: Armature_setBones NOT implemented yet!\n");
@ -239,22 +234,22 @@ static PyObject *Armature_setName(C_Armature *self, PyObject *args)
*/ */
/*****************************************************************************/ /*****************************************************************************/
/* Function: ArmatureDeAlloc */ /* Function: Armature_dealloc */
/* Description: This is a callback function for the C_Armature type. It is */ /* Description: This is a callback function for the BPy_Armature type. It is */
/* the destructor function. */ /* the destructor function. */
/*****************************************************************************/ /*****************************************************************************/
static void ArmatureDeAlloc (C_Armature *self) static void Armature_dealloc (BPy_Armature *self)
{ {
PyObject_DEL (self); PyObject_DEL (self);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ArmatureGetAttr */ /* Function: Armature_getAttr */
/* Description: This is a callback function for the C_Armature type. It is */ /* Description: This is a callback function for the BPy_Armature type. It is */
/* the function that accesses C_Armature member variables and */ /* the function that accesses BPy_Armature member variables and */
/* methods. */ /* methods. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject* ArmatureGetAttr (C_Armature *self, char *name) static PyObject* Armature_getAttr (BPy_Armature *self, char *name)
{ {
PyObject *attr = Py_None; PyObject *attr = Py_None;
@ -275,17 +270,17 @@ static PyObject* ArmatureGetAttr (C_Armature *self, char *name)
if (attr != Py_None) return attr; /* member attribute found, return it */ if (attr != Py_None) return attr; /* member attribute found, return it */
/* not an attribute, search the methods table */ /* not an attribute, search the methods table */
return Py_FindMethod(C_Armature_methods, (PyObject *)self, name); return Py_FindMethod(BPy_Armature_methods, (PyObject *)self, name);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ArmatureSetAttr */ /* Function: Armature_setAttr */
/* Description: This is a callback function for the C_Armature type. It is */ /* Description: This is a callback function for the BPy_Armature type. It is */
/* the function that changes Armature Data members values. If */ /* the function that changes Armature Data members values. If */
/* this data is linked to a Blender Armature, it also gets */ /* this data is linked to a Blender Armature, it also gets */
/* updated. */ /* updated. */
/*****************************************************************************/ /*****************************************************************************/
static int ArmatureSetAttr (C_Armature *self, char *name, PyObject *value) static int Armature_setAttr (BPy_Armature *self, char *name, PyObject *value)
{ {
PyObject *valtuple; PyObject *valtuple;
PyObject *error = NULL; PyObject *error = NULL;
@ -317,50 +312,48 @@ static int ArmatureSetAttr (C_Armature *self, char *name, PyObject *value)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ArmaturePrint */ /* Function: Armature_print */
/* Description: This is a callback function for the C_Armature type. It */ /* Description: This is a callback function for the BPy_Armature type. It */
/* builds a meaninful string to 'print' armature objects. */ /* builds a meaninful string to 'print' armature objects. */
/*****************************************************************************/ /*****************************************************************************/
static int ArmaturePrint(C_Armature *self, FILE *fp, int flags) static int Armature_print(BPy_Armature *self, FILE *fp, int flags)
{ {
fprintf(fp, "[Armature \"%s\"]", self->armature->id.name+2); fprintf(fp, "[Armature \"%s\"]", self->armature->id.name+2);
return 0; return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ArmatureRepr */ /* Function: Armature_repr */
/* Description: This is a callback function for the C_Armature type. It */ /* Description: This is a callback function for the BPy_Armature type. It */
/* builds a meaninful string to represent armature objects. */ /* builds a meaninful string to represent armature objects. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *ArmatureRepr (C_Armature *self) static PyObject *Armature_repr (BPy_Armature *self)
{ {
return PyString_FromString(self->armature->id.name+2); return PyString_FromString(self->armature->id.name+2);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ArmatureCmp */ /* Function: Armature_compare */
/* Description: This is a callback function for the C_Armature type. It */ /* Description: This is a callback function for the BPy_Armature type. It */
/* compares the two armatures: translate comparison to the */ /* compares the two armatures: translate comparison to the */
/* C pointers. */ /* C pointers. */
/*****************************************************************************/ /*****************************************************************************/
static int ArmatureCmp (C_Armature *a, C_Armature *b) static int Armature_compare (BPy_Armature *a, BPy_Armature *b)
{ {
bArmature *pa = a->armature, *pb = b->armature; bArmature *pa = a->armature, *pb = b->armature;
return (pa == pb) ? 0:-1; return (pa == pb) ? 0:-1;
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_ArmatureCreatePyObject */ /* Function: Armature_CreatePyObject */
/* Description: This function will create a new BlenArmature from an */ /* Description: This function will create a new BlenArmature from an */
/* existing Armature structure. */ /* existing Armature structure. */
/*****************************************************************************/ /*****************************************************************************/
PyObject* M_ArmatureCreatePyObject (struct bArmature *obj) PyObject* Armature_CreatePyObject (struct bArmature *obj)
{ {
C_Armature * blen_armature; BPy_Armature * blen_armature;
printf ("In M_ArmatureCreatePyObject\n"); blen_armature = (BPy_Armature*)PyObject_NEW (BPy_Armature, &Armature_Type);
blen_armature = (C_Armature*)PyObject_NEW (C_Armature, &Armature_Type);
if (blen_armature == NULL) if (blen_armature == NULL)
{ {
@ -371,24 +364,24 @@ PyObject* M_ArmatureCreatePyObject (struct bArmature *obj)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_ArmatureCheckPyObject */ /* Function: Armature_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */ /* Description: This function returns true when the given PyObject is of the */
/* type Armature. Otherwise it will return false. */ /* type Armature. Otherwise it will return false. */
/*****************************************************************************/ /*****************************************************************************/
int M_ArmatureCheckPyObject (PyObject *py_obj) int Armature_CheckPyObject (PyObject *py_obj)
{ {
return (py_obj->ob_type == &Armature_Type); return (py_obj->ob_type == &Armature_Type);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_ArmatureFromPyObject */ /* Function: Armature_FromPyObject */
/* Description: This function returns the Blender armature from the given */ /* Description: This function returns the Blender armature from the given */
/* PyObject. */ /* PyObject. */
/*****************************************************************************/ /*****************************************************************************/
struct bArmature* M_ArmatureFromPyObject (PyObject *py_obj) struct bArmature* Armature_FromPyObject (PyObject *py_obj)
{ {
C_Armature * blen_obj; BPy_Armature * blen_obj;
blen_obj = (C_Armature*)py_obj; blen_obj = (BPy_Armature*)py_obj;
return (blen_obj->armature); return (blen_obj->armature);
} }

View File

@ -54,7 +54,7 @@
static PyObject *M_Armature_New (PyObject *self, PyObject *args, static PyObject *M_Armature_New (PyObject *self, PyObject *args,
PyObject *keywords); PyObject *keywords);
static PyObject *M_Armature_Get (PyObject *self, PyObject *args); static PyObject *M_Armature_Get (PyObject *self, PyObject *args);
PyObject *M_Armature_Init (void); PyObject *Armature_Init (void);
/*****************************************************************************/ /*****************************************************************************/
/* The following string definitions are used for documentation strings. */ /* The following string definitions are used for documentation strings. */
@ -92,25 +92,25 @@ struct PyMethodDef M_Armature_methods[] = {
}; };
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Armature structure definition: */ /* Python BPy_Armature structure definition: */
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
bArmature *armature; bArmature *armature;
} C_Armature; } BPy_Armature;
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Armature methods declarations: */ /* Python BPy_Armature methods declarations: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Armature_getName(C_Armature *self); static PyObject *Armature_getName(BPy_Armature *self);
static PyObject *Armature_getBones(C_Armature *self); static PyObject *Armature_getBones(BPy_Armature *self);
static PyObject *Armature_setName(C_Armature *self, PyObject *args); static PyObject *Armature_setName(BPy_Armature *self, PyObject *args);
//static PyObject *Armature_setBones(C_Armature *self, PyObject *args); //static PyObject *Armature_setBones(BPy_Armature *self, PyObject *args);
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Armature methods table: */ /* Python BPy_Armature methods table: */
/*****************************************************************************/ /*****************************************************************************/
static PyMethodDef C_Armature_methods[] = { static PyMethodDef BPy_Armature_methods[] = {
/* name, method, flags, doc */ /* name, method, flags, doc */
{"getName", (PyCFunction)Armature_getName, METH_NOARGS, {"getName", (PyCFunction)Armature_getName, METH_NOARGS,
"() - return Armature name"}, "() - return Armature name"},
@ -127,12 +127,12 @@ static PyMethodDef C_Armature_methods[] = {
/*****************************************************************************/ /*****************************************************************************/
/* Python TypeArmature callback function prototypes: */ /* Python TypeArmature callback function prototypes: */
/*****************************************************************************/ /*****************************************************************************/
static void ArmatureDeAlloc (C_Armature *armature); static void Armature_dealloc (BPy_Armature *armature);
static PyObject *ArmatureGetAttr (C_Armature *armature, char *name); static PyObject *Armature_getAttr (BPy_Armature *armature, char *name);
static int ArmatureSetAttr (C_Armature *armature, char *name, PyObject *v); static int Armature_setAttr (BPy_Armature *armature, char *name, PyObject *v);
static int ArmatureCmp (C_Armature *a1, C_Armature *a2); static int Armature_compare (BPy_Armature *a1, BPy_Armature *a2);
static PyObject *ArmatureRepr (C_Armature *armature); static PyObject *Armature_repr (BPy_Armature *armature);
static int ArmaturePrint (C_Armature *armature, FILE *fp, int flags); static int Armature_print (BPy_Armature *armature, FILE *fp, int flags);
/*****************************************************************************/ /*****************************************************************************/
/* Python TypeArmature structure definition: */ /* Python TypeArmature structure definition: */
@ -141,16 +141,16 @@ PyTypeObject Armature_Type =
{ {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /* ob_size */ 0, /* ob_size */
"Armature", /* tp_name */ "Blender Armature", /* tp_name */
sizeof (C_Armature), /* tp_basicsize */ sizeof (BPy_Armature), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
/* methods */ /* methods */
(destructor)ArmatureDeAlloc, /* tp_dealloc */ (destructor)Armature_dealloc, /* tp_dealloc */
(printfunc)ArmaturePrint, /* tp_print */ (printfunc)Armature_print, /* tp_print */
(getattrfunc)ArmatureGetAttr, /* tp_getattr */ (getattrfunc)Armature_getAttr, /* tp_getattr */
(setattrfunc)ArmatureSetAttr, /* tp_setattr */ (setattrfunc)Armature_setAttr, /* tp_setattr */
(cmpfunc)ArmatureCmp, /* tp_compare */ (cmpfunc)Armature_compare, /* tp_compare */
(reprfunc)ArmatureRepr, /* tp_repr */ (reprfunc)Armature_repr, /* tp_repr */
0, /* tp_as_number */ 0, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
0, /* tp_as_mapping */ 0, /* tp_as_mapping */
@ -158,7 +158,7 @@ PyTypeObject Armature_Type =
0,0,0,0,0,0, 0,0,0,0,0,0,
0, /* tp_doc */ 0, /* tp_doc */
0,0,0,0,0,0, 0,0,0,0,0,0,
C_Armature_methods, /* tp_methods */ BPy_Armature_methods, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
}; };

View File

@ -82,8 +82,6 @@ PyObject *Blender_Get (PyObject *self, PyObject *args)
PyObject * dict; PyObject * dict;
char * str; char * str;
printf ("In Blender_Get()\n");
if (!PyArg_ParseTuple (args, "O", &object)) if (!PyArg_ParseTuple (args, "O", &object))
{ {
/* TODO: Do we need to generate a nice error message here? */ /* TODO: Do we need to generate a nice error message here? */
@ -162,8 +160,6 @@ PyObject *Blender_Redraw(PyObject *self, PyObject *args)
int wintype = SPACE_VIEW3D; int wintype = SPACE_VIEW3D;
printf ("In Blender_Redraw()\n");
if (!PyArg_ParseTuple (args, "|i", &wintype)) if (!PyArg_ParseTuple (args, "|i", &wintype))
{ {
return EXPP_ReturnPyObjError (PyExc_TypeError, return EXPP_ReturnPyObjError (PyExc_TypeError,
@ -187,8 +183,6 @@ PyObject *Blender_Redraw(PyObject *self, PyObject *args)
/*****************************************************************************/ /*****************************************************************************/
PyObject *Blender_ReleaseGlobalDict(PyObject *self, PyObject *args) PyObject *Blender_ReleaseGlobalDict(PyObject *self, PyObject *args)
{ {
printf ("In Blender_ReleaseGlobalDict()\n");
if (!PyArg_ParseTuple (args, "|i", &EXPP_releaseGlobalDict)) if (!PyArg_ParseTuple (args, "|i", &EXPP_releaseGlobalDict))
{ {
return EXPP_ReturnPyObjError (PyExc_TypeError, return EXPP_ReturnPyObjError (PyExc_TypeError,
@ -206,7 +200,6 @@ void M_Blender_Init (void)
PyObject * module; PyObject * module;
PyObject * dict; PyObject * dict;
printf ("In M_Blender_Init()\n");
g_blenderdict = NULL; g_blenderdict = NULL;
/* TODO: create a docstring for the Blender module */ /* TODO: create a docstring for the Blender module */
@ -214,22 +207,23 @@ void M_Blender_Init (void)
dict = PyModule_GetDict (module); dict = PyModule_GetDict (module);
g_blenderdict = dict; g_blenderdict = dict;
PyDict_SetItemString (dict, "sys", sys_Init());
PyDict_SetItemString (dict, "Scene", Scene_Init()); PyDict_SetItemString (dict, "Scene", Scene_Init());
PyDict_SetItemString (dict, "Object", M_Object_Init()); PyDict_SetItemString (dict, "Object", Object_Init());
PyDict_SetItemString (dict, "Types", Types_Init()); PyDict_SetItemString (dict, "Types", Types_Init());
PyDict_SetItemString (dict, "NMesh", NMesh_Init()); PyDict_SetItemString (dict, "NMesh", NMesh_Init());
PyDict_SetItemString (dict, "Material", Material_Init()); PyDict_SetItemString (dict, "Material", Material_Init());
PyDict_SetItemString (dict, "Camera", Camera_Init()); PyDict_SetItemString (dict, "Camera", Camera_Init());
PyDict_SetItemString (dict, "Lamp", Lamp_Init()); PyDict_SetItemString (dict, "Lamp", Lamp_Init());
PyDict_SetItemString (dict, "Curve", M_Curve_Init()); PyDict_SetItemString (dict, "Curve", Curve_Init());
PyDict_SetItemString (dict, "Armature", M_Armature_Init()); PyDict_SetItemString (dict, "Armature", Armature_Init());
PyDict_SetItemString (dict, "Ipo", M_Ipo_Init()); PyDict_SetItemString (dict, "Ipo", Ipo_Init());
PyDict_SetItemString (dict, "Metaball", M_Metaball_Init()); PyDict_SetItemString (dict, "Metaball", Metaball_Init());
PyDict_SetItemString (dict, "Image", Image_Init()); PyDict_SetItemString (dict, "Image", Image_Init());
PyDict_SetItemString (dict, "Window", Window_Init()); PyDict_SetItemString (dict, "Window", Window_Init());
PyDict_SetItemString (dict, "Draw", Draw_Init()); PyDict_SetItemString (dict, "Draw", Draw_Init());
PyDict_SetItemString (dict, "BGL", BGL_Init()); PyDict_SetItemString (dict, "BGL", BGL_Init());
PyDict_SetItemString (dict, "Effect", M_Effect_Init()); PyDict_SetItemString (dict, "Effect", Effect_Init());
PyDict_SetItemString (dict, "Text", Text_Init()); PyDict_SetItemString (dict, "Text", Text_Init());
PyDict_SetItemString (dict, "World", M_World_Init()); PyDict_SetItemString (dict, "World", World_Init());
} }

View File

@ -73,32 +73,32 @@ struct PyMethodDef M_Bone_methods[] = {
}; };
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Bone methods declarations: */ /* Python BPy_Bone methods declarations: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Bone_getName(C_Bone *self); static PyObject *Bone_getName(BPy_Bone *self);
static PyObject *Bone_getRoll(C_Bone *self); static PyObject *Bone_getRoll(BPy_Bone *self);
static PyObject *Bone_getHead(C_Bone *self); static PyObject *Bone_getHead(BPy_Bone *self);
static PyObject *Bone_getTail(C_Bone *self); static PyObject *Bone_getTail(BPy_Bone *self);
static PyObject *Bone_getLoc(C_Bone *self); static PyObject *Bone_getLoc(BPy_Bone *self);
static PyObject *Bone_getSize(C_Bone *self); static PyObject *Bone_getSize(BPy_Bone *self);
static PyObject *Bone_getQuat(C_Bone *self); static PyObject *Bone_getQuat(BPy_Bone *self);
static PyObject *Bone_getParent(C_Bone *self); static PyObject *Bone_getParent(BPy_Bone *self);
static PyObject *Bone_hasParent(C_Bone *self); static PyObject *Bone_hasParent(BPy_Bone *self);
static PyObject *Bone_getChildren(C_Bone *self); static PyObject *Bone_getChildren(BPy_Bone *self);
static PyObject *Bone_setName(C_Bone *self, PyObject *args); static PyObject *Bone_setName(BPy_Bone *self, PyObject *args);
static PyObject *Bone_setRoll(C_Bone *self, PyObject *args); static PyObject *Bone_setRoll(BPy_Bone *self, PyObject *args);
static PyObject *Bone_setHead(C_Bone *self, PyObject *args); static PyObject *Bone_setHead(BPy_Bone *self, PyObject *args);
static PyObject *Bone_setTail(C_Bone *self, PyObject *args); static PyObject *Bone_setTail(BPy_Bone *self, PyObject *args);
static PyObject *Bone_setLoc(C_Bone *self, PyObject *args); static PyObject *Bone_setLoc(BPy_Bone *self, PyObject *args);
static PyObject *Bone_setSize(C_Bone *self, PyObject *args); static PyObject *Bone_setSize(BPy_Bone *self, PyObject *args);
static PyObject *Bone_setQuat(C_Bone *self, PyObject *args); static PyObject *Bone_setQuat(BPy_Bone *self, PyObject *args);
//static PyObject *Bone_setParent(C_Bone *self, PyObject *args); //static PyObject *Bone_setParent(BPy_Bone *self, PyObject *args);
//static PyObject *Bone_setChildren(C_Bone *self, PyObject *args); //static PyObject *Bone_setChildren(BPy_Bone *self, PyObject *args);
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Bone methods table: */ /* Python BPy_Bone methods table: */
/*****************************************************************************/ /*****************************************************************************/
static PyMethodDef C_Bone_methods[] = { static PyMethodDef BPy_Bone_methods[] = {
/* name, method, flags, doc */ /* name, method, flags, doc */
{"getName", (PyCFunction)Bone_getName, METH_NOARGS, "() - return Bone name"}, {"getName", (PyCFunction)Bone_getName, METH_NOARGS, "() - return Bone name"},
{"getRoll", (PyCFunction)Bone_getRoll, METH_NOARGS, "() - return Bone roll"}, {"getRoll", (PyCFunction)Bone_getRoll, METH_NOARGS, "() - return Bone roll"},
@ -136,12 +136,12 @@ static PyMethodDef C_Bone_methods[] = {
/*****************************************************************************/ /*****************************************************************************/
/* Python TypeBone callback function prototypes: */ /* Python TypeBone callback function prototypes: */
/*****************************************************************************/ /*****************************************************************************/
static void BoneDeAlloc (C_Bone *bone); static void Bone_dealloc (BPy_Bone *bone);
static PyObject *BoneGetAttr (C_Bone *bone, char *name); static PyObject *Bone_getAttr (BPy_Bone *bone, char *name);
static int BoneSetAttr (C_Bone *bone, char *name, PyObject *v); static int Bone_setAttr (BPy_Bone *bone, char *name, PyObject *v);
static int BoneCmp (C_Bone *a1, C_Bone *a2); static int Bone_compare (BPy_Bone *a1, BPy_Bone *a2);
static PyObject *BoneRepr (C_Bone *bone); static PyObject *Bone_repr (BPy_Bone *bone);
static int BonePrint (C_Bone *bone, FILE *fp, int flags); static int Bone_print (BPy_Bone *bone, FILE *fp, int flags);
/*****************************************************************************/ /*****************************************************************************/
/* Python TypeBone structure definition: */ /* Python TypeBone structure definition: */
@ -150,16 +150,16 @@ PyTypeObject Bone_Type =
{ {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /* ob_size */ 0, /* ob_size */
"Bone", /* tp_name */ "Blender Bone", /* tp_name */
sizeof (C_Bone), /* tp_basicsize */ sizeof (BPy_Bone), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
/* methods */ /* methods */
(destructor)BoneDeAlloc, /* tp_dealloc */ (destructor)Bone_dealloc, /* tp_dealloc */
(printfunc)BonePrint, /* tp_print */ (printfunc)Bone_print, /* tp_print */
(getattrfunc)BoneGetAttr, /* tp_getattr */ (getattrfunc)Bone_getAttr, /* tp_getattr */
(setattrfunc)BoneSetAttr, /* tp_setattr */ (setattrfunc)Bone_setAttr, /* tp_setattr */
(cmpfunc)BoneCmp, /* tp_compare */ (cmpfunc)Bone_compare, /* tp_compare */
(reprfunc)BoneRepr, /* tp_repr */ (reprfunc)Bone_repr, /* tp_repr */
0, /* tp_as_number */ 0, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
0, /* tp_as_mapping */ 0, /* tp_as_mapping */
@ -167,7 +167,7 @@ PyTypeObject Bone_Type =
0,0,0,0,0,0, 0,0,0,0,0,0,
0, /* tp_doc */ 0, /* tp_doc */
0,0,0,0,0,0, 0,0,0,0,0,0,
C_Bone_methods, /* tp_methods */ BPy_Bone_methods, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
}; };
@ -181,11 +181,9 @@ PyTypeObject Bone_Type =
static PyObject *M_Bone_New(PyObject *self, PyObject *args, PyObject *keywords) static PyObject *M_Bone_New(PyObject *self, PyObject *args, PyObject *keywords)
{ {
char *name_str = "BoneName"; char *name_str = "BoneName";
C_Bone *py_bone = NULL; /* for Bone Data object wrapper in Python */ BPy_Bone *py_bone = NULL; /* for Bone Data object wrapper in Python */
Bone *bl_bone = NULL; /* for actual Bone Data we create in Blender */ Bone *bl_bone = NULL; /* for actual Bone Data we create in Blender */
printf ("In Bone_New()\n");
if (!PyArg_ParseTuple(args, "|s", &name_str)) if (!PyArg_ParseTuple(args, "|s", &name_str))
return (EXPP_ReturnPyObjError (PyExc_AttributeError, return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected string or empty argument")); "expected string or empty argument"));
@ -195,7 +193,7 @@ static PyObject *M_Bone_New(PyObject *self, PyObject *args, PyObject *keywords)
strncpy(bl_bone->name,name_str,sizeof(bl_bone->name)); strncpy(bl_bone->name,name_str,sizeof(bl_bone->name));
if (bl_bone) /* now create the wrapper obj in Python */ if (bl_bone) /* now create the wrapper obj in Python */
py_bone = (C_Bone *)PyObject_NEW(C_Bone, &Bone_Type); py_bone = (BPy_Bone *)PyObject_NEW(BPy_Bone, &Bone_Type);
else else
return (EXPP_ReturnPyObjError (PyExc_RuntimeError, return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't create Bone Data in Blender")); "couldn't create Bone Data in Blender"));
@ -218,16 +216,14 @@ static PyObject *M_Bone_New(PyObject *self, PyObject *args, PyObject *keywords)
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_Bone_Init */ /* Function: Bone_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Bone_Init (void) PyObject *Bone_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
Bone_Type.ob_type = &PyType_Type; Bone_Type.ob_type = &PyType_Type;
printf ("In M_Bone_Init()\n");
submodule = Py_InitModule3("Blender.Armature.Bone", submodule = Py_InitModule3("Blender.Armature.Bone",
M_Bone_methods, M_Bone_doc); M_Bone_methods, M_Bone_doc);
@ -235,9 +231,9 @@ PyObject *M_Bone_Init (void)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Bone methods: */ /* Python BPy_Bone methods: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Bone_getName(C_Bone *self) static PyObject *Bone_getName(BPy_Bone *self)
{ {
PyObject *attr=NULL; PyObject *attr=NULL;
@ -253,7 +249,7 @@ static PyObject *Bone_getName(C_Bone *self)
} }
static PyObject *Bone_getRoll(C_Bone *self) static PyObject *Bone_getRoll(BPy_Bone *self)
{ {
PyObject *attr=NULL; PyObject *attr=NULL;
@ -269,7 +265,7 @@ static PyObject *Bone_getRoll(C_Bone *self)
} }
static PyObject *Bone_getHead(C_Bone *self) static PyObject *Bone_getHead(BPy_Bone *self)
{ {
PyObject *attr=NULL; PyObject *attr=NULL;
@ -286,7 +282,7 @@ static PyObject *Bone_getHead(C_Bone *self)
} }
static PyObject *Bone_getTail(C_Bone *self) static PyObject *Bone_getTail(BPy_Bone *self)
{ {
PyObject *attr=NULL; PyObject *attr=NULL;
@ -303,7 +299,7 @@ static PyObject *Bone_getTail(C_Bone *self)
} }
static PyObject *Bone_getLoc (C_Bone *self) static PyObject *Bone_getLoc (BPy_Bone *self)
{ {
PyObject *attr=NULL; PyObject *attr=NULL;
@ -320,7 +316,7 @@ static PyObject *Bone_getLoc (C_Bone *self)
} }
static PyObject *Bone_getSize(C_Bone *self) static PyObject *Bone_getSize(BPy_Bone *self)
{ {
PyObject *attr=NULL; PyObject *attr=NULL;
@ -337,7 +333,7 @@ static PyObject *Bone_getSize(C_Bone *self)
} }
static PyObject *Bone_getQuat(C_Bone *self) static PyObject *Bone_getQuat(BPy_Bone *self)
{ {
PyObject *attr=NULL; PyObject *attr=NULL;
@ -354,14 +350,14 @@ static PyObject *Bone_getQuat(C_Bone *self)
} }
static PyObject *Bone_hasParent(C_Bone *self) static PyObject *Bone_hasParent(BPy_Bone *self)
{ {
if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError, if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get attribute from a NULL bone")); "couldn't get attribute from a NULL bone"));
/* /*
return M_BoneCreatePyObject(self->bone->parent); return Bone_CreatePyObject(self->bone->parent);
*/ */
if (self->bone->parent) if (self->bone->parent)
{ {
@ -377,13 +373,13 @@ static PyObject *Bone_hasParent(C_Bone *self)
} }
static PyObject *Bone_getParent(C_Bone *self) static PyObject *Bone_getParent(BPy_Bone *self)
{ {
if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError, if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get attribute from a NULL bone")); "couldn't get attribute from a NULL bone"));
if (self->bone->parent) return M_BoneCreatePyObject(self->bone->parent); if (self->bone->parent) return Bone_CreatePyObject(self->bone->parent);
else /*(EXPP_ReturnPyObjError (PyExc_RuntimeError, else /*(EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get parent bone, because bone hasn't got a parent."));*/ "couldn't get parent bone, because bone hasn't got a parent."));*/
{ {
@ -394,7 +390,7 @@ static PyObject *Bone_getParent(C_Bone *self)
} }
static PyObject *Bone_getChildren(C_Bone *self) static PyObject *Bone_getChildren(BPy_Bone *self)
{ {
int totbones = 0; int totbones = 0;
Bone* current = NULL; Bone* current = NULL;
@ -413,7 +409,7 @@ static PyObject *Bone_getChildren(C_Bone *self)
listbones = PyList_New(totbones); listbones = PyList_New(totbones);
for (i=0; i<totbones; i++) { for (i=0; i<totbones; i++) {
assert(current); assert(current);
PyList_SetItem(listbones, i, M_BoneCreatePyObject(current)); PyList_SetItem(listbones, i, Bone_CreatePyObject(current));
current = current->next; current = current->next;
} }
@ -421,7 +417,7 @@ static PyObject *Bone_getChildren(C_Bone *self)
} }
static PyObject *Bone_setName(C_Bone *self, PyObject *args) static PyObject *Bone_setName(BPy_Bone *self, PyObject *args)
{ {
char *name; char *name;
@ -439,7 +435,7 @@ static PyObject *Bone_setName(C_Bone *self, PyObject *args)
} }
PyObject *Bone_setRoll(C_Bone *self, PyObject *args) PyObject *Bone_setRoll(BPy_Bone *self, PyObject *args)
{ {
float roll; float roll;
@ -457,7 +453,7 @@ PyObject *Bone_setRoll(C_Bone *self, PyObject *args)
} }
static PyObject *Bone_setHead(C_Bone *self, PyObject *args) static PyObject *Bone_setHead(BPy_Bone *self, PyObject *args)
{ {
float f1,f2,f3; float f1,f2,f3;
@ -477,7 +473,7 @@ static PyObject *Bone_setHead(C_Bone *self, PyObject *args)
} }
static PyObject *Bone_setTail(C_Bone *self, PyObject *args) static PyObject *Bone_setTail(BPy_Bone *self, PyObject *args)
{ {
float f1,f2,f3; float f1,f2,f3;
@ -497,7 +493,7 @@ static PyObject *Bone_setTail(C_Bone *self, PyObject *args)
} }
static PyObject *Bone_setLoc(C_Bone *self, PyObject *args) static PyObject *Bone_setLoc(BPy_Bone *self, PyObject *args)
{ {
float f1,f2,f3; float f1,f2,f3;
@ -517,7 +513,7 @@ static PyObject *Bone_setLoc(C_Bone *self, PyObject *args)
} }
static PyObject *Bone_setSize(C_Bone *self, PyObject *args) static PyObject *Bone_setSize(BPy_Bone *self, PyObject *args)
{ {
float f1,f2,f3; float f1,f2,f3;
@ -537,7 +533,7 @@ static PyObject *Bone_setSize(C_Bone *self, PyObject *args)
} }
static PyObject *Bone_setQuat(C_Bone *self, PyObject *args) static PyObject *Bone_setQuat(BPy_Bone *self, PyObject *args)
{ {
float f1,f2,f3,f4; float f1,f2,f3,f4;
@ -559,22 +555,22 @@ static PyObject *Bone_setQuat(C_Bone *self, PyObject *args)
/*****************************************************************************/ /*****************************************************************************/
/* Function: BoneDeAlloc */ /* Function: Bone_dealloc */
/* Description: This is a callback function for the C_Bone type. It is */ /* Description: This is a callback function for the BPy_Bone type. It is */
/* the destructor function. */ /* the destructor function. */
/*****************************************************************************/ /*****************************************************************************/
static void BoneDeAlloc (C_Bone *self) static void Bone_dealloc (BPy_Bone *self)
{ {
PyObject_DEL (self); PyObject_DEL (self);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: BoneGetAttr */ /* Function: Bone_getAttr */
/* Description: This is a callback function for the C_Bone type. It is */ /* Description: This is a callback function for the BPy_Bone type. It is */
/* the function that accesses C_Bone member variables and */ /* the function that accesses BPy_Bone member variables and */
/* methods. */ /* methods. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject* BoneGetAttr (C_Bone *self, char *name) static PyObject* Bone_getAttr (BPy_Bone *self, char *name)
{ {
PyObject *attr = Py_None; PyObject *attr = Py_None;
@ -611,16 +607,16 @@ static PyObject* BoneGetAttr (C_Bone *self, char *name)
if (attr != Py_None) return attr; /* member attribute found, return it */ if (attr != Py_None) return attr; /* member attribute found, return it */
/* not an attribute, search the methods table */ /* not an attribute, search the methods table */
return Py_FindMethod(C_Bone_methods, (PyObject *)self, name); return Py_FindMethod(BPy_Bone_methods, (PyObject *)self, name);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: BoneSetAttr */ /* Function: Bone_setAttr */
/* Description: This is a callback function for the C_Bone type. It is the */ /* Description: This is a callback function for the BPy_Bone type. It is the */
/* function that changes Bone Data members values. If this */ /* function that changes Bone Data members values. If this */
/* data is linked to a Blender Bone, it also gets updated. */ /* data is linked to a Blender Bone, it also gets updated. */
/*****************************************************************************/ /*****************************************************************************/
static int BoneSetAttr (C_Bone *self, char *name, PyObject *value) static int Bone_setAttr (BPy_Bone *self, char *name, PyObject *value)
{ {
PyObject *valtuple; PyObject *valtuple;
PyObject *error = NULL; PyObject *error = NULL;
@ -650,11 +646,11 @@ static int BoneSetAttr (C_Bone *self, char *name, PyObject *value)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: BonePrint */ /* Function: Bone_print */
/* Description: This is a callback function for the C_Bone type. It */ /* Description: This is a callback function for the BPy_Bone type. It */
/* builds a meaninful string to 'print' bone objects. */ /* builds a meaninful string to 'print' bone objects. */
/*****************************************************************************/ /*****************************************************************************/
static int BonePrint(C_Bone *self, FILE *fp, int flags) static int Bone_print(BPy_Bone *self, FILE *fp, int flags)
{ {
if (self->bone) fprintf(fp, "[Bone \"%s\"]", self->bone->name); if (self->bone) fprintf(fp, "[Bone \"%s\"]", self->bone->name);
else fprintf(fp, "[Bone NULL]"); else fprintf(fp, "[Bone NULL]");
@ -662,23 +658,23 @@ static int BonePrint(C_Bone *self, FILE *fp, int flags)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: BoneRepr */ /* Function: Bone_repr */
/* Description: This is a callback function for the C_Bone type. It */ /* Description: This is a callback function for the BPy_Bone type. It */
/* builds a meaninful string to represent bone objects. */ /* builds a meaninful string to represent bone objects. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *BoneRepr (C_Bone *self) static PyObject *Bone_repr (BPy_Bone *self)
{ {
if (self->bone) return PyString_FromString(self->bone->name); if (self->bone) return PyString_FromString(self->bone->name);
else return PyString_FromString("NULL"); else return PyString_FromString("NULL");
} }
/**************************************************************************/ /**************************************************************************/
/* Function: BoneCmp */ /* Function: Bone_compare */
/* Description: This is a callback function for the C_Bone type. It */ /* Description: This is a callback function for the BPy_Bone type. It */
/* compares the two bones: translate comparison to the */ /* compares the two bones: translate comparison to the */
/* C pointers. */ /* C pointers. */
/**************************************************************************/ /**************************************************************************/
static int BoneCmp (C_Bone *a, C_Bone *b) static int Bone_compare (BPy_Bone *a, BPy_Bone *b)
{ {
Bone *pa = a->bone, *pb = b->bone; Bone *pa = a->bone, *pb = b->bone;
return (pa == pb) ? 0:-1; return (pa == pb) ? 0:-1;
@ -688,17 +684,15 @@ static int BoneCmp (C_Bone *a, C_Bone *b)
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_BoneCreatePyObject */ /* Function: Bone_CreatePyObject */
/* Description: This function will create a new BlenBone from an existing */ /* Description: This function will create a new BlenBone from an existing */
/* Bone structure. */ /* Bone structure. */
/*****************************************************************************/ /*****************************************************************************/
PyObject* M_BoneCreatePyObject (struct Bone *obj) PyObject* Bone_CreatePyObject (struct Bone *obj)
{ {
C_Bone * blen_bone; BPy_Bone * blen_bone;
printf (" In M_BoneCreatePyObject\n"); blen_bone = (BPy_Bone*)PyObject_NEW (BPy_Bone, &Bone_Type);
blen_bone = (C_Bone*)PyObject_NEW (C_Bone, &Bone_Type);
if (blen_bone == NULL) if (blen_bone == NULL)
{ {
@ -709,24 +703,24 @@ PyObject* M_BoneCreatePyObject (struct Bone *obj)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_BoneCheckPyObject */ /* Function: Bone_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */ /* Description: This function returns true when the given PyObject is of the */
/* type Bone. Otherwise it will return false. */ /* type Bone. Otherwise it will return false. */
/*****************************************************************************/ /*****************************************************************************/
int M_BoneCheckPyObject (PyObject *py_obj) int Bone_CheckPyObject (PyObject *py_obj)
{ {
return (py_obj->ob_type == &Bone_Type); return (py_obj->ob_type == &Bone_Type);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_BoneFromPyObject */ /* Function: Bone_FromPyObject */
/* Description: This function returns the Blender bone from the given */ /* Description: This function returns the Blender bone from the given */
/* PyObject. */ /* PyObject. */
/*****************************************************************************/ /*****************************************************************************/
struct Bone* M_BoneFromPyObject (PyObject *py_obj) struct Bone* Bone_FromPyObject (PyObject *py_obj)
{ {
C_Bone * blen_obj; BPy_Bone * blen_obj;
blen_obj = (C_Bone*)py_obj; blen_obj = (BPy_Bone*)py_obj;
return (blen_obj->bone); return (blen_obj->bone);
} }

View File

@ -37,18 +37,18 @@
#include <DNA_armature_types.h> #include <DNA_armature_types.h>
/** Bone module initialization function. */ /** Bone module initialization function. */
PyObject *M_Bone_Init (void); PyObject *Bone_Init (void);
/** Python C_Bone structure definition. */ /** Python BPy_Bone structure definition. */
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
Bone *bone; Bone *bone;
} C_Bone; } BPy_Bone;
PyObject* M_BoneCreatePyObject (struct Bone *obj); PyObject* Bone_CreatePyObject (struct Bone *obj);
int M_BoneCheckPyObject (PyObject *py_obj); int Bone_CheckPyObject (PyObject *py_obj);
Bone* M_BoneFromPyObject (PyObject *py_obj); Bone* Bone_FromPyObject (PyObject *py_obj);
#endif #endif

View File

@ -152,12 +152,12 @@ struct PyMethodDef M_Build_methods[] = {
}; };
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_Build_Init */ /* Function: Build_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Build_Init (void) PyObject *Build_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
printf ("In M_Build_Init()\n");
Build_Type.ob_type = &PyType_Type; Build_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.Build",M_Build_methods,M_Build_doc ); submodule = Py_InitModule3("Blender.Build",M_Build_methods,M_Build_doc );
return (submodule); return (submodule);

View File

@ -49,12 +49,12 @@ PyTypeObject Camera_Type =
sizeof (BPy_Camera), /* tp_basicsize */ sizeof (BPy_Camera), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
/* methods */ /* methods */
(destructor)Camera_DeAlloc, /* tp_dealloc */ (destructor)Camera_dealloc, /* tp_dealloc */
(printfunc)Camera_Print, /* tp_print */ (printfunc)Camera_print, /* tp_print */
(getattrfunc)Camera_GetAttr, /* tp_getattr */ (getattrfunc)Camera_getAttr, /* tp_getattr */
(setattrfunc)Camera_SetAttr, /* tp_setattr */ (setattrfunc)Camera_setAttr, /* tp_setattr */
(cmpfunc)Camera_Compare, /* tp_compare */ (cmpfunc)Camera_compare, /* tp_compare */
(reprfunc)Camera_Repr, /* tp_repr */ (reprfunc)Camera_repr, /* tp_repr */
0, /* tp_as_number */ 0, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
0, /* tp_as_mapping */ 0, /* tp_as_mapping */
@ -183,8 +183,6 @@ PyObject *Camera_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
printf ("In M_Camera_Init()\n");
Camera_Type.ob_type = &PyType_Type; Camera_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.Camera", submodule = Py_InitModule3("Blender.Camera",
@ -470,12 +468,12 @@ static PyObject *Camera_setDrawSize(BPy_Camera *self, PyObject *args)
return Py_None; return Py_None;
} }
static void Camera_DeAlloc (BPy_Camera *self) static void Camera_dealloc (BPy_Camera *self)
{ {
PyObject_DEL (self); PyObject_DEL (self);
} }
static PyObject *Camera_GetAttr (BPy_Camera *self, char *name) static PyObject *Camera_getAttr (BPy_Camera *self, char *name)
{ {
PyObject *attr = Py_None; PyObject *attr = Py_None;
@ -520,7 +518,7 @@ static PyObject *Camera_GetAttr (BPy_Camera *self, char *name)
return Py_FindMethod(BPy_Camera_methods, (PyObject *)self, name); return Py_FindMethod(BPy_Camera_methods, (PyObject *)self, name);
} }
static int Camera_SetAttr (BPy_Camera *self, char *name, PyObject *value) static int Camera_setAttr (BPy_Camera *self, char *name, PyObject *value)
{ {
PyObject *valtuple; PyObject *valtuple;
PyObject *error = NULL; PyObject *error = NULL;
@ -579,19 +577,19 @@ static int Camera_SetAttr (BPy_Camera *self, char *name, PyObject *value)
return 0; /* normal exit */ return 0; /* normal exit */
} }
static int Camera_Compare (BPy_Camera *a, BPy_Camera *b) static int Camera_compare (BPy_Camera *a, BPy_Camera *b)
{ {
Camera *pa = a->camera, *pb = b->camera; Camera *pa = a->camera, *pb = b->camera;
return (pa == pb) ? 0:-1; return (pa == pb) ? 0:-1;
} }
static int Camera_Print(BPy_Camera *self, FILE *fp, int flags) static int Camera_print(BPy_Camera *self, FILE *fp, int flags)
{ {
fprintf(fp, "[Camera \"%s\"]", self->camera->id.name+2); fprintf(fp, "[Camera \"%s\"]", self->camera->id.name+2);
return 0; return 0;
} }
static PyObject *Camera_Repr (BPy_Camera *self) static PyObject *Camera_repr (BPy_Camera *self)
{ {
return PyString_FromString(self->camera->id.name+2); return PyString_FromString(self->camera->id.name+2);
} }

View File

@ -173,12 +173,12 @@ static PyMethodDef BPy_Camera_methods[] = {
/*****************************************************************************/ /*****************************************************************************/
/* Python Camera_Type callback function prototypes: */ /* Python Camera_Type callback function prototypes: */
/*****************************************************************************/ /*****************************************************************************/
static void Camera_DeAlloc (BPy_Camera *self); 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_setAttr (BPy_Camera *self, char *name, PyObject *v);
static int Camera_Compare (BPy_Camera *a, BPy_Camera *b); static int Camera_compare (BPy_Camera *a, BPy_Camera *b);
static PyObject *Camera_GetAttr (BPy_Camera *self, char *name); static PyObject *Camera_getAttr (BPy_Camera *self, char *name);
static PyObject *Camera_Repr (BPy_Camera *self); static PyObject *Camera_repr (BPy_Camera *self);
#endif /* EXPP_CAMERA_H */ #endif /* EXPP_CAMERA_H */

View File

@ -43,7 +43,6 @@ static PyObject *M_Curve_New(PyObject *self, PyObject *args)
BPy_Curve *pycurve; /* for Curve Data object wrapper in Python */ BPy_Curve *pycurve; /* for Curve Data object wrapper in Python */
Curve *blcurve = 0; /* for actual Curve Data we create in Blender */ Curve *blcurve = 0; /* for actual Curve Data we create in Blender */
printf ("In Curve_New()\n");
if (!PyArg_ParseTuple(args, "|s", &name)) if (!PyArg_ParseTuple(args, "|s", &name))
return (EXPP_ReturnPyObjError (PyExc_AttributeError, return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected string argument or no argument")); "expected string argument or no argument"));
@ -81,7 +80,6 @@ static PyObject *M_Curve_Get(PyObject *self, PyObject *args)
Curve *curv_iter; Curve *curv_iter;
BPy_Curve *wanted_curv; BPy_Curve *wanted_curv;
printf ("In Curve_Get()\n");
if (!PyArg_ParseTuple(args, "|s", &name))//expects nothing or a string if (!PyArg_ParseTuple(args, "|s", &name))//expects nothing or a string
return (EXPP_ReturnPyObjError (PyExc_AttributeError, return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected string argument")); "expected string argument"));
@ -133,12 +131,11 @@ BPy_Curve *found_cur=(BPy_Curve*)PyObject_NEW(BPy_Curve,&Curve_Type);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_Curve_Init */ /* Function: Curve_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Curve_Init (void) PyObject *Curve_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
printf ("In M_Curve_Init()\n");
Curve_Type.ob_type = &PyType_Type; Curve_Type.ob_type = &PyType_Type;
@ -677,8 +674,6 @@ PyObject* CurveCreatePyObject (struct Curve *curve)
{ {
BPy_Curve * blen_object; BPy_Curve * blen_object;
printf ("In CurveCreatePyObject\n");
blen_object = (BPy_Curve*)PyObject_NEW (BPy_Curve, &Curve_Type); blen_object = (BPy_Curve*)PyObject_NEW (BPy_Curve, &Curve_Type);
if (blen_object == NULL) if (blen_object == NULL)

View File

@ -283,7 +283,6 @@ static PyObject *Method_Draw (PyObject *self, PyObject *args)
{ {
/*@ If forced drawing is disable queue a redraw event instead */ /*@ If forced drawing is disable queue a redraw event instead */
if (EXPP_disable_force_draw) { if (EXPP_disable_force_draw) {
printf ("\nEXPP_disable_force_draw\n");
scrarea_queue_winredraw(curarea); scrarea_queue_winredraw(curarea);
return EXPP_incr_ret (Py_None); return EXPP_incr_ret (Py_None);
} }
@ -656,8 +655,6 @@ PyObject *Draw_Init (void)
{ {
PyObject *submodule, *dict; PyObject *submodule, *dict;
printf("In M_Draw_Init()\n");
Button_Type.ob_type = &PyType_Type; Button_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.Draw", Draw_methods, Draw_doc); submodule = Py_InitModule3("Blender.Draw", Draw_methods, Draw_doc);

View File

@ -49,7 +49,7 @@
void initBlenderApi2_2x (void) void initBlenderApi2_2x (void)
{ {
printf ("initBlenderApi2_2x\n"); //printf ("initBlenderApi2_2x\n");
g_blenderdict = NULL; g_blenderdict = NULL;
M_Blender_Init (); M_Blender_Init ();
} }
@ -73,7 +73,7 @@ ScriptLink * setScriptLinks(ID *id, short event)
int obj_id; int obj_id;
obj_id = MAKE_ID2 (id->name[0], id->name[1]); obj_id = MAKE_ID2 (id->name[0], id->name[1]);
printf ("In setScriptLinks (id=%s, event=%d)\n",id->name, event); //printf ("In setScriptLinks (id=%s, event=%d)\n",id->name, event);
switch (obj_id) switch (obj_id)
{ {
@ -83,7 +83,7 @@ ScriptLink * setScriptLinks(ID *id, short event)
{ {
return NULL; return NULL;
} }
link = M_ObjectCreatePyObject (object); link = Object_CreatePyObject (object);
scriptlink = &(object->scriptlink); scriptlink = &(object->scriptlink);
break; break;
case ID_LA: case ID_LA:

View File

@ -148,24 +148,25 @@ PyObject * effectlist = PyList_New (0);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_Effect_Init */ /* Function: Effect_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Build_Init (void); PyObject *Build_Init (void);
PyObject *M_Wave_Init (void); PyObject *Wave_Init (void);
PyObject *M_Particle_Init (void); PyObject *Particle_Init (void);
PyObject *M_Effect_Init (void) PyObject *Effect_Init (void)
{ {
PyObject *submodule, *dict; PyObject *submodule, *dict;
printf ("In M_Effect_Init()\n");
Effect_Type.ob_type = &PyType_Type; Effect_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.Effect",M_Effect_methods, 0 ); submodule = Py_InitModule3("Blender.Effect",M_Effect_methods, 0 );
dict = PyModule_GetDict (submodule); dict = PyModule_GetDict (submodule);
PyDict_SetItemString (dict, "Wave", M_Wave_Init()); PyDict_SetItemString (dict, "Wave", Wave_Init());
PyDict_SetItemString (dict, "Build", M_Build_Init()); PyDict_SetItemString (dict, "Build", Build_Init());
PyDict_SetItemString (dict, "Particle", M_Particle_Init()); PyDict_SetItemString (dict, "Particle", Particle_Init());
return (submodule); return (submodule);
} }
@ -297,8 +298,6 @@ PyObject* EffectCreatePyObject (struct Effect *effect)
{ {
BPy_Effect * blen_object; BPy_Effect * blen_object;
printf ("In EffectCreatePyObject\n");
blen_object = (BPy_Effect*)PyObject_NEW (BPy_Effect, &Effect_Type); blen_object = (BPy_Effect*)PyObject_NEW (BPy_Effect, &Effect_Type);
if (blen_object == NULL) if (blen_object == NULL)

View File

@ -40,7 +40,7 @@
#include "Image.h" #include "Image.h"
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Image defaults: */ /* Python BPy_Image defaults: */
/*****************************************************************************/ /*****************************************************************************/
#define EXPP_IMAGE_REP 1 #define EXPP_IMAGE_REP 1
#define EXPP_IMAGE_REP_MIN 1 #define EXPP_IMAGE_REP_MIN 1
@ -124,11 +124,11 @@ static PyObject *M_Image_Get(PyObject *self, PyObject *args)
if (name) { /* (name) - Search image by name */ if (name) { /* (name) - Search image by name */
C_Image *wanted_image = NULL; BPy_Image *wanted_image = NULL;
while ((img_iter) && (wanted_image == NULL)) { while ((img_iter) && (wanted_image == NULL)) {
if (strcmp (name, img_iter->id.name+2) == 0) { if (strcmp (name, img_iter->id.name+2) == 0) {
wanted_image = (C_Image *)PyObject_NEW(C_Image, &Image_Type); wanted_image = (BPy_Image *)PyObject_NEW(BPy_Image, &Image_Type);
if (wanted_image) wanted_image->image = img_iter; if (wanted_image) wanted_image->image = img_iter;
} }
img_iter = img_iter->id.next; img_iter = img_iter->id.next;
@ -181,13 +181,13 @@ static PyObject *M_Image_Load(PyObject *self, PyObject *args)
{ {
char *fname; char *fname;
Image *img_ptr; Image *img_ptr;
C_Image *img; BPy_Image *img;
if (!PyArg_ParseTuple(args, "s", &fname)) if (!PyArg_ParseTuple(args, "s", &fname))
return (EXPP_ReturnPyObjError (PyExc_TypeError, return (EXPP_ReturnPyObjError (PyExc_TypeError,
"expected string argument")); "expected string argument"));
img = (C_Image *)PyObject_NEW(C_Image, &Image_Type); img = (BPy_Image *)PyObject_NEW(BPy_Image, &Image_Type);
if (!img) if (!img)
return (EXPP_ReturnPyObjError (PyExc_MemoryError, return (EXPP_ReturnPyObjError (PyExc_MemoryError,
@ -222,18 +222,18 @@ PyObject *Image_Init (void)
/************************/ /************************/
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Image methods declarations: */ /* Python BPy_Image methods declarations: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Image_getName(C_Image *self); static PyObject *Image_getName(BPy_Image *self);
static PyObject *Image_getFilename(C_Image *self); static PyObject *Image_getFilename(BPy_Image *self);
static PyObject *Image_setName(C_Image *self, PyObject *args); static PyObject *Image_setName(BPy_Image *self, PyObject *args);
static PyObject *Image_setXRep(C_Image *self, PyObject *args); static PyObject *Image_setXRep(BPy_Image *self, PyObject *args);
static PyObject *Image_setYRep(C_Image *self, PyObject *args); static PyObject *Image_setYRep(BPy_Image *self, PyObject *args);
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Image methods table: */ /* Python BPy_Image methods table: */
/*****************************************************************************/ /*****************************************************************************/
static PyMethodDef C_Image_methods[] = { static PyMethodDef BPy_Image_methods[] = {
/* name, method, flags, doc */ /* name, method, flags, doc */
{"getName", (PyCFunction)Image_getName, METH_NOARGS, {"getName", (PyCFunction)Image_getName, METH_NOARGS,
"() - Return Image Data name"}, "() - Return Image Data name"},
@ -251,12 +251,12 @@ static PyMethodDef C_Image_methods[] = {
/*****************************************************************************/ /*****************************************************************************/
/* Python Image_Type callback function prototypes: */ /* Python Image_Type callback function prototypes: */
/*****************************************************************************/ /*****************************************************************************/
static void Image_Dealloc (C_Image *self); static void Image_Dealloc (BPy_Image *self);
static int Image_SetAttr (C_Image *self, char *name, PyObject *v); static int Image_SetAttr (BPy_Image *self, char *name, PyObject *v);
static int Image_Compare (C_Image *a, C_Image *b); static int Image_Compare (BPy_Image *a, BPy_Image *b);
static int Image_Print (C_Image *self, FILE *fp, int flags); static int Image_Print (BPy_Image *self, FILE *fp, int flags);
static PyObject *Image_GetAttr (C_Image *self, char *name); static PyObject *Image_GetAttr (BPy_Image *self, char *name);
static PyObject *Image_Repr (C_Image *self); static PyObject *Image_Repr (BPy_Image *self);
/*****************************************************************************/ /*****************************************************************************/
/* Python Image_Type structure definition: */ /* Python Image_Type structure definition: */
@ -265,8 +265,8 @@ PyTypeObject Image_Type =
{ {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /* ob_size */ 0, /* ob_size */
"Image", /* tp_name */ "Blender Image", /* tp_name */
sizeof (C_Image), /* tp_basicsize */ sizeof (BPy_Image), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
/* methods */ /* methods */
(destructor)Image_Dealloc, /* tp_dealloc */ (destructor)Image_Dealloc, /* tp_dealloc */
@ -282,34 +282,34 @@ PyTypeObject Image_Type =
0,0,0,0,0,0, 0,0,0,0,0,0,
0, /* tp_doc */ 0, /* tp_doc */
0,0,0,0,0,0, 0,0,0,0,0,0,
C_Image_methods, /* tp_methods */ BPy_Image_methods, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
}; };
/*****************************************************************************/ /*****************************************************************************/
/* Function: ImageDealloc */ /* Function: ImageDealloc */
/* Description: This is a callback function for the C_Image type. It is */ /* Description: This is a callback function for the BPy_Image type. It is */
/* the destructor function. */ /* the destructor function. */
/*****************************************************************************/ /*****************************************************************************/
static void Image_Dealloc (C_Image *self) static void Image_Dealloc (BPy_Image *self)
{ {
PyObject_DEL (self); PyObject_DEL (self);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: Image_CreatePyObject */ /* Function: Image_CreatePyObject */
/* Description: This function will create a new C_Image from an existing */ /* Description: This function will create a new BPy_Image from an existing */
/* Blender image structure. */ /* Blender image structure. */
/*****************************************************************************/ /*****************************************************************************/
PyObject *Image_CreatePyObject (Image *image) PyObject *Image_CreatePyObject (Image *image)
{ {
C_Image *py_img; BPy_Image *py_img;
py_img = (C_Image *)PyObject_NEW (C_Image, &Image_Type); py_img = (BPy_Image *)PyObject_NEW (BPy_Image, &Image_Type);
if (!py_img) if (!py_img)
return EXPP_ReturnPyObjError (PyExc_MemoryError, return EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create C_Image object"); "couldn't create BPy_Image object");
py_img->image = image; py_img->image = image;
@ -327,9 +327,9 @@ int Image_CheckPyObject (PyObject *pyobj)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Image methods: */ /* Python BPy_Image methods: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Image_getName(C_Image *self) static PyObject *Image_getName(BPy_Image *self)
{ {
PyObject *attr = PyString_FromString(self->image->id.name+2); PyObject *attr = PyString_FromString(self->image->id.name+2);
@ -339,7 +339,7 @@ static PyObject *Image_getName(C_Image *self)
"couldn't get Image.name attribute")); "couldn't get Image.name attribute"));
} }
static PyObject *Image_getFilename(C_Image *self) static PyObject *Image_getFilename(BPy_Image *self)
{ {
PyObject *attr = PyString_FromString(self->image->name); PyObject *attr = PyString_FromString(self->image->name);
@ -349,7 +349,7 @@ static PyObject *Image_getFilename(C_Image *self)
"couldn't get Image.filename attribute")); "couldn't get Image.filename attribute"));
} }
static PyObject *Image_setName(C_Image *self, PyObject *args) static PyObject *Image_setName(BPy_Image *self, PyObject *args)
{ {
char *name; char *name;
char buf[21]; char buf[21];
@ -366,7 +366,7 @@ static PyObject *Image_setName(C_Image *self, PyObject *args)
return Py_None; return Py_None;
} }
static PyObject *Image_setXRep(C_Image *self, PyObject *args) static PyObject *Image_setXRep(BPy_Image *self, PyObject *args)
{ {
short value; short value;
@ -384,7 +384,7 @@ static PyObject *Image_setXRep(C_Image *self, PyObject *args)
return Py_None; return Py_None;
} }
static PyObject *Image_setYRep(C_Image *self, PyObject *args) static PyObject *Image_setYRep(BPy_Image *self, PyObject *args)
{ {
short value; short value;
@ -404,11 +404,11 @@ static PyObject *Image_setYRep(C_Image *self, PyObject *args)
/*****************************************************************************/ /*****************************************************************************/
/* Function: Image_GetAttr */ /* Function: Image_GetAttr */
/* Description: This is a callback function for the C_Image type. It is */ /* Description: This is a callback function for the BPy_Image type. It is */
/* the function that accesses C_Image member variables and */ /* the function that accesses BPy_Image member variables and */
/* methods. */ /* methods. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Image_GetAttr (C_Image *self, char *name) static PyObject *Image_GetAttr (BPy_Image *self, char *name)
{ {
PyObject *attr = Py_None; PyObject *attr = Py_None;
@ -432,16 +432,16 @@ static PyObject *Image_GetAttr (C_Image *self, char *name)
if (attr != Py_None) return attr; /* attribute found, return its value */ if (attr != Py_None) return attr; /* attribute found, return its value */
/* not an attribute, search the methods table */ /* not an attribute, search the methods table */
return Py_FindMethod(C_Image_methods, (PyObject *)self, name); return Py_FindMethod(BPy_Image_methods, (PyObject *)self, name);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: Image_SetAttr */ /* Function: Image_SetAttr */
/* Description: This is a callback function for the C_Image type. It is the */ /* Description: This is a callback function for the BPy_Image type. It is the*/
/* function that changes Image Data members values. If this */ /* function that changes Image Data members values. If this */
/* data is linked to a Blender Image, it also gets updated. */ /* data is linked to a Blender Image, it also gets updated. */
/*****************************************************************************/ /*****************************************************************************/
static int Image_SetAttr (C_Image *self, char *name, PyObject *value) static int Image_SetAttr (BPy_Image *self, char *name, PyObject *value)
{ {
PyObject *valtuple; PyObject *valtuple;
PyObject *error = NULL; PyObject *error = NULL;
@ -480,13 +480,13 @@ static int Image_SetAttr (C_Image *self, char *name, PyObject *value)
/*****************************************************************************/ /*****************************************************************************/
/* Function: Image_Compare */ /* Function: Image_Compare */
/* Description: This is a callback function for the C_Image type. It */ /* Description: This is a callback function for the BPy_Image type. It */
/* compares two Image_Type objects. Only the "==" and "!=" */ /* compares two Image_Type objects. Only the "==" and "!=" */
/* comparisons are meaninful. Returns 0 for equality and -1 if */ /* comparisons are meaninful. Returns 0 for equality and -1 if */
/* they don't point to the same Blender Image struct. */ /* they don't point to the same Blender Image struct. */
/* In Python it becomes 1 if they are equal, 0 otherwise. */ /* In Python it becomes 1 if they are equal, 0 otherwise. */
/*****************************************************************************/ /*****************************************************************************/
static int Image_Compare (C_Image *a, C_Image *b) static int Image_Compare (BPy_Image *a, BPy_Image *b)
{ {
Image *pa = a->image, *pb = b->image; Image *pa = a->image, *pb = b->image;
return (pa == pb) ? 0:-1; return (pa == pb) ? 0:-1;
@ -494,10 +494,10 @@ static int Image_Compare (C_Image *a, C_Image *b)
/*****************************************************************************/ /*****************************************************************************/
/* Function: Image_Print */ /* Function: Image_Print */
/* Description: This is a callback function for the C_Image type. It */ /* Description: This is a callback function for the BPy_Image type. It */
/* builds a meaninful string to 'print' image objects. */ /* builds a meaninful string to 'print' image objects. */
/*****************************************************************************/ /*****************************************************************************/
static int Image_Print(C_Image *self, FILE *fp, int flags) static int Image_Print(BPy_Image *self, FILE *fp, int flags)
{ {
fprintf(fp, "[Image \"%s\"]", self->image->id.name+2); fprintf(fp, "[Image \"%s\"]", self->image->id.name+2);
return 0; return 0;
@ -505,10 +505,10 @@ static int Image_Print(C_Image *self, FILE *fp, int flags)
/*****************************************************************************/ /*****************************************************************************/
/* Function: Image_Repr */ /* Function: Image_Repr */
/* Description: This is a callback function for the C_Image type. It */ /* Description: This is a callback function for the BPy_Image type. It */
/* builds a meaninful string to represent image objects. */ /* builds a meaninful string to represent image objects. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Image_Repr (C_Image *self) static PyObject *Image_Repr (BPy_Image *self)
{ {
return PyString_FromString(self->image->id.name+2); return PyString_FromString(self->image->id.name+2);
} }

View File

@ -37,17 +37,17 @@
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Image structure definition */ /* Python BPy_Image structure definition */
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
Image *image; Image *image;
} C_Image; } BPy_Image;
extern PyTypeObject Image_Type; /* The Image PyType Object */ extern PyTypeObject Image_Type; /* The Image PyType Object */
#define C_Image_Check(v) ((v)->ob_type == &Image_Type) /* for type checking */ #define BPy_Image_Check(v) ((v)->ob_type == &Image_Type)/*for type checking*/
/*****************************************************************************/ /*****************************************************************************/
/* Module Blender.Image - public functions */ /* Module Blender.Image - public functions */

View File

@ -132,15 +132,14 @@ static PyObject *M_Ipo_Get(PyObject *self, PyObject *args)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_Ipo_Init */ /* Function: Ipo_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Ipo_Init (void) PyObject *Ipo_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
Ipo_Type.ob_type = &PyType_Type; Ipo_Type.ob_type = &PyType_Type;
printf ("In M_Ipo_Init()\n");
submodule = Py_InitModule3("Blender.Ipo", M_Ipo_methods, M_Ipo_doc); submodule = Py_InitModule3("Blender.Ipo", M_Ipo_methods, M_Ipo_doc);
return (submodule); return (submodule);

View File

@ -188,7 +188,7 @@ static PyObject *M_Lamp_TypesDict (void)
PyObject *Types = M_constant_New(); PyObject *Types = M_constant_New();
if (Types) { if (Types) {
C_constant *c = (C_constant *)Types; BPy_constant *c = (BPy_constant *)Types;
constant_insert (c, "Lamp", PyInt_FromLong (EXPP_LAMP_TYPE_LAMP)); constant_insert (c, "Lamp", PyInt_FromLong (EXPP_LAMP_TYPE_LAMP));
constant_insert (c, "Sun", PyInt_FromLong (EXPP_LAMP_TYPE_SUN)); constant_insert (c, "Sun", PyInt_FromLong (EXPP_LAMP_TYPE_SUN));
@ -205,7 +205,7 @@ static PyObject *M_Lamp_ModesDict (void)
PyObject *Modes = M_constant_New(); PyObject *Modes = M_constant_New();
if (Modes) { if (Modes) {
C_constant *c = (C_constant *)Modes; BPy_constant *c = (BPy_constant *)Modes;
constant_insert (c, "Shadows", PyInt_FromLong (EXPP_LAMP_MODE_SHADOWS)); constant_insert (c, "Shadows", PyInt_FromLong (EXPP_LAMP_MODE_SHADOWS));
constant_insert (c, "Halo", PyInt_FromLong (EXPP_LAMP_MODE_HALO)); constant_insert (c, "Halo", PyInt_FromLong (EXPP_LAMP_MODE_HALO));

View File

@ -73,7 +73,6 @@ static PyObject *M_Metaball_New(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "|s", &name)) if (!PyArg_ParseTuple(args, "|s", &name))
return (EXPP_ReturnPyObjError (PyExc_TypeError, return (EXPP_ReturnPyObjError (PyExc_TypeError,
"expected string argument (or nothing)")); "expected string argument (or nothing)"));
printf ("In MetaBall_New()\n");
blmball = add_mball(); /* first create the MetaBall Data in Blender */ blmball = add_mball(); /* first create the MetaBall Data in Blender */
@ -159,15 +158,15 @@ static PyObject *M_Metaball_Get(PyObject *self, PyObject *args)
} }
/*******************************************************************************/ /******************************************************************************/
/* Function: M_Metaball_Init */ /* Function: Metaball_Init */
/*******************************************************************************/ /******************************************************************************/
PyObject *M_Metaball_Init (void) PyObject *Metaball_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
Metaball_Type.ob_type = &PyType_Type; Metaball_Type.ob_type = &PyType_Type;
printf ("In M_Metaball_Init()\n");
submodule = Py_InitModule3("Blender.Metaball", submodule = Py_InitModule3("Blender.Metaball",
M_Metaball_methods, M_Metaball_doc); M_Metaball_methods, M_Metaball_doc);

View File

@ -49,9 +49,9 @@ static void NMCol_dealloc(PyObject *self)
PyObject_DEL(self); /* XXX PyObject_Del ?*/ PyObject_DEL(self); /* XXX PyObject_Del ?*/
} }
static C_NMCol *newcol (char r, char g, char b, char a) static BPy_NMCol *newcol (char r, char g, char b, char a)
{ {
C_NMCol *mc = (C_NMCol *) PyObject_NEW (C_NMCol, &NMCol_Type); BPy_NMCol *mc = (BPy_NMCol *) PyObject_NEW (BPy_NMCol, &NMCol_Type);
mc->r= r; mc->r= r;
mc->g= g; mc->g= g;
@ -73,7 +73,7 @@ static PyObject *M_NMesh_Col(PyObject *self, PyObject *args)
static PyObject *NMCol_getattr(PyObject *self, char *name) static PyObject *NMCol_getattr(PyObject *self, char *name)
{ {
C_NMCol *mc = (C_NMCol *)self; BPy_NMCol *mc = (BPy_NMCol *)self;
if (strcmp(name, "r") == 0) return Py_BuildValue("i", mc->r); if (strcmp(name, "r") == 0) return Py_BuildValue("i", mc->r);
else if (strcmp(name, "g") == 0) return Py_BuildValue("i", mc->g); else if (strcmp(name, "g") == 0) return Py_BuildValue("i", mc->g);
@ -85,7 +85,7 @@ static PyObject *NMCol_getattr(PyObject *self, char *name)
static int NMCol_setattr(PyObject *self, char *name, PyObject *v) static int NMCol_setattr(PyObject *self, char *name, PyObject *v)
{ {
C_NMCol *mc = (C_NMCol *)self; BPy_NMCol *mc = (BPy_NMCol *)self;
short ival; short ival;
if(!PyArg_Parse(v, "h", &ival)) return -1; if(!PyArg_Parse(v, "h", &ival)) return -1;
@ -101,7 +101,7 @@ static int NMCol_setattr(PyObject *self, char *name, PyObject *v)
return 0; return 0;
} }
PyObject *NMCol_repr(C_NMCol *self) PyObject *NMCol_repr(BPy_NMCol *self)
{ {
static char s[256]; static char s[256];
sprintf (s, "[NMCol - <%d, %d, %d, %d>]", self->r, self->g, self->b, self->a); sprintf (s, "[NMCol - <%d, %d, %d, %d>]", self->r, self->g, self->b, self->a);
@ -113,7 +113,7 @@ PyTypeObject NMCol_Type =
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /* ob_size */ 0, /* ob_size */
"NMCol", /* tp_name */ "NMCol", /* tp_name */
sizeof(C_NMCol), /* tp_basicsize */ sizeof(BPy_NMCol), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
/* methods */ /* methods */
(destructor) NMCol_dealloc, /* tp_dealloc */ (destructor) NMCol_dealloc, /* tp_dealloc */
@ -137,7 +137,7 @@ PyTypeObject NMCol_Type =
/*****************************/ /*****************************/
static void NMFace_dealloc (PyObject *self) static void NMFace_dealloc (PyObject *self)
{ {
C_NMFace *mf = (C_NMFace *)self; BPy_NMFace *mf = (BPy_NMFace *)self;
Py_DECREF(mf->v); Py_DECREF(mf->v);
Py_DECREF(mf->uv); Py_DECREF(mf->uv);
@ -146,9 +146,9 @@ static void NMFace_dealloc (PyObject *self)
PyObject_DEL(self); PyObject_DEL(self);
} }
static C_NMFace *new_NMFace(PyObject *vertexlist) static BPy_NMFace *new_NMFace(PyObject *vertexlist)
{ {
C_NMFace *mf = PyObject_NEW (C_NMFace, &NMFace_Type); BPy_NMFace *mf = PyObject_NEW (BPy_NMFace, &NMFace_Type);
mf->v = vertexlist; mf->v = vertexlist;
mf->uv = PyList_New(0); mf->uv = PyList_New(0);
@ -180,7 +180,7 @@ static PyObject *M_NMesh_Face(PyObject *self, PyObject *args)
static PyObject *NMFace_append(PyObject *self, PyObject *args) static PyObject *NMFace_append(PyObject *self, PyObject *args)
{ {
PyObject *vert; PyObject *vert;
C_NMFace *f = (C_NMFace *)self; BPy_NMFace *f = (BPy_NMFace *)self;
if (!PyArg_ParseTuple(args, "O!", &NMVert_Type, &vert)) if (!PyArg_ParseTuple(args, "O!", &NMVert_Type, &vert))
return EXPP_ReturnPyObjError (PyExc_TypeError, return EXPP_ReturnPyObjError (PyExc_TypeError,
@ -202,7 +202,7 @@ static struct PyMethodDef NMFace_methods[] =
static PyObject *NMFace_getattr(PyObject *self, char *name) static PyObject *NMFace_getattr(PyObject *self, char *name)
{ {
C_NMFace *mf = (C_NMFace *)self; BPy_NMFace *mf = (BPy_NMFace *)self;
if(strcmp(name, "v") == 0) if(strcmp(name, "v") == 0)
return Py_BuildValue("O", mf->v); return Py_BuildValue("O", mf->v);
@ -236,7 +236,7 @@ static PyObject *NMFace_getattr(PyObject *self, char *name)
static int NMFace_setattr(PyObject *self, char *name, PyObject *v) static int NMFace_setattr(PyObject *self, char *name, PyObject *v)
{ {
C_NMFace *mf = (C_NMFace *)self; BPy_NMFace *mf = (BPy_NMFace *)self;
short ival; short ival;
if (strcmp(name, "v") == 0) { if (strcmp(name, "v") == 0) {
@ -308,7 +308,7 @@ static int NMFace_setattr(PyObject *self, char *name, PyObject *v)
return 0; return 0;
} }
mf->image = ((C_Image *)pyimg)->image; mf->image = ((BPy_Image *)pyimg)->image;
return 0; return 0;
} }
@ -321,17 +321,17 @@ static PyObject *NMFace_repr (PyObject *self)
return PyString_FromString("[NMFace]"); return PyString_FromString("[NMFace]");
} }
static int NMFace_len(C_NMFace *self) static int NMFace_len(BPy_NMFace *self)
{ {
return PySequence_Length(self->v); return PySequence_Length(self->v);
} }
static PyObject *NMFace_item(C_NMFace *self, int i) static PyObject *NMFace_item(BPy_NMFace *self, int i)
{ {
return PySequence_GetItem(self->v, i); // new ref return PySequence_GetItem(self->v, i); // new ref
} }
static PyObject *NMFace_slice(C_NMFace *self, int begin, int end) static PyObject *NMFace_slice(BPy_NMFace *self, int begin, int end)
{ {
return PyList_GetSlice(self->v, begin, end); // new ref return PyList_GetSlice(self->v, begin, end); // new ref
} }
@ -352,7 +352,7 @@ PyTypeObject NMFace_Type =
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /*ob_size*/ 0, /*ob_size*/
"NMFace", /*tp_name*/ "NMFace", /*tp_name*/
sizeof(C_NMFace), /*tp_basicsize*/ sizeof(BPy_NMFace), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
/* methods */ /* methods */
(destructor) NMFace_dealloc, /*tp_dealloc*/ (destructor) NMFace_dealloc, /*tp_dealloc*/
@ -367,9 +367,9 @@ PyTypeObject NMFace_Type =
0, /*tp_hash*/ 0, /*tp_hash*/
}; };
static C_NMVert *newvert(float *co) static BPy_NMVert *newvert(float *co)
{ {
C_NMVert *mv = PyObject_NEW(C_NMVert, &NMVert_Type); BPy_NMVert *mv = PyObject_NEW(BPy_NMVert, &NMVert_Type);
mv->co[0] = co[0]; mv->co[1] = co[1]; mv->co[2] = co[2]; mv->co[0] = co[0]; mv->co[1] = co[1]; mv->co[2] = co[2];
@ -397,7 +397,7 @@ static void NMVert_dealloc(PyObject *self)
static PyObject *NMVert_getattr(PyObject *self, char *name) static PyObject *NMVert_getattr(PyObject *self, char *name)
{ {
C_NMVert *mv = (C_NMVert *)self; BPy_NMVert *mv = (BPy_NMVert *)self;
if (!strcmp(name, "co") || !strcmp(name, "loc")) if (!strcmp(name, "co") || !strcmp(name, "loc"))
return newVectorObject(mv->co, 3); return newVectorObject(mv->co, 3);
@ -411,7 +411,7 @@ static PyObject *NMVert_getattr(PyObject *self, char *name)
static int NMVert_setattr(PyObject *self, char *name, PyObject *v) static int NMVert_setattr(PyObject *self, char *name, PyObject *v)
{ {
C_NMVert *mv = (C_NMVert *)self; BPy_NMVert *mv = (BPy_NMVert *)self;
int i; int i;
if (strcmp(name,"index") == 0) { if (strcmp(name,"index") == 0) {
@ -431,12 +431,12 @@ static int NMVert_setattr(PyObject *self, char *name, PyObject *v)
return EXPP_ReturnIntError (PyExc_AttributeError, name); return EXPP_ReturnIntError (PyExc_AttributeError, name);
} }
static int NMVert_len(C_NMVert *self) static int NMVert_len(BPy_NMVert *self)
{ {
return 3; return 3;
} }
static PyObject *NMVert_item(C_NMVert *self, int i) static PyObject *NMVert_item(BPy_NMVert *self, int i)
{ {
if (i < 0 || i >= 3) if (i < 0 || i >= 3)
return EXPP_ReturnPyObjError (PyExc_IndexError, return EXPP_ReturnPyObjError (PyExc_IndexError,
@ -445,7 +445,7 @@ static PyObject *NMVert_item(C_NMVert *self, int i)
return Py_BuildValue("f", self->co[i]); return Py_BuildValue("f", self->co[i]);
} }
static PyObject *NMVert_slice(C_NMVert *self, int begin, int end) static PyObject *NMVert_slice(BPy_NMVert *self, int begin, int end)
{ {
PyObject *list; PyObject *list;
int count; int count;
@ -462,7 +462,7 @@ static PyObject *NMVert_slice(C_NMVert *self, int begin, int end)
return list; return list;
} }
static int NMVert_ass_item(C_NMVert *self, int i, PyObject *ob) static int NMVert_ass_item(BPy_NMVert *self, int i, PyObject *ob)
{ {
if (i < 0 || i >= 3) if (i < 0 || i >= 3)
return EXPP_ReturnIntError (PyExc_IndexError, return EXPP_ReturnIntError (PyExc_IndexError,
@ -477,7 +477,7 @@ static int NMVert_ass_item(C_NMVert *self, int i, PyObject *ob)
return 0; return 0;
} }
static int NMVert_ass_slice(C_NMVert *self, int begin, int end, PyObject *seq) static int NMVert_ass_slice(BPy_NMVert *self, int begin, int end, PyObject *seq)
{ {
int count; int count;
@ -523,7 +523,7 @@ PyTypeObject NMVert_Type =
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /*ob_size*/ 0, /*ob_size*/
"NMVert", /*tp_name*/ "NMVert", /*tp_name*/
sizeof(C_NMVert), /*tp_basicsize*/ sizeof(BPy_NMVert), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
/* methods */ /* methods */
(destructor) NMVert_dealloc, /*tp_dealloc*/ (destructor) NMVert_dealloc, /*tp_dealloc*/
@ -538,7 +538,7 @@ PyTypeObject NMVert_Type =
static void NMesh_dealloc(PyObject *self) static void NMesh_dealloc(PyObject *self)
{ {
C_NMesh *me = (C_NMesh *)self; BPy_NMesh *me = (BPy_NMesh *)self;
Py_DECREF(me->name); Py_DECREF(me->name);
Py_DECREF(me->verts); Py_DECREF(me->verts);
@ -549,7 +549,7 @@ static void NMesh_dealloc(PyObject *self)
static PyObject *NMesh_getSelectedFaces(PyObject *self, PyObject *args) static PyObject *NMesh_getSelectedFaces(PyObject *self, PyObject *args)
{ {
C_NMesh *nm = (C_NMesh *)self; BPy_NMesh *nm = (BPy_NMesh *)self;
Mesh *me = nm->mesh; Mesh *me = nm->mesh;
int flag = 0; int flag = 0;
@ -581,15 +581,15 @@ static PyObject *NMesh_getSelectedFaces(PyObject *self, PyObject *args)
static PyObject *NMesh_getActiveFace(PyObject *self, PyObject *args) static PyObject *NMesh_getActiveFace(PyObject *self, PyObject *args)
{ {
if (((C_NMesh *)self)->sel_face < 0) if (((BPy_NMesh *)self)->sel_face < 0)
return EXPP_incr_ret(Py_None); return EXPP_incr_ret(Py_None);
return Py_BuildValue("i", ((C_NMesh *)self)->sel_face); return Py_BuildValue("i", ((BPy_NMesh *)self)->sel_face);
} }
static PyObject *NMesh_hasVertexUV(PyObject *self, PyObject *args) static PyObject *NMesh_hasVertexUV(PyObject *self, PyObject *args)
{ {
C_NMesh *me = (C_NMesh *)self; BPy_NMesh *me = (BPy_NMesh *)self;
int flag; int flag;
if (args) { if (args) {
@ -607,7 +607,7 @@ static PyObject *NMesh_hasVertexUV(PyObject *self, PyObject *args)
static PyObject *NMesh_hasFaceUV(PyObject *self, PyObject *args) static PyObject *NMesh_hasFaceUV(PyObject *self, PyObject *args)
{ {
C_NMesh *me = (C_NMesh *)self; BPy_NMesh *me = (BPy_NMesh *)self;
int flag = -1; int flag = -1;
if (!PyArg_ParseTuple(args, "|i", &flag)) if (!PyArg_ParseTuple(args, "|i", &flag))
@ -633,7 +633,7 @@ static PyObject *NMesh_hasFaceUV(PyObject *self, PyObject *args)
static PyObject *NMesh_hasVertexColours(PyObject *self, PyObject *args) static PyObject *NMesh_hasVertexColours(PyObject *self, PyObject *args)
{ {
C_NMesh *me= (C_NMesh *)self; BPy_NMesh *me= (BPy_NMesh *)self;
int flag = -1; int flag = -1;
if (!PyArg_ParseTuple(args, "|i", &flag)) if (!PyArg_ParseTuple(args, "|i", &flag))
@ -659,7 +659,7 @@ static PyObject *NMesh_hasVertexColours(PyObject *self, PyObject *args)
static PyObject *NMesh_update(PyObject *self, PyObject *args) static PyObject *NMesh_update(PyObject *self, PyObject *args)
{ {
C_NMesh *nmesh = (C_NMesh *)self; BPy_NMesh *nmesh = (BPy_NMesh *)self;
Mesh *mesh = nmesh->mesh; Mesh *mesh = nmesh->mesh;
if (mesh) { if (mesh) {
@ -696,7 +696,7 @@ static PyObject *NMesh_getVertexInfluences(PyObject *self, PyObject *args)
PyObject* influence_list = NULL; PyObject* influence_list = NULL;
/* Get a reference to the mesh object wrapped in here. */ /* Get a reference to the mesh object wrapped in here. */
Mesh *me = ((C_NMesh*)self)->mesh; Mesh *me = ((BPy_NMesh*)self)->mesh;
/* Parse the parameters: only on integer (vertex index) */ /* Parse the parameters: only on integer (vertex index) */
if (!PyArg_ParseTuple(args, "i", &index)) if (!PyArg_ParseTuple(args, "i", &index))
@ -741,7 +741,7 @@ static PyObject *NMesh_getVertexInfluences(PyObject *self, PyObject *args)
return influence_list; /* No need to incref it */ return influence_list; /* No need to incref it */
} }
Mesh *Mesh_fromNMesh(C_NMesh *nmesh) Mesh *Mesh_fromNMesh(BPy_NMesh *nmesh)
{ {
Mesh *mesh = NULL; Mesh *mesh = NULL;
mesh = add_mesh(); /* us == 1, should we zero it for all added objs ? */ mesh = add_mesh(); /* us == 1, should we zero it for all added objs ? */
@ -758,7 +758,7 @@ Mesh *Mesh_fromNMesh(C_NMesh *nmesh)
PyObject *NMesh_link(PyObject *self, PyObject *args) PyObject *NMesh_link(PyObject *self, PyObject *args)
{/* {/*
C_Object *bl_obj; BPy_Object *bl_obj;
if (!PyArg_ParseTuple(args, "O!", &Object_Type, &bl_obj)) if (!PyArg_ParseTuple(args, "O!", &Object_Type, &bl_obj))
return EXPP_ReturnPyErrorObj (PyExc_TypeError, return EXPP_ReturnPyErrorObj (PyExc_TypeError,
@ -786,7 +786,7 @@ static struct PyMethodDef NMesh_methods[] =
static PyObject *NMesh_getattr(PyObject *self, char *name) static PyObject *NMesh_getattr(PyObject *self, char *name)
{ {
C_NMesh *me = (C_NMesh *)self; BPy_NMesh *me = (BPy_NMesh *)self;
if (strcmp(name, "name") == 0) if (strcmp(name, "name") == 0)
return EXPP_incr_ret(me->name); return EXPP_incr_ret(me->name);
@ -817,7 +817,7 @@ static PyObject *NMesh_getattr(PyObject *self, char *name)
static int NMesh_setattr(PyObject *self, char *name, PyObject *v) static int NMesh_setattr(PyObject *self, char *name, PyObject *v)
{ {
C_NMesh *me = (C_NMesh *)self; BPy_NMesh *me = (BPy_NMesh *)self;
if (!strcmp(name, "verts") || !strcmp(name, "faces") || if (!strcmp(name, "verts") || !strcmp(name, "faces") ||
!strcmp(name, "materials")) { !strcmp(name, "materials")) {
@ -853,7 +853,7 @@ PyTypeObject NMesh_Type =
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /*ob_size*/ 0, /*ob_size*/
"NMesh", /*tp_name*/ "NMesh", /*tp_name*/
sizeof(C_NMesh), /*tp_basicsize*/ sizeof(BPy_NMesh), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
/* methods */ /* methods */
(destructor) NMesh_dealloc, /*tp_dealloc*/ (destructor) NMesh_dealloc, /*tp_dealloc*/
@ -862,10 +862,10 @@ PyTypeObject NMesh_Type =
(setattrfunc) NMesh_setattr, /*tp_setattr*/ (setattrfunc) NMesh_setattr, /*tp_setattr*/
}; };
static C_NMFace *nmface_from_data(C_NMesh *mesh, int vidxs[4], static BPy_NMFace *nmface_from_data(BPy_NMesh *mesh, int vidxs[4],
char mat_nr, char flag, TFace *tface, MCol *col) char mat_nr, char flag, TFace *tface, MCol *col)
{ {
C_NMFace *newf = PyObject_NEW (C_NMFace, &NMFace_Type); BPy_NMFace *newf = PyObject_NEW (BPy_NMFace, &NMFace_Type);
int i, len; int i, len;
if (vidxs[3]) len = 4; if (vidxs[3]) len = 4;
@ -916,7 +916,7 @@ static C_NMFace *nmface_from_data(C_NMesh *mesh, int vidxs[4],
return newf; return newf;
} }
static C_NMFace *nmface_from_shortdata(C_NMesh *mesh, static BPy_NMFace *nmface_from_shortdata(BPy_NMesh *mesh,
MFace *face, TFace *tface, MCol *col) MFace *face, TFace *tface, MCol *col)
{ {
int vidxs[4]; int vidxs[4];
@ -928,7 +928,7 @@ static C_NMFace *nmface_from_shortdata(C_NMesh *mesh,
return nmface_from_data(mesh, vidxs, face->mat_nr, face->flag, tface, col); return nmface_from_data(mesh, vidxs, face->mat_nr, face->flag, tface, col);
} }
static C_NMFace *nmface_from_intdata(C_NMesh *mesh, static BPy_NMFace *nmface_from_intdata(BPy_NMesh *mesh,
MFaceInt *face, TFace *tface, MCol *col) MFaceInt *face, TFace *tface, MCol *col)
{ {
int vidxs[4]; int vidxs[4];
@ -940,10 +940,10 @@ static C_NMFace *nmface_from_intdata(C_NMesh *mesh,
return nmface_from_data(mesh, vidxs, face->mat_nr, face->flag, tface, col); return nmface_from_data(mesh, vidxs, face->mat_nr, face->flag, tface, col);
} }
static C_NMVert *nmvert_from_data(C_NMesh *me, static BPy_NMVert *nmvert_from_data(BPy_NMesh *me,
MVert *vert, MSticky *st, float *co, int idx) MVert *vert, MSticky *st, float *co, int idx)
{ {
C_NMVert *mv = PyObject_NEW(C_NMVert, &NMVert_Type); BPy_NMVert *mv = PyObject_NEW(BPy_NMVert, &NMVert_Type);
mv->co[0] = co[0]; mv->co[1] = co[1]; mv->co[2] = co[2]; mv->co[0] = co[0]; mv->co[1] = co[1]; mv->co[2] = co[2];
@ -982,7 +982,7 @@ static int get_active_faceindex(Mesh *me)
static PyObject *new_NMesh_internal(Mesh *oldmesh, static PyObject *new_NMesh_internal(Mesh *oldmesh,
DispListMesh *dlm, float *extverts) DispListMesh *dlm, float *extverts)
{ {
C_NMesh *me = PyObject_NEW (C_NMesh, &NMesh_Type); BPy_NMesh *me = PyObject_NEW (BPy_NMesh, &NMesh_Type);
me->flags = 0; me->flags = 0;
if (!oldmesh) { if (!oldmesh) {
@ -1125,12 +1125,12 @@ static PyObject *M_NMesh_GetRawFromObject(PyObject *self, PyObject *args)
else else
nmesh = new_NMesh(me); nmesh = new_NMesh(me);
} }
((C_NMesh *) nmesh)->mesh = 0; // hack: to mark that (deformed) mesh is readonly, ((BPy_NMesh *) nmesh)->mesh = 0; // hack: to mark that (deformed) mesh is readonly,
// so the update function will not try to write it. // so the update function will not try to write it.
return nmesh; return nmesh;
} }
static void mvert_from_data(MVert *mv, MSticky *st, C_NMVert *from) static void mvert_from_data(MVert *mv, MSticky *st, BPy_NMVert *from)
{ {
mv->co[0] = from->co[0]; mv->co[1] = from->co[1]; mv->co[2] = from->co[2]; mv->co[0] = from->co[0]; mv->co[1] = from->co[1]; mv->co[2] = from->co[2];
@ -1151,7 +1151,7 @@ static void mvert_from_data(MVert *mv, MSticky *st, C_NMVert *from)
* RGBA/BRGA confusion, it just works, but will never work with * RGBA/BRGA confusion, it just works, but will never work with
* a restructured Blender */ * a restructured Blender */
static void assign_perFaceColors(TFace *tf, C_NMFace *from) static void assign_perFaceColors(TFace *tf, BPy_NMFace *from)
{ {
MCol *col; MCol *col;
int i; int i;
@ -1164,8 +1164,8 @@ static void assign_perFaceColors(TFace *tf, C_NMFace *from)
if(len > 4) len = 4; if(len > 4) len = 4;
for (i = 0; i < len; i++, col++) { for (i = 0; i < len; i++, col++) {
C_NMCol *mc = (C_NMCol *)PySequence_GetItem(from->col, i); BPy_NMCol *mc = (BPy_NMCol *)PySequence_GetItem(from->col, i);
if(!C_NMCol_Check(mc)) { if(!BPy_NMCol_Check(mc)) {
Py_DECREF(mc); Py_DECREF(mc);
continue; continue;
} }
@ -1180,7 +1180,7 @@ static void assign_perFaceColors(TFace *tf, C_NMFace *from)
} }
} }
static int assignFaceUV(TFace *tf, C_NMFace *nmface) static int assignFaceUV(TFace *tf, BPy_NMFace *nmface)
{ {
PyObject *fuv, *tmp; PyObject *fuv, *tmp;
int i; int i;
@ -1210,29 +1210,29 @@ static int assignFaceUV(TFace *tf, C_NMFace *nmface)
return 1; return 1;
} }
static void mface_from_data(MFace *mf, TFace *tf, MCol *col, C_NMFace *from) static void mface_from_data(MFace *mf, TFace *tf, MCol *col, BPy_NMFace *from)
{ {
C_NMVert *nmv; BPy_NMVert *nmv;
int i = PyList_Size(from->v); int i = PyList_Size(from->v);
if(i >= 1) { if(i >= 1) {
nmv = (C_NMVert *)PyList_GetItem(from->v, 0); nmv = (BPy_NMVert *)PyList_GetItem(from->v, 0);
if (C_NMVert_Check(nmv) && nmv->index != -1) mf->v1 = nmv->index; if (BPy_NMVert_Check(nmv) && nmv->index != -1) mf->v1 = nmv->index;
else mf->v1 = 0; else mf->v1 = 0;
} }
if(i >= 2) { if(i >= 2) {
nmv = (C_NMVert *)PyList_GetItem(from->v, 1); nmv = (BPy_NMVert *)PyList_GetItem(from->v, 1);
if (C_NMVert_Check(nmv) && nmv->index != -1) mf->v2 = nmv->index; if (BPy_NMVert_Check(nmv) && nmv->index != -1) mf->v2 = nmv->index;
else mf->v2 = 0; else mf->v2 = 0;
} }
if(i >= 3) { if(i >= 3) {
nmv = (C_NMVert *)PyList_GetItem(from->v, 2); nmv = (BPy_NMVert *)PyList_GetItem(from->v, 2);
if (C_NMVert_Check(nmv) && nmv->index != -1) mf->v3 = nmv->index; if (BPy_NMVert_Check(nmv) && nmv->index != -1) mf->v3 = nmv->index;
else mf->v3= 0; else mf->v3= 0;
} }
if(i >= 4) { if(i >= 4) {
nmv = (C_NMVert *)PyList_GetItem(from->v, 3); nmv = (BPy_NMVert *)PyList_GetItem(from->v, 3);
if (C_NMVert_Check(nmv) && nmv->index != -1) mf->v4 = nmv->index; if (BPy_NMVert_Check(nmv) && nmv->index != -1) mf->v4 = nmv->index;
else mf->v4= 0; else mf->v4= 0;
} }
@ -1264,8 +1264,8 @@ static void mface_from_data(MFace *mf, TFace *tf, MCol *col, C_NMFace *from)
if(len > 4) len = 4; if(len > 4) len = 4;
for (i = 0; i < len; i++, col++) { for (i = 0; i < len; i++, col++) {
C_NMCol *mc = (C_NMCol *) PySequence_GetItem(from->col, i); BPy_NMCol *mc = (BPy_NMCol *) PySequence_GetItem(from->col, i);
if(!C_NMCol_Check(mc)) { if(!BPy_NMCol_Check(mc)) {
Py_DECREF(mc); Py_DECREF(mc);
continue; continue;
} }
@ -1281,15 +1281,15 @@ static void mface_from_data(MFace *mf, TFace *tf, MCol *col, C_NMFace *from)
} }
/* check for a valid UV sequence */ /* check for a valid UV sequence */
static int check_validFaceUV(C_NMesh *nmesh) static int check_validFaceUV(BPy_NMesh *nmesh)
{ {
PyObject *faces; PyObject *faces;
C_NMFace *nmface; BPy_NMFace *nmface;
int i, n; int i, n;
faces = nmesh->faces; faces = nmesh->faces;
for (i = 0; i < PySequence_Length(faces); i++) { for (i = 0; i < PySequence_Length(faces); i++) {
nmface = (C_NMFace *)PyList_GetItem(faces, i); nmface = (BPy_NMFace *)PyList_GetItem(faces, i);
n = PySequence_Length(nmface->uv); n = PySequence_Length(nmface->uv);
if (n != PySequence_Length(nmface->v)) if (n != PySequence_Length(nmface->v))
{ {
@ -1315,7 +1315,7 @@ static int unlink_existingMeshData(Mesh *mesh)
return 1; return 1;
} }
Material **nmesh_updateMaterials(C_NMesh *nmesh) Material **nmesh_updateMaterials(BPy_NMesh *nmesh)
{ {
Material **matlist; Material **matlist;
Mesh *mesh = nmesh->mesh; Mesh *mesh = nmesh->mesh;
@ -1338,7 +1338,7 @@ Material **nmesh_updateMaterials(C_NMesh *nmesh)
return matlist; return matlist;
} }
PyObject *NMesh_assignMaterials_toObject(C_NMesh *nmesh, Object *ob) PyObject *NMesh_assignMaterials_toObject(BPy_NMesh *nmesh, Object *ob)
{ {
BPy_Material *pymat; BPy_Material *pymat;
Material *ma; Material *ma;
@ -1370,7 +1370,7 @@ PyObject *NMesh_assignMaterials_toObject(C_NMesh *nmesh, Object *ob)
return EXPP_incr_ret (Py_None); return EXPP_incr_ret (Py_None);
} }
static int convert_NMeshToMesh (Mesh *mesh, C_NMesh *nmesh) static int convert_NMeshToMesh (Mesh *mesh, BPy_NMesh *nmesh)
{ {
MFace *newmf; MFace *newmf;
TFace *newtf; TFace *newtf;
@ -1425,12 +1425,12 @@ static int convert_NMeshToMesh (Mesh *mesh, C_NMesh *nmesh)
* index. - Zr * index. - Zr
*/ */
for (i = 0; i < mesh->totface; i++) { for (i = 0; i < mesh->totface; i++) {
C_NMFace *mf = (C_NMFace *)PySequence_GetItem(nmesh->faces, i); BPy_NMFace *mf = (BPy_NMFace *)PySequence_GetItem(nmesh->faces, i);
j = PySequence_Length(mf->v); j = PySequence_Length(mf->v);
while (j--) { while (j--) {
C_NMVert *mv = (C_NMVert *)PySequence_GetItem(mf->v, j); BPy_NMVert *mv = (BPy_NMVert *)PySequence_GetItem(mf->v, j);
if (C_NMVert_Check(mv)) mv->index = -1; if (BPy_NMVert_Check(mv)) mv->index = -1;
Py_DECREF(mv); Py_DECREF(mv);
} }
@ -1438,7 +1438,7 @@ static int convert_NMeshToMesh (Mesh *mesh, C_NMesh *nmesh)
} }
for (i = 0; i < mesh->totvert; i++) { for (i = 0; i < mesh->totvert; i++) {
C_NMVert *mv = (C_NMVert *)PySequence_GetItem(nmesh->verts, i); BPy_NMVert *mv = (BPy_NMVert *)PySequence_GetItem(nmesh->verts, i);
mv->index = i; mv->index = i;
Py_DECREF(mv); Py_DECREF(mv);
} }
@ -1447,7 +1447,7 @@ static int convert_NMeshToMesh (Mesh *mesh, C_NMesh *nmesh)
newst = mesh->msticky; newst = mesh->msticky;
for (i = 0; i < mesh->totvert; i++) { for (i = 0; i < mesh->totvert; i++) {
PyObject *mv = PySequence_GetItem (nmesh->verts, i); PyObject *mv = PySequence_GetItem (nmesh->verts, i);
mvert_from_data(newmv, newst, (C_NMVert *)mv); mvert_from_data(newmv, newst, (BPy_NMVert *)mv);
Py_DECREF(mv); Py_DECREF(mv);
newmv++; newmv++;
@ -1466,7 +1466,7 @@ static int convert_NMeshToMesh (Mesh *mesh, C_NMesh *nmesh)
newtf = mesh->tface; newtf = mesh->tface;
for (i = 0; i<mesh->totface; i++) { for (i = 0; i<mesh->totface; i++) {
PyObject *mf = PySequence_GetItem(nmesh->faces, i); PyObject *mf = PySequence_GetItem(nmesh->faces, i);
mface_from_data(newmf, newtf, newmc, (C_NMFace *) mf); mface_from_data(newmf, newtf, newmc, (BPy_NMFace *) mf);
Py_DECREF(mf); Py_DECREF(mf);
newtf++; newtf++;
@ -1482,7 +1482,7 @@ static int convert_NMeshToMesh (Mesh *mesh, C_NMesh *nmesh)
for (i = 0; i < mesh->totface; i++) { for (i = 0; i < mesh->totface; i++) {
PyObject *mf = PySequence_GetItem(nmesh->faces, i); PyObject *mf = PySequence_GetItem(nmesh->faces, i);
mface_from_data(newmf, 0, newmc, (C_NMFace *) mf); mface_from_data(newmf, 0, newmc, (BPy_NMFace *) mf);
Py_DECREF(mf); Py_DECREF(mf);
newmf++; newmf++;
@ -1497,7 +1497,7 @@ static PyObject *M_NMesh_PutRaw(PyObject *self, PyObject *args)
char *name = NULL; char *name = NULL;
Mesh *mesh = NULL; Mesh *mesh = NULL;
Object *ob = NULL; Object *ob = NULL;
C_NMesh *nmesh; BPy_NMesh *nmesh;
int recalc_normals = 1; int recalc_normals = 1;
if (!PyArg_ParseTuple(args, "O!|si", if (!PyArg_ParseTuple(args, "O!|si",
@ -1608,7 +1608,7 @@ static PyObject *M_NMesh_FaceModesDict (void)
PyObject *FM = M_constant_New(); PyObject *FM = M_constant_New();
if (FM) { if (FM) {
C_constant *d = (C_constant *)FM; BPy_constant *d = (BPy_constant *)FM;
constant_insert(d, "BILLBOARD", PyInt_FromLong(TF_BILLBOARD2)); constant_insert(d, "BILLBOARD", PyInt_FromLong(TF_BILLBOARD2));
constant_insert(d, "ALL", PyInt_FromLong(0xffff)); constant_insert(d, "ALL", PyInt_FromLong(0xffff));
@ -1633,7 +1633,7 @@ static PyObject *M_NMesh_FaceFlagsDict (void)
PyObject *FF = M_constant_New(); PyObject *FF = M_constant_New();
if (FF) { if (FF) {
C_constant *d = (C_constant *)FF; BPy_constant *d = (BPy_constant *)FF;
EXPP_ADDCONST(d, SELECT); EXPP_ADDCONST(d, SELECT);
EXPP_ADDCONST(d, HIDE); EXPP_ADDCONST(d, HIDE);
@ -1648,7 +1648,7 @@ static PyObject *M_NMesh_FaceTranspModesDict (void)
PyObject *FTM = M_constant_New(); PyObject *FTM = M_constant_New();
if (FTM) { if (FTM) {
C_constant *d = (C_constant *)FTM; BPy_constant *d = (BPy_constant *)FTM;
EXPP_ADDCONST(d, SOLID); EXPP_ADDCONST(d, SOLID);
EXPP_ADDCONST(d, ADD); EXPP_ADDCONST(d, ADD);
@ -1698,7 +1698,7 @@ int NMesh_CheckPyObject (PyObject *pyobj)
Mesh *NMesh_FromPyObject (PyObject *pyobj) Mesh *NMesh_FromPyObject (PyObject *pyobj)
{ {
if (pyobj->ob_type == &NMesh_Type) if (pyobj->ob_type == &NMesh_Type)
return Mesh_fromNMesh ((C_NMesh *)pyobj); return Mesh_fromNMesh ((BPy_NMesh *)pyobj);
return NULL; return NULL;
} }

View File

@ -81,10 +81,10 @@ static PyObject *g_nmeshmodule = NULL;
/* Type checking for EXPP PyTypes */ /* Type checking for EXPP PyTypes */
#define C_NMesh_Check(v) ((v)->ob_type == &NMesh_Type) #define BPy_NMesh_Check(v) ((v)->ob_type == &NMesh_Type)
#define C_NMFace_Check(v) ((v)->ob_type == &NMFace_Type) #define BPy_NMFace_Check(v) ((v)->ob_type == &NMFace_Type)
#define C_NMVert_Check(v) ((v)->ob_type == &NMVert_Type) #define BPy_NMVert_Check(v) ((v)->ob_type == &NMVert_Type)
#define C_NMCol_Check(v) ((v)->ob_type == &NMCol_Type) #define BPy_NMCol_Check(v) ((v)->ob_type == &NMCol_Type)
static char M_NMesh_doc[] = static char M_NMesh_doc[] =
"The Blender.NMesh module"; "The Blender.NMesh module";
@ -164,7 +164,7 @@ typedef struct {
PyObject_HEAD PyObject_HEAD
unsigned char r, g, b, a; unsigned char r, g, b, a;
} C_NMCol; /* an NMesh color: [r,g,b,a] */ } BPy_NMCol; /* an NMesh color: [r,g,b,a] */
typedef struct { typedef struct {
PyObject_VAR_HEAD PyObject_VAR_HEAD
@ -173,7 +173,7 @@ typedef struct {
float uvco[3]; float uvco[3];
int index; int index;
} C_NMVert; /* an NMesh vertex */ } BPy_NMVert; /* an NMesh vertex */
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
@ -186,7 +186,7 @@ typedef struct {
Image *image; Image *image;
char mat_nr, smooth; char mat_nr, smooth;
} C_NMFace; /* an NMesh face */ } BPy_NMFace; /* an NMesh face */
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
@ -202,17 +202,17 @@ typedef struct {
#define NMESH_HASVERTUV 1<<1 #define NMESH_HASVERTUV 1<<1
#define NMESH_HASFACEUV 1<<2 #define NMESH_HASFACEUV 1<<2
} C_NMesh; } BPy_NMesh;
/* PROTOS */ /* PROTOS */
extern void test_object_materials(ID *id); /* declared in BKE_material.h */ extern void test_object_materials(ID *id); /* declared in BKE_material.h */
static int unlink_existingMeshData(Mesh *mesh); static int unlink_existingMeshData(Mesh *mesh);
static int convert_NMeshToMesh(Mesh *mesh, C_NMesh *nmesh); static int convert_NMeshToMesh(Mesh *mesh, BPy_NMesh *nmesh);
void mesh_update(Mesh *mesh); void mesh_update(Mesh *mesh);
PyObject *new_NMesh(Mesh *oldmesh); PyObject *new_NMesh(Mesh *oldmesh);
Mesh *Mesh_fromNMesh(C_NMesh *nmesh); Mesh *Mesh_fromNMesh(BPy_NMesh *nmesh);
PyObject *NMesh_assignMaterials_toObject(C_NMesh *nmesh, Object *ob); PyObject *NMesh_assignMaterials_toObject(BPy_NMesh *nmesh, Object *ob);
Material **nmesh_updateMaterials(C_NMesh *nmesh); Material **nmesh_updateMaterials(BPy_NMesh *nmesh);
Material **newMaterialList_fromPyList (PyObject *list); Material **newMaterialList_fromPyList (PyObject *list);
void mesh_update(Mesh *mesh); void mesh_update(Mesh *mesh);

View File

@ -76,37 +76,37 @@ struct PyMethodDef M_Object_methods[] = {
}; };
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Object methods declarations: */ /* Python BPy_Object methods declarations: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Object_clrParent (C_Object *self, PyObject *args); static PyObject *Object_clrParent (BPy_Object *self, PyObject *args);
static PyObject *Object_getData (C_Object *self); static PyObject *Object_getData (BPy_Object *self);
static PyObject *Object_getDeformData (C_Object *self); static PyObject *Object_getDeformData (BPy_Object *self);
static PyObject *Object_getDeltaLocation (C_Object *self); static PyObject *Object_getDeltaLocation (BPy_Object *self);
static PyObject *Object_getDrawMode (C_Object *self); static PyObject *Object_getDrawMode (BPy_Object *self);
static PyObject *Object_getDrawType (C_Object *self); static PyObject *Object_getDrawType (BPy_Object *self);
static PyObject *Object_getEuler (C_Object *self); static PyObject *Object_getEuler (BPy_Object *self);
static PyObject *Object_getInverseMatrix (C_Object *self); static PyObject *Object_getInverseMatrix (BPy_Object *self);
static PyObject *Object_getLocation (C_Object *self, PyObject *args); static PyObject *Object_getLocation (BPy_Object *self, PyObject *args);
static PyObject *Object_getMaterials (C_Object *self); static PyObject *Object_getMaterials (BPy_Object *self);
static PyObject *Object_getMatrix (C_Object *self); static PyObject *Object_getMatrix (BPy_Object *self);
static PyObject *Object_getParent (C_Object *self); static PyObject *Object_getParent (BPy_Object *self);
static PyObject *Object_getTracked (C_Object *self); static PyObject *Object_getTracked (BPy_Object *self);
static PyObject *Object_getType (C_Object *self); static PyObject *Object_getType (BPy_Object *self);
static PyObject *Object_link (C_Object *self, PyObject *args); static PyObject *Object_link (BPy_Object *self, PyObject *args);
static PyObject *Object_makeParent (C_Object *self, PyObject *args); static PyObject *Object_makeParent (BPy_Object *self, PyObject *args);
static PyObject *Object_materialUsage (C_Object *self, PyObject *args); static PyObject *Object_materialUsage (BPy_Object *self, PyObject *args);
static PyObject *Object_setDeltaLocation (C_Object *self, PyObject *args); static PyObject *Object_setDeltaLocation (BPy_Object *self, PyObject *args);
static PyObject *Object_setDrawMode (C_Object *self, PyObject *args); static PyObject *Object_setDrawMode (BPy_Object *self, PyObject *args);
static PyObject *Object_setDrawType (C_Object *self, PyObject *args); static PyObject *Object_setDrawType (BPy_Object *self, PyObject *args);
static PyObject *Object_setEuler (C_Object *self, PyObject *args); static PyObject *Object_setEuler (BPy_Object *self, PyObject *args);
static PyObject *Object_setLocation (C_Object *self, PyObject *args); static PyObject *Object_setLocation (BPy_Object *self, PyObject *args);
static PyObject *Object_setMaterials (C_Object *self, PyObject *args); static PyObject *Object_setMaterials (BPy_Object *self, PyObject *args);
static PyObject *Object_shareFrom (C_Object *self, PyObject *args); static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args);
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Object methods table: */ /* Python BPy_Object methods table: */
/*****************************************************************************/ /*****************************************************************************/
static PyMethodDef C_Object_methods[] = { static PyMethodDef BPy_Object_methods[] = {
/* name, method, flags, doc */ /* name, method, flags, doc */
{"clrParent", (PyCFunction)Object_clrParent, METH_VARARGS, {"clrParent", (PyCFunction)Object_clrParent, METH_VARARGS,
"Clears parent object. Optionally specify:\n\ "Clears parent object. Optionally specify:\n\
@ -182,11 +182,12 @@ works only if self and the object specified are of the same type."},
/*****************************************************************************/ /*****************************************************************************/
/* PythonTypeObject callback function prototypes */ /* PythonTypeObject callback function prototypes */
/*****************************************************************************/ /*****************************************************************************/
static void ObjectDeAlloc (C_Object *obj); static void Object_dealloc (BPy_Object *obj);
static int ObjectPrint (C_Object *obj, FILE *fp, int flags); static int Object_print (BPy_Object *obj, FILE *fp, int flags);
static PyObject* ObjectGetAttr (C_Object *obj, char *name); static PyObject* Object_getAttr (BPy_Object *obj, char *name);
static int ObjectSetAttr (C_Object *obj, char *name, PyObject *v); static int Object_setAttr (BPy_Object *obj, char *name, PyObject *v);
static PyObject* ObjectRepr (C_Object *obj); static PyObject* Object_repr (BPy_Object *obj);
static int Object_compare (BPy_Object *a, BPy_Object *b);
/*****************************************************************************/ /*****************************************************************************/
/* Python TypeObject structure definition. */ /* Python TypeObject structure definition. */
@ -195,16 +196,16 @@ PyTypeObject Object_Type =
{ {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /* ob_size */ 0, /* ob_size */
"Object", /* tp_name */ "Blender Object", /* tp_name */
sizeof (C_Object), /* tp_basicsize */ sizeof (BPy_Object), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
/* methods */ /* methods */
(destructor)ObjectDeAlloc, /* tp_dealloc */ (destructor)Object_dealloc, /* tp_dealloc */
(printfunc)ObjectPrint, /* tp_print */ (printfunc)Object_print, /* tp_print */
(getattrfunc)ObjectGetAttr, /* tp_getattr */ (getattrfunc)Object_getAttr, /* tp_getattr */
(setattrfunc)ObjectSetAttr, /* tp_setattr */ (setattrfunc)Object_setAttr, /* tp_setattr */
0, /* tp_compare */ (cmpfunc)Object_compare, /* tp_compare */
(reprfunc)ObjectRepr, /* tp_repr */ (reprfunc)Object_repr, /* tp_repr */
0, /* tp_as_number */ 0, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
0, /* tp_as_mapping */ 0, /* tp_as_mapping */
@ -212,7 +213,7 @@ PyTypeObject Object_Type =
0,0,0,0,0,0, 0,0,0,0,0,0,
0, /* tp_doc */ 0, /* tp_doc */
0,0,0,0,0,0, 0,0,0,0,0,0,
C_Object_methods, /* tp_methods */ BPy_Object_methods, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
}; };
@ -223,13 +224,11 @@ PyTypeObject Object_Type =
PyObject *M_Object_New(PyObject *self, PyObject *args) PyObject *M_Object_New(PyObject *self, PyObject *args)
{ {
struct Object * object; struct Object * object;
C_Object * blen_object; BPy_Object * blen_object;
int type; int type;
char * str_type; char * str_type;
char * name = NULL; char * name = NULL;
printf ("In Object_New()\n");
if (!PyArg_ParseTuple(args, "s|s", &str_type, &name)) if (!PyArg_ParseTuple(args, "s|s", &str_type, &name))
{ {
PythonReturnErrorObject (PyExc_TypeError, PythonReturnErrorObject (PyExc_TypeError,
@ -365,7 +364,7 @@ PyObject *M_Object_New(PyObject *self, PyObject *args)
G.totobj++; G.totobj++;
/* Create a Python object from it. */ /* Create a Python object from it. */
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type); blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
blen_object->object = object; blen_object->object = object;
blen_object->data = NULL; blen_object->data = NULL;
blen_object->parent = NULL; blen_object->parent = NULL;
@ -382,13 +381,11 @@ PyObject *M_Object_Get(PyObject *self, PyObject *args)
struct Object * object; struct Object * object;
char * name = NULL; char * name = NULL;
printf ("In Object_Get()\n");
PyArg_ParseTuple(args, "|s", &name); PyArg_ParseTuple(args, "|s", &name);
if (name != NULL) if (name != NULL)
{ {
C_Object * blen_object; BPy_Object * blen_object;
object = GetObjectByName (name); object = GetObjectByName (name);
@ -398,7 +395,7 @@ PyObject *M_Object_Get(PyObject *self, PyObject *args)
return (PythonReturnErrorObject (PyExc_AttributeError, return (PythonReturnErrorObject (PyExc_AttributeError,
"Unknown object specified.")); "Unknown object specified."));
} }
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type); blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
blen_object->object = object; blen_object->object = object;
blen_object->parent = NULL; blen_object->parent = NULL;
blen_object->data = NULL; blen_object->data = NULL;
@ -446,7 +443,7 @@ PyObject *M_Object_Get(PyObject *self, PyObject *args)
/*****************************************************************************/ /*****************************************************************************/
static PyObject *M_Object_GetSelected (PyObject *self, PyObject *args) static PyObject *M_Object_GetSelected (PyObject *self, PyObject *args)
{ {
C_Object * blen_object; BPy_Object * blen_object;
PyObject * list; PyObject * list;
Base * base_iter; Base * base_iter;
@ -458,7 +455,7 @@ static PyObject *M_Object_GetSelected (PyObject *self, PyObject *args)
(G.scene->basact->lay & G.vd->lay))) (G.scene->basact->lay & G.vd->lay)))
{ {
/* Active object is first in the list. */ /* Active object is first in the list. */
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type); blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
if (blen_object == NULL) if (blen_object == NULL)
{ {
Py_DECREF (list); Py_DECREF (list);
@ -477,7 +474,7 @@ static PyObject *M_Object_GetSelected (PyObject *self, PyObject *args)
(base_iter->lay & G.vd->lay)) && (base_iter->lay & G.vd->lay)) &&
(base_iter != G.scene->basact)) (base_iter != G.scene->basact))
{ {
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type); blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
if (blen_object == NULL) if (blen_object == NULL)
{ {
Py_DECREF (list); Py_DECREF (list);
@ -496,23 +493,21 @@ static PyObject *M_Object_GetSelected (PyObject *self, PyObject *args)
/*****************************************************************************/ /*****************************************************************************/
/* Function: initObject */ /* Function: initObject */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Object_Init (void) PyObject *Object_Init (void)
{ {
PyObject * module; PyObject * module;
printf ("In initObject()\n");
Object_Type.ob_type = &PyType_Type; Object_Type.ob_type = &PyType_Type;
module = Py_InitModule3("Object", M_Object_methods, M_Object_doc); module = Py_InitModule3("Blender.Object", M_Object_methods, M_Object_doc);
return (module); return (module);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Object methods: */ /* Python BPy_Object methods: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Object_clrParent (C_Object *self, PyObject *args) static PyObject *Object_clrParent (BPy_Object *self, PyObject *args)
{ {
int mode=0; int mode=0;
int fast=0; int fast=0;
@ -541,7 +536,7 @@ static PyObject *Object_clrParent (C_Object *self, PyObject *args)
return (Py_None); return (Py_None);
} }
static PyObject *Object_getData (C_Object *self) static PyObject *Object_getData (BPy_Object *self)
{ {
PyObject * data_object; PyObject * data_object;
//# int obj_id; //# int obj_id;
@ -569,7 +564,7 @@ static PyObject *Object_getData (C_Object *self)
switch (self->object->type)//#obj_id) switch (self->object->type)//#obj_id)
{ {
case OB_ARMATURE://#ID_AR: case OB_ARMATURE://#ID_AR:
data_object = M_ArmatureCreatePyObject (self->object->data); data_object = Armature_CreatePyObject (self->object->data);
break; break;
case OB_CAMERA://#ID_CA: case OB_CAMERA://#ID_CA:
data_object = Camera_CreatePyObject (self->object->data); data_object = Camera_CreatePyObject (self->object->data);
@ -591,7 +586,7 @@ static PyObject *Object_getData (C_Object *self)
data_object = NMesh_CreatePyObject (self->object->data); data_object = NMesh_CreatePyObject (self->object->data);
break; break;
case ID_OB: case ID_OB:
data_object = M_ObjectCreatePyObject (self->object->data); data_object = Object_CreatePyObject (self->object->data);
break; break;
case ID_SCE: case ID_SCE:
break; break;
@ -615,13 +610,13 @@ static PyObject *Object_getData (C_Object *self)
} }
} }
static PyObject *Object_getDeformData (C_Object *self) static PyObject *Object_getDeformData (BPy_Object *self)
{ {
return (PythonReturnErrorObject (PyExc_NotImplementedError, return (PythonReturnErrorObject (PyExc_NotImplementedError,
"getDeformData: not yet implemented")); "getDeformData: not yet implemented"));
} }
static PyObject *Object_getDeltaLocation (C_Object *self) static PyObject *Object_getDeltaLocation (BPy_Object *self)
{ {
PyObject *attr = Py_BuildValue ("fff", PyObject *attr = Py_BuildValue ("fff",
self->object->dloc[0], self->object->dloc[0],
@ -634,7 +629,7 @@ static PyObject *Object_getDeltaLocation (C_Object *self)
"couldn't get Object.dloc attributes")); "couldn't get Object.dloc attributes"));
} }
static PyObject *Object_getDrawMode (C_Object *self) static PyObject *Object_getDrawMode (BPy_Object *self)
{ {
PyObject *attr = Py_BuildValue ("b", self->object->dtx); PyObject *attr = Py_BuildValue ("b", self->object->dtx);
@ -644,7 +639,7 @@ static PyObject *Object_getDrawMode (C_Object *self)
"couldn't get Object.drawMode attribute")); "couldn't get Object.drawMode attribute"));
} }
static PyObject *Object_getDrawType (C_Object *self) static PyObject *Object_getDrawType (BPy_Object *self)
{ {
PyObject *attr = Py_BuildValue ("b", self->object->dt); PyObject *attr = Py_BuildValue ("b", self->object->dt);
@ -654,7 +649,7 @@ static PyObject *Object_getDrawType (C_Object *self)
"couldn't get Object.drawType attribute")); "couldn't get Object.drawType attribute"));
} }
static PyObject *Object_getEuler (C_Object *self) static PyObject *Object_getEuler (BPy_Object *self)
{ {
PyObject *attr = Py_BuildValue ("fff", PyObject *attr = Py_BuildValue ("fff",
self->object->drot[0], self->object->drot[0],
@ -667,7 +662,7 @@ static PyObject *Object_getEuler (C_Object *self)
"couldn't get Object.drot attributes")); "couldn't get Object.drot attributes"));
} }
static PyObject *Object_getInverseMatrix (C_Object *self) static PyObject *Object_getInverseMatrix (BPy_Object *self)
{ {
Object * ob; Object * ob;
float inverse[4][4]; float inverse[4][4];
@ -678,7 +673,7 @@ static PyObject *Object_getInverseMatrix (C_Object *self)
return (newMatrixObject (inverse)); return (newMatrixObject (inverse));
} }
static PyObject *Object_getLocation (C_Object *self, PyObject *args) static PyObject *Object_getLocation (BPy_Object *self, PyObject *args)
{ {
PyObject *attr = Py_BuildValue ("fff", PyObject *attr = Py_BuildValue ("fff",
self->object->loc[0], self->object->loc[0],
@ -691,14 +686,14 @@ static PyObject *Object_getLocation (C_Object *self, PyObject *args)
"couldn't get Object.loc attributes")); "couldn't get Object.loc attributes"));
} }
static PyObject *Object_getMaterials (C_Object *self) static PyObject *Object_getMaterials (BPy_Object *self)
{ {
/* TODO: Implement when the Material module is implemented. */ /* TODO: Implement when the Material module is implemented. */
return (PythonReturnErrorObject (PyExc_NotImplementedError, return (PythonReturnErrorObject (PyExc_NotImplementedError,
"getMaterials: not yet implemented")); "getMaterials: not yet implemented"));
} }
static PyObject *Object_getMatrix (C_Object *self) static PyObject *Object_getMatrix (BPy_Object *self)
{ {
Object * ob; Object * ob;
@ -707,7 +702,7 @@ static PyObject *Object_getMatrix (C_Object *self)
return (newMatrixObject (ob->obmat)); return (newMatrixObject (ob->obmat));
} }
static PyObject *Object_getParent (C_Object *self) static PyObject *Object_getParent (BPy_Object *self)
{ {
PyObject *attr; PyObject *attr;
@ -721,11 +716,11 @@ static PyObject *Object_getParent (C_Object *self)
{ {
return (EXPP_incr_ret (Py_None)); return (EXPP_incr_ret (Py_None));
} }
attr = M_ObjectCreatePyObject (self->object->parent); attr = Object_CreatePyObject (self->object->parent);
if (attr) if (attr)
{ {
self->parent = (struct C_Object*)attr; self->parent = (struct BPy_Object*)attr;
return (attr); return (attr);
} }
@ -733,7 +728,7 @@ static PyObject *Object_getParent (C_Object *self)
"couldn't get Object.parent attribute")); "couldn't get Object.parent attribute"));
} }
static PyObject *Object_getTracked (C_Object *self) static PyObject *Object_getTracked (BPy_Object *self)
{ {
PyObject *attr; PyObject *attr;
@ -744,11 +739,11 @@ static PyObject *Object_getTracked (C_Object *self)
} }
/* TODO: what if self->object->track==NULL? Should we return Py_None? */ /* TODO: what if self->object->track==NULL? Should we return Py_None? */
attr = M_ObjectCreatePyObject (self->object->track); attr = Object_CreatePyObject (self->object->track);
if (attr) if (attr)
{ {
self->track = (struct C_Object*)attr; self->track = (struct BPy_Object*)attr;
return (attr); return (attr);
} }
@ -756,7 +751,7 @@ static PyObject *Object_getTracked (C_Object *self)
"couldn't get Object.track attribute")); "couldn't get Object.track attribute"));
} }
static PyObject *Object_getType (C_Object *self) static PyObject *Object_getType (BPy_Object *self)
{ {
switch (self->object->type) switch (self->object->type)
{ {
@ -776,7 +771,7 @@ static PyObject *Object_getType (C_Object *self)
} }
} }
static PyObject *Object_link (C_Object *self, PyObject *args) static PyObject *Object_link (BPy_Object *self, PyObject *args)
{ {
PyObject * py_data; PyObject * py_data;
ID * id; ID * id;
@ -844,11 +839,11 @@ static PyObject *Object_link (C_Object *self, PyObject *args)
return (Py_None); return (Py_None);
} }
static PyObject *Object_makeParent (C_Object *self, PyObject *args) static PyObject *Object_makeParent (BPy_Object *self, PyObject *args)
{ {
PyObject * list; PyObject * list;
PyObject * py_child; PyObject * py_child;
C_Object * py_obj_child; BPy_Object * py_obj_child;
Object * child; Object * child;
Object * parent; Object * parent;
int noninverse; int noninverse;
@ -872,8 +867,8 @@ static PyObject *Object_makeParent (C_Object *self, PyObject *args)
{ {
child = NULL; child = NULL;
py_child = PySequence_GetItem (list, i); py_child = PySequence_GetItem (list, i);
if (M_ObjectCheckPyObject (py_child)) if (Object_CheckPyObject (py_child))
child = (Object*) M_ObjectFromPyObject (py_child); child = (Object*) Object_FromPyObject (py_child);
if (child == NULL) if (child == NULL)
{ {
@ -889,8 +884,8 @@ static PyObject *Object_makeParent (C_Object *self, PyObject *args)
} }
child->partype = PAROBJECT; child->partype = PAROBJECT;
child->parent = parent; child->parent = parent;
py_obj_child = (C_Object *) py_child; py_obj_child = (BPy_Object *) py_child;
py_obj_child->parent = (struct C_Object *)self; py_obj_child->parent = (struct BPy_Object *)self;
if (noninverse == 1) if (noninverse == 1)
{ {
/* Parent inverse = unity */ /* Parent inverse = unity */
@ -915,13 +910,13 @@ static PyObject *Object_makeParent (C_Object *self, PyObject *args)
return (Py_None); return (Py_None);
} }
static PyObject *Object_materialUsage (C_Object *self, PyObject *args) static PyObject *Object_materialUsage (BPy_Object *self, PyObject *args)
{ {
return (PythonReturnErrorObject (PyExc_NotImplementedError, return (PythonReturnErrorObject (PyExc_NotImplementedError,
"materialUsage: not yet implemented")); "materialUsage: not yet implemented"));
} }
static PyObject *Object_setDeltaLocation (C_Object *self, PyObject *args) static PyObject *Object_setDeltaLocation (BPy_Object *self, PyObject *args)
{ {
float dloc1; float dloc1;
float dloc2; float dloc2;
@ -941,7 +936,7 @@ static PyObject *Object_setDeltaLocation (C_Object *self, PyObject *args)
return (Py_None); return (Py_None);
} }
static PyObject *Object_setDrawMode (C_Object *self, PyObject *args) static PyObject *Object_setDrawMode (BPy_Object *self, PyObject *args)
{ {
char dt; char dt;
@ -956,7 +951,7 @@ static PyObject *Object_setDrawMode (C_Object *self, PyObject *args)
return (Py_None); return (Py_None);
} }
static PyObject *Object_setDrawType (C_Object *self, PyObject *args) static PyObject *Object_setDrawType (BPy_Object *self, PyObject *args)
{ {
char dtx; char dtx;
@ -971,7 +966,7 @@ static PyObject *Object_setDrawType (C_Object *self, PyObject *args)
return (Py_None); return (Py_None);
} }
static PyObject *Object_setEuler (C_Object *self, PyObject *args) static PyObject *Object_setEuler (BPy_Object *self, PyObject *args)
{ {
float drot1; float drot1;
float drot2; float drot2;
@ -991,7 +986,7 @@ static PyObject *Object_setEuler (C_Object *self, PyObject *args)
return (Py_None); return (Py_None);
} }
static PyObject *Object_setLocation (C_Object *self, PyObject *args) static PyObject *Object_setLocation (BPy_Object *self, PyObject *args)
{ {
float loc1; float loc1;
float loc2; float loc2;
@ -1011,7 +1006,7 @@ static PyObject *Object_setLocation (C_Object *self, PyObject *args)
return (Py_None); return (Py_None);
} }
static PyObject *Object_setMaterials (C_Object *self, PyObject *args) static PyObject *Object_setMaterials (BPy_Object *self, PyObject *args)
{ {
#if 0 #if 0
PyObject * list; PyObject * list;
@ -1075,9 +1070,9 @@ static PyObject *Object_setMaterials (C_Object *self, PyObject *args)
"setMaterials: not yet implemented")); "setMaterials: not yet implemented"));
} }
static PyObject *Object_shareFrom (C_Object *self, PyObject *args) static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args)
{ {
C_Object * object; BPy_Object * object;
ID * id; ID * id;
ID * oldid; ID * oldid;
@ -1087,7 +1082,7 @@ static PyObject *Object_shareFrom (C_Object *self, PyObject *args)
"expected an object argument"); "expected an object argument");
return (NULL); return (NULL);
} }
if (!M_ObjectCheckPyObject ((PyObject*)object)) if (!Object_CheckPyObject ((PyObject*)object))
{ {
PythonReturnErrorObject (PyExc_TypeError, PythonReturnErrorObject (PyExc_TypeError,
"argument 1 is not of type 'Object'"); "argument 1 is not of type 'Object'");
@ -1135,17 +1130,15 @@ static PyObject *Object_shareFrom (C_Object *self, PyObject *args)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_ObjectCreatePyObject */ /* Function: Object_CreatePyObject */
/* Description: This function will create a new BlenObject from an existing */ /* Description: This function will create a new BlenObject from an existing */
/* Object structure. */ /* Object structure. */
/*****************************************************************************/ /*****************************************************************************/
PyObject* M_ObjectCreatePyObject (struct Object *obj) PyObject* Object_CreatePyObject (struct Object *obj)
{ {
C_Object * blen_object; BPy_Object * blen_object;
printf ("In M_ObjectCreatePyObject\n"); blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type);
if (blen_object == NULL) if (blen_object == NULL)
{ {
@ -1156,45 +1149,45 @@ PyObject* M_ObjectCreatePyObject (struct Object *obj)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_ObjectCheckPyObject */ /* Function: Object_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */ /* Description: This function returns true when the given PyObject is of the */
/* type Object. Otherwise it will return false. */ /* type Object. Otherwise it will return false. */
/*****************************************************************************/ /*****************************************************************************/
int M_ObjectCheckPyObject (PyObject *py_obj) int Object_CheckPyObject (PyObject *py_obj)
{ {
return (py_obj->ob_type == &Object_Type); return (py_obj->ob_type == &Object_Type);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_ObjectFromPyObject */ /* Function: Object_FromPyObject */
/* Description: This function returns the Blender object from the given */ /* Description: This function returns the Blender object from the given */
/* PyObject. */ /* PyObject. */
/*****************************************************************************/ /*****************************************************************************/
struct Object* M_ObjectFromPyObject (PyObject *py_obj) struct Object* Object_FromPyObject (PyObject *py_obj)
{ {
C_Object * blen_obj; BPy_Object * blen_obj;
blen_obj = (C_Object*)py_obj; blen_obj = (BPy_Object*)py_obj;
return (blen_obj->object); return (blen_obj->object);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ObjectDeAlloc */ /* Function: Object_dealloc */
/* Description: This is a callback function for the BlenObject type. It is */ /* Description: This is a callback function for the BlenObject type. It is */
/* the destructor function. */ /* the destructor function. */
/*****************************************************************************/ /*****************************************************************************/
static void ObjectDeAlloc (C_Object *obj) static void Object_dealloc (BPy_Object *obj)
{ {
PyObject_DEL (obj); PyObject_DEL (obj);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ObjectGetAttr */ /* Function: Object_getAttr */
/* Description: This is a callback function for the BlenObject type. It is */ /* Description: This is a callback function for the BlenObject type. It is */
/* the function that retrieves any value from Blender and */ /* the function that retrieves any value from Blender and */
/* passes it to Python. */ /* passes it to Python. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject* ObjectGetAttr (C_Object *obj, char *name) static PyObject* Object_getAttr (BPy_Object *obj, char *name)
{ {
struct Object * object; struct Object * object;
struct Ika * ika; struct Ika * ika;
@ -1277,9 +1270,9 @@ static PyObject* ObjectGetAttr (C_Object *obj, char *name)
if (StringEqual (name, "Layer")) if (StringEqual (name, "Layer"))
return (PyInt_FromLong(object->lay)); return (PyInt_FromLong(object->lay));
if (StringEqual (name, "parent")) if (StringEqual (name, "parent"))
return (M_ObjectCreatePyObject (object->parent)); return (Object_CreatePyObject (object->parent));
if (StringEqual (name, "track")) if (StringEqual (name, "track"))
return (M_ObjectCreatePyObject (object->track)); return (Object_CreatePyObject (object->track));
if (StringEqual (name, "data")) if (StringEqual (name, "data"))
return (Object_getData (obj)); return (Object_getData (obj));
if (StringEqual (name, "ipo")) if (StringEqual (name, "ipo"))
@ -1302,16 +1295,16 @@ static PyObject* ObjectGetAttr (C_Object *obj, char *name)
return (Py_BuildValue ("b", object->dtx)); return (Py_BuildValue ("b", object->dtx));
/* not an attribute, search the methods table */ /* not an attribute, search the methods table */
return Py_FindMethod(C_Object_methods, (PyObject *)obj, name); return Py_FindMethod(BPy_Object_methods, (PyObject *)obj, name);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ObjectSetAttr */ /* Function: Object_setAttr */
/* Description: This is a callback function for the BlenObject type. It is */ /* Description: This is a callback function for the BlenObject type. It is */
/* the function that retrieves any value from Python and sets */ /* the function that retrieves any value from Python and sets */
/* it accordingly in Blender. */ /* it accordingly in Blender. */
/*****************************************************************************/ /*****************************************************************************/
static int ObjectSetAttr (C_Object *obj, char *name, PyObject *value) static int Object_setAttr (BPy_Object *obj, char *name, PyObject *value)
{ {
struct Object * object; struct Object * object;
struct Ika * ika; struct Ika * ika;
@ -1469,22 +1462,36 @@ static int ObjectSetAttr (C_Object *obj, char *name, PyObject *value)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ObjectPrint */ /* Function: Object_compare */
/* Description: This is a callback function for the C_Object type. It */ /* Description: This is a callback function for the BPy_Object type. It */
/* compares two Object_Type objects. Only the "==" and "!=" */
/* comparisons are meaninful. Returns 0 for equality and -1 if */
/* they don't point to the same Blender Object struct. */
/* In Python it becomes 1 if they are equal, 0 otherwise. */
/*****************************************************************************/
static int Object_compare (BPy_Object *a, BPy_Object *b)
{
Object *pa = a->object, *pb = b->object;
return (pa == pb) ? 0:-1;
}
/*****************************************************************************/
/* Function: Object_print */
/* Description: This is a callback function for the BPy_Object type. It */
/* builds a meaninful string to 'print' object objects. */ /* builds a meaninful string to 'print' object objects. */
/*****************************************************************************/ /*****************************************************************************/
static int ObjectPrint(C_Object *self, FILE *fp, int flags) static int Object_print(BPy_Object *self, FILE *fp, int flags)
{ {
fprintf(fp, "[Object \"%s\"]", self->object->id.name+2); fprintf(fp, "[Object \"%s\"]", self->object->id.name+2);
return 0; return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: ObjectRepr */ /* Function: Object_repr */
/* Description: This is a callback function for the C_Object type. It */ /* Description: This is a callback function for the BPy_Object type. It */
/* builds a meaninful string to represent object objects. */ /* builds a meaninful string to represent object objects. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *ObjectRepr (C_Object *self) static PyObject *Object_repr (BPy_Object *self)
{ {
return PyString_FromString(self->object->id.name+2); return PyString_FromString(self->object->id.name+2);
} }

View File

@ -60,13 +60,13 @@
/* The Object PyType Object defined in Object.c */ /* The Object PyType Object defined in Object.c */
extern PyTypeObject Object_Type; extern PyTypeObject Object_Type;
#define C_Object_Check(v) \ #define BPy_Object_Check(v) \
((v)->ob_type == &Object_Type) /* for type checking */ ((v)->ob_type == &Object_Type) /* for type checking */
/*****************************************************************************/ /*****************************************************************************/
/* Python C_Object structure definition. */ /* Python BPy_Object structure definition. */
/*****************************************************************************/ /*****************************************************************************/
struct C_Object; struct BPy_Object;
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
@ -78,11 +78,11 @@ typedef struct {
/* points to the parent object. This is only set when there's a valid */ /* points to the parent object. This is only set when there's a valid */
/* PyObject (already created at some point). */ /* PyObject (already created at some point). */
struct C_Object * parent; struct BPy_Object * parent;
/* points to the object that is tracking this object. This is only set */ /* points to the object that is tracking this object. This is only set */
/* when there's a valid PyObject (already created at some point). */ /* when there's a valid PyObject (already created at some point). */
struct C_Object * track; struct BPy_Object * track;
} C_Object; } BPy_Object;
#endif /* EXPP_OBJECT_H */ #endif /* EXPP_OBJECT_H */

View File

@ -254,9 +254,9 @@ PyObject *M_Particle_Get(PyObject *self, PyObject *args)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_Particle_Init */ /* Function: Particle_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Particle_Init (void) PyObject *Particle_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
Particle_Type.ob_type = &PyType_Type; Particle_Type.ob_type = &PyType_Type;

View File

@ -162,12 +162,12 @@ static PyMethodDef BPy_Scene_methods[] = {
/*****************************************************************************/ /*****************************************************************************/
/* Python Scene_Type callback function prototypes: */ /* Python Scene_Type callback function prototypes: */
/*****************************************************************************/ /*****************************************************************************/
static void Scene_DeAlloc (BPy_Scene *self); static void Scene_dealloc (BPy_Scene *self);
static int Scene_Print (BPy_Scene *self, FILE *fp, int flags); static int Scene_print (BPy_Scene *self, FILE *fp, int flags);
static int Scene_SetAttr (BPy_Scene *self, char *name, PyObject *v); static int Scene_setAttr (BPy_Scene *self, char *name, PyObject *v);
static int Scene_Compare (BPy_Scene *a, BPy_Scene *b); static int Scene_compare (BPy_Scene *a, BPy_Scene *b);
static PyObject *Scene_GetAttr (BPy_Scene *self, char *name); static PyObject *Scene_getAttr (BPy_Scene *self, char *name);
static PyObject *Scene_Repr (BPy_Scene *self); static PyObject *Scene_repr (BPy_Scene *self);
/*****************************************************************************/ /*****************************************************************************/
/* Python Scene_Type structure definition: */ /* Python Scene_Type structure definition: */
@ -180,12 +180,12 @@ PyTypeObject Scene_Type =
sizeof (BPy_Scene), /* tp_basicsize */ sizeof (BPy_Scene), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
/* methods */ /* methods */
(destructor)Scene_DeAlloc, /* tp_dealloc */ (destructor)Scene_dealloc, /* tp_dealloc */
(printfunc)Scene_Print, /* tp_print */ (printfunc)Scene_print, /* tp_print */
(getattrfunc)Scene_GetAttr, /* tp_getattr */ (getattrfunc)Scene_getAttr, /* tp_getattr */
(setattrfunc)Scene_SetAttr, /* tp_setattr */ (setattrfunc)Scene_setAttr, /* tp_setattr */
(cmpfunc)Scene_Compare, /* tp_compare */ (cmpfunc)Scene_compare, /* tp_compare */
(reprfunc)Scene_Repr, /* tp_repr */ (reprfunc)Scene_repr, /* tp_repr */
0, /* tp_as_number */ 0, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
0, /* tp_as_mapping */ 0, /* tp_as_mapping */
@ -204,8 +204,6 @@ static PyObject *M_Scene_New(PyObject *self, PyObject *args, PyObject *kword)
PyObject *pyscene; /* for the Scene object wrapper in Python */ PyObject *pyscene; /* for the Scene object wrapper in Python */
Scene *blscene; /* for the actual Scene we create in Blender */ Scene *blscene; /* for the actual Scene we create in Blender */
printf ("In Scene_New()\n");
if (!PyArg_ParseTupleAndKeywords(args, kword, "|s", kw, &name)) if (!PyArg_ParseTupleAndKeywords(args, kword, "|s", kw, &name))
return (EXPP_ReturnPyObjError (PyExc_AttributeError, return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected a string or an empty argument list")); "expected a string or an empty argument list"));
@ -315,8 +313,6 @@ PyObject *Scene_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
printf ("In M_Scene_Init()\n");
Scene_Type.ob_type = &PyType_Type; Scene_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.Scene", submodule = Py_InitModule3("Blender.Scene",
@ -464,7 +460,7 @@ static PyObject *Scene_update (BPy_Scene *self)
static PyObject *Scene_link (BPy_Scene *self, PyObject *args) static PyObject *Scene_link (BPy_Scene *self, PyObject *args)
{ {
Scene *scene = self->scene; Scene *scene = self->scene;
C_Object *bpy_obj; /* XXX Change to BPy or whatever is chosen */ BPy_Object *bpy_obj; /* XXX Change to BPy or whatever is chosen */
if (!scene) if (!scene)
return EXPP_ReturnPyObjError (PyExc_RuntimeError, return EXPP_ReturnPyObjError (PyExc_RuntimeError,
@ -511,7 +507,7 @@ static PyObject *Scene_link (BPy_Scene *self, PyObject *args)
static PyObject *Scene_unlink (BPy_Scene *self, PyObject *args) static PyObject *Scene_unlink (BPy_Scene *self, PyObject *args)
{ {
C_Object *bpy_obj = NULL; BPy_Object *bpy_obj = NULL;
Object *object; Object *object;
Scene *scene = self->scene; Scene *scene = self->scene;
Base *base; Base *base;
@ -638,7 +634,7 @@ static PyObject *Scene_getCurrentCamera (BPy_Scene *self)
static PyObject *Scene_setCurrentCamera (BPy_Scene *self, PyObject *args) static PyObject *Scene_setCurrentCamera (BPy_Scene *self, PyObject *args)
{ {
Object *object; Object *object;
C_Object *cam_obj; BPy_Object *cam_obj;
Scene *scene = self->scene; Scene *scene = self->scene;
if (!scene) if (!scene)
@ -663,12 +659,12 @@ static PyObject *Scene_setCurrentCamera (BPy_Scene *self, PyObject *args)
return Py_None; return Py_None;
} }
static void Scene_DeAlloc (BPy_Scene *self) static void Scene_dealloc (BPy_Scene *self)
{ {
PyObject_DEL (self); PyObject_DEL (self);
} }
static PyObject *Scene_GetAttr (BPy_Scene *self, char *name) static PyObject *Scene_getAttr (BPy_Scene *self, char *name)
{ {
PyObject *attr = Py_None; PyObject *attr = Py_None;
@ -689,7 +685,7 @@ static PyObject *Scene_GetAttr (BPy_Scene *self, char *name)
return Py_FindMethod(BPy_Scene_methods, (PyObject *)self, name); return Py_FindMethod(BPy_Scene_methods, (PyObject *)self, name);
} }
static int Scene_SetAttr (BPy_Scene *self, char *name, PyObject *value) static int Scene_setAttr (BPy_Scene *self, char *name, PyObject *value)
{ {
PyObject *valtuple; PyObject *valtuple;
PyObject *error = NULL; PyObject *error = NULL;
@ -728,19 +724,19 @@ static int Scene_SetAttr (BPy_Scene *self, char *name, PyObject *value)
return 0; /* normal exit */ return 0; /* normal exit */
} }
static int Scene_Compare (BPy_Scene *a, BPy_Scene *b) static int Scene_compare (BPy_Scene *a, BPy_Scene *b)
{ {
Scene *pa = a->scene, *pb = b->scene; Scene *pa = a->scene, *pb = b->scene;
return (pa == pb) ? 0:-1; return (pa == pb) ? 0:-1;
} }
static int Scene_Print(BPy_Scene *self, FILE *fp, int flags) static int Scene_print(BPy_Scene *self, FILE *fp, int flags)
{ {
fprintf(fp, "[Scene \"%s\"]", self->scene->id.name+2); fprintf(fp, "[Scene \"%s\"]", self->scene->id.name+2);
return 0; return 0;
} }
static PyObject *Scene_Repr (BPy_Scene *self) static PyObject *Scene_repr (BPy_Scene *self)
{ {
return PyString_FromString(self->scene->id.name+2); return PyString_FromString(self->scene->id.name+2);
} }

View File

@ -57,7 +57,7 @@ typedef struct {
/* Python Scene_Type helper functions needed by Blender (the Init function) */ /* Python Scene_Type helper functions needed by Blender (the Init function) */
/* and Object modules. */ /* and Object modules. */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Scene_Init (void); PyObject *Scene_Init (void);
PyObject *Scene_CreatePyObject (Scene *cam); PyObject *Scene_CreatePyObject (Scene *cam);
Scene *Scene_FromPyObject (PyObject *pyobj); Scene *Scene_FromPyObject (PyObject *pyobj);
int Scene_CheckPyObject (PyObject *pyobj); int Scene_CheckPyObject (PyObject *pyobj);

View File

@ -0,0 +1,87 @@
/*
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* This is a new part of Blender.
*
* Contributor(s): Willian P. Germano
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Sys.h"
static PyObject *g_sysmodule = Py_None; /* pointer to Blender.sys module */
PyObject *sys_Init (void)
{
PyObject *submodule, *dict, *sep;
submodule = Py_InitModule3("Blender.sys", M_sys_methods, M_sys_doc);
g_sysmodule = submodule;
dict = PyModule_GetDict(submodule);
#ifdef WIN32
sep = Py_BuildValue("s", "\\");
#else
sep = Py_BuildValue("s", "/");
#endif
if (sep) {
Py_INCREF(sep);
PyDict_SetItemString(dict, "dirsep" , sep);
PyDict_SetItemString(dict, "sep" , sep);
}
return submodule;
}
static PyObject *M_sys_dirname (PyObject *self, PyObject *args)
{
PyObject *c;
char *name, dirname[256];
char sep;
int n;
if (!PyArg_ParseTuple(args, "s", &name))
return EXPP_ReturnPyObjError (PyExc_TypeError,
"expected string argument");
c = PyObject_GetAttrString (g_sysmodule, "dirsep");
sep = PyString_AsString(c)[0];
Py_DECREF(c);
n = strrchr(name, sep) - name;
if (n > 255) {
PyErr_SetString(PyExc_RuntimeError, "path too long");
return 0;
}
strncpy(dirname, name, n);
dirname[n] = 0;
return Py_BuildValue("s", dirname);
}

View File

@ -0,0 +1,66 @@
/*
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* This is a new part of Blender.
*
* Contributor(s): Willian P. Germano
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef EXPP_sys_H
#define EXPP_sys_H
#include <Python.h>
#include <BLI_blenlib.h> /* for BLI_last_slash() */
#include "gen_utils.h"
#include "modules.h"
/*****************************************************************************/
/* Python API function prototypes for the sys module. */
/*****************************************************************************/
static PyObject *M_sys_dirname (PyObject *self, PyObject *args);
/*****************************************************************************/
/* The following string definitions are used for documentation strings. */
/* In Python these will be written to the console when doing a */
/* Blender.sys.__doc__ */
/*****************************************************************************/
static char M_sys_doc[] =
"The Blender.sys submodule\n\
\n\
This is a minimal sys module kept for compatibility. It may also still be\n\
useful for users without full Python installations.\n";
static char M_sys_dirname_doc[] = "";
/*****************************************************************************/
/* Python method structure definition for Blender.sys module: */
/*****************************************************************************/
struct PyMethodDef M_sys_methods[] = {
{"dirname", M_sys_dirname, METH_VARARGS, M_sys_dirname_doc},
{NULL, NULL, 0, NULL}
};
#endif /* EXPP_sys_H */

View File

@ -400,9 +400,8 @@ static void Text_dealloc (BPy_Text *self)
static PyObject *Text_getAttr (BPy_Text *self, char *name) static PyObject *Text_getAttr (BPy_Text *self, char *name)
{ {
PyObject *attr = Py_None; PyObject *attr = Py_None;
Text *text = self->text;
if (!text || !Text_IsLinked(text)) if (!self->text || !Text_IsLinked(self))
return EXPP_ReturnPyObjError (PyExc_RuntimeError, return EXPP_ReturnPyObjError (PyExc_RuntimeError,
"Text was already deleted!"); "Text was already deleted!");
@ -439,9 +438,8 @@ static int Text_setAttr (BPy_Text *self, char *name, PyObject *value)
{ {
PyObject *valtuple; PyObject *valtuple;
PyObject *error = NULL; PyObject *error = NULL;
Text *text = self->text;
if (!text || !Text_IsLinked(text)) if (!self->text || !Text_IsLinked(self))
return EXPP_ReturnIntError (PyExc_RuntimeError, return EXPP_ReturnIntError (PyExc_RuntimeError,
"Text was already deleted!"); "Text was already deleted!");
@ -494,7 +492,7 @@ static int Text_compare (BPy_Text *a, BPy_Text *b)
/*****************************************************************************/ /*****************************************************************************/
static int Text_print(BPy_Text *self, FILE *fp, int flags) static int Text_print(BPy_Text *self, FILE *fp, int flags)
{ {
if (self->text && Text_IsLinked(self->text)) if (self->text && Text_IsLinked(self))
fprintf(fp, "[Text \"%s\"]", self->text->id.name+2); fprintf(fp, "[Text \"%s\"]", self->text->id.name+2);
else else
fprintf(fp, "[Text <deleted>]"); fprintf(fp, "[Text <deleted>]");
@ -509,23 +507,25 @@ static int Text_print(BPy_Text *self, FILE *fp, int flags)
/*****************************************************************************/ /*****************************************************************************/
static PyObject *Text_repr (BPy_Text *self) static PyObject *Text_repr (BPy_Text *self)
{ {
if (self->text && Text_IsLinked(self->text)) if (self->text && Text_IsLinked(self))
return PyString_FromString(self->text->id.name+2); return PyString_FromString(self->text->id.name+2);
else else
return PyString_FromString("<deleted>"); return PyString_FromString("<deleted>");
} }
/* internal function to confirm if a Text wasn't unlinked */ /* Internal function to confirm if a Text wasn't unlinked.
static int Text_IsLinked(Text *text) * This is necessary because without it, if a script writer
* referenced an already unlinked Text obj, Blender would crash. */
static int Text_IsLinked(BPy_Text *self)
{ {
Text *txt_iter = G.main->text.first; Text *txt_iter = G.main->text.first;
while (txt_iter) { while (txt_iter) {
if (text == txt_iter) return 1; if (self->text == txt_iter) return 1; /* ok, still linked */
txt_iter = txt_iter->id.next; txt_iter = txt_iter->id.next;
} }
/* uh-oh, it was already deleted */
self->text = NULL; /* so we invalidate the pointer */
return 0; return 0;
} }

View File

@ -178,6 +178,6 @@ PyTypeObject Text_Type =
0, /* tp_members */ 0, /* tp_members */
}; };
static int Text_IsLinked(Text *text); static int Text_IsLinked(BPy_Text *self);
#endif /* EXPP_TEXT_H */ #endif /* EXPP_TEXT_H */

View File

@ -166,8 +166,6 @@ int type = EFF_WAVE;
BPy_Effect *pyeffect; BPy_Effect *pyeffect;
Effect *bleffect = 0; Effect *bleffect = 0;
printf ("In Effect_New()\n");
bleffect = add_effect(type); bleffect = add_effect(type);
if (bleffect == NULL) if (bleffect == NULL)
return (EXPP_ReturnPyObjError (PyExc_RuntimeError, return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
@ -198,7 +196,7 @@ PyObject *M_Wave_Get(PyObject *self, PyObject *args)
Effect *eff; Effect *eff;
BPy_Wave *wanted_eff; BPy_Wave *wanted_eff;
int num,i; int num,i;
printf ("In Effect_Get()\n");
if (!PyArg_ParseTuple(args, "si", &name, &num )) if (!PyArg_ParseTuple(args, "si", &name, &num ))
return(EXPP_ReturnPyObjError(PyExc_AttributeError,\ return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
"expected string int argument")); "expected string int argument"));
@ -237,12 +235,12 @@ PyObject *M_Wave_Get(PyObject *self, PyObject *args)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: M_Wave_Init */ /* Function: Wave_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_Wave_Init (void) PyObject *Wave_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
printf ("In M_Wave_Init()\n");
Wave_Type.ob_type = &PyType_Type; Wave_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.Wave",M_Wave_methods, M_Wave_doc); submodule = Py_InitModule3("Blender.Wave",M_Wave_methods, M_Wave_doc);
return (submodule); return (submodule);
@ -548,7 +546,6 @@ PyObject* WaveCreatePyObject (struct Effect *wave)
{ {
BPy_Wave * blen_object; BPy_Wave * blen_object;
printf ("In WaveCreatePyObject\n");
blen_object = (BPy_Wave*)PyObject_NEW (BPy_Wave, &Wave_Type); blen_object = (BPy_Wave*)PyObject_NEW (BPy_Wave, &Wave_Type);

View File

@ -175,7 +175,7 @@ static PyObject *M_Window_ImageSelector(PyObject *self, PyObject *args)
static PyObject *M_Window_DrawProgressBar(PyObject *self, PyObject *args) static PyObject *M_Window_DrawProgressBar(PyObject *self, PyObject *args)
{ {
float done; float done;
char *info = 0; char *info = NULL;
int retval; int retval;
if(!PyArg_ParseTuple(args, "fs", &done, &info)) if(!PyArg_ParseTuple(args, "fs", &done, &info))
@ -194,8 +194,6 @@ PyObject *Window_Init (void)
{ {
PyObject *submodule, *Types; PyObject *submodule, *Types;
printf ("In M_Window_Init()\n");
submodule = Py_InitModule3("Blender.Window", M_Window_methods, M_Window_doc); submodule = Py_InitModule3("Blender.Window", M_Window_methods, M_Window_doc);
Types = Py_BuildValue("{s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h}", Types = Py_BuildValue("{s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h}",

View File

@ -209,12 +209,10 @@ static PyObject *M_World_Get(PyObject *self, PyObject *args)
* \return PyObject*: The initialized submodule. * \return PyObject*: The initialized submodule.
*/ */
PyObject *M_World_Init (void) PyObject *World_Init (void)
{ {
PyObject *submodule; PyObject *submodule;
printf ("In M_World_Init()\n");
World_Type.ob_type = &PyType_Type; World_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.World", submodule = Py_InitModule3("Blender.World",

View File

@ -175,7 +175,7 @@ static PyMethodDef BPy_World_methods[] = {
/* Python World_Type helper functions needed by Blender (the Init function) */ /* Python World_Type helper functions needed by Blender (the Init function) */
/* and Object modules. */ /* and Object modules. */
/*****************************************************************************/ /*****************************************************************************/
PyObject *M_World_Init (void); PyObject *World_Init (void);
PyObject *World_CreatePyObject (World *cam); PyObject *World_CreatePyObject (World *cam);
World *World_FromPyObject (PyObject *pyobj); World *World_FromPyObject (PyObject *pyobj);
int World_CheckPyObject (PyObject *pyobj); int World_CheckPyObject (PyObject *pyobj);

View File

@ -37,12 +37,12 @@
/*****************************************************************************/ /*****************************************************************************/
/* Python constant_Type callback function prototypes: */ /* Python constant_Type callback function prototypes: */
/*****************************************************************************/ /*****************************************************************************/
static void constantDeAlloc (C_constant *cam); static void constant_dealloc (BPy_constant *cam);
static PyObject *constantGetAttr (C_constant *cam, char *name); static PyObject *constant_getAttr (BPy_constant *cam, char *name);
static PyObject *constantRepr (C_constant *cam); static PyObject *constant_repr (BPy_constant *cam);
static int constantLength(C_constant *self); static int constantLength(BPy_constant *self);
static PyObject *constantSubscript(C_constant *self, PyObject *key); static PyObject *constantSubscript(BPy_constant *self, PyObject *key);
static int constantAssSubscript(C_constant *self, PyObject *who, static int constantAssSubscript(BPy_constant *self, PyObject *who,
PyObject *cares); PyObject *cares);
/*****************************************************************************/ /*****************************************************************************/
@ -62,16 +62,16 @@ PyTypeObject constant_Type =
{ {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /* ob_size */ 0, /* ob_size */
"constant", /* tp_name */ "Blender constant", /* tp_name */
sizeof (C_constant), /* tp_basicsize */ sizeof (BPy_constant), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
/* methods */ /* methods */
(destructor)constantDeAlloc, /* tp_dealloc */ (destructor)constant_dealloc, /* tp_dealloc */
0, /* tp_print */ 0, /* tp_print */
(getattrfunc)constantGetAttr, /* tp_getattr */ (getattrfunc)constant_getAttr, /* tp_getattr */
0, /* tp_setattr */ 0, /* tp_setattr */
0, /* tp_compare */ 0, /* tp_compare */
(reprfunc)constantRepr, /* tp_repr */ (reprfunc)constant_repr, /* tp_repr */
0, /* tp_as_number */ 0, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
&constantAsMapping, /* tp_as_mapping */ &constantAsMapping, /* tp_as_mapping */
@ -95,13 +95,11 @@ PyObject *M_constant_New(void) /* can't be static, we call it in other files */
static PyObject *new_const(void) static PyObject *new_const(void)
{ /* this is the static one */ { /* this is the static one */
C_constant *constant; BPy_constant *constant;
constant_Type.ob_type = &PyType_Type; constant_Type.ob_type = &PyType_Type;
printf ("In constant_New()\n"); constant = (BPy_constant *)PyObject_NEW(BPy_constant, &constant_Type);
constant = (C_constant *)PyObject_NEW(C_constant, &constant_Type);
if (constant == NULL) if (constant == NULL)
return (PythonReturnErrorObject (PyExc_MemoryError, return (PythonReturnErrorObject (PyExc_MemoryError,
@ -115,31 +113,31 @@ static PyObject *new_const(void)
} }
/*****************************************************************************/ /*****************************************************************************/
/* Python C_constant methods: */ /* Python BPy_constant methods: */
/*****************************************************************************/ /*****************************************************************************/
int constant_insert (C_constant *self, char *name, PyObject *value) int constant_insert (BPy_constant *self, char *name, PyObject *value)
{ {
return PyDict_SetItemString (self->dict, name, value); return PyDict_SetItemString (self->dict, name, value);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: constantDeAlloc */ /* Function: constant_dealloc */
/* Description: This is a callback function for the C_constant type. It is */ /* Description: This is a callback function for the BPy_constant type. It is */
/* the destructor function. */ /* the destructor function. */
/*****************************************************************************/ /*****************************************************************************/
static void constantDeAlloc (C_constant *self) static void constant_dealloc (BPy_constant *self)
{ {
Py_DECREF(self->dict); Py_DECREF(self->dict);
PyObject_DEL (self); PyObject_DEL (self);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: constantGetAttr */ /* Function: constant_getAttr */
/* Description: This is a callback function for the C_constant type. It is */ /* Description: This is a callback function for the BPy_constant type. It is */
/* the function that accesses C_constant member variables and */ /* the function that accesses BPy_constant member variables and */
/* methods. */ /* methods. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *constantGetAttr (C_constant *self, char *name) static PyObject *constant_getAttr (BPy_constant *self, char *name)
{ {
if (self->dict) if (self->dict)
{ {
@ -166,12 +164,12 @@ static PyObject *constantGetAttr (C_constant *self, char *name)
/* These functions provide code to access constant objects as */ /* These functions provide code to access constant objects as */
/* mappings. */ /* mappings. */
/*****************************************************************************/ /*****************************************************************************/
static int constantLength(C_constant *self) static int constantLength(BPy_constant *self)
{ {
return 0; return 0;
} }
static PyObject *constantSubscript(C_constant *self, PyObject *key) static PyObject *constantSubscript(BPy_constant *self, PyObject *key)
{ {
if (self->dict) { if (self->dict) {
PyObject *v = PyDict_GetItem(self->dict, key); PyObject *v = PyDict_GetItem(self->dict, key);
@ -185,7 +183,7 @@ static PyObject *constantSubscript(C_constant *self, PyObject *key)
return NULL; return NULL;
} }
static int constantAssSubscript(C_constant *self, PyObject *who, static int constantAssSubscript(BPy_constant *self, PyObject *who,
PyObject *cares) PyObject *cares)
{ {
/* no user assignments allowed */ /* no user assignments allowed */
@ -193,11 +191,11 @@ static int constantAssSubscript(C_constant *self, PyObject *who,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Function: constantRepr */ /* Function: constant_repr */
/* Description: This is a callback function for the C_constant type. It */ /* Description: This is a callback function for the BPy_constant type. It */
/* builds a meaninful string to represent constant objects. */ /* builds a meaninful string to represent constant objects. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *constantRepr (C_constant *self) static PyObject *constant_repr (BPy_constant *self)
{ {
PyObject *repr = PyObject_Repr(self->dict); PyObject *repr = PyObject_Repr(self->dict);
return repr; return repr;

View File

@ -46,17 +46,17 @@
PyObject *M_constant_New (void); PyObject *M_constant_New (void);
/*****************************************************************************/ /*****************************************************************************/
/* Python C_constant structure definition: */ /* Python BPy_constant structure definition: */
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
PyObject *dict; PyObject *dict;
} C_constant; } BPy_constant;
/*****************************************************************************/ /*****************************************************************************/
/* Python C_constant methods declarations: */ /* Python BPy_constant methods declarations: */
/*****************************************************************************/ /*****************************************************************************/
int constant_insert(C_constant *self, char *name, PyObject *value); int constant_insert(BPy_constant *self, char *name, PyObject *value);
#endif /* EXPP_constant_H */ #endif /* EXPP_constant_H */

View File

@ -1,18 +1,26 @@
# Blender.BGL module (OpenGL wrapper) # Blender.BGL module (OpenGL wrapper)
""" """
The Blender.BGL submodule (the OpenGL wrapper).
The Blender.BGL submodule The Blender.BGL submodule
=========================
This module wraps OpenGL constants and functions, making them available from This module wraps OpenGL constants and functions, making them available from
within Blender Python. The complete list can be retrieved from the module within Blender Python.
itself, by listing its contents: dir(Blender.BGL). There are too many to be
documented here, but a simple search on the net can point to more than enough The complete list can be retrieved from the module itself, by listing its
material to teach OpenGL programming, from books to many collections of contents: dir(Blender.BGL). There are too many to be documented here, but
tutorials. The I{red book}: "OpenGL Programming Guide", is a very good a simple search on the net can point to more than enough material to teach
resource, even for newcomers. OpenGL programming, from books to many collections of tutorials.
The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning
OpenGL}" and the online NeHe tutorials are two of the best resources.
@see: U{www.opengl.org} @see: U{www.opengl.org}
Example:: Example::
import Blender import Blender
from Blender.BGL import * from Blender.BGL import *
from Blender import Draw from Blender import Draw
@ -44,7 +52,7 @@ Example::
Draw.Redraw(1) # make changes visible. Draw.Redraw(1) # make changes visible.
# #
def ev(evt, val): # this is a callback for Draw.Register() def ev(evt, val): # this is a callback for Draw.Register()
global R,G,B,A # it handles input events global R,G,B,A # ... it handles input events
if evt == Draw.ESCKEY or evt == Draw.QKEY: if evt == Draw.ESCKEY or evt == Draw.QKEY:
Draw.Exit() # this quits the script Draw.Exit() # this quits the script
elif evt == Draw.LEFTMOUSE: R = 1 - R elif evt == Draw.LEFTMOUSE: R = 1 - R

View File

@ -7,16 +7,30 @@
# Blender.py Camera.py Lamp.py BGL.py etc. # Blender.py Camera.py Lamp.py BGL.py etc.
""" """
Here goes the Introduction to Blender Python This is the main Blender module.
Let's see:: Blender Python
==============
Submodules:
-----------
- L{Camera}
- L{Lamp}
- L{BGL}
- L{Window}
- L{Text}
Introduction:
-------------
- What scripting is, why have it - What scripting is, why have it
- What Python is, links - What Python is, links
- More about what scripting can give us - More about what scripting can give us
- Overview of the Blender Python modules - Overview of the Blender Python modules
- Links to Blender, Blender Python, later: script lists - Links to Blender, Blender Python, later: script lists
@author: The Blender Python Team @author: The Blender Python Team
@requires: Blender 2.28 or newer, Python 2.? (2.0, 2.1, 2.2 ???) or newer @requires: Blender 2.28 or newer.
@version: 0.1 @version: 0.1
@see: U{www.blender.org<http://www.blender.org>} @see: U{www.blender.org<http://www.blender.org>}
@see: U{projects.blender.org<http://projects.blender.org>} @see: U{projects.blender.org<http://projects.blender.org>}

View File

@ -1,7 +1,10 @@
# Blender.Camera module and the Camera PyType object # Blender.Camera module and the Camera PyType object
""" """
The Blender.Camera submodule The Blender.Camera submodule.
Camera Data
===========
This module provides access to B{Camera Data} objects in Blender. This module provides access to B{Camera Data} objects in Blender.

View File

@ -1,7 +1,10 @@
# Blender.Lamp module and the Lamp PyType object # Blender.Lamp module and the Lamp PyType object
""" """
The Blender.Lamp submodule The Blender.Lamp submodule.
Lamp Data
=========
This module provides control over B{Lamp Data} objects in Blender. This module provides control over B{Lamp Data} objects in Blender.

View File

@ -1,7 +1,10 @@
# Blender.Text module and the Text PyType object # Blender.Text module and the Text PyType object
""" """
The Blender.Text submodule The Blender.Text submodule.
Text Objects
============
This module provides access to B{Text} objects in Blender. This module provides access to B{Text} objects in Blender.

View File

@ -0,0 +1,117 @@
# Blender.Window module and the Window PyType object
"""
The Blender.Window submodule.
Window
======
This module provides access to B{Window} functions in Blender.
Example:
--------
FileSelector::
import Blender
from Blender import Window
#
def my_callback(filename): # callback for the FileSelector
print "You chose the file:", filename # do something with the chosen file
#
Window.FileSelector (my_callback, "Choose one!")
Example:
--------
DrawProgressBar::
import Blender
from Blender.Window import DrawProgressBar
#
# substitute the bogus_*() function calls for your own, of course.
#
DrawProgressBar (0.0, "Importing data ...")
bogus_importData()
DrawProgressBar (0.3, "Building something")
bogus_build()
DrawProgressBar (0.8, "Updating Blender")
bogus_update()
DrawProgressBar (1.0, "Finished")
#
# another example:
#
number = 1
while number < 20:
file = filename + "00%d" % number
DrawProgressBar (number / 20.0, "Loading texture: %s" % file)
Blender.Image.Load(file)
number += 1
DrawProgressBar (1.0, "Finished loading")
"""
def Redraw ():
"""
Force a redraw of a specific Window Type (see Window.Types).
"""
def RedrawAll ():
"""
Redraw all windows.
"""
def QRedrawAll ():
"""
Redraw all windows by queue event.
"""
def FileSelector (callback, title = 'SELECT FILE'):
"""
Open the file selector window in Blender. After the user selects a filename,
it is passed as parameter to the function callback given to FileSelector().
Example::
import Blender
#
def my_function(filename):
print 'The selected file was:', filename
#
Blender.Window.FileSelector (my_function, 'SAVE FILE')
@type callback: function that accepts a string: f(str)
@param callback: The function that must be provided to FileSelector() and
will receive the selected filename as parameter.
@type title: string
@param title: The string that appears in the button to confirm the selection
and return from the file selection window.
"""
def ImageSelector (callback, title = 'SELECT IMAGE'):
"""
Open the image selector window in Blender. After the user selects a filename,
it is passed as parameter to the function callback given to ImageSelector().
Example::
import Blender
#
def my_function(imagename):
print 'The selected image was:', imagename
#
Blender.Window.ImageSelector (my_function, 'LOAD IMAGE')
@type callback: function that accepts a string: f(str)
@param callback: The function that must be provided to ImageSelector() and
will receive the selected filename as parameter.
@type title: string
@param title: The string that appears in the button to confirm the selection
and return from the image selection window.
"""
def DrawProgressBar (done, text):
"""
Draw a progress bar in the upper right corner of the screen. To cancel it
prematurely, users can press the "Esc" key.
@type done: float
@param done: A float in [0, 1] that tells the advance in the progress
bar.
@type text: string
@param text: Info about what is currently being done "behind the scenes".
"""

View File

@ -58,11 +58,14 @@ extern PyObject *g_blenderdict;
/*****************************************************************************/ /*****************************************************************************/
void M_Blender_Init (void); void M_Blender_Init (void);
/* sys */
PyObject * sys_Init (void);
/* Object itself */ /* Object itself */
PyObject * M_Object_Init (void); PyObject * Object_Init (void);
PyObject * M_ObjectCreatePyObject (struct Object *obj); PyObject * Object_CreatePyObject (struct Object *obj);
int M_ObjectCheckPyObject (PyObject *py_obj); Object * Object_FromPyObject (PyObject *py_obj);
struct Object * M_ObjectFromPyObject (PyObject *py_obj); int Object_CheckPyObject (PyObject *py_obj);
/* Scene */ /* Scene */
PyObject * Scene_Init (void); PyObject * Scene_Init (void);
@ -95,33 +98,33 @@ Lamp * Lamp_FromPyObject (PyObject *pyobj);
int Lamp_CheckPyObject (PyObject *pyobj); int Lamp_CheckPyObject (PyObject *pyobj);
/* Curve Data */ /* Curve Data */
PyObject * M_Curve_Init (void); PyObject * Curve_Init (void);
PyObject * CurveCreatePyObject (struct Curve *curve); PyObject * CurveCreatePyObject (struct Curve *curve);
struct Curve * CurveFromPyObject (PyObject *py_obj); Curve * CurveFromPyObject (PyObject *py_obj);
int CurveCheckPyObject (PyObject *py_obj); int CurveCheckPyObject (PyObject *py_obj);
/* Armature Data */ /* Armature Data */
PyObject * M_Armature_Init (void); PyObject * Armature_Init (void);
PyObject * M_ArmatureCreatePyObject (bArmature *armature); PyObject * Armature_CreatePyObject (bArmature *armature);
bArmature* M_ArmatureFromPyObject (PyObject *py_obj); bArmature * Armature_FromPyObject (PyObject *py_obj);
int M_ArmatureCheckPyObject (PyObject *py_obj); int Armature_CheckPyObject (PyObject *py_obj);
/* Ipo Data */ /* Ipo Data */
PyObject * M_Ipo_Init (void); PyObject * Ipo_Init (void);
PyObject * Ipo_CreatePyObject (struct Ipo *ipo); PyObject * Ipo_CreatePyObject (struct Ipo *ipo);
struct Ipo * Ipo_FromPyObject (PyObject *py_obj); Ipo * Ipo_FromPyObject (PyObject *py_obj);
int Ipo_CheckPyObject (PyObject *py_obj); int Ipo_CheckPyObject (PyObject *py_obj);
/* Metaball Data */ /* Metaball Data */
PyObject * M_Metaball_Init (void); PyObject * Metaball_Init (void);
PyObject * Metaball_CreatePyObject (MetaBall *metaball); PyObject * Metaball_CreatePyObject (MetaBall *metaball);
struct MetaBall * Metaball_FromPyObject (PyObject *py_obj); MetaBall * Metaball_FromPyObject (PyObject *py_obj);
int Metaball_CheckPyObject (PyObject *py_obj); int Metaball_CheckPyObject (PyObject *py_obj);
/* Particle Effects Data */ /* Particle Effects Data */
PyObject * M_Effect_Init (void); PyObject * Effect_Init (void);
PyObject * Effect_CreatePyObject (struct Effect *effect); PyObject * Effect_CreatePyObject (struct Effect *effect);
struct Effect * Effect_FromPyObject (PyObject *py_obj); Effect * Effect_FromPyObject (PyObject *py_obj);
int Effect_CheckPyObject (PyObject *py_obj); int Effect_CheckPyObject (PyObject *py_obj);
/* Image */ /* Image */
@ -137,6 +140,6 @@ PyObject * Text_CreatePyObject (Text *txt);
PyObject * Window_Init (void); PyObject * Window_Init (void);
PyObject * Draw_Init (void); PyObject * Draw_Init (void);
PyObject * BGL_Init (void); PyObject * BGL_Init (void);
PyObject * M_World_Init (void); PyObject * World_Init (void);
#endif /* EXPP_modules_h */ #endif /* EXPP_modules_h */