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)
This commit is contained in:
12
source/blender/freestyle/intern/python/Director.cpp
Normal file
12
source/blender/freestyle/intern/python/Director.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "Director.h"
|
||||
|
||||
#include "BPy_Convert.h"
|
||||
|
||||
bool director_BPy_UnaryPredicate1D___call__( PyObject *py_up1D, Interface1D& if1D) {
|
||||
cout << "Polymorphism works" << endl;
|
||||
|
||||
PyObject *method = PyObject_GetAttrString( py_up1D, "__call__");
|
||||
PyObject *result = PyObject_CallFunction(method, "O", BPy_Interface1D_from_Interface1D(if1D) );
|
||||
|
||||
return bool_from_PyBool(result);
|
||||
}
|
||||
Reference in New Issue
Block a user