From dc686139de8740484c55516e225ab515db5734f2 Mon Sep 17 00:00:00 2001 From: Jacques Guignot Date: Fri, 27 Jun 2003 07:46:29 +0000 Subject: [PATCH] end of cleanup ; naming conventions, balance between c and h files --- source/blender/python/api2_2x/Build.c | 98 ++++----- source/blender/python/api2_2x/Build.h | 79 ++++--- source/blender/python/api2_2x/Curve.h | 85 ++++---- source/blender/python/api2_2x/Effect.c | 68 +++---- source/blender/python/api2_2x/Effect.h | 31 ++- source/blender/python/api2_2x/Metaball.c | 122 ++++++----- source/blender/python/api2_2x/Metaball.h | 122 ++++------- source/blender/python/api2_2x/Particle.c | 126 ++++++------ source/blender/python/api2_2x/Particle.h | 104 +++++----- source/blender/python/api2_2x/Wave.c | 90 ++++---- source/blender/python/api2_2x/Wave.h | 68 +++---- source/blender/python/api2_2x/World.c | 238 +++++----------------- source/blender/python/api2_2x/World.h | 137 ++++++++++++- source/blender/python/api2_2x/bpy_types.h | 121 ++++++++++- 14 files changed, 779 insertions(+), 710 deletions(-) diff --git a/source/blender/python/api2_2x/Build.c b/source/blender/python/api2_2x/Build.c index b2f285986bf..9224aca763c 100644 --- a/source/blender/python/api2_2x/Build.c +++ b/source/blender/python/api2_2x/Build.c @@ -32,28 +32,6 @@ #include "Build.h" #include "Effect.h" -/*****************************************************************************/ -/* Python C_Build methods table: */ -/*****************************************************************************/ -static PyMethodDef C_Build_methods[] = { - {"getType", (PyCFunction)Effect_getType, - METH_NOARGS,"() - Return Effect type"}, - {"setType", (PyCFunction)Effect_setType, - METH_VARARGS,"() - Set Effect type"}, - {"getFlag", (PyCFunction)Effect_getFlag, - METH_NOARGS,"() - Return Effect flag"}, - {"setFlag", (PyCFunction)Effect_setFlag, - METH_VARARGS,"() - Set Effect flag"}, - {"getLen",(PyCFunction)Build_getLen, - METH_NOARGS,"()-Return Build len"}, - {"setLen",(PyCFunction)Build_setLen, METH_VARARGS, - "()- Sets Build len"}, - {"getSfra",(PyCFunction)Build_getSfra, - METH_NOARGS,"()-Return Build sfra"}, - {"setSfra",(PyCFunction)Build_setSfra, METH_VARARGS, - "()- Sets Build sfra"}, - {0} -}; /*****************************************************************************/ /* Python Build_Type structure definition: */ /*****************************************************************************/ @@ -62,7 +40,7 @@ PyTypeObject Build_Type = PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "Build", /* tp_name */ - sizeof (C_Build), /* tp_basicsize */ + sizeof (BPy_Build), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)BuildDeAlloc, /* tp_dealloc */ @@ -78,19 +56,10 @@ PyTypeObject Build_Type = 0,0,0,0,0,0, 0, /* tp_doc */ 0,0,0,0,0,0, - C_Build_methods, /* tp_methods */ + BPy_Build_methods, /* tp_methods */ 0, /* tp_members */ }; -/*****************************************************************************/ -/* Python method structure definition for Blender.Build module: */ -/*****************************************************************************/ -struct PyMethodDef M_Build_methods[] = { - {"New",(PyCFunction)M_Build_New, METH_VARARGS,0}, - {"Get", M_Build_Get, METH_VARARGS, 0}, - {"get", M_Build_Get, METH_VARARGS, 0}, - {NULL, NULL, 0, NULL} -}; /*****************************************************************************/ @@ -100,7 +69,7 @@ struct PyMethodDef M_Build_methods[] = { PyObject *M_Build_New(PyObject *self, PyObject *args) { int type = EFF_BUILD; - C_Effect *pyeffect; + BPy_Effect *pyeffect; Effect *bleffect = 0; printf ("In Effect_New()\n"); @@ -110,7 +79,7 @@ int type = EFF_BUILD; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create Effect Data in Blender")); - pyeffect = (C_Effect *)PyObject_NEW(C_Effect, &Effect_Type); + pyeffect = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); if (pyeffect == NULL) return (EXPP_ReturnPyObjError (PyExc_MemoryError, @@ -133,7 +102,7 @@ PyObject *M_Build_Get(PyObject *self, PyObject *args) char *name = 0; Object *object_iter; Effect *eff; - C_Build *wanted_eff; + BPy_Build *wanted_eff; int num,i; printf ("In Effect_Get()\n"); if (!PyArg_ParseTuple(args, "si", &name, &num )) @@ -161,9 +130,9 @@ PyObject *M_Build_Get(PyObject *self, PyObject *args) if (eff->type != EFF_BUILD)continue; eff = eff->next; if (!eff) - return(EXPP_ReturnPyObjError(PyExc_AttributeError,"bject")); + return(EXPP_ReturnPyObjError(PyExc_AttributeError,"object not created")); } - wanted_eff = (C_Build *)PyObject_NEW(C_Build, &Build_Type); + wanted_eff = (BPy_Build *)PyObject_NEW(BPy_Build, &Build_Type); wanted_eff->build = eff; return (PyObject*)wanted_eff; } @@ -173,6 +142,15 @@ PyObject *M_Build_Get(PyObject *self, PyObject *args) return Py_None; } + + +struct PyMethodDef M_Build_methods[] = { + {"New",(PyCFunction)M_Build_New, METH_VARARGS, M_Build_New_doc}, + {"Get", M_Build_Get, METH_VARARGS, M_Build_Get_doc}, + {"get", M_Build_Get, METH_VARARGS,M_Build_Get_doc}, + {NULL, NULL, 0, NULL} +}; + /*****************************************************************************/ /* Function: M_Build_Init */ /*****************************************************************************/ @@ -181,22 +159,22 @@ PyObject *M_Build_Init (void) PyObject *submodule; printf ("In M_Build_Init()\n"); Build_Type.ob_type = &PyType_Type; - submodule = Py_InitModule3("Blender.Build",M_Build_methods, 0); + submodule = Py_InitModule3("Blender.Build",M_Build_methods,M_Build_doc ); return (submodule); } /*****************************************************************************/ -/* Python C_Build methods: */ +/* Python BPy_Build methods: */ /*****************************************************************************/ -PyObject *Build_getLen(C_Build *self) +PyObject *Build_getLen(BPy_Build *self) { BuildEff*ptr = (BuildEff*)self->build; return PyFloat_FromDouble(ptr->len); } -PyObject *Build_setLen(C_Build *self,PyObject *args) +PyObject *Build_setLen(BPy_Build *self,PyObject *args) { BuildEff*ptr = (BuildEff*)self->build; float val = 0; @@ -209,13 +187,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) } -PyObject *Build_getSfra(C_Build *self) +PyObject *Build_getSfra(BPy_Build *self) { BuildEff*ptr = (BuildEff*)self->build; return PyFloat_FromDouble(ptr->sfra); } -PyObject *Build_setSfra(C_Build *self,PyObject *args) +PyObject *Build_setSfra(BPy_Build *self,PyObject *args) { BuildEff*ptr = (BuildEff*)self->build; float val = 0; @@ -229,10 +207,10 @@ PyObject *Build_setSfra(C_Build *self,PyObject *args) /*****************************************************************************/ /* Function: BuildDeAlloc */ -/* Description: This is a callback function for the C_Build type. It is */ +/* Description: This is a callback function for the BPy_Build type. It is */ /* the destructor function. */ /*****************************************************************************/ -void BuildDeAlloc (C_Build *self) +void BuildDeAlloc (BPy_Build *self) { BuildEff*ptr = (BuildEff*)self; PyObject_DEL (ptr); @@ -240,24 +218,24 @@ void BuildDeAlloc (C_Build *self) /*****************************************************************************/ /* Function: BuildGetAttr */ -/* Description: This is a callback function for the C_Build type. It is */ -/* the function that accesses C_Build "member variables" and */ +/* Description: This is a callback function for the BPy_Build type. It is */ +/* the function that accesses BPy_Build "member variables" and */ /* methods. */ /*****************************************************************************/ -PyObject *BuildGetAttr (C_Build *self, char *name) +PyObject *BuildGetAttr (BPy_Build *self, char *name) { if (!strcmp(name,"sfra"))return Build_getSfra( self); if (!strcmp(name,"len"))return Build_getLen( self); - return Py_FindMethod(C_Build_methods, (PyObject *)self, name); + return Py_FindMethod(BPy_Build_methods, (PyObject *)self, name); } /*****************************************************************************/ /* Function: BuildSetAttr */ -/* Description: This is a callback function for the C_Build type. It is the */ +/* Description: This is a callback function for the BPy_Build type. It is the */ /* function that sets Build Data attributes (member variables). */ /*****************************************************************************/ -int BuildSetAttr (C_Build *self, char *name, PyObject *value) +int BuildSetAttr (BPy_Build *self, char *name, PyObject *value) { PyObject *valtuple; PyObject *error = NULL; @@ -286,31 +264,31 @@ int BuildSetAttr (C_Build *self, char *name, PyObject *value) /*****************************************************************************/ /* Function: BuildPrint */ -/* Description: This is a callback function for the C_Build type. It */ +/* Description: This is a callback function for the BPy_Build type. It */ /* builds a meaninful string to 'print' build objects. */ /*****************************************************************************/ -int BuildPrint(C_Build *self, FILE *fp, int flags) +int BuildPrint(BPy_Build *self, FILE *fp, int flags) { return 0; } /*****************************************************************************/ /* Function: BuildRepr */ -/* Description: This is a callback function for the C_Build type. It */ +/* Description: This is a callback function for the BPy_Build type. It */ /* builds a meaninful string to represent build objects. */ /*****************************************************************************/ -PyObject *BuildRepr (C_Build *self) +PyObject *BuildRepr (BPy_Build *self) { return 0; } PyObject* BuildCreatePyObject (struct Effect *build) { - C_Build * blen_object; + BPy_Build * blen_object; printf ("In BuildCreatePyObject\n"); - blen_object = (C_Build*)PyObject_NEW (C_Build, &Build_Type); + blen_object = (BPy_Build*)PyObject_NEW (BPy_Build, &Build_Type); if (blen_object == NULL) { @@ -329,9 +307,9 @@ return (py_obj->ob_type == &Build_Type); struct Build* BuildFromPyObject (PyObject *py_obj) { - C_Build * blen_obj; + BPy_Build * blen_obj; - blen_obj = (C_Build*)py_obj; + blen_obj = (BPy_Build*)py_obj; return ((struct Build*)blen_obj->build); } diff --git a/source/blender/python/api2_2x/Build.h b/source/blender/python/api2_2x/Build.h index cf07926d6a4..542a2560d16 100644 --- a/source/blender/python/api2_2x/Build.h +++ b/source/blender/python/api2_2x/Build.h @@ -44,46 +44,77 @@ #include #include "gen_utils.h" +#include "bpy_types.h" +#include "Effect.h" /*****************************************************************************/ /* Python API function prototypes for the Build module. */ /*****************************************************************************/ PyObject *M_Build_New (PyObject *self, PyObject *args); PyObject *M_Build_Get (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.Camera.__doc__ */ +/*****************************************************************************/ + +static char M_Build_doc[] = +"The Blender Build module\n\ +This module provides access to **Build Data** objects in Blender\n"; + +static char M_Build_New_doc[] = +"Build.New ():\n\ + Return a new Build Data object with the given type and name."; + +static char M_Build_Get_doc[] = +"Build.Get (name = None):\n\ + Return the build data with the given 'name', None if not found, or\n\ + Return a list with all Build Data objects in the current scene,\n\ + if no argument was given."; /*****************************************************************************/ -/* Python C_Build structure definition: */ +/* Python method structure definition for Blender.Build module: */ /*****************************************************************************/ -typedef struct { - PyObject_HEAD - Effect *build; -} C_Build; -#include"Effect.h" +/* +struct PyMethodDef M_Build_methods[] = { + {"New",(PyCFunction)M_Build_New, METH_VARARGS, 0}, + {"Get", M_Build_Get, METH_VARARGS, 0}, + {"get", M_Build_Get, METH_VARARGS, 0}, + {NULL, NULL, 0, NULL} +}; +*/ /*****************************************************************************/ -/* Python C_Build methods declarations: */ +/* Python BPy_Build methods declarations: */ /*****************************************************************************/ -PyObject *Effect_getType(C_Effect *self); -PyObject *Effect_setType(C_Effect *self, PyObject *args); -PyObject *Effect_getFlag(C_Effect *self); -PyObject *Effect_setFlag(C_Effect *self, PyObject *args); -PyObject *Build_getLen(C_Build *self); -PyObject *Build_setLen(C_Build *self,PyObject*a); -PyObject *Build_getSfra(C_Build *self); -PyObject *Build_setSfra(C_Build *self,PyObject*a); -PyObject *Build_getLen(C_Build *self); -PyObject *Build_setLen(C_Build *self,PyObject*a); -PyObject *Build_getSfra(C_Build *self); -PyObject *Build_setSfra(C_Build *self,PyObject*a); +PyObject *Build_getLen(BPy_Build *self); +PyObject *Build_setLen(BPy_Build *self,PyObject*a); +PyObject *Build_getSfra(BPy_Build *self); +PyObject *Build_setSfra(BPy_Build *self,PyObject*a); + +/*****************************************************************************/ +/* Python BPy_Build methods table: */ +/*****************************************************************************/ +static PyMethodDef BPy_Build_methods[] = { + {"getLen",(PyCFunction)Build_getLen, + METH_NOARGS,"()-Return Build len"}, + {"setLen",(PyCFunction)Build_setLen, METH_VARARGS, + "()- Sets Build len"}, + {"getSfra",(PyCFunction)Build_getSfra, + METH_NOARGS,"()-Return Build sfra"}, + {"setSfra",(PyCFunction)Build_setSfra, METH_VARARGS, + "()- Sets Build sfra"}, + {0} +}; /*****************************************************************************/ /* Python Build_Type callback function prototypes: */ /*****************************************************************************/ -void BuildDeAlloc (C_Build *msh); -int BuildPrint (C_Build *msh, FILE *fp, int flags); -int BuildSetAttr (C_Build *msh, char *name, PyObject *v); -PyObject *BuildGetAttr (C_Build *msh, char *name); -PyObject *BuildRepr (C_Build *msh); +void BuildDeAlloc (BPy_Build *msh); +int BuildPrint (BPy_Build *msh, FILE *fp, int flags); +int BuildSetAttr (BPy_Build *msh, char *name, PyObject *v); +PyObject *BuildGetAttr (BPy_Build *msh, char *name); +PyObject *BuildRepr (BPy_Build *msh); PyObject* BuildCreatePyObject (struct Effect *build); int BuildCheckPyObject (PyObject *py_obj); struct Build* BuildFromPyObject (PyObject *py_obj); diff --git a/source/blender/python/api2_2x/Curve.h b/source/blender/python/api2_2x/Curve.h index 38f795a1e78..741050c83ff 100644 --- a/source/blender/python/api2_2x/Curve.h +++ b/source/blender/python/api2_2x/Curve.h @@ -42,9 +42,9 @@ #include #include #include -#include #include "gen_utils.h" +#include "bpy_types.h" /*****************************************************************************/ /* Python API function prototypes for the Curve module. */ @@ -75,50 +75,43 @@ struct PyMethodDef M_Curve_methods[] = { {NULL, NULL, 0, NULL} }; -/*****************************************************************************/ -/* Python C_Curve structure definition: */ -/*****************************************************************************/ -typedef struct { - PyObject_HEAD - Curve *curve; -} C_Curve; /*****************************************************************************/ -/* Python C_Curve methods declarations: */ +/* Python BPy_Curve methods declarations: */ /*****************************************************************************/ -static PyObject *Curve_getName(C_Curve *self); -static PyObject *Curve_setName(C_Curve *self, PyObject *args); -static PyObject *Curve_getPathLen(C_Curve *self); -static PyObject *Curve_setPathLen(C_Curve *self, PyObject *args); -static PyObject *Curve_getTotcol(C_Curve *self); -static PyObject *Curve_setTotcol(C_Curve *self, PyObject *args); -static PyObject *Curve_getMode(C_Curve *self); -static PyObject *Curve_setMode(C_Curve *self, PyObject *args); -static PyObject *Curve_getBevresol(C_Curve *self); -static PyObject *Curve_setBevresol(C_Curve *self, PyObject *args); -static PyObject *Curve_getResolu(C_Curve *self); -static PyObject *Curve_setResolu(C_Curve *self, PyObject *args); -static PyObject *Curve_getResolv(C_Curve *self); -static PyObject *Curve_setResolv(C_Curve *self, PyObject *args); -static PyObject *Curve_getWidth(C_Curve *self); -static PyObject *Curve_setWidth(C_Curve *self, PyObject *args); -static PyObject *Curve_getExt1(C_Curve *self); -static PyObject *Curve_setExt1(C_Curve *self, PyObject *args); -static PyObject *Curve_getExt2(C_Curve *self); -static PyObject *Curve_setExt2(C_Curve *self, PyObject *args); -static PyObject *Curve_getControlPoint(C_Curve *self, PyObject *args); -static PyObject *Curve_setControlPoint(C_Curve *self, PyObject *args); -static PyObject *Curve_getLoc(C_Curve *self); -static PyObject *Curve_setLoc(C_Curve *self, PyObject *args); -static PyObject *Curve_getRot(C_Curve *self); -static PyObject *Curve_setRot(C_Curve *self, PyObject *args); -static PyObject *Curve_getSize(C_Curve *self); -static PyObject *Curve_setSize(C_Curve *self, PyObject *args); +static PyObject *Curve_getName(BPy_Curve *self); +static PyObject *Curve_setName(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getPathLen(BPy_Curve *self); +static PyObject *Curve_setPathLen(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getTotcol(BPy_Curve *self); +static PyObject *Curve_setTotcol(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getMode(BPy_Curve *self); +static PyObject *Curve_setMode(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getBevresol(BPy_Curve *self); +static PyObject *Curve_setBevresol(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getResolu(BPy_Curve *self); +static PyObject *Curve_setResolu(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getResolv(BPy_Curve *self); +static PyObject *Curve_setResolv(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getWidth(BPy_Curve *self); +static PyObject *Curve_setWidth(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getExt1(BPy_Curve *self); +static PyObject *Curve_setExt1(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getExt2(BPy_Curve *self); +static PyObject *Curve_setExt2(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getControlPoint(BPy_Curve *self, PyObject *args); +static PyObject *Curve_setControlPoint(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getLoc(BPy_Curve *self); +static PyObject *Curve_setLoc(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getRot(BPy_Curve *self); +static PyObject *Curve_setRot(BPy_Curve *self, PyObject *args); +static PyObject *Curve_getSize(BPy_Curve *self); +static PyObject *Curve_setSize(BPy_Curve *self, PyObject *args); /*****************************************************************************/ -/* Python C_Curve methods table: */ +/* Python BPy_Curve methods table: */ /*****************************************************************************/ -static PyMethodDef C_Curve_methods[] = { +static PyMethodDef BPy_Curve_methods[] = { {"getName", (PyCFunction)Curve_getName, METH_NOARGS,"() - Return Curve Data name"}, {"setName", (PyCFunction)Curve_setName, @@ -184,11 +177,11 @@ Sets a control point "}, /*****************************************************************************/ /* Python Curve_Type callback function prototypes: */ /*****************************************************************************/ -static void CurveDeAlloc (C_Curve *msh); -static int CurvePrint (C_Curve *msh, FILE *fp, int flags); -static int CurveSetAttr (C_Curve *msh, char *name, PyObject *v); -static PyObject *CurveGetAttr (C_Curve *msh, char *name); -static PyObject *CurveRepr (C_Curve *msh); +static void CurveDeAlloc (BPy_Curve *msh); +static int CurvePrint (BPy_Curve *msh, FILE *fp, int flags); +static int CurveSetAttr (BPy_Curve *msh, char *name, PyObject *v); +static PyObject *CurveGetAttr (BPy_Curve *msh, char *name); +static PyObject *CurveRepr (BPy_Curve *msh); PyObject* CurveCreatePyObject (struct Curve *curve); int CurveCheckPyObject (PyObject *py_obj); struct Curve* CurveFromPyObject (PyObject *py_obj); @@ -202,7 +195,7 @@ PyTypeObject Curve_Type = PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "Curve", /* tp_name */ - sizeof (C_Curve), /* tp_basicsize */ + sizeof (BPy_Curve), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)CurveDeAlloc, /* tp_dealloc */ @@ -218,7 +211,7 @@ PyTypeObject Curve_Type = 0,0,0,0,0,0, 0, /* tp_doc */ 0,0,0,0,0,0, - C_Curve_methods, /* tp_methods */ + BPy_Curve_methods, /* tp_methods */ 0, /* tp_members */ }; diff --git a/source/blender/python/api2_2x/Effect.c b/source/blender/python/api2_2x/Effect.c index 63b172453c3..60ee4af814a 100644 --- a/source/blender/python/api2_2x/Effect.c +++ b/source/blender/python/api2_2x/Effect.c @@ -54,7 +54,7 @@ struct PyMethodDef M_Effect_methods[] = { /*****************************************************************************/ PyObject *M_Effect_New(PyObject *self, PyObject *args) { - C_Effect *pyeffect; + BPy_Effect *pyeffect; Effect *bleffect = 0; int type = -1; char * btype = NULL; @@ -76,7 +76,7 @@ PyObject *M_Effect_New(PyObject *self, PyObject *args) return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create Effect Data in Blender")); - pyeffect = (C_Effect *)PyObject_NEW(C_Effect, &Effect_Type); + pyeffect = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); if (pyeffect == NULL) return (EXPP_ReturnPyObjError (PyExc_MemoryError, @@ -98,7 +98,7 @@ PyObject *M_Effect_Get(PyObject *self, PyObject *args) char *name = 0; Object *object_iter; Effect *eff; - C_Effect *wanted_eff; + BPy_Effect *wanted_eff; int num,i; if (!PyArg_ParseTuple(args, "|si", &name, &num )) return(EXPP_ReturnPyObjError(PyExc_AttributeError,\ @@ -119,7 +119,7 @@ PyObject *M_Effect_Get(PyObject *self, PyObject *args) if (object_iter->effect.first != NULL){ eff = object_iter->effect.first; for(i = 0;inext; - wanted_eff = (C_Effect *)PyObject_NEW(C_Effect, &Effect_Type); + wanted_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); wanted_eff->effect = eff; return (PyObject*)wanted_eff; } @@ -133,7 +133,7 @@ PyObject * effectlist = PyList_New (0); if (object_iter->effect.first != NULL){ eff = object_iter->effect.first; while (eff){ - C_Effect *found_eff = (C_Effect *)PyObject_NEW(C_Effect, &Effect_Type); + BPy_Effect *found_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); found_eff->effect = eff; PyList_Append (effectlist , (PyObject *)found_eff); eff = eff->next; @@ -170,19 +170,19 @@ PyObject *M_Effect_Init (void) } /*****************************************************************************/ -/* Python C_Effect methods: */ +/* Python BPy_Effect methods: */ /*****************************************************************************/ -PyObject *Effect_getType(C_Effect *self) +PyObject *Effect_getType(BPy_Effect *self) { PyObject *attr = PyInt_FromLong((long)self->effect->type); if (attr) return attr; - return (EXPP_ReturnPyObjError (PyExc_RuntimeError,\ - "couldn't get mode attribute")); + return (EXPP_ReturnPyObjError (PyExc_RuntimeError,\ + "couldn't get mode attribute")); } -PyObject *Effect_setType(C_Effect *self, PyObject *args) +PyObject *Effect_setType(BPy_Effect *self, PyObject *args) { int value; if (!PyArg_ParseTuple(args, "i", &value)) @@ -193,7 +193,7 @@ PyObject *Effect_setType(C_Effect *self, PyObject *args) return Py_None; } -PyObject *Effect_getFlag(C_Effect *self) +PyObject *Effect_getFlag(BPy_Effect *self) { PyObject *attr = PyInt_FromLong((long)self->effect->flag); if (attr) return attr; @@ -202,7 +202,7 @@ PyObject *Effect_getFlag(C_Effect *self) } -PyObject *Effect_setFlag(C_Effect *self, PyObject *args) +PyObject *Effect_setFlag(BPy_Effect *self, PyObject *args) { int value; if (!PyArg_ParseTuple(args, "i", &value)) @@ -219,58 +219,58 @@ PyObject *Effect_setFlag(C_Effect *self, PyObject *args) /*****************************************************************************/ /* Function: EffectDeAlloc */ -/* Description: This is a callback function for the C_Effect type. It is */ +/* Description: This is a callback function for the BPy_Effect type. It is */ /* the destructor function. */ /*****************************************************************************/ -void EffectDeAlloc (C_Effect *self) +void EffectDeAlloc (BPy_Effect *self) { PyObject_DEL (self); } /*****************************************************************************/ /* Function: EffectGetAttr */ -/* Description: This is a callback function for the C_Effect type. It is */ -/* the function that accesses C_Effect "member variables" and */ +/* Description: This is a callback function for the BPy_Effect type. It is */ +/* the function that accesses BPy_Effect "member variables" and */ /* methods. */ /*****************************************************************************/ -PyObject *EffectGetAttr (C_Effect *self, char *name) +PyObject *EffectGetAttr (BPy_Effect *self, char *name) { switch(self->effect->type) { - case EFF_BUILD : return BuildGetAttr( (C_Build*)self, name); - case EFF_WAVE : return WaveGetAttr ((C_Wave*)self, name); - case EFF_PARTICLE : return ParticleGetAttr ((C_Particle*)self, name); + case EFF_BUILD : return BuildGetAttr( (BPy_Build*)self, name); + case EFF_WAVE : return WaveGetAttr ((BPy_Wave*)self, name); + case EFF_PARTICLE : return ParticleGetAttr ((BPy_Particle*)self, name); } - return Py_FindMethod(C_Effect_methods, (PyObject *)self, name); + return Py_FindMethod(BPy_Effect_methods, (PyObject *)self, name); } /*****************************************************************************/ /* Function: EffectSetAttr */ -/* Description: This is a callback function for the C_Effect type. It is the */ +/* Description: This is a callback function for the BPy_Effect type. It is the */ /* function that sets Effect Data attributes (member variables).*/ /*****************************************************************************/ -int EffectSetAttr (C_Effect *self, char *name, PyObject *value) +int EffectSetAttr (BPy_Effect *self, char *name, PyObject *value) { switch(self->effect->type) { - case EFF_BUILD : return BuildSetAttr( (C_Build*)self, name,value); - case EFF_WAVE : return WaveSetAttr ((C_Wave*)self, name,value); - case EFF_PARTICLE : return ParticleSetAttr ((C_Particle*)self, name,value); + case EFF_BUILD : return BuildSetAttr( (BPy_Build*)self, name,value); + case EFF_WAVE : return WaveSetAttr ((BPy_Wave*)self, name,value); + case EFF_PARTICLE : return ParticleSetAttr ((BPy_Particle*)self, name,value); } return 0; /* normal exit */ } /*****************************************************************************/ /* Function: EffectPrint */ -/* Description: This is a callback function for the C_Effect type. It */ +/* Description: This is a callback function for the BPy_Effect type. It */ /* builds a meaninful string to 'print' effcte objects. */ /*****************************************************************************/ -int EffectPrint(C_Effect *self, FILE *fp, int flags) +int EffectPrint(BPy_Effect *self, FILE *fp, int flags) { if (self->effect->type == EFF_BUILD)puts("Effect Build"); if (self->effect->type == EFF_PARTICLE)puts("Effect Particle"); @@ -281,10 +281,10 @@ if (self->effect->type == EFF_WAVE)puts("Effect Wave"); /*****************************************************************************/ /* Function: EffectRepr */ -/* Description: This is a callback function for the C_Effect type. It */ +/* Description: This is a callback function for the BPy_Effect type. It */ /* builds a meaninful string to represent effcte objects. */ /*****************************************************************************/ -PyObject *EffectRepr (C_Effect *self) +PyObject *EffectRepr (BPy_Effect *self) { char*str=""; if (self->effect->type == EFF_BUILD)str = "Effect Build"; @@ -295,11 +295,11 @@ return PyString_FromString(str); PyObject* EffectCreatePyObject (struct Effect *effect) { - C_Effect * blen_object; + BPy_Effect * blen_object; printf ("In EffectCreatePyObject\n"); - blen_object = (C_Effect*)PyObject_NEW (C_Effect, &Effect_Type); + blen_object = (BPy_Effect*)PyObject_NEW (BPy_Effect, &Effect_Type); if (blen_object == NULL) { @@ -318,9 +318,9 @@ return (py_obj->ob_type == &Effect_Type); struct Effect* EffectFromPyObject (PyObject *py_obj) { - C_Effect * blen_obj; + BPy_Effect * blen_obj; - blen_obj = (C_Effect*)py_obj; + blen_obj = (BPy_Effect*)py_obj; return ((Effect*)blen_obj->effect); } diff --git a/source/blender/python/api2_2x/Effect.h b/source/blender/python/api2_2x/Effect.h index 4ccec72cfdf..544f80f7a09 100644 --- a/source/blender/python/api2_2x/Effect.h +++ b/source/blender/python/api2_2x/Effect.h @@ -42,15 +42,15 @@ #include #include #include -#include #include"gen_utils.h" +#include "bpy_types.h" /*****************************************************************************/ -/* Python C_Effect methods table: */ +/* Python BPy_Effect methods table: */ /*****************************************************************************/ -static PyMethodDef C_Effect_methods[] = { +static PyMethodDef BPy_Effect_methods[] = { {0} }; @@ -61,28 +61,21 @@ PyObject *M_Effect_New (PyObject *self, PyObject *args); PyObject *M_Effect_Get (PyObject *self, PyObject *args); -/*****************************************************************************/ -/* Python C_Effect structure definition: */ -/*****************************************************************************/ -typedef struct { - PyObject_HEAD - Effect *effect; -} C_Effect; /*****************************************************************************/ -/* Python C_Effect methods declarations: */ +/* Python BPy_Effect methods declarations: */ /*****************************************************************************/ -/*PyObject *Effect_getType(C_Effect *self);*/ +/*PyObject *Effect_getType(BPy_Effect *self);*/ /*****************************************************************************/ /* Python Effect_Type callback function prototypes: */ /*****************************************************************************/ -void EffectDeAlloc (C_Effect *msh); -int EffectPrint (C_Effect *msh, FILE *fp, int flags); -int EffectSetAttr (C_Effect *msh, char *name, PyObject *v); -PyObject *EffectGetAttr (C_Effect *msh, char *name); -PyObject *EffectRepr (C_Effect *msh); +void EffectDeAlloc (BPy_Effect *msh); +int EffectPrint (BPy_Effect *msh, FILE *fp, int flags); +int EffectSetAttr (BPy_Effect *msh, char *name, PyObject *v); +PyObject *EffectGetAttr (BPy_Effect *msh, char *name); +PyObject *EffectRepr (BPy_Effect *msh); PyObject* EffectCreatePyObject (struct Effect *effect); int EffectCheckPyObject (PyObject *py_obj); struct Effect* EffectFromPyObject (PyObject *py_obj); @@ -94,7 +87,7 @@ static PyTypeObject Effect_Type = PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "Effect", /* tp_name */ - sizeof (C_Effect), /* tp_basicsize */ + sizeof (BPy_Effect), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)EffectDeAlloc, /* tp_dealloc */ @@ -110,7 +103,7 @@ static PyTypeObject Effect_Type = 0,0,0,0,0,0, 0, /* tp_doc */ 0,0,0,0,0,0, - C_Effect_methods, /* tp_methods */ + BPy_Effect_methods, /* tp_methods */ 0, /* tp_members */ }; diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c index c1df4b91ab1..0a679f8ef1a 100644 --- a/source/blender/python/api2_2x/Metaball.c +++ b/source/blender/python/api2_2x/Metaball.c @@ -32,6 +32,34 @@ #include "Metaball.h" +/*****************************************************************************/ +/* Python Metaball_Type structure definition: */ +/*****************************************************************************/ +PyTypeObject Metaball_Type = + { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "Metaball", /* tp_name */ + sizeof (BPy_Metaball), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)MetaballDeAlloc, /* tp_dealloc */ + (printfunc)MetaballPrint, /* tp_print */ + (getattrfunc)MetaballGetAttr, /* tp_getattr */ + (setattrfunc)MetaballSetAttr, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc)MetaballRepr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_as_hash */ + 0,0,0,0,0,0, + 0, /* tp_doc */ + 0,0,0,0,0,0, + BPy_Metaball_methods, /* tp_methods */ + 0, /* tp_members */ + }; + /*****************************************************************************/ /* Function: M_Metaball_New */ /* Python equivalent: Blender.Metaball.New */ @@ -39,7 +67,7 @@ static PyObject *M_Metaball_New(PyObject *self, PyObject *args) { char*name = 0; - C_Metaball *pymball; /* for Data object wrapper in Python */ + BPy_Metaball *pymball; /* for Data object wrapper in Python */ MetaBall *blmball; /* for actual Data we create in Blender */ char buf[21]; if (!PyArg_ParseTuple(args, "|s", &name)) @@ -50,7 +78,7 @@ static PyObject *M_Metaball_New(PyObject *self, PyObject *args) blmball = add_mball(); /* first create the MetaBall Data in Blender */ if (blmball) /* now create the wrapper obj in Python */ - pymball = (C_Metaball *)PyObject_NEW(C_Metaball, &Metaball_Type); + pymball = (BPy_Metaball *)PyObject_NEW(BPy_Metaball, &Metaball_Type); else return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create MetaBall Data in Blender")); @@ -90,11 +118,11 @@ static PyObject *M_Metaball_Get(PyObject *self, PyObject *args) if (name) { /* (name) - Search mball by name */ - C_Metaball *wanted_mball = NULL; + BPy_Metaball *wanted_mball = NULL; while ((mball_iter) && (wanted_mball == NULL)) { if (strcmp (name, mball_iter->id.name+2) == 0) { - wanted_mball=(C_Metaball*)PyObject_NEW(C_Metaball,&Metaball_Type); + wanted_mball=(BPy_Metaball*)PyObject_NEW(BPy_Metaball,&Metaball_Type); if (wanted_mball) wanted_mball->metaball = mball_iter; } @@ -120,7 +148,7 @@ static PyObject *M_Metaball_Get(PyObject *self, PyObject *args) "couldn't create PyList")); while (mball_iter) { - C_Metaball *found_mball=(C_Metaball*)PyObject_NEW(C_Metaball,&Metaball_Type); + BPy_Metaball *found_mball=(BPy_Metaball*)PyObject_NEW(BPy_Metaball,&Metaball_Type); found_mball->metaball = mball_iter; PyList_Append (mballlist, (PyObject *)found_mball); mball_iter = mball_iter->id.next; @@ -147,9 +175,9 @@ PyObject *M_Metaball_Init (void) } /*******************************************************************************/ -/* Python C_Metaball methods: */ +/* Python BPy_Metaball methods: */ /*******************************************************************************/ -static PyObject *Metaball_getName(C_Metaball *self) +static PyObject *Metaball_getName(BPy_Metaball *self) { PyObject *attr = PyString_FromString(self->metaball->id.name+2); @@ -162,7 +190,7 @@ static PyObject *Metaball_getName(C_Metaball *self) -static PyObject *Metaball_setName(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setName(BPy_Metaball *self,PyObject*args) { char *name = NULL; char buf[20]; @@ -178,7 +206,7 @@ static PyObject *Metaball_setName(C_Metaball *self,PyObject*args) } -static PyObject *Metaball_getBbox(C_Metaball *self) +static PyObject *Metaball_getBbox(BPy_Metaball *self) { int i,j; PyObject* ll; @@ -195,7 +223,7 @@ static PyObject *Metaball_getBbox(C_Metaball *self) return l; } -static PyObject *Metaball_getNMetaElems(C_Metaball *self) +static PyObject *Metaball_getNMetaElems(BPy_Metaball *self) { int i = 0; MetaElem*ptr = self->metaball->elems.first; @@ -210,7 +238,7 @@ static PyObject *Metaball_getNMetaElems(C_Metaball *self) -static PyObject *Metaball_getloc(C_Metaball *self) +static PyObject *Metaball_getloc(BPy_Metaball *self) { PyObject* l = PyList_New(0); PyList_Append( l, PyFloat_FromDouble(self->metaball->loc[0])); @@ -219,7 +247,7 @@ static PyObject *Metaball_getloc(C_Metaball *self) return l; } -static PyObject *Metaball_setloc(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setloc(BPy_Metaball *self,PyObject*args) { PyObject *listargs=0; int i; @@ -235,7 +263,7 @@ static PyObject *Metaball_setloc(C_Metaball *self,PyObject*args) return Py_None; } -static PyObject *Metaball_getrot(C_Metaball *self) +static PyObject *Metaball_getrot(BPy_Metaball *self) { PyObject* l = PyList_New(0); PyList_Append( l, PyFloat_FromDouble(self->metaball->rot[0])); @@ -244,7 +272,7 @@ static PyObject *Metaball_getrot(C_Metaball *self) return l; } -static PyObject *Metaball_setrot(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setrot(BPy_Metaball *self,PyObject*args) { PyObject *listargs=0; int i; @@ -260,7 +288,7 @@ static PyObject *Metaball_setrot(C_Metaball *self,PyObject*args) return Py_None; } -static PyObject *Metaball_getsize(C_Metaball *self) +static PyObject *Metaball_getsize(BPy_Metaball *self) { PyObject* l = PyList_New(0); PyList_Append( l, PyFloat_FromDouble(self->metaball->size[0])); @@ -269,7 +297,7 @@ static PyObject *Metaball_getsize(C_Metaball *self) return l; } -static PyObject *Metaball_setsize(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setsize(BPy_Metaball *self,PyObject*args) { PyObject *listargs=0; int i; @@ -285,12 +313,12 @@ static PyObject *Metaball_setsize(C_Metaball *self,PyObject*args) return Py_None; } -static PyObject *Metaball_getWiresize(C_Metaball *self) +static PyObject *Metaball_getWiresize(BPy_Metaball *self) { return PyFloat_FromDouble(self->metaball->wiresize); } -static PyObject *Metaball_setWiresize(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setWiresize(BPy_Metaball *self,PyObject*args) { float val; @@ -303,12 +331,12 @@ static PyObject *Metaball_setWiresize(C_Metaball *self,PyObject*args) return Py_None; } -static PyObject *Metaball_getRendersize(C_Metaball *self) +static PyObject *Metaball_getRendersize(BPy_Metaball *self) { return PyFloat_FromDouble(self->metaball->rendersize); } -static PyObject *Metaball_setRendersize(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setRendersize(BPy_Metaball *self,PyObject*args) { float val; @@ -321,12 +349,12 @@ static PyObject *Metaball_setRendersize(C_Metaball *self,PyObject*args) return Py_None; } -static PyObject *Metaball_getThresh(C_Metaball *self) +static PyObject *Metaball_getThresh(BPy_Metaball *self) { return PyFloat_FromDouble(self->metaball->thresh); } -static PyObject *Metaball_setThresh(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setThresh(BPy_Metaball *self,PyObject*args) { float val; @@ -345,7 +373,7 @@ static PyObject *Metaball_setThresh(C_Metaball *self,PyObject*args) /* get/set metaelems data, */ /*******************************************************************************/ -static PyObject *Metaball_getMetadata(C_Metaball *self,PyObject*args) +static PyObject *Metaball_getMetadata(BPy_Metaball *self,PyObject*args) { int num; int i = 0; @@ -393,7 +421,7 @@ static PyObject *Metaball_getMetadata(C_Metaball *self,PyObject*args) -static PyObject *Metaball_setMetadata(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setMetadata(BPy_Metaball *self,PyObject*args) { int num; int i = 0; @@ -443,7 +471,7 @@ return (EXPP_ReturnPyObjError (PyExc_TypeError, \ return (EXPP_ReturnPyObjError (PyExc_TypeError, "unknown field ")); } -static PyObject *Metaball_getMetatype(C_Metaball *self,PyObject*args) +static PyObject *Metaball_getMetatype(BPy_Metaball *self,PyObject*args) { int num; int i = 0; @@ -458,7 +486,7 @@ static PyObject *Metaball_getMetatype(C_Metaball *self,PyObject*args) -static PyObject *Metaball_setMetatype(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setMetatype(BPy_Metaball *self,PyObject*args) { int num,val, i = 0; MetaElem*ptr = self->metaball->elems.first; @@ -474,7 +502,7 @@ static PyObject *Metaball_setMetatype(C_Metaball *self,PyObject*args) } -static PyObject *Metaball_getMetax(C_Metaball *self,PyObject*args) +static PyObject *Metaball_getMetax(BPy_Metaball *self,PyObject*args) { MetaElem*ptr = self->metaball->elems.first; int num; @@ -488,7 +516,7 @@ static PyObject *Metaball_getMetax(C_Metaball *self,PyObject*args) -static PyObject *Metaball_setMetax(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setMetax(BPy_Metaball *self,PyObject*args) { MetaElem*ptr = self->metaball->elems.first; int num, i = 0; @@ -503,7 +531,7 @@ static PyObject *Metaball_setMetax(C_Metaball *self,PyObject*args) return Py_None; } -static PyObject *Metaball_getMetay(C_Metaball *self,PyObject*args) +static PyObject *Metaball_getMetay(BPy_Metaball *self,PyObject*args) { MetaElem*ptr = self->metaball->elems.first; int num; @@ -517,7 +545,7 @@ static PyObject *Metaball_getMetay(C_Metaball *self,PyObject*args) -static PyObject *Metaball_setMetay(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setMetay(BPy_Metaball *self,PyObject*args) { MetaElem*ptr = self->metaball->elems.first; int num, i = 0; @@ -534,7 +562,7 @@ static PyObject *Metaball_setMetay(C_Metaball *self,PyObject*args) } -static PyObject *Metaball_getMetaz(C_Metaball *self,PyObject*args) +static PyObject *Metaball_getMetaz(BPy_Metaball *self,PyObject*args) { MetaElem*ptr = self->metaball->elems.first; int num; @@ -546,7 +574,7 @@ static PyObject *Metaball_getMetaz(C_Metaball *self,PyObject*args) return (PyFloat_FromDouble(ptr->z)); } -static PyObject *Metaball_setMetaz(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setMetaz(BPy_Metaball *self,PyObject*args) { int num, i = 0; MetaElem*ptr = self->metaball->elems.first; @@ -563,7 +591,7 @@ static PyObject *Metaball_setMetaz(C_Metaball *self,PyObject*args) } -static PyObject *Metaball_getMetas(C_Metaball *self,PyObject*args) +static PyObject *Metaball_getMetas(BPy_Metaball *self,PyObject*args) { MetaElem*ptr = self->metaball->elems.first; int num; @@ -575,7 +603,7 @@ static PyObject *Metaball_getMetas(C_Metaball *self,PyObject*args) return (PyFloat_FromDouble(ptr->s)); } -static PyObject *Metaball_setMetas(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setMetas(BPy_Metaball *self,PyObject*args) { int num, i = 0; MetaElem*ptr = self->metaball->elems.first; @@ -596,7 +624,7 @@ static PyObject *Metaball_setMetas(C_Metaball *self,PyObject*args) -static PyObject *Metaball_getMetalen(C_Metaball *self,PyObject*args) +static PyObject *Metaball_getMetalen(BPy_Metaball *self,PyObject*args) { int num; int i = 0; @@ -610,7 +638,7 @@ static PyObject *Metaball_getMetalen(C_Metaball *self,PyObject*args) return (PyFloat_FromDouble(ptr->len)); } -static PyObject *Metaball_setMetalen(C_Metaball *self,PyObject*args) +static PyObject *Metaball_setMetalen(BPy_Metaball *self,PyObject*args) { int num, i = 0; float val; @@ -637,15 +665,15 @@ static PyObject *Metaball_setMetalen(C_Metaball *self,PyObject*args) /*****************************************************************************/ /* Function: MetaballDeAlloc */ -/* Description: This is a callback function for the C_Metaball type. It is */ +/* Description: This is a callback function for the BPy_Metaball type. It is */ /* the destructor function. */ /*****************************************************************************/ -static void MetaballDeAlloc (C_Metaball *self) +static void MetaballDeAlloc (BPy_Metaball *self) { PyObject_DEL (self); } -static int MetaballPrint (C_Metaball *self, FILE *fp, int flags) +static int MetaballPrint (BPy_Metaball *self, FILE *fp, int flags) { fprintf(fp, "[MetaBall \"%s\"]", self->metaball->id.name+2); return 0; @@ -653,26 +681,26 @@ static int MetaballPrint (C_Metaball *self, FILE *fp, int flags) } /*****************************************************************************/ /* Function: MetaballGetAttr */ -/* Description: This is a callback function for the C_Metaball type. It is */ -/* the function that accesses C_Metaball "member variables" and */ +/* Description: This is a callback function for the BPy_Metaball type. It is */ +/* the function that accesses BPy_Metaball "member variables" and */ /* methods. */ /*****************************************************************************/ -static PyObject *MetaballGetAttr (C_Metaball *self, char *name) +static PyObject *MetaballGetAttr (BPy_Metaball *self, char *name) { if (strcmp (name, "name") == 0)return Metaball_getName (self); if (strcmp (name, "rot") == 0)return Metaball_getrot (self); if (strcmp (name, "loc") == 0)return Metaball_getloc (self); if (strcmp (name, "size") == 0)return Metaball_getsize (self); - return Py_FindMethod(C_Metaball_methods, (PyObject *)self, name); + return Py_FindMethod(BPy_Metaball_methods, (PyObject *)self, name); } /*******************************************************************************/ /* Function: MetaballSetAttr */ -/* Description: This is a callback function for the C_Metaball type. It is the */ +/* Description: This is a callback function for the BPy_Metaball type. It is the */ /* function that sets Metaball Data attributes (member variables).*/ /*******************************************************************************/ -static int MetaballSetAttr (C_Metaball *self, char *name, PyObject *value) +static int MetaballSetAttr (BPy_Metaball *self, char *name, PyObject *value) { PyObject *valtuple = Py_BuildValue("(O)", value); @@ -707,10 +735,10 @@ static int MetaballSetAttr (C_Metaball *self, char *name, PyObject *value) /*****************************************************************************/ /* Function: MetaballRepr */ -/* Description: This is a callback function for the C_Metaball type. It */ +/* Description: This is a callback function for the BPy_Metaball type. It */ /* builds a meaninful string to represent metaball objects. */ /*****************************************************************************/ -static PyObject *MetaballRepr (C_Metaball *self) +static PyObject *MetaballRepr (BPy_Metaball *self) { return PyString_FromString(self->metaball->id.name+2); } diff --git a/source/blender/python/api2_2x/Metaball.h b/source/blender/python/api2_2x/Metaball.h index eaa310cf169..4fdf301a95c 100644 --- a/source/blender/python/api2_2x/Metaball.h +++ b/source/blender/python/api2_2x/Metaball.h @@ -40,15 +40,11 @@ #include #include #include -#include #include "constant.h" #include "gen_utils.h" #include "modules.h" - -/*****************************************************************************/ -/* Python C_Metaball defaults: */ -/*****************************************************************************/ +#include "bpy_types.h" /*****************************************************************************/ @@ -62,15 +58,15 @@ static PyObject *M_Metaball_Get (PyObject *self, PyObject *args); /* In Python these will be written to the console when doing a */ /* Blender.Metaball.__doc__ */ /*****************************************************************************/ -char M_Metaball_doc[] = +static char M_Metaball_doc[] = "The Blender Metaball module\n\n\nMetaballs are spheres\ that can join each other to create smooth,\ organic volumes\n. The spheres themseves are called\ 'Metaelements' and can be accessed from the Metaball module."; -char M_Metaball_New_doc[] ="Creates a new metaball"; +static char M_Metaball_New_doc[] ="Creates a new metaball"; -char M_Metaball_Get_doc[] ="Retreives an existing metaball"; +static char M_Metaball_Get_doc[] ="Retreives an existing metaball"; /*****************************************************************************/ /* Python method structure definition for Blender.Metaball module: */ @@ -82,52 +78,45 @@ struct PyMethodDef M_Metaball_methods[] = { {NULL, NULL, 0, NULL} }; -/*****************************************************************************/ -/* Python C_Metaball structure definition: */ -/*****************************************************************************/ -typedef struct { - PyObject_HEAD - MetaBall *metaball; -} C_Metaball; /*****************************************************************************/ -/* Python C_Metaball methods declarations: */ +/* Python BPy_Metaball methods declarations: */ /*****************************************************************************/ -static PyObject *Metaball_getBbox(C_Metaball *self); -static PyObject *Metaball_getName(C_Metaball *self); -static PyObject *Metaball_setName(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getWiresize(C_Metaball *self); -static PyObject *Metaball_setWiresize(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getRendersize(C_Metaball *self); -static PyObject *Metaball_setRendersize(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getThresh(C_Metaball *self); -static PyObject *Metaball_setThresh(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getNMetaElems(C_Metaball *self); -static PyObject *Metaball_getMetatype(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetatype(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetadata(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetadata(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetax(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetax(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetay(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetay(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetaz(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetaz(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetas(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetas(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetalen(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetalen(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getloc(C_Metaball *self); -static PyObject *Metaball_setloc(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getrot(C_Metaball *self); -static PyObject *Metaball_setrot(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getsize(C_Metaball *self); -static PyObject *Metaball_setsize(C_Metaball *self,PyObject*args); +static PyObject *Metaball_getBbox(BPy_Metaball *self); +static PyObject *Metaball_getName(BPy_Metaball *self); +static PyObject *Metaball_setName(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getWiresize(BPy_Metaball *self); +static PyObject *Metaball_setWiresize(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getRendersize(BPy_Metaball *self); +static PyObject *Metaball_setRendersize(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getThresh(BPy_Metaball *self); +static PyObject *Metaball_setThresh(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getNMetaElems(BPy_Metaball *self); +static PyObject *Metaball_getMetatype(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_setMetatype(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getMetadata(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_setMetadata(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getMetax(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_setMetax(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getMetay(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_setMetay(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getMetaz(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_setMetaz(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getMetas(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_setMetas(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getMetalen(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_setMetalen(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getloc(BPy_Metaball *self); +static PyObject *Metaball_setloc(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getrot(BPy_Metaball *self); +static PyObject *Metaball_setrot(BPy_Metaball *self,PyObject*args); +static PyObject *Metaball_getsize(BPy_Metaball *self); +static PyObject *Metaball_setsize(BPy_Metaball *self,PyObject*args); /*****************************************************************************/ -/* Python C_Metaball methods table: */ +/* Python BPy_Metaball methods table: */ /*****************************************************************************/ -static PyMethodDef C_Metaball_methods[] = { +static PyMethodDef BPy_Metaball_methods[] = { /* name, method, flags, doc */ {"getName", (PyCFunction)Metaball_getName,\ METH_NOARGS, "() - Return Metaball name"}, @@ -196,38 +185,11 @@ static PyMethodDef C_Metaball_methods[] = { /*****************************************************************************/ /* Python Metaball_Type callback function prototypes: */ /*****************************************************************************/ -static void MetaballDeAlloc (C_Metaball *self); -static int MetaballPrint (C_Metaball *self, FILE *fp, int flags); -static int MetaballSetAttr (C_Metaball *self, char *name, PyObject *v); -static PyObject *MetaballGetAttr (C_Metaball *self, char *name); -static PyObject *MetaballRepr (C_Metaball *self); +static void MetaballDeAlloc (BPy_Metaball *self); +static int MetaballPrint (BPy_Metaball *self, FILE *fp, int flags); +static int MetaballSetAttr (BPy_Metaball *self, char *name, PyObject *v); +static PyObject *MetaballGetAttr (BPy_Metaball *self, char *name); +static PyObject *MetaballRepr (BPy_Metaball *self); -/*****************************************************************************/ -/* Python Metaball_Type structure definition: */ -/*****************************************************************************/ -PyTypeObject Metaball_Type = - { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "Metaball", /* tp_name */ - sizeof (C_Metaball), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)MetaballDeAlloc, /* tp_dealloc */ - (printfunc)MetaballPrint, /* tp_print */ - (getattrfunc)MetaballGetAttr, /* tp_getattr */ - (setattrfunc)MetaballSetAttr, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)MetaballRepr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_as_hash */ - 0,0,0,0,0,0, - 0, /* tp_doc */ - 0,0,0,0,0,0, - C_Metaball_methods, /* tp_methods */ - 0, /* tp_members */ - }; #endif /* EXPP_METABALL_H */ diff --git a/source/blender/python/api2_2x/Particle.c b/source/blender/python/api2_2x/Particle.c index 0ce030b7bef..29beaa98eab 100644 --- a/source/blender/python/api2_2x/Particle.c +++ b/source/blender/python/api2_2x/Particle.c @@ -33,9 +33,9 @@ #include "Effect.h" /*****************************************************************************/ -/* Python C_Particle methods table: */ +/* Python BPy_Particle methods table: */ /*****************************************************************************/ -static PyMethodDef C_Particle_methods[] = { +static PyMethodDef BPy_Particle_methods[] = { {"getType", (PyCFunction)Effect_getType, METH_NOARGS,"() - Return Effect type"}, {"setType", (PyCFunction)Effect_setType, @@ -133,7 +133,7 @@ PyTypeObject Particle_Type = PyObject_HEAD_INIT(NULL) 0, "Particle", - sizeof (C_Particle), + sizeof (BPy_Particle), 0, (destructor)ParticleDeAlloc, @@ -149,7 +149,7 @@ PyTypeObject Particle_Type = 0,0,0,0,0,0, 0, 0,0,0,0,0,0, - C_Particle_methods, + BPy_Particle_methods, 0, }; /*****************************************************************************/ @@ -182,7 +182,7 @@ struct PyMethodDef M_Particle_methods[] = { PyObject *M_Particle_New(PyObject *self, PyObject *args) { int type = EFF_PARTICLE; - C_Effect *pyeffect; + BPy_Effect *pyeffect; Effect *bleffect = 0; @@ -191,7 +191,7 @@ PyObject *M_Particle_New(PyObject *self, PyObject *args) return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create Effect Data in Blender")); - pyeffect = (C_Effect *)PyObject_NEW(C_Effect, &Effect_Type); + pyeffect = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); if (pyeffect == NULL) return (EXPP_ReturnPyObjError (PyExc_MemoryError, @@ -214,7 +214,7 @@ PyObject *M_Particle_Get(PyObject *self, PyObject *args) char *name = 0; Object *object_iter; Effect *eff; - C_Particle *wanted_eff; + BPy_Particle *wanted_eff; int num,i; if (!PyArg_ParseTuple(args, "si", &name, &num )) return(EXPP_ReturnPyObjError(PyExc_AttributeError,\ @@ -243,7 +243,7 @@ PyObject *M_Particle_Get(PyObject *self, PyObject *args) if (!eff) return(EXPP_ReturnPyObjError(PyExc_AttributeError,"bject")); } - wanted_eff = (C_Particle *)PyObject_NEW(C_Particle, &Particle_Type); + wanted_eff = (BPy_Particle *)PyObject_NEW(BPy_Particle, &Particle_Type); wanted_eff->particle = eff; return (PyObject*)wanted_eff; } @@ -265,10 +265,10 @@ PyObject *M_Particle_Init (void) } /*****************************************************************************/ -/* Python C_Particle methods: */ +/* Python BPy_Particle methods: */ /*****************************************************************************/ -PyObject *Particle_getSta(C_Particle *self) +PyObject *Particle_getSta(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -277,7 +277,7 @@ PyObject *Particle_getSta(C_Particle *self) -PyObject *Particle_setSta(C_Particle *self,PyObject *args) +PyObject *Particle_setSta(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val = 0; @@ -288,7 +288,7 @@ PyObject *Particle_setSta(C_Particle *self,PyObject *args) Py_INCREF(Py_None); return Py_None; } -PyObject *Particle_getEnd(C_Particle *self) +PyObject *Particle_getEnd(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -297,7 +297,7 @@ PyObject *Particle_getEnd(C_Particle *self) -PyObject *Particle_setEnd(C_Particle *self,PyObject *args) +PyObject *Particle_setEnd(BPy_Particle *self,PyObject *args) { float val = 0; PartEff*ptr = (PartEff*)self->particle; @@ -309,7 +309,7 @@ PyObject *Particle_setEnd(C_Particle *self,PyObject *args) return Py_None; } -PyObject *Particle_getLifetime(C_Particle *self) +PyObject *Particle_getLifetime(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -318,7 +318,7 @@ PyObject *Particle_getLifetime(C_Particle *self) -PyObject *Particle_setLifetime(C_Particle *self,PyObject *args) +PyObject *Particle_setLifetime(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val = 0; @@ -331,7 +331,7 @@ PyObject *Particle_setLifetime(C_Particle *self,PyObject *args) } -PyObject *Particle_getNormfac(C_Particle *self) +PyObject *Particle_getNormfac(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -340,7 +340,7 @@ PyObject *Particle_getNormfac(C_Particle *self) -PyObject *Particle_setNormfac(C_Particle *self,PyObject *args) +PyObject *Particle_setNormfac(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val = 0; @@ -354,7 +354,7 @@ PyObject *Particle_setNormfac(C_Particle *self,PyObject *args) -PyObject *Particle_getObfac(C_Particle *self) +PyObject *Particle_getObfac(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -363,7 +363,7 @@ PyObject *Particle_getObfac(C_Particle *self) -PyObject *Particle_setObfac(C_Particle *self,PyObject *args) +PyObject *Particle_setObfac(BPy_Particle *self,PyObject *args) { float val = 0; PartEff*ptr = (PartEff*)self->particle; @@ -377,7 +377,7 @@ PyObject *Particle_setObfac(C_Particle *self,PyObject *args) -PyObject *Particle_getRandfac(C_Particle *self) +PyObject *Particle_getRandfac(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -386,7 +386,7 @@ PyObject *Particle_getRandfac(C_Particle *self) -PyObject *Particle_setRandfac(C_Particle *self,PyObject *args) +PyObject *Particle_setRandfac(BPy_Particle *self,PyObject *args) { float val = 0; PartEff*ptr = (PartEff*)self->particle; @@ -400,7 +400,7 @@ PyObject *Particle_setRandfac(C_Particle *self,PyObject *args) -PyObject *Particle_getTexfac(C_Particle *self) +PyObject *Particle_getTexfac(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -409,7 +409,7 @@ PyObject *Particle_getTexfac(C_Particle *self) -PyObject *Particle_setTexfac(C_Particle *self,PyObject *args) +PyObject *Particle_setTexfac(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val = 0; @@ -423,7 +423,7 @@ PyObject *Particle_setTexfac(C_Particle *self,PyObject *args) -PyObject *Particle_getRandlife(C_Particle *self) +PyObject *Particle_getRandlife(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -432,7 +432,7 @@ PyObject *Particle_getRandlife(C_Particle *self) -PyObject *Particle_setRandlife(C_Particle *self,PyObject *args) +PyObject *Particle_setRandlife(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val = 0; @@ -446,7 +446,7 @@ PyObject *Particle_setRandlife(C_Particle *self,PyObject *args) -PyObject *Particle_getNabla(C_Particle *self) +PyObject *Particle_getNabla(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -455,7 +455,7 @@ PyObject *Particle_getNabla(C_Particle *self) -PyObject *Particle_setNabla(C_Particle *self,PyObject *args) +PyObject *Particle_setNabla(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val = 0; @@ -469,7 +469,7 @@ PyObject *Particle_setNabla(C_Particle *self,PyObject *args) -PyObject *Particle_getVectsize(C_Particle *self) +PyObject *Particle_getVectsize(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -478,7 +478,7 @@ PyObject *Particle_getVectsize(C_Particle *self) -PyObject *Particle_setVectsize(C_Particle *self,PyObject *args) +PyObject *Particle_setVectsize(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val = 0; @@ -491,7 +491,7 @@ PyObject *Particle_setVectsize(C_Particle *self,PyObject *args) } -PyObject *Particle_getTotpart(C_Particle *self) +PyObject *Particle_getTotpart(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -500,7 +500,7 @@ PyObject *Particle_getTotpart(C_Particle *self) -PyObject *Particle_setTotpart(C_Particle *self,PyObject *args) +PyObject *Particle_setTotpart(BPy_Particle *self,PyObject *args) { int val = 0; PartEff*ptr = (PartEff*)self->particle; @@ -513,7 +513,7 @@ PyObject *Particle_setTotpart(C_Particle *self,PyObject *args) } -PyObject *Particle_getTotkey(C_Particle *self) +PyObject *Particle_getTotkey(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -522,7 +522,7 @@ PyObject *Particle_getTotkey(C_Particle *self) -PyObject *Particle_setTotkey(C_Particle *self,PyObject *args) +PyObject *Particle_setTotkey(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; int val = 0; @@ -536,7 +536,7 @@ PyObject *Particle_setTotkey(C_Particle *self,PyObject *args) -PyObject *Particle_getSeed(C_Particle *self) +PyObject *Particle_getSeed(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -545,7 +545,7 @@ PyObject *Particle_getSeed(C_Particle *self) -PyObject *Particle_setSeed(C_Particle *self,PyObject *args) +PyObject *Particle_setSeed(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; int val = 0; @@ -557,7 +557,7 @@ PyObject *Particle_setSeed(C_Particle *self,PyObject *args) return Py_None; } -PyObject *Particle_getForce(C_Particle *self) +PyObject *Particle_getForce(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -565,7 +565,7 @@ PyObject *Particle_getForce(C_Particle *self) } -PyObject *Particle_setForce(C_Particle *self,PyObject *args) +PyObject *Particle_setForce(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val[3]; @@ -585,7 +585,7 @@ PyObject *Particle_setForce(C_Particle *self,PyObject *args) return Py_None; } -PyObject *Particle_getMult(C_Particle *self) +PyObject *Particle_getMult(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -594,7 +594,7 @@ PyObject *Particle_getMult(C_Particle *self) } -PyObject *Particle_setMult(C_Particle *self,PyObject *args) +PyObject *Particle_setMult(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val[4]; @@ -612,7 +612,7 @@ if (PyTuple_Size(args) == 1)args = PyTuple_GetItem(args,0); -PyObject *Particle_getLife(C_Particle *self) +PyObject *Particle_getLife(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -621,7 +621,7 @@ PyObject *Particle_getLife(C_Particle *self) } -PyObject *Particle_setLife(C_Particle *self,PyObject *args) +PyObject *Particle_setLife(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val[4]; @@ -638,7 +638,7 @@ if (PyTuple_Size(args) == 1)args = PyTuple_GetItem(args,0); -PyObject *Particle_getChild(C_Particle *self) +PyObject *Particle_getChild(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -647,7 +647,7 @@ PyObject *Particle_getChild(C_Particle *self) } -PyObject *Particle_setChild(C_Particle *self,PyObject *args) +PyObject *Particle_setChild(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val[4]; @@ -664,7 +664,7 @@ if (PyTuple_Size(args) == 1)args = PyTuple_GetItem(args,0); -PyObject *Particle_getMat(C_Particle *self) +PyObject *Particle_getMat(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -673,7 +673,7 @@ PyObject *Particle_getMat(C_Particle *self) } -PyObject *Particle_setMat(C_Particle *self,PyObject *args) +PyObject *Particle_setMat(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val[4]; @@ -689,7 +689,7 @@ if (PyTuple_Size(args) == 1)args = PyTuple_GetItem(args,0); } -PyObject *Particle_getDefvec(C_Particle *self) +PyObject *Particle_getDefvec(BPy_Particle *self) { PartEff*ptr = (PartEff*)self->particle; @@ -698,7 +698,7 @@ PyObject *Particle_getDefvec(C_Particle *self) } -PyObject *Particle_setDefvec(C_Particle *self,PyObject *args) +PyObject *Particle_setDefvec(BPy_Particle *self,PyObject *args) { PartEff*ptr = (PartEff*)self->particle; float val[3]; @@ -715,10 +715,10 @@ if (PyTuple_Size(args) == 1)args = PyTuple_GetItem(args,0); /*****************************************************************************/ /* Function: ParticleDeAlloc */ -/* Description: This is a callback function for the C_Particle type. It is */ +/* Description: This is a callback function for the BPy_Particle type. It is */ /* the destructor function. */ /*****************************************************************************/ -void ParticleDeAlloc (C_Particle *self) +void ParticleDeAlloc (BPy_Particle *self) { PartEff*ptr = (PartEff*)self; PyObject_DEL (ptr); @@ -726,13 +726,13 @@ void ParticleDeAlloc (C_Particle *self) /*****************************************************************************/ /* Function: ParticleGetAttr */ -/* Description: This is a callback function for the C_Particle type. It is */ -/* the function that accesses C_Particle "member variables" and */ +/* Description: This is a callback function for the BPy_Particle type. It is */ +/* the function that accesses BPy_Particle "member variables" and */ /* methods. */ /*****************************************************************************/ -PyObject *ParticleGetAttr (C_Particle *self, char *name) +PyObject *ParticleGetAttr (BPy_Particle *self, char *name) { if (strcmp (name, "seed") == 0) @@ -773,15 +773,15 @@ PyObject *ParticleGetAttr (C_Particle *self, char *name) return Particle_getDefvec (self); - return Py_FindMethod(C_Particle_methods, (PyObject *)self, name); + return Py_FindMethod(BPy_Particle_methods, (PyObject *)self, name); } /*****************************************************************************/ /* Function: ParticleSetAttr */ -/* Description: This is a callback function for the C_Particle type. It is th*/ +/* Description: This is a callback function for the BPy_Particle type. It is th*/ /* function that sets Particle Data attributes (member vars) */ /*****************************************************************************/ -int ParticleSetAttr (C_Particle *self, char *name, PyObject *value) +int ParticleSetAttr (BPy_Particle *self, char *name, PyObject *value) { PyObject *valtuple; @@ -856,10 +856,10 @@ int ParticleSetAttr (C_Particle *self, char *name, PyObject *value) /*****************************************************************************/ /* Function: ParticlePrint */ -/* Description: This is a callback function for the C_Particle type. It */ +/* Description: This is a callback function for the BPy_Particle type. It */ /* particles a meaninful string to 'print' particle objects. */ /*****************************************************************************/ -int ParticlePrint(C_Particle *self, FILE *fp, int flags) +int ParticlePrint(BPy_Particle *self, FILE *fp, int flags) { printf("Hi, I'm a particle!"); return 0; @@ -867,20 +867,20 @@ int ParticlePrint(C_Particle *self, FILE *fp, int flags) /*****************************************************************************/ /* Function: ParticleRepr */ -/* Description: This is a callback function for the C_Particle type. It */ +/* Description: This is a callback function for the BPy_Particle type. It */ /* particles a meaninful string to represent particle objects. */ /*****************************************************************************/ -PyObject *ParticleRepr (C_Particle *self) +PyObject *ParticleRepr (BPy_Particle *self) { return PyString_FromString("Particle"); } PyObject* ParticleCreatePyObject (struct Effect *particle) { - C_Particle * blen_object; + BPy_Particle * blen_object; - blen_object = (C_Particle*)PyObject_NEW (C_Particle, &Particle_Type); + blen_object = (BPy_Particle*)PyObject_NEW (BPy_Particle, &Particle_Type); if (blen_object == NULL) { @@ -899,9 +899,9 @@ int ParticleCheckPyObject (PyObject *py_obj) struct Particle* ParticleFromPyObject (PyObject *py_obj) { - C_Particle * blen_obj; + BPy_Particle * blen_obj; - blen_obj = (C_Particle*)py_obj; + blen_obj = (BPy_Particle*)py_obj; return ((struct Particle*)blen_obj->particle); } diff --git a/source/blender/python/api2_2x/Particle.h b/source/blender/python/api2_2x/Particle.h index 8e760cbc5be..b20ebb37bd9 100644 --- a/source/blender/python/api2_2x/Particle.h +++ b/source/blender/python/api2_2x/Particle.h @@ -44,6 +44,7 @@ #include #include "gen_utils.h" +#include "bpy_types.h" /*****************************************************************************/ /* Python API function prototypes for the Particle module. */ @@ -52,71 +53,64 @@ PyObject *M_Particle_New (PyObject *self, PyObject *args); PyObject *M_Particle_Get (PyObject *self, PyObject *args); -/*****************************************************************************/ -/* Python C_Particle structure definition: */ -/*****************************************************************************/ -typedef struct { - PyObject_HEAD - Effect *particle; -} C_Particle; #include"Effect.h" /*****************************************************************************/ -/* Python C_Particle methods declarations: */ +/* Python BPy_Particle methods declarations: */ /*****************************************************************************/ -PyObject *Effect_getType(C_Effect *self); -PyObject *Effect_setType(C_Effect *self, PyObject *args); -PyObject *Effect_getFlag(C_Effect *self); -PyObject *Effect_setFlag(C_Effect *self, PyObject *args); -PyObject *Particle_getSta(C_Particle *self); -PyObject *Particle_setSta(C_Particle *self,PyObject*a); -PyObject *Particle_getEnd(C_Particle *self); -PyObject *Particle_setEnd(C_Particle *self,PyObject*a); -PyObject *Particle_getLifetime(C_Particle *self); -PyObject *Particle_setLifetime(C_Particle *self,PyObject*a); -PyObject *Particle_getNormfac(C_Particle *self); -PyObject *Particle_setNormfac(C_Particle *self,PyObject*a); -PyObject *Particle_getObfac(C_Particle *self); -PyObject *Particle_setObfac(C_Particle *self,PyObject*a); -PyObject *Particle_getRandfac(C_Particle *self); -PyObject *Particle_setRandfac(C_Particle *self,PyObject*a); -PyObject *Particle_getTexfac(C_Particle *self); -PyObject *Particle_setTexfac(C_Particle *self,PyObject*a); -PyObject *Particle_getRandlife(C_Particle *self); -PyObject *Particle_setRandlife(C_Particle *self,PyObject*a); -PyObject *Particle_getNabla(C_Particle *self); -PyObject *Particle_setNabla(C_Particle *self,PyObject*a); -PyObject *Particle_getVectsize(C_Particle *self); -PyObject *Particle_setVectsize(C_Particle *self,PyObject*a); -PyObject *Particle_getTotpart(C_Particle *self); -PyObject *Particle_setTotpart(C_Particle *self,PyObject*a); -PyObject *Particle_getTotkey(C_Particle *self); -PyObject *Particle_setTotkey(C_Particle *self,PyObject*a); -PyObject *Particle_getSeed(C_Particle *self); -PyObject *Particle_setSeed(C_Particle *self,PyObject*a); -PyObject *Particle_getForce(C_Particle *self); -PyObject *Particle_setForce(C_Particle *self,PyObject*a); -PyObject *Particle_getMult(C_Particle *self); -PyObject *Particle_setMult(C_Particle *self,PyObject*a); -PyObject *Particle_getLife(C_Particle *self); -PyObject *Particle_setLife(C_Particle *self,PyObject*a); -PyObject *Particle_getMat(C_Particle *self); -PyObject *Particle_setMat(C_Particle *self,PyObject*a); -PyObject *Particle_getChild(C_Particle *self); -PyObject *Particle_setChild(C_Particle *self,PyObject*a); -PyObject *Particle_getDefvec(C_Particle *self); -PyObject *Particle_setDefvec(C_Particle *self,PyObject*a); +PyObject *Effect_getType(BPy_Effect *self); +PyObject *Effect_setType(BPy_Effect *self, PyObject *args); +PyObject *Effect_getFlag(BPy_Effect *self); +PyObject *Effect_setFlag(BPy_Effect *self, PyObject *args); +PyObject *Particle_getSta(BPy_Particle *self); +PyObject *Particle_setSta(BPy_Particle *self,PyObject*a); +PyObject *Particle_getEnd(BPy_Particle *self); +PyObject *Particle_setEnd(BPy_Particle *self,PyObject*a); +PyObject *Particle_getLifetime(BPy_Particle *self); +PyObject *Particle_setLifetime(BPy_Particle *self,PyObject*a); +PyObject *Particle_getNormfac(BPy_Particle *self); +PyObject *Particle_setNormfac(BPy_Particle *self,PyObject*a); +PyObject *Particle_getObfac(BPy_Particle *self); +PyObject *Particle_setObfac(BPy_Particle *self,PyObject*a); +PyObject *Particle_getRandfac(BPy_Particle *self); +PyObject *Particle_setRandfac(BPy_Particle *self,PyObject*a); +PyObject *Particle_getTexfac(BPy_Particle *self); +PyObject *Particle_setTexfac(BPy_Particle *self,PyObject*a); +PyObject *Particle_getRandlife(BPy_Particle *self); +PyObject *Particle_setRandlife(BPy_Particle *self,PyObject*a); +PyObject *Particle_getNabla(BPy_Particle *self); +PyObject *Particle_setNabla(BPy_Particle *self,PyObject*a); +PyObject *Particle_getVectsize(BPy_Particle *self); +PyObject *Particle_setVectsize(BPy_Particle *self,PyObject*a); +PyObject *Particle_getTotpart(BPy_Particle *self); +PyObject *Particle_setTotpart(BPy_Particle *self,PyObject*a); +PyObject *Particle_getTotkey(BPy_Particle *self); +PyObject *Particle_setTotkey(BPy_Particle *self,PyObject*a); +PyObject *Particle_getSeed(BPy_Particle *self); +PyObject *Particle_setSeed(BPy_Particle *self,PyObject*a); +PyObject *Particle_getForce(BPy_Particle *self); +PyObject *Particle_setForce(BPy_Particle *self,PyObject*a); +PyObject *Particle_getMult(BPy_Particle *self); +PyObject *Particle_setMult(BPy_Particle *self,PyObject*a); +PyObject *Particle_getLife(BPy_Particle *self); +PyObject *Particle_setLife(BPy_Particle *self,PyObject*a); +PyObject *Particle_getMat(BPy_Particle *self); +PyObject *Particle_setMat(BPy_Particle *self,PyObject*a); +PyObject *Particle_getChild(BPy_Particle *self); +PyObject *Particle_setChild(BPy_Particle *self,PyObject*a); +PyObject *Particle_getDefvec(BPy_Particle *self); +PyObject *Particle_setDefvec(BPy_Particle *self,PyObject*a); /*****************************************************************************/ /* Python Particle_Type callback function prototypes: */ /*****************************************************************************/ -void ParticleDeAlloc (C_Particle *msh); -int ParticlePrint (C_Particle *msh, FILE *fp, int flags); -int ParticleSetAttr (C_Particle *msh, char *name, PyObject *v); -PyObject *ParticleGetAttr (C_Particle *msh, char *name); -PyObject *ParticleRepr (C_Particle *msh); +void ParticleDeAlloc (BPy_Particle *msh); +int ParticlePrint (BPy_Particle *msh, FILE *fp, int flags); +int ParticleSetAttr (BPy_Particle *msh, char *name, PyObject *v); +PyObject *ParticleGetAttr (BPy_Particle *msh, char *name); +PyObject *ParticleRepr (BPy_Particle *msh); PyObject* ParticleCreatePyObject (struct Effect *particle); int ParticleCheckPyObject (PyObject *py_obj); struct Particle* ParticleFromPyObject (PyObject *py_obj); diff --git a/source/blender/python/api2_2x/Wave.c b/source/blender/python/api2_2x/Wave.c index f8218db39d5..ab2e5639c23 100644 --- a/source/blender/python/api2_2x/Wave.c +++ b/source/blender/python/api2_2x/Wave.c @@ -34,9 +34,9 @@ /*****************************************************************************/ -/* Python C_Wave methods table: */ +/* Python BPy_Wave methods table: */ /*****************************************************************************/ -static PyMethodDef C_Wave_methods[] = { +static PyMethodDef BPy_Wave_methods[] = { {"getType", (PyCFunction)Effect_getType, METH_NOARGS,"() - Return Effect type"}, {"setType", (PyCFunction)Effect_setType, @@ -99,7 +99,7 @@ PyTypeObject Wave_Type = PyObject_HEAD_INIT(NULL) 0, "Wave", - sizeof (C_Wave), + sizeof (BPy_Wave), 0, /* methods */ (destructor)WaveDeAlloc, /* tp_dealloc */ @@ -115,7 +115,7 @@ PyTypeObject Wave_Type = 0,0,0,0,0,0, 0, /* tp_doc */ 0,0,0,0,0,0, - C_Wave_methods, /* tp_methods */ + BPy_Wave_methods, /* tp_methods */ 0, /* tp_members */ }; @@ -163,7 +163,7 @@ struct PyMethodDef M_Wave_methods[] = { PyObject *M_Wave_New(PyObject *self, PyObject *args) { int type = EFF_WAVE; - C_Effect *pyeffect; + BPy_Effect *pyeffect; Effect *bleffect = 0; printf ("In Effect_New()\n"); @@ -173,7 +173,7 @@ int type = EFF_WAVE; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create Effect Data in Blender")); - pyeffect = (C_Effect *)PyObject_NEW(C_Effect, &Effect_Type); + pyeffect = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); if (pyeffect == NULL) return (EXPP_ReturnPyObjError (PyExc_MemoryError, @@ -196,7 +196,7 @@ PyObject *M_Wave_Get(PyObject *self, PyObject *args) char *name = 0; Object *object_iter; Effect *eff; - C_Wave *wanted_eff; + BPy_Wave *wanted_eff; int num,i; printf ("In Effect_Get()\n"); if (!PyArg_ParseTuple(args, "si", &name, &num )) @@ -226,7 +226,7 @@ PyObject *M_Wave_Get(PyObject *self, PyObject *args) if (!eff) return(EXPP_ReturnPyObjError(PyExc_AttributeError,"bject")); } - wanted_eff = (C_Wave *)PyObject_NEW(C_Wave, &Wave_Type); + wanted_eff = (BPy_Wave *)PyObject_NEW(BPy_Wave, &Wave_Type); wanted_eff->wave = eff; return (PyObject*)wanted_eff; } @@ -249,16 +249,16 @@ PyObject *M_Wave_Init (void) } /*****************************************************************************/ -/* Python C_Wave methods: */ +/* Python BPy_Wave methods: */ /*****************************************************************************/ -PyObject *Wave_getStartx(C_Wave *self) +PyObject *Wave_getStartx(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->startx); } -PyObject *Wave_setStartx(C_Wave *self,PyObject *args) +PyObject *Wave_setStartx(BPy_Wave *self,PyObject *args) { WaveEff*ptr = (WaveEff*)self->wave; float val = 0; @@ -270,13 +270,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) return Py_None; } -PyObject *Wave_getStarty(C_Wave *self) +PyObject *Wave_getStarty(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->starty); } -PyObject *Wave_setStarty(C_Wave *self,PyObject *args) +PyObject *Wave_setStarty(BPy_Wave *self,PyObject *args) { WaveEff*ptr = (WaveEff*)self->wave; float val = 0; @@ -288,13 +288,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) return Py_None; } -PyObject *Wave_getHeight(C_Wave *self) +PyObject *Wave_getHeight(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->height); } -PyObject *Wave_setHeight(C_Wave *self,PyObject *args) +PyObject *Wave_setHeight(BPy_Wave *self,PyObject *args) { WaveEff*ptr = (WaveEff*)self->wave; float val = 0; @@ -306,13 +306,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) return Py_None; } -PyObject *Wave_getWidth(C_Wave *self) +PyObject *Wave_getWidth(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->width); } -PyObject *Wave_setWidth(C_Wave *self,PyObject *args) +PyObject *Wave_setWidth(BPy_Wave *self,PyObject *args) { float val = 0; WaveEff*ptr; @@ -325,13 +325,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) return Py_None; } -PyObject *Wave_getNarrow(C_Wave *self) +PyObject *Wave_getNarrow(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->narrow); } -PyObject *Wave_setNarrow(C_Wave *self,PyObject *args) +PyObject *Wave_setNarrow(BPy_Wave *self,PyObject *args) { float val = 0; WaveEff*ptr; @@ -344,13 +344,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) return Py_None; } -PyObject *Wave_getSpeed(C_Wave *self) +PyObject *Wave_getSpeed(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->speed); } -PyObject *Wave_setSpeed(C_Wave *self,PyObject *args) +PyObject *Wave_setSpeed(BPy_Wave *self,PyObject *args) { float val = 0; WaveEff*ptr; @@ -363,13 +363,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) return Py_None; } -PyObject *Wave_getMinfac(C_Wave *self) +PyObject *Wave_getMinfac(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->minfac); } -PyObject *Wave_setMinfac(C_Wave *self,PyObject *args) +PyObject *Wave_setMinfac(BPy_Wave *self,PyObject *args) { float val = 0; WaveEff*ptr; @@ -384,13 +384,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) -PyObject *Wave_getDamp(C_Wave *self) +PyObject *Wave_getDamp(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->damp); } -PyObject *Wave_setDamp(C_Wave *self,PyObject *args) +PyObject *Wave_setDamp(BPy_Wave *self,PyObject *args) { WaveEff*ptr; float val = 0; @@ -403,13 +403,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) return Py_None; } -PyObject *Wave_getTimeoffs(C_Wave *self) +PyObject *Wave_getTimeoffs(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->timeoffs); } -PyObject *Wave_setTimeoffs(C_Wave *self,PyObject *args) +PyObject *Wave_setTimeoffs(BPy_Wave *self,PyObject *args) { float val = 0; WaveEff*ptr; @@ -422,13 +422,13 @@ if (!PyArg_ParseTuple(args, "f", &val )) return Py_None; } -PyObject *Wave_getLifetime(C_Wave *self) +PyObject *Wave_getLifetime(BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; return PyFloat_FromDouble(ptr->lifetime); } -PyObject *Wave_setLifetime(C_Wave *self,PyObject *args) +PyObject *Wave_setLifetime(BPy_Wave *self,PyObject *args) { float val = 0; WaveEff*ptr; @@ -442,10 +442,10 @@ if (!PyArg_ParseTuple(args, "f", &val )) } /*****************************************************************************/ /* Function: WaveDeAlloc */ -/* Description: This is a callback function for the C_Wave type. It is */ +/* Description: This is a callback function for the BPy_Wave type. It is */ /* the destructor function. */ /*****************************************************************************/ -void WaveDeAlloc (C_Wave *self) +void WaveDeAlloc (BPy_Wave *self) { WaveEff*ptr = (WaveEff*)self->wave; PyObject_DEL (ptr); @@ -453,12 +453,12 @@ void WaveDeAlloc (C_Wave *self) /*****************************************************************************/ /* Function: WaveGetAttr */ -/* Description: This is a callback function for the C_Wave type. It is */ -/* the function that accesses C_Wave "member variables" and */ +/* Description: This is a callback function for the BPy_Wave type. It is */ +/* the function that accesses BPy_Wave "member variables" and */ /* methods. */ /*****************************************************************************/ -PyObject *WaveGetAttr (C_Wave *self, char *name) +PyObject *WaveGetAttr (BPy_Wave *self, char *name) { if (!strcmp(name,"lifetime"))return Wave_getLifetime( self); else if (!strcmp(name,"timeoffs"))return Wave_getTimeoffs( self); @@ -470,15 +470,15 @@ PyObject *WaveGetAttr (C_Wave *self, char *name) else if (!strcmp(name,"height"))return Wave_getHeight( self); else if (!strcmp(name,"startx"))return Wave_getStartx( self); else if (!strcmp(name,"starty"))return Wave_getStarty( self); - return Py_FindMethod(C_Wave_methods, (PyObject *)self, name); + return Py_FindMethod(BPy_Wave_methods, (PyObject *)self, name); } /*****************************************************************************/ /* Function: WaveSetAttr */ -/* Description: This is a callback function for the C_Wave type. It is the */ +/* Description: This is a callback function for the BPy_Wave type. It is the */ /* function that sets Wave Data attributes (member variables). */ /*****************************************************************************/ -int WaveSetAttr (C_Wave *self, char *name, PyObject *value) +int WaveSetAttr (BPy_Wave *self, char *name, PyObject *value) { PyObject *valtuple; PyObject *error = NULL; @@ -524,10 +524,10 @@ int WaveSetAttr (C_Wave *self, char *name, PyObject *value) /*****************************************************************************/ /* Function: WavePrint */ -/* Description: This is a callback function for the C_Wave type. It */ +/* Description: This is a callback function for the BPy_Wave type. It */ /* builds a meaninful string to 'print' wave objects. */ /*****************************************************************************/ -int WavePrint(C_Wave *self, FILE *fp, int flags) +int WavePrint(BPy_Wave *self, FILE *fp, int flags) { printf("I'm a wave...Cool, no?"); @@ -536,21 +536,21 @@ int WavePrint(C_Wave *self, FILE *fp, int flags) /*****************************************************************************/ /* Function: WaveRepr */ -/* Description: This is a callback function for the C_Wave type. It */ +/* Description: This is a callback function for the BPy_Wave type. It */ /* builds a meaninful string to represent wave objects. */ /*****************************************************************************/ -PyObject *WaveRepr (C_Wave *self) +PyObject *WaveRepr (BPy_Wave *self) { return 0; } PyObject* WaveCreatePyObject (struct Effect *wave) { - C_Wave * blen_object; + BPy_Wave * blen_object; printf ("In WaveCreatePyObject\n"); - blen_object = (C_Wave*)PyObject_NEW (C_Wave, &Wave_Type); + blen_object = (BPy_Wave*)PyObject_NEW (BPy_Wave, &Wave_Type); if (blen_object == NULL) { @@ -569,9 +569,9 @@ return (py_obj->ob_type == &Wave_Type); struct Wave* WaveFromPyObject (PyObject *py_obj) { - C_Wave * blen_obj; + BPy_Wave * blen_obj; - blen_obj = (C_Wave*)py_obj; + blen_obj = (BPy_Wave*)py_obj; return ((struct Wave*)blen_obj->wave); } diff --git a/source/blender/python/api2_2x/Wave.h b/source/blender/python/api2_2x/Wave.h index 8fab6b0d5da..1544088535d 100644 --- a/source/blender/python/api2_2x/Wave.h +++ b/source/blender/python/api2_2x/Wave.h @@ -52,51 +52,43 @@ PyObject *M_Wave_New (PyObject *self, PyObject *args); PyObject *M_Wave_Get (PyObject *self, PyObject *args); -/*****************************************************************************/ -/* Python C_Wave structure definition: */ -/*****************************************************************************/ -typedef struct { - PyObject_HEAD - Effect *wave; -} C_Wave; - #include"Effect.h" /*****************************************************************************/ -/* Python C_Wave methods declarations: */ +/* Python BPy_Wave methods declarations: */ /*****************************************************************************/ -PyObject *Effect_getType(C_Effect *self); -PyObject *Effect_setType(C_Effect *self, PyObject *args); -PyObject *Effect_getFlag(C_Effect *self); -PyObject *Effect_setFlag(C_Effect *self, PyObject *args); -PyObject *Wave_getStartx(C_Wave *self); -PyObject *Wave_setStartx(C_Wave *self,PyObject*a); -PyObject *Wave_getStarty(C_Wave *self); -PyObject *Wave_setStarty(C_Wave *self,PyObject*a); -PyObject *Wave_getHeight(C_Wave *self); -PyObject *Wave_setHeight(C_Wave *self,PyObject*a); -PyObject *Wave_getWidth(C_Wave *self); -PyObject *Wave_setWidth(C_Wave *self,PyObject*a); -PyObject *Wave_getNarrow(C_Wave *self); -PyObject *Wave_setNarrow(C_Wave *self,PyObject*a); -PyObject *Wave_getSpeed(C_Wave *self); -PyObject *Wave_setSpeed(C_Wave *self,PyObject*a); -PyObject *Wave_getMinfac(C_Wave *self); -PyObject *Wave_setMinfac(C_Wave *self,PyObject*a); -PyObject *Wave_getDamp(C_Wave *self); -PyObject *Wave_setDamp(C_Wave *self,PyObject*a); -PyObject *Wave_getTimeoffs(C_Wave *self); -PyObject *Wave_setTimeoffs(C_Wave *self,PyObject*a); -PyObject *Wave_getLifetime(C_Wave *self); -PyObject *Wave_setLifetime(C_Wave *self,PyObject*a); +PyObject *Effect_getType(BPy_Effect *self); +PyObject *Effect_setType(BPy_Effect *self, PyObject *args); +PyObject *Effect_getFlag(BPy_Effect *self); +PyObject *Effect_setFlag(BPy_Effect *self, PyObject *args); +PyObject *Wave_getStartx(BPy_Wave *self); +PyObject *Wave_setStartx(BPy_Wave *self,PyObject*a); +PyObject *Wave_getStarty(BPy_Wave *self); +PyObject *Wave_setStarty(BPy_Wave *self,PyObject*a); +PyObject *Wave_getHeight(BPy_Wave *self); +PyObject *Wave_setHeight(BPy_Wave *self,PyObject*a); +PyObject *Wave_getWidth(BPy_Wave *self); +PyObject *Wave_setWidth(BPy_Wave *self,PyObject*a); +PyObject *Wave_getNarrow(BPy_Wave *self); +PyObject *Wave_setNarrow(BPy_Wave *self,PyObject*a); +PyObject *Wave_getSpeed(BPy_Wave *self); +PyObject *Wave_setSpeed(BPy_Wave *self,PyObject*a); +PyObject *Wave_getMinfac(BPy_Wave *self); +PyObject *Wave_setMinfac(BPy_Wave *self,PyObject*a); +PyObject *Wave_getDamp(BPy_Wave *self); +PyObject *Wave_setDamp(BPy_Wave *self,PyObject*a); +PyObject *Wave_getTimeoffs(BPy_Wave *self); +PyObject *Wave_setTimeoffs(BPy_Wave *self,PyObject*a); +PyObject *Wave_getLifetime(BPy_Wave *self); +PyObject *Wave_setLifetime(BPy_Wave *self,PyObject*a); /*****************************************************************************/ /* Python Wave_Type callback function prototypes: */ /*****************************************************************************/ -void WaveDeAlloc (C_Wave *msh); -int WavePrint (C_Wave *msh, FILE *fp, int flags); -int WaveSetAttr (C_Wave *msh, char *name, PyObject *v); -PyObject *WaveGetAttr (C_Wave *msh, char *name); -PyObject *WaveRepr (C_Wave *msh); +void WaveDeAlloc (BPy_Wave *msh); +int WavePrint (BPy_Wave *msh, FILE *fp, int flags); +int WaveSetAttr (BPy_Wave *msh, char *name, PyObject *v); +PyObject *WaveGetAttr (BPy_Wave *msh, char *name); +PyObject *WaveRepr (BPy_Wave *msh); PyObject* WaveCreatePyObject (struct Effect *wave); int WaveCheckPyObject (PyObject *py_obj); struct Wave* WaveFromPyObject (PyObject *py_obj); diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 0b5ca91cc2f..2ffb3ebef5c 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -51,155 +51,15 @@ #include "World.h" -/*****************************************************************************/ -/* Python API function prototypes for the World module. */ -/*****************************************************************************/ -static PyObject *M_World_New (PyObject *self, PyObject *args, - PyObject *keywords); -static PyObject *M_World_Get (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.World.__doc__ */ -/*****************************************************************************/ -static char M_World_doc[] = -"The Blender World module\n\n\ -This module provides access to **World Data** objects in Blender\n\n\ -Example::\n\n\ - from Blender import World, Object, Scene\n\ - c = World.New('ortho') # create new ortho world data\n\ - c.lens = 35.0 # set lens value\n\ - cur = Scene.getCurrent() # get current Scene\n\ - ob = Object.New('World') # make world object\n\ - ob.link(c) # link world data with this object\n\ - cur.link(ob) # link object into scene\n\ - cur.setCurrentWorld(ob) # make this world the active\n"; - -static char M_World_New_doc[] = -"(type) - return a new World object of type \"type\", \ -which can be 'persp' or 'ortho'.\n\ -() - return a new World object of type 'persp'."; - -static char M_World_Get_doc[] = -"(name) - return the world with the name 'name', \ -returns None if not found.\n If 'name' is not specified, \ -it returns a list of all worlds in the\ncurrent scene."; - -/*****************************************************************************/ -/* Python method structure definition for Blender.World module: */ -/*****************************************************************************/ -struct PyMethodDef M_World_methods[] = { - {"New",(PyCFunction)M_World_New, METH_VARARGS|METH_KEYWORDS,M_World_New_doc}, - {"Get", M_World_Get, METH_VARARGS, M_World_Get_doc}, - {"get", M_World_Get, METH_VARARGS, M_World_Get_doc}, - {NULL, NULL, 0, NULL} -}; - -/*****************************************************************************/ -/* Python C_World methods declarations: */ -/*****************************************************************************/ -static PyObject *World_getName(C_World *self); -static PyObject *World_setName(C_World *self, PyObject *args); -static PyObject *World_getColormodel(C_World *self); -static PyObject *World_setColormodel(C_World *self, PyObject *args ); -static PyObject *World_getFastcol(C_World *self); -static PyObject *World_setFastcol(C_World *self, PyObject *args ); -static PyObject *World_getSkytype(C_World *self); -static PyObject *World_setSkytype(C_World *self, PyObject *args ); -static PyObject *World_getMode(C_World *self); -static PyObject *World_setMode(C_World *self, PyObject *args ); -static PyObject *World_getTotex(C_World *self); -static PyObject *World_setTotex(C_World *self, PyObject *args ); -static PyObject *World_getTexact(C_World *self); -static PyObject *World_setTexact(C_World *self, PyObject *args ); -static PyObject *World_getMistype(C_World *self); -static PyObject *World_setMistype(C_World *self, PyObject *args ); -static PyObject *World_getHor(C_World *self); -static PyObject *World_setHor(C_World *self, PyObject *args ); -static PyObject *World_getZen(C_World *self); -static PyObject *World_setZen(C_World *self, PyObject *args ); -static PyObject *World_getAmb(C_World *self); -static PyObject *World_setAmb(C_World *self, PyObject *args ); -static PyObject *World_getStar(C_World *self); -static PyObject *World_setStar(C_World *self, PyObject *args ); -static PyObject *World_getDof(C_World *self); -static PyObject *World_setDof(C_World *self, PyObject *args ); -static PyObject *World_getMist(C_World *self); -static PyObject *World_setMist(C_World *self, PyObject *args ); - -/*****************************************************************************/ -/* Python C_World methods table: */ -/*****************************************************************************/ -static PyMethodDef C_World_methods[] = { - {"getName", (PyCFunction)World_getName, METH_NOARGS, - "() - Return World Data name"}, - {"setName", (PyCFunction)World_setName, METH_VARARGS, - "() - Return World Data name"}, - {"getColormodel", (PyCFunction)World_getColormodel, METH_NOARGS, - "() - Return World Data colormodel"}, - {"setColormodel", (PyCFunction)World_setColormodel, METH_VARARGS, - "() - Return World Data colormodel"}, - {"getFastcol", (PyCFunction)World_getFastcol, METH_NOARGS, - "() - Return World Data fastcol"}, - {"setFastcol", (PyCFunction)World_setFastcol, METH_VARARGS, - "() - Return World Data fastcol"}, - {"getSkytype", (PyCFunction)World_getSkytype, METH_NOARGS, - "() - Return World Data skytype"}, - {"setSkytype", (PyCFunction)World_setSkytype, METH_VARARGS, - "() - Return World Data skytype"}, - {"getMode", (PyCFunction)World_getMode, METH_NOARGS, - "() - Return World Data mode"}, - {"setMode", (PyCFunction)World_setMode, METH_VARARGS, - "() - Return World Data mode"}, - {"getTotex", (PyCFunction)World_getTotex, METH_NOARGS, - "() - Return World Data totex"}, - {"setTotex", (PyCFunction)World_setTotex, METH_VARARGS, - "() - Return World Data totex"}, - {"getTexact", (PyCFunction)World_getTexact, METH_NOARGS, - "() - Return World Data texact"}, - {"setTexact", (PyCFunction)World_setTexact, METH_VARARGS, - "() - Return World Data texact"}, - {"getMistype", (PyCFunction)World_getMistype, METH_NOARGS, - "() - Return World Data mistype"}, - {"setMistype", (PyCFunction)World_setMistype, METH_VARARGS, - "() - Return World Data mistype"}, - {"getHor", (PyCFunction)World_getHor, METH_NOARGS, - "() - Return World Data hor"}, - {"setHor", (PyCFunction)World_setHor, METH_VARARGS, - "() - Return World Data hor"}, - {"getZen", (PyCFunction)World_getZen, METH_NOARGS, - "() - Return World Data zen"}, - {"setZen", (PyCFunction)World_setZen, METH_VARARGS, - "() - Return World Data zen"}, - {"getAmb", (PyCFunction)World_getAmb, METH_NOARGS, - "() - Return World Data amb"}, - {"setAmb", (PyCFunction)World_setAmb, METH_VARARGS, - "() - Return World Data amb"}, - {"getStar", (PyCFunction)World_getStar, METH_NOARGS, - "() - Return World Data star"}, - {"setStar", (PyCFunction)World_setStar, METH_VARARGS, - "() - Return World Data star"}, - {"getDof", (PyCFunction)World_getDof, METH_NOARGS, - "() - Return World Data dof"}, - {"setDof", (PyCFunction)World_setDof, METH_VARARGS, - "() - Return World Data dof"}, - {"getMist", (PyCFunction)World_getMist, METH_NOARGS, - "() - Return World Data mist"}, - {"setMist", (PyCFunction)World_setMist, METH_VARARGS, - "() - Return World Data mist"}, - {0} -}; - /*****************************************************************************/ /* Python World_Type callback function prototypes: */ /*****************************************************************************/ -static void World_DeAlloc (C_World *self); -static int World_Print (C_World *self, FILE *fp, int flags); -static int World_SetAttr (C_World *self, char *name, PyObject *v); -static int World_Compare (C_World *a, C_World *b); -static PyObject *World_GetAttr (C_World *self, char *name); -static PyObject *World_Repr (C_World *self); +static void World_DeAlloc (BPy_World *self); +static int World_Print (BPy_World *self, FILE *fp, int flags); +static int World_SetAttr (BPy_World *self, char *name, PyObject *v); +static int World_Compare (BPy_World *a, BPy_World *b); +static PyObject *World_GetAttr (BPy_World *self, char *name); +static PyObject *World_Repr (BPy_World *self); /*****************************************************************************/ /* Python World_Type structure definition: */ @@ -209,7 +69,7 @@ PyTypeObject World_Type = PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "World", /* tp_name */ - sizeof (C_World), /* tp_basicsize */ + sizeof (BPy_World), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)World_DeAlloc, /* tp_dealloc */ @@ -225,7 +85,7 @@ PyTypeObject World_Type = 0,0,0,0,0,0, 0, /* tp_doc */ 0,0,0,0,0,0, - C_World_methods, /* tp_methods */ + BPy_World_methods, /* tp_methods */ 0, /* tp_members */ }; @@ -251,7 +111,7 @@ static PyObject *M_World_New(PyObject *self, PyObject *args, PyObject *kwords) World *add_world(char *name); char*name = NULL; - C_World *pyworld; + BPy_World *pyworld; World *blworld; if (!PyArg_ParseTuple(args, "s", &name)) @@ -262,7 +122,7 @@ static PyObject *M_World_New(PyObject *self, PyObject *args, PyObject *kwords) blworld = add_world(name); if (blworld) - pyworld = (C_World *)PyObject_NEW(C_World, &World_Type); + pyworld = (BPy_World *)PyObject_NEW(BPy_World, &World_Type); else return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create World Data in Blender")); @@ -295,7 +155,7 @@ static PyObject *M_World_Get(PyObject *self, PyObject *args) char *name = NULL; World *world_iter; PyObject *worldlist; - C_World *wanted_world = NULL; + BPy_World *wanted_world = NULL; char error_msg[64]; if (!PyArg_ParseTuple(args, "|s", &name)) @@ -307,7 +167,7 @@ static PyObject *M_World_Get(PyObject *self, PyObject *args) if (name) { /* (name) - Search world by name */ while ((world_iter) && (wanted_world == NULL)) { if (strcmp (name, world_iter->id.name+2) == 0) { - wanted_world = (C_World *)PyObject_NEW(C_World, &World_Type); + wanted_world = (BPy_World *)PyObject_NEW(BPy_World, &World_Type); if (wanted_world) wanted_world->world = world_iter; } world_iter = world_iter->id.next; @@ -329,7 +189,7 @@ static PyObject *M_World_Get(PyObject *self, PyObject *args) "couldn't create PyList")); while (world_iter) { - C_World *found_world = (C_World *)PyObject_NEW(C_World, &World_Type); + BPy_World *found_world = (BPy_World *)PyObject_NEW(BPy_World, &World_Type); found_world->world = world_iter; PyList_Append (worldlist , (PyObject *)found_world); @@ -365,7 +225,7 @@ PyObject *M_World_Init (void) /*****************************************************************************/ -/* Python C_World methods: */ +/* Python BPy_World methods: */ /*****************************************************************************/ /** @@ -383,7 +243,7 @@ PyObject *M_World_Init (void) * \return string: The World Data name. */ -static PyObject *World_getName(C_World *self) +static PyObject *World_getName(BPy_World *self) { PyObject *attr = PyString_FromString(self->world->id.name+2); @@ -397,7 +257,7 @@ static PyObject *World_getName(C_World *self) * \param name - string: The new World Data name. */ -static PyObject *World_setName(C_World *self, PyObject *args) +static PyObject *World_setName(BPy_World *self, PyObject *args) { char *name = 0; char buf[21]; @@ -422,7 +282,7 @@ static PyObject *World_setName(C_World *self, PyObject *args) * \return int : The World Data colormodel. */ -static PyObject *World_getColormodel(C_World *self) +static PyObject *World_getColormodel(BPy_World *self) { PyObject *attr = PyInt_FromLong((long)self->world->colormodel); @@ -439,7 +299,7 @@ static PyObject *World_getColormodel(C_World *self) * \return int : The World Data colormodel. */ -static PyObject *World_setColormodel(C_World *self, PyObject *args ) +static PyObject *World_setColormodel(BPy_World *self, PyObject *args ) { int colormodel; @@ -457,7 +317,7 @@ static PyObject *World_setColormodel(C_World *self, PyObject *args ) * \return int : The World Data fastcol. */ -static PyObject *World_getFastcol(C_World *self) +static PyObject *World_getFastcol(BPy_World *self) { PyObject *attr = PyInt_FromLong((long)self->world->fastcol); @@ -474,7 +334,7 @@ static PyObject *World_getFastcol(C_World *self) * \return int : The World Data fastcol. */ -static PyObject *World_setFastcol(C_World *self, PyObject *args ) +static PyObject *World_setFastcol(BPy_World *self, PyObject *args ) { int fastcol; @@ -495,7 +355,7 @@ static PyObject *World_setFastcol(C_World *self, PyObject *args ) * \return int : The World Data skytype. */ -static PyObject *World_getSkytype(C_World *self) +static PyObject *World_getSkytype(BPy_World *self) { PyObject *attr = PyInt_FromLong((long)self->world->skytype); @@ -512,7 +372,7 @@ static PyObject *World_getSkytype(C_World *self) * \return int : The World Data skytype. */ -static PyObject *World_setSkytype(C_World *self, PyObject *args ) +static PyObject *World_setSkytype(BPy_World *self, PyObject *args ) { int skytype; @@ -531,7 +391,7 @@ static PyObject *World_setSkytype(C_World *self, PyObject *args ) * \return int : The World Data mode. */ -static PyObject *World_getMode(C_World *self) +static PyObject *World_getMode(BPy_World *self) { PyObject *attr = PyInt_FromLong((long)self->world->mode); @@ -548,7 +408,7 @@ static PyObject *World_getMode(C_World *self) * \return int : The World Data mode. */ -static PyObject *World_setMode(C_World *self, PyObject *args ) +static PyObject *World_setMode(BPy_World *self, PyObject *args ) { int mode; @@ -590,7 +450,7 @@ static PyObject *World_setMode(C_World *self, PyObject *args ) * \return int : The World Data totex. */ -static PyObject *World_getTotex(C_World *self) +static PyObject *World_getTotex(BPy_World *self) { PyObject *attr = PyInt_FromLong((long)self->world->totex); @@ -607,7 +467,7 @@ static PyObject *World_getTotex(C_World *self) * \return int : The World Data totex. */ -static PyObject *World_setTotex(C_World *self, PyObject *args ) +static PyObject *World_setTotex(BPy_World *self, PyObject *args ) { int totex; @@ -625,7 +485,7 @@ static PyObject *World_setTotex(C_World *self, PyObject *args ) * \return int : The World Data texact. */ -static PyObject *World_getTexact(C_World *self) +static PyObject *World_getTexact(BPy_World *self) { PyObject *attr = PyInt_FromLong((long)self->world->texact); @@ -642,7 +502,7 @@ static PyObject *World_getTexact(C_World *self) * \return int : The World Data texact. */ -static PyObject *World_setTexact(C_World *self, PyObject *args ) +static PyObject *World_setTexact(BPy_World *self, PyObject *args ) { int texact; @@ -660,7 +520,7 @@ static PyObject *World_setTexact(C_World *self, PyObject *args ) * \return int : The World Data mistype. */ -static PyObject *World_getMistype(C_World *self) +static PyObject *World_getMistype(BPy_World *self) { PyObject *attr = PyInt_FromLong((long)self->world->mistype); @@ -677,7 +537,7 @@ static PyObject *World_getMistype(C_World *self) * \return int : The World Data mistype. */ -static PyObject *World_setMistype(C_World *self, PyObject *args ) +static PyObject *World_setMistype(BPy_World *self, PyObject *args ) { int mistype; @@ -697,7 +557,7 @@ static PyObject *World_setMistype(C_World *self, PyObject *args ) -static PyObject *World_getHor(C_World *self) +static PyObject *World_getHor(BPy_World *self) { PyObject *attr = PyList_New(0); if (!attr) @@ -710,7 +570,7 @@ static PyObject *World_getHor(C_World *self) } -static PyObject *World_setHor(C_World *self, PyObject *args ) +static PyObject *World_setHor(BPy_World *self, PyObject *args ) { PyObject *listargs=0; if (!PyArg_ParseTuple(args, "O", &listargs)) @@ -724,7 +584,7 @@ static PyObject *World_setHor(C_World *self, PyObject *args ) } -static PyObject *World_getZen(C_World *self) +static PyObject *World_getZen(BPy_World *self) { PyObject *attr = PyList_New(0); if (!attr) @@ -737,7 +597,7 @@ static PyObject *World_getZen(C_World *self) } -static PyObject *World_setZen(C_World *self, PyObject *args ) +static PyObject *World_setZen(BPy_World *self, PyObject *args ) { PyObject *listargs=0; if (!PyArg_ParseTuple(args, "O", &listargs)) @@ -753,7 +613,7 @@ static PyObject *World_setZen(C_World *self, PyObject *args ) -static PyObject *World_getAmb(C_World *self) +static PyObject *World_getAmb(BPy_World *self) { PyObject *attr = PyList_New(0); if (!attr) @@ -766,7 +626,7 @@ static PyObject *World_getAmb(C_World *self) } -static PyObject *World_setAmb(C_World *self, PyObject *args ) +static PyObject *World_setAmb(BPy_World *self, PyObject *args ) { PyObject *listargs=0; if (!PyArg_ParseTuple(args, "O", &listargs)) @@ -783,7 +643,7 @@ static PyObject *World_setAmb(C_World *self, PyObject *args ) } -static PyObject *World_getStar(C_World *self) +static PyObject *World_getStar(BPy_World *self) { PyObject *attr = PyList_New(0); if (!attr) @@ -799,7 +659,7 @@ static PyObject *World_getStar(C_World *self) } -static PyObject *World_setStar(C_World *self, PyObject *args ) +static PyObject *World_setStar(BPy_World *self, PyObject *args ) { PyObject *listargs=0; if (!PyArg_ParseTuple(args, "O", &listargs)) @@ -821,7 +681,7 @@ static PyObject *World_setStar(C_World *self, PyObject *args ) -static PyObject *World_getDof(C_World *self) +static PyObject *World_getDof(BPy_World *self) { PyObject *attr = PyList_New(0); if (!attr) @@ -834,7 +694,7 @@ static PyObject *World_getDof(C_World *self) } -static PyObject *World_setDof(C_World *self, PyObject *args ) +static PyObject *World_setDof(BPy_World *self, PyObject *args ) { PyObject *listargs=0; if (!PyArg_ParseTuple(args, "O", &listargs)) @@ -854,7 +714,7 @@ static PyObject *World_setDof(C_World *self, PyObject *args ) -static PyObject *World_getMist(C_World *self) +static PyObject *World_getMist(BPy_World *self) { PyObject *attr = PyList_New(0); if (!attr) @@ -867,7 +727,7 @@ static PyObject *World_getMist(C_World *self) } -static PyObject *World_setMist(C_World *self, PyObject *args ) +static PyObject *World_setMist(BPy_World *self, PyObject *args ) { PyObject *listargs=0; if (!PyArg_ParseTuple(args, "O", &listargs)) @@ -893,7 +753,7 @@ static PyObject *World_setMist(C_World *self, PyObject *args ) * \brief The World PyType destructor */ -static void World_DeAlloc (C_World *self) +static void World_DeAlloc (BPy_World *self) { PyObject_DEL (self); } @@ -905,7 +765,7 @@ static void World_DeAlloc (C_World *self) * World PyObject data members. Ex. in Python: "print myworld.lens". */ -static PyObject *World_GetAttr (C_World *self, char *name) +static PyObject *World_GetAttr (BPy_World *self, char *name) { if (strcmp (name, "name") == 0)return World_getName (self); @@ -922,7 +782,7 @@ if (strcmp (name, "amb") == 0)return World_getAmb (self); if (strcmp (name, "star") == 0)return World_getStar (self); if (strcmp (name, "dof") == 0)return World_getDof (self); if (strcmp (name, "mist") == 0)return World_getMist (self); - return Py_FindMethod(C_World_methods, (PyObject *)self, name); + return Py_FindMethod(BPy_World_methods, (PyObject *)self, name); } /** @@ -932,7 +792,7 @@ if (strcmp (name, "mist") == 0)return World_getMist (self); * World data member. Ex. in Python: "myworld.lens = 45.0". */ -static int World_SetAttr (C_World *self, char *name, PyObject *value) +static int World_SetAttr (BPy_World *self, char *name, PyObject *value) { PyObject *valtuple = Py_BuildValue("(O)", value); @@ -967,7 +827,7 @@ return 0; /* normal exit */ * comparisons are meaninful -- the "<", "<=", ">" or ">=" are not. */ -static int World_Compare (C_World *a, C_World *b) +static int World_Compare (BPy_World *a, BPy_World *b) { World *pa = a->world, *pb = b->world; return (pa == pb) ? 0:-1; @@ -980,7 +840,7 @@ static int World_Compare (C_World *a, C_World *b) * World. It builds a string with the name of the wrapped Blender World. */ -static int World_Print(C_World *self, FILE *fp, int flags) +static int World_Print(BPy_World *self, FILE *fp, int flags) { fprintf(fp, "[World \"%s\"]", self->world->id.name+2); return 0; @@ -993,7 +853,7 @@ static int World_Print(C_World *self, FILE *fp, int flags) * Python. Repr gives a string representation of a PyObject. */ -static PyObject *World_Repr (C_World *self) +static PyObject *World_Repr (BPy_World *self) { return PyString_FromString(self->world->id.name+2); } diff --git a/source/blender/python/api2_2x/World.h b/source/blender/python/api2_2x/World.h index a9d2df41fb3..6063e0a27ad 100644 --- a/source/blender/python/api2_2x/World.h +++ b/source/blender/python/api2_2x/World.h @@ -34,23 +34,142 @@ #include -#include #include "constant.h" #include "gen_utils.h" - -/* The World PyType Object defined in World.c */ -extern PyTypeObject World_Type; +#include "bpy_types.h" /*****************************************************************************/ -/* Python C_World structure definition: */ +/* Python API function prototypes for the World module. */ /*****************************************************************************/ -typedef struct { - PyObject_HEAD - World *world; +static PyObject *M_World_New (PyObject *self, PyObject *args, + PyObject *keywords); +static PyObject *M_World_Get (PyObject *self, PyObject *args); -} C_World; + +/*****************************************************************************/ +/* The following string definitions are used for documentation strings. */ +/* In Python these will be written to the console when doing a */ +/* Blender.World.__doc__ */ +/*****************************************************************************/ +static char M_World_doc[] = +"The Blender World module\n\n\ +This module provides access to **World Data** objects in Blender\n\n"; + +static char M_World_New_doc[] ="() - return a new World object"; + +static char M_World_Get_doc[] ="(name) - return the world with the name 'name', \ +returns None if not found.\n If 'name' is not specified, \ +it returns a list of all worlds in the\ncurrent scene."; + + + +/*****************************************************************************/ +/* Python method structure definition for Blender.World module: */ +/*****************************************************************************/ +struct PyMethodDef M_World_methods[] = { + {"New",(PyCFunction)M_World_New, METH_VARARGS|METH_KEYWORDS,M_World_New_doc}, + {"Get", M_World_Get, METH_VARARGS, M_World_Get_doc}, + {"get", M_World_Get, METH_VARARGS, M_World_Get_doc}, + {NULL, NULL, 0, NULL} +}; + + +/*****************************************************************************/ +/* Python BPy_World methods declarations: */ +/*****************************************************************************/ +static PyObject *World_getName(BPy_World *self); +static PyObject *World_setName(BPy_World *self, PyObject *args); +static PyObject *World_getColormodel(BPy_World *self); +static PyObject *World_setColormodel(BPy_World *self, PyObject *args ); +static PyObject *World_getFastcol(BPy_World *self); +static PyObject *World_setFastcol(BPy_World *self, PyObject *args ); +static PyObject *World_getSkytype(BPy_World *self); +static PyObject *World_setSkytype(BPy_World *self, PyObject *args ); +static PyObject *World_getMode(BPy_World *self); +static PyObject *World_setMode(BPy_World *self, PyObject *args ); +static PyObject *World_getTotex(BPy_World *self); +static PyObject *World_setTotex(BPy_World *self, PyObject *args ); +static PyObject *World_getTexact(BPy_World *self); +static PyObject *World_setTexact(BPy_World *self, PyObject *args ); +static PyObject *World_getMistype(BPy_World *self); +static PyObject *World_setMistype(BPy_World *self, PyObject *args ); +static PyObject *World_getHor(BPy_World *self); +static PyObject *World_setHor(BPy_World *self, PyObject *args ); +static PyObject *World_getZen(BPy_World *self); +static PyObject *World_setZen(BPy_World *self, PyObject *args ); +static PyObject *World_getAmb(BPy_World *self); +static PyObject *World_setAmb(BPy_World *self, PyObject *args ); +static PyObject *World_getStar(BPy_World *self); +static PyObject *World_setStar(BPy_World *self, PyObject *args ); +static PyObject *World_getDof(BPy_World *self); +static PyObject *World_setDof(BPy_World *self, PyObject *args ); +static PyObject *World_getMist(BPy_World *self); +static PyObject *World_setMist(BPy_World *self, PyObject *args ); + +/*****************************************************************************/ +/* Python BPy_World methods table: */ +/*****************************************************************************/ +static PyMethodDef BPy_World_methods[] = { + {"getName", (PyCFunction)World_getName, METH_NOARGS, + "() - Return World Data name"}, + {"setName", (PyCFunction)World_setName, METH_VARARGS, + "() - Return World Data name"}, + {"getColormodel", (PyCFunction)World_getColormodel, METH_NOARGS, + "() - Return World Data colormodel"}, + {"setColormodel", (PyCFunction)World_setColormodel, METH_VARARGS, + "() - Return World Data colormodel"}, + {"getFastcol", (PyCFunction)World_getFastcol, METH_NOARGS, + "() - Return World Data fastcol"}, + {"setFastcol", (PyCFunction)World_setFastcol, METH_VARARGS, + "() - Return World Data fastcol"}, + {"getSkytype", (PyCFunction)World_getSkytype, METH_NOARGS, + "() - Return World Data skytype"}, + {"setSkytype", (PyCFunction)World_setSkytype, METH_VARARGS, + "() - Return World Data skytype"}, + {"getMode", (PyCFunction)World_getMode, METH_NOARGS, + "() - Return World Data mode"}, + {"setMode", (PyCFunction)World_setMode, METH_VARARGS, + "() - Return World Data mode"}, + {"getTotex", (PyCFunction)World_getTotex, METH_NOARGS, + "() - Return World Data totex"}, + {"setTotex", (PyCFunction)World_setTotex, METH_VARARGS, + "() - Return World Data totex"}, + {"getTexact", (PyCFunction)World_getTexact, METH_NOARGS, + "() - Return World Data texact"}, + {"setTexact", (PyCFunction)World_setTexact, METH_VARARGS, + "() - Return World Data texact"}, + {"getMistype", (PyCFunction)World_getMistype, METH_NOARGS, + "() - Return World Data mistype"}, + {"setMistype", (PyCFunction)World_setMistype, METH_VARARGS, + "() - Return World Data mistype"}, + {"getHor", (PyCFunction)World_getHor, METH_NOARGS, + "() - Return World Data hor"}, + {"setHor", (PyCFunction)World_setHor, METH_VARARGS, + "() - Return World Data hor"}, + {"getZen", (PyCFunction)World_getZen, METH_NOARGS, + "() - Return World Data zen"}, + {"setZen", (PyCFunction)World_setZen, METH_VARARGS, + "() - Return World Data zen"}, + {"getAmb", (PyCFunction)World_getAmb, METH_NOARGS, + "() - Return World Data amb"}, + {"setAmb", (PyCFunction)World_setAmb, METH_VARARGS, + "() - Return World Data amb"}, + {"getStar", (PyCFunction)World_getStar, METH_NOARGS, + "() - Return World Data star"}, + {"setStar", (PyCFunction)World_setStar, METH_VARARGS, + "() - Return World Data star"}, + {"getDof", (PyCFunction)World_getDof, METH_NOARGS, + "() - Return World Data dof"}, + {"setDof", (PyCFunction)World_setDof, METH_VARARGS, + "() - Return World Data dof"}, + {"getMist", (PyCFunction)World_getMist, METH_NOARGS, + "() - Return World Data mist"}, + {"setMist", (PyCFunction)World_setMist, METH_VARARGS, + "() - Return World Data mist"}, + {0} +}; /*****************************************************************************/ /* Python World_Type helper functions needed by Blender (the Init function) */ diff --git a/source/blender/python/api2_2x/bpy_types.h b/source/blender/python/api2_2x/bpy_types.h index ff8ed8699b7..f8dae9f438b 100644 --- a/source/blender/python/api2_2x/bpy_types.h +++ b/source/blender/python/api2_2x/bpy_types.h @@ -36,6 +36,11 @@ #include #include +#include +#include +#include +#include +#include #include "rgbTuple.h" /* for BPy_rgbTuple */ @@ -68,9 +73,123 @@ typedef struct { PyObject_HEAD Lamp *lamp; BPy_rgbTuple *color; - } BPy_Lamp; /**/ +/*****************************************************************************/ +/* Ipo Data */ +/*****************************************************************************/ +extern PyTypeObject Ipo_Type; + +#define BPy_Ipo_Check(v) ((v)->ob_type == &Ipo_Type) /* for type checking */ + +/* Python BPy_Ipo structure definition */ +typedef struct { + PyObject_HEAD + Ipo *ipo; +} BPy_Ipo; +/**/ + + +/*****************************************************************************/ +/* Metaball Data */ +/*****************************************************************************/ +extern PyTypeObject Metaball_Type; + +#define BPy_Metaball_Check(v) ((v)->ob_type==&Metaball_Type) + +/* Python BPy_Metaball structure definition */ +typedef struct { + PyObject_HEAD + MetaBall *metaball; +} BPy_Metaball; +/**/ + + +/*****************************************************************************/ +/* Effect Data */ +/*****************************************************************************/ +extern PyTypeObject Effect_Type; + +#define BPy_Effect_Check(v) ((v)->ob_type==&Effect_Type) + +/* Python BPy_Effect structure definition */ +typedef struct { + PyObject_HEAD + Effect *effect; +} BPy_Effect; +/**/ + +/*****************************************************************************/ +/* Wave Data */ +/*****************************************************************************/ +extern PyTypeObject Wave_Type; + +#define BPy_Wave_Check(v) ((v)->ob_type==&Wave_Type) + +/* Python BPy_Wave structure definition */ +typedef struct { + PyObject_HEAD + Effect *wave; +} BPy_Wave; +/**/ + +/*****************************************************************************/ +/* Build Data */ +/*****************************************************************************/ +extern PyTypeObject Build_Type; + +#define BPy_Build_Check(v) ((v)->ob_type==&Build_Type) + +/* Python BPy_Build structure definition */ +typedef struct { + PyObject_HEAD + Effect *build; +} BPy_Build; +/**/ + +/*****************************************************************************/ +/* Particle Data */ +/*****************************************************************************/ +extern PyTypeObject Particle_Type; + +#define BPy_Particle_Check(v) ((v)->ob_type==&Particle_Type) + +/* Python BPy_Particle structure definition */ +typedef struct { + PyObject_HEAD + Effect *particle; +} BPy_Particle; +/**/ + +/*****************************************************************************/ +/* Curve Data */ +/*****************************************************************************/ +extern PyTypeObject Curve_Type; + +#define BPy_Curve_Check(v) ((v)->ob_type==&Curve_Type) + +/* Python BPy_Curve structure definition */ +typedef struct { + PyObject_HEAD + Curve *curve; +} BPy_Curve; +/**/ + +/*****************************************************************************/ +/* World Data */ +/*****************************************************************************/ +extern PyTypeObject World_Type; + +#define BPy_World_Check(v) ((v)->ob_type==&World_Type) + +/* Python BPy_World structure definition */ +typedef struct { + PyObject_HEAD + World *world; +} BPy_World; +/**/ + + #endif /* EXPP_bpy_types_h */