[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15743] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python: soc-2008-mxcurioni: found and fixed all potential issues iterating over internal view-map data .

Maxime Curioni maxime.curioni at gmail.com
Thu Jul 24 23:32:51 CEST 2008


Revision: 15743
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15743
Author:   mxcurioni
Date:     2008-07-24 23:32:50 +0200 (Thu, 24 Jul 2008)

Log Message:
-----------
soc-2008-mxcurioni: found and fixed all potential issues iterating over internal view-map data. The internal namespaces (ViewEdgeInternal, ViewVertexInternal, CurveInternal, StrokeInternal...) should NOT be included to prevent redefintion errors.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp	2008-07-24 21:32:50 UTC (rev 15743)
@@ -9,6 +9,7 @@
 #include "Interface0D/BPy_ViewVertex.h"
 #include "Interface1D/BPy_FEdge.h"
 #include "Interface1D/BPy_ViewEdge.h"
+#include "Iterator/BPy_orientedViewEdgeIterator.h"
 #include "BPy_SShape.h"
 #include "BPy_Nature.h"
 #include "BPy_MediumType.h"
@@ -149,7 +150,13 @@
 	return py_ss;	
 }
 
+PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& ove_it ) {
+	PyObject *py_ove_it = orientedViewEdgeIterator_Type.tp_new( &orientedViewEdgeIterator_Type, 0, 0 );
+	((BPy_orientedViewEdgeIterator *) py_ove_it)->ove_it = new ViewVertexInternal::orientedViewEdgeIterator( ove_it );
 
+	return py_ove_it;
+}
+
 ///////////////////////////////////////////////////////////////////////////////////////////
 
 #ifdef __cplusplus

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h	2008-07-24 21:32:50 UTC (rev 15743)
@@ -1,6 +1,7 @@
 #ifndef FREESTYLE_PYTHON_CONVERT_H
 #define FREESTYLE_PYTHON_CONVERT_H
 
+
 #include "../geometry/Geom.h"
 using namespace Geometry;
 
@@ -22,6 +23,17 @@
 // NonTVertex, TVertex, ViewEdge, ViewMap, ViewShape, ViewVertex
 #include "../view_map/ViewMap.h"
 
+// ViewVertexInternal::orientedViewEdgeIterator
+// ViewEdgeInternal::SVertexIterator
+// ViewEdgeInternal::ViewEdgeIterator
+#include "../view_map/ViewMapIterators.h"
+//#####################    IMPORTANT   #####################
+//  Do not use the following namespaces within this file :
+//   - ViewVertexInternal 
+//   - ViewEdgeInternal
+//##########################################################
+
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -45,6 +57,7 @@
 PyObject * BPy_Interface0D_from_Interface0D( Interface0D& if0D );
 PyObject * BPy_Nature_from_Nature( unsigned short n );
 PyObject * BPy_MediumType_from_MediumType( int n );
+PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& ove_it );
 PyObject * BPy_SShape_from_SShape( SShape& ss );
 PyObject * BPy_StrokeAttribute_from_StrokeAttribute( StrokeAttribute& sa );
 PyObject * BPy_StrokeVertex_from_StrokeVertex( StrokeVertex& sv );

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp	2008-07-24 21:32:50 UTC (rev 15743)
@@ -121,13 +121,13 @@
 	    return -1;
 
 	if( !obj ){
-		self->cp_it = new CurvePointIterator();
+		self->cp_it = new CurveInternal::CurvePointIterator();
 		
 	} else if( BPy_CurvePointIterator_Check(obj) ) {
-		self->cp_it = new CurvePointIterator(*( ((BPy_CurvePointIterator *) obj)->cp_it ));
+		self->cp_it = new CurveInternal::CurvePointIterator(*( ((BPy_CurvePointIterator *) obj)->cp_it ));
 	
 	} else if( PyFloat_Check(obj) ) {
-		self->cp_it = new CurvePointIterator( PyFloat_AsDouble(obj) );
+		self->cp_it = new CurveInternal::CurvePointIterator( PyFloat_AsDouble(obj) );
 			
 	} else {
 		return -1;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h	2008-07-24 21:32:50 UTC (rev 15743)
@@ -2,7 +2,6 @@
 #define FREESTYLE_PYTHON_CURVEPOINTITERATOR_H
 
 #include "../../stroke/CurveIterators.h"
-using namespace CurveInternal;
 
 #include "../BPy_Iterator.h"
 
@@ -21,7 +20,7 @@
 /*---------------------------Python BPy_CurvePointIterator structure definition----------*/
 typedef struct {
 	BPy_Iterator py_it;
-	CurvePointIterator *cp_it;
+	CurveInternal::CurvePointIterator *cp_it;
 } BPy_CurvePointIterator;
 
 ///////////////////////////////////////////////////////////////////////////////////////////

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp	2008-07-24 21:32:50 UTC (rev 15743)
@@ -121,21 +121,22 @@
 	    return -1;
 
 	if( !obj1 ){
-		self->sv_it = new SVertexIterator();
+		self->sv_it = new ViewEdgeInternal::SVertexIterator();
 		
 	} else if( BPy_SVertexIterator_Check(obj1) ) {
-		self->sv_it = new SVertexIterator(*( ((BPy_SVertexIterator *) obj1)->sv_it ));
+		self->sv_it = new ViewEdgeInternal::SVertexIterator(*( ((BPy_SVertexIterator *) obj1)->sv_it ));
 	
 	} else if(  obj1 && BPy_SVertex_Check(obj1) &&
 	 			obj2 && BPy_SVertex_Check(obj2) &&
 				obj3 && BPy_FEdge_Check(obj3) &&
 				obj4 && BPy_FEdge_Check(obj4) ) {
 
-		self->sv_it = new SVertexIterator(	((BPy_SVertex *) obj1)->sv,
-											((BPy_SVertex *) obj2)->sv,
-											((BPy_FEdge *) obj3)->fe,
-											((BPy_FEdge *) obj4)->fe,
-											f );
+		self->sv_it = new ViewEdgeInternal::SVertexIterator(
+							((BPy_SVertex *) obj1)->sv,
+							((BPy_SVertex *) obj2)->sv,
+							((BPy_FEdge *) obj3)->fe,
+							((BPy_FEdge *) obj4)->fe,
+							f );
 			
 	} else {
 		return -1;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h	2008-07-24 21:32:50 UTC (rev 15743)
@@ -2,7 +2,6 @@
 #define FREESTYLE_PYTHON_SVERTEXITERATOR_H
 
 #include "../../view_map/ViewMapIterators.h"
-using namespace ViewEdgeInternal;
 
 #include "../BPy_Iterator.h"
 
@@ -22,7 +21,7 @@
 /*---------------------------Python BPy_SVertexIterator structure definition----------*/
 typedef struct {
 	BPy_Iterator py_it;
-	SVertexIterator *sv_it;
+	ViewEdgeInternal::SVertexIterator *sv_it;
 } BPy_SVertexIterator;
 
 ///////////////////////////////////////////////////////////////////////////////////////////

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp	2008-07-24 21:32:50 UTC (rev 15743)
@@ -120,10 +120,10 @@
 	    return -1;
 
 	if( !obj ){
-		self->sv_it = new StrokeVertexIterator();
+		self->sv_it = new StrokeInternal::StrokeVertexIterator();
 		
 	} else if( BPy_StrokeVertexIterator_Check(obj) ) {
-		self->sv_it = new StrokeVertexIterator(*( ((BPy_StrokeVertexIterator *) obj)->sv_it ));
+		self->sv_it = new StrokeInternal::StrokeVertexIterator(*( ((BPy_StrokeVertexIterator *) obj)->sv_it ));
 	
 	} else {
 		return -1;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h	2008-07-24 21:32:50 UTC (rev 15743)
@@ -2,7 +2,6 @@
 #define FREESTYLE_PYTHON_STROKEVERTEXITERATOR_H
 
 #include "../../stroke/StrokeIterators.h"
-using namespace StrokeInternal;
 
 #include "../BPy_Iterator.h"
 
@@ -21,7 +20,7 @@
 /*---------------------------Python BPy_StrokeVertexIterator structure definition----------*/
 typedef struct {
 	BPy_Iterator py_it;
-	StrokeVertexIterator *sv_it;
+	StrokeInternal::StrokeVertexIterator *sv_it;
 } BPy_StrokeVertexIterator;
 
 ///////////////////////////////////////////////////////////////////////////////////////////

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp	2008-07-24 20:39:13 UTC (rev 15742)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp	2008-07-24 21:32:50 UTC (rev 15743)
@@ -115,13 +115,13 @@
 	    return -1;
 
 	if( obj1 && BPy_ViewEdgeIterator_Check(obj1)  ) {
-		self->ve_it = new ViewEdgeIterator(*( ((BPy_ViewEdgeIterator *) obj1)->ve_it ));
+		self->ve_it = new ViewEdgeInternal::ViewEdgeIterator(*( ((BPy_ViewEdgeIterator *) obj1)->ve_it ));
 	
 	} else {
 		ViewEdge *begin = ( obj1 && BPy_ViewEdge_Check(obj1) ) ? ((BPy_ViewEdge *) obj1)->ve : 0;
 		bool orientation = ( obj2 && PyBool_Check(obj2) ) ? bool_from_PyBool(obj2) : true;
 		
-		self->ve_it = new ViewEdgeIterator( begin, orientation);
+		self->ve_it = new ViewEdgeInternal::ViewEdgeIterator( begin, orientation);
 		
 	}
 		

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list