diff options
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface0D')
6 files changed, 34 insertions, 23 deletions
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index 5c739f9cd29..85ccae1c247 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -152,6 +152,7 @@ int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) } self->py_if0D.if0D = self->cp; + self->py_if0D.borrowed = 0; return 0; } @@ -163,20 +164,23 @@ PyObject * CurvePoint___copy__( BPy_CurvePoint *self ) { py_cp->cp = new CurvePoint( *(self->cp) ); py_cp->py_if0D.if0D = py_cp->cp; + py_cp->py_if0D.borrowed = 0; return (PyObject *) py_cp; } PyObject * CurvePoint_A( BPy_CurvePoint *self ) { - if( SVertex *A = self->cp->A() ) - return BPy_SVertex_from_SVertex_ptr( A ); + SVertex *A = self->cp->A(); + if( A ) + return BPy_SVertex_from_SVertex( *A ); Py_RETURN_NONE; } PyObject * CurvePoint_B( BPy_CurvePoint *self ) { - if( SVertex *B = self->cp->B() ) - return BPy_SVertex_from_SVertex_ptr( B ); + SVertex *B = self->cp->B(); + if( B ) + return BPy_SVertex_from_SVertex( *B ); Py_RETURN_NONE; } diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index 46fd1c64758..b3005570843 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -151,6 +151,7 @@ int SVertex___init__(BPy_SVertex *self, PyObject *args, PyObject *kwds) } self->py_if0D.if0D = self->sv; + self->py_if0D.borrowed = 0; return 0; } @@ -162,6 +163,7 @@ PyObject * SVertex___copy__( BPy_SVertex *self ) { py_svertex->sv = self->sv->duplicate(); py_svertex->py_if0D.if0D = py_svertex->sv; + py_svertex->py_if0D.borrowed = 0; return (PyObject *) py_svertex; } @@ -188,12 +190,10 @@ PyObject * SVertex_normalsSize( BPy_SVertex *self ) { PyObject * SVertex_viewvertex( BPy_SVertex *self ) { ViewVertex *vv = self->sv->viewvertex(); - if (!vv) - Py_RETURN_NONE; - if (typeid(*vv) == typeid(NonTVertex)) - return BPy_NonTVertex_from_NonTVertex_ptr( dynamic_cast<NonTVertex*>(vv) ); - else - return BPy_TVertex_from_TVertex_ptr( dynamic_cast<TVertex*>(vv) ); + if( vv ) + return Any_BPy_ViewVertex_from_ViewVertex( *vv ); + + Py_RETURN_NONE; } PyObject *SVertex_setPoint3D( BPy_SVertex *self , PyObject *args) { diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp index f37e868bdbd..edccf65f53a 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp @@ -120,6 +120,7 @@ int ViewVertex___init__(BPy_ViewVertex *self ) { self->vv = 0; // ViewVertex is abstract self->py_if0D.if0D = new Interface0D(); + self->py_if0D.borrowed = 0; return 0; } diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 969aa1d7216..b3e709540b3 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -166,6 +166,7 @@ int StrokeVertex___init__(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds self->py_cp.cp = self->sv; self->py_cp.py_if0D.if0D = self->sv; + self->py_cp.py_if0D.borrowed = 0; return 0; } @@ -184,7 +185,7 @@ PyObject * StrokeVertex_getPoint( BPy_StrokeVertex *self ) { } PyObject * StrokeVertex_attribute( BPy_StrokeVertex *self ) { - return BPy_StrokeAttribute_from_StrokeAttribute_ptr( &(self->sv->attribute()) ); + return BPy_StrokeAttribute_from_StrokeAttribute( self->sv->attribute() ); } PyObject * StrokeVertex_curvilinearAbscissa( BPy_StrokeVertex *self ) { diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp index e21a4264410..a5948deea7a 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp @@ -139,6 +139,7 @@ int NonTVertex___init__(BPy_NonTVertex *self, PyObject *args, PyObject *kwds) self->py_vv.vv = self->ntv; self->py_vv.py_if0D.if0D = self->ntv; + self->py_vv.py_if0D.borrowed = 0; return 0; } @@ -151,16 +152,17 @@ PyObject * NonTVertex_castToSVertex( BPy_NonTVertex *self ) { } PyObject * NonTVertex_castToViewVertex( BPy_NonTVertex *self ) { - return BPy_ViewVertex_from_ViewVertex_ptr( self->ntv->castToViewVertex() ); + return BPy_ViewVertex_from_ViewVertex( *(self->ntv->castToViewVertex()) ); } PyObject * NonTVertex_castToNonTVertex( BPy_NonTVertex *self ) { - return BPy_NonTVertex_from_NonTVertex_ptr( self->ntv->castToNonTVertex() ); + return BPy_NonTVertex_from_NonTVertex( *(self->ntv->castToNonTVertex()) ); } PyObject * NonTVertex_svertex( BPy_NonTVertex *self ) { - if( self->ntv->svertex() ){ - return BPy_SVertex_from_SVertex_ptr( self->ntv->svertex() ); + SVertex *v = self->ntv->svertex(); + if( v ){ + return BPy_SVertex_from_SVertex( *v ); } Py_RETURN_NONE; diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp index 4ac3d3dd170..6eb97055576 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp @@ -134,30 +134,33 @@ int TVertex___init__(BPy_TVertex *self, PyObject *args, PyObject *kwds) self->tv = new TVertex(); self->py_vv.vv = self->tv; self->py_vv.py_if0D.if0D = self->tv; + self->py_vv.py_if0D.borrowed = 0; return 0; } PyObject * TVertex_castToViewVertex( BPy_TVertex *self ) { - return BPy_ViewVertex_from_ViewVertex_ptr( self->tv->castToViewVertex() ); + return BPy_ViewVertex_from_ViewVertex( *(self->tv->castToViewVertex()) ); } PyObject * TVertex_castToTVertex( BPy_TVertex *self ) { - return BPy_TVertex_from_TVertex_ptr( self->tv->castToTVertex() ); + return BPy_TVertex_from_TVertex( *(self->tv->castToTVertex()) ); } PyObject * TVertex_frontSVertex( BPy_TVertex *self ) { - if( self->tv->frontSVertex() ){ - return BPy_SVertex_from_SVertex_ptr( self->tv->frontSVertex() ); + SVertex *v = self->tv->frontSVertex(); + if( v ){ + return BPy_SVertex_from_SVertex( *v ); } Py_RETURN_NONE; } PyObject * TVertex_backSVertex( BPy_TVertex *self ) { - if( self->tv->backSVertex() ){ - return BPy_SVertex_from_SVertex_ptr( self->tv->backSVertex() ); + SVertex *v = self->tv->backSVertex(); + if( v ){ + return BPy_SVertex_from_SVertex( *v ); } Py_RETURN_NONE; @@ -205,7 +208,7 @@ PyObject * TVertex_getSVertex( BPy_TVertex *self, PyObject *args) { SVertex *sv = self->tv->getSVertex( ((BPy_FEdge *) py_fe)->fe ); if( sv ){ - return BPy_SVertex_from_SVertex_ptr( sv ); + return BPy_SVertex_from_SVertex( *sv ); } Py_RETURN_NONE; @@ -219,7 +222,7 @@ PyObject * TVertex_mate( BPy_TVertex *self, PyObject *args) { ViewEdge *ve = self->tv->mate( ((BPy_ViewEdge *) py_ve)->ve ); if( ve ){ - return BPy_ViewEdge_from_ViewEdge_ptr( ve ); + return BPy_ViewEdge_from_ViewEdge( *ve ); } Py_RETURN_NONE; |