diff options
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface1D')
7 files changed, 47 insertions, 27 deletions
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp index 4e646de18e6..ccdcbe98c69 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp @@ -155,12 +155,12 @@ int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds) PyObject *obj1 = 0, *obj2 = 0; - if (! PyArg_ParseTuple(args, "|OO", &obj1, &obj2) ) + if (! PyArg_ParseTuple(args, "|O!O!", &SVertex_Type, &obj1, &SVertex_Type, &obj2) ) return -1; if( !obj1 && !obj2 ){ self->fe = new FEdge(); - } else if( BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) { + } else if( obj1 && obj2 ) { self->fe = new FEdge( ((BPy_SVertex *) obj1)->sv, ((BPy_SVertex *) obj2)->sv ); } else { PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); @@ -168,6 +168,7 @@ int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds) } self->py_if1D.if1D = self->fe; + self->py_if1D.borrowed = 0; return 0; } @@ -180,21 +181,24 @@ PyObject * FEdge___copy__( BPy_FEdge *self ) { py_fe->fe = new FEdge( *(self->fe) ); py_fe->py_if1D.if1D = py_fe->fe; + py_fe->py_if1D.borrowed = 0; return (PyObject *) py_fe; } PyObject * FEdge_vertexA( BPy_FEdge *self ) { - if( self->fe->vertexA() ){ - return BPy_SVertex_from_SVertex_ptr( self->fe->vertexA() ); + SVertex *A = self->fe->vertexA(); + if( A ){ + return BPy_SVertex_from_SVertex( *A ); } Py_RETURN_NONE; } PyObject * FEdge_vertexB( BPy_FEdge *self ) { - if( self->fe->vertexB() ){ - return BPy_SVertex_from_SVertex_ptr( self->fe->vertexB() ); + SVertex *B = self->fe->vertexB(); + if( B ){ + return BPy_SVertex_from_SVertex( *B ); } Py_RETURN_NONE; @@ -211,29 +215,33 @@ PyObject * FEdge___getitem__( BPy_FEdge *self, PyObject *args ) { return NULL; } - if( SVertex *v = self->fe->operator[](i) ) - return BPy_SVertex_from_SVertex_ptr( v ); + SVertex *v = self->fe->operator[](i); + if( v ) + return BPy_SVertex_from_SVertex( *v ); Py_RETURN_NONE; } PyObject * FEdge_nextEdge( BPy_FEdge *self ) { - if( FEdge *fe = self->fe->nextEdge() ) - return BPy_FEdge_from_FEdge( *fe ); + FEdge *fe = self->fe->nextEdge(); + if( fe ) + return Any_BPy_FEdge_from_FEdge( *fe ); Py_RETURN_NONE; } PyObject * FEdge_previousEdge( BPy_FEdge *self ) { - if( FEdge *fe = self->fe->previousEdge() ) - return BPy_FEdge_from_FEdge( *fe ); + FEdge *fe = self->fe->previousEdge(); + if( fe ) + return Any_BPy_FEdge_from_FEdge( *fe ); Py_RETURN_NONE; } PyObject * FEdge_viewedge( BPy_FEdge *self ) { - if( ViewEdge *ve = self->fe->viewedge() ) - return BPy_ViewEdge_from_ViewEdge_ptr( ve ); + ViewEdge *ve = self->fe->viewedge(); + if( ve ) + return BPy_ViewEdge_from_ViewEdge( *ve ); Py_RETURN_NONE; } diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index a44e2feed5b..2194748ef4e 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -149,6 +149,7 @@ int FrsCurve___init__(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) } self->py_if1D.if1D = self->c; + self->py_if1D.borrowed = 0; return 0; } diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 89b9478212f..38cba3f1275 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -198,6 +198,7 @@ int Stroke___init__(BPy_Stroke *self, PyObject *args, PyObject *kwds) } self->py_if1D.if1D = self->s; + self->py_if1D.borrowed = 0; return 0; } @@ -216,7 +217,7 @@ PyObject * Stroke_item( BPy_Stroke *self, Py_ssize_t i ) { PyErr_SetString(PyExc_IndexError, "subscript index out of range"); return NULL; } - return BPy_StrokeVertex_from_StrokeVertex_ptr( self->s->strokeVerticeAt(i) ); + return BPy_StrokeVertex_from_StrokeVertex( self->s->strokeVerticeAt(i) ); } PyObject * Stroke___getitem__( BPy_Stroke *self, PyObject *item ) { diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index 958d96031e3..ba0c4756b9b 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -163,54 +163,61 @@ int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds) { self->ve = new ViewEdge(); self->py_if1D.if1D = self->ve; + self->py_if1D.borrowed = 0; return 0; } PyObject * ViewEdge_A( BPy_ViewEdge *self ) { - if( self->ve->A() ){ - return BPy_ViewVertex_from_ViewVertex_ptr( self->ve->A() ); + ViewVertex *v = self->ve->A(); + if( v ){ + return Any_BPy_ViewVertex_from_ViewVertex( *v ); } Py_RETURN_NONE; } PyObject * ViewEdge_B( BPy_ViewEdge *self ) { - if( self->ve->B() ){ - return BPy_ViewVertex_from_ViewVertex_ptr( self->ve->B() ); + ViewVertex *v = self->ve->B(); + if( v ){ + return Any_BPy_ViewVertex_from_ViewVertex( *v ); } Py_RETURN_NONE; } PyObject * ViewEdge_fedgeA( BPy_ViewEdge *self ) { - if( self->ve->fedgeA() ){ - return BPy_FEdge_from_FEdge(*( self->ve->fedgeA() )); + FEdge *A = self->ve->fedgeA(); + if( A ){ + return Any_BPy_FEdge_from_FEdge( *A ); } Py_RETURN_NONE; } PyObject * ViewEdge_fedgeB( BPy_ViewEdge *self ) { - if( self->ve->fedgeB() ){ - return BPy_FEdge_from_FEdge(*( self->ve->fedgeB() )); + FEdge *B = self->ve->fedgeB(); + if( B ){ + return Any_BPy_FEdge_from_FEdge( *B ); } Py_RETURN_NONE; } PyObject * ViewEdge_viewShape( BPy_ViewEdge *self ) { - if( self->ve->viewShape() ){ - return BPy_ViewShape_from_ViewShape(*( self->ve->viewShape() )); + ViewShape *vs = self->ve->viewShape(); + if( vs ){ + return BPy_ViewShape_from_ViewShape( *vs ); } Py_RETURN_NONE; } PyObject * ViewEdge_aShape( BPy_ViewEdge *self ) { - if( self->ve->aShape() ){ - return BPy_ViewShape_from_ViewShape(*( self->ve->aShape() )); + ViewShape *vs = self->ve->aShape(); + if( vs ){ + return BPy_ViewShape_from_ViewShape( *vs ); } Py_RETURN_NONE; diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp index 5714f415d80..a80388bd76c 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp @@ -137,6 +137,7 @@ int Chain___init__(BPy_Chain *self, PyObject *args, PyObject *kwds) self->py_c.c = self->c; self->py_c.py_if1D.if1D = self->c; + self->py_c.py_if1D.borrowed = 0; return 0; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index aa0ba7dfc46..7f60098a4d1 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -148,6 +148,7 @@ int FEdgeSharp___init__(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds) self->py_fe.fe = self->fes; self->py_fe.py_if1D.if1D = self->fes; + self->py_fe.py_if1D.borrowed = 0; return 0; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index 9913503db58..c19ef463f22 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -140,6 +140,7 @@ int FEdgeSmooth___init__(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds) self->py_fe.fe = self->fes; self->py_fe.py_if1D.if1D = self->fes; + self->py_fe.py_if1D.borrowed = 0; return 0; } |