diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-27 07:40:37 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-27 07:40:37 +0400 |
commit | 995fdd9fcd382869cb5c87517c5aef5aeb08dd7a (patch) | |
tree | 147a3feede84b5ca1351a894804e7a9fcba78b45 /source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp | |
parent | 0c64c49d2f930aed4ef310c2331bc3df0932cbe2 (diff) |
soc-2008-mxcurioni: implemented and tested unary predicates. The good news is that My approach seems to works (even though it is not fully testable as it needs Freestyle to be running). I will now port the 80 predicate subclasses left.
In this commit, UnaryPredicate0DDouble and its subclasses DensityF0D and LocalAverageDepthF0D are implemented and integrated in the API.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp | 47 |
1 files changed, 5 insertions, 42 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp index dda236a0989..01783bf0f7f 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp @@ -1,6 +1,6 @@ #include "BPy_UnaryFunction0D.h" -#include "BPy_Convert.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h" #ifdef __cplusplus extern "C" { @@ -9,17 +9,11 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for UnaryFunction0D instance -----------*/ -static int UnaryFunction0D___init__(BPy_UnaryFunction0D *self, PyObject *args, PyObject *kwds); static void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D *self); static PyObject * UnaryFunction0D___repr__(BPy_UnaryFunction0D *self); -static PyObject * UnaryFunction0D_getName( BPy_UnaryFunction0D *self, PyObject *args); -static PyObject * UnaryFunction0D___call__( BPy_UnaryFunction0D *self, PyObject *args); - /*----------------------UnaryFunction0D instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0D_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0D_getName, METH_NOARGS, ""}, - {"__call__", ( PyCFunction ) UnaryFunction0D___call__, METH_VARARGS, "" }, {NULL, NULL, 0, NULL} }; @@ -89,7 +83,7 @@ PyTypeObject UnaryFunction0D_Type = { NULL, /* descrgetfunc tp_descr_get; */ NULL, /* descrsetfunc tp_descr_set; */ 0, /* long tp_dictoffset; */ - (initproc)UnaryFunction0D___init__, /* initproc tp_init; */ + NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ PyType_GenericNew, /* newfunc tp_new; */ @@ -118,54 +112,23 @@ PyMODINIT_FUNC UnaryFunction0D_Init( PyObject *module ) return; Py_INCREF( &UnaryFunction0D_Type ); PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type); + + UnaryFunction0DDouble_Init( module ); } //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0D___init__(BPy_UnaryFunction0D *self, PyObject *args, PyObject *kwds) -{ - return 0; -} - void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D* self) { - //delete self->uf0D; self->ob_type->tp_free((PyObject*)self); } PyObject * UnaryFunction0D___repr__(BPy_UnaryFunction0D* self) { - return PyString_FromFormat("type: %s - address: %p", ((UnaryFunction0D<void> *) self->uf0D)->getName().c_str(), self->uf0D ); -} - - -PyObject * UnaryFunction0D_getName( BPy_UnaryFunction0D *self, PyObject *args) -{ - return PyString_FromString( ((UnaryFunction0D<void> *) self->uf0D)->getName().c_str() ); + return PyString_FromString("UnaryFunction0D"); } -PyObject * UnaryFunction0D___call__( BPy_UnaryFunction0D *self, PyObject *args) -{ - PyObject *l; - - if( !PyArg_ParseTuple(args, "O", &l) ) { - cout << "ERROR: UnaryFunction0D___call__ " << endl; - return NULL; - } - - // pb: operator() is called on Interface0DIterator while we have a list - // solutions: - // 1)reconvert back to iterator ? - // 2) adapt interface0d to have t(), u() functions - - // b = self->bp0D->operator()( *(obj1->uf0D) ); - // return PyBool_from_bool( b ); - - Py_RETURN_NONE; -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus |