diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-29 09:45:16 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-29 09:45:16 +0400 |
commit | db6388e0f2b1e03ff280615fb96b93c565c9b22a (patch) | |
tree | 3a538b4464fb6b9d6bef5df129027970f37f08c8 /source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp | |
parent | e4677c409dcad94e96b2ae765422f91e0b0dd9fd (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/BPy_ChainingIterator.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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; +} |