diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-27 01:47:39 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-27 01:47:39 +0400 |
commit | 0c64c49d2f930aed4ef310c2331bc3df0932cbe2 (patch) | |
tree | e863274f8326a9735dfe03cd5e7c580cd33a08cc /source/blender/freestyle/intern/python | |
parent | 5718639a79b51241f348eb241d2379ade06cd787 (diff) |
soc-2008-mxcurioni: added (but did not test) ViewMap and Noise classes. Updated ViewShape class accordingly
Diffstat (limited to 'source/blender/freestyle/intern/python')
6 files changed, 473 insertions, 96 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index 13164d0a153..ed35a85068b 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -7,11 +7,11 @@ #include "BPy_Id.h" #include "BPy_IntegrationType.h" #include "BPy_Interface0D.h" -#include "BPy_Iterator.h" -#include "Interface0D/BPy_CurvePoint.h" #include "BPy_Interface1D.h" +#include "BPy_Iterator.h" #include "BPy_MediumType.h" #include "BPy_Nature.h" +#include "BPy_Noise.h" #include "BPy_SShape.h" #include "BPy_StrokeAttribute.h" #include "BPy_StrokeShader.h" @@ -19,6 +19,7 @@ #include "BPy_UnaryFunction1D.h" #include "BPy_UnaryPredicate0D.h" #include "BPy_UnaryPredicate1D.h" +#include "BPy_ViewMap.h" #include "BPy_ViewShape.h" @@ -151,6 +152,7 @@ PyObject *Freestyle_Init( void ) Interface0D_Init( module ); Interface1D_Init( module ); Iterator_Init( module ); + Noise_Init( module ); SShape_Init( module ); StrokeAttribute_Init( module ); StrokeShader_Init( module ); @@ -158,8 +160,9 @@ PyObject *Freestyle_Init( void ) UnaryFunction1D_Init( module ); UnaryPredicate0D_Init( module ); UnaryPredicate1D_Init( module ); + ViewMap_Init( module ); ViewShape_Init( module ); - + return module; } diff --git a/source/blender/freestyle/intern/python/BPy_Noise.cpp b/source/blender/freestyle/intern/python/BPy_Noise.cpp index 8e6b7aa5022..f8d5d6b066d 100644 --- a/source/blender/freestyle/intern/python/BPy_Noise.cpp +++ b/source/blender/freestyle/intern/python/BPy_Noise.cpp @@ -1,48 +1,239 @@ - PyObject *_wrap_Noise_turbulence1__SWIG_0(PyObject *self , PyObject *args) { +#include "BPy_Noise.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for Noise instance -----------*/ +static int Noise___init__(BPy_Noise *self, PyObject *args, PyObject *kwds); +static void Noise___dealloc__(BPy_Noise *self); +static PyObject * Noise___repr__(BPy_Noise *self); + +static PyObject * Noise_turbulence1( BPy_Noise *self, PyObject *args); +static PyObject * Noise_turbulence2( BPy_Noise *self, PyObject *args); +static PyObject * Noise_turbulence3( BPy_Noise *self, PyObject *args); +static PyObject * Noise_smoothNoise1( BPy_Noise *self, PyObject *args); +static PyObject * Noise_smoothNoise2( BPy_Noise *self, PyObject *args); +static PyObject * Noise_smoothNoise3( BPy_Noise *self, PyObject *args); + +/*----------------------Noise instance definitions ----------------------------*/ +static PyMethodDef BPy_Noise_methods[] = { + {"turbulence1", ( PyCFunction ) Noise_turbulence1, METH_VARARGS, "(float arg, float freq, float amp, unsigned oct=4))Returns a noise value for a 1D element"}, + {"turbulence2", ( PyCFunction ) Noise_turbulence2, METH_VARARGS, "([x, y], float freq, float amp, unsigned oct=4)))Returns a noise value for a 2D element"}, + {"turbulence3", ( PyCFunction ) Noise_turbulence3, METH_VARARGS, "([x, y, z], float freq, float amp, unsigned oct=4)))Returns a noise value for a 3D element"}, + {"smoothNoise1", ( PyCFunction ) Noise_smoothNoise1, METH_VARARGS, "(float arg))Returns a smooth noise value for a 1D element "}, + {"smoothNoise2", ( PyCFunction ) Noise_smoothNoise2, METH_VARARGS, "([x, y]))Returns a smooth noise value for a 2D element "}, + {"smoothNoise3", ( PyCFunction ) Noise_smoothNoise3, METH_VARARGS, "([x, y, z))Returns a smooth noise value for a 3D element "}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_Noise type definition ------------------------------*/ + +PyTypeObject Noise_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "Noise", /* tp_name */ + sizeof( BPy_Noise ), /* tp_basicsize */ + 0, /* tp_itemsize */ + + /* methods */ + (destructor)Noise___dealloc__, /* tp_dealloc */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ + (reprfunc)Noise___repr__, /* tp_repr */ + + /* Method suites for standard classes */ + + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ + + /* More standard operations (here for binary compatibility) */ + + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ + + /* Functions to access object as input/output buffer */ + NULL, /* PyBufferProcs *tp_as_buffer; */ + + /*** Flags to define presence of optional/expanded features ***/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ + + NULL, /* char *tp_doc; Documentation string */ + /*** Assigned meaning in release 2.0 ***/ + /* call function for all accessible objects */ + NULL, /* traverseproc tp_traverse; */ + + /* delete references to contained objects */ + NULL, /* inquiry tp_clear; */ + + /*** Assigned meaning in release 2.1 ***/ + /*** rich comparisons ***/ + NULL, /* richcmpfunc tp_richcompare; */ + + /*** weak reference enabler ***/ + 0, /* long tp_weaklistoffset; */ + + /*** Added in release 2.2 ***/ + /* Iterators */ + NULL, /* getiterfunc tp_iter; */ + NULL, /* iternextfunc tp_iternext; */ + + /*** Attribute descriptor and subclassing stuff ***/ + BPy_Noise_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)Noise___init__, /* initproc tp_init; */ + NULL, /* allocfunc tp_alloc; */ + PyType_GenericNew, /* newfunc tp_new; */ + + /* Low-level free-memory routine */ + NULL, /* freefunc tp_free; */ + + /* For PyObject_IS_GC */ + NULL, /* inquiry tp_is_gc; */ + NULL, /* PyObject *tp_bases; */ + + /* method resolution order */ + NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_cache; */ + NULL, /* PyObject *tp_subclasses; */ + NULL, /* PyObject *tp_weaklist; */ + NULL +}; + +//-------------------MODULE INITIALIZATION-------------------------------- +PyMODINIT_FUNC Noise_Init( PyObject *module ) +{ + if( module == NULL ) + return; + + if( PyType_Ready( &Noise_Type ) < 0 ) + return; + + Py_INCREF( &Noise_Type ); + PyModule_AddObject(module, "Noise", (PyObject *)&Noise_Type); } +//------------------------INSTANCE METHODS ---------------------------------- - PyObject *_wrap_Noise_turbulence1__SWIG_1(PyObject *self , PyObject *args) { +int Noise___init__(BPy_Noise *self, PyObject *args, PyObject *kwds) +{ + self->n = new Noise(); + return 0; } - - PyObject *_wrap_Noise_turbulence1(PyObject *self, PyObject *args) { +void Noise___dealloc__(BPy_Noise* self) +{ + delete self->n; + self->ob_type->tp_free((PyObject*)self); } - PyObject *_wrap_Noise_turbulence2__SWIG_0(PyObject *self , PyObject *args) { +PyObject * Noise___repr__(BPy_Noise* self) +{ + return PyString_FromFormat("Noise - address: %p", self->n ); } - PyObject *_wrap_Noise_turbulence2__SWIG_1(PyObject *self , PyObject *args) { -} +PyObject * Noise_turbulence1( BPy_Noise *self , PyObject *args) { + float f1, f2, f3; + unsigned int i; + if(!( PyArg_ParseTuple(args, "fff|I", &f1, &f2, &f3, &i) )) { + cout << "ERROR: Noise_turbulence1" << endl; + Py_RETURN_NONE; + } - PyObject *_wrap_Noise_turbulence2(PyObject *self, PyObject *args) { + return PyFloat_FromDouble( self->n->turbulence1(f1, f2, f3, i) ); } +PyObject * Noise_turbulence2( BPy_Noise *self , PyObject *args) { + PyObject *obj1; + float f2, f3; + unsigned int i; - PyObject *_wrap_Noise_turbulence3__SWIG_0(PyObject *self , PyObject *args) { -} + if(!( PyArg_ParseTuple(args, "Off|I", &obj1, &f2, &f3, &i) && PyList_Check(obj1) && PyList_Size(obj1) > 1 )) { + cout << "ERROR: Noise_turbulence2" << endl; + Py_RETURN_NONE; + } - - PyObject *_wrap_Noise_turbulence3__SWIG_1(PyObject *self , PyObject *args) { + Vec2f v( PyFloat_AsDouble(PyList_GetItem(obj1, 0)), PyFloat_AsDouble(PyList_GetItem(obj1, 1)) ); + + return PyFloat_FromDouble( self->n->turbulence2(v, f2, f3, i) ); } - - PyObject *_wrap_Noise_turbulence3(PyObject *self, PyObject *args) { +PyObject * Noise_turbulence3( BPy_Noise *self , PyObject *args) { + PyObject *obj1; + float f2, f3; + unsigned int i; + + if(!( PyArg_ParseTuple(args, "Off|I", &obj1, &f2, &f3, &i) && PyList_Check(obj1) && PyList_Size(obj1) > 2 )) { + cout << "ERROR: Noise_turbulence3" << endl; + Py_RETURN_NONE; + } + + Vec3f v( PyFloat_AsDouble(PyList_GetItem(obj1, 0)), + PyFloat_AsDouble(PyList_GetItem(obj1, 1)), + PyFloat_AsDouble(PyList_GetItem(obj1, 2)) ); + + return PyFloat_FromDouble( self->n->turbulence3(v, f2, f3, i) ); } +PyObject * Noise_smoothNoise1( BPy_Noise *self , PyObject *args) { + float f; - PyObject *_wrap_Noise_smoothNoise1(PyObject *self , PyObject *args) { + if(!( PyArg_ParseTuple(args, "f", &f) )) { + cout << "ERROR: Noise_smoothNoise1" << endl; + Py_RETURN_NONE; + } + + return PyFloat_FromDouble( self->n->smoothNoise1(f) ); } +PyObject * Noise_smoothNoise2( BPy_Noise *self , PyObject *args) { + PyObject *obj; + + if(!( PyArg_ParseTuple(args, "O", &obj) && PyList_Check(obj) && PyList_Size(obj) > 1 )) { + cout << "ERROR: Noise_smoothNoise2" << endl; + Py_RETURN_NONE; + } - PyObject *_wrap_Noise_smoothNoise2(PyObject *self , PyObject *args) { + Vec2f v( PyFloat_AsDouble(PyList_GetItem(obj, 0)), PyFloat_AsDouble(PyList_GetItem(obj, 1)) ); + + return PyFloat_FromDouble( self->n->smoothNoise2(v) ); } +PyObject * Noise_smoothNoise3( BPy_Noise *self , PyObject *args) { + PyObject *obj; + + if(!( PyArg_ParseTuple(args, "O", &obj) && PyList_Check(obj) && PyList_Size(obj) > 2 )) { + cout << "ERROR: Noise_smoothNoise3" << endl; + Py_RETURN_NONE; + } - PyObject *_wrap_Noise_smoothNoise3(PyObject *self , PyObject *args) { + Vec3f v( PyFloat_AsDouble(PyList_GetItem(obj, 0)), + PyFloat_AsDouble(PyList_GetItem(obj, 1)), + PyFloat_AsDouble(PyList_GetItem(obj, 2)) ); + + return PyFloat_FromDouble( self->n->smoothNoise3(v) ); } +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/BPy_Noise.h b/source/blender/freestyle/intern/python/BPy_Noise.h new file mode 100644 index 00000000000..b9b66d34e94 --- /dev/null +++ b/source/blender/freestyle/intern/python/BPy_Noise.h @@ -0,0 +1,36 @@ +#ifndef FREESTYLE_PYTHON_NOISE_H +#define FREESTYLE_PYTHON_NOISE_H + +#include "../geometry/Noise.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject Noise_Type; + +#define BPy_Noise_Check(v) (( (PyObject *) v)->ob_type == &Noise_Type) + +/*---------------------------Python BPy_Noise structure definition----------*/ +typedef struct { + PyObject_HEAD + Noise *n; +} BPy_Noise; + +/*---------------------------Python BPy_Noise visible prototypes-----------*/ + +PyMODINIT_FUNC Noise_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_NOISE_H */ diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp index 24a986b3885..e8633770c8c 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp @@ -1,104 +1,203 @@ - PyObject *_wrap_ViewMap_userdata_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewMap_userdata_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_ViewMap(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_delete_ViewMap(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewMap_GetClosestViewEdge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewMap_GetClosestFEdge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewMap_getInstance(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewMap_ViewShapes(PyObject *self , PyObject *args) { -} - +#include "BPy_ViewMap.h" + +#include "BPy_Convert.h" +#include "BPy_BBox.h" +#include "Interface1D/BPy_FEdge.h" +#include "Interface1D/BPy_ViewEdge.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for ViewMap instance -----------*/ +static int ViewMap___init__(BPy_ViewMap *self, PyObject *args, PyObject *kwds); +static void ViewMap___dealloc__(BPy_ViewMap *self); +static PyObject * ViewMap___repr__(BPy_ViewMap* self); + +static PyObject * ViewMap_getClosestViewEdge( BPy_ViewMap *self , PyObject *args); +static PyObject * ViewMap_getClosestFEdge( BPy_ViewMap *self , PyObject *args); +static PyObject * ViewMap_getScene3dBBox( BPy_ViewMap *self , PyObject *args); +static PyObject * ViewMap_setScene3dBBox( BPy_ViewMap *self , PyObject *args); + +/*---------------------- BPy_ViewShape instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewMap_methods[] = { + {"getClosestViewEdge", ( PyCFunction ) ViewMap_getClosestViewEdge, METH_VARARGS, "(double x, double y) Gets the viewedge the nearest to the 2D position specified as argument "}, + {"getClosestFEdge", ( PyCFunction ) ViewMap_getClosestFEdge, METH_VARARGS, "(double x, double y) Gets the Fedge the nearest to the 2D position specified as argument "}, + {"getScene3dBBox", ( PyCFunction ) ViewMap_getScene3dBBox, METH_NOARGS, "() Returns the scene 3D bounding box. "}, + {"setScene3dBBox", ( PyCFunction ) ViewMap_setScene3dBBox, METH_VARARGS, "(BBox bb) Sets the scene 3D bounding box."}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewMap type definition ------------------------------*/ + +PyTypeObject ViewMap_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "ViewMap", /* tp_name */ + sizeof( BPy_ViewMap ), /* tp_basicsize */ + 0, /* tp_itemsize */ + + /* methods */ + (destructor)ViewMap___dealloc__, /* tp_dealloc */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ + (reprfunc)ViewMap___repr__, /* tp_repr */ + + /* Method suites for standard classes */ + + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ + + /* More standard operations (here for binary compatibility) */ + + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ + + /* Functions to access object as input/output buffer */ + NULL, /* PyBufferProcs *tp_as_buffer; */ + + /*** Flags to define presence of optional/expanded features ***/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ + + NULL, /* char *tp_doc; Documentation string */ + /*** Assigned meaning in release 2.0 ***/ + /* call function for all accessible objects */ + NULL, /* traverseproc tp_traverse; */ + + /* delete references to contained objects */ + NULL, /* inquiry tp_clear; */ + + /*** Assigned meaning in release 2.1 ***/ + /*** rich comparisons ***/ + NULL, /* richcmpfunc tp_richcompare; */ + + /*** weak reference enabler ***/ + 0, /* long tp_weaklistoffset; */ + + /*** Added in release 2.2 ***/ + /* Iterators */ + NULL, /* getiterfunc tp_iter; */ + NULL, /* iternextfunc tp_iternext; */ + + /*** Attribute descriptor and subclassing stuff ***/ + BPy_ViewMap_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)ViewMap___init__, /* initproc tp_init; */ + NULL, /* allocfunc tp_alloc; */ + PyType_GenericNew, /* newfunc tp_new; */ + + /* Low-level free-memory routine */ + NULL, /* freefunc tp_free; */ + + /* For PyObject_IS_GC */ + NULL, /* inquiry tp_is_gc; */ + NULL, /* PyObject *tp_bases; */ + + /* method resolution order */ + NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_cache; */ + NULL, /* PyObject *tp_subclasses; */ + NULL, /* PyObject *tp_weaklist; */ + NULL +}; - PyObject *_wrap_ViewMap_ViewEdges(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewMap_ViewVertices(PyObject *self , PyObject *args) { -} +//-------------------MODULE INITIALIZATION-------------------------------- +PyMODINIT_FUNC ViewMap_Init( PyObject *module ) +{ + if( module == NULL ) + return; + if( PyType_Ready( &ViewMap_Type ) < 0 ) + return; - PyObject *_wrap_ViewMap_FEdges(PyObject *self , PyObject *args) { + Py_INCREF( &ViewMap_Type ); + PyModule_AddObject(module, "ViewMap", (PyObject *)&ViewMap_Type); } +//------------------------INSTANCE METHODS ---------------------------------- - PyObject *_wrap_ViewMap_SVertices(PyObject *self , PyObject *args) { +int ViewMap___init__(BPy_ViewMap *self, PyObject *args, PyObject *kwds) +{ + self->vm = new ViewMap(); + return 0; } - - PyObject *_wrap_ViewMap_viewedges_begin(PyObject *self , PyObject *args) { +void ViewMap___dealloc__(BPy_ViewMap *self) +{ + delete self->vm; + self->ob_type->tp_free((PyObject*)self); } - - PyObject *_wrap_ViewMap_viewedges_end(PyObject *self , PyObject *args) { +PyObject * ViewMap___repr__(BPy_ViewMap *self) +{ + return PyString_FromFormat("ViewMap - address: %p", self->vm ); } +PyObject * ViewMap_getClosestViewEdge( BPy_ViewMap *self , PyObject *args) { + double x, y; - PyObject *_wrap_ViewMap_viewedges_size(PyObject *self , PyObject *args) { -} + if(!( PyArg_ParseTuple(args, "dd", &x, &y) )) { + cout << "ERROR: ViewMap_getClosestFEdge" << endl; + Py_RETURN_NONE; + } + ViewEdge *ve = const_cast<ViewEdge *>( self->vm->getClosestViewEdge(x,y) ); + if( ve ) + return BPy_ViewEdge_from_ViewEdge(*ve); - PyObject *_wrap_ViewMap_viewShape(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } +PyObject * ViewMap_getClosestFEdge( BPy_ViewMap *self , PyObject *args) { + double x, y; - PyObject *_wrap_ViewMap_shapeIdToIndexMap(PyObject *self , PyObject *args) { -} + if(!( PyArg_ParseTuple(args, "dd", &x, &y) )) { + cout << "ERROR: ViewMap_getClosestFEdge" << endl; + Py_RETURN_NONE; + } + FEdge *fe = const_cast<FEdge *>( self->vm->getClosestFEdge(x,y) ); + if( fe ) + return BPy_FEdge_from_FEdge(*fe); - PyObject *_wrap_ViewMap_getScene3dBBox(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } - - PyObject *_wrap_ViewMap_AddViewShape(PyObject *self , PyObject *args) { +PyObject * ViewMap_getScene3dBBox( BPy_ViewMap *self , PyObject *args) { + BBox<Vec3r> bb( self->vm->getScene3dBBox() ); + return BPy_BBox_from_BBox( bb ); } +PyObject * ViewMap_setScene3dBBox( BPy_ViewMap *self , PyObject *args) { + PyObject *py_bb = 0; - PyObject *_wrap_ViewMap_AddViewEdge(PyObject *self , PyObject *args) { -} + if(!( PyArg_ParseTuple(args, "O", &py_bb) && BPy_BBox_Check(py_bb) )) { + cout << "ERROR: ViewMap_setScene3dBBox" << endl; + Py_RETURN_NONE; + } + self->vm->setScene3dBBox(*( ((BPy_BBox *) py_bb)->bb )); - PyObject *_wrap_ViewMap_AddViewVertex(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } - PyObject *_wrap_ViewMap_AddFEdge(PyObject *self , PyObject *args) { -} - +/////////////////////////////////////////////////////////////////////////////////////////// - PyObject *_wrap_ViewMap_AddSVertex(PyObject *self , PyObject *args) { +#ifdef __cplusplus } - - - PyObject *_wrap_ViewMap_setScene3dBBox(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewMap_CreateTVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewMap_InsertViewVertex(PyObject *self , PyObject *args) { -} - - +#endif
\ No newline at end of file diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.h b/source/blender/freestyle/intern/python/BPy_ViewMap.h new file mode 100644 index 00000000000..841b5d46f07 --- /dev/null +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_VIEWMAP_H +#define FREESTYLE_PYTHON_VIEWMAP_H + +#include "../view_map/ViewMap.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ViewMap_Type; + +#define BPy_ViewMap_Check(v) (( (PyObject *) v)->ob_type == &ViewMap_Type) + +/*---------------------------Python BPy_ViewMap structure definition----------*/ +typedef struct { + PyObject_HEAD + ViewMap *vm; +} BPy_ViewMap; + +/*---------------------------Python BPy_ViewMap visible prototypes-----------*/ + +PyMODINIT_FUNC ViewMap_Init( PyObject *module ); + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_VIEWMAP_H */ diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 3ac2c02a274..a87859491b4 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -16,12 +16,27 @@ static int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwd static void ViewShape___dealloc__(BPy_ViewShape *self); static PyObject * ViewShape___repr__(BPy_ViewShape* self); +static PyObject * ViewShape_sshape( BPy_ViewShape *self ); +static PyObject * ViewShape_vertices( BPy_ViewShape *self ); +static PyObject * ViewShape_edges( BPy_ViewShape *self ); +static PyObject * ViewShape_getId( BPy_ViewShape *self ); +static PyObject * ViewShape_setSShape( BPy_ViewShape *self , PyObject *args); +static PyObject * ViewShape_setVertices( BPy_ViewShape *self , PyObject *args); +static PyObject * ViewShape_setEdges( BPy_ViewShape *self , PyObject *args); +static PyObject * ViewShape_AddEdge( BPy_ViewShape *self , PyObject *args); +static PyObject * ViewShape_AddVertex( BPy_ViewShape *self , PyObject *args); /*---------------------- BPy_ViewShape instance definitions ----------------------------*/ static PyMethodDef BPy_ViewShape_methods[] = { - //{"AddEdge", ( PyCFunction ) ViewShape_AddEdge, METH_VARARGS, "(FEdge fe )Adds a FEdge to the list of FEdges. "}, - - + {"sshape", ( PyCFunction ) ViewShape_sshape, METH_NOARGS, "() Returns the SShape on top of which this ViewShape is built. "}, + {"vertices", ( PyCFunction ) ViewShape_vertices, METH_NOARGS, "() Returns the list of ViewVertex contained in this ViewShape."}, + {"edges", ( PyCFunction ) ViewShape_edges, METH_NOARGS, "() Returns the list of ViewEdge contained in this ViewShape. "}, + {"getId", ( PyCFunction ) ViewShape_getId, METH_NOARGS, "() Returns the ViewShape id. "}, + {"setSShape", ( PyCFunction ) ViewShape_setSShape, METH_VARARGS, "(SShape ss) Sets the SShape on top of which the ViewShape is built. "}, + {"setVertices", ( PyCFunction ) ViewShape_setVertices, METH_VARARGS, "([<ViewVertex>]) Sets the list of ViewVertex contained in this ViewShape."}, + {"setEdges", ( PyCFunction ) ViewShape_setEdges, METH_VARARGS, "([<ViewEdge>]) Sets the list of ViewEdge contained in this ViewShape."}, + {"AddEdge", ( PyCFunction ) ViewShape_AddEdge, METH_VARARGS, "(ViewEdge ve) Adds a ViewEdge to the list "}, + {"AddVertex", ( PyCFunction ) ViewShape_AddVertex, METH_VARARGS, "(ViewVertex ve) Adds a ViewVertex to the list. "}, {NULL, NULL, 0, NULL} }; @@ -231,7 +246,6 @@ PyObject * ViewShape_setVertices( BPy_ViewShape *self , PyObject *args) { Py_RETURN_NONE; } -//void SetEdges (const vector< ViewEdge * > &iEdges) PyObject * ViewShape_setEdges( BPy_ViewShape *self , PyObject *args) { PyObject *list = 0; PyObject *tmp; |