Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Curioni <maxime.curioni@gmail.com>2008-07-31 12:50:12 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-07-31 12:50:12 +0400
commit3010f2b753f2397256861816504b8e7d697632db (patch)
treecee975b7fc574c43be0d462447c87056c4bdfc6b /source/blender/freestyle/intern/stroke/StrokeShader.h
parenta482f644242456ad6ddf0306e1b37d8855342103 (diff)
soc-2008-mxcurioni: the native Python system now supports cross-language polymorphism for the following classes: BinaryPredicate0D (__call__), BinaryPredicate1D (__call__), UnaryPredicate0D (__call__), UnaryPredicate1D (__call__), StrokeShader (shade), ChainingIterator (init, traverse).
Other methods could easily be supported in the future. The method now works as planned for the contour style. For style modules with Python shaders, there still is a problem that I will fix right away.
Diffstat (limited to 'source/blender/freestyle/intern/stroke/StrokeShader.h')
-rwxr-xr-xsource/blender/freestyle/intern/stroke/StrokeShader.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/freestyle/intern/stroke/StrokeShader.h b/source/blender/freestyle/intern/stroke/StrokeShader.h
index fa1289f6e0f..f92895564d8 100755
--- a/source/blender/freestyle/intern/stroke/StrokeShader.h
+++ b/source/blender/freestyle/intern/stroke/StrokeShader.h
@@ -33,6 +33,8 @@
# include <iostream>
# include <vector>
+# include "../python/Director.h"
+
//
// StrokeShader base class
//
@@ -69,8 +71,11 @@ class Stroke;
class LIB_STROKE_EXPORT StrokeShader
{
public:
+
+ PyObject *py_ss;
+
/*! Default constructor. */
- StrokeShader() {}
+ StrokeShader() { py_ss = 0; }
/*! Destructor. */
virtual ~StrokeShader() {}
/*! Returns the string corresponding to the
@@ -111,7 +116,13 @@ public:
* as Color, Thickness, Geometry...)
*/
virtual void shade(Stroke& ioStroke) const {
- cerr << "Warning: method shade() not implemented" << endl;
+ string name( py_ss ? PyString_AsString(PyObject_CallMethod(py_ss, "getName", "")) : getName() );
+
+ if( py_ss && PyObject_HasAttrString(py_ss, "shade") ) {
+ return Director_BPy_StrokeShader_shade(py_ss, ioStroke);
+ } else {
+ cerr << "Warning: " << name << " method shade() not implemented" << endl;
+ }
}
};