[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15785] branches/soc-2008-mxcurioni/source /blender/freestyle: soc-2008-mxcurioni: implemented (but did not test) ChainPredicateIterator and ChainSilhouetteIterator

Maxime Curioni maxime.curioni at gmail.com
Sat Jul 26 22:06:00 CEST 2008


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

Log Message:
-----------
soc-2008-mxcurioni: implemented (but did not test) ChainPredicateIterator and ChainSilhouetteIterator

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
    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

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

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript	2008-07-26 20:02:10 UTC (rev 15784)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript	2008-07-26 20:05:55 UTC (rev 15785)
@@ -65,6 +65,7 @@
 					prefix + '/BPy_BBox.cpp',
 					prefix + '/BPy_BinaryPredicate0D.cpp',
 					prefix + '/BPy_BinaryPredicate1D.cpp',
+					prefix + '/BPy_FrsMaterial.cpp',
 					prefix + '/BPy_Id.cpp',
 					prefix + '/BPy_IntegrationType.cpp',
 					prefix + '/BPy_Interface0D.cpp',
@@ -76,7 +77,10 @@
 						prefix + '/Interface0D/ViewVertex/BPy_TVertex.cpp',
 					prefix + '/BPy_Interface1D.cpp',
 						prefix + '/Interface1D/BPy_Curve.cpp',
+						prefix + '/Interface1D/Curve/BPy_Chain.cpp',
 						prefix + '/Interface1D/BPy_FEdge.cpp',
+						prefix + '/Interface1D/FEdge/BPy_FEdgeSharp.cpp',
+						prefix + '/Interface1D/FEdge/BPy_FEdgeSmooth.cpp',
 						prefix + '/Interface1D/BPy_Stroke.cpp',
 						prefix + '/Interface1D/BPy_ViewEdge.cpp',
 					prefix + '/BPy_Iterator.cpp',
@@ -87,6 +91,9 @@
 						prefix + '/Iterator/BPy_SVertexIterator.cpp',
 						prefix + '/Iterator/BPy_orientedViewEdgeIterator.cpp',
 						prefix + '/Iterator/BPy_ViewEdgeIterator.cpp',
+						prefix + '/Iterator/BPy_ChainingIterator.cpp',
+						prefix + '/Iterator/BPy_ChainPredicateIterator.cpp',
+						prefix + '/Iterator/BPy_ChainSilhouetteIterator.cpp',
 					prefix + '/BPy_MediumType.cpp',
 					prefix + '/BPy_Nature.cpp',
 					prefix + '/BPy_SShape.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 20:02:10 UTC (rev 15784)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp	2008-07-26 20:05:55 UTC (rev 15785)
@@ -9,8 +9,8 @@
 #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"
+#include "Iterator/BPy_ChainPredicateIterator.h"
+#include "Iterator/BPy_ChainSilhouetteIterator.h"
 
 
 	
@@ -176,17 +176,17 @@
 	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);
+	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/Iterator/BPy_ChainPredicateIterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp	2008-07-26 20:02:10 UTC (rev 15784)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp	2008-07-26 20:05:55 UTC (rev 15785)
@@ -1,8 +1,10 @@
 #include "BPy_ChainPredicateIterator.h"
 
 #include "../BPy_Convert.h"
+#include "../BPy_BinaryPredicate1D.h"
+#include "../Interface1D/BPy_ViewEdge.h"
+#include "../BPy_UnaryPredicate1D.h"
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -12,14 +14,9 @@
 /*---------------  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}
 };
 
@@ -110,51 +107,43 @@
 
 //------------------------INSTANCE METHODS ----------------------------------
 
-// ChainPredicateIterator (bool iRestrictToSelection=true, bool iRestrictToUnvisited=true, ViewEdge *begin=NULL, bool orientation=true)
-//  	ChainPredicateIterator (UnaryPredicate1D &upred, BinaryPredicate1D &bpred, bool iRestrictToSelection=true, bool iRestrictToUnvisited=true, ViewEdge *begin=NULL, bool orientation=true)
-//  	ChainPredicateIterator (const ChainPredicateIterator &brother)
-
 int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *args )
 {	
-	PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0;
+	PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0, *obj5 = 0, *obj6 = 0;
 
-	if (!( PyArg_ParseTuple(args, "O|OOOOO", &obj1, &obj2, &obj3, &obj4) ))
+	if (!( PyArg_ParseTuple(args, "O|OOOOO", &obj1, &obj2, &obj3, &obj4, &obj5, &obj6) ))
 	    return -1;
 
-	if( obj1 && BPy_ChainPredicateIterator_Check(obj1)  ) {
-		self->c_it = new ChainPredicateIterator(*( ((BPy_ChainPredicateIterator *) obj1)->c_it ));
+	if( obj1 && BPy_ChainPredicateIterator_Check(obj1)  ) { 
+		self->cp_it = new ChainPredicateIterator(*( ((BPy_ChainPredicateIterator *) obj1)->cp_it ));
 	
-	} else 	if( obj1 && BPy_ChainPredicateIterator_Check(obj1)  ) {
-			self->c_it = new ChainPredicateIterator(*( ((BPy_ChainPredicateIterator *) obj1)->c_it ));
+	} else if( 	obj1 && BPy_UnaryPredicate1D_Check(obj1) && ((BPy_UnaryPredicate1D *) obj1)->up1D &&
+	  			obj2 && BPy_BinaryPredicate1D_Check(obj2) && ((BPy_BinaryPredicate1D *) obj2)->bp1D	) {
+				
+		UnaryPredicate1D *up1D = ((BPy_UnaryPredicate1D *) obj1)->up1D;
+		BinaryPredicate1D *bp1D = ((BPy_BinaryPredicate1D *) obj2)->bp1D;
+		bool restrictToSelection = ( obj3 && PyBool_Check(obj3) ) ? bool_from_PyBool(obj3) : true;
+		bool restrictToUnvisited = ( obj4 && PyBool_Check(obj4) ) ? bool_from_PyBool(obj4) : true;
+		ViewEdge *begin = ( obj5 && BPy_ViewEdge_Check(obj5) ) ? ((BPy_ViewEdge *) obj5)->ve : 0;
+		bool orientation = ( obj6 && PyBool_Check(obj6) ) ? bool_from_PyBool(obj6) : true;
 	
+		self->cp_it = new ChainPredicateIterator( *up1D, *bp1D, restrictToSelection, restrictToUnvisited, begin, orientation);
+	
 	} else {
 		bool restrictToSelection = ( obj1 && PyBool_Check(obj1) ) ? bool_from_PyBool(obj1) : true;
 		bool restrictToUnvisited = ( obj2 && PyBool_Check(obj2) ) ? bool_from_PyBool(obj2) : true;
 		ViewEdge *begin = ( obj3 && BPy_ViewEdge_Check(obj3) ) ? ((BPy_ViewEdge *) obj3)->ve : 0;
 		bool orientation = ( obj4 && PyBool_Check(obj4) ) ? bool_from_PyBool(obj4) : true;
 		
-		self->c_it = new ChainPredicateIterator( restrictToSelection, restrictToUnvisited, begin, orientation);	
+		self->cp_it = new ChainPredicateIterator( restrictToSelection, restrictToUnvisited, begin, orientation);	
 	}
 	
-	self->py_ve_it.ve_it = self->c_it;
-	self->py_ve_it.py_it.it = self->c_it;
+	self->py_c_it.c_it = self->cp_it;
+	self->py_c_it.py_ve_it.ve_it = self->cp_it;
+	self->py_c_it.py_ve_it.py_it.it = self->cp_it;
 	
 	return 0;
-}
-
-//virtual ViewEdge * 	traverse (const AdjacencyIterator &it)
-PyObject *ChainPredicateIterator_traverse( BPy_ViewEdgeIterator *self, PyObject *args ) {
-	PyObject *py_a_it;
-
-	if(!( PyArg_ParseTuple(args, "O", &py_a_it) && BPy_AdjacencyIterator_Check(py_a_it) )) {
-		cout << "ERROR: ChainPredicateIterator_traverse" << endl;
-		Py_RETURN_NONE;
-	}
 	
-	if( ((BPy_AdjacencyIterator *) py_a_it)->a_it )
-		self->ve_it->traverse(*( ((BPy_AdjacencyIterator *) py_a_it)->a_it ));
-		
-	Py_RETURN_NONE;
 }
 
 

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h	2008-07-26 20:02:10 UTC (rev 15784)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h	2008-07-26 20:05:55 UTC (rev 15785)
@@ -2,9 +2,9 @@
 #define FREESTYLE_PYTHON_CHAINPREDICATEITERATOR_H
 
 
-#include "../../view_map/ChainingIterators.h"
+#include "../../stroke/ChainingIterators.h"
 
-#include "BPy_ChainPredicateIterator.h"
+#include "BPy_ChainingIterator.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -20,7 +20,7 @@
 
 /*---------------------------Python BPy_ChainPredicateIterator structure definition----------*/
 typedef struct {
-	ChainingIterator py_c_it;
+	BPy_ChainingIterator py_c_it;
 	ChainPredicateIterator *cp_it;
 } BPy_ChainPredicateIterator;
 

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp	2008-07-26 20:02:10 UTC (rev 15784)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp	2008-07-26 20:05:55 UTC (rev 15785)
@@ -0,0 +1,141 @@
+#include "BPy_ChainSilhouetteIterator.h"
+
+#include "../BPy_Convert.h"
+#include "../Interface1D/BPy_ViewEdge.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////////////
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list