General housekeeping and cleanup. Move static declarations and

data definitions from .h files into corresponding .c files.
Blame zr for this since he's the one who pointed out that our
bpy headers were a mish-mash of stuff that belonged in the .c files!

In a nutshell, the headers should contain the declarations necessary
to use a module or class.  The implementation files ( .c in this case )
should contain statements that allocate storage ( definitions in
the C sense ) and executable code.

When used at file scope, the keyword 'static' means "don't tell
anyone else about this".  Since headers describe a public
interface, static declarations and definitions belong in the
implementation files.

The net result of all this is that after stuff has moved out
into the .c files, the .h files are empty or mostly empty.
I didn't delete them since there seem to be some public
declarations and because I did not want to cause too much
disruption at one time. Time enough for that later!
This commit is contained in:
Stephen Swaney
2004-03-29 08:16:18 +00:00
parent 0a6d0e62e1
commit f3feb77918
11 changed files with 3093 additions and 2563 deletions

View File

@@ -31,13 +31,103 @@
#include "BezTriple.h"
#include <Python.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <DNA_ipo_types.h>
#include "constant.h"
#include "gen_utils.h"
#include "modules.h"
/*****************************************************************************/
/* Python API function prototypes for the BezTriple module. */
/*****************************************************************************/
static PyObject *M_BezTriple_New (PyObject * self, PyObject * args);
static PyObject *M_BezTriple_Get (PyObject * self, PyObject * args);
/*****************************************************************************/
/* Python C_BezTriple instance methods declarations: */
/*****************************************************************************/
static PyObject *BezTriple_setPoints (C_BezTriple * self, PyObject * args);
static PyObject *BezTriple_getPoints (C_BezTriple * self);
static PyObject *BezTriple_getTriple (C_BezTriple * self);
/*****************************************************************************/
/* Python BezTriple_Type callback function prototypes: */
/*****************************************************************************/
static void BezTripleDeAlloc (C_BezTriple * self);
static int BezTripleSetAttr (C_BezTriple * self, char *name, PyObject * v);
static PyObject *BezTripleGetAttr (C_BezTriple * self, char *name);
static PyObject *BezTripleRepr (C_BezTriple * self);
/*****************************************************************************/
/* Python method structure definition for Blender.BezTriple module: */
/*****************************************************************************/
struct PyMethodDef M_BezTriple_methods[] = {
{"New", (PyCFunction) M_BezTriple_New, METH_VARARGS | METH_KEYWORDS, 0},
{"Get", M_BezTriple_Get, METH_VARARGS, 0},
{"get", M_BezTriple_Get, METH_VARARGS, 0},
{NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Python C_BezTriple methods table: */
/*****************************************************************************/
static PyMethodDef C_BezTriple_methods[] = {
/* name, method, flags, doc */
{"setPoints", (PyCFunction) BezTriple_setPoints, METH_VARARGS,
"(str) - Change BezTriple point coordinates"},
{"getPoints", (PyCFunction) BezTriple_getPoints, METH_NOARGS,
"() - return BezTriple knot point x and y coordinates"},
{"getTriple", (PyCFunction) BezTriple_getTriple, METH_VARARGS,
"() - return list of floating point triplets. order is H1, knot, H2"},
{NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Python BezTriple_Type structure definition: */
/*****************************************************************************/
PyTypeObject BezTriple_Type = {
PyObject_HEAD_INIT (NULL) 0, /* ob_size */
"BezTriple", /* tp_name */
sizeof (C_BezTriple), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor) BezTripleDeAlloc, /* tp_dealloc */
0, /* tp_print */
(getattrfunc) BezTripleGetAttr, /* tp_getattr */
(setattrfunc) BezTripleSetAttr, /* tp_setattr */
0, /* tp_compare */
(reprfunc) BezTripleRepr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_as_hash */
0, 0, 0, 0, 0, 0,
0, /* tp_doc */
0, 0, 0, 0, 0, 0,
C_BezTriple_methods, /* tp_methods */
0, /* tp_members */
0, /* tm_getset */
0
};
/*****************************************************************************/
/* Function: M_BezTriple_New */
/* Python equivalent: Blender.BezTriple.New */
/*****************************************************************************/
static PyObject *M_BezTriple_New(PyObject *self, PyObject *args)
static PyObject *
M_BezTriple_New (PyObject * self, PyObject * args)
{
return 0;
return 0;
}
/*****************************************************************************/
@@ -48,60 +138,83 @@ static PyObject *M_BezTriple_New(PyObject *self, PyObject *args)
/* passed in, a list of all ipo data names in the */
/* current scene is returned. */
/*****************************************************************************/
static PyObject *M_BezTriple_Get(PyObject *self, PyObject *args)
static PyObject *
M_BezTriple_Get (PyObject * self, PyObject * args)
{
return 0;
return 0;
}
/*****************************************************************************/
/* Function: BezTripleDeAlloc */
/* Description: This is a callback function for the C_BezTriple type. It is */
/* the destructor function. */
/*****************************************************************************/
static void BezTripleDeAlloc (C_BezTriple *self)
static void
BezTripleDeAlloc (C_BezTriple * self)
{
PyObject_DEL (self);
}
static PyObject* BezTriple_getPoints (C_BezTriple *self)
{
struct BezTriple *bezt = self->beztriple;
PyObject* l = PyList_New(0);
int i;
for(i = 0;i<2;i++)
{
PyList_Append( l, PyFloat_FromDouble(bezt->vec[1][i]));
}
static PyObject *
BezTriple_getPoints (C_BezTriple * self)
{
struct BezTriple *bezt = self->beztriple;
PyObject *l = PyList_New (0);
int i;
for (i = 0; i < 2; i++)
{
PyList_Append (l, PyFloat_FromDouble (bezt->vec[1][i]));
}
return l;
}
static PyObject * BezTriple_setPoints (C_BezTriple *self,PyObject *args)
{
static PyObject *
BezTriple_getTriple (C_BezTriple * self)
{
int i;
struct BezTriple *bezt = self->beztriple;
PyObject *retlist = PyList_New (0);
PyObject *point;
int i;
struct BezTriple *bezt = self->beztriple;
PyObject*popo = 0;
if (!PyArg_ParseTuple(args, "O", &popo))
return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected tuple argument"));
if ( PyTuple_Check(popo) == 0)
{
puts("error in BezTriple_setPoints");
Py_INCREF(Py_None);
return Py_None;
}
for(i = 0;i<2;i++)
{
bezt->vec[1][i] = PyFloat_AsDouble(PyTuple_GetItem(popo, i));
bezt->vec[0][i] = bezt->vec[1][i] -1;
bezt->vec[2][i] = bezt->vec[1][i] +1;
}
for (i = 0; i < 3; i++)
{
point = Py_BuildValue ("[fff]",
bezt->vec[i][0],
bezt->vec[i][1], bezt->vec[i][2]);
PyList_Append (retlist, point);
}
return retlist;
}
Py_INCREF(Py_None);
static PyObject *
BezTriple_setPoints (C_BezTriple * self, PyObject * args)
{
int i;
struct BezTriple *bezt = self->beztriple;
PyObject *popo = 0;
if (!PyArg_ParseTuple (args, "O", &popo))
return (EXPP_ReturnPyObjError
(PyExc_TypeError, "expected tuple argument"));
if (PyTuple_Check (popo) == 0)
{
puts ("error in BezTriple_setPoints");
Py_INCREF (Py_None);
return Py_None;
}
for (i = 0; i < 2; i++)
{
bezt->vec[1][i] = PyFloat_AsDouble (PyTuple_GetItem (popo, i));
bezt->vec[0][i] = bezt->vec[1][i] - 1;
bezt->vec[2][i] = bezt->vec[1][i] + 1;
}
Py_INCREF (Py_None);
return Py_None;
}
@@ -112,10 +225,12 @@ static PyObject * BezTriple_setPoints (C_BezTriple *self,PyObject *args)
/* the function that accesses C_BezTriple "member variables" and */
/* methods. */
/*****************************************************************************/
static PyObject *BezTripleGetAttr (C_BezTriple *self, char *name)
static PyObject *
BezTripleGetAttr (C_BezTriple * self, char *name)
{
if (strcmp (name, "pt") == 0)return BezTriple_getPoints(self);
return Py_FindMethod(C_BezTriple_methods, (PyObject *)self, name);
if (strcmp (name, "pt") == 0)
return BezTriple_getPoints (self);
return Py_FindMethod (C_BezTriple_methods, (PyObject *) self, name);
}
/*****************************************************************************/
@@ -123,10 +238,12 @@ if (strcmp (name, "pt") == 0)return BezTriple_getPoints(self);
/* Description: This is a callback function for the C_BezTriple type. It is the */
/* function that sets BezTriple Data attributes (member variables).*/
/*****************************************************************************/
static int BezTripleSetAttr (C_BezTriple *self, char *name, PyObject *value)
static int
BezTripleSetAttr (C_BezTriple * self, char *name, PyObject * value)
{
if (strcmp (name, "pt") == 0) BezTriple_setPoints(self,value);
return 0; /* normal exit */
if (strcmp (name, "pt") == 0)
BezTriple_setPoints (self, value);
return 0; /* normal exit */
}
/*****************************************************************************/
@@ -134,17 +251,29 @@ static int BezTripleSetAttr (C_BezTriple *self, char *name, PyObject *value)
/* Description: This is a callback function for the C_BezTriple type. It */
/* builds a meaninful string to represent BezTriple objects. */
/*****************************************************************************/
static PyObject *BezTripleRepr (C_BezTriple *self)
static PyObject *
BezTripleRepr (C_BezTriple * self)
{
/* float vec[3][3];
float alfa;
short s[3][2];
short h1, h2;
char f1, f2, f3, hide;
*/
char str[1000];
sprintf(str,"BezTriple %f %f %f %f %f %f %f %f %f %f\n %d %d %d %d %d %d %d %d %d %d %d %d\n",self->beztriple->vec[0][0],self->beztriple->vec[0][1],self->beztriple->vec[0][2],self->beztriple->vec[1][0],self->beztriple->vec[1][1],self->beztriple->vec[1][2],self->beztriple->vec[2][0],self->beztriple->vec[2][1],self->beztriple->vec[2][2],self->beztriple->alfa,self->beztriple->s[0][0],self->beztriple->s[0][1],self->beztriple->s[1][0],self->beztriple->s[1][1],self->beztriple->s[2][0],self->beztriple->s[1][1],self->beztriple->h1,self->beztriple->h2,self->beztriple->f1,self->beztriple->f2,self->beztriple->f3,self->beztriple->hide);
return PyString_FromString(str);
/* float vec[3][3];
float alfa;
short s[3][2];
short h1, h2;
char f1, f2, f3, hide;
*/
char str[1000];
sprintf (str,
"BezTriple %f %f %f %f %f %f %f %f %f %f\n %d %d %d %d %d %d %d %d %d %d %d %d\n",
self->beztriple->vec[0][0], self->beztriple->vec[0][1],
self->beztriple->vec[0][2], self->beztriple->vec[1][0],
self->beztriple->vec[1][1], self->beztriple->vec[1][2],
self->beztriple->vec[2][0], self->beztriple->vec[2][1],
self->beztriple->vec[2][2], self->beztriple->alfa,
self->beztriple->s[0][0], self->beztriple->s[0][1],
self->beztriple->s[1][0], self->beztriple->s[1][1],
self->beztriple->s[2][0], self->beztriple->s[1][1],
self->beztriple->h1, self->beztriple->h2, self->beztriple->f1,
self->beztriple->f2, self->beztriple->f3, self->beztriple->hide);
return PyString_FromString (str);
}
/* Three Python BezTriple_Type helper functions needed by the Object module: */
@@ -154,19 +283,20 @@ static PyObject *BezTripleRepr (C_BezTriple *self)
/* Description: This function will create a new C_BezTriple from an existing */
/* Blender ipo structure. */
/*****************************************************************************/
PyObject *BezTriple_CreatePyObject (BezTriple *bzt)
PyObject *
BezTriple_CreatePyObject (BezTriple * bzt)
{
C_BezTriple *pybeztriple;
C_BezTriple *pybeztriple;
pybeztriple = (C_BezTriple *)PyObject_NEW (C_BezTriple, &BezTriple_Type);
pybeztriple = (C_BezTriple *) PyObject_NEW (C_BezTriple, &BezTriple_Type);
if (!pybeztriple)
return EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create C_BezTriple object");
if (!pybeztriple)
return EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create C_BezTriple object");
pybeztriple->beztriple = bzt;
pybeztriple->beztriple = bzt;
return (PyObject *)pybeztriple;
return (PyObject *) pybeztriple;
}
/*****************************************************************************/
@@ -174,9 +304,10 @@ PyObject *BezTriple_CreatePyObject (BezTriple *bzt)
/* Description: This function returns true when the given PyObject is of the */
/* type BezTriple. Otherwise it will return false. */
/*****************************************************************************/
int BezTriple_CheckPyObject (PyObject *pyobj)
int
BezTriple_CheckPyObject (PyObject * pyobj)
{
return (pyobj->ob_type == &BezTriple_Type);
return (pyobj->ob_type == &BezTriple_Type);
}
/*****************************************************************************/
@@ -184,7 +315,8 @@ int BezTriple_CheckPyObject (PyObject *pyobj)
/* Description: This function returns the Blender beztriple from the given */
/* PyObject. */
/*****************************************************************************/
BezTriple *BezTriple_FromPyObject (PyObject *pyobj)
BezTriple *
BezTriple_FromPyObject (PyObject * pyobj)
{
return ((C_BezTriple *)pyobj)->beztriple;
return ((C_BezTriple *) pyobj)->beztriple;
}

View File

@@ -33,98 +33,17 @@
#define EXPP_BEZTRIPLE_H
#include <Python.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <DNA_ipo_types.h>
#include "constant.h"
#include "gen_utils.h"
#include "modules.h"
/*****************************************************************************/
/* Python API function prototypes for the BezTriple module. */
/*****************************************************************************/
static PyObject *M_BezTriple_New (PyObject *self, PyObject *args);
static PyObject *M_BezTriple_Get (PyObject *self, PyObject *args);
/*****************************************************************************/
/* Python method structure definition for Blender.BezTriple module: */
/*****************************************************************************/
struct PyMethodDef M_BezTriple_methods[] = {
{"New",(PyCFunction)M_BezTriple_New, METH_VARARGS|METH_KEYWORDS,0},
{"Get", M_BezTriple_Get, METH_VARARGS, 0},
{"get", M_BezTriple_Get, METH_VARARGS, 0},
{NULL, NULL, 0, NULL}
};
#include <DNA_curve_types.h>
/*****************************************************************************/
/* Python C_BezTriple structure definition: */
/*****************************************************************************/
typedef struct {
PyObject_HEAD
BezTriple *beztriple;
} C_BezTriple;
/*****************************************************************************/
/* Python C_BezTriple methods declarations: */
/*****************************************************************************/
static PyObject *BezTriple_setPoints(C_BezTriple *self, PyObject *args);
static PyObject *BezTriple_getPoints(C_BezTriple *self);
/*****************************************************************************/
/* Python C_BezTriple methods table: */
/*****************************************************************************/
static PyMethodDef C_BezTriple_methods[] = {
/* name, method, flags, doc */
{"setPoints", (PyCFunction)BezTriple_setPoints, METH_VARARGS,
"(str) - Change BezTriple point coordinates"},
{"getPoints", (PyCFunction)BezTriple_getPoints, METH_NOARGS,
"(str) - Change BezTriple point coordinates"},
{0}
};
/*****************************************************************************/
/* Python BezTriple_Type callback function prototypes: */
/*****************************************************************************/
static void BezTripleDeAlloc (C_BezTriple *self);
static int BezTripleSetAttr (C_BezTriple *self, char *name, PyObject *v);
static PyObject *BezTripleGetAttr (C_BezTriple *self, char *name);
static PyObject *BezTripleRepr (C_BezTriple *self);
/*****************************************************************************/
/* Python BezTriple_Type structure definition: */
/*****************************************************************************/
PyTypeObject BezTriple_Type =
typedef struct
{
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
"BezTriple", /* tp_name */
sizeof (C_BezTriple), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)BezTripleDeAlloc, /* tp_dealloc */
0, /* tp_print */
(getattrfunc)BezTripleGetAttr, /* tp_getattr */
(setattrfunc)BezTripleSetAttr, /* tp_setattr */
0, /* tp_compare */
(reprfunc)BezTripleRepr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_as_hash */
0,0,0,0,0,0,
0, /* tp_doc */
0,0,0,0,0,0,
C_BezTriple_methods, /* tp_methods */
0, /* tp_members */
};
PyObject_HEAD BezTriple * beztriple;
}
C_BezTriple;
#endif /* EXPP_BEZTRIPLE_H */

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@
*
* This is a new part of Blender.
*
* Contributor(s): Jacques Guignot
* Contributor(s): Jacques Guignot, Stephen Swaney
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -32,197 +32,6 @@
#ifndef EXPP_CURVE_H
#define EXPP_CURVE_H
#include <Python.h>
#include <stdio.h>
#include <BLI_arithb.h>
#include <BLI_blenlib.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BKE_curve.h>
#include "gen_utils.h"
#include "bpy_types.h"
/*****************************************************************************/
/* Python API function prototypes for the Curve module. */
/*****************************************************************************/
static PyObject *M_Curve_New (PyObject *self, PyObject *args);
static PyObject *M_Curve_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.Curve.__doc__ */
/*****************************************************************************/
char M_Curve_doc[] = "The Blender Curve module\n\n\
This module provides access to **Curve Data** in Blender.\n\
Functions :\n\
New(opt name) : creates a new curve object with the given name (optional)\n\
Get(name) : retreives a curve with the given name (mandatory)\n\
get(name) : same as Get. Kept for compatibility reasons";
char M_Curve_New_doc[] ="";
char M_Curve_Get_doc[] ="xxx";
/*****************************************************************************/
/* Python method structure definition for Blender.Curve module: */
/*****************************************************************************/
struct PyMethodDef M_Curve_methods[] = {
{"New",(PyCFunction)M_Curve_New, METH_VARARGS,M_Curve_New_doc},
{"Get", M_Curve_Get, METH_VARARGS, M_Curve_Get_doc},
{"get", M_Curve_Get, METH_VARARGS, M_Curve_Get_doc},
{NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Python BPy_Curve methods declarations: */
/*****************************************************************************/
static PyObject *Curve_getName(BPy_Curve *self);
static PyObject *Curve_setName(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getPathLen(BPy_Curve *self);
static PyObject *Curve_setPathLen(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getTotcol(BPy_Curve *self);
static PyObject *Curve_setTotcol(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getMode(BPy_Curve *self);
static PyObject *Curve_setMode(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getBevresol(BPy_Curve *self);
static PyObject *Curve_setBevresol(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getResolu(BPy_Curve *self);
static PyObject *Curve_setResolu(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getResolv(BPy_Curve *self);
static PyObject *Curve_setResolv(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getWidth(BPy_Curve *self);
static PyObject *Curve_setWidth(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getExt1(BPy_Curve *self);
static PyObject *Curve_setExt1(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getExt2(BPy_Curve *self);
static PyObject *Curve_setExt2(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getControlPoint(BPy_Curve *self, PyObject *args);
static PyObject *Curve_setControlPoint(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getLoc(BPy_Curve *self);
static PyObject *Curve_setLoc(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getRot(BPy_Curve *self);
static PyObject *Curve_setRot(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getSize(BPy_Curve *self);
static PyObject *Curve_setSize(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getNumCurves(BPy_Curve *self);
static PyObject *Curve_isNurb( BPy_Curve *self, PyObject *args );
static PyObject *Curve_getNumPoints(BPy_Curve *self, PyObject *args);
static PyObject *Curve_getNumPoints(BPy_Curve *self, PyObject *args);
/*****************************************************************************/
/* Python BPy_Curve methods table: */
/*****************************************************************************/
static PyMethodDef BPy_Curve_methods[] = {
{"getName", (PyCFunction)Curve_getName,
METH_NOARGS,"() - Return Curve Data name"},
{"setName", (PyCFunction)Curve_setName,
METH_VARARGS,"() - Sets Curve Data name"},
{"getPathLen", (PyCFunction)Curve_getPathLen,
METH_NOARGS,"() - Return Curve path length"},
{"setPathLen", (PyCFunction)Curve_setPathLen,
METH_VARARGS,"(int) - Sets Curve path length"},
{"getTotcol", (PyCFunction)Curve_getTotcol,
METH_NOARGS,"() - Return the number of materials of the curve"},
{"setTotcol", (PyCFunction)Curve_setTotcol,
METH_VARARGS,"(int) - Sets the number of materials of the curve"},
{"getFlag", (PyCFunction)Curve_getMode,
METH_NOARGS,"() - Return flag (see the doc for semantic)"},
{"setFlag", (PyCFunction)Curve_setMode,
METH_VARARGS,"(int) - Sets flag (see the doc for semantic)"},
{"getBevresol", (PyCFunction)Curve_getBevresol,
METH_NOARGS,"() - Return bevel resolution"},
{"setBevresol", (PyCFunction)Curve_setBevresol,
METH_VARARGS,"(int) - Sets bevel resolution"},
{"getResolu", (PyCFunction)Curve_getResolu,
METH_NOARGS,"() - Return U resolution"},
{"setResolu", (PyCFunction)Curve_setResolu,
METH_VARARGS,"(int) - Sets U resolution"},
{"getResolv", (PyCFunction)Curve_getResolv,
METH_NOARGS,"() - Return V resolution"},
{"setResolv", (PyCFunction)Curve_setResolv,
METH_VARARGS,"(int) - Sets V resolution"},
{"getWidth", (PyCFunction)Curve_getWidth,
METH_NOARGS,"() - Return curve width"},
{"setWidth", (PyCFunction)Curve_setWidth,
METH_VARARGS,"(int) - Sets curve width"},
{"getExt1", (PyCFunction)Curve_getExt1,
METH_NOARGS,"() - Returns extent 1 of the bevel"},
{"setExt1", (PyCFunction)Curve_setExt1,
METH_VARARGS,"(int) - Sets extent 1 of the bevel"},
{"getExt2", (PyCFunction)Curve_getExt2,
METH_NOARGS,"() - Return extent 2 of the bevel "},
{"setExt2", (PyCFunction)Curve_setExt2,
METH_VARARGS,"(int) - Sets extent 2 of the bevel "},
{"getControlPoint", (PyCFunction)Curve_getControlPoint,
METH_VARARGS,"(int numcurve,int numpoint) -\
Gets a control point.Depending upon the curve type, returne a list of 4 or 9 floats"},
{"setControlPoint", (PyCFunction)Curve_setControlPoint,
METH_VARARGS,"(int numcurve,int numpoint,float x,float y,float z,\
loat w)(nurbs) or (int numcurve,int numpoint,float x1,...,x9(bezier)\
Sets a control point "},
{"getLoc", (PyCFunction)Curve_getLoc,
METH_NOARGS,"() - Gets Location of the curve (a 3-tuple) "},
{"setLoc", (PyCFunction)Curve_setLoc,
METH_VARARGS,"(3-tuple) - Sets Location "},
{"getRot", (PyCFunction)Curve_getRot,
METH_NOARGS,"() - Gets curve rotation"},
{"setRot", (PyCFunction)Curve_setRot,
METH_VARARGS,"(3-tuple) - Sets curve rotation"},
{"getSize", (PyCFunction)Curve_getSize,
METH_NOARGS,"() - Gets curve size"},
{"setSize", (PyCFunction)Curve_setSize,
METH_VARARGS,"(3-tuple) - Sets curve size"},
{"getNumCurves", (PyCFunction)Curve_getNumCurves,
METH_NOARGS,"() - Gets # of curves"},
{"isNurb", (PyCFunction)Curve_isNurb,
METH_VARARGS,"(nothing or integer) - returns 1 or 0, depending upon the curve being a Nurb"},
{"getNumPoints", (PyCFunction)Curve_getNumPoints,
METH_VARARGS,"(nothing or integer) - returns the number of points of the specified curve"},
{0}
};
/*****************************************************************************/
/* Python Curve_Type callback function prototypes: */
/*****************************************************************************/
static void CurveDeAlloc (BPy_Curve *msh);
//static int CurvePrint (BPy_Curve *msh, FILE *fp, int flags);
static int CurveSetAttr (BPy_Curve *msh, char *name, PyObject *v);
static PyObject *CurveGetAttr (BPy_Curve *msh, char *name);
static PyObject *CurveRepr (BPy_Curve *msh);
// PyObject* Curve_CreatePyObject (struct Curve *curve);
//int Curve_CheckPyObject (PyObject *py_obj);
//struct Curve* Curve_FromPyObject (PyObject *py_obj);
/*****************************************************************************/
/* Python Curve_Type structure definition: */
/*****************************************************************************/
PyTypeObject Curve_Type =
{
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
"Curve", /* tp_name */
sizeof (BPy_Curve), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)CurveDeAlloc, /* tp_dealloc */
0, /* tp_print */
(getattrfunc)CurveGetAttr, /* tp_getattr */
(setattrfunc)CurveSetAttr, /* tp_setattr */
0, /* tp_compare */
(reprfunc)CurveRepr, /* 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_Curve_methods, /* tp_methods */
0, /* tp_members */
};
#include <bpy_types.h>
#endif /* EXPP_CURVE_H */

File diff suppressed because it is too large Load Diff

View File

@@ -33,298 +33,51 @@
* bpython/intern dir, with minor modifications to suit the current
* implementation. Important original comments are marked with an @ symbol. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef EXPP_DRAW_H_
#define EXPP_DRAW_H_
#ifdef WIN32
#include "BLI_winstuff.h"
#endif
#include "MEM_guardedalloc.h"
#include "BMF_Api.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_text_types.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_object.h"
#include "BIF_gl.h"
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_interface.h"
#include "BIF_mywindow.h"
#include "BPI_script.h" /* script struct */
#include "interface.h"
#include "mydevice.h" /*@ for all the event constants */
#include "Python.h"
#include "gen_utils.h"
#include "modules.h"
/*@ hack to flag that window redraw has happened inside slider callback: */
int EXPP_disable_force_draw = 0;
/* From Window.h, used here by py_slider_update() */
PyObject *M_Window_Redraw(PyObject *self, PyObject *args);
PyObject *M_Window_Redraw (PyObject * self, PyObject * args);
/* This one was an extern in BPY_main.h, but only opy_draw.c was using it */
int g_window_redrawn;
static char Draw_doc[] =
"The Blender.Draw submodule";
static uiBlock *Get_uiBlock (void);
void initDraw (void);
/* Button Object */
/*
* Button Object stuct
*/
typedef struct _Button {
PyObject_VAR_HEAD
int type; /*@ 1 == int, 2 == float, 3 == string */
int slen; /*@ length of string (if type == 3) */
union {
typedef struct _Button
{
PyObject_VAR_HEAD /* required Py Macro */
int type; /*@ 1 == int, 2 == float, 3 == string */
int slen; /*@ length of string (if type == 3) */
union
{
int asint;
float asfloat;
char *asstr;
} val;
} Button;
}
val;
char *tooltip;
}
Button;
static void Button_dealloc(PyObject *self);
static PyObject *Button_getattr(PyObject *self, char *name);
static PyObject *Button_repr(PyObject *self);
static int Button_setattr(PyObject *self, char *name, PyObject *v);
PyTypeObject Button_Type =
{
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"Button", /*tp_name*/
sizeof(Button), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor) Button_dealloc, /*tp_dealloc*/
(printfunc) 0, /*tp_print*/
(getattrfunc) Button_getattr, /*tp_getattr*/
(setattrfunc) Button_setattr, /*tp_setattr*/
(cmpfunc) 0, /*tp_cmp*/
(reprfunc) Button_repr, /*tp_repr*/
};
/*
* these are declared in ../BPY_extern.h
*/
void BPY_spacescript_do_pywin_draw (SpaceScript * sc);
void BPY_spacescript_do_pywin_event (SpaceScript * sc,
unsigned short event, short val);
void BPY_free_compiled_text (Text * text);
static Button *newbutton (void);
/* GUI interface routines */
static void exit_pydraw(SpaceScript *sc, short error);
static void exec_callback(SpaceScript *sc, PyObject *callback, PyObject *args);
/* these are declared in ../BPY_extern.h */
void BPY_spacescript_do_pywin_draw(SpaceScript *sc);
static void spacescript_do_pywin_buttons(SpaceScript *sc, unsigned short event);
void BPY_spacescript_do_pywin_event(SpaceScript *sc, unsigned short event, short val);
void BPY_free_compiled_text(Text *text);
static char Method_Exit_doc[] =
"() - Exit the windowing interface";
static PyObject *Method_Exit (PyObject *self, PyObject *args);
static char Method_Register_doc[] =
"(draw, event, button) - Register callbacks for windowing\n\n\
(draw) A function to draw the screen, taking no arguments\n\
(event) A function to handle events, taking 2 arguments (evt, val)\n\
(evt) The event number\n\
(val) The value modifier (for key and mouse press/release)\n\
(button) A function to handle button events, taking 1 argument (evt)\n\
(evt) The button number\n\n\
A None object can be passed if a callback is unused.";
static PyObject *Method_Register (PyObject *self, PyObject *args);
static char Method_Redraw_doc[] =
"([after]) - Queue a redraw event\n\n\
[after=0] Determines whether the redraw is processed before\n\
or after other input events.\n\n\
Redraw events are buffered so that regardless of how many events\n\
are queued the window only receives one redraw event.";
static PyObject *Method_Redraw (PyObject *self, PyObject *args);
static char Method_Draw_doc[] =
"() - Force an immediate redraw\n\n\
Forced redraws are not buffered, in other words the window is redrawn\n\
exactly once for everytime this function is called.";
static PyObject *Method_Draw (PyObject *self, PyObject *args);
static char Method_Create_doc[] =
"(value) - Create a default Button object\n\n\
(value) - The value to store in the button\n\n\
Valid values are ints, floats, and strings";
static PyObject *Method_Create (PyObject *self, PyObject *args);
static uiBlock *Get_uiBlock(void);
static char Method_Button_doc[] =
"(name, event, x, y, width, height, [tooltip]) - Create a new Button \
(push) button\n\n\
(name) A string to display on the button\n\
(event) The event number to pass to the button event function when activated\n\
(x, y) The lower left coordinate of the button\n\
(width, height) The button width and height\n\
[tooltip=""] The button's tooltip";
static PyObject *Method_Button (PyObject *self, PyObject *args);
static char Method_Menu_doc[] =
"(name, event, x, y, width, height, default, [tooltip]) - Create a new Menu \
button\n\n\
(name) A string to display on the button\n\
(event) The event number to pass to the button event function when activated\n\
(x, y) The lower left coordinate of the button\n\
(width, height) The button width and height\n\
(default) The number of the option to be selected by default\n\
[tooltip=""] The button's tooltip\n\n\
The menu options are specified through the name of the\n\
button. Options are followed by a format code and separated\n\
by the '|' (pipe) character.\n\
Valid format codes are\n\
%t - The option should be used as the title\n\
%xN - The option should set the integer N in the button value.";
static PyObject *Method_Menu (PyObject *self, PyObject *args);
static char Method_Toggle_doc[] =
"(name, event, x, y, width, height, default, [tooltip]) - Create a new Toggle \
button\n\n\
(name) A string to display on the button\n\
(event) The event number to pass to the button event function when activated\n\
(x, y) The lower left coordinate of the button\n\
(width, height) The button width and height\n\
(default) An integer (0 or 1) specifying the default state\n\
[tooltip=""] The button's tooltip";
static PyObject *Method_Toggle (PyObject *self, PyObject *args);
static void py_slider_update(void *butv, void *data2_unused);
static char Method_Slider_doc[] =
"(name, event, x, y, width, height, initial, min, max, [update, tooltip]) - \
Create a new Slider button\n\n\
(name) A string to display on the button\n\
(event) The event number to pass to the button event function when activated\n\
(x, y) The lower left coordinate of the button\n\
(width, height) The button width and height\n\
(initial, min, max) Three values (int or float) specifying the initial \
and limit values.\n\
[update=1] A value controlling whether the slider will emit events as it \
is edited.\n\
A non-zero value (default) enables the events. A zero value supresses them.\n\
[tooltip=""] The button's tooltip";
static PyObject *Method_Slider (PyObject *self, PyObject *args);
static char Method_Scrollbar_doc[] =
"(event, x, y, width, height, initial, min, max, [update, tooltip]) - Create a \
new Scrollbar\n\n\
(event) The event number to pass to the button event function when activated\n\
(x, y) The lower left coordinate of the button\n\
(width, height) The button width and height\n\
(initial, min, max) Three values (int or float) specifying the initial and limit values.\n\
[update=1] A value controlling whether the slider will emit events as it is edited.\n\
A non-zero value (default) enables the events. A zero value supresses them.\n\
[tooltip=""] The button's tooltip";
static PyObject *Method_Scrollbar (PyObject *self, PyObject *args);
static char Method_Number_doc[] =
"(name, event, x, y, width, height, initial, min, max, [tooltip]) - Create a \
new Number button\n\n\
(name) A string to display on the button\n\
(event) The event number to pass to the button event function when activated\n\
(x, y) The lower left coordinate of the button\n\
(width, height) The button width and height\n\
(initial, min, max) Three values (int or float) specifying the initial and \
limit values.\n\
[tooltip=""] The button's tooltip";
static PyObject *Method_Number (PyObject *self, PyObject *args);
static char Method_String_doc[] =
"(name, event, x, y, width, height, initial, length, [tooltip]) - Create a \
new String button\n\n\
(name) A string to display on the button\n\
(event) The event number to pass to the button event function when activated\n\
(x, y) The lower left coordinate of the button\n\
(width, height) The button width and height\n\
(initial) The string to display initially\n\
(length) The maximum input length\n\
[tooltip=""] The button's tooltip";
static PyObject *Method_String (PyObject *self, PyObject *args);
static char Method_GetStringWidth_doc[] =
"(text, font = 'normal') - Return the width in pixels of the given string\n\
(font) The font size: 'normal' (default), 'small' or 'tiny'.";
static char Method_Text_doc[] =
"(text, font = 'normal') - Draw text onscreen\n\n\
(text) The text to draw\n\
(font) The font size: 'normal' (default), 'small' or 'tiny'.\n\n\
NEW! - This function now returns the width of the drawn string.";
static PyObject *Method_GetStringWidth (PyObject *self, PyObject *args);
static PyObject *Method_Text (PyObject *self, PyObject *args);
static char Method_PupMenu_doc[] =
"(string, maxrow = None) - Display a pop-up menu at the screen.\n\
The contents of the pop-up are specified through the 'string' argument,\n\
like with Draw.Menu.\n\
'maxrow' is an optional int to control how many rows the pop-up should have.\n\
Options are followed by a format code and separated\n\
by the '|' (pipe) character.\n\
Valid format codes are\n\
%t - The option should be used as the title\n\
%xN - The option should set the integer N in the button value.\n\n\
Ex: Draw.PupMenu('OK?%t|QUIT BLENDER') # should be familiar ...";
static PyObject *Method_PupMenu (PyObject *self, PyObject *args);
#define _MethodDef(func, prefix) \
{#func, prefix##_##func, METH_VARARGS, prefix##_##func##_doc}
/* So that _MethodDef(delete, Scene) expands to:
* {"delete", Scene_delete, METH_VARARGS, Scene_delete_doc} */
#undef MethodDef
#define MethodDef(func) _MethodDef(func, Method)
static struct PyMethodDef Draw_methods[] = {
MethodDef(Create),
MethodDef(Button),
MethodDef(Toggle),
MethodDef(Menu),
MethodDef(Slider),
MethodDef(Scrollbar),
MethodDef(Number),
MethodDef(String),
MethodDef(GetStringWidth),
MethodDef(Text),
MethodDef(PupMenu),
MethodDef(Exit),
MethodDef(Redraw),
MethodDef(Draw),
MethodDef(Register),
{NULL, NULL}
};
PyObject *M_Draw_Init (void);
PyObject *M_Draw_Init (void);
#endif /* EXPP_DRAW_H */

File diff suppressed because it is too large Load Diff

View File

@@ -33,157 +33,17 @@
#define EXPP_IPO_H
#include <Python.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <DNA_ipo_types.h>
#include "constant.h"
#include "gen_utils.h"
#include "modules.h"
/*****************************************************************************/
/* Python API function prototypes for the Ipo module. */
/*****************************************************************************/
static PyObject *M_Ipo_New (PyObject *self, PyObject *args);
static PyObject *M_Ipo_Get (PyObject *self, PyObject *args);
static PyObject *M_Ipo_Recalc (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.Ipo.__doc__ */
/*****************************************************************************/
char M_Ipo_doc[] = "";
char M_Ipo_New_doc[] ="";
char M_Ipo_Get_doc[] ="";
/*****************************************************************************/
/* Python method structure definition for Blender.Ipo module: */
/*****************************************************************************/
struct PyMethodDef M_Ipo_methods[] = {
{"New",(PyCFunction)M_Ipo_New, METH_VARARGS|METH_KEYWORDS,M_Ipo_New_doc},
{"Get", M_Ipo_Get, METH_VARARGS, M_Ipo_Get_doc},
{"get", M_Ipo_Get, METH_VARARGS, M_Ipo_Get_doc},
{"Recalc", M_Ipo_Recalc, METH_VARARGS, M_Ipo_Get_doc},
{NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Python BPy_Ipo structure definition: */
/*****************************************************************************/
typedef struct {
PyObject_HEAD
Ipo *ipo;
} BPy_Ipo;
/*****************************************************************************/
/* Python BPy_Ipo methods declarations: */
/*****************************************************************************/
static PyObject *Ipo_getName(BPy_Ipo *self);
static PyObject *Ipo_setName(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_getBlocktype(BPy_Ipo *self);
static PyObject *Ipo_setBlocktype(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_getRctf(BPy_Ipo *self);
static PyObject *Ipo_setRctf(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_getCurve(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_getCurves(BPy_Ipo *self);
static PyObject *Ipo_addCurve(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_getNcurves(BPy_Ipo *self);
static PyObject *Ipo_getNBezPoints(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_DeleteBezPoints(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_getCurveBP(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_getCurvecurval(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_EvaluateCurveOn(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_setCurveBeztriple(BPy_Ipo *self, PyObject *args);
static PyObject *Ipo_getCurveBeztriple(BPy_Ipo *self, PyObject *args);
/*****************************************************************************/
/* Python BPy_Ipo methods table: */
/*****************************************************************************/
static PyMethodDef BPy_Ipo_methods[] = {
/* name, method, flags, doc */
{"getName", (PyCFunction)Ipo_getName, METH_NOARGS,
"() - Return Ipo Data name"},
{"setName", (PyCFunction)Ipo_setName, METH_VARARGS,
"(str) - Change Ipo Data name"},
{"getBlocktype", (PyCFunction)Ipo_getBlocktype, METH_NOARGS,
"() - Return Ipo blocktype -"},
{"setBlocktype", (PyCFunction)Ipo_setBlocktype, METH_VARARGS,
"(str) - Change Ipo blocktype"},
{"getRctf", (PyCFunction)Ipo_getRctf, METH_NOARGS,
"() - Return Ipo rctf - "},
{"setRctf", (PyCFunction)Ipo_setRctf, METH_VARARGS,
"(str) - Change Ipo rctf"},
{"addCurve", (PyCFunction)Ipo_addCurve, METH_VARARGS,
"() - Return Ipo ncurves"},
{"getNcurves", (PyCFunction)Ipo_getNcurves, METH_NOARGS,
"() - Return Ipo ncurves"},
{"getNBezPoints", (PyCFunction)Ipo_getNBezPoints, METH_VARARGS,
"() - Return curve number of Bez points"},
{"delBezPoint", (PyCFunction)Ipo_DeleteBezPoints, METH_VARARGS,
"() - Return curve number of Bez points"},
{"getCurveBP", (PyCFunction)Ipo_getCurveBP, METH_VARARGS,
"() - Return Ipo ncurves"},
{"EvaluateCurveOn", (PyCFunction)Ipo_EvaluateCurveOn, METH_VARARGS,
"() - Return curve value at given time"},
{"getCurveCurval", (PyCFunction)Ipo_getCurvecurval, METH_VARARGS,
"() - Return curval"},
{"getCurveBeztriple", (PyCFunction)Ipo_getCurveBeztriple, METH_VARARGS,
"() - Return Ipo ncurves"},
{"setCurveBeztriple", (PyCFunction)Ipo_setCurveBeztriple, METH_VARARGS,
"() - Return curval"},
{"getCurves", (PyCFunction)Ipo_getCurves, METH_NOARGS,
"() - Return curval"},
{"getCurve", (PyCFunction)Ipo_getCurve, METH_VARARGS,
"() - Return curval"},
{0}
};
/*****************************************************************************/
/* Python Ipo_Type callback function prototypes: */
/*****************************************************************************/
static void IpoDeAlloc (BPy_Ipo *self);
//static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags);
static int IpoSetAttr (BPy_Ipo *self, char *name, PyObject *v);
static PyObject *IpoGetAttr (BPy_Ipo *self, char *name);
static PyObject *IpoRepr (BPy_Ipo *self);
/*****************************************************************************/
/* Python Ipo_Type structure definition: */
/*****************************************************************************/
PyTypeObject Ipo_Type =
typedef struct
{
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
"Ipo", /* tp_name */
sizeof (BPy_Ipo), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)IpoDeAlloc, /* tp_dealloc */
0, /* tp_print */
(getattrfunc)IpoGetAttr, /* tp_getattr */
(setattrfunc)IpoSetAttr, /* tp_setattr */
0, /* tp_compare */
(reprfunc)IpoRepr, /* 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_Ipo_methods, /* tp_methods */
0, /* tp_members */
};
PyObject_HEAD /* required macro */
Ipo * ipo;
}
BPy_Ipo;
#endif /* EXPP_IPO_H */

View File

@@ -31,28 +31,146 @@
#include "Ipocurve.h"
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include "constant.h"
#include "gen_utils.h"
#include "modules.h"
/*****************************************************************************/
/* Python API function prototypes for the IpoCurve module. */
/*****************************************************************************/
static PyObject *M_IpoCurve_New (PyObject * self, PyObject * args);
static PyObject *M_IpoCurve_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.IpoCurve.__doc__ */
/*****************************************************************************/
char M_IpoCurve_doc[] = "";
char M_IpoCurve_New_doc[] = "";
char M_IpoCurve_Get_doc[] = "";
/*****************************************************************************/
/* Python method structure definition for Blender.IpoCurve module: */
/*****************************************************************************/
struct PyMethodDef M_IpoCurve_methods[] = {
{"New", (PyCFunction) M_IpoCurve_New, METH_VARARGS | METH_KEYWORDS,
M_IpoCurve_New_doc},
{"Get", M_IpoCurve_Get, METH_VARARGS, M_IpoCurve_Get_doc},
{"get", M_IpoCurve_Get, METH_VARARGS, M_IpoCurve_Get_doc},
{NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Python C_IpoCurve methods declarations: */
/*****************************************************************************/
static PyObject *IpoCurve_getName (C_IpoCurve * self);
static PyObject *IpoCurve_Recalc (C_IpoCurve * self);
static PyObject *IpoCurve_setName (C_IpoCurve * self, PyObject * args);
static PyObject *IpoCurve_addBezier (C_IpoCurve * self, PyObject * args);
static PyObject *IpoCurve_setInterpolation (C_IpoCurve * self,
PyObject * args);
static PyObject *IpoCurve_getInterpolation (C_IpoCurve * self);
static PyObject *IpoCurve_setExtrapolation (C_IpoCurve * self,
PyObject * args);
static PyObject *IpoCurve_getExtrapolation (C_IpoCurve * self);
static PyObject *IpoCurve_getPoints (C_IpoCurve * self);
/*****************************************************************************/
/* Python C_IpoCurve methods table: */
/*****************************************************************************/
static PyMethodDef C_IpoCurve_methods[] = {
/* name, method, flags, doc */
{"getName", (PyCFunction) IpoCurve_getName, METH_NOARGS,
"() - Return IpoCurve Data name"},
{"Recalc", (PyCFunction) IpoCurve_Recalc, METH_NOARGS,
"() - Return IpoCurve Data name"},
{"update", (PyCFunction) IpoCurve_Recalc, METH_NOARGS,
"() - Return IpoCurve Data name"},
{"setName", (PyCFunction) IpoCurve_setName, METH_VARARGS,
"(str) - Change IpoCurve Data name"},
{"addBezier", (PyCFunction) IpoCurve_addBezier, METH_VARARGS,
"(str) - Change IpoCurve Data name"},
{"setInterpolation", (PyCFunction) IpoCurve_setInterpolation, METH_VARARGS,
"(str) - Change IpoCurve Data name"},
{"getInterpolation", (PyCFunction) IpoCurve_getInterpolation, METH_NOARGS,
"(str) - Change IpoCurve Data name"},
{"setExtrapolation", (PyCFunction) IpoCurve_setExtrapolation, METH_VARARGS,
"(str) - Change IpoCurve Data name"},
{"getExtrapolation", (PyCFunction) IpoCurve_getExtrapolation, METH_NOARGS,
"(str) - Change IpoCurve Data name"},
{"getPoints", (PyCFunction) IpoCurve_getPoints, METH_NOARGS,
"(str) - Change IpoCurve Data name"},
{NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Python IpoCurve_Type callback function prototypes: */
/*****************************************************************************/
static void IpoCurveDeAlloc (C_IpoCurve * self);
//static int IpoCurvePrint (C_IpoCurve *self, FILE *fp, int flags);
static int IpoCurveSetAttr (C_IpoCurve * self, char *name, PyObject * v);
static PyObject *IpoCurveGetAttr (C_IpoCurve * self, char *name);
static PyObject *IpoCurveRepr (C_IpoCurve * self);
/*****************************************************************************/
/* Python IpoCurve_Type structure definition: */
/*****************************************************************************/
PyTypeObject IpoCurve_Type = {
PyObject_HEAD_INIT (NULL) /* required macro */
0, /* ob_size */
"IpoCurve", /* tp_name */
sizeof (C_IpoCurve), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor) IpoCurveDeAlloc, /* tp_dealloc */
0, /* tp_print */
(getattrfunc) IpoCurveGetAttr, /* tp_getattr */
(setattrfunc) IpoCurveSetAttr, /* tp_setattr */
0, /* tp_compare */
(reprfunc) IpoCurveRepr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_as_hash */
0, 0, 0, 0, 0, 0,
0, /* tp_doc */
0, 0, 0, 0, 0, 0,
C_IpoCurve_methods, /* tp_methods */
0, /* tp_members */
};
/*****************************************************************************/
/* Function: M_IpoCurve_New */
/* Python equivalent: Blender.IpoCurve.New */
/*****************************************************************************/
static PyObject *M_IpoCurve_New(PyObject *self, PyObject *args)
static PyObject *
M_IpoCurve_New (PyObject * self, PyObject * args)
{
return 0;
return 0;
}
/*****************************************************************************/
/* Function: Ipo_Init */
/*****************************************************************************/
PyObject *IpoCurve_Init (void)
PyObject *
IpoCurve_Init (void)
{
PyObject *submodule;
PyObject *submodule;
IpoCurve_Type.ob_type = &PyType_Type;
submodule = Py_InitModule3("Blender.IpoCurve", M_IpoCurve_methods, M_IpoCurve_doc);
submodule =
Py_InitModule3 ("Blender.IpoCurve", M_IpoCurve_methods, M_IpoCurve_doc);
return (submodule);
}
@@ -65,185 +183,231 @@ PyObject *IpoCurve_Init (void)
/* passed in, a list of all ipo data names in the */
/* current scene is returned. */
/*****************************************************************************/
static PyObject *M_IpoCurve_Get(PyObject *self, PyObject *args)
static PyObject *
M_IpoCurve_Get (PyObject * self, PyObject * args)
{
return 0;
return 0;
}
/*****************************************************************************/
/* Python C_IpoCurve methods: */
/*****************************************************************************/
static PyObject *IpoCurve_setInterpolation( C_IpoCurve * self, PyObject *args)
static PyObject *
IpoCurve_setInterpolation (C_IpoCurve * self, PyObject * args)
{
char*interpolationtype = 0;
int id = -1;
if (!PyArg_ParseTuple(args, "s", &interpolationtype))
return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected string argument"));
if (!strcmp(interpolationtype,"Bezier"))id = IPO_BEZ;
if (!strcmp(interpolationtype,"Constant"))id = IPO_CONST;
if (!strcmp(interpolationtype,"Linear"))id = IPO_LIN;
if (id == -1)
return (EXPP_ReturnPyObjError (PyExc_TypeError,"bad interpolation type"));
char *interpolationtype = 0;
int id = -1;
if (!PyArg_ParseTuple (args, "s", &interpolationtype))
return (EXPP_ReturnPyObjError
(PyExc_TypeError, "expected string argument"));
if (!strcmp (interpolationtype, "Bezier"))
id = IPO_BEZ;
if (!strcmp (interpolationtype, "Constant"))
id = IPO_CONST;
if (!strcmp (interpolationtype, "Linear"))
id = IPO_LIN;
if (id == -1)
return (EXPP_ReturnPyObjError
(PyExc_TypeError, "bad interpolation type"));
self->ipocurve->ipo = id;
Py_INCREF(Py_None);
self->ipocurve->ipo = id;
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *IpoCurve_getInterpolation( C_IpoCurve * self)
{ char*str = 0;
IpoCurve *icu = self->ipocurve;
if (icu->ipo == IPO_BEZ) str = "Bezier";
if (icu->ipo == IPO_CONST) str = "Bonstant";
if (icu->ipo == IPO_LIN) str = "Linear";
static PyObject *
IpoCurve_getInterpolation (C_IpoCurve * self)
{
char *str = 0;
IpoCurve *icu = self->ipocurve;
if (icu->ipo == IPO_BEZ)
str = "Bezier";
if (icu->ipo == IPO_CONST)
str = "Bonstant";
if (icu->ipo == IPO_LIN)
str = "Linear";
if (!str)
return (EXPP_ReturnPyObjError (PyExc_TypeError,"unknown interpolation type"));
return PyString_FromString(str);
if (!str)
return (EXPP_ReturnPyObjError
(PyExc_TypeError, "unknown interpolation type"));
return PyString_FromString (str);
}
static PyObject *IpoCurve_setExtrapolation( C_IpoCurve * self, PyObject *args)
static PyObject *
IpoCurve_setExtrapolation (C_IpoCurve * self, PyObject * args)
{
char*extrapolationtype = 0;
int id = -1;
if (!PyArg_ParseTuple(args, "s", &extrapolationtype))
return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected string argument"));
if (!strcmp(extrapolationtype,"Constant"))id = 0;
if (!strcmp(extrapolationtype,"Extrapolation"))id = 1;
if (!strcmp(extrapolationtype,"Cyclic"))id = 2;
if (!strcmp(extrapolationtype,"Cyclic_extrapolation"))id = 3;
char *extrapolationtype = 0;
int id = -1;
if (!PyArg_ParseTuple (args, "s", &extrapolationtype))
return (EXPP_ReturnPyObjError
(PyExc_TypeError, "expected string argument"));
if (!strcmp (extrapolationtype, "Constant"))
id = 0;
if (!strcmp (extrapolationtype, "Extrapolation"))
id = 1;
if (!strcmp (extrapolationtype, "Cyclic"))
id = 2;
if (!strcmp (extrapolationtype, "Cyclic_extrapolation"))
id = 3;
if (id == -1)
return (EXPP_ReturnPyObjError (PyExc_TypeError,"bad interpolation type"));
self->ipocurve->extrap = id;
Py_INCREF(Py_None);
if (id == -1)
return (EXPP_ReturnPyObjError
(PyExc_TypeError, "bad interpolation type"));
self->ipocurve->extrap = id;
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *
IpoCurve_getExtrapolation (C_IpoCurve * self)
{
char *str = 0;
IpoCurve *icu = self->ipocurve;
if (icu->extrap == 0)
str = "Constant";
if (icu->extrap == 1)
str = "Extrapolation";
if (icu->extrap == 2)
str = "Cyclic";
if (icu->extrap == 3)
str = "Cyclic_extrapolation";
return PyString_FromString (str);
}
static PyObject *
IpoCurve_addBezier (C_IpoCurve * self, PyObject * args)
{
short MEM_freeN (void *vmemh);
void *MEM_mallocN (unsigned int len, char *str);
float x, y;
int npoints;
IpoCurve *icu;
BezTriple *bzt, *tmp;
static char name[10] = "mlml";
PyObject *popo = 0;
if (!PyArg_ParseTuple (args, "O", &popo))
return (EXPP_ReturnPyObjError
(PyExc_TypeError, "expected tuple argument"));
x = PyFloat_AsDouble (PyTuple_GetItem (popo, 0));
y = PyFloat_AsDouble (PyTuple_GetItem (popo, 1));
icu = self->ipocurve;
npoints = icu->totvert;
tmp = icu->bezt;
icu->bezt = MEM_mallocN (sizeof (BezTriple) * (npoints + 1), name);
if (tmp)
{
memmove (icu->bezt, tmp, sizeof (BezTriple) * npoints);
MEM_freeN (tmp);
}
memmove (icu->bezt + npoints, icu->bezt, sizeof (BezTriple));
icu->totvert++;
bzt = icu->bezt + npoints;
bzt->vec[0][0] = x - 1;
bzt->vec[1][0] = x;
bzt->vec[2][0] = x + 1;
bzt->vec[0][1] = y - 1;
bzt->vec[1][1] = y;
bzt->vec[2][1] = y + 1;
/* set handle type to Auto */
bzt->h1 = HD_AUTO;
bzt->h2 = HD_AUTO;
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *IpoCurve_getExtrapolation( C_IpoCurve * self)
static PyObject *
IpoCurve_setName (C_IpoCurve * self, PyObject * args)
{
char*str = 0;
IpoCurve *icu = self->ipocurve;
if (icu->extrap == 0) str = "Constant";
if (icu->extrap == 1) str = "Extrapolation";
if (icu->extrap == 2) str = "Cyclic";
if (icu->extrap == 3) str = "Cyclic_extrapolation";
return PyString_FromString(str);
return 0;
}
static PyObject *IpoCurve_addBezier( C_IpoCurve * self, PyObject *args)
static PyObject *
IpoCurve_Recalc (C_IpoCurve * self)
{
short MEM_freeN(void *vmemh) ;
void *MEM_mallocN(unsigned int len, char *str);
float x,y;
int npoints;
IpoCurve *icu;
BezTriple *bzt,*tmp;
static char name[10] = "mlml";
PyObject*popo = 0;
if (!PyArg_ParseTuple(args, "O", &popo))
return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected tuple argument"));
x = PyFloat_AsDouble(PyTuple_GetItem(popo,0));
y = PyFloat_AsDouble(PyTuple_GetItem(popo,1));
icu = self->ipocurve;
npoints = icu->totvert;
tmp = icu->bezt;
icu->bezt = MEM_mallocN(sizeof(BezTriple)*(npoints+1),name);
if(tmp){
memmove(icu->bezt,tmp,sizeof(BezTriple)*npoints);
MEM_freeN(tmp);
}
memmove(icu->bezt+npoints,icu->bezt,sizeof(BezTriple));
icu->totvert++;
bzt = icu->bezt + npoints;
bzt->vec[0][0] = x-1;
bzt->vec[1][0] = x;
bzt->vec[2][0] = x+1;
bzt->vec[0][1] = y-1;
bzt->vec[1][1] = y;
bzt->vec[2][1] = y+1;
/* set handle type to Auto */
bzt->h1= HD_AUTO;
bzt->h2= HD_AUTO;
Py_INCREF(Py_None);
void testhandles_ipocurve (IpoCurve * icu);
IpoCurve *icu = self->ipocurve;
testhandles_ipocurve (icu);
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *IpoCurve_setName(C_IpoCurve *self, PyObject *args)
static PyObject *
IpoCurve_getName (C_IpoCurve * self)
{
return 0;
}
char *nametab[24] =
{ "LocX", "LocY", "LocZ", "dLocX", "dLocY", "dLocZ", "RotX", "RotY",
"RotZ", "dRotX", "dRotY", "dRotZ", "SizeX", "SizeY", "SizeZ", "dSizeX",
"dSizeY",
"dSizeZ", "Layer", "Time", "ColR", "ColG", "ColB", "ColA"
};
static PyObject *IpoCurve_Recalc(C_IpoCurve *self)
{
void testhandles_ipocurve(IpoCurve *icu);
IpoCurve *icu = self->ipocurve;
testhandles_ipocurve(icu);
Py_INCREF(Py_None);
return Py_None;
}
if (self->ipocurve->blocktype != ID_OB)
return EXPP_ReturnPyObjError (PyExc_TypeError,
"This function doesn't support this ipocurve type yet");
static PyObject* IpoCurve_getName (C_IpoCurve *self)
{
char * nametab[24] = {"LocX","LocY","LocZ","dLocX","dLocY","dLocZ","RotX","RotY","RotZ","dRotX","dRotY","dRotZ","SizeX","SizeY","SizeZ","dSizeX","dSizeY","dSizeZ","Layer","Time","ColR","ColG","ColB","ColA"};
// printf("IpoCurve_getName %d\n",self->ipocurve->vartype);
if (self->ipocurve->adrcode <= 0)
return PyString_FromString ("Index too small");
if (self->ipocurve->adrcode >= 25)
return PyString_FromString ("Index too big");
if (self->ipocurve->blocktype != ID_OB)
return EXPP_ReturnPyObjError (PyExc_TypeError,
"This function doesn't support this ipocurve type yet");
// printf("IpoCurve_getName %d\n",self->ipocurve->vartype);
if (self->ipocurve->adrcode <=0 )
return PyString_FromString("Index too small");
if (self->ipocurve->adrcode >= 25 )
return PyString_FromString("Index too big");
return PyString_FromString(nametab[self->ipocurve->adrcode-1]);
return PyString_FromString (nametab[self->ipocurve->adrcode - 1]);
}
static void IpoCurveDeAlloc (C_IpoCurve *self)
static void
IpoCurveDeAlloc (C_IpoCurve * self)
{
PyObject_DEL (self);
}
static PyObject* IpoCurve_getPoints (C_IpoCurve *self)
{
struct BezTriple *bezt;
PyObject* l = PyList_New(0);
int i;
for(i = 0;i<self->ipocurve->totvert;i++)
{
bezt = self->ipocurve->bezt + i;
PyList_Append( l, BezTriple_CreatePyObject(bezt));
}
return l;
static PyObject *
IpoCurve_getPoints (C_IpoCurve * self)
{
struct BezTriple *bezt;
PyObject *po;
PyObject *list = PyList_New (0);
int i;
for (i = 0; i < self->ipocurve->totvert; i++)
{
bezt = self->ipocurve->bezt + i;
po = BezTriple_CreatePyObject (bezt);
#if 0
if (BezTriple_CheckPyObject (po))
printf ("po is ok\n");
else
printf ("po is hosed\n");
#endif
PyList_Append (list, po);
/*
PyList_Append( list, BezTriple_CreatePyObject(bezt));
*/
}
return list;
}
int IpoCurve_setPoints (C_IpoCurve *self, PyObject *value )
{
struct BezTriple *bezt;
PyObject* l = PyList_New(0);
int i;
for(i = 0;i<self->ipocurve->totvert;i++)
{
bezt = self->ipocurve->bezt + i;
PyList_Append( l, BezTriple_CreatePyObject(bezt));
}
int
IpoCurve_setPoints (C_IpoCurve * self, PyObject * value)
{
struct BezTriple *bezt;
PyObject *l = PyList_New (0);
int i;
for (i = 0; i < self->ipocurve->totvert; i++)
{
bezt = self->ipocurve->bezt + i;
PyList_Append (l, BezTriple_CreatePyObject (bezt));
}
return 0;
}
@@ -254,11 +418,14 @@ struct BezTriple *bezt;
/* the function that accesses C_IpoCurve "member variables" and */
/* methods. */
/*****************************************************************************/
static PyObject *IpoCurveGetAttr (C_IpoCurve *self, char *name)
static PyObject *
IpoCurveGetAttr (C_IpoCurve * self, char *name)
{
if (strcmp (name, "bezierPoints") == 0)return IpoCurve_getPoints(self);
if (strcmp (name, "name") == 0)return IpoCurve_getName(self);
return Py_FindMethod(C_IpoCurve_methods, (PyObject *)self, name);
if (strcmp (name, "bezierPoints") == 0)
return IpoCurve_getPoints (self);
if (strcmp (name, "name") == 0)
return IpoCurve_getName (self);
return Py_FindMethod (C_IpoCurve_methods, (PyObject *) self, name);
}
/*****************************************************************************/
@@ -266,10 +433,12 @@ if (strcmp (name, "name") == 0)return IpoCurve_getName(self);
/* Description: This is a callback function for the C_IpoCurve type. It is the */
/* function that sets IpoCurve Data attributes (member variables).*/
/*****************************************************************************/
static int IpoCurveSetAttr (C_IpoCurve *self, char *name, PyObject *value)
static int
IpoCurveSetAttr (C_IpoCurve * self, char *name, PyObject * value)
{
if (strcmp (name, "bezierPoints") == 0)return IpoCurve_setPoints(self,value);
return 0; /* normal exit */
if (strcmp (name, "bezierPoints") == 0)
return IpoCurve_setPoints (self, value);
return 0; /* normal exit */
}
/*****************************************************************************/
@@ -277,13 +446,14 @@ if (strcmp (name, "bezierPoints") == 0)return IpoCurve_setPoints(self,value);
/* Description: This is a callback function for the C_IpoCurve type. It */
/* builds a meaninful string to represent ipo objects. */
/*****************************************************************************/
static PyObject *IpoCurveRepr (C_IpoCurve *self)
static PyObject *
IpoCurveRepr (C_IpoCurve * self)
{
void GetIpoCurveName(IpoCurve *icu,char*s);
char s[100],s1[100];
GetIpoCurveName(self->ipocurve,s1);
sprintf(s,"IpoCurve %s \n",s1);
return PyString_FromString(s);
void GetIpoCurveName (IpoCurve * icu, char *s);
char s[100], s1[100];
GetIpoCurveName (self->ipocurve, s1);
sprintf (s, "IpoCurve %s \n", s1);
return PyString_FromString (s);
}
/* Three Python IpoCurve_Type helper functions needed by the Object module: */
@@ -293,19 +463,20 @@ static PyObject *IpoCurveRepr (C_IpoCurve *self)
/* Description: This function will create a new C_IpoCurve from an existing */
/* Blender ipo structure. */
/*****************************************************************************/
PyObject *IpoCurve_CreatePyObject (IpoCurve *ipo)
PyObject *
IpoCurve_CreatePyObject (IpoCurve * ipo)
{
C_IpoCurve *pyipo;
C_IpoCurve *pyipo;
pyipo = (C_IpoCurve *)PyObject_NEW (C_IpoCurve, &IpoCurve_Type);
pyipo = (C_IpoCurve *) PyObject_NEW (C_IpoCurve, &IpoCurve_Type);
if (!pyipo)
return EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create C_IpoCurve object");
if (!pyipo)
return EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create C_IpoCurve object");
pyipo->ipocurve = ipo;
pyipo->ipocurve = ipo;
return (PyObject *)pyipo;
return (PyObject *) pyipo;
}
/*****************************************************************************/
@@ -313,9 +484,10 @@ PyObject *IpoCurve_CreatePyObject (IpoCurve *ipo)
/* Description: This function returns true when the given PyObject is of the */
/* type IpoCurve. Otherwise it will return false. */
/*****************************************************************************/
int IpoCurve_CheckPyObject (PyObject *pyobj)
int
IpoCurve_CheckPyObject (PyObject * pyobj)
{
return (pyobj->ob_type == &IpoCurve_Type);
return (pyobj->ob_type == &IpoCurve_Type);
}
/*****************************************************************************/
@@ -323,7 +495,8 @@ int IpoCurve_CheckPyObject (PyObject *pyobj)
/* Description: This function returns the Blender ipo from the given */
/* PyObject. */
/*****************************************************************************/
IpoCurve *IpoCurve_FromPyObject (PyObject *pyobj)
IpoCurve *
IpoCurve_FromPyObject (PyObject * pyobj)
{
return ((C_IpoCurve *)pyobj)->ipocurve;
return ((C_IpoCurve *) pyobj)->ipocurve;
}

View File

@@ -33,131 +33,17 @@
#define EXPP_IPOCURVE_H
#include <Python.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <DNA_ipo_types.h>
#include "constant.h"
#include "gen_utils.h"
#include "modules.h"
/*****************************************************************************/
/* Python API function prototypes for the IpoCurve module. */
/*****************************************************************************/
static PyObject *M_IpoCurve_New (PyObject *self, PyObject *args);
static PyObject *M_IpoCurve_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.IpoCurve.__doc__ */
/*****************************************************************************/
char M_IpoCurve_doc[] = "";
char M_IpoCurve_New_doc[] ="";
char M_IpoCurve_Get_doc[] ="";
/*****************************************************************************/
/* Python method structure definition for Blender.IpoCurve module: */
/*****************************************************************************/
struct PyMethodDef M_IpoCurve_methods[] = {
{"New",(PyCFunction)M_IpoCurve_New, METH_VARARGS|METH_KEYWORDS,M_IpoCurve_New_doc},
{"Get", M_IpoCurve_Get, METH_VARARGS, M_IpoCurve_Get_doc},
{"get", M_IpoCurve_Get, METH_VARARGS, M_IpoCurve_Get_doc},
{NULL, NULL, 0, NULL}
};
#include <DNA_curve_types.h> /* declaration of IpoCurve */
/*****************************************************************************/
/* Python C_IpoCurve structure definition: */
/*****************************************************************************/
typedef struct {
PyObject_HEAD
IpoCurve *ipocurve;
} C_IpoCurve;
/*****************************************************************************/
/* Python C_IpoCurve methods declarations: */
/*****************************************************************************/
static PyObject *IpoCurve_getName(C_IpoCurve *self);
static PyObject *IpoCurve_Recalc(C_IpoCurve *self);
static PyObject *IpoCurve_setName(C_IpoCurve *self, PyObject *args);
static PyObject *IpoCurve_addBezier( C_IpoCurve*self, PyObject *args);
static PyObject *IpoCurve_setInterpolation( C_IpoCurve*self, PyObject *args);
static PyObject *IpoCurve_getInterpolation( C_IpoCurve*self);
static PyObject *IpoCurve_setExtrapolation( C_IpoCurve*self, PyObject *args);
static PyObject *IpoCurve_getExtrapolation( C_IpoCurve*self);
static PyObject *IpoCurve_getPoints( C_IpoCurve*self);
/*****************************************************************************/
/* Python C_IpoCurve methods table: */
/*****************************************************************************/
static PyMethodDef C_IpoCurve_methods[] = {
/* name, method, flags, doc */
{"getName", (PyCFunction)IpoCurve_getName, METH_NOARGS,
"() - Return IpoCurve Data name"},
{"Recalc", (PyCFunction)IpoCurve_Recalc, METH_NOARGS,
"() - Return IpoCurve Data name"},
{"update", (PyCFunction)IpoCurve_Recalc, METH_NOARGS,
"() - Return IpoCurve Data name"},
{"setName", (PyCFunction)IpoCurve_setName, METH_VARARGS,
"(str) - Change IpoCurve Data name"},
{"addBezier", (PyCFunction)IpoCurve_addBezier, METH_VARARGS,
"(str) - Change IpoCurve Data name"},
{"setInterpolation", (PyCFunction)IpoCurve_setInterpolation, METH_VARARGS,
"(str) - Change IpoCurve Data name"},
{"getInterpolation", (PyCFunction)IpoCurve_getInterpolation, METH_NOARGS,
"(str) - Change IpoCurve Data name"},
{"setExtrapolation", (PyCFunction)IpoCurve_setExtrapolation, METH_VARARGS,
"(str) - Change IpoCurve Data name"},
{"getExtrapolation", (PyCFunction)IpoCurve_getExtrapolation, METH_NOARGS,
"(str) - Change IpoCurve Data name"},
{"getPoints", (PyCFunction)IpoCurve_getPoints, METH_NOARGS,
"(str) - Change IpoCurve Data name"},
{0}
};
/*****************************************************************************/
/* Python IpoCurve_Type callback function prototypes: */
/*****************************************************************************/
static void IpoCurveDeAlloc (C_IpoCurve *self);
//static int IpoCurvePrint (C_IpoCurve *self, FILE *fp, int flags);
static int IpoCurveSetAttr (C_IpoCurve *self, char *name, PyObject *v);
static PyObject *IpoCurveGetAttr (C_IpoCurve *self, char *name);
static PyObject *IpoCurveRepr (C_IpoCurve *self);
/*****************************************************************************/
/* Python IpoCurve_Type structure definition: */
/*****************************************************************************/
PyTypeObject IpoCurve_Type =
typedef struct
{
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
"IpoCurve", /* tp_name */
sizeof (C_IpoCurve), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)IpoCurveDeAlloc, /* tp_dealloc */
0, /* tp_print */
(getattrfunc)IpoCurveGetAttr, /* tp_getattr */
(setattrfunc)IpoCurveSetAttr, /* tp_setattr */
0, /* tp_compare */
(reprfunc)IpoCurveRepr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_as_hash */
0,0,0,0,0,0,
0, /* tp_doc */
0,0,0,0,0,0,
C_IpoCurve_methods, /* tp_methods */
0, /* tp_members */
};
PyObject_HEAD /* required macro */
IpoCurve * ipocurve;
}
C_IpoCurve;
#endif /* EXPP_IPOCURVE_H */

View File

@@ -42,7 +42,7 @@
#include <DNA_curve_types.h>
#include <DNA_world_types.h>
#include "rgbTuple.h" /* for BPy_rgbTuple */
#include "rgbTuple.h" /* for BPy_rgbTuple */
/*****************************************************************************/
/* Camera Data */
@@ -50,15 +50,16 @@
extern PyTypeObject Camera_Type;
#define BPy_Camera_Check(v) \
((v)->ob_type == &Camera_Type) /* for type checking */
((v)->ob_type == &Camera_Type) /* for type checking */
/* Python BPy_Camera structure definition */
typedef struct {
PyObject_HEAD
Camera *camera;
typedef struct
{
PyObject_HEAD /* required py macro */
Camera * camera;
} BPy_Camera;
/**/
}
BPy_Camera;
/*****************************************************************************/
/* Lamp Data */
@@ -66,31 +67,31 @@ typedef struct {
extern PyTypeObject Lamp_Type;
#define BPy_Lamp_Check(v) \
((v)->ob_type == &Lamp_Type) /* for type checking */
((v)->ob_type == &Lamp_Type) /* for type checking */
/* Python BPy_Lamp structure definition */
typedef struct {
PyObject_HEAD
Lamp *lamp;
typedef struct
{
PyObject_HEAD /* required py macro */
Lamp * lamp;
BPy_rgbTuple *color;
} BPy_Lamp;
/**/
}
BPy_Lamp;
/*****************************************************************************/
/* Ipo Data */
/*****************************************************************************/
extern PyTypeObject Ipo_Type;
#define BPy_Ipo_Check(v) ((v)->ob_type == &Ipo_Type) /* for type checking */
#define BPy_Ipo_Check(v) ((v)->ob_type == &Ipo_Type) /* for type checking */
/* Python BPy_Ipo structure definition */
typedef struct {
PyObject_HEAD
Ipo *ipo;
} BPy_Ipo;
/**/
typedef struct
{
PyObject_HEAD /* required py macro */
Ipo * ipo;
}
BPy_Ipo;
/*****************************************************************************/
/* Metaball Data */
@@ -100,12 +101,12 @@ extern PyTypeObject Metaball_Type;
#define BPy_Metaball_Check(v) ((v)->ob_type==&Metaball_Type)
/* Python BPy_Metaball structure definition */
typedef struct {
PyObject_HEAD
MetaBall *metaball;
} BPy_Metaball;
/**/
typedef struct
{
PyObject_HEAD /* required py macro */
MetaBall * metaball;
}
BPy_Metaball;
/*****************************************************************************/
/* Effect Data */
@@ -115,11 +116,12 @@ extern PyTypeObject Effect_Type;
#define BPy_Effect_Check(v) ((v)->ob_type==&Effect_Type)
/* Python BPy_Effect structure definition */
typedef struct {
PyObject_HEAD
Effect *effect;
} BPy_Effect;
/**/
typedef struct
{
PyObject_HEAD /* required py macro */
Effect * effect;
}
BPy_Effect;
/*****************************************************************************/
/* Wave Data */
@@ -129,11 +131,12 @@ extern PyTypeObject Wave_Type;
#define BPy_Wave_Check(v) ((v)->ob_type==&Wave_Type)
/* Python BPy_Wave structure definition */
typedef struct {
PyObject_HEAD
Effect *wave;
} BPy_Wave;
/**/
typedef struct
{
PyObject_HEAD /* required py macro */
Effect * wave;
}
BPy_Wave;
/*****************************************************************************/
/* Build Data */
@@ -143,11 +146,12 @@ extern PyTypeObject Build_Type;
#define BPy_Build_Check(v) ((v)->ob_type==&Build_Type)
/* Python BPy_Build structure definition */
typedef struct {
PyObject_HEAD
Effect *build;
} BPy_Build;
/**/
typedef struct
{
PyObject_HEAD /* required py macro */
Effect * build;
}
BPy_Build;
/*****************************************************************************/
/* Particle Data */
@@ -157,11 +161,12 @@ extern PyTypeObject Particle_Type;
#define BPy_Particle_Check(v) ((v)->ob_type==&Particle_Type)
/* Python BPy_Particle structure definition */
typedef struct {
PyObject_HEAD
Effect *particle;
} BPy_Particle;
/**/
typedef struct
{
PyObject_HEAD /* required py macro */
Effect * particle;
}
BPy_Particle;
/*****************************************************************************/
/* Curve Data */
@@ -171,11 +176,12 @@ extern PyTypeObject Curve_Type;
#define BPy_Curve_Check(v) ((v)->ob_type==&Curve_Type)
/* Python BPy_Curve structure definition */
typedef struct {
PyObject_HEAD
Curve *curve;
} BPy_Curve;
/**/
typedef struct
{
PyObject_HEAD /* required py macro */
Curve * curve;
}
BPy_Curve;
/*****************************************************************************/
/* World Data */
@@ -185,11 +191,11 @@ extern PyTypeObject World_Type;
#define BPy_World_Check(v) ((v)->ob_type==&World_Type)
/* Python BPy_World structure definition */
typedef struct {
PyObject_HEAD
World *world;
} BPy_World;
/**/
typedef struct
{
PyObject_HEAD /* required py macro */
World * world;
}
BPy_World;
#endif /* EXPP_bpy_types_h */