diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-07-20 03:17:30 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-07-20 03:17:30 +0400 |
commit | 5fed0560d9184d9dd64625ce6af70f67e0ad0960 (patch) | |
tree | bf7c1675ebfa339ece476a66015d7225383084f6 /source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp | |
parent | 1cb1d0e6e96e60bb64fc42056e1a3d77b28cf1a4 (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/Iterator/BPy_Interface0DIterator.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index 5c35aa612a6..096baad2936 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -136,7 +136,23 @@ PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self ) { } PyObject * Interface0DIterator_getObject(BPy_Interface0DIterator *self) { - return BPy_Interface0D_from_Interface0D( self->if0D_it->operator*() ); + Interface0D &if0D = self->if0D_it->operator*(); + if (typeid(if0D) == typeid(CurvePoint)) { + return BPy_CurvePoint_from_CurvePoint_ptr(dynamic_cast<CurvePoint*>(&if0D)); + } else if (typeid(if0D) == typeid(StrokeVertex)) { + return BPy_StrokeVertex_from_StrokeVertex_ptr(dynamic_cast<StrokeVertex*>(&if0D)); + } else if (typeid(if0D) == typeid(SVertex)) { + return BPy_SVertex_from_SVertex_ptr(dynamic_cast<SVertex*>(&if0D)); + } else if (typeid(if0D) == typeid(ViewVertex)) { + return BPy_ViewVertex_from_ViewVertex_ptr(dynamic_cast<ViewVertex*>(&if0D)); + } else if (typeid(if0D) == typeid(NonTVertex)) { + return BPy_NonTVertex_from_NonTVertex_ptr(dynamic_cast<NonTVertex*>(&if0D)); + } else if (typeid(if0D) == typeid(TVertex)) { + return BPy_TVertex_from_TVertex_ptr(dynamic_cast<TVertex*>(&if0D)); + } else { + cerr << "Warning: cast to " << if0D.getExactTypeName() << " not implemented" << endl; + return BPy_Interface0D_from_Interface0D(if0D); + } } |