diff options
author | Stephen Swaney <sswaney@centurytel.net> | 2004-10-07 23:25:40 +0400 |
---|---|---|
committer | Stephen Swaney <sswaney@centurytel.net> | 2004-10-07 23:25:40 +0400 |
commit | 0fdc0ce297be5a9621e41eba6e785a1d9c9287e4 (patch) | |
tree | 88eadd40613bf72f2cbe1b8bfbd5a1418b627a1a /source/blender/python/api2_2x | |
parent | 14ae3362c5dce229e84ca9331879d99d44a13a50 (diff) |
Another step in the Big Bpy Cleanup.
- move static declarations and data definitions out of headers.
the BGL module still need cleaning.
- move declarations out of modules.h and into appropriate .h files.
modules.h still exists as a container for the few modules that
need to #include almost everything.
- all files now have a $Id tag and have been formatted by indent
there are no changes to executable code.
pre-commit versions are tagged with bpy-cleanup-pre-20041007
for the sake of paranoia.
Diffstat (limited to 'source/blender/python/api2_2x')
61 files changed, 1175 insertions, 1081 deletions
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c index 29875d3644e..a1c0e5eea9a 100644 --- a/source/blender/python/api2_2x/Armature.c +++ b/source/blender/python/api2_2x/Armature.c @@ -44,7 +44,6 @@ #include <BLI_arithb.h> #include "constant.h" #include "gen_utils.h" -#include "modules.h" #include "Types.h" //---------------- Python API function prototypes for the Armature module--- diff --git a/source/blender/python/api2_2x/Armature.h b/source/blender/python/api2_2x/Armature.h index c96736b4c5e..4787c00921e 100644 --- a/source/blender/python/api2_2x/Armature.h +++ b/source/blender/python/api2_2x/Armature.h @@ -42,6 +42,11 @@ typedef struct { } BPy_Armature; //--------------------visible prototypes------------------------------ + PyObject *Armature_Init( void ); +PyObject *Armature_CreatePyObject( bArmature * armature ); +bArmature *Armature_FromPyObject( PyObject * py_obj ); +int Armature_CheckPyObject( PyObject * py_obj ); + #endif /* EXPP_ARMATURE_H */ diff --git a/source/blender/python/api2_2x/BGL.c b/source/blender/python/api2_2x/BGL.c index 31f54902419..32007267d67 100644 --- a/source/blender/python/api2_2x/BGL.c +++ b/source/blender/python/api2_2x/BGL.c @@ -37,6 +37,7 @@ #include "BGL.h" + static int type_size(int type) { switch (type) { diff --git a/source/blender/python/api2_2x/BGL.h b/source/blender/python/api2_2x/BGL.h index c5b2d9df85c..7a09925f2b4 100644 --- a/source/blender/python/api2_2x/BGL.h +++ b/source/blender/python/api2_2x/BGL.h @@ -66,7 +66,6 @@ #include "Python.h" #include "gen_utils.h" -#include "modules.h" /*@ Buffer Object */ /*@ For Python access to OpenGL functions requiring a pointer. */ diff --git a/source/blender/python/api2_2x/BezTriple.c b/source/blender/python/api2_2x/BezTriple.c index 23cd7d50d22..a6a020b0537 100644 --- a/source/blender/python/api2_2x/BezTriple.c +++ b/source/blender/python/api2_2x/BezTriple.c @@ -42,7 +42,7 @@ #include "constant.h" #include "gen_utils.h" -#include "modules.h" + /*****************************************************************************/ /* Python API function prototypes for the BezTriple module. */ diff --git a/source/blender/python/api2_2x/BezTriple.h b/source/blender/python/api2_2x/BezTriple.h index e4795b4ff07..f865fa73646 100644 --- a/source/blender/python/api2_2x/BezTriple.h +++ b/source/blender/python/api2_2x/BezTriple.h @@ -45,5 +45,12 @@ typedef struct { BezTriple * beztriple; } C_BezTriple; +/* + * prototypes + */ + +PyObject *BezTriple_CreatePyObject( BezTriple * bzt ); +int BezTriple_CheckPyObject( PyObject * pyobj ); +BezTriple *BezTriple_FromPyObject( PyObject * pyobj ); #endif /* EXPP_BEZTRIPLE_H */ diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 9e0c513f8b1..d9b4151388d 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -60,12 +60,12 @@ #include <BKE_ipo.h> #include <blendef.h> + + #include "gen_utils.h" #include "modules.h" #include "../BPY_extern.h" /* for bpy_gethome() */ -/* From Window.h, used here by Blender_Redraw */ -PyObject *M_Window_Redraw( PyObject * self, PyObject * args ); /**********************************************************/ /* Python API function prototypes for the Blender module. */ diff --git a/source/blender/python/api2_2x/Blender.h b/source/blender/python/api2_2x/Blender.h index af7fa7c1056..52e447834c3 100644 --- a/source/blender/python/api2_2x/Blender.h +++ b/source/blender/python/api2_2x/Blender.h @@ -32,4 +32,8 @@ #ifndef EXPP_BLENDER_H #define EXPP_BLENDER_H + +extern PyObject *g_blenderdict; +void M_Blender_Init( void ); + #endif /* EXPP_BLENDER_H */ diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c index 0367fa99a65..ddca513c1aa 100644 --- a/source/blender/python/api2_2x/Bone.c +++ b/source/blender/python/api2_2x/Bone.c @@ -40,6 +40,7 @@ #include <BLI_blenlib.h> #include <DNA_action_types.h> #include <DNA_armature_types.h> +#include <DNA_ipo_types.h> #include <BIF_poseobject.h> #include <BKE_action.h> #include <BSE_editaction.h> @@ -47,7 +48,6 @@ #include <MEM_guardedalloc.h> #include "constant.h" #include "gen_utils.h" -#include "modules.h" #include "NLA.h" #include "quat.h" #include "matrix.h" diff --git a/source/blender/python/api2_2x/Build.h b/source/blender/python/api2_2x/Build.h index d98155d7269..cd0f99d61a3 100644 --- a/source/blender/python/api2_2x/Build.h +++ b/source/blender/python/api2_2x/Build.h @@ -34,14 +34,20 @@ #define EXPP_BUILD_H #include <Python.h> +#include <DNA_effect_types.h> +#include "Effect.h" +extern PyTypeObject Build_Type; -#include <DNA_effect_types.h> +#define BPy_Build_Check(v) ((v)->ob_type==&Build_Type) +/* Python BPy_Build structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + Effect * build; +} BPy_Build; -#include "bpy_types.h" -#include "Effect.h" /*****************************************************************************/ /* Python API function prototypes for the Build module. */ diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c index 69e0152cb4c..b0a3ebc76d9 100644 --- a/source/blender/python/api2_2x/Camera.c +++ b/source/blender/python/api2_2x/Camera.c @@ -37,12 +37,12 @@ #include <BLI_blenlib.h> #include <Python.h> -#include <DNA_camera_types.h> + #include "constant.h" #include "gen_utils.h" -#include "modules.h" #include "Camera.h" +#include "Ipo.h" /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Camera.h b/source/blender/python/api2_2x/Camera.h index 4d69017122f..81457e12878 100644 --- a/source/blender/python/api2_2x/Camera.h +++ b/source/blender/python/api2_2x/Camera.h @@ -33,7 +33,20 @@ #ifndef EXPP_CAMERA_H #define EXPP_CAMERA_H -#include "bpy_types.h" /* where the BPy_Camera struct is declared */ +#include <Python.h> +#include <DNA_camera_types.h> + +extern PyTypeObject Camera_Type; + +#define BPy_Camera_Check(v) \ + ((v)->ob_type == &Camera_Type) /* for type checking */ + +/* Python BPy_Camera structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + Camera * camera; + +} BPy_Camera; /*****************************************************************************/ /* Python BPy_Camera defaults: */ @@ -60,6 +73,9 @@ #define EXPP_CAM_DRAWSIZE_MIN 0.1 #define EXPP_CAM_DRAWSIZE_MAX 10.0 - +PyObject *Camera_Init( void ); +PyObject *Camera_CreatePyObject( Camera * cam ); +int Camera_CheckPyObject( PyObject * pyobj ); +Camera *Camera_FromPyObject( PyObject * pyobj ); #endif /* EXPP_CAMERA_H */ diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c index d49c6121190..e04204be07f 100644 --- a/source/blender/python/api2_2x/CurNurb.c +++ b/source/blender/python/api2_2x/CurNurb.c @@ -33,10 +33,10 @@ #include "DNA_curve_types.h" #include "BKE_curve.h" #include "MEM_guardedalloc.h" -#include "bpy_types.h" -#include "modules.h" + #include "gen_utils.h" #include "CurNurb.h" +#include "BezTriple.h" /*------------------------------------------------------------- @@ -675,7 +675,7 @@ PyObject *CurNurb_Init( void ) { PyObject *submodule; - Curve_Type.ob_type = &PyType_Type; + CurNurb_Type.ob_type = &PyType_Type; submodule = Py_InitModule3( "Blender.CurNurb", M_CurNurb_methods, diff --git a/source/blender/python/api2_2x/CurNurb.h b/source/blender/python/api2_2x/CurNurb.h index f0a90f28888..437069982a9 100644 --- a/source/blender/python/api2_2x/CurNurb.h +++ b/source/blender/python/api2_2x/CurNurb.h @@ -32,6 +32,35 @@ #ifndef EXPP_NURB_H #define EXPP_NURB_H +#include <DNA_curve_types.h> + +extern PyTypeObject CurNurb_Type; + +#define BPy_CurNurb_Check(v) ((v)->ob_type == &CurNurb_Type) /* for type checking */ + +/* Python BPy_CurNurb structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + Nurb * nurb; /* pointer to Blender data */ + + /* iterator stuff */ + /* internal ptrs to point data. do not free */ + BPoint *bp; + BezTriple *bezt; + int atEnd; /* iter exhausted flag */ + int nextPoint; + +} BPy_CurNurb; + + +/* + * prototypes + */ + +PyObject *CurNurb_Init( void ); +PyObject *CurNurb_CreatePyObject( Nurb * bzt ); +int CurNurb_CheckPyObject( PyObject * pyobj ); +Nurb *CurNurb_FromPyObject( PyObject * pyobj ); PyObject *CurNurb_getPoint( BPy_CurNurb * self, int index ); PyObject *CurNurb_pointAtIndex( Nurb * nurb, int index ); diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index 36370ec6077..2f19ffb261a 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -36,15 +36,18 @@ #include <BLI_arithb.h> #include <BLI_blenlib.h> #include <BKE_main.h> +#include <BKE_displist.h> #include <BKE_global.h> #include <BKE_object.h> #include <BKE_library.h> #include <BKE_curve.h> #include <BKE_utildefines.h> #include <MEM_guardedalloc.h> /* because we wil be mallocing memory */ + #include "CurNurb.h" +#include "Material.h" #include "gen_utils.h" -#include "modules.h" + /*****************************************************************************/ /* The following string definitions are used for documentation strings. */ @@ -1156,7 +1159,8 @@ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * args ) static PyObject *Curve_update( BPy_Curve * self ) { - update_displists( ( void * ) self->curve ); +/* update_displists( ( void * ) self->curve ); */ + freedisplist( &self->curve->disp ); Py_INCREF( Py_None ); return Py_None; @@ -1451,12 +1455,16 @@ struct Curve *Curve_FromPyObject( PyObject * py_obj ) /* + * NOTE: this func has been replaced by freedisplist() in the recent + * display list refactoring. + * * walk across all objects looking for curves * so we can update their ob's disp list */ void update_displists( void *data ) { +#if 0 Base *base; Object *ob; unsigned int layer; @@ -1492,4 +1500,6 @@ void update_displists( void *data ) else base = base->next; } +#endif } + diff --git a/source/blender/python/api2_2x/Curve.h b/source/blender/python/api2_2x/Curve.h index ab5e1961b25..206165e88bb 100644 --- a/source/blender/python/api2_2x/Curve.h +++ b/source/blender/python/api2_2x/Curve.h @@ -33,6 +33,28 @@ #ifndef EXPP_CURVE_H #define EXPP_CURVE_H -#include "bpy_types.h" +#include <DNA_curve_types.h> + +extern PyTypeObject Curve_Type; + +#define BPy_Curve_Check(v) ((v)->ob_type==&Curve_Type) + +/* Python BPy_Curve structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + Curve * curve; + /* pointer for iterator: does not point to owned memory */ + Nurb *iter_pointer; +} BPy_Curve; + + +/* + * protoypes + */ + +PyObject *Curve_Init( void ); +PyObject *Curve_CreatePyObject( struct Curve * curve ); +int Curve_CheckPyObject( PyObject * py_obj ); +struct Curve *Curve_FromPyObject( PyObject * py_obj ); #endif /* EXPP_CURVE_H */ diff --git a/source/blender/python/api2_2x/Draw.h b/source/blender/python/api2_2x/Draw.h index 7ec1c886849..9f1d7eb19fe 100644 --- a/source/blender/python/api2_2x/Draw.h +++ b/source/blender/python/api2_2x/Draw.h @@ -38,15 +38,12 @@ #define EXPP_DRAW_H_ #include "DNA_space_types.h" +#include "DNA_text_types.h" #include "Python.h" #include "gen_utils.h" -#include "modules.h" - -/* From Window.h, used here by py_slider_update() */ -PyObject *M_Window_Redraw( PyObject * self, PyObject * args ); - +#include "Window.h" void initDraw( void ); @@ -76,5 +73,6 @@ void BPY_spacescript_do_pywin_event( SpaceScript * sc, void BPY_free_compiled_text( Text * text ); PyObject *M_Draw_Init( void ); +PyObject *Draw_Init( void ); #endif /* EXPP_DRAW_H */ diff --git a/source/blender/python/api2_2x/EXPP_interface.c b/source/blender/python/api2_2x/EXPP_interface.c index 6c836ab9eac..2a03936c3f7 100644 --- a/source/blender/python/api2_2x/EXPP_interface.c +++ b/source/blender/python/api2_2x/EXPP_interface.c @@ -39,8 +39,10 @@ #include <BKE_main.h> #include "EXPP_interface.h" +#include "Blender.h" +#include "Registry.h" #include "gen_utils.h" -#include "modules.h" + void initBlenderApi2_2x( void ) { diff --git a/source/blender/python/api2_2x/Effect.h b/source/blender/python/api2_2x/Effect.h index 9546acdbfd3..0d56ea391a8 100644 --- a/source/blender/python/api2_2x/Effect.h +++ b/source/blender/python/api2_2x/Effect.h @@ -44,8 +44,20 @@ #include <BKE_library.h> #include <BKE_effect.h> +#include <DNA_effect_types.h> + #include"gen_utils.h" -#include "bpy_types.h" + +extern PyTypeObject Effect_Type; + +#define BPy_Effect_Check(v) ((v)->ob_type==&Effect_Type) + +/* Python BPy_Effect structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + Effect * effect; +} BPy_Effect; + /*****************************************************************************/ /* Python API function prototypes for the Effect module. */ @@ -64,6 +76,8 @@ PyObject *M_Effect_Get( PyObject * self, PyObject * args ); /*****************************************************************************/ /* Python Effect_Type callback function prototypes: */ /*****************************************************************************/ + +PyObject *Effect_Init( void ); void EffectDeAlloc( BPy_Effect * msh ); //int EffectPrint (BPy_Effect *msh, FILE *fp, int flags); int EffectSetAttr( BPy_Effect * msh, char *name, PyObject * v ); diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c index 4a5b245e352..b155e2a12e3 100644 --- a/source/blender/python/api2_2x/Ipo.c +++ b/source/blender/python/api2_2x/Ipo.c @@ -39,9 +39,12 @@ #include <BSE_editipo.h> #include <BLI_blenlib.h> +#include <DNA_curve_types.h> + +#include "Ipocurve.h" #include "constant.h" #include "gen_utils.h" -#include "modules.h" + /* forward declarations */ diff --git a/source/blender/python/api2_2x/Ipo.h b/source/blender/python/api2_2x/Ipo.h index 3974df722f0..07e3c8f546f 100644 --- a/source/blender/python/api2_2x/Ipo.h +++ b/source/blender/python/api2_2x/Ipo.h @@ -44,5 +44,19 @@ typedef struct { Ipo * ipo; } BPy_Ipo; +extern PyTypeObject Ipo_Type; + +#define BPy_Ipo_Check(v) ((v)->ob_type == &Ipo_Type) /* for type checking */ + + +/* + * prototypes + */ + +PyObject *Ipo_Init( void ); +PyObject *Ipo_CreatePyObject( struct Ipo *ipo ); +Ipo *Ipo_FromPyObject( PyObject * py_obj ); +int Ipo_CheckPyObject( PyObject * py_obj ); + #endif /* EXPP_IPO_H */ diff --git a/source/blender/python/api2_2x/Ipocurve.c b/source/blender/python/api2_2x/Ipocurve.c index 6a9cc243c39..9a50345fb39 100644 --- a/source/blender/python/api2_2x/Ipocurve.c +++ b/source/blender/python/api2_2x/Ipocurve.c @@ -40,9 +40,11 @@ #include <BLI_blenlib.h> #include <BSE_editipo.h> +#include <DNA_ipo_types.h> + #include "constant.h" #include "gen_utils.h" -#include "modules.h" +#include "BezTriple.h" /*****************************************************************************/ /* Python API function prototypes for the IpoCurve module. */ diff --git a/source/blender/python/api2_2x/Ipocurve.h b/source/blender/python/api2_2x/Ipocurve.h index 4cac8796277..fcfb5fcb551 100644 --- a/source/blender/python/api2_2x/Ipocurve.h +++ b/source/blender/python/api2_2x/Ipocurve.h @@ -45,4 +45,12 @@ typedef struct { } C_IpoCurve; + +PyObject *IpoCurve_Init( void ); +PyObject *IpoCurve_CreatePyObject( IpoCurve * ipo ); +int IpoCurve_CheckPyObject( PyObject * pyobj ); +IpoCurve *IpoCurve_FromPyObject( PyObject * pyobj ); + + + #endif /* EXPP_IPOCURVE_H */ diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index dc4e6f17159..3a8888b7e9f 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -29,7 +29,7 @@ * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ -#include <Python.h> + #include <stdio.h> #include <BKE_main.h> @@ -37,13 +37,15 @@ #include <BKE_object.h> #include <BKE_library.h> #include <BLI_blenlib.h> -#include <DNA_lamp_types.h> + +#include "Lamp.h" +#include "Ipo.h" #include "constant.h" #include "rgbTuple.h" #include "gen_utils.h" -#include "modules.h" -#include "bpy_types.h" /* for the BPy_Lamp declaration */ + + /*****************************************************************************/ /* Python BPy_Lamp defaults: */ diff --git a/source/blender/python/api2_2x/Lamp.h b/source/blender/python/api2_2x/Lamp.h index d1cc0b33262..fac10ad4fc3 100644 --- a/source/blender/python/api2_2x/Lamp.h +++ b/source/blender/python/api2_2x/Lamp.h @@ -33,4 +33,31 @@ #ifndef EXPP_LAMP_H #define EXPP_LAMP_H +#include <Python.h> +#include <DNA_lamp_types.h> +#include "rgbTuple.h" + +extern PyTypeObject Lamp_Type; + +#define BPy_Lamp_Check(v) \ + ((v)->ob_type == &Lamp_Type) /* for type checking */ + +/* Python BPy_Lamp structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + Lamp * lamp; + BPy_rgbTuple *color; +} BPy_Lamp; + + +/* + * prototypes + */ + +PyObject *Lamp_Init( void ); +PyObject *Lamp_CreatePyObject( struct Lamp *lamp ); +Lamp *Lamp_FromPyObject( PyObject * pyobj ); +int Lamp_CheckPyObject( PyObject * pyobj ); +Lamp *GetLampByName( char *name ); + #endif /* EXPP_LAMP_H */ diff --git a/source/blender/python/api2_2x/Lattice.c b/source/blender/python/api2_2x/Lattice.c index d2b3bc84115..e10755f28ec 100644 --- a/source/blender/python/api2_2x/Lattice.c +++ b/source/blender/python/api2_2x/Lattice.c @@ -32,6 +32,182 @@ #include "Lattice.h" + +#include <BKE_main.h> +#include <BKE_global.h> +#include <BKE_library.h> +#include <BKE_lattice.h> +#include <BKE_utildefines.h> +#include <BKE_key.h> +#include <BLI_blenlib.h> + +#include <DNA_key_types.h> +#include <DNA_curve_types.h> +#include <DNA_scene_types.h> +#include <BIF_editlattice.h> +#include <BIF_editkey.h> +#include "blendef.h" +#include "mydevice.h" +#include "constant.h" +#include "gen_utils.h" + + +/*****************************************************************************/ +/* Python API function prototypes for the Lattice module. */ +/*****************************************************************************/ +static PyObject *M_Lattice_New( PyObject * self, PyObject * args ); +static PyObject *M_Lattice_Get( PyObject * self, PyObject * args ); + +/*****************************************************************************/ +/* Lattice Module strings */ +/* The following string definitions are used for documentation strings. */ +/* In Python these will be written to the console when doing a */ +/* Blender.Lattice.__doc__ */ +/*****************************************************************************/ +static char M_Lattice_doc[] = "The Blender Lattice module\n\n"; + +static char M_Lattice_New_doc[] = "() - return a new Lattice object"; + +static char M_Lattice_Get_doc[] = "() - geta a Lattice from blender"; + +/*****************************************************************************/ +/* Python method structure definition for Blender.Lattice module: */ +/*****************************************************************************/ +struct PyMethodDef M_Lattice_methods[] = { + {"New", ( PyCFunction ) M_Lattice_New, METH_VARARGS, + M_Lattice_New_doc}, + {"Get", ( PyCFunction ) M_Lattice_Get, METH_VARARGS, + M_Lattice_Get_doc}, + {NULL, NULL, 0, NULL} +}; + + + +/*****************************************************************************/ +/* Python BPy_Lattice methods declarations: */ +/*****************************************************************************/ +static PyObject *Lattice_getName( BPy_Lattice * self ); +static PyObject *Lattice_setName( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_setPartitions( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_getPartitions( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_setKeyTypes( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_getKeyTypes( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_setMode( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_getMode( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_setPoint( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_getPoint( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_applyDeform( BPy_Lattice * self ); +static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args ); + +/*****************************************************************************/ +/* Lattice Strings */ +/* The following string definitions are used for documentation strings. */ +/* In Python these will be written to the console when doing a */ +/* Blender.Lattice.__doc__ */ +/*****************************************************************************/ +static char Lattice_getName_doc[] = "() - Return Lattice Object name"; + +static char Lattice_setName_doc[] = "(str) - Change Lattice Object name"; + +static char Lattice_setPartitions_doc[] = + "(str) - Set the number of Partitions in x,y,z"; + +static char Lattice_getPartitions_doc[] = + "(str) - Get the number of Partitions in x,y,z"; + +static char Lattice_setKeyTypes_doc[] = + "(str) - Set the key types for x,y,z dimensions"; + +static char Lattice_getKeyTypes_doc[] = + "(str) - Get the key types for x,y,z dimensions"; + +static char Lattice_setMode_doc[] = "(str) - Make an outside or grid lattice"; + +static char Lattice_getMode_doc[] = "(str) - Get lattice mode type"; + +static char Lattice_setPoint_doc[] = + "(str) - Set the coordinates of a point on the lattice"; + +static char Lattice_getPoint_doc[] = + "(str) - Get the coordinates of a point on the lattice"; + +static char Lattice_applyDeform_doc[] = + "(str) - Apply the new lattice deformation to children"; + +static char Lattice_insertKey_doc[] = + "(str) - Set a new key for the lattice at specified frame"; + +/*****************************************************************************/ +/* Python BPy_Lattice methods table: */ +/*****************************************************************************/ +static PyMethodDef BPy_Lattice_methods[] = { + /* name, method, flags, doc */ + {"getName", ( PyCFunction ) Lattice_getName, METH_NOARGS, + Lattice_getName_doc}, + {"setName", ( PyCFunction ) Lattice_setName, METH_VARARGS, + Lattice_setName_doc}, + {"setPartitions", ( PyCFunction ) Lattice_setPartitions, METH_VARARGS, + Lattice_setPartitions_doc}, + {"getPartitions", ( PyCFunction ) Lattice_getPartitions, METH_NOARGS, + Lattice_getPartitions_doc}, + {"setKeyTypes", ( PyCFunction ) Lattice_setKeyTypes, METH_VARARGS, + Lattice_setKeyTypes_doc}, + {"getKeyTypes", ( PyCFunction ) Lattice_getKeyTypes, METH_NOARGS, + Lattice_getKeyTypes_doc}, + {"setMode", ( PyCFunction ) Lattice_setMode, METH_VARARGS, + Lattice_setMode_doc}, + {"getMode", ( PyCFunction ) Lattice_getMode, METH_NOARGS, + Lattice_getMode_doc}, + {"setPoint", ( PyCFunction ) Lattice_setPoint, METH_VARARGS, + Lattice_setPoint_doc}, + {"getPoint", ( PyCFunction ) Lattice_getPoint, METH_VARARGS, + Lattice_getPoint_doc}, + {"applyDeform", ( PyCFunction ) Lattice_applyDeform, METH_NOARGS, + Lattice_applyDeform_doc}, + {"insertKey", ( PyCFunction ) Lattice_insertKey, METH_VARARGS, + Lattice_insertKey_doc}, + {NULL, NULL, 0, NULL} +}; + +/*****************************************************************************/ +/* Python Lattice_Type callback function prototypes: */ +/*****************************************************************************/ +static void Lattice_dealloc( BPy_Lattice * self ); +static int Lattice_setAttr( BPy_Lattice * self, char *name, PyObject * v ); +static PyObject *Lattice_getAttr( BPy_Lattice * self, char *name ); +static PyObject *Lattice_repr( BPy_Lattice * self ); + +/*****************************************************************************/ +/* Python Lattice_Type structure definition: */ +/*****************************************************************************/ +PyTypeObject Lattice_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "Blender Lattice", /* tp_name */ + sizeof( BPy_Lattice ), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + ( destructor ) Lattice_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + ( getattrfunc ) Lattice_getAttr, /* tp_getattr */ + ( setattrfunc ) Lattice_setAttr, /* tp_setattr */ + 0, /* tp_compare */ + ( reprfunc ) Lattice_repr, /* 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_Lattice_methods, /* tp_methods */ + 0, /* tp_members */ +}; + +static int Lattice_InLatList( BPy_Lattice * self ); +static int Lattice_IsLinkedToObject( BPy_Lattice * self ); + + //*************************************************************************** // Function: Lattice_CreatePyObject //*************************************************************************** diff --git a/source/blender/python/api2_2x/Lattice.h b/source/blender/python/api2_2x/Lattice.h index a7acc79515d..09ba1b421b6 100644 --- a/source/blender/python/api2_2x/Lattice.h +++ b/source/blender/python/api2_2x/Lattice.h @@ -34,51 +34,9 @@ #define EXPP_Lattice_H #include <Python.h> -#include <BKE_main.h> -#include <BKE_global.h> -#include <BKE_library.h> -#include <BKE_lattice.h> -#include <BKE_utildefines.h> -#include <BKE_key.h> -#include <BLI_blenlib.h> #include <DNA_lattice_types.h> -#include <DNA_key_types.h> -#include <BIF_editlattice.h> -#include <BIF_editkey.h> -#include "blendef.h" -#include "mydevice.h" -#include "constant.h" -#include "gen_utils.h" -#include "modules.h" -/*****************************************************************************/ -/* Python API function prototypes for the Lattice module. */ -/*****************************************************************************/ -static PyObject *M_Lattice_New( PyObject * self, PyObject * args ); -static PyObject *M_Lattice_Get( PyObject * self, PyObject * args ); - -/*****************************************************************************/ -/* Lattice Module strings */ -/* The following string definitions are used for documentation strings. */ -/* In Python these will be written to the console when doing a */ -/* Blender.Lattice.__doc__ */ -/*****************************************************************************/ -static char M_Lattice_doc[] = "The Blender Lattice module\n\n"; - -static char M_Lattice_New_doc[] = "() - return a new Lattice object"; -static char M_Lattice_Get_doc[] = "() - geta a Lattice from blender"; - -/*****************************************************************************/ -/* Python method structure definition for Blender.Lattice module: */ -/*****************************************************************************/ -struct PyMethodDef M_Lattice_methods[] = { - {"New", ( PyCFunction ) M_Lattice_New, METH_VARARGS, - M_Lattice_New_doc}, - {"Get", ( PyCFunction ) M_Lattice_Get, METH_VARARGS, - M_Lattice_Get_doc}, - {NULL, NULL, 0, NULL} -}; /*****************************************************************************/ /* Python BPy_Lattice structure definition: */ @@ -87,128 +45,16 @@ typedef struct { PyObject_HEAD Lattice * Lattice; } BPy_Lattice; -/*****************************************************************************/ -/* Python BPy_Lattice methods declarations: */ -/*****************************************************************************/ -static PyObject *Lattice_getName( BPy_Lattice * self ); -static PyObject *Lattice_setName( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_setPartitions( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_getPartitions( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_setKeyTypes( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_getKeyTypes( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_setMode( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_getMode( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_setPoint( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_getPoint( BPy_Lattice * self, PyObject * args ); -static PyObject *Lattice_applyDeform( BPy_Lattice * self ); -static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args ); - -/*****************************************************************************/ -/* Lattice Strings */ -/* The following string definitions are used for documentation strings. */ -/* In Python these will be written to the console when doing a */ -/* Blender.Lattice.__doc__ */ -/*****************************************************************************/ -static char Lattice_getName_doc[] = "() - Return Lattice Object name"; - -static char Lattice_setName_doc[] = "(str) - Change Lattice Object name"; - -static char Lattice_setPartitions_doc[] = - "(str) - Set the number of Partitions in x,y,z"; -static char Lattice_getPartitions_doc[] = - "(str) - Get the number of Partitions in x,y,z"; -static char Lattice_setKeyTypes_doc[] = - "(str) - Set the key types for x,y,z dimensions"; +/* + * prototypes + */ -static char Lattice_getKeyTypes_doc[] = - "(str) - Get the key types for x,y,z dimensions"; - -static char Lattice_setMode_doc[] = "(str) - Make an outside or grid lattice"; - -static char Lattice_getMode_doc[] = "(str) - Get lattice mode type"; - -static char Lattice_setPoint_doc[] = - "(str) - Set the coordinates of a point on the lattice"; - -static char Lattice_getPoint_doc[] = - "(str) - Get the coordinates of a point on the lattice"; - -static char Lattice_applyDeform_doc[] = - "(str) - Apply the new lattice deformation to children"; - -static char Lattice_insertKey_doc[] = - "(str) - Set a new key for the lattice at specified frame"; - -/*****************************************************************************/ -/* Python BPy_Lattice methods table: */ -/*****************************************************************************/ -static PyMethodDef BPy_Lattice_methods[] = { - /* name, method, flags, doc */ - {"getName", ( PyCFunction ) Lattice_getName, METH_NOARGS, - Lattice_getName_doc}, - {"setName", ( PyCFunction ) Lattice_setName, METH_VARARGS, - Lattice_setName_doc}, - {"setPartitions", ( PyCFunction ) Lattice_setPartitions, METH_VARARGS, - Lattice_setPartitions_doc}, - {"getPartitions", ( PyCFunction ) Lattice_getPartitions, METH_NOARGS, - Lattice_getPartitions_doc}, - {"setKeyTypes", ( PyCFunction ) Lattice_setKeyTypes, METH_VARARGS, - Lattice_setKeyTypes_doc}, - {"getKeyTypes", ( PyCFunction ) Lattice_getKeyTypes, METH_NOARGS, - Lattice_getKeyTypes_doc}, - {"setMode", ( PyCFunction ) Lattice_setMode, METH_VARARGS, - Lattice_setMode_doc}, - {"getMode", ( PyCFunction ) Lattice_getMode, METH_NOARGS, - Lattice_getMode_doc}, - {"setPoint", ( PyCFunction ) Lattice_setPoint, METH_VARARGS, - Lattice_setPoint_doc}, - {"getPoint", ( PyCFunction ) Lattice_getPoint, METH_VARARGS, - Lattice_getPoint_doc}, - {"applyDeform", ( PyCFunction ) Lattice_applyDeform, METH_NOARGS, - Lattice_applyDeform_doc}, - {"insertKey", ( PyCFunction ) Lattice_insertKey, METH_VARARGS, - Lattice_insertKey_doc}, - {NULL, NULL, 0, NULL} -}; - -/*****************************************************************************/ -/* Python Lattice_Type callback function prototypes: */ -/*****************************************************************************/ -static void Lattice_dealloc( BPy_Lattice * self ); -static int Lattice_setAttr( BPy_Lattice * self, char *name, PyObject * v ); -static PyObject *Lattice_getAttr( BPy_Lattice * self, char *name ); -static PyObject *Lattice_repr( BPy_Lattice * self ); - -/*****************************************************************************/ -/* Python Lattice_Type structure definition: */ -/*****************************************************************************/ -PyTypeObject Lattice_Type = { - PyObject_HEAD_INIT( NULL ) - 0, /* ob_size */ - "Blender Lattice", /* tp_name */ - sizeof( BPy_Lattice ), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - ( destructor ) Lattice_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - ( getattrfunc ) Lattice_getAttr, /* tp_getattr */ - ( setattrfunc ) Lattice_setAttr, /* tp_setattr */ - 0, /* tp_compare */ - ( reprfunc ) Lattice_repr, /* 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_Lattice_methods, /* tp_methods */ - 0, /* tp_members */ -}; +PyObject *Lattice_Init( void ); +PyObject *Lattice_CreatePyObject( Lattice * lt ); +Lattice *Lattice_FromPyObject( PyObject * pyobj ); +int Lattice_CheckPyObject( PyObject * pyobj ); -static int Lattice_InLatList( BPy_Lattice * self ); -static int Lattice_IsLinkedToObject( BPy_Lattice * self ); #endif /* EXPP_LATTICE_H */ diff --git a/source/blender/python/api2_2x/Library.c b/source/blender/python/api2_2x/Library.c index 09d7424b708..a8edd6c147b 100644 --- a/source/blender/python/api2_2x/Library.c +++ b/source/blender/python/api2_2x/Library.c @@ -37,6 +37,7 @@ #include <stdio.h> #include <DNA_ID.h> +#include <DNA_curve_types.h> #include <BKE_library.h> /* for all_local */ #include "BKE_displist.h" /* for set_displist_onlyzero */ #include "BKE_font.h" /* for text_to_curve */ @@ -45,7 +46,7 @@ #include <MEM_guardedalloc.h> #include "gen_utils.h" -#include "modules.h" + /** * Global variables. diff --git a/source/blender/python/api2_2x/MTex.c b/source/blender/python/api2_2x/MTex.c index 0e870cd385f..0f1d77cf209 100644 --- a/source/blender/python/api2_2x/MTex.c +++ b/source/blender/python/api2_2x/MTex.c @@ -42,7 +42,6 @@ #include "Texture.h" #include "constant.h" #include "gen_utils.h" -#include "modules.h" /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index 6b0b7f35c42..833bd16a008 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -39,13 +39,12 @@ #include "constant.h" #include "gen_utils.h" -#include "bpy_types.h" -#include "modules.h" #include "MTex.h" #include "Texture.h" #include "Material.h" +#include "Ipo.h" /*****************************************************************************/ /* Python BPy_Material defaults: */ diff --git a/source/blender/python/api2_2x/Material.h b/source/blender/python/api2_2x/Material.h index c9591c42271..58f2862112b 100644 --- a/source/blender/python/api2_2x/Material.h +++ b/source/blender/python/api2_2x/Material.h @@ -57,14 +57,19 @@ extern PyTypeObject Material_Type; /* The Material PyType Object */ /* Module Blender.Material - public functions */ /*****************************************************************************/ PyObject *M_Material_Init( void ); + +PyObject *Material_Init( void ); PyObject *Material_CreatePyObject( Material * mat ); Material *Material_FromPyObject( PyObject * pyobj ); int Material_CheckPyObject( PyObject * pyobj ); -/* Some functions needed by NMesh.c */ +/* Some functions needed by NMesh, Curve and friends */ PyObject *EXPP_PyList_fromMaterialList( Material ** matlist, int len, int all ); Material **EXPP_newMaterialList_fromPyList( PyObject * list ); Material **EXPP_newMaterialList( int len ); +void EXPP_incr_mats_us( Material ** matlist, int len ); +int EXPP_synchronizeMaterialLists( Object * object ); +int EXPP_releaseMaterialList( Material ** matlist, int len ); #endif /* EXPP_MATERIAL_H */ diff --git a/source/blender/python/api2_2x/Mathutils.c b/source/blender/python/api2_2x/Mathutils.c index 5f5664bf706..dc6c6a5194b 100644 --- a/source/blender/python/api2_2x/Mathutils.c +++ b/source/blender/python/api2_2x/Mathutils.c @@ -30,8 +30,184 @@ * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ +#include <Python.h> +#include <BKE_main.h> +#include <BKE_global.h> +#include <BKE_library.h> +#include <BKE_utildefines.h> +#include <BLI_blenlib.h> +#include <BLI_arithb.h> +#include <PIL_time.h> +#include <BLI_rand.h> +#include <math.h> +#include "vector.h" +#include "euler.h" +#include "quat.h" +#include "matrix.h" +#include "blendef.h" +#include "mydevice.h" +#include "constant.h" +#include "gen_utils.h" #include "Mathutils.h" + +/*****************************************************************************/ +// Python API function prototypes for the Mathutils module. +/*****************************************************************************/ +static PyObject *M_Mathutils_Rand( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_Vector( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_CrossVecs( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_DotVecs( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_AngleBetweenVecs( PyObject * self, + PyObject * args ); +static PyObject *M_Mathutils_MidpointVecs( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_VecMultMat( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_ProjectVecs( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_CopyVec( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_Matrix( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_RotationMatrix( PyObject * self, + PyObject * args ); +static PyObject *M_Mathutils_ScaleMatrix( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_OrthoProjectionMatrix( PyObject * self, + PyObject * args ); +static PyObject *M_Mathutils_ShearMatrix( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_TranslationMatrix( PyObject * self, + PyObject * args ); +static PyObject *M_Mathutils_MatMultVec( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_CopyMat( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_Quaternion( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_CrossQuats( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_DotQuats( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_CopyQuat( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_DifferenceQuats( PyObject * self, + PyObject * args ); +static PyObject *M_Mathutils_Slerp( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_Euler( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_CopyEuler( PyObject * self, PyObject * args ); +static PyObject *M_Mathutils_RotateEuler( 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.Mathutils.__doc__ +/* Mathutils Module strings */ +/****************************************************************************/ +static char M_Mathutils_doc[] = "The Blender Mathutils module\n\n"; +static char M_Mathutils_Vector_doc[] = + "() - create a new vector object from a list of floats"; +static char M_Mathutils_Matrix_doc[] = + "() - create a new matrix object from a list of floats"; +static char M_Mathutils_Quaternion_doc[] = + "() - create a quaternion from a list or an axis of rotation and an angle"; +static char M_Mathutils_Euler_doc[] = + "() - create and return a new euler object"; +static char M_Mathutils_Rand_doc[] = "() - return a random number"; +static char M_Mathutils_CrossVecs_doc[] = + "() - returns a vector perpedicular to the 2 vectors crossed"; +static char M_Mathutils_CopyVec_doc[] = "() - create a copy of vector"; +static char M_Mathutils_DotVecs_doc[] = + "() - return the dot product of two vectors"; +static char M_Mathutils_AngleBetweenVecs_doc[] = + "() - returns the angle between two vectors in degrees"; +static char M_Mathutils_MidpointVecs_doc[] = + "() - return the vector to the midpoint between two vectors"; +static char M_Mathutils_MatMultVec_doc[] = + "() - multiplies a matrix by a column vector"; +static char M_Mathutils_VecMultMat_doc[] = + "() - multiplies a row vector by a matrix"; +static char M_Mathutils_ProjectVecs_doc[] = + "() - returns the projection vector from the projection of vecA onto vecB"; +static char M_Mathutils_RotationMatrix_doc[] = + "() - construct a rotation matrix from an angle and axis of rotation"; +static char M_Mathutils_ScaleMatrix_doc[] = + "() - construct a scaling matrix from a scaling factor"; +static char M_Mathutils_OrthoProjectionMatrix_doc[] = + "() - construct a orthographic projection matrix from a selected plane"; +static char M_Mathutils_ShearMatrix_doc[] = + "() - construct a shearing matrix from a plane of shear and a shear factor"; +static char M_Mathutils_CopyMat_doc[] = "() - create a copy of a matrix"; +static char M_Mathutils_TranslationMatrix_doc[] = + "() - create a translation matrix from a vector"; +static char M_Mathutils_CopyQuat_doc[] = "() - copy quatB to quatA"; +static char M_Mathutils_CopyEuler_doc[] = "() - copy eulB to eultA"; +static char M_Mathutils_CrossQuats_doc[] = + "() - return the mutliplication of two quaternions"; +static char M_Mathutils_DotQuats_doc[] = + "() - return the dot product of two quaternions"; +static char M_Mathutils_Slerp_doc[] = + "() - returns the interpolation between two quaternions"; +static char M_Mathutils_DifferenceQuats_doc[] = + "() - return the angular displacment difference between two quats"; +static char M_Mathutils_RotateEuler_doc[] = + "() - rotate euler by an axis and angle"; + + +/****************************************************************************/ +// Python method structure definition for Blender.Mathutils module: +/****************************************************************************/ +struct PyMethodDef M_Mathutils_methods[] = { + {"Rand", ( PyCFunction ) M_Mathutils_Rand, METH_VARARGS, + M_Mathutils_Rand_doc}, + {"Vector", ( PyCFunction ) M_Mathutils_Vector, METH_VARARGS, + M_Mathutils_Vector_doc}, + {"CrossVecs", ( PyCFunction ) M_Mathutils_CrossVecs, METH_VARARGS, + M_Mathutils_CrossVecs_doc}, + {"DotVecs", ( PyCFunction ) M_Mathutils_DotVecs, METH_VARARGS, + M_Mathutils_DotVecs_doc}, + {"AngleBetweenVecs", ( PyCFunction ) M_Mathutils_AngleBetweenVecs, + METH_VARARGS, + M_Mathutils_AngleBetweenVecs_doc}, + {"MidpointVecs", ( PyCFunction ) M_Mathutils_MidpointVecs, + METH_VARARGS, + M_Mathutils_MidpointVecs_doc}, + {"VecMultMat", ( PyCFunction ) M_Mathutils_VecMultMat, METH_VARARGS, + M_Mathutils_VecMultMat_doc}, + {"ProjectVecs", ( PyCFunction ) M_Mathutils_ProjectVecs, METH_VARARGS, + M_Mathutils_ProjectVecs_doc}, + {"CopyVec", ( PyCFunction ) M_Mathutils_CopyVec, METH_VARARGS, + M_Mathutils_CopyVec_doc}, + {"Matrix", ( PyCFunction ) M_Mathutils_Matrix, METH_VARARGS, + M_Mathutils_Matrix_doc}, + {"RotationMatrix", ( PyCFunction ) M_Mathutils_RotationMatrix, + METH_VARARGS, + M_Mathutils_RotationMatrix_doc}, + {"ScaleMatrix", ( PyCFunction ) M_Mathutils_ScaleMatrix, METH_VARARGS, + M_Mathutils_ScaleMatrix_doc}, + {"ShearMatrix", ( PyCFunction ) M_Mathutils_ShearMatrix, METH_VARARGS, + M_Mathutils_ShearMatrix_doc}, + {"TranslationMatrix", ( PyCFunction ) M_Mathutils_TranslationMatrix, + METH_VARARGS, + M_Mathutils_TranslationMatrix_doc}, + {"CopyMat", ( PyCFunction ) M_Mathutils_CopyMat, METH_VARARGS, + M_Mathutils_CopyMat_doc}, + {"OrthoProjectionMatrix", + ( PyCFunction ) M_Mathutils_OrthoProjectionMatrix, METH_VARARGS, + M_Mathutils_OrthoProjectionMatrix_doc}, + {"MatMultVec", ( PyCFunction ) M_Mathutils_MatMultVec, METH_VARARGS, + M_Mathutils_MatMultVec_doc}, + {"Quaternion", ( PyCFunction ) M_Mathutils_Quaternion, METH_VARARGS, + M_Mathutils_Quaternion_doc}, + {"CopyQuat", ( PyCFunction ) M_Mathutils_CopyQuat, METH_VARARGS, + M_Mathutils_CopyQuat_doc}, + {"CrossQuats", ( PyCFunction ) M_Mathutils_CrossQuats, METH_VARARGS, + M_Mathutils_CrossQuats_doc}, + {"DotQuats", ( PyCFunction ) M_Mathutils_DotQuats, METH_VARARGS, + M_Mathutils_DotQuats_doc}, + {"DifferenceQuats", ( PyCFunction ) M_Mathutils_DifferenceQuats, + METH_VARARGS, + M_Mathutils_DifferenceQuats_doc}, + {"Slerp", ( PyCFunction ) M_Mathutils_Slerp, METH_VARARGS, + M_Mathutils_Slerp_doc}, + {"Euler", ( PyCFunction ) M_Mathutils_Euler, METH_VARARGS, + M_Mathutils_Euler_doc}, + {"CopyEuler", ( PyCFunction ) M_Mathutils_CopyEuler, METH_VARARGS, + M_Mathutils_CopyEuler_doc}, + {"RotateEuler", ( PyCFunction ) M_Mathutils_RotateEuler, METH_VARARGS, + M_Mathutils_RotateEuler_doc}, + {NULL, NULL, 0, NULL} +}; + + //*************************************************************************** // Function: M_Mathutils_Rand //*************************************************************************** diff --git a/source/blender/python/api2_2x/Mathutils.h b/source/blender/python/api2_2x/Mathutils.h index 9a0e30b2eaf..7d34187656e 100644 --- a/source/blender/python/api2_2x/Mathutils.h +++ b/source/blender/python/api2_2x/Mathutils.h @@ -1,4 +1,7 @@ -/* * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** +/* + * $Id$ + * + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -30,182 +33,10 @@ #ifndef EXPP_Mathutils_H #define EXPP_Mathutils_H -#include <Python.h> -#include <BKE_main.h> -#include <BKE_global.h> -#include <BKE_library.h> -#include <BKE_utildefines.h> -#include <BLI_blenlib.h> -#include <BLI_arithb.h> -#include <PIL_time.h> -#include <BLI_rand.h> -#include <math.h> -#include "vector.h" -#include "euler.h" -#include "quat.h" -#include "matrix.h" -#include "blendef.h" -#include "mydevice.h" -#include "constant.h" -#include "gen_utils.h" -#include "modules.h" -#include "Types.h" - -/*****************************************************************************/ -// Python API function prototypes for the Mathutils module. -/*****************************************************************************/ -static PyObject *M_Mathutils_Rand( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_Vector( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_CrossVecs( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_DotVecs( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_AngleBetweenVecs( PyObject * self, - PyObject * args ); -static PyObject *M_Mathutils_MidpointVecs( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_VecMultMat( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_ProjectVecs( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_CopyVec( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_Matrix( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_RotationMatrix( PyObject * self, - PyObject * args ); -static PyObject *M_Mathutils_ScaleMatrix( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_OrthoProjectionMatrix( PyObject * self, - PyObject * args ); -static PyObject *M_Mathutils_ShearMatrix( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_TranslationMatrix( PyObject * self, - PyObject * args ); -static PyObject *M_Mathutils_MatMultVec( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_CopyMat( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_Quaternion( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_CrossQuats( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_DotQuats( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_CopyQuat( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_DifferenceQuats( PyObject * self, - PyObject * args ); -static PyObject *M_Mathutils_Slerp( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_Euler( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_CopyEuler( PyObject * self, PyObject * args ); -static PyObject *M_Mathutils_RotateEuler( 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.Mathutils.__doc__ -/* Mathutils Module strings */ -/****************************************************************************/ -static char M_Mathutils_doc[] = "The Blender Mathutils module\n\n"; -static char M_Mathutils_Vector_doc[] = - "() - create a new vector object from a list of floats"; -static char M_Mathutils_Matrix_doc[] = - "() - create a new matrix object from a list of floats"; -static char M_Mathutils_Quaternion_doc[] = - "() - create a quaternion from a list or an axis of rotation and an angle"; -static char M_Mathutils_Euler_doc[] = - "() - create and return a new euler object"; -static char M_Mathutils_Rand_doc[] = "() - return a random number"; -static char M_Mathutils_CrossVecs_doc[] = - "() - returns a vector perpedicular to the 2 vectors crossed"; -static char M_Mathutils_CopyVec_doc[] = "() - create a copy of vector"; -static char M_Mathutils_DotVecs_doc[] = - "() - return the dot product of two vectors"; -static char M_Mathutils_AngleBetweenVecs_doc[] = - "() - returns the angle between two vectors in degrees"; -static char M_Mathutils_MidpointVecs_doc[] = - "() - return the vector to the midpoint between two vectors"; -static char M_Mathutils_MatMultVec_doc[] = - "() - multiplies a matrix by a column vector"; -static char M_Mathutils_VecMultMat_doc[] = - "() - multiplies a row vector by a matrix"; -static char M_Mathutils_ProjectVecs_doc[] = - "() - returns the projection vector from the projection of vecA onto vecB"; -static char M_Mathutils_RotationMatrix_doc[] = - "() - construct a rotation matrix from an angle and axis of rotation"; -static char M_Mathutils_ScaleMatrix_doc[] = - "() - construct a scaling matrix from a scaling factor"; -static char M_Mathutils_OrthoProjectionMatrix_doc[] = - "() - construct a orthographic projection matrix from a selected plane"; -static char M_Mathutils_ShearMatrix_doc[] = - "() - construct a shearing matrix from a plane of shear and a shear factor"; -static char M_Mathutils_CopyMat_doc[] = "() - create a copy of a matrix"; -static char M_Mathutils_TranslationMatrix_doc[] = - "() - create a translation matrix from a vector"; -static char M_Mathutils_CopyQuat_doc[] = "() - copy quatB to quatA"; -static char M_Mathutils_CopyEuler_doc[] = "() - copy eulB to eultA"; -static char M_Mathutils_CrossQuats_doc[] = - "() - return the mutliplication of two quaternions"; -static char M_Mathutils_DotQuats_doc[] = - "() - return the dot product of two quaternions"; -static char M_Mathutils_Slerp_doc[] = - "() - returns the interpolation between two quaternions"; -static char M_Mathutils_DifferenceQuats_doc[] = - "() - return the angular displacment difference between two quats"; -static char M_Mathutils_RotateEuler_doc[] = - "() - rotate euler by an axis and angle"; +#include "Types.h" -/****************************************************************************/ -// Python method structure definition for Blender.Mathutils module: -/****************************************************************************/ -struct PyMethodDef M_Mathutils_methods[] = { - {"Rand", ( PyCFunction ) M_Mathutils_Rand, METH_VARARGS, - M_Mathutils_Rand_doc}, - {"Vector", ( PyCFunction ) M_Mathutils_Vector, METH_VARARGS, - M_Mathutils_Vector_doc}, - {"CrossVecs", ( PyCFunction ) M_Mathutils_CrossVecs, METH_VARARGS, - M_Mathutils_CrossVecs_doc}, - {"DotVecs", ( PyCFunction ) M_Mathutils_DotVecs, METH_VARARGS, - M_Mathutils_DotVecs_doc}, - {"AngleBetweenVecs", ( PyCFunction ) M_Mathutils_AngleBetweenVecs, - METH_VARARGS, - M_Mathutils_AngleBetweenVecs_doc}, - {"MidpointVecs", ( PyCFunction ) M_Mathutils_MidpointVecs, - METH_VARARGS, - M_Mathutils_MidpointVecs_doc}, - {"VecMultMat", ( PyCFunction ) M_Mathutils_VecMultMat, METH_VARARGS, - M_Mathutils_VecMultMat_doc}, - {"ProjectVecs", ( PyCFunction ) M_Mathutils_ProjectVecs, METH_VARARGS, - M_Mathutils_ProjectVecs_doc}, - {"CopyVec", ( PyCFunction ) M_Mathutils_CopyVec, METH_VARARGS, - M_Mathutils_CopyVec_doc}, - {"Matrix", ( PyCFunction ) M_Mathutils_Matrix, METH_VARARGS, - M_Mathutils_Matrix_doc}, - {"RotationMatrix", ( PyCFunction ) M_Mathutils_RotationMatrix, - METH_VARARGS, - M_Mathutils_RotationMatrix_doc}, - {"ScaleMatrix", ( PyCFunction ) M_Mathutils_ScaleMatrix, METH_VARARGS, - M_Mathutils_ScaleMatrix_doc}, - {"ShearMatrix", ( PyCFunction ) M_Mathutils_ShearMatrix, METH_VARARGS, - M_Mathutils_ShearMatrix_doc}, - {"TranslationMatrix", ( PyCFunction ) M_Mathutils_TranslationMatrix, - METH_VARARGS, - M_Mathutils_TranslationMatrix_doc}, - {"CopyMat", ( PyCFunction ) M_Mathutils_CopyMat, METH_VARARGS, - M_Mathutils_CopyMat_doc}, - {"OrthoProjectionMatrix", - ( PyCFunction ) M_Mathutils_OrthoProjectionMatrix, METH_VARARGS, - M_Mathutils_OrthoProjectionMatrix_doc}, - {"MatMultVec", ( PyCFunction ) M_Mathutils_MatMultVec, METH_VARARGS, - M_Mathutils_MatMultVec_doc}, - {"Quaternion", ( PyCFunction ) M_Mathutils_Quaternion, METH_VARARGS, - M_Mathutils_Quaternion_doc}, - {"CopyQuat", ( PyCFunction ) M_Mathutils_CopyQuat, METH_VARARGS, - M_Mathutils_CopyQuat_doc}, - {"CrossQuats", ( PyCFunction ) M_Mathutils_CrossQuats, METH_VARARGS, - M_Mathutils_CrossQuats_doc}, - {"DotQuats", ( PyCFunction ) M_Mathutils_DotQuats, METH_VARARGS, - M_Mathutils_DotQuats_doc}, - {"DifferenceQuats", ( PyCFunction ) M_Mathutils_DifferenceQuats, - METH_VARARGS, - M_Mathutils_DifferenceQuats_doc}, - {"Slerp", ( PyCFunction ) M_Mathutils_Slerp, METH_VARARGS, - M_Mathutils_Slerp_doc}, - {"Euler", ( PyCFunction ) M_Mathutils_Euler, METH_VARARGS, - M_Mathutils_Euler_doc}, - {"CopyEuler", ( PyCFunction ) M_Mathutils_CopyEuler, METH_VARARGS, - M_Mathutils_CopyEuler_doc}, - {"RotateEuler", ( PyCFunction ) M_Mathutils_RotateEuler, METH_VARARGS, - M_Mathutils_RotateEuler_doc}, - {NULL, NULL, 0, NULL} -}; +PyObject *Mathutils_Init( void ); #endif /* EXPP_Mathutils_H */ diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c index 6c55dddfc4d..9a64820cd07 100644 --- a/source/blender/python/api2_2x/Metaball.c +++ b/source/blender/python/api2_2x/Metaball.c @@ -32,10 +32,185 @@ #include "Metaball.h" -PyObject *Metaball_Init( void ); -PyObject *Metaball_CreatePyObject( MetaBall * metaball ); -MetaBall *Metaball_FromPyObject( PyObject * py_obj ); -int Metaball_CheckPyObject( PyObject * py_obj ); +#include <BKE_main.h> +#include <BKE_global.h> +#include <BKE_mball.h> +#include <BKE_object.h> +#include <BKE_library.h> +#include <BLI_blenlib.h> + +#include "constant.h" +#include "gen_utils.h" + + + +/*****************************************************************************/ +/* Python API function prototypes for the Metaball module. */ +/*****************************************************************************/ +static PyObject *M_Metaball_New( PyObject * self, PyObject * args ); +static PyObject *M_Metaball_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.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."; + +static char M_Metaball_New_doc[] = "Creates a new metaball"; + +static char M_Metaball_Get_doc[] = "Retreives an existing metaball"; + +/*****************************************************************************/ +/* Python method structure definition for Blender.Metaball module: */ +/*****************************************************************************/ +struct PyMethodDef M_Metaball_methods[] = { + {"New", M_Metaball_New, METH_VARARGS, M_Metaball_New_doc}, + {"Get", M_Metaball_Get, METH_VARARGS, M_Metaball_Get_doc}, + {"get", M_Metaball_Get, METH_VARARGS, M_Metaball_Get_doc}, + {NULL, NULL, 0, NULL} +}; + + +/*****************************************************************************/ +/* Python BPy_Metaball methods declarations: */ +/*****************************************************************************/ +static PyObject *Metaball_getMetaElemList( BPy_Metaball * self ); +static PyObject *Metaball_addMetaelem( BPy_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 BPy_Metaball methods table: */ +/*****************************************************************************/ +static PyMethodDef BPy_Metaball_methods[] = { + /* name, method, flags, doc */ + {"getName", ( PyCFunction ) Metaball_getName, + METH_NOARGS, "() - Return Metaball name"}, + + {"getMetaElemList", ( PyCFunction ) Metaball_getMetaElemList, + METH_NOARGS, "() - Return Metaelems list"}, + + {"addMetaelem", ( PyCFunction ) Metaball_addMetaelem, + METH_VARARGS, "() -Adds a metaelem to the metaball"}, + {"setName", ( PyCFunction ) Metaball_setName, + METH_VARARGS, "() - Sets Metaball name"}, + {"getWiresize", ( PyCFunction ) Metaball_getWiresize, + METH_NOARGS, "() - Return Metaball wire size"}, + {"setWiresize", ( PyCFunction ) Metaball_setWiresize, + METH_VARARGS, "() - Sets Metaball wire size"}, + {"getRendersize", ( PyCFunction ) Metaball_getRendersize, + METH_NOARGS, "() - Return Metaball render size"}, + {"setRendersize", ( PyCFunction ) Metaball_setRendersize, + METH_VARARGS, "() - Sets Metaball render size"}, + {"getThresh", ( PyCFunction ) Metaball_getThresh, + METH_NOARGS, "() - Return Metaball threshold"}, + {"setThresh", ( PyCFunction ) Metaball_setThresh, + METH_VARARGS, "() - Sets Metaball threshold"}, + {"getBbox", ( PyCFunction ) Metaball_getBbox, + METH_NOARGS, "() - Return Metaball bounding box"}, + {"getNMetaElems", ( PyCFunction ) Metaball_getNMetaElems, + METH_NOARGS, "() Returns the number of Spheres "}, + {"getMetatype", ( PyCFunction ) Metaball_getMetatype, + METH_VARARGS, "() - "}, + {"setMetatype", ( PyCFunction ) Metaball_setMetatype, + METH_VARARGS, "() - "}, + {"getMetadata", ( PyCFunction ) Metaball_getMetadata, + METH_VARARGS, "() - Gets Metaball MetaData "}, + {"setMetadata", ( PyCFunction ) Metaball_setMetadata, + METH_VARARGS, "() - "}, + {"getMetax", ( PyCFunction ) Metaball_getMetax, + METH_VARARGS, "() - gets the x coordinate of the metaelement "}, + {"setMetax", ( PyCFunction ) Metaball_setMetax, + METH_VARARGS, "() -sets the x coordinate of the metaelement "}, + {"getMetay", ( PyCFunction ) Metaball_getMetay, + METH_VARARGS, "() - gets the y coordinate of the metaelement"}, + {"setMetay", ( PyCFunction ) Metaball_setMetay, + METH_VARARGS, "() - sets the y coordinate of the metaelement"}, + {"getMetaz", ( PyCFunction ) Metaball_getMetaz, + METH_VARARGS, "() - gets the z coordinate of the metaelement"}, + {"setMetaz", ( PyCFunction ) Metaball_setMetaz, + METH_VARARGS, "() - sets the z coordinate of the metaelement"}, + {"getMetas", ( PyCFunction ) Metaball_getMetas, + METH_VARARGS, "() - gets the s coordinate of the metaelement"}, + {"setMetas", ( PyCFunction ) Metaball_setMetas, + METH_VARARGS, "() - sets the s coordinate of the metaelement"}, + {"getMetalen", ( PyCFunction ) Metaball_getMetalen, + METH_VARARGS, "() - gets the length of the metaelement."}, + {"setMetalen", ( PyCFunction ) Metaball_setMetalen, + METH_VARARGS, "() - sets the length of the metaelement."}, + {"getloc", ( PyCFunction ) Metaball_getloc, + METH_NOARGS, "() - Gets Metaball loc values"}, + {"setloc", ( PyCFunction ) Metaball_setloc, + METH_VARARGS, "(f f f) - Sets Metaball loc values"}, + {"getrot", ( PyCFunction ) Metaball_getrot, + METH_NOARGS, "() - Gets Metaball rot values"}, + {"setrot", ( PyCFunction ) Metaball_setrot, + METH_VARARGS, "(f f f) - Sets Metaball rot values"}, + {"getsize", ( PyCFunction ) Metaball_getsize, + METH_NOARGS, "() - Gets Metaball size values"}, + {"setsize", ( PyCFunction ) Metaball_setsize, + METH_VARARGS, "(f f f) - Sets Metaball size values"}, + {NULL, NULL, 0, NULL} +}; + +/*****************************************************************************/ +/* Python BPy_Metaelem methods table: */ +/*****************************************************************************/ +static PyMethodDef BPy_Metaelem_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*****************************************************************************/ +/* Python Metaball_Type callback function prototypes: */ +/*****************************************************************************/ +static void MetaballDeAlloc( BPy_Metaball * self ); +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 Metaelem_Type callback function prototypes: */ +/*****************************************************************************/ +static void MetaelemDeAlloc( BPy_Metaelem * self ); +static int MetaelemSetAttr( BPy_Metaelem * self, char *name, PyObject * v ); +static PyObject *MetaelemGetAttr( BPy_Metaelem * self, char *name ); +static PyObject *MetaelemRepr( BPy_Metaelem * self ); + + /*****************************************************************************/ /* Python Metaball_Type structure definition: */ diff --git a/source/blender/python/api2_2x/Metaball.h b/source/blender/python/api2_2x/Metaball.h index 2d91cdc2dd7..b190b53dce3 100644 --- a/source/blender/python/api2_2x/Metaball.h +++ b/source/blender/python/api2_2x/Metaball.h @@ -34,185 +34,38 @@ #define EXPP_METABALL_H #include <Python.h> +#include <DNA_meta_types.h> -#include <BKE_main.h> -#include <BKE_global.h> -#include <BKE_mball.h> -#include <BKE_object.h> -#include <BKE_library.h> -#include <BLI_blenlib.h> -#include "constant.h" -#include "gen_utils.h" -#include "modules.h" -#include "bpy_types.h" +extern PyTypeObject Metaball_Type; +#define BPy_Metaball_Check(v) ((v)->ob_type==&Metaball_Type) -/*****************************************************************************/ -/* Python API function prototypes for the Metaball module. */ -/*****************************************************************************/ -static PyObject *M_Metaball_New( PyObject * self, PyObject * args ); -static PyObject *M_Metaball_Get( PyObject * self, PyObject * args ); +/* Python BPy_Metaball structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + MetaBall * metaball; +} BPy_Metaball; -/*****************************************************************************/ -/* The following string definitions are used for documentation strings. */ -/* In Python these will be written to the console when doing a */ -/* Blender.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."; -static char M_Metaball_New_doc[] = "Creates a new metaball"; +extern PyTypeObject Metaelem_Type; -static char M_Metaball_Get_doc[] = "Retreives an existing metaball"; +#define BPy_Metaelem_Check(v) ((v)->ob_type==&Metaelem_Type) -/*****************************************************************************/ -/* Python method structure definition for Blender.Metaball module: */ -/*****************************************************************************/ -struct PyMethodDef M_Metaball_methods[] = { - {"New", M_Metaball_New, METH_VARARGS, M_Metaball_New_doc}, - {"Get", M_Metaball_Get, METH_VARARGS, M_Metaball_Get_doc}, - {"get", M_Metaball_Get, METH_VARARGS, M_Metaball_Get_doc}, - {NULL, NULL, 0, NULL} -}; +/* Python BPy_Metaelem structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + MetaElem * metaelem; +} BPy_Metaelem; -/*****************************************************************************/ -/* Python BPy_Metaball methods declarations: */ -/*****************************************************************************/ -static PyObject *Metaball_getMetaElemList( BPy_Metaball * self ); -static PyObject *Metaball_addMetaelem( BPy_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 BPy_Metaball methods table: */ -/*****************************************************************************/ -static PyMethodDef BPy_Metaball_methods[] = { - /* name, method, flags, doc */ - {"getName", ( PyCFunction ) Metaball_getName, - METH_NOARGS, "() - Return Metaball name"}, - - {"getMetaElemList", ( PyCFunction ) Metaball_getMetaElemList, - METH_NOARGS, "() - Return Metaelems list"}, - - {"addMetaelem", ( PyCFunction ) Metaball_addMetaelem, - METH_VARARGS, "() -Adds a metaelem to the metaball"}, - {"setName", ( PyCFunction ) Metaball_setName, - METH_VARARGS, "() - Sets Metaball name"}, - {"getWiresize", ( PyCFunction ) Metaball_getWiresize, - METH_NOARGS, "() - Return Metaball wire size"}, - {"setWiresize", ( PyCFunction ) Metaball_setWiresize, - METH_VARARGS, "() - Sets Metaball wire size"}, - {"getRendersize", ( PyCFunction ) Metaball_getRendersize, - METH_NOARGS, "() - Return Metaball render size"}, - {"setRendersize", ( PyCFunction ) Metaball_setRendersize, - METH_VARARGS, "() - Sets Metaball render size"}, - {"getThresh", ( PyCFunction ) Metaball_getThresh, - METH_NOARGS, "() - Return Metaball threshold"}, - {"setThresh", ( PyCFunction ) Metaball_setThresh, - METH_VARARGS, "() - Sets Metaball threshold"}, - {"getBbox", ( PyCFunction ) Metaball_getBbox, - METH_NOARGS, "() - Return Metaball bounding box"}, - {"getNMetaElems", ( PyCFunction ) Metaball_getNMetaElems, - METH_NOARGS, "() Returns the number of Spheres "}, - {"getMetatype", ( PyCFunction ) Metaball_getMetatype, - METH_VARARGS, "() - "}, - {"setMetatype", ( PyCFunction ) Metaball_setMetatype, - METH_VARARGS, "() - "}, - {"getMetadata", ( PyCFunction ) Metaball_getMetadata, - METH_VARARGS, "() - Gets Metaball MetaData "}, - {"setMetadata", ( PyCFunction ) Metaball_setMetadata, - METH_VARARGS, "() - "}, - {"getMetax", ( PyCFunction ) Metaball_getMetax, - METH_VARARGS, "() - gets the x coordinate of the metaelement "}, - {"setMetax", ( PyCFunction ) Metaball_setMetax, - METH_VARARGS, "() -sets the x coordinate of the metaelement "}, - {"getMetay", ( PyCFunction ) Metaball_getMetay, - METH_VARARGS, "() - gets the y coordinate of the metaelement"}, - {"setMetay", ( PyCFunction ) Metaball_setMetay, - METH_VARARGS, "() - sets the y coordinate of the metaelement"}, - {"getMetaz", ( PyCFunction ) Metaball_getMetaz, - METH_VARARGS, "() - gets the z coordinate of the metaelement"}, - {"setMetaz", ( PyCFunction ) Metaball_setMetaz, - METH_VARARGS, "() - sets the z coordinate of the metaelement"}, - {"getMetas", ( PyCFunction ) Metaball_getMetas, - METH_VARARGS, "() - gets the s coordinate of the metaelement"}, - {"setMetas", ( PyCFunction ) Metaball_setMetas, - METH_VARARGS, "() - sets the s coordinate of the metaelement"}, - {"getMetalen", ( PyCFunction ) Metaball_getMetalen, - METH_VARARGS, "() - gets the length of the metaelement."}, - {"setMetalen", ( PyCFunction ) Metaball_setMetalen, - METH_VARARGS, "() - sets the length of the metaelement."}, - {"getloc", ( PyCFunction ) Metaball_getloc, - METH_NOARGS, "() - Gets Metaball loc values"}, - {"setloc", ( PyCFunction ) Metaball_setloc, - METH_VARARGS, "(f f f) - Sets Metaball loc values"}, - {"getrot", ( PyCFunction ) Metaball_getrot, - METH_NOARGS, "() - Gets Metaball rot values"}, - {"setrot", ( PyCFunction ) Metaball_setrot, - METH_VARARGS, "(f f f) - Sets Metaball rot values"}, - {"getsize", ( PyCFunction ) Metaball_getsize, - METH_NOARGS, "() - Gets Metaball size values"}, - {"setsize", ( PyCFunction ) Metaball_setsize, - METH_VARARGS, "(f f f) - Sets Metaball size values"}, - {NULL, NULL, 0, NULL} -}; - -/*****************************************************************************/ -/* Python BPy_Metaelem methods table: */ -/*****************************************************************************/ -static PyMethodDef BPy_Metaelem_methods[] = { - {NULL, NULL, 0, NULL} -}; - -/*****************************************************************************/ -/* Python Metaball_Type callback function prototypes: */ -/*****************************************************************************/ -static void MetaballDeAlloc( BPy_Metaball * self ); -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 Metaelem_Type callback function prototypes: */ -/*****************************************************************************/ -static void MetaelemDeAlloc( BPy_Metaelem * self ); -static int MetaelemSetAttr( BPy_Metaelem * self, char *name, PyObject * v ); -static PyObject *MetaelemGetAttr( BPy_Metaelem * self, char *name ); -static PyObject *MetaelemRepr( BPy_Metaelem * self ); +/* + * prototypes + */ +PyObject *Metaball_Init( void ); +PyObject *Metaball_CreatePyObject( MetaBall * metaball ); +MetaBall *Metaball_FromPyObject( PyObject * py_obj ); +int Metaball_CheckPyObject( PyObject * py_obj ); #endif /* EXPP_METABALL_H */ diff --git a/source/blender/python/api2_2x/NLA.c b/source/blender/python/api2_2x/NLA.c index dce9db31a6e..088d6a5d0c7 100644 --- a/source/blender/python/api2_2x/NLA.c +++ b/source/blender/python/api2_2x/NLA.c @@ -35,6 +35,8 @@ #include <BKE_action.h> #include <BKE_global.h> #include <BKE_main.h> + +#include "Ipo.h" #include "Types.h" /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c index e172c30c394..541638c86e1 100644 --- a/source/blender/python/api2_2x/NMesh.c +++ b/source/blender/python/api2_2x/NMesh.c @@ -33,6 +33,39 @@ #include "NMesh.h" +#include "DNA_key_types.h" +#include "DNA_listBase.h" +#include "DNA_object_types.h" +#include "DNA_material_types.h" +#include "DNA_armature_types.h" +#include "DNA_scene_types.h" + +#include "BDR_editface.h" /* make_tfaces */ +#include "BIF_editdeform.h" +#include "BIF_editkey.h" /* insert_meshkey */ +#include "BIF_editmesh.h" /* vertexnormals_mesh() : still needed???*/ +#include "BIF_meshtools.h" /* current loc of vertexnormals_mesh() */ +#include "BIF_space.h" +#include "BKE_mesh.h" +#include "BKE_main.h" +#include "BKE_global.h" +#include "BKE_library.h" +#include "BKE_displist.h" +#include "BKE_screen.h" +#include "BKE_object.h" +#include "BLI_blenlib.h" +#include "BLI_arithb.h" +#include "MEM_guardedalloc.h" + +#include "blendef.h" +#include "mydevice.h" + +#include "Object.h" +#include "vector.h" +#include "constant.h" +#include "gen_utils.h" + + /* EXPP Mesh defines */ #define EXPP_NMESH_MODE_NOPUNOFLIP ME_NOPUNOFLIP @@ -49,6 +82,21 @@ #define NMESH_SUBDIV_MIN 1 #define NMESH_SUBDIV_MAX 6 +/* Globals */ +static PyObject *g_nmeshmodule = NULL; + +static int unlink_existingMeshData( Mesh * mesh ); +static int convert_NMeshToMesh( Mesh * mesh, BPy_NMesh * nmesh ); +static PyObject *NMesh_addVertGroup( PyObject * self, PyObject * args ); +static PyObject *NMesh_removeVertGroup( PyObject * self, PyObject * args ); +static PyObject *NMesh_assignVertsToGroup( PyObject * self, PyObject * args ); +static PyObject *NMesh_removeVertsFromGroup( PyObject * self, + PyObject * args ); +static PyObject *NMesh_getVertsFromGroup( PyObject * self, PyObject * args ); +static PyObject *NMesh_renameVertGroup( PyObject * self, PyObject * args ); +static PyObject *NMesh_getVertGroupNames( PyObject * self, PyObject * args ); + + static char NMesh_addVertGroup_doc[] = "add a named and empty vertex(deform) Group to a mesh that has been linked\n\ to an object. "; diff --git a/source/blender/python/api2_2x/NMesh.h b/source/blender/python/api2_2x/NMesh.h index 1d9b3386dc8..a9c21ac23b2 100644 --- a/source/blender/python/api2_2x/NMesh.h +++ b/source/blender/python/api2_2x/NMesh.h @@ -43,37 +43,9 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "DNA_key_types.h" -#include "DNA_listBase.h" -#include "DNA_object_types.h" -#include "DNA_material_types.h" -#include "DNA_armature_types.h" - -#include "BDR_editface.h" /* make_tfaces */ -#include "BIF_editdeform.h" -#include "BIF_editkey.h" /* insert_meshkey */ -#include "BIF_editmesh.h" /* vertexnormals_mesh() */ -#include "BIF_space.h" -#include "BKE_mesh.h" -#include "BKE_main.h" -#include "BKE_global.h" -#include "BKE_library.h" -#include "BKE_displist.h" -#include "BKE_screen.h" -#include "BKE_object.h" -#include "BLI_blenlib.h" -#include "BLI_arithb.h" -#include "MEM_guardedalloc.h" - -#include "blendef.h" -#include "mydevice.h" #include "Material.h" #include "Image.h" -#include "vector.h" -#include "constant.h" -#include "gen_utils.h" -#include "modules.h" /* EXPP PyType Objects */ PyTypeObject NMesh_Type; @@ -81,19 +53,18 @@ PyTypeObject NMFace_Type; PyTypeObject NMVert_Type; PyTypeObject NMCol_Type; -extern PyTypeObject Image_Type; struct BPy_Object; /* These are from blender/src/editdeform.c, should be declared elsewhere, * maybe in BIF_editdeform.h, after proper testing of vgrouping methods XXX */ + void create_dverts( Mesh * me ); void add_vert_defnr( Object * ob, int def_nr, int vertnum, float weight, int assignmode ); void remove_vert_def_nr( Object * ob, int def_nr, int vertnum ); -/* Globals */ -static PyObject *g_nmeshmodule = NULL; + /* Type checking for EXPP PyTypes */ #define BPy_NMesh_Check(v) ((v)->ob_type == &NMesh_Type) @@ -150,8 +121,13 @@ typedef struct { /* PROTOS */ extern void test_object_materials( ID * id ); /* declared in BKE_material.h */ -static int unlink_existingMeshData( Mesh * mesh ); -static int convert_NMeshToMesh( Mesh * mesh, BPy_NMesh * nmesh ); + +PyObject *NMesh_Init( void ); +PyObject *NMesh_CreatePyObject( Mesh * me, Object * ob ); +Mesh *Mesh_FromPyObject( PyObject * pyobj, Object * ob ); +int NMesh_CheckPyObject( PyObject * pyobj ); + + void mesh_update( Mesh * mesh ); PyObject *new_NMesh( Mesh * oldmesh ); Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh ); @@ -159,14 +135,6 @@ PyObject *NMesh_assignMaterials_toObject( BPy_NMesh * nmesh, Object * ob ); Material **nmesh_updateMaterials( BPy_NMesh * nmesh ); Material **newMaterialList_fromPyList( PyObject * list ); void mesh_update( Mesh * mesh ); -static PyObject *NMesh_addVertGroup( PyObject * self, PyObject * args ); -static PyObject *NMesh_removeVertGroup( PyObject * self, PyObject * args ); -static PyObject *NMesh_assignVertsToGroup( PyObject * self, PyObject * args ); -static PyObject *NMesh_removeVertsFromGroup( PyObject * self, - PyObject * args ); -static PyObject *NMesh_getVertsFromGroup( PyObject * self, PyObject * args ); -static PyObject *NMesh_renameVertGroup( PyObject * self, PyObject * args ); -static PyObject *NMesh_getVertGroupNames( PyObject * self, PyObject * args ); #endif /* EXPP_NMESH_H */ diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index ba5a757a3c6..f094b141fb0 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -39,12 +39,18 @@ #include "logic.h" #include <blendef.h> #include <DNA_scene_types.h> +#include <DNA_mesh_types.h> +#include <DNA_curve_types.h> #include <DNA_property_types.h> #include <BSE_edit.h> #include <BKE_property.h> #include <BKE_mball.h> #include <BIF_editview.h> +#include "Ipo.h" +#include "Lattice.h" +#include "modules.h" + /*****************************************************************************/ /* Python API function prototypes for the Blender module. */ diff --git a/source/blender/python/api2_2x/Object.h b/source/blender/python/api2_2x/Object.h index e96ecca241e..c1b3025a386 100644 --- a/source/blender/python/api2_2x/Object.h +++ b/source/blender/python/api2_2x/Object.h @@ -59,9 +59,7 @@ #include <DNA_view3d_types.h> #include <DNA_action_types.h> -#include "bpy_types.h" #include "gen_utils.h" -#include "modules.h" #include "vector.h" #include "matrix.h" #include "euler.h" @@ -80,6 +78,13 @@ typedef struct { PyObject_HEAD struct Object *object; } BPy_Object; + +PyObject *Object_Init( void ); +PyObject *Object_CreatePyObject( struct Object *obj ); +Object *Object_FromPyObject( PyObject * py_obj ); +int Object_CheckPyObject( PyObject * py_obj ); +Object *GetObjectByName( char *name ); + int EXPP_add_obdata( struct Object *object ); #endif /* EXPP_OBJECT_H */ diff --git a/source/blender/python/api2_2x/Particle.h b/source/blender/python/api2_2x/Particle.h index 8a91f4ef9af..9010c50f70d 100644 --- a/source/blender/python/api2_2x/Particle.h +++ b/source/blender/python/api2_2x/Particle.h @@ -45,7 +45,18 @@ #include <DNA_effect_types.h> #include "gen_utils.h" -#include "bpy_types.h" + +extern PyTypeObject Particle_Type; + +#define BPy_Particle_Check(v) ((v)->ob_type==&Particle_Type) + +/* Python BPy_Particle structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + Effect * particle; +} BPy_Particle; + + /*****************************************************************************/ /* Python API function prototypes for the Particle module. */ diff --git a/source/blender/python/api2_2x/Registry.c b/source/blender/python/api2_2x/Registry.c index c4de504451e..e0ba81b1029 100644 --- a/source/blender/python/api2_2x/Registry.c +++ b/source/blender/python/api2_2x/Registry.c @@ -32,6 +32,63 @@ #include "Registry.h" +#include <stdio.h> + +#include "gen_utils.h" + + + +/* the Registry dictionary */ +PyObject *bpy_registryDict = NULL; + +/*****************************************************************************/ +/* Python API function prototypes for the Registry module. */ +/*****************************************************************************/ +static PyObject *M_Registry_Keys( PyObject * self ); +static PyObject *M_Registry_GetKey( PyObject * self, PyObject * args ); +static PyObject *M_Registry_SetKey( PyObject * self, PyObject * args ); +static PyObject *M_Registry_RemoveKey( 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.Registry.__doc__ */ +/*****************************************************************************/ +char M_Registry_doc[] = + "The Blender Registry module (persistent data cache)\n\n\ + Use this module to store configuration data that a script can reload\n\ + when it is executed again.\n"; + +char M_Registry_Keys_doc[] = + "() - Get all keys in the Registry dictionary.\n\n\ + Each key references another dict with saved data from a specific script.\n"; + +char M_Registry_GetKey_doc[] = + "(name) - Get a specific entry (dict) from the Registry dictionary\n\ + (name) - a string that references a specific script.\n"; + +char M_Registry_SetKey_doc[] = + "(key, dict) - Store an entry in the Registry dictionary.\n\ + If an entry with the same 'key' already exists, it is substituted.\n\ + (key) - the string to use as a key for the dict being saved.\n\ + (dict) - a dictionary with the data to be stored.\n"; + +char M_Registry_RemoveKey_doc[] = + "(key) - Remove the dict with key 'key' from the Registry.\n"; + +/*****************************************************************************/ +/* Python method structure definition for Blender.Registry module: */ +/*****************************************************************************/ +struct PyMethodDef M_Registry_methods[] = { + {"Keys", ( PyCFunction ) M_Registry_Keys, METH_VARARGS, + M_Registry_Keys_doc}, + {"GetKey", M_Registry_GetKey, METH_VARARGS, M_Registry_GetKey_doc}, + {"SetKey", M_Registry_SetKey, METH_VARARGS, M_Registry_SetKey_doc}, + {"RemoveKey", M_Registry_RemoveKey, METH_VARARGS, + M_Registry_RemoveKey_doc}, + {NULL, NULL, 0, NULL} +}; + /*****************************************************************************/ /* Function: M_Registry_Keys */ /* Python equivalent: Blender.Registry.Keys */ diff --git a/source/blender/python/api2_2x/Registry.h b/source/blender/python/api2_2x/Registry.h index 1853b957413..4383d63e0bc 100644 --- a/source/blender/python/api2_2x/Registry.h +++ b/source/blender/python/api2_2x/Registry.h @@ -43,60 +43,8 @@ #define EXPP_REGISTRY_H #include <Python.h> -#include <stdio.h> -#include "gen_utils.h" -#include "modules.h" - -/* the Registry dictionary, declare here, defined in ../BPY_interface.c */ -PyObject *bpy_registryDict = NULL; - -/*****************************************************************************/ -/* Python API function prototypes for the Registry module. */ -/*****************************************************************************/ -static PyObject *M_Registry_Keys( PyObject * self ); -static PyObject *M_Registry_GetKey( PyObject * self, PyObject * args ); -static PyObject *M_Registry_SetKey( PyObject * self, PyObject * args ); -static PyObject *M_Registry_RemoveKey( 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.Registry.__doc__ */ -/*****************************************************************************/ -char M_Registry_doc[] = - "The Blender Registry module (persistent data cache)\n\n\ - Use this module to store configuration data that a script can reload\n\ - when it is executed again.\n"; - -char M_Registry_Keys_doc[] = - "() - Get all keys in the Registry dictionary.\n\n\ - Each key references another dict with saved data from a specific script.\n"; - -char M_Registry_GetKey_doc[] = - "(name) - Get a specific entry (dict) from the Registry dictionary\n\ - (name) - a string that references a specific script.\n"; - -char M_Registry_SetKey_doc[] = - "(key, dict) - Store an entry in the Registry dictionary.\n\ - If an entry with the same 'key' already exists, it is substituted.\n\ - (key) - the string to use as a key for the dict being saved.\n\ - (dict) - a dictionary with the data to be stored.\n"; - -char M_Registry_RemoveKey_doc[] = - "(key) - Remove the dict with key 'key' from the Registry.\n"; - -/*****************************************************************************/ -/* Python method structure definition for Blender.Registry module: */ -/*****************************************************************************/ -struct PyMethodDef M_Registry_methods[] = { - {"Keys", ( PyCFunction ) M_Registry_Keys, METH_VARARGS, - M_Registry_Keys_doc}, - {"GetKey", M_Registry_GetKey, METH_VARARGS, M_Registry_GetKey_doc}, - {"SetKey", M_Registry_SetKey, METH_VARARGS, M_Registry_SetKey_doc}, - {"RemoveKey", M_Registry_RemoveKey, METH_VARARGS, - M_Registry_RemoveKey_doc}, - {NULL, NULL, 0, NULL} -}; +extern PyObject *bpy_registryDict; +PyObject *Registry_Init( void ); #endif /* EXPP_REGISTRY_H */ diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index b6d7a5fe358..99d07986d01 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -46,7 +46,6 @@ #include <mydevice.h> /* for #define REDRAW */ #include "Object.h" -#include "bpy_types.h" #include "constant.h" #include "gen_utils.h" #include "sceneRender.h" diff --git a/source/blender/python/api2_2x/Scene.h b/source/blender/python/api2_2x/Scene.h index ca0775dc6f8..c6905d56be2 100644 --- a/source/blender/python/api2_2x/Scene.h +++ b/source/blender/python/api2_2x/Scene.h @@ -48,9 +48,12 @@ typedef struct { } BPy_Scene; //---------------------------Python BPy_Scene visible prototypes----------- // Python Scene_Type helper functions needed by Blender (the Init function) and Object modules. + + PyObject *Scene_Init( void ); PyObject *Scene_CreatePyObject( Scene * cam ); Scene *Scene_FromPyObject( PyObject * pyobj ); int Scene_CheckPyObject( PyObject * pyobj ); +Scene *GetSceneByName( char *name ); #endif /* EXPP_SCENE_H */ diff --git a/source/blender/python/api2_2x/Sys.c b/source/blender/python/api2_2x/Sys.c index 56b80f7b79e..708c9c8fbb1 100644 --- a/source/blender/python/api2_2x/Sys.c +++ b/source/blender/python/api2_2x/Sys.c @@ -36,7 +36,7 @@ #include <Python.h> #include <sys/stat.h> #include "gen_utils.h" -#include "modules.h" + /*****************************************************************************/ /* Python API function prototypes for the sys module. */ diff --git a/source/blender/python/api2_2x/Sys.h b/source/blender/python/api2_2x/Sys.h index 7817fff1fdc..46f3017111d 100644 --- a/source/blender/python/api2_2x/Sys.h +++ b/source/blender/python/api2_2x/Sys.h @@ -33,4 +33,6 @@ #ifndef EXPP_sys_H #define EXPP_sys_H +PyObject *sys_Init( void ); + #endif /* EXPP_sys_H */ diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c index 029b53f2664..55304588515 100644 --- a/source/blender/python/api2_2x/Text.c +++ b/source/blender/python/api2_2x/Text.c @@ -42,8 +42,8 @@ #include <BLI_blenlib.h> #include <DNA_text_types.h> +#include "Text.h" #include "gen_utils.h" -#include "modules.h" #include "../BPY_extern.h" #define EXPP_TEXT_MODE_FOLLOW TXT_FOLLOW diff --git a/source/blender/python/api2_2x/Text.h b/source/blender/python/api2_2x/Text.h index 01203ba1246..cf2b29986b4 100644 --- a/source/blender/python/api2_2x/Text.h +++ b/source/blender/python/api2_2x/Text.h @@ -32,4 +32,10 @@ #ifndef EXPP_TEXT_H #define EXPP_TEXT_H + +#include <DNA_text_types.h> + +PyObject *Text_Init( void ); +PyObject *Text_CreatePyObject( Text * txt ); + #endif /* EXPP_TEXT_H */ diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c index 839a804017f..144f200f045 100644 --- a/source/blender/python/api2_2x/Texture.c +++ b/source/blender/python/api2_2x/Texture.c @@ -40,9 +40,10 @@ #include "MTex.h" #include "Texture.h" #include "Image.h" +#include "Ipo.h" #include "constant.h" #include "gen_utils.h" -#include "modules.h" + /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c index 6647071013f..930ecc7c270 100644 --- a/source/blender/python/api2_2x/Types.c +++ b/source/blender/python/api2_2x/Types.c @@ -36,14 +36,17 @@ This module is a dictionary of all Blender Python types"; struct PyMethodDef Null_methods[] = { {NULL, NULL, 0, NULL} }; + + +/* The internal types (lowercase first letter, like constant_Type) are only + * set when some object initializes them. But unless we do it early, we get + * some easy and unpredictable (varies with platform, even distro) ways to + * crash Blender. Some modules also need this early up, so let's generalize + * and init all our pytypes here. + */ + void types_InitAll( void ) { - /* The internal types (lowercase first letter, like constant_Type) are only - * set when some object initializes them. But unless we do it early, we get - * some easy and unpredictable (varies with platform, even distro) ways to - * crash Blender. Some modules also need this early up, so let's generalize - * and init all our pytypes here. */ - Action_Type.ob_type = &PyType_Type; Armature_Type.ob_type = &PyType_Type; BezTriple_Type.ob_type = &PyType_Type; diff --git a/source/blender/python/api2_2x/Types.h b/source/blender/python/api2_2x/Types.h index 73b7209e4f9..a73a89a6cb1 100644 --- a/source/blender/python/api2_2x/Types.h +++ b/source/blender/python/api2_2x/Types.h @@ -54,4 +54,7 @@ extern PyTypeObject property_Type; extern PyTypeObject buffer_Type, constant_Type, euler_Type; extern PyTypeObject matrix_Type, quaternion_Type, rgbTuple_Type, vector_Type; +PyObject *Types_Init( void ); +void types_InitAll( void ); + #endif /* EXPP_TYPES_H */ diff --git a/source/blender/python/api2_2x/Wave.h b/source/blender/python/api2_2x/Wave.h index 2fb5810ba47..91daf22c0fd 100644 --- a/source/blender/python/api2_2x/Wave.h +++ b/source/blender/python/api2_2x/Wave.h @@ -44,8 +44,21 @@ #include <BKE_library.h> #include <DNA_effect_types.h> +#include"Effect.h" #include "gen_utils.h" + +extern PyTypeObject Wave_Type; + +#define BPy_Wave_Check(v) ((v)->ob_type==&Wave_Type) + +/* Python BPy_Wave structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + Effect * wave; +} BPy_Wave; + + /*****************************************************************************/ /* Python API function prototypes for the Wave module. */ /*****************************************************************************/ @@ -53,7 +66,7 @@ PyObject *M_Wave_New( PyObject * self, PyObject * args ); PyObject *M_Wave_Get( PyObject * self, PyObject * args ); -#include"Effect.h" + /*****************************************************************************/ /* Python BPy_Wave methods declarations: */ /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c index 85dbbadcebd..84b3a5974bb 100644 --- a/source/blender/python/api2_2x/Window.c +++ b/source/blender/python/api2_2x/Window.c @@ -52,11 +52,12 @@ #include <DNA_view3d_types.h> #include <DNA_screen_types.h> #include <DNA_space_types.h> +#include <DNA_scene_types.h> #include <DNA_text_types.h> #include <DNA_vec_types.h> /* for rcti struct */ +#include "windowTheme.h" #include "gen_utils.h" -#include "modules.h" #include "matrix.h" #include "vector.h" #include "constant.h" diff --git a/source/blender/python/api2_2x/Window.h b/source/blender/python/api2_2x/Window.h index a615f408b42..25250724e83 100644 --- a/source/blender/python/api2_2x/Window.h +++ b/source/blender/python/api2_2x/Window.h @@ -35,4 +35,7 @@ #ifndef EXPP_WINDOW_H #define EXPP_WINDOW_H +PyObject *Window_Init( void ); +PyObject *M_Window_Redraw( PyObject * self, PyObject * args ); + #endif /* EXPP_WINDOW_H */ diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 4f1c20d851d..89af766c354 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -36,7 +36,7 @@ * \brief Blender.World Module and World Data PyObject implementation. * * Note: Parameters between "<" and ">" are optional. But if one of them is - * given, all preceding ones must be given, too. Of course, this only relates + * given, all preceding ones must be given, too. Of course, this only relates * to the Python functions and methods described here and only inside Python * code. [ This will go to another file later, probably the main exppython * doc file]. XXX Better: put optional args with their default value: @@ -49,7 +49,52 @@ #include <BKE_library.h> #include <BLI_blenlib.h> +#include <DNA_scene_types.h> /* for G.scene */ + #include "World.h" +#include "Ipo.h" + +#include "constant.h" +#include "gen_utils.h" + + +/*****************************************************************************/ +/* Python BPy_World methods declarations: */ +/*****************************************************************************/ +static PyObject *World_getRange( BPy_World * self ); +static PyObject *World_setRange( BPy_World * self, PyObject * args ); +static PyObject *World_getIpo( BPy_World * self ); +static PyObject *World_setIpo( BPy_World * self, PyObject * args ); +static PyObject *World_clearIpo( BPy_World * self ); +static PyObject *World_getName( BPy_World * self ); +static PyObject *World_setName( BPy_World * self, PyObject * args ); +static PyObject *World_getSkytype( BPy_World * self ); +static PyObject *World_setSkytype( 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_getMist( BPy_World * self ); +static PyObject *World_setMist( BPy_World * self, PyObject * args ); +static PyObject *World_getScriptLinks( BPy_World * self, PyObject * args ); +static PyObject *World_addScriptLink( BPy_World * self, PyObject * args ); +static PyObject *World_clearScriptLinks( BPy_World * self ); +static PyObject *World_makeActive( BPy_World * self ); + + +/*****************************************************************************/ +/* 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 ); +static PyObject *M_World_GetActive( PyObject * self ); /*****************************************************************************/ @@ -62,6 +107,105 @@ 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 ); + + +/*****************************************************************************/ +/* 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."; +static char M_World_GetActive_doc[] = "() - returns the current world, or \ +None if the Scene has no world"; + + + +/*****************************************************************************/ +/* 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}, + {"GetActive", ( PyCFunction ) M_World_GetActive, METH_NOARGS, + M_World_GetActive_doc}, + {"get", M_World_Get, METH_VARARGS, M_World_Get_doc}, + {NULL, NULL, 0, NULL} +}; + + + +/*****************************************************************************/ +/* Python BPy_World methods table: */ +/*****************************************************************************/ +static PyMethodDef BPy_World_methods[] = { + {"getRange", ( PyCFunction ) World_getRange, METH_NOARGS, + "() - Return World Range"}, + {"setRange", ( PyCFunction ) World_setRange, METH_VARARGS, + "() - Change this World's range"}, + {"getIpo", ( PyCFunction ) World_getIpo, METH_NOARGS, + "() - Return World Ipo"}, + {"setIpo", ( PyCFunction ) World_setIpo, METH_VARARGS, + "() - Change this World's ipo"}, + {"clearIpo", ( PyCFunction ) World_clearIpo, METH_VARARGS, + "() - Unlink Ipo from this World"}, + {"getName", ( PyCFunction ) World_getName, METH_NOARGS, + "() - Return World Data name"}, + {"setName", ( PyCFunction ) World_setName, METH_VARARGS, + "() - Return World Data name"}, + {"getSkytype", ( PyCFunction ) World_getSkytype, METH_NOARGS, + "() - Return World Data skytype"}, + {"setSkytype", ( PyCFunction ) World_setSkytype, METH_VARARGS, + "() - Return World Data skytype"}, + {"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"}, + {"getMist", ( PyCFunction ) World_getMist, METH_NOARGS, + "() - Return World Data mist"}, + {"setMist", ( PyCFunction ) World_setMist, METH_VARARGS, + "() - Return World Data mist"}, + {"getScriptLinks", ( PyCFunction ) World_getScriptLinks, METH_VARARGS, + "(eventname) - Get a list of this world's scriptlinks (Text names) " + "of the given type\n" + "(eventname) - string: FrameChanged or Redraw."}, + {"addScriptLink", ( PyCFunction ) World_addScriptLink, METH_VARARGS, + "(text, evt) - Add a new world scriptlink.\n" + "(text) - string: an existing Blender Text name;\n" + "(evt) string: FrameChanged or Redraw."}, + {"clearScriptLinks", ( PyCFunction ) World_clearScriptLinks, + METH_NOARGS, + "() - Delete all scriptlinks from this world :)."}, + {"makeActive", ( PyCFunction ) World_makeActive, METH_NOARGS, + "() - Makes this world the active world for the current scene."}, + {NULL, NULL, 0, NULL} +}; + + /*****************************************************************************/ /* Python World_Type structure definition: */ /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/World.h b/source/blender/python/api2_2x/World.h index ed9968480d7..81d38f68545 100644 --- a/source/blender/python/api2_2x/World.h +++ b/source/blender/python/api2_2x/World.h @@ -35,154 +35,29 @@ #include <Python.h> +#include <DNA_world_types.h> +//#include "bpy_types.h" -#include "constant.h" -#include "gen_utils.h" -#include "bpy_types.h" -#include "modules.h" +#define BPy_World_Check(v) ((v)->ob_type==&World_Type) -/*****************************************************************************/ -/* 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 ); -static PyObject *M_World_GetActive( PyObject * self ); +/* Python BPy_World structure definition */ +typedef struct { + PyObject_HEAD /* required py macro */ + World * world; +} BPy_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."; -static char M_World_GetActive_doc[] = "() - returns the current world, or \ -None if the Scene has no world"; - - - -/*****************************************************************************/ -/* 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}, - {"GetActive", ( PyCFunction ) M_World_GetActive, METH_NOARGS, - M_World_GetActive_doc}, - {"get", M_World_Get, METH_VARARGS, M_World_Get_doc}, - {NULL, NULL, 0, NULL} -}; - - -/*****************************************************************************/ -/* Python BPy_World methods declarations: */ -/*****************************************************************************/ -static PyObject *World_getRange( BPy_World * self ); -static PyObject *World_setRange( BPy_World * self, PyObject * args ); -static PyObject *World_getIpo( BPy_World * self ); -static PyObject *World_setIpo( BPy_World * self, PyObject * args ); -static PyObject *World_clearIpo( BPy_World * self ); -static PyObject *World_getName( BPy_World * self ); -static PyObject *World_setName( BPy_World * self, PyObject * args ); -static PyObject *World_getSkytype( BPy_World * self ); -static PyObject *World_setSkytype( 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_getMist( BPy_World * self ); -static PyObject *World_setMist( BPy_World * self, PyObject * args ); -static PyObject *World_getScriptLinks( BPy_World * self, PyObject * args ); -static PyObject *World_addScriptLink( BPy_World * self, PyObject * args ); -static PyObject *World_clearScriptLinks( BPy_World * self ); -static PyObject *World_makeActive( BPy_World * self ); - -/*****************************************************************************/ -/* Python BPy_World methods table: */ -/*****************************************************************************/ -static PyMethodDef BPy_World_methods[] = { - {"getRange", ( PyCFunction ) World_getRange, METH_NOARGS, - "() - Return World Range"}, - {"setRange", ( PyCFunction ) World_setRange, METH_VARARGS, - "() - Change this World's range"}, - {"getIpo", ( PyCFunction ) World_getIpo, METH_NOARGS, - "() - Return World Ipo"}, - {"setIpo", ( PyCFunction ) World_setIpo, METH_VARARGS, - "() - Change this World's ipo"}, - {"clearIpo", ( PyCFunction ) World_clearIpo, METH_VARARGS, - "() - Unlink Ipo from this World"}, - {"getName", ( PyCFunction ) World_getName, METH_NOARGS, - "() - Return World Data name"}, - {"setName", ( PyCFunction ) World_setName, METH_VARARGS, - "() - Return World Data name"}, - {"getSkytype", ( PyCFunction ) World_getSkytype, METH_NOARGS, - "() - Return World Data skytype"}, - {"setSkytype", ( PyCFunction ) World_setSkytype, METH_VARARGS, - "() - Return World Data skytype"}, - {"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"}, - {"getMist", ( PyCFunction ) World_getMist, METH_NOARGS, - "() - Return World Data mist"}, - {"setMist", ( PyCFunction ) World_setMist, METH_VARARGS, - "() - Return World Data mist"}, - {"getScriptLinks", ( PyCFunction ) World_getScriptLinks, METH_VARARGS, - "(eventname) - Get a list of this world's scriptlinks (Text names) " - "of the given type\n" - "(eventname) - string: FrameChanged or Redraw."}, - {"addScriptLink", ( PyCFunction ) World_addScriptLink, METH_VARARGS, - "(text, evt) - Add a new world scriptlink.\n" - "(text) - string: an existing Blender Text name;\n" - "(evt) string: FrameChanged or Redraw."}, - {"clearScriptLinks", ( PyCFunction ) World_clearScriptLinks, - METH_NOARGS, - "() - Delete all scriptlinks from this world :)."}, - {"makeActive", ( PyCFunction ) World_makeActive, METH_NOARGS, - "() - Makes this world the active world for the current scene."}, - {NULL, NULL, 0, NULL} -}; +extern PyTypeObject World_Type; /*****************************************************************************/ /* Python World_Type helper functions needed by Blender (the Init function) */ /* and Object modules. */ /*****************************************************************************/ + PyObject *World_Init( void ); PyObject *World_CreatePyObject( World * world ); World *World_FromPyObject( PyObject * pyobj ); int World_CheckPyObject( PyObject * pyobj ); - +World *GetWorldByName( char *name ); #endif /* EXPP_WORLD_H */ diff --git a/source/blender/python/api2_2x/bpy_types.h b/source/blender/python/api2_2x/bpy_types.h index 2c409d4ab78..d8144de5bb7 100644 --- a/source/blender/python/api2_2x/bpy_types.h +++ b/source/blender/python/api2_2x/bpy_types.h @@ -34,186 +34,68 @@ #include <Python.h> -#include <DNA_camera_types.h> -#include <DNA_lamp_types.h> -#include <DNA_ipo_types.h> -#include <DNA_meta_types.h> -#include <DNA_effect_types.h> + + + #include <DNA_curve_types.h> -#include <DNA_world_types.h> -#include "rgbTuple.h" /* for BPy_rgbTuple */ + /*****************************************************************************/ /* Camera Data */ /*****************************************************************************/ -extern PyTypeObject Camera_Type; - -#define BPy_Camera_Check(v) \ - ((v)->ob_type == &Camera_Type) /* for type checking */ - -/* Python BPy_Camera structure definition */ -typedef struct { - PyObject_HEAD /* required py macro */ - Camera * camera; -} BPy_Camera; /*****************************************************************************/ /* Lamp Data */ /*****************************************************************************/ -extern PyTypeObject Lamp_Type; - -#define BPy_Lamp_Check(v) \ - ((v)->ob_type == &Lamp_Type) /* for type checking */ - -/* Python BPy_Lamp structure definition */ -typedef struct { - PyObject_HEAD /* required py macro */ - 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 /* required py macro */ - 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 /* required py macro */ - MetaBall * metaball; -} BPy_Metaball; /*****************************************************************************/ /* Metaelem Data */ /*****************************************************************************/ -extern PyTypeObject Metaelem_Type; -#define BPy_Metaelem_Check(v) ((v)->ob_type==&Metaelem_Type) - -/* Python BPy_Metaelem structure definition */ -typedef struct { - PyObject_HEAD /* required py macro */ - MetaElem * metaelem; -} BPy_Metaelem; /*****************************************************************************/ /* 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 /* required py macro */ - 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 /* required py macro */ - 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 /* required py macro */ - 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 /* required py macro */ - 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 /* required py macro */ - Curve * curve; - /* pointer for iterator: does not point to owned memory */ - Nurb *iter_pointer; -} BPy_Curve; /********** CurNurb data ***********/ -extern PyTypeObject CurNurb_Type; - -#define BPy_CurNurb_Check(v) ((v)->ob_type == &CurNurb_Type) /* for type checking */ - -/* Python BPy_CurNurb structure definition */ -typedef struct { - PyObject_HEAD /* required py macro */ - Nurb * nurb; /* pointer to Blender data */ - - /* iterator stuff */ - /* internal ptrs to point data. do not free */ - BPoint *bp; - BezTriple *bezt; - int atEnd; /* iter exhausted flag */ - int nextPoint; - -} BPy_CurNurb; - /*****************************************************************************/ /* 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 /* required py macro */ - World * world; -} BPy_World; #endif /* EXPP_bpy_types_h */ diff --git a/source/blender/python/api2_2x/modules.h b/source/blender/python/api2_2x/modules.h index 6d021ebb0b3..1c6cba453e6 100644 --- a/source/blender/python/api2_2x/modules.h +++ b/source/blender/python/api2_2x/modules.h @@ -25,7 +25,8 @@ * * This is a new part of Blender. * - * Contributor(s): Michel Selten, Willian P. Germano, Nathan Letwory + * Contributor(s): Michel Selten, Willian P. Germano, Nathan Letwory, + * Stephen Swaney * * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ @@ -33,179 +34,61 @@ #ifndef EXPP_modules_h #define EXPP_modules_h -#include <Python.h> - -#include <DNA_scene_types.h> -#include <DNA_object_types.h> -#include <DNA_mesh_types.h> -#include <DNA_camera_types.h> -#include <DNA_lamp_types.h> -#include <DNA_lattice_types.h> -#include <DNA_curve_types.h> -#include <DNA_armature_types.h> -#include <DNA_ipo_types.h> -#include <DNA_effect_types.h> -#include <DNA_meta_types.h> -#include <DNA_image_types.h> -#include <DNA_texture_types.h> -#include <DNA_text_types.h> -#include <DNA_world_types.h> -#include <DNA_key_types.h> -#include <DNA_sequence_types.h> -#include <DNA_action_types.h> -#include <DNA_constraint_types.h> +/************************************************************ +Certain bpy module files ( BPY_interface.c, Blender.c, and Object.c ) +need to know about almost every other module. This file is a +convenient way to include almost all the necessary declarations. + +The #includes commented out below currently do not exist. +Their *_Init() method declarations are hacked in down below. +************************************************************/ + + +#include "Armature.h" +/* #include "BGL.h" */ +#include "Blender.h" +#include "Camera.h" +#include "Curve.h" +#include "CurNurb.h" +#include "Draw.h" +#include "Effect.h" +#include "Ipo.h" +#include "Ipocurve.h" +#include "Lamp.h" +#include "Lattice.h" +/* #include "Library.h" */ +#include "Material.h" +#include "Mathutils.h" +#include "Metaball.h" +#include "NLA.h" +#include "NMesh.h" +/* #include "Noise.h" */ +#include "Object.h" +#include "Registry.h" +#include "Scene.h" +#include "Sound.h" +#include "Sys.h" +#include "Text.h" +#include "Texture.h" +#include "Types.h" +#include "Window.h" +#include "World.h" /*****************************************************************************/ /* Global variables */ /*****************************************************************************/ -extern PyObject *g_blenderdict; - - -/*****************************************************************************/ -/* Module Init functions and Data Object helper functions (used by the */ -/* Object module to work with its .data field for the various Data objs */ -/*****************************************************************************/ -void M_Blender_Init( void ); - -void types_InitAll( void ); /* in Types.c */ - -/* sys */ -PyObject *sys_Init( void ); - -/* Registry */ -PyObject *Registry_Init( void ); - -/* Object itself */ -PyObject *Object_Init( void ); -PyObject *Object_CreatePyObject( struct Object *obj ); -Object *Object_FromPyObject( PyObject * py_obj ); -int Object_CheckPyObject( PyObject * py_obj ); -Object *GetObjectByName( char *name ); - -/* Scene */ -PyObject *Scene_Init( void ); -PyObject *Scene_CreatePyObject( struct Scene *sce ); -Scene *Scene_FromPyObject( PyObject * pyobj ); -int Scene_CheckPyObject( PyObject * pyobj ); -Scene *GetSceneByName( char *name ); - -/* Types */ -PyObject *Types_Init( void ); - -/* NMesh Data */ -PyObject *NMesh_Init( void ); -PyObject *NMesh_CreatePyObject( Mesh * me, Object * ob ); -Mesh *Mesh_FromPyObject( PyObject * pyobj, Object * ob ); -int NMesh_CheckPyObject( PyObject * pyobj ); - -/* Material */ -PyObject *Material_Init( void ); -PyObject *Material_CreatePyObject( struct Material *mat ); -int Material_CheckPyObject( PyObject * pyobj ); -Material **EXPP_newMaterialList_fromPyList( PyObject * list ); -Material **EXPP_newMaterialList( int len ); -int EXPP_releaseMaterialList( Material ** matlist, int len ); -int EXPP_synchronizeMaterialLists( Object * object ); -void EXPP_incr_mats_us( Material ** matlist, int len ); -PyObject *EXPP_PyList_fromMaterialList( Material ** matlist, int len, - int all ); -Material *GetMaterialByName( char *name ); - -/* Texture */ -PyObject *Texture_Init( void ); - -/* Camera Data */ -PyObject *Camera_Init( void ); -PyObject *Camera_CreatePyObject( struct Camera *cam ); -Camera *Camera_FromPyObject( PyObject * pyobj ); -int Camera_CheckPyObject( PyObject * pyobj ); -Camera *GetCameraByName( char *name ); -/* Lamp Data */ -PyObject *Lamp_Init( void ); -PyObject *Lamp_CreatePyObject( struct Lamp *lamp ); -Lamp *Lamp_FromPyObject( PyObject * pyobj ); -int Lamp_CheckPyObject( PyObject * pyobj ); -Lamp *GetLampByName( char *name ); +/**************************************************************************** +Module Init functions for modules without a .h file. +BGL is a special case. It still has data declarations in the .h file +and cannot be #included until it is cleaned up. +****************************************************************************/ -/* Curve Data */ -PyObject *Curve_Init( void ); -PyObject *Curve_CreatePyObject( struct Curve *curve ); -Curve *Curve_FromPyObject( PyObject * py_obj ); -int Curve_CheckPyObject( PyObject * py_obj ); - -/* Armature Data */ -PyObject *Armature_Init( void ); -PyObject *Armature_CreatePyObject( bArmature * armature ); -bArmature *Armature_FromPyObject( PyObject * py_obj ); -int Armature_CheckPyObject( PyObject * py_obj ); - -/* Ipo Data */ -PyObject *BezTriple_CreatePyObject( BezTriple * bzt ); -int BezTriple_CheckPyObject( PyObject * pyobj ); -BezTriple *BezTriple_FromPyObject( PyObject * pyobj ); - -PyObject *IpoCurve_Init( void ); -PyObject *IpoCurve_CreatePyObject( IpoCurve * ipo ); -int IpoCurve_CheckPyObject( PyObject * pyobj ); -IpoCurve *IpoCurve_FromPyObject( PyObject * pyobj ); - -PyObject *Ipo_Init( void ); -PyObject *Ipo_CreatePyObject( struct Ipo *ipo ); -Ipo *Ipo_FromPyObject( PyObject * py_obj ); -int Ipo_CheckPyObject( PyObject * py_obj ); - -/* Metaball Data */ -PyObject *Metaball_Init( void ); -PyObject *Metaball_CreatePyObject( MetaBall * metaball ); -MetaBall *Metaball_FromPyObject( PyObject * py_obj ); -int Metaball_CheckPyObject( PyObject * py_obj ); - -/* Particle Effects Data */ -PyObject *Effect_Init( void ); -PyObject *Effect_CreatePyObject( struct Effect *effect ); -Effect *Effect_FromPyObject( PyObject * py_obj ); -int Effect_CheckPyObject( PyObject * py_obj ); - -/* Image */ -PyObject *Image_Init( void ); -PyObject *Image_CreatePyObject( Image * image ); -int Image_CheckPyObject( PyObject * pyobj ); - -/* Text */ -PyObject *Text_Init( void ); -PyObject *Text_CreatePyObject( Text * txt ); - -/* World */ -PyObject *World_Init( void ); -PyObject *World_CreatePyObject( struct World *world ); -int World_CheckPyObject( PyObject * py_obj ); -World *World_FromPyObject( PyObject * py_obj ); -World *GetWorldByName( char *name ); - -/* Lattice */ -PyObject *Lattice_Init( void ); -PyObject *Lattice_CreatePyObject( Lattice * lt ); -Lattice *Lattice_FromPyObject( PyObject * pyobj ); -int Lattice_CheckPyObject( PyObject * pyobj ); +PyObject *BGL_Init( void ); -/* Noise */ +PyObject *Library_Init( void ); PyObject *Noise_Init( void ); -/* CurNurb */ -PyObject *CurNurb_Init( void ); -PyObject *CurNurb_CreatePyObject( Nurb * bzt ); -int CurNurb_CheckPyObject( PyObject * pyobj ); -Nurb *CurNurb_FromPyObject( PyObject * pyobj ); -/* Init functions for other modules */ -PyObject *Window_Init( void ); -PyObject *Draw_Init( void ); -PyObject *BGL_Init( void ); -PyObject *Mathutils_Init( void ); -PyObject *NLA_Init( void ); -PyObject *Library_Init( void ); -PyObject *Sound_Init( void ); -PyObject *Theme_Init( void ); /* Window.Theme */ #endif /* EXPP_modules_h */ diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index 8b2f55a3398..7d6ba0cb7f7 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -48,7 +48,7 @@ #include "blendef.h" #include "Scene.h" #include "gen_utils.h" -#include "modules.h" + #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/source/blender/python/api2_2x/windowTheme.h b/source/blender/python/api2_2x/windowTheme.h index 22ae4a1ff00..83f338da95b 100644 --- a/source/blender/python/api2_2x/windowTheme.h +++ b/source/blender/python/api2_2x/windowTheme.h @@ -54,4 +54,6 @@ typedef struct { } BPy_Theme; +PyObject *Theme_Init( void ); + #endif /* EXPP_WINDOWTHEME_H */ |