From 7565990db264dbb7771744cea0a1c87b3e11fc3f Mon Sep 17 00:00:00 2001 From: Maxime Curioni Date: Fri, 1 Aug 2008 21:55:58 +0000 Subject: soc-2008-mxcurioni: made considerable changes to support cross-language polymorphism for UnaryFunction0D, Interface0D, Interface1D. Add to change UnaryFunction1D to static UnaryFunction1D_void. Resolved namespace collision on the Image class (changed to FrsImage). There is greater support for style modules but somehow, some do not show anything yet (japanese_bigbrush being an example). --- .../freestyle/intern/python/BPy_Convert.cpp | 61 ++++++++---- .../blender/freestyle/intern/python/BPy_Convert.h | 25 +++-- .../freestyle/intern/python/BPy_Interface1D.cpp | 45 +++++++++ .../blender/freestyle/intern/python/Director.cpp | 103 +++++++++++++++++++-- source/blender/freestyle/intern/python/Director.h | 32 +++---- .../UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp | 6 +- .../BPy_UnaryFunction0DEdgeNature.cpp | 1 + .../UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp | 1 + .../UnaryFunction0D/BPy_UnaryFunction0DId.cpp | 1 + .../BPy_UnaryFunction0DMaterial.cpp | 1 + .../BPy_UnaryFunction0DUnsigned.cpp | 1 + .../UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp | 1 + .../UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp | 1 + .../BPy_UnaryFunction0DVectorViewShape.cpp | 1 + .../BPy_UnaryFunction0DViewShape.cpp | 1 + .../UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp | 2 + .../BPy_UnaryFunction1DEdgeNature.cpp | 2 + .../UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp | 2 + .../BPy_UnaryFunction1DUnsigned.cpp | 2 + .../UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp | 2 + .../UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp | 2 + .../BPy_UnaryFunction1DVectorViewShape.cpp | 2 + .../UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp | 6 +- .../UnaryFunction1D/BPy_UnaryFunction1DVoid.h | 2 +- 24 files changed, 246 insertions(+), 57 deletions(-) (limited to 'source/blender/freestyle/intern/python') diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index e7d98440683..a1c26aaf622 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -39,14 +39,15 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// +//============================== +// C++ => Python +//============================== + PyObject * PyBool_from_bool( bool b ){ return PyBool_FromLong( b ? 1 : 0); } -bool bool_from_PyBool( PyObject *b ) { - return b == Py_True; -} PyObject * Vector_from_Vec2f( Vec2f& vec ) { float vec_data[2]; // because vec->_coord is protected @@ -224,19 +225,6 @@ PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewE return py_dve; } - -//============================== -// Constants -//============================== - -IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) { - return static_cast( PyInt_AsLong(obj) ); -} - -Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ) { - return static_cast( PyInt_AsLong(obj) ); -} - //============================== // Iterators //============================== @@ -323,7 +311,48 @@ PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator( ChainSilhou } +//============================== +// Python => C++ +//============================== + +bool bool_from_PyBool( PyObject *b ) { + return b == Py_True; +} + +IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) { + return static_cast( PyInt_AsLong(obj) ); +} + +Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ) { + return static_cast( PyInt_AsLong(obj) ); +} +Nature::EdgeNature EdgeNature_from_BPy_Nature( PyObject* obj ) { + return static_cast( PyInt_AsLong(obj) ); +} + +Vec2f * Vec2f_ptr_from_Vector( PyObject* obj ) { + float x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") ); + float y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") ); + + return new Vec2f(x,y); +} + +Vec3f * Vec3f_ptr_from_Vector( PyObject* obj ) { + float x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") ); + float y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") ); + float z = PyFloat_AsDouble( PyObject_GetAttrString(obj,"z") ); + + return new Vec3f(x,y,z); +} + +Vec3r * Vec3r_ptr_from_Vector( PyObject* obj ) { + double x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") ); + double y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") ); + double z = PyFloat_AsDouble( PyObject_GetAttrString(obj,"z") ); + + return new Vec3r(x,y,z); +} /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h index 4bfaf4c1e17..5bfdef56278 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.h +++ b/source/blender/freestyle/intern/python/BPy_Convert.h @@ -23,6 +23,9 @@ using namespace Geometry; // Material #include "../scene_graph/Material.h" +// Nature::VertexNature, Nature::EdgeNature +#include "../winged_edge/Nature.h" + // Stroke, StrokeAttribute, StrokeVertex #include "../stroke/Stroke.h" @@ -58,16 +61,15 @@ extern "C" { #include "api2_2x/vector.h" #include "api2_2x/gen_utils.h" -PyObject * PyBool_from_bool( bool b ); -bool bool_from_PyBool( PyObject *b ); +//============================== +// C++ => Python +//============================== +PyObject * PyBool_from_bool( bool b ); PyObject * Vector_from_Vec2f( Vec2f& v ); PyObject * Vector_from_Vec3f( Vec3f& v ); PyObject * Vector_from_Vec3r( Vec3r& v ); -IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ); -Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ); - PyObject * BPy_BBox_from_BBox( BBox< Vec3r > &bb ); PyObject * BPy_CurvePoint_from_CurvePoint( CurvePoint& cp ); PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewEdge& dve ); @@ -99,8 +101,19 @@ PyObject * BPy_ChainingIterator_from_ChainingIterator( ChainingIterator& c_it ); PyObject * BPy_ChainPredicateIterator_from_ChainPredicateIterator( ChainPredicateIterator& cp_it ); PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator( ChainSilhouetteIterator& cs_it ); +//============================== +// Python => C++ +//============================== + +bool bool_from_PyBool( PyObject *b ); +IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ); +Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ); +Nature::EdgeNature EdgeNature_from_BPy_Nature( PyObject* obj ); +Vec2f * Vec2f_ptr_from_Vector( PyObject* obj ); +Vec3f * Vec3f_ptr_from_Vector( PyObject* obj ); +Vec3r * Vec3r_ptr_from_Vector( PyObject* obj ); + - /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index 3db9531da4b..8d2549ebf2c 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -30,6 +30,10 @@ static PyObject *Interface1D_getId( BPy_Interface1D *self ); static PyObject *Interface1D_getNature( BPy_Interface1D *self ); static PyObject *Interface1D_getTimeStamp( BPy_Interface1D *self ); static PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args); +static PyObject * Interface1D_verticesBegin( BPy_Interface1D *self ); +static PyObject * Interface1D_verticesEnd( BPy_Interface1D *self ); +static PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ); +static PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ); /*----------------------Interface1D instance definitions ----------------------------*/ static PyMethodDef BPy_Interface1D_methods[] = { @@ -41,6 +45,11 @@ static PyMethodDef BPy_Interface1D_methods[] = { {"getNature", ( PyCFunction ) Interface1D_getNature, METH_NOARGS, "Returns the nature of the 1D element"}, {"getTimeStamp", ( PyCFunction ) Interface1D_getTimeStamp, METH_NOARGS, "Returns the time stamp of the 1D element. Mainly used for selection"}, {"setTimeStamp", ( PyCFunction ) Interface1D_setTimeStamp, METH_VARARGS, "Sets the time stamp for the 1D element"}, + {"verticesBegin", ( PyCFunction ) Interface1D_verticesBegin, METH_NOARGS, ""}, + {"verticesEnd", ( PyCFunction ) Interface1D_verticesEnd, METH_NOARGS, ""}, + {"pointsBegin", ( PyCFunction ) Interface1D_pointsBegin, METH_VARARGS, ""}, + {"pointsEnd", ( PyCFunction ) Interface1D_pointsEnd, METH_VARARGS, ""}, + {NULL, NULL, 0, NULL} }; @@ -189,6 +198,7 @@ PyMODINIT_FUNC Interface1D_Init( PyObject *module ) int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { self->if1D = new Interface1D(); + self->if1D->py_if1D = (PyObject *) self; return 0; } @@ -245,6 +255,41 @@ PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args) { Py_RETURN_NONE; } +PyObject * Interface1D_verticesBegin( BPy_Interface1D *self ) { + Interface0DIterator if0D_it( self->if1D->verticesBegin() ); + return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it ); +} + +PyObject * Interface1D_verticesEnd( BPy_Interface1D *self ) { + Interface0DIterator if0D_it( self->if1D->verticesEnd() ); + return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it ); +} + + +PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ) { + float f = 0; + + if(!( PyArg_ParseTuple(args, "|f", &f) )) { + cout << "ERROR: Interface1D_pointsBegin" << endl; + Py_RETURN_NONE; + } + + Interface0DIterator if0D_it( self->if1D->pointsBegin(f) ); + return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it ); +} + +PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ) { + float f = 0; + + if(!( PyArg_ParseTuple(args, "|f", &f) )) { + cout << "ERROR: Interface1D_pointsEnd" << endl; + Py_RETURN_NONE; + } + + Interface0DIterator if0D_it( self->if1D->pointsEnd(f) ); + return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it ); +} + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp index 42677919ca5..b3188554c09 100644 --- a/source/blender/freestyle/intern/python/Director.cpp +++ b/source/blender/freestyle/intern/python/Director.cpp @@ -4,14 +4,29 @@ #include "BPy_BinaryPredicate0D.h" #include "BPy_BinaryPredicate1D.h" +#include "BPy_FrsMaterial.h" +#include "BPy_Id.h" #include "BPy_UnaryFunction0D.h" #include "BPy_UnaryFunction1D.h" #include "BPy_UnaryPredicate0D.h" #include "BPy_UnaryPredicate1D.h" #include "BPy_StrokeShader.h" #include "Iterator/BPy_ChainingIterator.h" +#include "Iterator/BPy_Interface0DIterator.h" #include "Interface1D/BPy_Stroke.h" #include "Interface1D/BPy_ViewEdge.h" +#include "BPy_ViewShape.h" + +#include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DFloat.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DId.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DMaterial.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DVec2f.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DVec3f.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DViewShape.h" // BinaryPredicate0D: __call__ bool Director_BPy_BinaryPredicate0D___call__( PyObject *obj, Interface0D& i1, Interface0D& i2) { @@ -61,17 +76,58 @@ ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyItera return ((BPy_ViewEdge *) result)->ve; } + // BPy_UnaryFunction{0D,1D}: __call__ -// BPy_UnaryFunction0DDouble -// BPy_UnaryFunction0DEdgeNature -// BPy_UnaryFunction0DFloat -// BPy_UnaryFunction0DId -// BPy_UnaryFunction0DMaterial -// BPy_UnaryFunction0DUnsigned -// BPy_UnaryFunction0DVec2f -// BPy_UnaryFunction0DVec3f -// BPy_UnaryFunction0DVectorViewShape -// BPy_UnaryFunction0DViewShape +void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it) { + + PyObject *result = PyObject_CallMethod( obj, "__call__", "O", BPy_Interface0DIterator_from_Interface0DIterator(if0D_it) ); + + if( BPy_UnaryFunction0DDouble_Check(obj) ) { + ((UnaryFunction0D *) uf0D)->result = PyFloat_AsDouble(result); + + } else if ( BPy_UnaryFunction0DEdgeNature_Check(obj) ) { + ((UnaryFunction0D *) uf0D)->result = EdgeNature_from_BPy_Nature(result); + + } else if ( BPy_UnaryFunction0DFloat_Check(obj) ) { + + ((UnaryFunction0D *) uf0D)->result = PyFloat_AsDouble(result); + + } else if ( BPy_UnaryFunction0DId_Check(obj) ) { + ((UnaryFunction0D *) uf0D)->result = *( ((BPy_Id *) result)->id ); + + } else if ( BPy_UnaryFunction0DMaterial_Check(obj) ) { + ((UnaryFunction0D *) uf0D)->result = *( ((BPy_FrsMaterial *) result)->m ); + + } else if ( BPy_UnaryFunction0DUnsigned_Check(obj) ) { + ((UnaryFunction0D *) uf0D)->result = PyInt_AsLong(result); + + } else if ( BPy_UnaryFunction0DVec2f_Check(obj) ) { + Vec2f *v = Vec2f_ptr_from_Vector( result ); + ((UnaryFunction0D *) uf0D)->result = *v; + delete v; + + } else if ( BPy_UnaryFunction0DVec3f_Check(obj) ) { + Vec3f *v = Vec3f_ptr_from_Vector( result ); + ((UnaryFunction0D *) uf0D)->result = *v; + delete v; + + } else if ( BPy_UnaryFunction0DVectorViewShape_Check(obj) ) { + vector vec; + for( int i = 0; i < PyList_Size(result); i++) { + ViewShape *b = ( (BPy_ViewShape *) PyList_GetItem(result, i) )->vs; + vec.push_back( b ); + } + + ((UnaryFunction0D< vector > *) uf0D)->result = vec; + + } else if ( BPy_UnaryFunction0DViewShape_Check(obj) ) { + ((UnaryFunction0D *) uf0D)->result = ((BPy_ViewShape *) result)->vs; + + } + +} + +void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D) { // BPy_UnaryFunction1DDouble // BPy_UnaryFunction1DEdgeNature @@ -82,6 +138,10 @@ ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyItera // BPy_UnaryFunction1DVectorViewShape // BPy_UnaryFunction1DVoid + +} + + // BPy_Iterator: increment, decrement, isBegin, isEnd void Director_BPy_Iterator_increment( PyObject *obj ) { PyObject_CallMethod( obj, "increment", "", 0 ); @@ -103,5 +163,28 @@ bool Director_BPy_Iterator_isEnd( PyObject *obj ) { return bool_from_PyBool(result); } +// BPy_Interface1D: verticesBegin, verticesEnd, pointsBegin, pointsEnd +Interface0DIterator Director_BPy_Interface1D_verticesBegin( PyObject *obj ){ + PyObject *result = PyObject_CallMethod( obj, "verticesBegin", "", 0 ); + + return *( ((BPy_Interface0DIterator *) result)->if0D_it ); +} + +Interface0DIterator Director_BPy_Interface1D_verticesEnd( PyObject *obj ){ + PyObject *result = PyObject_CallMethod( obj, "verticesEnd", "", 0 ); + + return *( ((BPy_Interface0DIterator *) result)->if0D_it ); +} + +Interface0DIterator Director_BPy_Interface1D_pointsBegin( PyObject *obj ){ + PyObject *result = PyObject_CallMethod( obj, "pointsBegin", "", 0 ); + return *( ((BPy_Interface0DIterator *) result)->if0D_it ); +} + +Interface0DIterator Director_BPy_Interface1D_pointsEnd( PyObject *obj ){ + PyObject *result = PyObject_CallMethod( obj, "pointsEnd", "", 0 ); + + return *( ((BPy_Interface0DIterator *) result)->if0D_it ); +} diff --git a/source/blender/freestyle/intern/python/Director.h b/source/blender/freestyle/intern/python/Director.h index 2a67be237f5..27afa3bbe3e 100644 --- a/source/blender/freestyle/intern/python/Director.h +++ b/source/blender/freestyle/intern/python/Director.h @@ -37,27 +37,9 @@ void Director_BPy_StrokeShader_shade( PyObject *obj, Stroke& s); void Director_BPy_ChainingIterator_init( PyObject *obj ); ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyIterator& a_it ); -// BPy_UnaryFunction0DDouble -double Director_BPy_UnaryFunction0DDouble___call__( PyObject *obj, Interface0DIterator& if0D_it); -// BPy_UnaryFunction0DEdgeNature -// BPy_UnaryFunction0DFloat -// BPy_UnaryFunction0DId -// BPy_UnaryFunction0DMaterial -// BPy_UnaryFunction0DUnsigned -// BPy_UnaryFunction0DVec2f -// BPy_UnaryFunction0DVec3f -// BPy_UnaryFunction0DVectorViewShape -// BPy_UnaryFunction0DViewShape - -// BPy_UnaryFunction1DDouble -// BPy_UnaryFunction1DEdgeNature -// BPy_UnaryFunction1DFloat -// BPy_UnaryFunction1DUnsigned -// BPy_UnaryFunction1DVec2f -// BPy_UnaryFunction1DVec3f -// BPy_UnaryFunction1DVectorViewShape -// BPy_UnaryFunction1DVoid -void Director_BPy_UnaryFunction1DVoid___call__( PyObject *obj, Interface1D& if1D); +// BPy_UnaryFunction{0D,1D}: __call__ +void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it); +void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D); // BPy_Iterator: increment, decrement, isBegin, isEnd void Director_BPy_Iterator_increment( PyObject *obj ); @@ -65,4 +47,12 @@ void Director_BPy_Iterator_decrement( PyObject *obj ); bool Director_BPy_Iterator_isBegin( PyObject *obj ); bool Director_BPy_Iterator_isEnd( PyObject *obj ); +// BPy_Interface1D: verticesBegin, verticesEnd, pointsBegin, pointsEnd +Interface0DIterator Director_BPy_Interface1D_verticesBegin( PyObject *obj ); +Interface0DIterator Director_BPy_Interface1D_verticesEnd( PyObject *obj ); +Interface0DIterator Director_BPy_Interface1D_pointsBegin( PyObject *obj ); +Interface0DIterator Director_BPy_Interface1D_pointsEnd( PyObject *obj ); + + + #endif // FREESTYLE_PYTHON_DIRECTOR diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index e7ac46122b6..45f5c297b8a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -14,6 +14,8 @@ #include "UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h" #include "UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h" +#include "../Director.h" + #ifdef __cplusplus extern "C" { #endif @@ -190,6 +192,7 @@ PyMODINIT_FUNC UnaryFunction0DDouble_Init( PyObject *module ) { int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self) { self->uf0D_double = new UnaryFunction0D(); + self->uf0D_double->py_uf0D = (PyObject *)self; return 0; } @@ -219,7 +222,8 @@ PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyOb return NULL; } - double d = self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )); + double d = self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it)); + return PyFloat_FromDouble( d ); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index 3dfcb74cddd..79f8ff1f648 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DEdgeNature_Init( PyObject *module ) { int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self) { self->uf0D_edgenature = new UnaryFunction0D(); + self->uf0D_edgenature->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index 2c11eb92ed5..bff5fa962c1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -164,6 +164,7 @@ PyMODINIT_FUNC UnaryFunction0DFloat_Init( PyObject *module ) { int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self) { self->uf0D_float = new UnaryFunction0D(); + self->uf0D_float->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index 2d6cbf09be1..6e21f5f687e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DId_Init( PyObject *module ) { int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self) { self->uf0D_id = new UnaryFunction0D(); + self->uf0D_id->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index 733acce6ab8..2aef794617a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DMaterial_Init( PyObject *module ) { int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self) { self->uf0D_material = new UnaryFunction0D(); + self->uf0D_material->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index a7d8e9f42a7..2d33419032b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DUnsigned_Init( PyObject *module ) { int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self) { self->uf0D_unsigned = new UnaryFunction0D(); + self->uf0D_unsigned->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index fb7fc4f19fe..3eedf16c575 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -141,6 +141,7 @@ PyMODINIT_FUNC UnaryFunction0DVec2f_Init( PyObject *module ) { int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self) { self->uf0D_vec2f = new UnaryFunction0D(); + self->uf0D_vec2f->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index d0412d7c7d0..aa77d17b18b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DVec3f_Init( PyObject *module ) { int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self) { self->uf0D_vec3f = new UnaryFunction0D(); + self->uf0D_vec3f->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 02aef4e28cf..93bea5c114e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DVectorViewShape_Init( PyObject *module ) { int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* self) { self->uf0D_vectorviewshape = new UnaryFunction0D< std::vector >(); + self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index eb2fceb3f06..a9714e0b2c6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -141,6 +141,7 @@ PyMODINIT_FUNC UnaryFunction0DViewShape_Init( PyObject *module ) { int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self) { self->uf0D_viewshape = new UnaryFunction0D(); + self->uf0D_viewshape->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index 887d1273e60..c3fc04c8b1e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -231,6 +231,8 @@ int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *ar self->uf1D_double = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); } + self->uf1D_double->py_uf1D = (PyObject *)self; + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index d4d7f642494..78d63020062 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -152,6 +152,8 @@ int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyOb self->uf1D_edgenature = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); } + self->uf1D_edgenature->py_uf1D = (PyObject *)self; + return 0; } void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* self) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index f4c8a9e53ce..a424d7862a6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -145,6 +145,8 @@ int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args self->uf1D_float = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); } + self->uf1D_float->py_uf1D = (PyObject *)self; + return 0; } void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index ef75f3bad5b..297116d2112 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -152,6 +152,8 @@ int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject self->uf1D_unsigned = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); } + self->uf1D_unsigned->py_uf1D = (PyObject *)self; + return 0; } void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* self) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index e0fa12c66e6..1d3f1c708b5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -158,6 +158,8 @@ int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args self->uf1D_vec2f = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); } + self->uf1D_vec2f->py_uf1D = (PyObject *)self; + return 0; } void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 3a3c7d4e835..1b4c7b281d3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -152,6 +152,8 @@ int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f* self, PyObject *args self->uf1D_vec3f = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); } + self->uf1D_vec3f->py_uf1D = (PyObject *)self; + return 0; } void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index c0b25403706..36f5fc442bf 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -165,6 +165,8 @@ int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector >( IntegrationType_from_BPy_IntegrationType(obj) ); } + self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self; + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index 99cc6838997..9d5178a299d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -161,11 +161,13 @@ int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args) } if( !obj ) - self->uf1D_void = new UnaryFunction1D(); + self->uf1D_void = new UnaryFunction1D_void(); else { - self->uf1D_void = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_void = new UnaryFunction1D_void( IntegrationType_from_BPy_IntegrationType(obj) ); } + self->uf1D_void->py_uf1D = (PyObject *)self; + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h index 3e8ad431ec4..34615bb4b27 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h @@ -18,7 +18,7 @@ extern PyTypeObject UnaryFunction1DVoid_Type; /*---------------------------Python BPy_UnaryFunction1DVoid structure definition----------*/ typedef struct { BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D *uf1D_void; + UnaryFunction1D_void *uf1D_void; } BPy_UnaryFunction1DVoid; /*---------------------------Python BPy_UnaryFunction1DVoid visible prototypes-----------*/ -- cgit v1.2.3