[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15749] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python: soc-2008-mxcurioni: fully implemented ( but did not test) ViewEdge class.

Maxime Curioni maxime.curioni at gmail.com
Fri Jul 25 03:38:20 CEST 2008


Revision: 15749
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15749
Author:   mxcurioni
Date:     2008-07-25 03:38:19 +0200 (Fri, 25 Jul 2008)

Log Message:
-----------
soc-2008-mxcurioni: fully implemented (but did not test) ViewEdge class. Modified functions accross API taking input boolean values.

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/BPy_StrokeAttribute.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp

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-25 01:17:37 UTC (rev 15748)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp	2008-07-25 01:38:19 UTC (rev 15749)
@@ -12,10 +12,11 @@
 #include "Iterator/BPy_Interface0DIterator.h"
 #include "Iterator/BPy_orientedViewEdgeIterator.h"
 #include "Iterator/BPy_StrokeVertexIterator.h"
-#include "BPy_SShape.h"
 #include "BPy_Nature.h"
 #include "BPy_MediumType.h"
+#include "BPy_SShape.h"
 #include "BPy_StrokeAttribute.h"
+#include "BPy_ViewShape.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -152,6 +153,13 @@
 	return py_ss;	
 }
 
+PyObject * BPy_ViewShape_from_ViewShape( ViewShape& vs ) {
+	PyObject *py_vs = ViewShape_Type.tp_new( &ViewShape_Type, 0, 0 );
+	((BPy_ViewShape *) py_vs)->vs = new ViewShape( vs );
+
+	return py_vs;
+}
+
 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 );
@@ -173,6 +181,8 @@
 	return py_sv_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-25 01:17:37 UTC (rev 15748)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h	2008-07-25 01:38:19 UTC (rev 15749)
@@ -65,6 +65,7 @@
 PyObject * BPy_SVertex_from_SVertex( SVertex& sv );
 PyObject * BPy_ViewVertex_from_ViewVertex_ptr( ViewVertex *vv );
 PyObject * BPy_ViewEdge_from_ViewEdge( ViewEdge& ve );
+PyObject * BPy_ViewShape_from_ViewShape( ViewShape& vs );
 
 PyObject * BPy_Interface0DIterator_from_Interface0DIterator( Interface0DIterator& if0D_it );
 PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& ove_it );

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp	2008-07-25 01:17:37 UTC (rev 15748)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp	2008-07-25 01:38:19 UTC (rev 15749)
@@ -395,17 +395,19 @@
 }
 
 PyObject * StrokeAttribute_setVisible( BPy_StrokeAttribute *self, PyObject *args ) {
-	int i = 0;
+	PyObject *py_b;
 
-	if(!( PyArg_ParseTuple(args, "i", &i) )) {
+	if(!( PyArg_ParseTuple(args, "O", &py_b) && PyBool_Check(py_b) )) {
 		cout << "ERROR: StrokeAttribute_setVisible" << endl;
 		Py_RETURN_NONE;
 	}
 
-	self->sa->setVisible( i );
+	self->sa->setVisible( bool_from_PyBool(py_b) );
+
 	Py_RETURN_NONE;
 }
 
+
 PyObject * StrokeAttribute_setAttributeReal( BPy_StrokeAttribute *self, PyObject *args ) {
 	char *s = 0;
 	double d = 0;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp	2008-07-25 01:17:37 UTC (rev 15748)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp	2008-07-25 01:38:19 UTC (rev 15749)
@@ -337,14 +337,14 @@
 
 
 PyObject *FEdge_setSmooth( BPy_FEdge *self , PyObject *args) {
-	int b;
+	PyObject *py_b;
 
-	if(!( PyArg_ParseTuple(args, "i", &b) )) {
+	if(!( PyArg_ParseTuple(args, "O", &py_b) && PyBool_Check(py_b) )) {
 		cout << "ERROR: FEdge_setSmooth" << endl;
 		Py_RETURN_NONE;
 	}
 
-	self->fe->setSmooth( (bool) b );
+	self->fe->setSmooth( bool_from_PyBool(py_b) );
 
 	Py_RETURN_NONE;
 }

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp	2008-07-25 01:17:37 UTC (rev 15748)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp	2008-07-25 01:38:19 UTC (rev 15749)
@@ -1,6 +1,12 @@
 #include "BPy_ViewEdge.h"
 
 #include "../BPy_Convert.h"
+#include "../BPy_Id.h"
+#include "../Interface0D/BPy_ViewVertex.h"
+#include "../Interface1D/BPy_FEdge.h"
+#include "../Interface1D/BPy_ViewEdge.h"
+#include "../BPy_Nature.h"
+#include "../BPy_ViewShape.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -13,13 +19,54 @@
 
 static PyObject * ViewEdge_A( BPy_ViewEdge *self );
 static PyObject * ViewEdge_B( BPy_ViewEdge *self );
+static PyObject * ViewEdge_fedgeA( BPy_ViewEdge *self ) ;
+static PyObject * ViewEdge_fedgeB( BPy_ViewEdge *self ) ;
+static PyObject * ViewEdge_viewShape( BPy_ViewEdge *self ) ;
+static PyObject * ViewEdge_aShape( BPy_ViewEdge *self ) ;
+static PyObject * ViewEdge_isClosed( BPy_ViewEdge *self );
+static PyObject * ViewEdge_getChainingTimeStamp( BPy_ViewEdge *self );
+static PyObject * ViewEdge_setChainingTimeStamp( BPy_ViewEdge *self, PyObject *args) ;
+static PyObject * ViewEdge_setA( BPy_ViewEdge *self , PyObject *args) ;
+static PyObject * ViewEdge_setB( BPy_ViewEdge *self , PyObject *args);
+static PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args );
+static PyObject * ViewEdge_setFEdgeA( BPy_ViewEdge *self, PyObject *args ) ;
+static PyObject * ViewEdge_setFEdgeB( BPy_ViewEdge *self, PyObject *args ) ;
+static PyObject * ViewEdge_setShape( BPy_ViewEdge *self, PyObject *args ) ;
+static PyObject * ViewEdge_setId( BPy_ViewEdge *self, PyObject *args ) ;
+static PyObject * ViewEdge_UpdateFEdges( BPy_ViewEdge *self );
+static PyObject * ViewEdge_setaShape( BPy_ViewEdge *self, PyObject *args );
+static PyObject * ViewEdge_setQI( BPy_ViewEdge *self, PyObject *args );
+static PyObject * ViewEdge_verticesBegin( BPy_ViewEdge *self );
+static PyObject * ViewEdge_verticesEnd( BPy_ViewEdge *self );
+static PyObject * ViewEdge_pointsBegin( BPy_ViewEdge *self, PyObject *args );
+static PyObject * ViewEdge_pointsEnd( BPy_ViewEdge *self, PyObject *args );
 
 
 /*----------------------ViewEdge instance definitions ----------------------------*/
 static PyMethodDef BPy_ViewEdge_methods[] = {	
-
 	{"A", ( PyCFunction ) ViewEdge_A, METH_NOARGS, "() Returns the first ViewVertex."},
 	{"B", ( PyCFunction ) ViewEdge_B, METH_NOARGS, "() Returns the second ViewVertex."},
+	{"fedgeA", ( PyCFunction ) ViewEdge_fedgeA, METH_NOARGS, "() Returns the first FEdge that constitues this ViewEdge."},
+	{"fedgeB", ( PyCFunction ) ViewEdge_fedgeB, METH_NOARGS, "() Returns the last FEdge that constitues this ViewEdge."},
+	{"viewShape", ( PyCFunction ) ViewEdge_viewShape, METH_NOARGS, "() Returns the ViewShape to which this ViewEdge belongs to . "},
+	{"aShape", ( PyCFunction ) ViewEdge_aShape, METH_NOARGS, "() Returns the shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no object is occluded, 0 is returned."},
+	{"isClosed", ( PyCFunction ) ViewEdge_isClosed, METH_NOARGS, "() Tells whether this ViewEdge forms a closed loop or not."},
+	{"getChainingTimeStamp", ( PyCFunction ) ViewEdge_getChainingTimeStamp, METH_NOARGS, "() Returns the time stamp of this ViewEdge."},
+	{"setChainingTimeStamp", ( PyCFunction ) ViewEdge_setChainingTimeStamp, METH_VARARGS, "(int ts) Sets the time stamp value."},
+	{"setA", ( PyCFunction ) ViewEdge_setA, METH_VARARGS, "(ViewVertex sv) Sets the first ViewVertex of the ViewEdge."},
+	{"setB", ( PyCFunction ) ViewEdge_setB, METH_VARARGS, "(ViewVertex sv) Sets the last ViewVertex of the ViewEdge."},
+	{"setNature", ( PyCFunction ) ViewEdge_setNature, METH_VARARGS, "(Nature n) Sets the nature of the ViewEdge."},
+	{"setFEdgeA", ( PyCFunction ) ViewEdge_setFEdgeA, METH_VARARGS, "(FEdge fe) Sets the first FEdge of the ViewEdge."},
+	{"setFEdgeB", ( PyCFunction ) ViewEdge_setFEdgeB, METH_VARARGS, "(FEdge fe) Sets the last FEdge of the ViewEdge."},
+	{"setShape", ( PyCFunction ) ViewEdge_setShape, METH_VARARGS, "(ViewShape vs) Sets the ViewShape to which this ViewEdge belongs to."},
+	{"setId", ( PyCFunction ) ViewEdge_setId, METH_VARARGS, "(Id id) Sets the ViewEdge id."},
+	{"UpdateFEdges", ( PyCFunction ) ViewEdge_UpdateFEdges, METH_NOARGS, "() Sets ViewEdge to this for all embedded fedges"},
+	{"setaShape", ( PyCFunction ) ViewEdge_setaShape, METH_VARARGS, "(ViewShape vs) Sets the occluded ViewShape"},
+	{"setQI", ( PyCFunction ) ViewEdge_setQI, METH_VARARGS, "(int qi) Sets the quantitative invisibility value."},
+	{"verticesBegin", ( PyCFunction ) ViewEdge_verticesBegin, METH_NOARGS, "() Returns an Interface0DIterator to iterate over the SVertex constituing the embedding of this ViewEdge. The returned Interface0DIterator points to the first SVertex of the ViewEdge."},
+	{"verticesEnd", ( PyCFunction ) ViewEdge_verticesEnd, METH_NOARGS, "() Returns an Interface0DIterator to iterate over the SVertex constituing the embedding of this ViewEdge. The returned Interface0DIterator points after the last SVertex of the ViewEdge."},
+	{"pointsBegin", ( PyCFunction ) ViewEdge_pointsBegin, METH_VARARGS, "(float t=0) Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given resolution t. The returned Interface0DIterator points on the first Point of the ViewEdge."},
+	{"pointsEnd", ( PyCFunction ) ViewEdge_pointsEnd, METH_VARARGS, "(float t=0) Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given resolution t. The returned Interface0DIterator points after the last Point of the ViewEdge."},
 	{NULL, NULL, 0, NULL}
 };
 
@@ -120,196 +167,235 @@
 
 
 PyObject * ViewEdge_A( BPy_ViewEdge *self ) {	
-	// if( self->ve->A() ){
-	// 	return BPy_ViewVertex_from_ViewVertex_ptr( self->ve->A() );
-	// }
-	// 	
+	if( self->ve->A() ){
+		return BPy_ViewVertex_from_ViewVertex_ptr( self->ve->A() );
+	}
+		

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list