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-29 09:45:16 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-07-29 09:45:16 +0400
commitdb6388e0f2b1e03ff280615fb96b93c565c9b22a (patch)
tree3a538b4464fb6b9d6bef5df129027970f37f08c8 /source/blender/freestyle/intern/python/Iterator
parente4677c409dcad94e96b2ae765422f91e0b0dd9fd (diff)
soc-2008-mxcurioni: finished porting the Freestyle API. All of the original classes, except EdgeModifier and TimestampModifier (which aren't even ported via SWIG), are available under the Blender.Freestyle module. Testing of the porting will now begin to make sure the SWIG-less system works as the original.
Quite a few modifications were made to finish the API: - Freestyle's SConscript was modified to catch all files within the intern/python directory, allowing integration of future shaders implemented in C++. - the Operators class was ported, with a special care of making its methods static (using the METH_STATIC flag in the tp_methods method definitions) - all of the type-checking functions [ BPy_[class name]_Check(obj) ] were changed to allow subclasses to be seen as that type too: instead on looking at the ob_type value, the PyObject_IsInstance function is used. - all of the iterators can now retrieve the object pointed to by the operator, using the getObject() method. A directedViewEdge pair is returned as a list of the two elements in the pair. - all of the style modules were copied to a style_modules_blender/ folder and were modified to use Freestyle as a Blender's submodule. IntegrationType and MediumType was also integrated (for example, changing MEAN to IntegrationType.MEAN). Testing now begins. If everything works correctly, I'll move on to lib3ds removal right away.
Diffstat (limited to 'source/blender/freestyle/intern/python/Iterator')
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp13
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp7
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp9
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp9
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp12
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp13
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h2
18 files changed, 90 insertions, 13 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
index e40f129d3d8..13c8382c3a2 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
@@ -12,8 +12,11 @@ extern "C" {
/*--------------- Python API function prototypes for AdjacencyIterator instance -----------*/
static int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args);
+static PyObject * AdjacencyIterator_getObject(BPy_AdjacencyIterator *self);
+
/*----------------------AdjacencyIterator instance definitions ----------------------------*/
static PyMethodDef BPy_AdjacencyIterator_methods[] = {
+ {"getObject", ( PyCFunction ) AdjacencyIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
{NULL, NULL, 0, NULL}
};
@@ -135,6 +138,16 @@ int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args )
}
+PyObject * AdjacencyIterator_getObject(BPy_AdjacencyIterator *self) {
+
+ ViewEdge *ve = self->a_it->operator*();
+ if( ve )
+ return BPy_ViewEdge_from_ViewEdge( *ve );
+
+ Py_RETURN_NONE;
+}
+
+
///////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
index de0178f7725..733a9f2fcab 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
@@ -15,7 +15,7 @@ extern "C" {
extern PyTypeObject AdjacencyIterator_Type;
-#define BPy_AdjacencyIterator_Check(v) (( (PyObject *) v)->ob_type == &AdjacencyIterator_Type)
+#define BPy_AdjacencyIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &AdjacencyIterator_Type) )
/*---------------------------Python BPy_AdjacencyIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
index c5d32fb01f3..39a794b27f7 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
@@ -16,7 +16,7 @@ extern "C" {
extern PyTypeObject ChainPredicateIterator_Type;
-#define BPy_ChainPredicateIterator_Check(v) (( (PyObject *) v)->ob_type == &ChainPredicateIterator_Type)
+#define BPy_ChainPredicateIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ChainPredicateIterator_Type) )
/*---------------------------Python BPy_ChainPredicateIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h
index 7e6feb00910..912d397d279 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h
@@ -16,7 +16,7 @@ extern "C" {
extern PyTypeObject ChainSilhouetteIterator_Type;
-#define BPy_ChainSilhouetteIterator_Check(v) (( (PyObject *) v)->ob_type == &ChainSilhouetteIterator_Type)
+#define BPy_ChainSilhouetteIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ChainSilhouetteIterator_Type) )
/*---------------------------Python BPy_ChainSilhouetteIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
index c695e92ec70..525b0697fa7 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
@@ -18,12 +18,15 @@ static PyObject * ChainingIterator_traverse( BPy_ChainingIterator *self, PyObjec
static PyObject * ChainingIterator_getVertex( BPy_ChainingIterator *self );
static PyObject * ChainingIterator_isIncrementing( BPy_ChainingIterator *self );
+static PyObject * ChainingIterator_getObject( BPy_ChainingIterator *self);
+
/*----------------------ChainingIterator instance definitions ----------------------------*/
static PyMethodDef BPy_ChainingIterator_methods[] = {
{"init", ( PyCFunction ) ChainingIterator_init, METH_NOARGS, "() Inits the iterator context. This method is called each time a new chain is started. It can be used to reset some history information that you might want to keep."},
{"traverse", ( PyCFunction ) ChainingIterator_traverse, METH_VARARGS, "(AdjacencyIterator ai) This method iterates over the potential next ViewEdges and returns the one that will be followed next. Returns the next ViewEdge to follow or 0 when the end of the chain is reached. "},
{"getVertex", ( PyCFunction ) ChainingIterator_getVertex, METH_NOARGS, "() Returns the vertex which is the next crossing "},
{"isIncrementing", ( PyCFunction ) ChainingIterator_isIncrementing, METH_NOARGS, "() Returns true if the current iteration is an incrementation."},
+ {"getObject", ( PyCFunction ) ChainingIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
{NULL, NULL, 0, NULL}
};
@@ -171,7 +174,14 @@ PyObject *ChainingIterator_isIncrementing( BPy_ChainingIterator *self ) {
return PyBool_from_bool( self->c_it->isIncrementing() );
}
+PyObject * ChainingIterator_getObject( BPy_ChainingIterator *self) {
+
+ ViewEdge *ve = self->c_it->operator*();
+ if( ve )
+ return BPy_ViewEdge_from_ViewEdge( *ve );
+ Py_RETURN_NONE;
+}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h
index 2994f381c1d..2a00aa8072f 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h
@@ -16,7 +16,7 @@ extern "C" {
extern PyTypeObject ChainingIterator_Type;
-#define BPy_ChainingIterator_Check(v) (( (PyObject *) v)->ob_type == &ChainingIterator_Type)
+#define BPy_ChainingIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ChainingIterator_Type) )
/*---------------------------Python BPy_ChainingIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
index 1f830261739..c02bd0a00fc 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
@@ -1,5 +1,6 @@
#include "BPy_CurvePointIterator.h"
+#include "../BPy_Convert.h"
#include "BPy_Interface0DIterator.h"
#ifdef __cplusplus
@@ -14,12 +15,14 @@ static PyObject * CurvePointIterator_t( BPy_CurvePointIterator *self );
static PyObject * CurvePointIterator_u( BPy_CurvePointIterator *self );
static PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator *self );
+static PyObject * CurvePointIterator_getObject(BPy_CurvePointIterator *self);
/*----------------------CurvePointIterator instance definitions ----------------------------*/
static PyMethodDef BPy_CurvePointIterator_methods[] = {
{"t", ( PyCFunction ) CurvePointIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."},
{"u", ( PyCFunction ) CurvePointIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."},
{"castToInterface0DIterator", ( PyCFunction ) CurvePointIterator_castToInterface0DIterator, METH_NOARGS, "() Casts this CurvePointIterator into an Interface0DIterator. Useful for any call to a function of the type UnaryFunction0D."},
+ {"getObject", ( PyCFunction ) CurvePointIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
{NULL, NULL, 0, NULL}
};
@@ -153,6 +156,10 @@ PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator
return py_if0D_it;
}
+PyObject * CurvePointIterator_getObject(BPy_CurvePointIterator *self) {
+ return BPy_CurvePoint_from_CurvePoint( self->cp_it->operator*() );
+}
+
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
index e8f082216de..ad04c7208bb 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
@@ -15,7 +15,7 @@ extern "C" {
extern PyTypeObject CurvePointIterator_Type;
-#define BPy_CurvePointIterator_Check(v) (( (PyObject *) v)->ob_type == &CurvePointIterator_Type)
+#define BPy_CurvePointIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &CurvePointIterator_Type) )
/*---------------------------Python BPy_CurvePointIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
index c88ba7773ab..92c3a7dfc38 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
@@ -1,5 +1,7 @@
#include "BPy_Interface0DIterator.h"
+#include "../BPy_Convert.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -12,10 +14,13 @@ static int Interface0DIterator___init__(BPy_Interface0DIterator *self, PyObject
static PyObject * Interface0DIterator_t( BPy_Interface0DIterator *self );
static PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self );
+static PyObject * Interface0DIterator_getObject(BPy_Interface0DIterator *self);
+
/*----------------------Interface0DIterator instance definitions ----------------------------*/
static PyMethodDef BPy_Interface0DIterator_methods[] = {
{"t", ( PyCFunction ) Interface0DIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."},
{"u", ( PyCFunction ) Interface0DIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."},
+ {"getObject", ( PyCFunction ) Interface0DIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
{NULL, NULL, 0, NULL}
};
@@ -130,6 +135,11 @@ PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self ) {
return PyFloat_FromDouble( self->if0D_it->u() );
}
+PyObject * Interface0DIterator_getObject(BPy_Interface0DIterator *self) {
+ return BPy_Interface0D_from_Interface0D( self->if0D_it->operator*() );
+}
+
+
///////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h
index 16edb2c3d68..c829d3d9d31 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h
@@ -15,7 +15,7 @@ extern "C" {
extern PyTypeObject Interface0DIterator_Type;
-#define BPy_Interface0DIterator_Check(v) (( (PyObject *) v)->ob_type == &Interface0DIterator_Type)
+#define BPy_Interface0DIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Interface0DIterator_Type) )
/*---------------------------Python BPy_Interface0DIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
index 649447f1db6..383480b8a9d 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
@@ -1,5 +1,6 @@
#include "BPy_SVertexIterator.h"
+#include "../BPy_Convert.h"
#include "../Interface0D/BPy_SVertex.h"
#include "../Interface1D/BPy_FEdge.h"
@@ -15,10 +16,13 @@ static int SVertexIterator___init__(BPy_SVertexIterator *self, PyObject *args);
static PyObject * SVertexIterator_t( BPy_SVertexIterator *self );
static PyObject * SVertexIterator_u( BPy_SVertexIterator *self );
+static PyObject * SVertexIterator_getObject( BPy_SVertexIterator *self);
+
/*----------------------SVertexIterator instance definitions ----------------------------*/
static PyMethodDef BPy_SVertexIterator_methods[] = {
{"t", ( PyCFunction ) SVertexIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."},
{"u", ( PyCFunction ) SVertexIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."},
+ {"getObject", ( PyCFunction ) SVertexIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
{NULL, NULL, 0, NULL}
};
@@ -155,6 +159,11 @@ PyObject * SVertexIterator_u( BPy_SVertexIterator *self ) {
return PyFloat_FromDouble( self->sv_it->u() );
}
+PyObject * SVertexIterator_getObject( BPy_SVertexIterator *self) {
+ return BPy_SVertex_from_SVertex( self->sv_it->operator*() );
+}
+
+
///////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
index ba6fbf020d0..b40f4d36420 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
@@ -16,7 +16,7 @@ extern "C" {
extern PyTypeObject SVertexIterator_Type;
-#define BPy_SVertexIterator_Check(v) (( (PyObject *) v)->ob_type == &SVertexIterator_Type)
+#define BPy_SVertexIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SVertexIterator_Type) )
/*---------------------------Python BPy_SVertexIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
index 1f04be635c5..0b1554a1cb7 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
@@ -1,5 +1,6 @@
#include "BPy_StrokeVertexIterator.h"
+#include "../BPy_Convert.h"
#include "BPy_Interface0DIterator.h"
#ifdef __cplusplus
@@ -14,11 +15,15 @@ static PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self );
static PyObject * StrokeVertexIterator_u( BPy_StrokeVertexIterator *self );
static PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexIterator *self );
+static PyObject * StrokeVertexIterator_getObject( BPy_StrokeVertexIterator *self);
+
+
/*----------------------StrokeVertexIterator instance definitions ----------------------------*/
static PyMethodDef BPy_StrokeVertexIterator_methods[] = {
{"t", ( PyCFunction ) StrokeVertexIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."},
{"u", ( PyCFunction ) StrokeVertexIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."},
{"castToInterface0DIterator", ( PyCFunction ) StrokeVertexIterator_castToInterface0DIterator, METH_NOARGS, "() Casts this StrokeVertexIterator into an Interface0DIterator. Useful for any call to a function of the type UnaryFunction0D."},
+ {"getObject", ( PyCFunction ) StrokeVertexIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
{NULL, NULL, 0, NULL}
};
@@ -149,6 +154,10 @@ PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexItera
return py_if0D_it;
}
+PyObject * StrokeVertexIterator_getObject( BPy_StrokeVertexIterator *self) {
+ return BPy_StrokeVertex_from_StrokeVertex( self->sv_it->operator*() );
+}
+
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
index 488a1efea3d..9e95fc0a401 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
@@ -15,7 +15,7 @@ extern "C" {
extern PyTypeObject StrokeVertexIterator_Type;
-#define BPy_StrokeVertexIterator_Check(v) (( (PyObject *) v)->ob_type == &StrokeVertexIterator_Type)
+#define BPy_StrokeVertexIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &StrokeVertexIterator_Type) )
/*---------------------------Python BPy_StrokeVertexIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
index add10cd1522..1f3e3c05d91 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
@@ -21,6 +21,9 @@ static PyObject * ViewEdgeIterator_getOrientation( BPy_ViewEdgeIterator *self );
static PyObject * ViewEdgeIterator_setOrientation( BPy_ViewEdgeIterator *self, PyObject *args );
static PyObject * ViewEdgeIterator_changeOrientation( BPy_ViewEdgeIterator *self );
+static PyObject * ViewEdgeIterator_getObject(BPy_ViewEdgeIterator *self);
+
+
/*----------------------ViewEdgeIterator instance definitions ----------------------------*/
static PyMethodDef BPy_ViewEdgeIterator_methods[] = {
{"getCurrentEdge", ( PyCFunction ) ViewEdgeIterator_getCurrentEdge, METH_NOARGS, "() Returns the current pointed ViewEdge."},
@@ -30,6 +33,7 @@ static PyMethodDef BPy_ViewEdgeIterator_methods[] = {
{"getOrientation", ( PyCFunction ) ViewEdgeIterator_getOrientation, METH_NOARGS, "() Gets the orientation of the pointed ViewEdge in the iteration. "},
{"setOrientation", ( PyCFunction ) ViewEdgeIterator_setOrientation, METH_VARARGS, "(bool b) Sets the orientation of the pointed ViewEdge in the iteration. "},
{"changeOrientation", ( PyCFunction ) ViewEdgeIterator_changeOrientation, METH_NOARGS, "() Changes the current orientation."},
+ {"getObject", ( PyCFunction ) ViewEdgeIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
{NULL, NULL, 0, NULL}
};
@@ -208,6 +212,14 @@ PyObject *ViewEdgeIterator_changeOrientation( BPy_ViewEdgeIterator *self ) {
Py_RETURN_NONE;
}
+PyObject * ViewEdgeIterator_getObject( BPy_ViewEdgeIterator *self) {
+
+ ViewEdge *ve = self->ve_it->operator*();
+ if( ve )
+ return BPy_ViewEdge_from_ViewEdge( *ve );
+
+ Py_RETURN_NONE;
+}
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h
index a86547c5937..dce90efc8cf 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h
@@ -16,7 +16,7 @@ extern "C" {
extern PyTypeObject ViewEdgeIterator_Type;
-#define BPy_ViewEdgeIterator_Check(v) (( (PyObject *) v)->ob_type == &ViewEdgeIterator_Type)
+#define BPy_ViewEdgeIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ViewEdgeIterator_Type) )
/*---------------------------Python BPy_ViewEdgeIterator structure definition----------*/
typedef struct {
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
index ec6850c3b96..0937e04e3a7 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
@@ -1,5 +1,7 @@
#include "BPy_orientedViewEdgeIterator.h"
+#include "../BPy_Convert.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -9,8 +11,12 @@ extern "C" {
/*--------------- Python API function prototypes for orientedViewEdgeIterator instance -----------*/
static int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args);
+static PyObject * orientedViewEdgeIterator_getObject(BPy_orientedViewEdgeIterator *self);
+
+
/*----------------------orientedViewEdgeIterator instance definitions ----------------------------*/
static PyMethodDef BPy_orientedViewEdgeIterator_methods[] = {
+ {"getObject", ( PyCFunction ) orientedViewEdgeIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
{NULL, NULL, 0, NULL}
};
@@ -99,9 +105,6 @@ PyTypeObject orientedViewEdgeIterator_Type = {
NULL
};
-//-------------------MODULE INITIALIZATION--------------------------------
-
-
//------------------------INSTANCE METHODS ----------------------------------
int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args )
@@ -121,6 +124,10 @@ int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObje
return 0;
}
+PyObject * orientedViewEdgeIterator_getObject( BPy_orientedViewEdgeIterator *self) {
+ return BPy_directedViewEdge_from_directedViewEdge( self->ove_it->operator*() );
+}
+
///////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h
index 1c8a25258b7..973d0f2b728 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h
@@ -16,7 +16,7 @@ extern "C" {
extern PyTypeObject orientedViewEdgeIterator_Type;
-#define BPy_orientedViewEdgeIterator_Check(v) (( (PyObject *) v)->ob_type == &orientedViewEdgeIterator_Type)
+#define BPy_orientedViewEdgeIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &orientedViewEdgeIterator_Type) )
/*---------------------------Python BPy_orientedViewEdgeIterator structure definition----------*/
typedef struct {