Revision: 15783
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15783
Author:   mxcurioni
Date:     2008-07-26 21:32:47 +0200 (Sat, 26 Jul 2008)

Log Message:
-----------
soc-2008-mxcurioni: completed implementing ViewEdgeIterator and 
ChainingIterator. Updated UnaryPredicate{0D,1D}

Modified Paths:
--------------
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp

Added Paths:
-----------
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h

Removed Paths:
-------------
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingPredicateIterator.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingSilhouetteIterator.cpp

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
 2008-07-26 18:38:59 UTC (rev 15782)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
 2008-07-26 19:32:47 UTC (rev 15783)
@@ -8,7 +8,11 @@
 #include "Iterator/BPy_SVertexIterator.h"
 #include "Iterator/BPy_orientedViewEdgeIterator.h"
 #include "Iterator/BPy_ViewEdgeIterator.h"
+#include "Iterator/BPy_ChainingIterator.h"
+// #include "Iterator/BPy_ChainPredicateIterator.h"
+// #include "Iterator/BPy_ChainSilhouetteIterator.h"
 
+
        
 #ifdef __cplusplus
 extern "C" {
@@ -167,7 +171,22 @@
        Py_INCREF( &ViewEdgeIterator_Type );
        PyModule_AddObject(module, "ViewEdgeIterator", (PyObject 
*)&ViewEdgeIterator_Type);
        
+       if( PyType_Ready( &ChainingIterator_Type ) < 0 )
+               return;
+       Py_INCREF( &ChainingIterator_Type );
+       PyModule_AddObject(module, "ChainingIterator", (PyObject 
*)&ChainingIterator_Type);
        
+       // if( PyType_Ready( &ChainPredicateIterator_Type ) < 0 )
+       //      return;
+       // Py_INCREF( &ChainPredicateIterator_Type );
+       // PyModule_AddObject(module, "ChainPredicateIterator", (PyObject 
*)&ChainPredicateIterator_Type);
+       // 
+       // if( PyType_Ready( &ChainSilhouetteIterator_Type ) < 0 )
+       //      return;
+       // Py_INCREF( &ChainSilhouetteIterator_Type );
+       // PyModule_AddObject(module, "ChainSilhouetteIterator", (PyObject 
*)&ChainSilhouetteIterator_Type);
+       
+       
 }
 
 //------------------------INSTANCE METHODS ----------------------------------

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
 2008-07-26 18:38:59 UTC (rev 15782)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
 2008-07-26 19:32:47 UTC (rev 15783)
@@ -1,6 +1,7 @@
 #include "BPy_UnaryPredicate0D.h"
 
 #include "BPy_Convert.h"
+#include "Iterator/BPy_Interface0DIterator.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -124,6 +125,7 @@
 
 int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, 
PyObject *kwds)
 {
+       self->up0D = new UnaryPredicate0D();
        return 0;
 }
 
@@ -147,15 +149,18 @@
 
 PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject 
*args)
 {
-       PyObject *l;
+       PyObject *py_if0D_it;
 
-       if( !PyArg_ParseTuple(args, "O", &l) ) {
+       if(!( PyArg_ParseTuple(args, "O", &py_if0D_it) && 
BPy_Interface0DIterator_Check(py_if0D_it) )) {
                cout << "ERROR: UnaryPredicate0D___call__ " << endl;            
                return NULL;
        }
-       
-       //TBD
-       
+
+       Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *) 
py_if0D_it)->if0D_it;
+
+       if( if0D_it )
+               return PyBool_from_bool( self->up0D->operator()(*if0D_it) );
+
        Py_RETURN_NONE;
 }
 

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
 2008-07-26 18:38:59 UTC (rev 15782)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
 2008-07-26 19:32:47 UTC (rev 15783)
@@ -1,6 +1,7 @@
 #include "BPy_UnaryPredicate1D.h"
 
 #include "BPy_Convert.h"
+#include "BPy_Interface1D.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -124,6 +125,7 @@
 
 int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, 
PyObject *kwds)
 {
+       self->up1D = new UnaryPredicate1D();
        return 0;
 }
 
@@ -147,15 +149,18 @@
 
 PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject 
*args)
 {
-       PyObject *l;
+       PyObject *py_if1D;
 
-       if( !PyArg_ParseTuple(args, "O", &l) ) {
+       if(!( PyArg_ParseTuple(args, "O", &py_if1D) && 
BPy_Interface1D_Check(py_if1D) )) {
                cout << "ERROR: UnaryPredicate1D___call__ " << endl;            
                return NULL;
        }
        
-       //TBD
+       Interface1D *if1D = ((BPy_Interface1D *) py_if1D)->if1D;
        
+       if( if1D )
+               return PyBool_from_bool( self->up1D->operator()(*if1D) );
+       
        Py_RETURN_NONE;
 }
 

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
       2008-07-26 18:38:59 UTC (rev 15782)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
       2008-07-26 19:32:47 UTC (rev 15783)
@@ -115,22 +115,22 @@
            return -1;
 
        if( !obj1 && !obj2 && !obj3 ){
-               self->ai = new AdjacencyIterator();
+               self->a_it = new AdjacencyIterator();
                
        } else if( BPy_AdjacencyIterator_Check(obj1) ) {
-               self->ai = new AdjacencyIterator(*( ((BPy_AdjacencyIterator *) 
obj1)->ai ));
+               self->a_it = new AdjacencyIterator(*( ((BPy_AdjacencyIterator 
*) obj1)->a_it ));
        
        } else if( BPy_ViewVertex_Check(obj1) ) {
                bool restrictToSelection = ( obj2 && PyBool_Check(obj2) ) ? 
bool_from_PyBool(obj2) : true;
                bool restrictToUnvisited = ( obj3 && PyBool_Check(obj3) ) ? 
bool_from_PyBool(obj3) : true;
                
-               self->ai = new AdjacencyIterator( ((BPy_ViewVertex *) 
obj1)->vv, restrictToSelection, restrictToUnvisited );
+               self->a_it = new AdjacencyIterator( ((BPy_ViewVertex *) 
obj1)->vv, restrictToSelection, restrictToUnvisited );
                        
        } else {
                return -1;
        }
 
-       self->py_it.it = self->ai;
+       self->py_it.it = self->a_it;
        return 0;
 
 }

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
 2008-07-26 18:38:59 UTC (rev 15782)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
 2008-07-26 19:32:47 UTC (rev 15783)
@@ -20,7 +20,7 @@
 /*---------------------------Python BPy_AdjacencyIterator structure 
definition----------*/
 typedef struct {
        BPy_Iterator py_it;
-       AdjacencyIterator *ai;
+       AdjacencyIterator *a_it;
 } BPy_AdjacencyIterator;
 
 
///////////////////////////////////////////////////////////////////////////////////////////

Copied: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
 (from rev 15727, 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingPredicateIterator.cpp)
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
                          (rev 0)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
  2008-07-26 19:32:47 UTC (rev 15783)
@@ -0,0 +1,165 @@
+#include "BPy_ChainPredicateIterator.h"
+
+#include "../BPy_Convert.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////////////
+
+/*---------------  Python API function prototypes for ChainPredicateIterator 
instance  -----------*/
+static int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, 
PyObject *args);
+
+static PyObject * ChainPredicateIterator_traverse( BPy_ViewEdgeIterator *self, 
PyObject *args );
+
+
+/*----------------------ChainPredicateIterator instance definitions 
----------------------------*/
+static PyMethodDef BPy_ChainPredicateIterator_methods[] = {
+
+       {"traverse", ( PyCFunction ) ChainPredicateIterator_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. "},
+
+       {NULL, NULL, 0, NULL}
+};
+
+/*-----------------------BPy_ChainPredicateIterator type definition 
------------------------------*/
+
+PyTypeObject ChainPredicateIterator_Type = {
+       PyObject_HEAD_INIT( NULL ) 
+       0,                                                      /* ob_size */
+       "ChainPredicateIterator",                               /* tp_name */
+       sizeof( BPy_ChainPredicateIterator ),   /* tp_basicsize */
+       0,                                                      /* tp_itemsize 
*/
+       
+       /* methods */
+       NULL,   /* tp_dealloc */
+       NULL,                                                   /* printfunc 
tp_print; */
+       NULL,                                                   /* getattrfunc 
tp_getattr; */
+       NULL,                                                   /* setattrfunc 
tp_setattr; */
+       NULL,                                                                   
        /* tp_compare */
+       NULL,                                   /* tp_repr */
+
+       /* Method suites for standard classes */
+
+       NULL,                       /* PyNumberMethods *tp_as_number; */
+       NULL,                       /* PySequenceMethods *tp_as_sequence; */
+       NULL,                       /* PyMappingMethods *tp_as_mapping; */
+
+       /* More standard operations (here for binary compatibility) */
+
+       NULL,                                           /* hashfunc tp_hash; */
+       NULL,                       /* ternaryfunc tp_call; */
+       NULL,                       /* reprfunc tp_str; */
+       NULL,                       /* getattrofunc tp_getattro; */
+       NULL,                       /* setattrofunc tp_setattro; */
+
+       /* Functions to access object as input/output buffer */
+       NULL,                       /* PyBufferProcs *tp_as_buffer; */
+
+  /*** Flags to define presence of optional/expanded features ***/
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,               /* long 
tp_flags; */
+
+       NULL,                       /*  char *tp_doc;  Documentation string */
+  /*** Assigned meaning in release 2.0 ***/
+       /* call function for all accessible objects */
+       NULL,                       /* traverseproc tp_traverse; */
+
+       /* delete references to contained objects */
+       NULL,                       /* inquiry tp_clear; */
+
+  /***  Assigned meaning in release 2.1 ***/
+  /*** rich comparisons ***/
+       NULL,                       /* richcmpfunc tp_richcompare; */
+
+  /***  weak reference enabler ***/
+       0,                          /* long tp_weaklistoffset; */
+
+  /*** Added in release 2.2 ***/
+       /*   Iterators */
+       NULL,                       /* getiterfunc tp_iter; */
+       NULL,                       /* iternextfunc tp_iternext; */
+
+  /*** Attribute descriptor and subclassing stuff ***/
+       BPy_ChainPredicateIterator_methods,     /* struct PyMethodDef 
*tp_methods; */

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to