Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Curioni <maxime.curioni@gmail.com>2008-07-25 05:38:19 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-07-25 05:38:19 +0400
commitc0f567e757cab55c1ed77d44a204c21023422859 (patch)
treebf85e3e1dd80407627febbf8c4dbb4a12c71e6df /source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
parentd8d9839ab31f774d6e8bcdda00cac31db0995d41 (diff)
soc-2008-mxcurioni: fully implemented (but did not test) ViewEdge class. Modified functions accross API taking input boolean values.
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp446
1 files changed, 266 insertions, 180 deletions
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
index 02d06757fcb..e32b90a2382 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
@@ -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 int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds)
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,195 +167,234 @@ int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds)
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() );
+ }
+
Py_RETURN_NONE;
}
PyObject * ViewEdge_B( BPy_ViewEdge *self ) {
- // if( self->ve->B() ){
- // return BPy_ViewVertex_from_ViewVertex_ptr( self->ve->B() );
- // }
+ if( self->ve->B() ){
+ return BPy_ViewVertex_from_ViewVertex_ptr( self->ve->B() );
+ }
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_fedgeA( BPy_ViewEdge *self ) {
+ if( self->ve->fedgeA() ){
+ return BPy_FEdge_from_FEdge(*( self->ve->fedgeA() ));
+ }
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_fedgeB( BPy_ViewEdge *self ) {
+ if( self->ve->fedgeB() ){
+ return BPy_FEdge_from_FEdge(*( self->ve->fedgeB() ));
+ }
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_viewShape( BPy_ViewEdge *self ) {
+ if( self->ve->viewShape() ){
+ return BPy_ViewShape_from_ViewShape(*( self->ve->viewShape() ));
+ }
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_aShape( BPy_ViewEdge *self ) {
+ if( self->ve->aShape() ){
+ return BPy_ViewShape_from_ViewShape(*( self->ve->aShape() ));
+ }
Py_RETURN_NONE;
}
-//
-// PyObject * ViewEdge___getitem__( BPy_ViewEdge *self, PyObject *args ) {
-// int i;
-//
-// if(!( PyArg_ParseTuple(args, "i", &i) && (i == 0 || i == 1) )) {
-// cout << "ERROR: ViewEdge___getitem__" << endl;
-// Py_RETURN_NONE;
-// }
-//
-// if( SVertex *v = self->ve->operator[](i) )
-// return BPy_SVertex_from_SVertex( *v );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject * ViewEdge_nextEdge( BPy_ViewEdge *self ) {
-// if( ViewEdge *fe = self->ve->nextEdge() )
-// return BPy_ViewEdge_from_ViewEdge( *fe );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject * ViewEdge_previousEdge( BPy_ViewEdge *self ) {
-// if( ViewEdge *fe = self->ve->previousEdge() )
-// return BPy_ViewEdge_from_ViewEdge( *fe );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject * ViewEdge_isSmooth( BPy_ViewEdge *self ) {
-// return PyBool_from_bool( self->ve->isSmooth() );
-// }
-//
-// PyObject *ViewEdge_setVertexA( BPy_ViewEdge *self , PyObject *args) {
-// PyObject *py_sv;
-//
-// if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) {
-// cout << "ERROR: ViewEdge_setVertexA" << endl;
-// Py_RETURN_NONE;
-// }
-//
-// self->ve->setVertexA( ((BPy_SVertex *) py_sv)->sv );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject *ViewEdge_setVertexB( BPy_ViewEdge *self , PyObject *args) {
-// PyObject *py_sv;
-//
-// if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) {
-// cout << "ERROR: ViewEdge_setVertexB" << endl;
-// Py_RETURN_NONE;
-// }
-//
-// self->ve->setVertexB( ((BPy_SVertex *) py_sv)->sv );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject *ViewEdge_setId( BPy_ViewEdge *self , PyObject *args) {
-// PyObject *py_id;
-//
-// if(!( PyArg_ParseTuple(args, "O", &py_id) && BPy_Id_Check(py_id) )) {
-// cout << "ERROR: ViewEdge_setId" << endl;
-// Py_RETURN_NONE;
-// }
-//
-// self->ve->setId(*( ((BPy_Id *) py_id)->id ));
-//
-// Py_RETURN_NONE;
-// }
-//
-//
-// PyObject *ViewEdge_setNextEdge( BPy_ViewEdge *self , PyObject *args) {
-// PyObject *py_fe;
-//
-// if(!( PyArg_ParseTuple(args, "O", &py_fe) && BPy_ViewEdge_Check(py_fe) )) {
-// cout << "ERROR: ViewEdge_setNextEdge" << endl;
-// Py_RETURN_NONE;
-// }
-//
-// self->ve->setNextEdge( ((BPy_ViewEdge *) py_fe)->ve );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject *ViewEdge_setPreviousEdge( BPy_ViewEdge *self , PyObject *args) {
-// PyObject *py_fe;
-//
-// if(!( PyArg_ParseTuple(args, "O", &py_fe) && BPy_ViewEdge_Check(py_fe) )) {
-// cout << "ERROR: ViewEdge_setPreviousEdge" << endl;
-// Py_RETURN_NONE;
-// }
-//
-// self->ve->setPreviousEdge( ((BPy_ViewEdge *) py_fe)->ve );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject *ViewEdge_setSmooth( BPy_ViewEdge *self , PyObject *args) {
-// int b;
-//
-// if(!( PyArg_ParseTuple(args, "i", &b) )) {
-// cout << "ERROR: ViewEdge_setSmooth" << endl;
-// Py_RETURN_NONE;
-// }
-//
-// self->ve->setSmooth( (bool) b );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args ) {
-// PyObject *py_n;
-//
-// if(!( PyArg_ParseTuple(args, "O", &py_n) && BPy_Nature_Check(py_n) )) {
-// cout << "ERROR: ViewEdge_setNature" << endl;
-// Py_RETURN_NONE;
-// }
-//
-// PyObject *i = (PyObject *) &( ((BPy_Nature *) py_n)->i );
-// ((ViewEdge *) self->py_if1D.if1D)->setNature( PyInt_AsLong(i) );
-//
-// Py_RETURN_NONE;
-// }
-//
-// PyObject *ViewEdge_getVertices( BPy_ViewEdge *self ) {
-// PyObject *py_vertices = PyList_New(NULL);
-//
-// for( Interface0DIterator it = self->ve->verticesBegin(); it != self->ve->verticesEnd(); it++ ) {
-// PyList_Append( py_vertices, BPy_Interface0D_from_Interface0D( *it ) );
-// }
-//
-// return py_vertices;
-// }
-//
-// PyObject *ViewEdge_getPoints( BPy_ViewEdge *self ) {
-// PyObject *py_points = PyList_New(NULL);
-//
-// for( Interface0DIterator it = self->ve->pointsBegin(); it != self->ve->pointsEnd(); it++ ) {
-// PyList_Append( py_points, BPy_Interface0D_from_Interface0D( *it ) );
-// }
-//
-// return py_points;
-// }
-//
-//
-//
-//
-//
-// FEdge * fedgeA ()
-// FEdge * fedgeB ()
-// ViewShape * viewShape ()
-// ViewShape * aShape ()
-// bool isClosed ()
-// unsigned getChainingTimeStamp ()
-// void SetA (ViewVertex *iA)
-// void SetB (ViewVertex *iB)
-// void SetNature (Nature::EdgeNature iNature)
-// void SetFEdgeA (FEdge *iFEdge)
-// void SetFEdgeB (FEdge *iFEdge)
-// void SetShape (ViewShape *iVShape)
-// void SetId (const Id &id)
-// void UpdateFEdges ()
-// void SetaShape (ViewShape *iShape)
-// void SetQI (int qi)
-// void setChainingTimeStamp (unsigned ts)
-// real getLength2D () const
-// virtual Interface0DIterator verticesBegin ()
-// virtual Interface0DIterator verticesEnd ()
-// virtual Interface0DIterator pointsBegin (float t=0.f)
-// virtual Interface0DIterator pointsEnd (float t=0.f)
+PyObject * ViewEdge_isClosed( BPy_ViewEdge *self ) {
+ return PyBool_from_bool( self->ve->isClosed() );
+}
+
+PyObject * ViewEdge_getChainingTimeStamp( BPy_ViewEdge *self ) {
+ return PyInt_FromLong( self->ve->getChainingTimeStamp() );
+}
+
+PyObject * ViewEdge_setChainingTimeStamp( BPy_ViewEdge *self, PyObject *args) {
+ int timestamp = 0 ;
+
+ if( !PyArg_ParseTuple(args, "i", &timestamp) ) {
+ cout << "ERROR: ViewEdge_setChainingTimeStamp" << endl;
+ Py_RETURN_NONE;
+ }
+
+ self->ve->setChainingTimeStamp( timestamp );
+
+ Py_RETURN_NONE;
+}
+
+PyObject *ViewEdge_setA( BPy_ViewEdge *self , PyObject *args) {
+ PyObject *py_vv;
+
+ if(!( PyArg_ParseTuple(args, "O", &py_vv) && BPy_ViewVertex_Check(py_vv) )) {
+ cout << "ERROR: ViewEdge_setA" << endl;
+ Py_RETURN_NONE;
+ }
+
+ self->ve->setA( ((BPy_ViewVertex *) py_vv)->vv );
+
+ Py_RETURN_NONE;
+}
+
+PyObject *ViewEdge_setB( BPy_ViewEdge *self , PyObject *args) {
+ PyObject *py_vv;
+
+ if(!( PyArg_ParseTuple(args, "O", &py_vv) && BPy_ViewVertex_Check(py_vv) )) {
+ cout << "ERROR: ViewEdge_setB" << endl;
+ Py_RETURN_NONE;
+ }
+
+ self->ve->setB( ((BPy_ViewVertex *) py_vv)->vv );
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args ) {
+ PyObject *py_n;
+
+ if(!( PyArg_ParseTuple(args, "O", &py_n) && BPy_Nature_Check(py_n) )) {
+ cout << "ERROR: ViewEdge_setNature" << endl;
+ Py_RETURN_NONE;
+ }
+
+ PyObject *i = (PyObject *) &( ((BPy_Nature *) py_n)->i );
+ self->ve->setNature( PyInt_AsLong(i) );
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_setFEdgeA( BPy_ViewEdge *self, PyObject *args ) {
+ PyObject *py_fe;
+
+ if(!( PyArg_ParseTuple(args, "O", &py_fe) && BPy_FEdge_Check(py_fe) )) {
+ cout << "ERROR: ViewEdge_setFEdgeA" << endl;
+ Py_RETURN_NONE;
+ }
+
+ self->ve->setFEdgeA( ((BPy_FEdge *) py_fe)->fe );
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_setFEdgeB( BPy_ViewEdge *self, PyObject *args ) {
+ PyObject *py_fe;
+
+ if(!( PyArg_ParseTuple(args, "O", &py_fe) && BPy_FEdge_Check(py_fe) )) {
+ cout << "ERROR: ViewEdge_setFEdgeB" << endl;
+ Py_RETURN_NONE;
+ }
+
+ self->ve->setFEdgeB( ((BPy_FEdge *) py_fe)->fe );
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_setShape( BPy_ViewEdge *self, PyObject *args ) {
+ PyObject *py_vs;
+
+ if(!( PyArg_ParseTuple(args, "O", &py_vs) && BPy_ViewShape_Check(py_vs) )) {
+ cout << "ERROR: ViewEdge_setShape" << endl;
+ Py_RETURN_NONE;
+ }
+
+ self->ve->setShape( ((BPy_ViewShape *) py_vs)->vs );
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_setId( BPy_ViewEdge *self, PyObject *args ) {
+ PyObject *py_id;
+
+ if(!( PyArg_ParseTuple(args, "O", &py_id) && BPy_Id_Check(py_id) )) {
+ cout << "ERROR: ViewEdge_setId" << endl;
+ Py_RETURN_NONE;
+ }
+
+ Id id(*( ((BPy_Id *) py_id)->id ));
+ self->ve->setId( id );
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_UpdateFEdges( BPy_ViewEdge *self ) {
+ self->ve->UpdateFEdges();
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_setaShape( BPy_ViewEdge *self, PyObject *args ) {
+ PyObject *py_vs;
+
+ if(!( PyArg_ParseTuple(args, "O", &py_vs) && BPy_ViewShape_Check(py_vs) )) {
+ cout << "ERROR: ViewEdge_setaShape" << endl;
+ Py_RETURN_NONE;
+ }
+
+ ViewShape *vs = ((BPy_ViewShape *) py_vs)->vs;
+ self->ve->setaShape( vs );
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_setQI( BPy_ViewEdge *self, PyObject *args ) {
+ int qi;
+
+ if(!( PyArg_ParseTuple(args, "i", &qi) )) {
+ cout << "ERROR: ViewEdge_setQI" << endl;
+ Py_RETURN_NONE;
+ }
+
+ self->ve->setQI( qi );
+
+ Py_RETURN_NONE;
+}
+
+PyObject * ViewEdge_verticesBegin( BPy_ViewEdge *self ) {
+ Interface0DIterator if0D_it( self->ve->verticesBegin() );
+ return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
+}
+
+PyObject * ViewEdge_verticesEnd( BPy_ViewEdge *self ) {
+ Interface0DIterator if0D_it( self->ve->verticesEnd() );
+ return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
+}
+
+PyObject * ViewEdge_pointsBegin( BPy_ViewEdge *self, PyObject *args ) {
+ float f = 0;
+ if(!( PyArg_ParseTuple(args, "|f", &f) )) {
+ cout << "ERROR: ViewEdge_pointsBegin" << endl;
+ Py_RETURN_NONE;
+ }
+
+ Interface0DIterator if0D_it( self->ve->pointsBegin(f) );
+ return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
+}
+
+PyObject * ViewEdge_pointsEnd( BPy_ViewEdge *self, PyObject *args ) {
+ float f = 0;
+
+ if(!( PyArg_ParseTuple(args, "|f", &f) )) {
+ cout << "ERROR: ViewEdge_pointsEnd" << endl;
+ Py_RETURN_NONE;
+ }
+
+ Interface0DIterator if0D_it( self->ve->pointsEnd(f) );
+ return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
+}
///////////////////////////////////////////////////////////////////////////////////////////