diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-30 05:51:40 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-30 05:51:40 +0400 |
commit | a482f644242456ad6ddf0306e1b37d8855342103 (patch) | |
tree | 4d89fe22969b7970ce09f195d82261ac47544157 /source/blender/freestyle/intern/stroke/Predicates1D.h | |
parent | 7d5eaa674b70b13af3c67b2209fdfe32b6168e45 (diff) |
soc-2008-mxcurioni: Tested SWIG-less environment more and understood why the former predicate methods were not working. As Stéphane had mentioned a few months ago, Freestyle uses SWIG directors to provide cross-language polymorphism. The API and the system I had provided did not support that feature and only implementations in C++ were supported. To correct the problem, after researching how directors are implemented in SWIG, I provided the same functionality. So far, I only provided the code for the UnaryPredicate1D class and it works. The implementation is in intern/python/Director.cpp and Operators.cpp. I will port the remaining directors tonight and continue to test it.
To prevent strokes from piling up after each render, I clear the canvas at each render now (as it should have been all along)
Diffstat (limited to 'source/blender/freestyle/intern/stroke/Predicates1D.h')
-rwxr-xr-x | source/blender/freestyle/intern/stroke/Predicates1D.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h index cf9a3283ae4..98148361bb7 100755 --- a/source/blender/freestyle/intern/stroke/Predicates1D.h +++ b/source/blender/freestyle/intern/stroke/Predicates1D.h @@ -36,6 +36,8 @@ # include "../view_map/Functions1D.h" # include "AdvancedFunctions1D.h" +# include "../python/Director.h" + // // UnaryPredicate1D (base class for predicates in 1D) // @@ -52,8 +54,13 @@ class UnaryPredicate1D { public: + + PyObject *py_up1D; + /*! Default constructor. */ - UnaryPredicate1D() {} + UnaryPredicate1D() { + py_up1D = 0; + } /*! Destructor. */ virtual ~UnaryPredicate1D() {} /*! Returns the string of the name @@ -71,9 +78,17 @@ public: * false otherwise. */ virtual bool operator()(Interface1D& inter) { - cerr << "Warning: operator() not implemented" << endl; - return false; + + if( py_up1D ) { + return director_BPy_UnaryPredicate1D___call__(py_up1D, inter); + } else { + cerr << "Warning: operator() not implemented" << endl; + return false; + } } + + inline void setPythonObject(PyObject *_py_up1D) { py_up1D = _py_up1D; } + }; |