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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-07-20 03:17:30 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-07-20 03:17:30 +0400
commit5fed0560d9184d9dd64625ce6af70f67e0ad0960 (patch)
treebf7c1675ebfa339ece476a66015d7225383084f6 /source/blender/freestyle/intern/python/Director.cpp
parent1cb1d0e6e96e60bb64fc42056e1a3d77b28cf1a4 (diff)
* Introspection-based automatic type conversion from a generic C++ object
to a specific Python object. The conversion takes place in the following places. - Interface0DIterator_getObject (BPy_Interface0DIterator.cpp) - Director_BPy_BinaryPredicate1D___call__ (Director.cpp) - Director_BPy_UnaryPredicate1D___call__ (Director.cpp) - SVertex_viewvertex (BPy_SVertex.cpp) - BPy_FEdge_from_FEdge (BPy_Convert.cpp) This is a tentative list and more conversions are expected to be added. * Added the following two converter functions to BPy_Convert.{cpp,h}: - BPy_NonTVertex_from_NonTVertex_ptr - BPy_TVertex_from_TVertex_ptr
Diffstat (limited to 'source/blender/freestyle/intern/python/Director.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp
index 84560de67a8..dd4688515a7 100644
--- a/source/blender/freestyle/intern/python/Director.cpp
+++ b/source/blender/freestyle/intern/python/Director.cpp
@@ -59,8 +59,21 @@ int Director_BPy_BinaryPredicate0D___call__( PyObject *obj, Interface0D& i1, Int
// BinaryPredicate1D: __call__
int Director_BPy_BinaryPredicate1D___call__( PyObject *obj, Interface1D& i1, Interface1D& i2) {
- PyObject *arg1 = BPy_Interface1D_from_Interface1D(i1);
- PyObject *arg2 = BPy_Interface1D_from_Interface1D(i2);
+ PyObject *arg1, *arg2;
+ if (typeid(i1) == typeid(ViewEdge)) {
+ arg1 = BPy_ViewEdge_from_ViewEdge_ptr(dynamic_cast<ViewEdge*>(&i1));
+ arg2 = BPy_ViewEdge_from_ViewEdge_ptr(dynamic_cast<ViewEdge*>(&i2));
+ } else if (typeid(i1) == typeid(Chain)) {
+ arg1 = BPy_Chain_from_Chain_ptr(dynamic_cast<Chain*>(&i1));
+ arg2 = BPy_Chain_from_Chain_ptr(dynamic_cast<Chain*>(&i2));
+ } else if (typeid(i1) == typeid(Stroke)) {
+ arg1 = BPy_Stroke_from_Stroke_ptr(dynamic_cast<Stroke*>(&i1));
+ arg2 = BPy_Stroke_from_Stroke_ptr(dynamic_cast<Stroke*>(&i2));
+ } else {
+ cerr << "Warning: cast to " + i1.getExactTypeName() + " not implemented" << endl;
+ arg1 = BPy_Interface1D_from_Interface1D(i1);
+ arg2 = BPy_Interface1D_from_Interface1D(i2);
+ }
PyObject *result = PyObject_CallMethod( obj, "__call__", "OO", arg1, arg2 );
Py_DECREF(arg1);
Py_DECREF(arg2);
@@ -87,7 +100,17 @@ int Director_BPy_UnaryPredicate0D___call__( PyObject *obj, Interface0DIterator&
// UnaryPredicate1D: __call__
int Director_BPy_UnaryPredicate1D___call__( PyObject *obj, Interface1D& if1D) {
- PyObject *arg = BPy_Interface1D_from_Interface1D(if1D);
+ PyObject *arg;
+ if (typeid(if1D) == typeid(ViewEdge)) {
+ arg = BPy_ViewEdge_from_ViewEdge_ptr(dynamic_cast<ViewEdge*>(&if1D));
+ } else if (typeid(if1D) == typeid(Chain)) {
+ arg = BPy_Chain_from_Chain_ptr(dynamic_cast<Chain*>(&if1D));
+ } else if (typeid(if1D) == typeid(Stroke)) {
+ arg = BPy_Stroke_from_Stroke_ptr(dynamic_cast<Stroke*>(&if1D));
+ } else {
+ cerr << "Warning: cast to " + if1D.getExactTypeName() + " not implemented" << endl;
+ arg = BPy_Interface1D_from_Interface1D(if1D);
+ }
PyObject *result = PyObject_CallMethod( obj, "__call__", "O", arg );
Py_DECREF(arg);
if (!result)