diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-08-02 01:55:58 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-08-02 01:55:58 +0400 |
commit | 7565990db264dbb7771744cea0a1c87b3e11fc3f (patch) | |
tree | db4795f8c46b8cde474112e775708f57a13ccf9e /source/blender/freestyle/intern/view_map/Functions0D.h | |
parent | c324f0cbc72b47182ba3d7fd1bbd280fcebe3283 (diff) |
soc-2008-mxcurioni: made considerable changes to support cross-language polymorphism for UnaryFunction0D, Interface0D, Interface1D. Add to change UnaryFunction1D<void> to static UnaryFunction1D_void. Resolved namespace collision on the Image class (changed to FrsImage). There is greater support for style modules but somehow, some do not show anything yet (japanese_bigbrush being an example).
Diffstat (limited to 'source/blender/freestyle/intern/view_map/Functions0D.h')
-rwxr-xr-x | source/blender/freestyle/intern/view_map/Functions0D.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.h b/source/blender/freestyle/intern/view_map/Functions0D.h index 1ad35da8d91..9543e8c34a6 100755 --- a/source/blender/freestyle/intern/view_map/Functions0D.h +++ b/source/blender/freestyle/intern/view_map/Functions0D.h @@ -43,6 +43,8 @@ class SShape; using namespace Geometry; +#include "../python/Director.h" + // // UnaryFunction0D (base class for functions in 0D) // @@ -70,12 +72,15 @@ class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction0D { public: + T result; + PyObject *py_uf0D; + /*! The type of the value * returned by the functor. */ typedef T ReturnedValueType; /*! Default constructor. */ - UnaryFunction0D() {} +UnaryFunction0D() { py_uf0D = 0;} /*! Destructor; */ virtual ~UnaryFunction0D() {} /*! Returns the string "UnaryFunction0D" */ @@ -90,9 +95,17 @@ public: * \return the result of the function of type T. */ virtual T operator()(Interface0DIterator& iter) { - cerr << "Warning: UnaryFunction0D operator() not implemented" << endl; - return T(); + string name( py_uf0D ? PyString_AsString(PyObject_CallMethod(py_uf0D, "getName", "")) : getName() ); + + if( py_uf0D && PyObject_HasAttrString(py_uf0D, "__call__") ) { + Director_BPy_UnaryFunction0D___call__( this, py_uf0D, iter); + return result; + } else { + cerr << "Warning: " << name << " operator() not implemented" << endl; + return T(); + } } + }; # ifdef SWIG |