* Added Blender.Curve submodule, written by Jacques Guignot (guignot):

Jacques contributed a new module to exppython, one that isn't available
    in the current 2.27 API.  Welcome, guignot : ).
This commit is contained in:
2003-05-17 07:08:08 +00:00
parent ed78dcc96c
commit d03323b1c3
4 changed files with 811 additions and 2 deletions

View File

@@ -218,7 +218,7 @@ void initBlender (void)
PyDict_SetItemString (dict, "NMesh", M_NMesh_Init());
PyDict_SetItemString (dict, "Camera", M_Camera_Init());
PyDict_SetItemString (dict, "Lamp", M_Lamp_Init());
/* PyDict_SetItemString (dict, "Curve", M_Curve_Init());*/
PyDict_SetItemString (dict, "Curve", M_Curve_Init());
PyDict_SetItemString (dict, "Image", M_Image_Init());
PyDict_SetItemString (dict, "Window", M_Window_Init());
PyDict_SetItemString (dict, "Draw", M_Draw_Init());

View File

@@ -0,0 +1,607 @@
/*
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* This is a new part of Blender.
*
* Contributor(s): Jacques Guignot
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Curve.h"
/*****************************************************************************/
/* Function: M_Curve_New */
/* Python equivalent: Blender.Curve.New */
/*****************************************************************************/
static PyObject *M_Curve_New(PyObject *self, PyObject *args)
{
char buf[21];
char *name = NULL;
C_Curve *pycurve; /* for Curve Data object wrapper in Python */
Curve *blcurve = 0; /* for actual Curve Data we create in Blender */
printf ("In Curve_New()\n");
if (!PyArg_ParseTuple(args, "|s", &name))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected string argument or no argument"));
blcurve = add_curve(OB_CURVE); /* first create the Curve Data in Blender */
if (blcurve == NULL) return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't create Curve Data in Blender"));
pycurve = (C_Curve *)PyObject_NEW(C_Curve, &Curve_Type);
if (pycurve == NULL) return (EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create Curve Data object"));
pycurve->curve = blcurve; /* link Python curve wrapper to Blender Curve */
if (name)
{
PyOS_snprintf(buf, sizeof(buf), "%s", name);
rename_id(&blcurve->id, buf);
}
return (PyObject *)pycurve;
}
/*****************************************************************************/
/* Function: M_Curve_Get */
/* Python equivalent: Blender.Curve.Get */
/*****************************************************************************/
static PyObject *M_Curve_Get(PyObject *self, PyObject *args)
{
char *name = 0;
Curve *curv_iter;
C_Curve *wanted_curv;
printf ("In Curve_Get()\n");
if (!PyArg_ParseTuple(args, "|s", &name))/* expects nothing or a string */
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected string argument"));
if(name){/* a name has been given */
/* Use the name to search for the curve requested */
wanted_curv = NULL;
curv_iter = G.main->curve.first;
while ((curv_iter) && (wanted_curv == NULL)) {
if (strcmp (name, curv_iter->id.name+2) == 0) {
wanted_curv = (C_Curve *)PyObject_NEW(C_Curve, &Curve_Type);
if (wanted_curv) wanted_curv->curve = curv_iter;
}
curv_iter = curv_iter->id.next;
}
if (wanted_curv == NULL) { /* Requested curve doesn't exist */
char error_msg[64];
PyOS_snprintf(error_msg, sizeof(error_msg),
"Curve \"%s\" not found", name);
return (EXPP_ReturnPyObjError (PyExc_NameError, error_msg));
}
return (PyObject*)wanted_curv;
}/* if(name) */
else{/* no name has been given; return a list of all curves by name. */
int index = 0;
PyObject *curvlist, *pystr;
curv_iter = G.main->curve.first;
curvlist = PyList_New (BLI_countlist (&(G.main->curve)));
if (curvlist == NULL)
return (PythonReturnErrorObject (PyExc_MemoryError,
"couldn't create PyList"));
while (curv_iter) {
pystr = PyString_FromString (curv_iter->id.name+2);
if (!pystr)
return (PythonReturnErrorObject (PyExc_MemoryError,
"couldn't create PyString"));
PyList_SET_ITEM (curvlist, index, pystr);
curv_iter = curv_iter->id.next;
index++;
}
return (curvlist);
}//else
}
/*****************************************************************************/
/* Function: M_Curve_Init */
/*****************************************************************************/
PyObject *M_Curve_Init (void)
{
PyObject *submodule;
printf ("In M_Curve_Init()\n");
submodule = Py_InitModule3("Blender.Curve",M_Curve_methods, M_Curve_doc);
return (submodule);
}
/*****************************************************************************/
/* Python C_Curve methods: */
/*****************************************************************************/
static PyObject *Curve_getName(C_Curve *self)
{
PyObject *attr = PyString_FromString(self->curve->id.name+2);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.name attribute"));
}
static PyObject *Curve_setName(C_Curve *self, PyObject *args)
{
char*name;
char buf[21];
if (!PyArg_ParseTuple(args, "s", &(name)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected string argument"));
PyOS_snprintf(buf, sizeof(buf), "%s", name);
rename_id(&self->curve->id, buf); /* proper way in Blender */
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getPathLen(C_Curve *self)
{
PyObject *attr = PyInt_FromLong((long)self->curve->pathlen);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.pathlen attribute"));
}
static PyObject *Curve_setPathLen(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "i", &(self->curve->pathlen)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getTotcol(C_Curve *self)
{
PyObject *attr = PyInt_FromLong((long)self->curve->totcol);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.totcol attribute"));
}
static PyObject *Curve_setTotcol(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "i", &(self->curve->totcol)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getMode(C_Curve *self)
{
PyObject *attr = PyInt_FromLong((long)self->curve->flag);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.flag attribute"));
}
static PyObject *Curve_setMode(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "i", &(self->curve->flag)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getBevresol(C_Curve *self)
{
PyObject *attr = PyInt_FromLong((long)self->curve->bevresol);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.bevresol attribute"));
}
static PyObject *Curve_setBevresol(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "i", &(self->curve->bevresol)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getResolu(C_Curve *self)
{
PyObject *attr = PyInt_FromLong((long)self->curve->resolu);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.resolu attribute"));
}
static PyObject *Curve_setResolu(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "i", &(self->curve->resolu)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getResolv(C_Curve *self)
{
PyObject *attr = PyInt_FromLong((long)self->curve->resolv);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.resolv attribute"));
}
static PyObject *Curve_setResolv(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "i", &(self->curve->resolv)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getWidth(C_Curve *self)
{
PyObject *attr = PyFloat_FromDouble((double)self->curve->width);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.width attribute"));
}
static PyObject *Curve_setWidth(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "f", &(self->curve->width)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected float argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getExt1(C_Curve *self)
{
PyObject *attr = PyFloat_FromDouble((double)self->curve->ext1);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.ext1 attribute"));
}
static PyObject *Curve_setExt1(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "f", &(self->curve->ext1)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected float argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getExt2(C_Curve *self)
{
PyObject *attr = PyFloat_FromDouble((double)self->curve->ext2);
if (attr) return attr;
return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get Curve.ext2 attribute"));
}
static PyObject *Curve_setExt2(C_Curve *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "f", &(self->curve->ext2)))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected float argument"));
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_setControlPoint(C_Curve *self, PyObject *args)
{
Nurb*ptrnurb = self->curve->nurb.first;
int numcourbe,numpoint,i,j;
float x,y,z,w;
float bez[9];
if (ptrnurb->bp)
if (!PyArg_ParseTuple(args, "iiffff", &numcourbe,&numpoint,&x,&y,&z,&w))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int int float float float float arguments"));
if (ptrnurb->bezt)
if (!PyArg_ParseTuple(args, "iifffffffff", &numcourbe,&numpoint,
bez,bez+1,bez+2,bez+3,bez+4,bez+5,bez+6,bez+7,bez+8))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int int float float float float float float float"
" float float arguments"));
for(i = 0;i< numcourbe;i++)
ptrnurb=ptrnurb->next;
if (ptrnurb->bp)
{
ptrnurb->bp[numpoint].vec[0] = x;
ptrnurb->bp[numpoint].vec[1] = y;
ptrnurb->bp[numpoint].vec[2] = z;
ptrnurb->bp[numpoint].vec[3] = w;
}
if (ptrnurb->bezt)
{
for(i = 0;i<3;i++)
for(j = 0;j<3;j++)
ptrnurb->bezt[numpoint].vec[i][j] = bez[i*3+j];
}
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getControlPoint(C_Curve *self, PyObject *args)
{
PyObject* liste = 0;
Nurb*ptrnurb;
int numcourbe,numpoint,i,j;
if (!PyArg_ParseTuple(args, "ii", &numcourbe,&numpoint))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected int int arguments"));
/* check args ??? */
ptrnurb = self->curve->nurb.first;
for(i = 0;i< numcourbe;i++)/* selection of the first point of the curve */
ptrnurb=ptrnurb->next;
if (ptrnurb->bp)
{
liste = PyList_New(4);
for(i = 0;i< 4;i++)
PyList_SetItem(liste, i, PyFloat_FromDouble( ptrnurb->bp[numpoint].vec[i]));
}
if (ptrnurb->bezt)
{
liste = PyList_New(9);
for(i = 0;i< 3;i++)
for(j = 0;j< 3;j++)
PyList_SetItem(liste, i*3+j,
PyFloat_FromDouble( ptrnurb->bezt[numpoint].vec[i][j]));
}
return liste;
}
static PyObject *Curve_getLoc(C_Curve *self)
{
int i;
PyObject* liste = PyList_New(3);
for(i = 0;i< 3;i++)
PyList_SetItem(liste, i, PyFloat_FromDouble( self->curve->loc[i]));
return liste;
}
static PyObject *Curve_setLoc(C_Curve *self, PyObject *args)
{
float x,y,z;
if (!PyArg_ParseTuple(args, "fff",&x,&y,&z))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected float float float arguments"));
self->curve->loc[0] = x;
self->curve->loc[1] = y;
self->curve->loc[2] = z;
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getRot(C_Curve *self)
{
int i;
PyObject* liste = PyList_New(3);
for(i = 0;i< 3;i++)
PyList_SetItem(liste, i, PyFloat_FromDouble( self->curve->rot[i]));
return liste;
}
static PyObject *Curve_setRot(C_Curve *self, PyObject *args)
{
float x,y,z;
if (!PyArg_ParseTuple(args, "fff",&x,&y,&z))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected float float float arguments"));
self->curve->rot[0] = x;
self->curve->rot[1] = y;
self->curve->rot[2] = z;
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *Curve_getSize(C_Curve *self)
{
int i;
PyObject* liste = PyList_New(3);
for(i = 0;i< 3;i++)
PyList_SetItem(liste, i, PyFloat_FromDouble( self->curve->size[i]));
return liste;
}
static PyObject *Curve_setSize(C_Curve *self, PyObject *args)
{
float x,y,z;
if (!PyArg_ParseTuple(args, "fff",&x,&y,&z))
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected float float float arguments"));
self->curve->size[0] = x;
self->curve->size[1] = y;
self->curve->size[2] = z;
Py_INCREF(Py_None);
return Py_None;
}
/*****************************************************************************/
/* Function: CurveDeAlloc */
/* Description: This is a callback function for the C_Curve type. It is */
/* the destructor function. */
/*****************************************************************************/
static void CurveDeAlloc (C_Curve *self)
{
PyObject_DEL (self);
}
/*****************************************************************************/
/* Function: CurveGetAttr */
/* Description: This is a callback function for the C_Curve type. It is */
/* the function that accesses C_Curve "member variables" and */
/* methods. */
/*****************************************************************************/
static PyObject *CurveGetAttr (C_Curve *self, char *name)/* getattr */
{
PyObject *attr = Py_None;
if (strcmp(name, "name") == 0)
attr = PyString_FromString(self->curve->id.name+2);
if (!attr)
return (EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create PyObject"));
if (attr != Py_None) return attr; /* member attribute found, return it */
/* not an attribute, search the methods table */
return Py_FindMethod(C_Curve_methods, (PyObject *)self, name);
}
/*****************************************************************************/
/* Function: CurveSetAttr */
/* Description: This is a callback function for the C_Curve type. It is the */
/* function that sets Curve Data attributes (member variables). */
/*****************************************************************************/
static int CurveSetAttr (C_Curve *self, char *name, PyObject *value)
{ /* setattr (mandatory?) */
return 0; /* normal exit */
}
/*****************************************************************************/
/* Function: CurvePrint */
/* Description: This is a callback function for the C_Curve type. It */
/* builds a meaninful string to 'print' curve objects. */
/*****************************************************************************/
static int CurvePrint(C_Curve *self, FILE *fp, int flags) /* print */
{
fprintf(fp, "[Curve \"%s\"]\n", self->curve->id.name+2);
return 0;
}
/*****************************************************************************/
/* Function: CurveRepr */
/* Description: This is a callback function for the C_Curve type. It */
/* builds a meaninful string to represent curve objects. */
/*****************************************************************************/
static PyObject *CurveRepr (C_Curve *self) /* used by 'repr' */
{
return PyString_FromString(self->curve->id.name+2);
}

View File

@@ -0,0 +1,202 @@
/*
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* This is a new part of Blender.
*
* Contributor(s): Jacques Guignot
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#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 <DNA_curve_types.h>
#include "gen_utils.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[] = "";
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 C_Curve structure definition: */
/*****************************************************************************/
typedef struct {
PyObject_HEAD
Curve *curve;
} C_Curve;
/*****************************************************************************/
/* Python C_Curve methods declarations: */
/*****************************************************************************/
static PyObject *Curve_getName(C_Curve *self);
static PyObject *Curve_setName(C_Curve *self, PyObject *args);
static PyObject *Curve_getPathLen(C_Curve *self);
static PyObject *Curve_setPathLen(C_Curve *self, PyObject *args);
static PyObject *Curve_getTotcol(C_Curve *self);
static PyObject *Curve_setTotcol(C_Curve *self, PyObject *args);
static PyObject *Curve_getMode(C_Curve *self);
static PyObject *Curve_setMode(C_Curve *self, PyObject *args);
static PyObject *Curve_getBevresol(C_Curve *self);
static PyObject *Curve_setBevresol(C_Curve *self, PyObject *args);
static PyObject *Curve_getResolu(C_Curve *self);
static PyObject *Curve_setResolu(C_Curve *self, PyObject *args);
static PyObject *Curve_getResolv(C_Curve *self);
static PyObject *Curve_setResolv(C_Curve *self, PyObject *args);
static PyObject *Curve_getWidth(C_Curve *self);
static PyObject *Curve_setWidth(C_Curve *self, PyObject *args);
static PyObject *Curve_getExt1(C_Curve *self);
static PyObject *Curve_setExt1(C_Curve *self, PyObject *args);
static PyObject *Curve_getExt2(C_Curve *self);
static PyObject *Curve_setExt2(C_Curve *self, PyObject *args);
static PyObject *Curve_getControlPoint(C_Curve *self, PyObject *args);
static PyObject *Curve_setControlPoint(C_Curve *self, PyObject *args);
static PyObject *Curve_getLoc(C_Curve *self);
static PyObject *Curve_setLoc(C_Curve *self, PyObject *args);
static PyObject *Curve_getRot(C_Curve *self);
static PyObject *Curve_setRot(C_Curve *self, PyObject *args);
static PyObject *Curve_getSize(C_Curve *self);
static PyObject *Curve_setSize(C_Curve *self, PyObject *args);
/*****************************************************************************/
/* Python C_Curve methods table: */
/*****************************************************************************/
static PyMethodDef C_Curve_methods[] = {
/* name, method, flags, doc */
{"getName", (PyCFunction)Curve_getName, METH_NOARGS,
"() - Return Curve Data name"},
{"setName", (PyCFunction)Curve_setName, METH_NOARGS,
"() - 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 totcol"},
{"setTotcol", (PyCFunction)Curve_setTotcol, METH_VARARGS,
"(int) - Sets totcol"},
{"getFlag", (PyCFunction)Curve_getMode, METH_NOARGS,"() - Return flag"},
{"setFlag", (PyCFunction)Curve_setMode, METH_VARARGS,"(int) - Sets flag"},
{"getBevresol", (PyCFunction)Curve_getBevresol, METH_NOARGS,
"() - Return bevresol"},
{"setBevresol", (PyCFunction)Curve_setBevresol, METH_VARARGS,
"(int) - Sets bevresol"},
{"getResolu", (PyCFunction)Curve_getResolu, METH_NOARGS,"() - Return resolu"},
{"setResolu", (PyCFunction)Curve_setResolu, METH_VARARGS,
"(int) - Sets resolu"},
{"getResolv", (PyCFunction)Curve_getResolv, METH_NOARGS,"() - Return resolv"},
{"setResolv", (PyCFunction)Curve_setResolv, METH_VARARGS,
"(int) - Sets resolv"},
{"getWidth", (PyCFunction)Curve_getWidth, METH_NOARGS,"() - Return width"},
{"setWidth", (PyCFunction)Curve_setWidth, METH_VARARGS,"(int) - Sets width"},
{"getExt1", (PyCFunction)Curve_getExt1, METH_NOARGS,"() - Return ext1"},
{"setExt1", (PyCFunction)Curve_setExt1, METH_VARARGS,"(int) - Sets ext1"},
{"getExt2", (PyCFunction)Curve_getExt2, METH_NOARGS,"() - Return ext2"},
{"setExt2", (PyCFunction)Curve_setExt2, METH_VARARGS,"(int) - Sets ext2"},
{"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, float w)(nurbs)\
or (int numcurve,int numpoint,float x1,...,x9(bezier) Sets a control point "},
{"getLoc", (PyCFunction)Curve_getLoc, METH_NOARGS,"() - Gets Location"},
{"setLoc", (PyCFunction)Curve_setLoc, METH_VARARGS,
"(float x,float y,float z) - Sets Location"},
{"getRot", (PyCFunction)Curve_getRot, METH_NOARGS,"() - Gets Rotation"},
{"setRot", (PyCFunction)Curve_setRot, METH_VARARGS,
"(float x,float y,float z) - Sets Rotation"},
{"getSize", (PyCFunction)Curve_getSize, METH_NOARGS,"() - Gets Size"},
{"setSize", (PyCFunction)Curve_setSize, METH_VARARGS,
"(float x,float y,float z) - Sets Size"},
{0}
};
/*****************************************************************************/
/* Python Curve_Type callback function prototypes: */
/*****************************************************************************/
static void CurveDeAlloc (C_Curve *msh);
static int CurvePrint (C_Curve *msh, FILE *fp, int flags);
static int CurveSetAttr (C_Curve *msh, char *name, PyObject *v);
static PyObject *CurveGetAttr (C_Curve *msh, char *name);
static PyObject *CurveRepr (C_Curve *msh);
/*****************************************************************************/
/* Python Curve_Type structure definition: */
/*****************************************************************************/
static PyTypeObject Curve_Type =
{
PyObject_HEAD_INIT(&PyType_Type)
0, /* ob_size */
"Curve", /* tp_name */
sizeof (C_Curve), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)CurveDeAlloc, /* tp_dealloc */
(printfunc)CurvePrint, /* 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,
C_Curve_methods, /* tp_methods */
0, /* tp_members */
};
#endif /* EXPP_CURVE_H */

View File

@@ -46,7 +46,7 @@ PyObject *ObjectCreatePyObject (struct Object *obj);
PyObject *M_NMesh_Init (void);
PyObject *M_Camera_Init (void);
PyObject *M_Lamp_Init (void);
/*PyObject *M_Curve_Init (void);*/
PyObject *M_Curve_Init (void);
PyObject *M_Image_Init (void);
PyObject *M_Window_Init (void);
PyObject *M_Draw_Init (void);