diff options
Diffstat (limited to 'source/blender/freestyle/intern/python/UnaryFunction1D')
66 files changed, 5159 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp new file mode 100644 index 00000000000..ac61161f65c --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -0,0 +1,287 @@ +#include "BPy_UnaryFunction1DDouble.h" + +#include "../BPy_Convert.h" +#include "../BPy_Interface1D.h" +#include "../BPy_IntegrationType.h" + +#include "UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h" +#include "UnaryFunction1D_double/BPy_DensityF1D.h" +#include "UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h" +#include "UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h" +#include "UnaryFunction1D_double/BPy_GetProjectedXF1D.h" +#include "UnaryFunction1D_double/BPy_GetProjectedYF1D.h" +#include "UnaryFunction1D_double/BPy_GetProjectedZF1D.h" +#include "UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h" +#include "UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h" +#include "UnaryFunction1D_double/BPy_GetXF1D.h" +#include "UnaryFunction1D_double/BPy_GetYF1D.h" +#include "UnaryFunction1D_double/BPy_GetZF1D.h" +#include "UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h" +#include "UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//-------------------MODULE INITIALIZATION-------------------------------- + +int UnaryFunction1DDouble_Init( PyObject *module ) { + + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1DDouble_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1DDouble_Type ); + PyModule_AddObject(module, "UnaryFunction1DDouble", (PyObject *)&UnaryFunction1DDouble_Type); + + if( PyType_Ready( &DensityF1D_Type ) < 0 ) + return -1; + Py_INCREF( &DensityF1D_Type ); + PyModule_AddObject(module, "DensityF1D", (PyObject *)&DensityF1D_Type); + + if( PyType_Ready( &Curvature2DAngleF1D_Type ) < 0 ) + return -1; + Py_INCREF( &Curvature2DAngleF1D_Type ); + PyModule_AddObject(module, "Curvature2DAngleF1D", (PyObject *)&Curvature2DAngleF1D_Type); + + if( PyType_Ready( &GetCompleteViewMapDensityF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetCompleteViewMapDensityF1D_Type ); + PyModule_AddObject(module, "GetCompleteViewMapDensityF1D", (PyObject *)&GetCompleteViewMapDensityF1D_Type); + + if( PyType_Ready( &GetDirectionalViewMapDensityF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetDirectionalViewMapDensityF1D_Type ); + PyModule_AddObject(module, "GetDirectionalViewMapDensityF1D", (PyObject *)&GetDirectionalViewMapDensityF1D_Type); + + if( PyType_Ready( &GetProjectedXF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetProjectedXF1D_Type ); + PyModule_AddObject(module, "GetProjectedXF1D", (PyObject *)&GetProjectedXF1D_Type); + + if( PyType_Ready( &GetProjectedYF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetProjectedYF1D_Type ); + PyModule_AddObject(module, "GetProjectedYF1D", (PyObject *)&GetProjectedYF1D_Type); + + if( PyType_Ready( &GetProjectedZF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetProjectedZF1D_Type ); + PyModule_AddObject(module, "GetProjectedZF1D", (PyObject *)&GetProjectedZF1D_Type); + + if( PyType_Ready( &GetSteerableViewMapDensityF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetSteerableViewMapDensityF1D_Type ); + PyModule_AddObject(module, "GetSteerableViewMapDensityF1D", (PyObject *)&GetSteerableViewMapDensityF1D_Type); + + if( PyType_Ready( &GetViewMapGradientNormF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetViewMapGradientNormF1D_Type ); + PyModule_AddObject(module, "GetViewMapGradientNormF1D", (PyObject *)&GetViewMapGradientNormF1D_Type); + + if( PyType_Ready( &GetXF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetXF1D_Type ); + PyModule_AddObject(module, "GetXF1D", (PyObject *)&GetXF1D_Type); + + if( PyType_Ready( &GetYF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetYF1D_Type ); + PyModule_AddObject(module, "GetYF1D", (PyObject *)&GetYF1D_Type); + + if( PyType_Ready( &GetZF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetZF1D_Type ); + PyModule_AddObject(module, "GetZF1D", (PyObject *)&GetZF1D_Type); + + if( PyType_Ready( &LocalAverageDepthF1D_Type ) < 0 ) + return -1; + Py_INCREF( &LocalAverageDepthF1D_Type ); + PyModule_AddObject(module, "LocalAverageDepthF1D", (PyObject *)&LocalAverageDepthF1D_Type); + + if( PyType_Ready( &ZDiscontinuityF1D_Type ) < 0 ) + return -1; + Py_INCREF( &ZDiscontinuityF1D_Type ); + PyModule_AddObject(module, "ZDiscontinuityF1D", (PyObject *)&ZDiscontinuityF1D_Type); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1DDouble___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface1D` and return a float value.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(integration)\n" +"\n" +" Builds a unary 1D function using the integration method given as\n" +" argument.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + if( !obj ) + self->uf1D_double = new UnaryFunction1D<double>(); + else { + self->uf1D_double = new UnaryFunction1D<double>( IntegrationType_from_BPy_IntegrationType(obj) ); + } + + self->uf1D_double->py_uf1D = (PyObject *)self; + + return 0; +} + +static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble* self) +{ + if (self->uf1D_double) + delete self->uf1D_double; + UnaryFunction1D_Type.tp_dealloc((PyObject*)self); +} + +static PyObject * UnaryFunction1DDouble___repr__(BPy_UnaryFunction1DDouble* self) +{ + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_double->getName().c_str(), self->uf1D_double ); +} + +static char UnaryFunction1DDouble_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 1D function.\n" +"\n" +" :return: The name of the unary 1D function.\n" +" :rtype: str\n"; + +static PyObject * UnaryFunction1DDouble_getName( BPy_UnaryFunction1DDouble *self ) +{ + return PyUnicode_FromString( self->uf1D_double->getName().c_str() ); +} + +static PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } + if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + return NULL; + + if( typeid(*(self->uf1D_double)) == typeid(UnaryFunction1D<double>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_double->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf1D_double->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + return PyFloat_FromDouble( self->uf1D_double->result ); + +} + +static char UnaryFunction1DDouble_setIntegrationType___doc__[] = +".. method:: setIntegrationType(integration)\n" +"\n" +" Sets the integration method.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DDouble_setIntegrationType(BPy_UnaryFunction1DDouble* self, PyObject *args) +{ + PyObject *obj; + + if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) + return NULL; + + self->uf1D_double->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); + Py_RETURN_NONE; +} + +static char UnaryFunction1DDouble_getIntegrationType___doc__[] = +".. method:: getIntegrationType(integration)\n" +"\n" +" Returns the integration method.\n" +"\n" +" :return: The integration method.\n" +" :rtype: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DDouble_getIntegrationType(BPy_UnaryFunction1DDouble* self) { + return BPy_IntegrationType_from_IntegrationType( self->uf1D_double->getIntegrationType() ); +} + +/*----------------------UnaryFunction1DDouble instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction1DDouble_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction1DDouble_getName, METH_NOARGS, UnaryFunction1DDouble_getName___doc__}, + {"setIntegrationType", ( PyCFunction ) UnaryFunction1DDouble_setIntegrationType, METH_VARARGS, UnaryFunction1DDouble_setIntegrationType___doc__}, + {"getIntegrationType", ( PyCFunction ) UnaryFunction1DDouble_getIntegrationType, METH_NOARGS, UnaryFunction1DDouble_getIntegrationType___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction1DDouble type definition ------------------------------*/ + +PyTypeObject UnaryFunction1DDouble_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction1DDouble", /* tp_name */ + sizeof(BPy_UnaryFunction1DDouble), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DDouble___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DDouble___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DDouble___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DDouble___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction1DDouble_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DDouble___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h new file mode 100644 index 00000000000..9a9170cfe17 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_UNARYFUNCTION1DDOUBLE_H +#define FREESTYLE_PYTHON_UNARYFUNCTION1DDOUBLE_H + +#include "../BPy_UnaryFunction1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject UnaryFunction1DDouble_Type; + +#define BPy_UnaryFunction1DDouble_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DDouble_Type) ) + +/*---------------------------Python BPy_UnaryFunction1DDouble structure definition----------*/ +typedef struct { + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D<double> *uf1D_double; +} BPy_UnaryFunction1DDouble; + +/*---------------------------Python BPy_UnaryFunction1DDouble visible prototypes-----------*/ +int UnaryFunction1DDouble_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_UNARYFUNCTION1DDOUBLE_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp new file mode 100644 index 00000000000..be58cbdaa35 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -0,0 +1,208 @@ +#include "BPy_UnaryFunction1DEdgeNature.h" + +#include "../BPy_Convert.h" +#include "../BPy_Interface1D.h" +#include "../BPy_IntegrationType.h" + +#include "UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//-------------------MODULE INITIALIZATION-------------------------------- + +int UnaryFunction1DEdgeNature_Init( PyObject *module ) { + + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1DEdgeNature_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1DEdgeNature_Type ); + PyModule_AddObject(module, "UnaryFunction1DEdgeNature", (PyObject *)&UnaryFunction1DEdgeNature_Type); + + if( PyType_Ready( &CurveNatureF1D_Type ) < 0 ) + return -1; + Py_INCREF( &CurveNatureF1D_Type ); + PyModule_AddObject(module, "CurveNatureF1D", (PyObject *)&CurveNatureF1D_Type); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1DEdgeNature___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface1D` and return a :class:`Nature` object.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(integration)\n" +"\n" +" Builds a unary 1D function using the integration method given as\n" +" argument.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + if( !obj ) + self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>(); + else { + self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>( IntegrationType_from_BPy_IntegrationType(obj) ); + } + + self->uf1D_edgenature->py_uf1D = (PyObject *)self; + + return 0; +} + +static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* self) +{ + if (self->uf1D_edgenature) + delete self->uf1D_edgenature; + UnaryFunction1D_Type.tp_dealloc((PyObject*)self); +} + +static PyObject * UnaryFunction1DEdgeNature___repr__(BPy_UnaryFunction1DEdgeNature* self) +{ + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_edgenature->getName().c_str(), self->uf1D_edgenature ); +} + +static char UnaryFunction1DEdgeNature_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 1D function.\n" +"\n" +" :return: The name of the unary 1D function.\n" +" :rtype: str\n"; + +static PyObject * UnaryFunction1DEdgeNature_getName( BPy_UnaryFunction1DEdgeNature *self ) +{ + return PyUnicode_FromString( self->uf1D_edgenature->getName().c_str() ); +} + +static PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } + if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + return NULL; + + if( typeid(*(self->uf1D_edgenature)) == typeid(UnaryFunction1D<Nature::EdgeNature>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_edgenature->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf1D_edgenature->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + return BPy_Nature_from_Nature( self->uf1D_edgenature->result ); + +} + +static char UnaryFunction1DEdgeNature_setIntegrationType___doc__[] = +".. method:: setIntegrationType(integration)\n" +"\n" +" Sets the integration method.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DEdgeNature_setIntegrationType(BPy_UnaryFunction1DEdgeNature* self, PyObject *args) +{ + PyObject *obj; + + if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) + return NULL; + + self->uf1D_edgenature->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); + Py_RETURN_NONE; +} + +static char UnaryFunction1DEdgeNature_getIntegrationType___doc__[] = +".. method:: getIntegrationType(integration)\n" +"\n" +" Returns the integration method.\n" +"\n" +" :return: The integration method.\n" +" :rtype: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DEdgeNature_getIntegrationType(BPy_UnaryFunction1DEdgeNature* self) { + return BPy_IntegrationType_from_IntegrationType( self->uf1D_edgenature->getIntegrationType() ); +} + +/*----------------------UnaryFunction1DEdgeNature instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction1DEdgeNature_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction1DEdgeNature_getName, METH_NOARGS, UnaryFunction1DEdgeNature_getName___doc__}, + {"setIntegrationType", ( PyCFunction ) UnaryFunction1DEdgeNature_setIntegrationType, METH_VARARGS, UnaryFunction1DEdgeNature_setIntegrationType___doc__}, + {"getIntegrationType", ( PyCFunction ) UnaryFunction1DEdgeNature_getIntegrationType, METH_NOARGS, UnaryFunction1DEdgeNature_getIntegrationType___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction1DEdgeNature type definition ------------------------------*/ + +PyTypeObject UnaryFunction1DEdgeNature_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction1DEdgeNature", /* tp_name */ + sizeof(BPy_UnaryFunction1DEdgeNature), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DEdgeNature___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DEdgeNature___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DEdgeNature___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DEdgeNature___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction1DEdgeNature_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DEdgeNature___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h new file mode 100644 index 00000000000..05e3e522c4b --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h @@ -0,0 +1,36 @@ +#ifndef FREESTYLE_PYTHON_UNARYFUNCTION1DEDGENATURE_H +#define FREESTYLE_PYTHON_UNARYFUNCTION1DEDGENATURE_H + +#include "../BPy_UnaryFunction1D.h" + +#include "../../winged_edge/Nature.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject UnaryFunction1DEdgeNature_Type; + +#define BPy_UnaryFunction1DEdgeNature_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DEdgeNature_Type) ) + +/*---------------------------Python BPy_UnaryFunction1DEdgeNature structure definition----------*/ +typedef struct { + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D<Nature::EdgeNature> *uf1D_edgenature; +} BPy_UnaryFunction1DEdgeNature; + +/*---------------------------Python BPy_UnaryFunction1DEdgeNature visible prototypes-----------*/ +int UnaryFunction1DEdgeNature_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_UNARYFUNCTION1DEDGENATURE_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp new file mode 100644 index 00000000000..04e98e683d1 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -0,0 +1,201 @@ +#include "BPy_UnaryFunction1DFloat.h" + +#include "../BPy_Convert.h" +#include "../BPy_Interface1D.h" +#include "../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//-------------------MODULE INITIALIZATION-------------------------------- + +int UnaryFunction1DFloat_Init( PyObject *module ) { + + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1DFloat_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1DFloat_Type ); + PyModule_AddObject(module, "UnaryFunction1DFloat", (PyObject *)&UnaryFunction1DFloat_Type); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1DFloat___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface1D` and return a float value.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(integration)\n" +"\n" +" Builds a unary 1D function using the integration method given as\n" +" argument.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + if( !obj ) + self->uf1D_float = new UnaryFunction1D<float>(); + else { + self->uf1D_float = new UnaryFunction1D<float>( IntegrationType_from_BPy_IntegrationType(obj) ); + } + + self->uf1D_float->py_uf1D = (PyObject *)self; + + return 0; +} + +static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self) +{ + if (self->uf1D_float) + delete self->uf1D_float; + UnaryFunction1D_Type.tp_dealloc((PyObject*)self); +} + +static PyObject * UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat* self) +{ + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_float->getName().c_str(), self->uf1D_float ); +} + +static char UnaryFunction1DFloat_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 1D function.\n" +"\n" +" :return: The name of the unary 1D function.\n" +" :rtype: str\n"; + +static PyObject * UnaryFunction1DFloat_getName( BPy_UnaryFunction1DFloat *self ) +{ + return PyUnicode_FromString( self->uf1D_float->getName().c_str() ); +} + +static PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } + if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + return NULL; + + if( typeid(*(self->uf1D_float)) == typeid(UnaryFunction1D<float>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_float->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf1D_float->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + return PyFloat_FromDouble( self->uf1D_float->result ); + +} + +static char UnaryFunction1DFloat_setIntegrationType___doc__[] = +".. method:: setIntegrationType(integration)\n" +"\n" +" Sets the integration method.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DFloat_setIntegrationType(BPy_UnaryFunction1DFloat* self, PyObject *args) +{ + PyObject *obj; + + if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) + return NULL; + + self->uf1D_float->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); + Py_RETURN_NONE; +} + +static char UnaryFunction1DFloat_getIntegrationType___doc__[] = +".. method:: getIntegrationType(integration)\n" +"\n" +" Returns the integration method.\n" +"\n" +" :return: The integration method.\n" +" :rtype: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DFloat_getIntegrationType(BPy_UnaryFunction1DFloat* self) { + return BPy_IntegrationType_from_IntegrationType( self->uf1D_float->getIntegrationType() ); +} + +/*----------------------UnaryFunction1DFloat instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction1DFloat_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction1DFloat_getName, METH_NOARGS, UnaryFunction1DFloat_getName___doc__}, + {"setIntegrationType", ( PyCFunction ) UnaryFunction1DFloat_setIntegrationType, METH_VARARGS, UnaryFunction1DFloat_setIntegrationType___doc__}, + {"getIntegrationType", ( PyCFunction ) UnaryFunction1DFloat_getIntegrationType, METH_NOARGS, UnaryFunction1DFloat_getIntegrationType___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction1DFloat type definition ------------------------------*/ + +PyTypeObject UnaryFunction1DFloat_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction1DFloat", /* tp_name */ + sizeof(BPy_UnaryFunction1DFloat), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DFloat___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DFloat___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DFloat___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DFloat___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction1DFloat_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DFloat___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h new file mode 100644 index 00000000000..529b382372e --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_UNARYFUNCTION1DFLOAT_H +#define FREESTYLE_PYTHON_UNARYFUNCTION1DFLOAT_H + +#include "../BPy_UnaryFunction1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject UnaryFunction1DFloat_Type; + +#define BPy_UnaryFunction1DFloat_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DFloat_Type) ) + +/*---------------------------Python BPy_UnaryFunction1DFloat structure definition----------*/ +typedef struct { + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D<float> *uf1D_float; +} BPy_UnaryFunction1DFloat; + +/*---------------------------Python BPy_UnaryFunction1DFloat visible prototypes-----------*/ +int UnaryFunction1DFloat_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_UNARYFUNCTION1DFLOAT_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp new file mode 100644 index 00000000000..74d9a858efa --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -0,0 +1,208 @@ +#include "BPy_UnaryFunction1DUnsigned.h" + +#include "../BPy_Convert.h" +#include "../BPy_Interface1D.h" +#include "../BPy_IntegrationType.h" + +#include "UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//-------------------MODULE INITIALIZATION-------------------------------- + +int UnaryFunction1DUnsigned_Init( PyObject *module ) { + + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1DUnsigned_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1DUnsigned_Type ); + PyModule_AddObject(module, "UnaryFunction1DUnsigned", (PyObject *)&UnaryFunction1DUnsigned_Type); + + if( PyType_Ready( &QuantitativeInvisibilityF1D_Type ) < 0 ) + return -1; + Py_INCREF( &QuantitativeInvisibilityF1D_Type ); + PyModule_AddObject(module, "QuantitativeInvisibilityF1D", (PyObject *)&QuantitativeInvisibilityF1D_Type); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1DUnsigned___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface1D` and return an int value.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(integration)\n" +"\n" +" Builds a unary 1D function using the integration method given as\n" +" argument.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + if( !obj ) + self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(); + else { + self->uf1D_unsigned = new UnaryFunction1D<unsigned int>( IntegrationType_from_BPy_IntegrationType(obj) ); + } + + self->uf1D_unsigned->py_uf1D = (PyObject *)self; + + return 0; +} + +static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* self) +{ + if (self->uf1D_unsigned) + delete self->uf1D_unsigned; + UnaryFunction1D_Type.tp_dealloc((PyObject*)self); +} + +static PyObject * UnaryFunction1DUnsigned___repr__(BPy_UnaryFunction1DUnsigned* self) +{ + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_unsigned->getName().c_str(), self->uf1D_unsigned ); +} + +static char UnaryFunction1DUnsigned_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 1D function.\n" +"\n" +" :return: The name of the unary 1D function.\n" +" :rtype: str\n"; + +static PyObject * UnaryFunction1DUnsigned_getName( BPy_UnaryFunction1DUnsigned *self ) +{ + return PyUnicode_FromString( self->uf1D_unsigned->getName().c_str() ); +} + +static PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } + if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + return NULL; + + if( typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<unsigned int>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_unsigned->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf1D_unsigned->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + return PyLong_FromLong( self->uf1D_unsigned->result ); + +} + +static char UnaryFunction1DUnsigned_setIntegrationType___doc__[] = +".. method:: setIntegrationType(integration)\n" +"\n" +" Sets the integration method.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DUnsigned_setIntegrationType(BPy_UnaryFunction1DUnsigned* self, PyObject *args) +{ + PyObject *obj; + + if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) + return NULL; + + self->uf1D_unsigned->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); + Py_RETURN_NONE; +} + +static char UnaryFunction1DUnsigned_getIntegrationType___doc__[] = +".. method:: getIntegrationType(integration)\n" +"\n" +" Returns the integration method.\n" +"\n" +" :return: The integration method.\n" +" :rtype: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DUnsigned_getIntegrationType(BPy_UnaryFunction1DUnsigned* self) { + return BPy_IntegrationType_from_IntegrationType( self->uf1D_unsigned->getIntegrationType() ); +} + +/*----------------------UnaryFunction1DUnsigned instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction1DUnsigned_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction1DUnsigned_getName, METH_NOARGS, UnaryFunction1DUnsigned_getName___doc__}, + {"setIntegrationType", ( PyCFunction ) UnaryFunction1DUnsigned_setIntegrationType, METH_VARARGS, UnaryFunction1DUnsigned_setIntegrationType___doc__}, + {"getIntegrationType", ( PyCFunction ) UnaryFunction1DUnsigned_getIntegrationType, METH_NOARGS, UnaryFunction1DUnsigned_getIntegrationType___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction1DUnsigned type definition ------------------------------*/ + +PyTypeObject UnaryFunction1DUnsigned_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction1DUnsigned", /* tp_name */ + sizeof(BPy_UnaryFunction1DUnsigned), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DUnsigned___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DUnsigned___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DUnsigned___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DUnsigned___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction1DUnsigned_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DUnsigned___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h new file mode 100644 index 00000000000..c70cc6257a7 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_UNARYFUNCTION1DUNSIGNED_H +#define FREESTYLE_PYTHON_UNARYFUNCTION1DUNSIGNED_H + +#include "../BPy_UnaryFunction1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject UnaryFunction1DUnsigned_Type; + +#define BPy_UnaryFunction1DUnsigned_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DUnsigned_Type) ) + +/*---------------------------Python BPy_UnaryFunction1DUnsigned structure definition----------*/ +typedef struct { + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D<unsigned int> *uf1D_unsigned; +} BPy_UnaryFunction1DUnsigned; + +/*---------------------------Python BPy_UnaryFunction1DUnsigned visible prototypes-----------*/ +int UnaryFunction1DUnsigned_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_UNARYFUNCTION1DUNSIGNED_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp new file mode 100644 index 00000000000..4bbe40cfdef --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -0,0 +1,214 @@ +#include "BPy_UnaryFunction1DVec2f.h" + +#include "../BPy_Convert.h" +#include "../BPy_Interface1D.h" +#include "../BPy_IntegrationType.h" + +#include "UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h" +#include "UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//-------------------MODULE INITIALIZATION-------------------------------- + +int UnaryFunction1DVec2f_Init( PyObject *module ) { + + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1DVec2f_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1DVec2f_Type ); + PyModule_AddObject(module, "UnaryFunction1DVec2f", (PyObject *)&UnaryFunction1DVec2f_Type); + + if( PyType_Ready( &Normal2DF1D_Type ) < 0 ) + return -1; + Py_INCREF( &Normal2DF1D_Type ); + PyModule_AddObject(module, "Normal2DF1D", (PyObject *)&Normal2DF1D_Type); + + if( PyType_Ready( &Orientation2DF1D_Type ) < 0 ) + return -1; + Py_INCREF( &Orientation2DF1D_Type ); + PyModule_AddObject(module, "Orientation2DF1D", (PyObject *)&Orientation2DF1D_Type); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1DVec2f___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface1D` and return a 2D vector.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(integration)\n" +"\n" +" Builds a unary 1D function using the integration method given as\n" +" argument.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + if( !obj ) + self->uf1D_vec2f = new UnaryFunction1D<Vec2f>(); + else { + self->uf1D_vec2f = new UnaryFunction1D<Vec2f>( IntegrationType_from_BPy_IntegrationType(obj) ); + } + + self->uf1D_vec2f->py_uf1D = (PyObject *)self; + + return 0; +} + +static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self) +{ + if (self->uf1D_vec2f) + delete self->uf1D_vec2f; + UnaryFunction1D_Type.tp_dealloc((PyObject*)self); +} + +static PyObject * UnaryFunction1DVec2f___repr__(BPy_UnaryFunction1DVec2f* self) +{ + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec2f->getName().c_str(), self->uf1D_vec2f ); +} + +static char UnaryFunction1DVec2f_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 1D function.\n" +"\n" +" :return: The name of the unary 1D function.\n" +" :rtype: str\n"; + +static PyObject * UnaryFunction1DVec2f_getName( BPy_UnaryFunction1DVec2f *self ) +{ + return PyUnicode_FromString( self->uf1D_vec2f->getName().c_str() ); +} + +static PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } + if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + return NULL; + + if( typeid(*(self->uf1D_vec2f)) == typeid(UnaryFunction1D<Vec2f>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_vec2f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf1D_vec2f->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + return Vector_from_Vec2f( self->uf1D_vec2f->result ); + +} + +static char UnaryFunction1DVec2f_setIntegrationType___doc__[] = +".. method:: setIntegrationType(integration)\n" +"\n" +" Sets the integration method.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DVec2f_setIntegrationType(BPy_UnaryFunction1DVec2f* self, PyObject *args) +{ + PyObject *obj; + + if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) + return NULL; + + self->uf1D_vec2f->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); + Py_RETURN_NONE; +} + +static char UnaryFunction1DVec2f_getIntegrationType___doc__[] = +".. method:: getIntegrationType(integration)\n" +"\n" +" Returns the integration method.\n" +"\n" +" :return: The integration method.\n" +" :rtype: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DVec2f_getIntegrationType(BPy_UnaryFunction1DVec2f* self) { + return BPy_IntegrationType_from_IntegrationType( self->uf1D_vec2f->getIntegrationType() ); +} + +/*----------------------UnaryFunction1DVec2f instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction1DVec2f_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction1DVec2f_getName, METH_NOARGS, UnaryFunction1DVec2f_getName___doc__}, + {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVec2f_setIntegrationType, METH_VARARGS, UnaryFunction1DVec2f_setIntegrationType___doc__}, + {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVec2f_getIntegrationType, METH_NOARGS, UnaryFunction1DVec2f_getIntegrationType___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction1DVec2f type definition ------------------------------*/ + +PyTypeObject UnaryFunction1DVec2f_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction1DVec2f", /* tp_name */ + sizeof(BPy_UnaryFunction1DVec2f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVec2f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DVec2f___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVec2f___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVec2f___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction1DVec2f_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVec2f___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h new file mode 100644 index 00000000000..64a616e211a --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h @@ -0,0 +1,37 @@ +#ifndef FREESTYLE_PYTHON_UNARYFUNCTION1DVEC2F_H +#define FREESTYLE_PYTHON_UNARYFUNCTION1DVEC2F_H + +#include "../BPy_UnaryFunction1D.h" + +#include "../../geometry/Geom.h" +using namespace Geometry; + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject UnaryFunction1DVec2f_Type; + +#define BPy_UnaryFunction1DVec2f_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DVec2f_Type) ) + +/*---------------------------Python BPy_UnaryFunction1DVec2f structure definition----------*/ +typedef struct { + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D<Vec2f> *uf1D_vec2f; +} BPy_UnaryFunction1DVec2f; + +/*---------------------------Python BPy_UnaryFunction1DVec2f visible prototypes-----------*/ +int UnaryFunction1DVec2f_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_UNARYFUNCTION1DVEC2F_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp new file mode 100644 index 00000000000..6682dbb7904 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -0,0 +1,208 @@ +#include "BPy_UnaryFunction1DVec3f.h" + +#include "../BPy_Convert.h" +#include "../BPy_Interface1D.h" +#include "../BPy_IntegrationType.h" + +#include "UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//-------------------MODULE INITIALIZATION-------------------------------- + +int UnaryFunction1DVec3f_Init( PyObject *module ) { + + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1DVec3f_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1DVec3f_Type ); + PyModule_AddObject(module, "UnaryFunction1DVec3f", (PyObject *)&UnaryFunction1DVec3f_Type); + + if( PyType_Ready( &Orientation3DF1D_Type ) < 0 ) + return -1; + Py_INCREF( &Orientation3DF1D_Type ); + PyModule_AddObject(module, "Orientation3DF1D", (PyObject *)&Orientation3DF1D_Type); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1DVec3f___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface1D` and return a 3D vector.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(integration)\n" +"\n" +" Builds a unary 1D function using the integration method given as\n" +" argument.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + if( !obj ) + self->uf1D_vec3f = new UnaryFunction1D<Vec3f>(); + else { + self->uf1D_vec3f = new UnaryFunction1D<Vec3f>( IntegrationType_from_BPy_IntegrationType(obj) ); + } + + self->uf1D_vec3f->py_uf1D = (PyObject *)self; + + return 0; +} +void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self) +{ + if (self->uf1D_vec3f) + delete self->uf1D_vec3f; + UnaryFunction1D_Type.tp_dealloc((PyObject*)self); +} + + +PyObject * UnaryFunction1DVec3f___repr__(BPy_UnaryFunction1DVec3f* self) +{ + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec3f->getName().c_str(), self->uf1D_vec3f ); +} + +static char UnaryFunction1DVec3f_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 1D function.\n" +"\n" +" :return: The name of the unary 1D function.\n" +" :rtype: str\n"; + +PyObject * UnaryFunction1DVec3f_getName( BPy_UnaryFunction1DVec3f *self ) +{ + return PyUnicode_FromString( self->uf1D_vec3f->getName().c_str() ); +} + +PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } + if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + return NULL; + + if( typeid(*(self->uf1D_vec3f)) == typeid(UnaryFunction1D<Vec3f>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_vec3f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf1D_vec3f->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + return Vector_from_Vec3f( self->uf1D_vec3f->result ); + +} + +static char UnaryFunction1DVec3f_setIntegrationType___doc__[] = +".. method:: setIntegrationType(integration)\n" +"\n" +" Sets the integration method.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +PyObject * UnaryFunction1DVec3f_setIntegrationType(BPy_UnaryFunction1DVec3f* self, PyObject *args) +{ + PyObject *obj; + + if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) + return NULL; + + self->uf1D_vec3f->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); + Py_RETURN_NONE; +} + +static char UnaryFunction1DVec3f_getIntegrationType___doc__[] = +".. method:: getIntegrationType(integration)\n" +"\n" +" Returns the integration method.\n" +"\n" +" :return: The integration method.\n" +" :rtype: :class:`IntegrationType`\n"; + +PyObject * UnaryFunction1DVec3f_getIntegrationType(BPy_UnaryFunction1DVec3f* self) { + return BPy_IntegrationType_from_IntegrationType( self->uf1D_vec3f->getIntegrationType() ); +} + +/*----------------------UnaryFunction1DVec3f instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction1DVec3f_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction1DVec3f_getName, METH_NOARGS, UnaryFunction1DVec3f_getName___doc__}, + {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVec3f_setIntegrationType, METH_VARARGS, UnaryFunction1DVec3f_setIntegrationType___doc__}, + {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVec3f_getIntegrationType, METH_NOARGS, UnaryFunction1DVec3f_getIntegrationType___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction1DVec3f type definition ------------------------------*/ + +PyTypeObject UnaryFunction1DVec3f_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction1DVec3f", /* tp_name */ + sizeof(BPy_UnaryFunction1DVec3f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVec3f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DVec3f___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVec3f___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVec3f___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction1DVec3f_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVec3f___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h new file mode 100644 index 00000000000..7730271fc09 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h @@ -0,0 +1,37 @@ +#ifndef FREESTYLE_PYTHON_UNARYFUNCTION1DVEC3F_H +#define FREESTYLE_PYTHON_UNARYFUNCTION1DVEC3F_H + +#include "../BPy_UnaryFunction1D.h" + +#include "../../geometry/Geom.h" +using namespace Geometry; + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject UnaryFunction1DVec3f_Type; + +#define BPy_UnaryFunction1DVec3f_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DVec3f_Type) ) + +/*---------------------------Python BPy_UnaryFunction1DVec3f structure definition----------*/ +typedef struct { + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D<Vec3f> *uf1D_vec3f; +} BPy_UnaryFunction1DVec3f; + +/*---------------------------Python BPy_UnaryFunction1DVec3f visible prototypes-----------*/ +int UnaryFunction1DVec3f_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_UNARYFUNCTION1DVEC3F_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp new file mode 100644 index 00000000000..54827871861 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -0,0 +1,233 @@ +#include "BPy_UnaryFunction1DVectorViewShape.h" + +#include "../BPy_Convert.h" +#include "../BPy_Interface1D.h" +#include "../BPy_IntegrationType.h" + +#include "UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h" +#include "UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h" +#include "UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//-------------------MODULE INITIALIZATION-------------------------------- + +int UnaryFunction1DVectorViewShape_Init( PyObject *module ) { + + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1DVectorViewShape_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1DVectorViewShape_Type ); + PyModule_AddObject(module, "UnaryFunction1DVectorViewShape", (PyObject *)&UnaryFunction1DVectorViewShape_Type); + + if( PyType_Ready( &GetOccludeeF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetOccludeeF1D_Type ); + PyModule_AddObject(module, "GetOccludeeF1D", (PyObject *)&GetOccludeeF1D_Type); + + if( PyType_Ready( &GetOccludersF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetOccludersF1D_Type ); + PyModule_AddObject(module, "GetOccludersF1D", (PyObject *)&GetOccludersF1D_Type); + + if( PyType_Ready( &GetShapeF1D_Type ) < 0 ) + return -1; + Py_INCREF( &GetShapeF1D_Type ); + PyModule_AddObject(module, "GetShapeF1D", (PyObject *)&GetShapeF1D_Type); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1DVectorViewShape___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface1D` and return a list of :class:`ViewShape`\n" +"objects.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(integration)\n" +"\n" +" Builds a unary 1D function using the integration method given as\n" +" argument.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + if( !obj ) + self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >(); + else { + self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >( IntegrationType_from_BPy_IntegrationType(obj) ); + } + + self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self; + + return 0; +} + +static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVectorViewShape* self) +{ + if (self->uf1D_vectorviewshape) + delete self->uf1D_vectorviewshape; + UnaryFunction1D_Type.tp_dealloc((PyObject*)self); +} + +static PyObject * UnaryFunction1DVectorViewShape___repr__(BPy_UnaryFunction1DVectorViewShape* self) +{ + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vectorviewshape->getName().c_str(), self->uf1D_vectorviewshape ); +} + +static char UnaryFunction1DVectorViewShape_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 1D function.\n" +"\n" +" :return: The name of the unary 1D function.\n" +" :rtype: str\n"; + +static PyObject * UnaryFunction1DVectorViewShape_getName( BPy_UnaryFunction1DVectorViewShape *self ) +{ + return PyUnicode_FromString( self->uf1D_vectorviewshape->getName().c_str() ); +} + +static PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } + if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + return NULL; + + if( typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D< std::vector<ViewShape*> >) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_vectorviewshape->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf1D_vectorviewshape->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + PyObject *list = PyList_New(0); + PyObject *item; + for( unsigned int i = 0; i < self->uf1D_vectorviewshape->result.size(); i++) { + ViewShape *v = self->uf1D_vectorviewshape->result[i]; + if (v) { + item = BPy_ViewShape_from_ViewShape(*v); + } else { + item = Py_None; + Py_INCREF(item); + } + PyList_Append(list, item); + } + + return list; +} + +static char UnaryFunction1DVectorViewShape_setIntegrationType___doc__[] = +".. method:: setIntegrationType(integration)\n" +"\n" +" Sets the integration method.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DVectorViewShape_setIntegrationType(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args) +{ + PyObject *obj; + + if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) + return NULL; + + self->uf1D_vectorviewshape->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); + Py_RETURN_NONE; +} + +static char UnaryFunction1DVectorViewShape_getIntegrationType___doc__[] = +".. method:: getIntegrationType(integration)\n" +"\n" +" Returns the integration method.\n" +"\n" +" :return: The integration method.\n" +" :rtype: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DVectorViewShape_getIntegrationType(BPy_UnaryFunction1DVectorViewShape* self) { + return BPy_IntegrationType_from_IntegrationType( self->uf1D_vectorviewshape->getIntegrationType() ); +} + +/*----------------------UnaryFunction1DVectorViewShape instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction1DVectorViewShape_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction1DVectorViewShape_getName, METH_NOARGS, UnaryFunction1DVectorViewShape_getName___doc__}, + {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVectorViewShape_setIntegrationType, METH_VARARGS, UnaryFunction1DVectorViewShape_setIntegrationType___doc__}, + {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVectorViewShape_getIntegrationType, METH_NOARGS, UnaryFunction1DVectorViewShape_getIntegrationType___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction1DVectorViewShape type definition ------------------------------*/ + +PyTypeObject UnaryFunction1DVectorViewShape_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction1DVectorViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction1DVectorViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVectorViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DVectorViewShape___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVectorViewShape___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVectorViewShape___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction1DVectorViewShape_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVectorViewShape___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h new file mode 100644 index 00000000000..e2321a6107f --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h @@ -0,0 +1,37 @@ +#ifndef FREESTYLE_PYTHON_UNARYFUNCTION1DVECTORVIEWSHAPE_H +#define FREESTYLE_PYTHON_UNARYFUNCTION1DVECTORVIEWSHAPE_H + +#include "../BPy_UnaryFunction1D.h" + +#include <vector> +#include "../../view_map/ViewMap.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject UnaryFunction1DVectorViewShape_Type; + +#define BPy_UnaryFunction1DVectorViewShape_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DVectorViewShape_Type) ) + +/*---------------------------Python BPy_UnaryFunction1DVectorViewShape structure definition----------*/ +typedef struct { + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D< std::vector<ViewShape*> > *uf1D_vectorviewshape; +} BPy_UnaryFunction1DVectorViewShape; + +/*---------------------------Python BPy_UnaryFunction1DVectorViewShape visible prototypes-----------*/ +int UnaryFunction1DVectorViewShape_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_UNARYFUNCTION1DVECTORVIEWSHAPE_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp new file mode 100644 index 00000000000..8bfb5dde6eb --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -0,0 +1,220 @@ +#include "BPy_UnaryFunction1DVoid.h" + +#include "../BPy_Convert.h" +#include "../BPy_Interface1D.h" +#include "../BPy_IntegrationType.h" + +#include "UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h" +#include "UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h" +#include "UnaryFunction1D_void/BPy_TimeStampF1D.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//-------------------MODULE INITIALIZATION-------------------------------- + +int UnaryFunction1DVoid_Init( PyObject *module ) { + + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1DVoid_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1DVoid_Type ); + PyModule_AddObject(module, "UnaryFunction1DVoid", (PyObject *)&UnaryFunction1DVoid_Type); + + if( PyType_Ready( &ChainingTimeStampF1D_Type ) < 0 ) + return -1; + Py_INCREF( &ChainingTimeStampF1D_Type ); + PyModule_AddObject(module, "ChainingTimeStampF1D", (PyObject *)&ChainingTimeStampF1D_Type); + + if( PyType_Ready( &IncrementChainingTimeStampF1D_Type ) < 0 ) + return -1; + Py_INCREF( &IncrementChainingTimeStampF1D_Type ); + PyModule_AddObject(module, "IncrementChainingTimeStampF1D", (PyObject *)&IncrementChainingTimeStampF1D_Type); + + if( PyType_Ready( &TimeStampF1D_Type ) < 0 ) + return -1; + Py_INCREF( &TimeStampF1D_Type ); + PyModule_AddObject(module, "TimeStampF1D", (PyObject *)&TimeStampF1D_Type); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1DVoid___doc__[] = +"Base class for unary functions (functors) working on\n" +":class:`Interface1D`.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(integration)\n" +"\n" +" Builds a unary 1D function using the integration method given as\n" +" argument.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + if( !obj ) + self->uf1D_void = new UnaryFunction1D_void(); + else { + self->uf1D_void = new UnaryFunction1D_void( IntegrationType_from_BPy_IntegrationType(obj) ); + } + + self->uf1D_void->py_uf1D = (PyObject *)self; + + return 0; +} + +static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid* self) +{ + if (self->uf1D_void) + delete self->uf1D_void; + UnaryFunction1D_Type.tp_dealloc((PyObject*)self); +} + +static PyObject * UnaryFunction1DVoid___repr__(BPy_UnaryFunction1DVoid* self) +{ + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_void->getName().c_str(), self->uf1D_void ); +} + +static char UnaryFunction1DVoid_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 1D function.\n" +"\n" +" :return: The name of the unary 1D function.\n" +" :rtype: str\n"; + +static PyObject * UnaryFunction1DVoid_getName( BPy_UnaryFunction1DVoid *self ) +{ + return PyUnicode_FromString( self->uf1D_void->getName().c_str() ); +} + +static PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } + if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + return NULL; + + if( typeid(*(self->uf1D_void)) == typeid(UnaryFunction1D_void) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_void->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf1D_void->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + Py_RETURN_NONE; +} + +static char UnaryFunction1DVoid_setIntegrationType___doc__[] = +".. method:: setIntegrationType(integration)\n" +"\n" +" Sets the integration method.\n" +"\n" +" :arg integration: An integration method.\n" +" :type integration: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DVoid_setIntegrationType(BPy_UnaryFunction1DVoid* self, PyObject *args) +{ + PyObject *obj; + + if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) + return NULL; + + self->uf1D_void->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); + Py_RETURN_NONE; +} + +static char UnaryFunction1DVoid_getIntegrationType___doc__[] = +".. method:: getIntegrationType(integration)\n" +"\n" +" Returns the integration method.\n" +"\n" +" :return: The integration method.\n" +" :rtype: :class:`IntegrationType`\n"; + +static PyObject * UnaryFunction1DVoid_getIntegrationType(BPy_UnaryFunction1DVoid* self) { + return BPy_IntegrationType_from_IntegrationType( self->uf1D_void->getIntegrationType() ); +} + +/*----------------------UnaryFunction1DVoid instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction1DVoid_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction1DVoid_getName, METH_NOARGS, UnaryFunction1DVoid_getName___doc__}, + {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVoid_setIntegrationType, METH_VARARGS, UnaryFunction1DVoid_setIntegrationType___doc__}, + {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVoid_getIntegrationType, METH_NOARGS, UnaryFunction1DVoid_getIntegrationType___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction1DVoid type definition ------------------------------*/ + +PyTypeObject UnaryFunction1DVoid_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction1DVoid", /* tp_name */ + sizeof(BPy_UnaryFunction1DVoid), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVoid___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DVoid___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVoid___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVoid___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction1DVoid_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVoid___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h new file mode 100644 index 00000000000..af907aeec84 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_UNARYFUNCTION1DVOID_H +#define FREESTYLE_PYTHON_UNARYFUNCTION1DVOID_H + +#include "../BPy_UnaryFunction1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject UnaryFunction1DVoid_Type; + +#define BPy_UnaryFunction1DVoid_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DVoid_Type) ) + +/*---------------------------Python BPy_UnaryFunction1DVoid structure definition----------*/ +typedef struct { + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D_void *uf1D_void; +} BPy_UnaryFunction1DVoid; + +/*---------------------------Python BPy_UnaryFunction1DVoid visible prototypes-----------*/ +int UnaryFunction1DVoid_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_UNARYFUNCTION1DVOID_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp new file mode 100644 index 00000000000..3ee5daec439 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp @@ -0,0 +1,97 @@ +#include "BPy_CurveNatureF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char CurveNatureF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds a CurveNatureF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the nature of the Interface1D (silhouette, ridge, crease,\n" +" and so on). Except if the Interface1D is a :class:`ViewEdge`, this\n" +" result might be ambiguous. Indeed, the Interface1D might result\n" +" from the gathering of several 1D elements, each one being of a\n" +" different nature. An integration method, such as the MEAN, might\n" +" give, in this case, irrelevant results.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The nature of the Interface1D.\n" +" :rtype: :class:`Nature`\n"; + +static int CurveNatureF1D___init__( BPy_CurveNatureF1D* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_edgenature.uf1D_edgenature = new Functions1D::CurveNatureF1D(t); + return 0; +} + +/*-----------------------BPy_CurveNatureF1D type definition ------------------------------*/ + +PyTypeObject CurveNatureF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "CurveNatureF1D", /* tp_name */ + sizeof(BPy_CurveNatureF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurveNatureF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DEdgeNature_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurveNatureF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h new file mode 100644 index 00000000000..852f8937954 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_CURVENATUREF1D_H +#define FREESTYLE_PYTHON_CURVENATUREF1D_H + +#include "../BPy_UnaryFunction1DEdgeNature.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject CurveNatureF1D_Type; + +#define BPy_CurveNatureF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &CurveNatureF1D_Type) ) + +/*---------------------------Python BPy_CurveNatureF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DEdgeNature py_uf1D_edgenature; +} BPy_CurveNatureF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_CURVENATUREF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp new file mode 100644 index 00000000000..f5ae4e885de --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp @@ -0,0 +1,92 @@ +#include "BPy_Normal2DF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char Normal2DF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds a Normal2DF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the 2D normal for the Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The 2D normal for the Interface1D.\n" +" :rtype: :class:`mathutils.Vector`\n"; + +static int Normal2DF1D___init__( BPy_Normal2DF1D* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_vec2f.uf1D_vec2f = new Functions1D::Normal2DF1D(t); + return 0; +} + +/*-----------------------BPy_Normal2DF1D type definition ------------------------------*/ + +PyTypeObject Normal2DF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Normal2DF1D", /* tp_name */ + sizeof(BPy_Normal2DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Normal2DF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVec2f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Normal2DF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h new file mode 100644 index 00000000000..32078558d0c --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_NORMAL2DF1D_H +#define FREESTYLE_PYTHON_NORMAL2DF1D_H + +#include "../BPy_UnaryFunction1DVec2f.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject Normal2DF1D_Type; + +#define BPy_Normal2DF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Normal2DF1D_Type) ) + +/*---------------------------Python BPy_Normal2DF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVec2f py_uf1D_vec2f; +} BPy_Normal2DF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_NORMAL2DF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp new file mode 100644 index 00000000000..c83ea650cb2 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp @@ -0,0 +1,94 @@ +#include "BPy_Orientation2DF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char Orientation2DF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds an Orientation2DF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the 2D orientation of the Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The 2D orientation of the Interface1D.\n" +" :rtype: :class:`mathutils.Vector`\n"; + +static int Orientation2DF1D___init__( BPy_Orientation2DF1D* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_vec2f.uf1D_vec2f = new Functions1D::Orientation2DF1D(t); + return 0; + +} + + +/*-----------------------BPy_Orientation2DF1D type definition ------------------------------*/ + +PyTypeObject Orientation2DF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Orientation2DF1D", /* tp_name */ + sizeof(BPy_Orientation2DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Orientation2DF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVec2f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Orientation2DF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h new file mode 100644 index 00000000000..189ab04db4f --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_ORIENTATION2DF1D_H +#define FREESTYLE_PYTHON_ORIENTATION2DF1D_H + +#include "../BPy_UnaryFunction1DVec2f.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject Orientation2DF1D_Type; + +#define BPy_Orientation2DF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Orientation2DF1D_Type) ) + +/*---------------------------Python BPy_Orientation2DF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVec2f py_uf1D_vec2f; +} BPy_Orientation2DF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_ORIENTATION2DF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp new file mode 100644 index 00000000000..41339111906 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp @@ -0,0 +1,92 @@ +#include "BPy_Orientation3DF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char Orientation3DF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds an Orientation3DF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the 3D orientation of the Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The 3D orientation of the Interface1D.\n" +" :rtype: :class:`mathutils.Vector`\n"; + +static int Orientation3DF1D___init__( BPy_Orientation3DF1D* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_vec3f.uf1D_vec3f = new Functions1D::Orientation3DF1D(t); + return 0; +} + +/*-----------------------BPy_Orientation3DF1D type definition ------------------------------*/ + +PyTypeObject Orientation3DF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Orientation3DF1D", /* tp_name */ + sizeof(BPy_Orientation3DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Orientation3DF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVec3f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Orientation3DF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h new file mode 100644 index 00000000000..b69baf106f4 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_ORIENTATION3DF1D_H +#define FREESTYLE_PYTHON_ORIENTATION3DF1D_H + +#include "../BPy_UnaryFunction1DVec3f.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject Orientation3DF1D_Type; + +#define BPy_Orientation3DF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Orientation3DF1D_Type) ) + +/*---------------------------Python BPy_Orientation3DF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVec3f py_uf1D_vec3f; +} BPy_Orientation3DF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_ORIENTATION3DF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp new file mode 100644 index 00000000000..da80aaa0b6e --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp @@ -0,0 +1,92 @@ +#include "BPy_Curvature2DAngleF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char Curvature2DAngleF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds a Curvature2DAngleF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the 2D curvature as an angle for an Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The 2D curvature as an angle.\n" +" :rtype: float\n"; + +static int Curvature2DAngleF1D___init__( BPy_Curvature2DAngleF1D* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::Curvature2DAngleF1D(t); + return 0; + +} +/*-----------------------BPy_Curvature2DAngleF1D type definition ------------------------------*/ + +PyTypeObject Curvature2DAngleF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Curvature2DAngleF1D", /* tp_name */ + sizeof(BPy_Curvature2DAngleF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Curvature2DAngleF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Curvature2DAngleF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h new file mode 100644 index 00000000000..1603a7dc4ea --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_CURVATURE2DANGLEF1D_H +#define FREESTYLE_PYTHON_CURVATURE2DANGLEF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject Curvature2DAngleF1D_Type; + +#define BPy_Curvature2DAngleF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Curvature2DAngleF1D_Type) ) + +/*---------------------------Python BPy_Curvature2DAngleF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_Curvature2DAngleF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_CURVATURE2DANGLEF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp new file mode 100644 index 00000000000..7035375a3f6 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp @@ -0,0 +1,107 @@ +#include "BPy_DensityF1D.h" + +#include "../../../stroke/AdvancedFunctions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char DensityF1D___doc__[] = +".. method:: __init__(sigma=2.0, iType=IntegrationType.MEAN, sampling=2.0)\n" +"\n" +" Builds a DensityF1D object.\n" +"\n" +" :arg sigma: The sigma used in DensityF0D and determining the window size\n" +" used in each density query.\n" +" :type sigma: float\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +" :arg sampling: The resolution used to sample the chain: the\n" +" corresponding 0D function is evaluated at each sample point and\n" +" the result is obtained by combining the resulting values into a\n" +" single one, following the method specified by iType.\n" +" :type sampling: float\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the density evaluated for an Interface1D. The density is\n" +" evaluated for a set of points along the Interface1D (using the\n" +" :class:`DensityF0D` functor) with a user-defined sampling and then\n" +" integrated into a single value using a user-defined integration\n" +" method.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The density evaluated for an Interface1D.\n" +" :rtype: float\n"; + +static int DensityF1D___init__( BPy_DensityF1D* self, PyObject *args) +{ + PyObject *obj = 0; + double d = 2.0; + float f = 2.0; + + if( !PyArg_ParseTuple(args, "|dO!f", &d, &IntegrationType_Type, &obj, &f) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::DensityF1D(d,t,f); + return 0; + +} + +/*-----------------------BPy_DensityF1D type definition ------------------------------*/ + +PyTypeObject DensityF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "DensityF1D", /* tp_name */ + sizeof(BPy_DensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + DensityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)DensityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h new file mode 100644 index 00000000000..36426536b36 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_DENSITYF1D_H +#define FREESTYLE_PYTHON_DENSITYF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject DensityF1D_Type; + +#define BPy_DensityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &DensityF1D_Type) ) + +/*---------------------------Python BPy_DensityF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_DensityF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_DENSITYF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp new file mode 100644 index 00000000000..5343d9e3236 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp @@ -0,0 +1,108 @@ +#include "BPy_GetCompleteViewMapDensityF1D.h" + +#include "../../../stroke/AdvancedFunctions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetCompleteViewMapDensityF1D___doc__[] = +".. method:: __init__(level, iType=IntegrationType.MEAN, sampling=2.0)\n" +"\n" +" Builds a GetCompleteViewMapDensityF1D object.\n" +"\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +" :arg sampling: The resolution used to sample the chain: the\n" +" corresponding 0D function is evaluated at each sample point and\n" +" the result is obtained by combining the resulting values into a\n" +" single one, following the method specified by iType.\n" +" :type sampling: float\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the density evaluated for an Interface1D in the complete\n" +" viewmap image. The density is evaluated for a set of points along\n" +" the Interface1D (using the :class:`ReadCompleteViewMapPixelF0D`\n" +" functor) and then integrated into a single value using a\n" +" user-defined integration method.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The density evaluated for the Interface1D in the complete\n" +" viewmap image.\n" +" :rtype: float\n"; + +static int GetCompleteViewMapDensityF1D___init__( BPy_GetCompleteViewMapDensityF1D* self, PyObject *args) +{ + PyObject *obj = 0; + unsigned i; + float f = 2.0; + + if( !PyArg_ParseTuple(args, "i|O!f", &i, &IntegrationType_Type, &obj, &f) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetCompleteViewMapDensityF1D(i,t,f); + return 0; + +} + +/*-----------------------BPy_GetCompleteViewMapDensityF1D type definition ------------------------------*/ + +PyTypeObject GetCompleteViewMapDensityF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetCompleteViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetCompleteViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetCompleteViewMapDensityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetCompleteViewMapDensityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h new file mode 100644 index 00000000000..5963b820348 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETCOMPLETEVIEWMAPDENSITYF1D_H +#define FREESTYLE_PYTHON_GETCOMPLETEVIEWMAPDENSITYF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetCompleteViewMapDensityF1D_Type; + +#define BPy_GetCompleteViewMapDensityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetCompleteViewMapDensityF1D_Type) ) + +/*---------------------------Python BPy_GetCompleteViewMapDensityF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetCompleteViewMapDensityF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETCOMPLETEVIEWMAPDENSITYF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp new file mode 100644 index 00000000000..5f543c30027 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -0,0 +1,112 @@ +#include "BPy_GetDirectionalViewMapDensityF1D.h" + +#include "../../../stroke/AdvancedFunctions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetDirectionalViewMapDensityF1D___doc__[] = +".. method:: __init__(iOrientation, level, iType=IntegrationType.MEAN, sampling=2.0)\n" +"\n" +" Builds a GetDirectionalViewMapDensityF1D object.\n" +"\n" +" :arg iOrientation: The number of the directional map we must work\n" +" with.\n" +" :type iOrientation: int\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +" :arg sampling: The resolution used to sample the chain: the\n" +" corresponding 0D function is evaluated at each sample point and\n" +" the result is obtained by combining the resulting values into a\n" +" single one, following the method specified by iType.\n" +" :type sampling: float\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the density evaluated for an Interface1D in of the\n" +" steerable viewmaps image. The direction telling which Directional\n" +" map to choose is explicitely specified by the user. The density is\n" +" evaluated for a set of points along the Interface1D (using the\n" +" :class:`ReadSteerableViewMapPixelF0D` functor) and then integrated\n" +" into a single value using a user-defined integration method.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: the density evaluated for an Interface1D in of the\n" +" steerable viewmaps image.\n" +" :rtype: float\n"; + +static int GetDirectionalViewMapDensityF1D___init__( BPy_GetDirectionalViewMapDensityF1D* self, PyObject *args) +{ + PyObject *obj = 0; + unsigned int u1, u2; + float f = 2.0; + + if( !PyArg_ParseTuple(args, "II|O!f", &u1, &u2, &IntegrationType_Type, &obj, &f) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetDirectionalViewMapDensityF1D(u1, u2, t, f); + return 0; + +} + +/*-----------------------BPy_GetDirectionalViewMapDensityF1D type definition ------------------------------*/ + +PyTypeObject GetDirectionalViewMapDensityF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetDirectionalViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetDirectionalViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetDirectionalViewMapDensityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetDirectionalViewMapDensityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h new file mode 100644 index 00000000000..0e2d7ec2718 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETDIRECTIONALVIEWMAPDENSITYF1D_H +#define FREESTYLE_PYTHON_GETDIRECTIONALVIEWMAPDENSITYF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetDirectionalViewMapDensityF1D_Type; + +#define BPy_GetDirectionalViewMapDensityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetDirectionalViewMapDensityF1D_Type) ) + +/*---------------------------Python BPy_GetDirectionalViewMapDensityF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetDirectionalViewMapDensityF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETDIRECTIONALVIEWMAPDENSITYF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp new file mode 100644 index 00000000000..3c8fa2f1f0f --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp @@ -0,0 +1,93 @@ +#include "BPy_GetProjectedXF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetProjectedXF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds a GetProjectedXF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values. \n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the projected X 3D coordinate of an Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The projected X 3D coordinate of an Interface1D.\n" +" :rtype: float\n"; + +static int GetProjectedXF1D___init__( BPy_GetProjectedXF1D* self, PyObject *args ) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedXF1D(t); + return 0; +} + + +/*-----------------------BPy_GetProjectedXF1D type definition ------------------------------*/ + +PyTypeObject GetProjectedXF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetProjectedXF1D", /* tp_name */ + sizeof(BPy_GetProjectedXF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedXF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedXF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h new file mode 100644 index 00000000000..d799fb7b334 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETPROJECTEDXF1D_H +#define FREESTYLE_PYTHON_GETPROJECTEDXF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetProjectedXF1D_Type; + +#define BPy_GetProjectedXF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedXF1D_Type) ) + +/*---------------------------Python BPy_GetProjectedXF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetProjectedXF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETPROJECTEDXF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp new file mode 100644 index 00000000000..ce655172778 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp @@ -0,0 +1,92 @@ +#include "BPy_GetProjectedYF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetProjectedYF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds a GetProjectedYF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values. \n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the projected Y 3D coordinate of an Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The projected Y 3D coordinate of an Interface1D.\n" +" :rtype: float\n"; + +static int GetProjectedYF1D___init__( BPy_GetProjectedYF1D* self, PyObject *args ) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedYF1D(t); + return 0; +} + +/*-----------------------BPy_GetProjectedYF1D type definition ------------------------------*/ + +PyTypeObject GetProjectedYF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetProjectedYF1D", /* tp_name */ + sizeof(BPy_GetProjectedYF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedYF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedYF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h new file mode 100644 index 00000000000..1b7fe6c6b5f --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETPROJECTEDYF1D_H +#define FREESTYLE_PYTHON_GETPROJECTEDYF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetProjectedYF1D_Type; + +#define BPy_GetProjectedYF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedYF1D_Type) ) + +/*---------------------------Python BPy_GetProjectedYF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetProjectedYF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETPROJECTEDYF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp new file mode 100644 index 00000000000..df1cefeab4c --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp @@ -0,0 +1,92 @@ +#include "BPy_GetProjectedZF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetProjectedZF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds a GetProjectedZF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values. \n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the projected Z 3D coordinate of an Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The projected Z 3D coordinate of an Interface1D.\n" +" :rtype: float\n"; + +static int GetProjectedZF1D___init__( BPy_GetProjectedZF1D* self, PyObject *args ) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedZF1D(t); + return 0; +} + +/*-----------------------BPy_GetProjectedZF1D type definition ------------------------------*/ + +PyTypeObject GetProjectedZF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetProjectedZF1D", /* tp_name */ + sizeof(BPy_GetProjectedZF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedZF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedZF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h new file mode 100644 index 00000000000..a87ac6f8c5e --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETPROJECTEDZF1D_H +#define FREESTYLE_PYTHON_GETPROJECTEDZF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetProjectedZF1D_Type; + +#define BPy_GetProjectedZF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedZF1D_Type) ) + +/*---------------------------Python BPy_GetProjectedZF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetProjectedZF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETPROJECTEDZF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp new file mode 100644 index 00000000000..7cd08a2da0b --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp @@ -0,0 +1,105 @@ +#include "BPy_GetSteerableViewMapDensityF1D.h" + +#include "../../../stroke/AdvancedFunctions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetSteerableViewMapDensityF1D___doc__[] = +".. method:: __init__(level, iType=IntegrationType.MEAN, sampling=2.0)\n" +"\n" +" Builds a GetSteerableViewMapDensityF1D object.\n" +"\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +" :arg sampling: The resolution used to sample the chain: the\n" +" corresponding 0D function is evaluated at each sample point and\n" +" the result is obtained by combining the resulting values into a\n" +" single one, following the method specified by iType.\n" +" :type sampling: float\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the density of the ViewMap for a given Interface1D. The\n" +" density of each :class:`FEdge` is evaluated in the proper steerable\n" +" :class:`ViewMap` depending on its orientation.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The density of the ViewMap for a given Interface1D.\n" +" :rtype: float\n"; + +static int GetSteerableViewMapDensityF1D___init__( BPy_GetSteerableViewMapDensityF1D* self, PyObject *args) +{ + PyObject *obj = 0; + int i; + float f = 2.0; + + if( !PyArg_ParseTuple(args, "i|O!f", &i, &IntegrationType_Type, &obj, &f) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetSteerableViewMapDensityF1D(i,t,f); + return 0; + +} + +/*-----------------------BPy_GetSteerableViewMapDensityF1D type definition ------------------------------*/ + +PyTypeObject GetSteerableViewMapDensityF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetSteerableViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetSteerableViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetSteerableViewMapDensityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetSteerableViewMapDensityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h new file mode 100644 index 00000000000..29880c7e9a7 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h @@ -0,0 +1,29 @@ +#ifndef FREESTYLE_PYTHON_GETSTEERABLEVIEWMAPDENSITYF1D_H +#define FREESTYLE_PYTHON_GETSTEERABLEVIEWMAPDENSITYF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetSteerableViewMapDensityF1D_Type; + +#define BPy_GetSteerableViewMapDensityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetSteerableViewMapDensityF1D_Type) ) +/*---------------------------Python BPy_GetSteerableViewMapDensityF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetSteerableViewMapDensityF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETSTEERABLEVIEWMAPDENSITYF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp new file mode 100644 index 00000000000..b34d56b37d3 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp @@ -0,0 +1,105 @@ +#include "BPy_GetViewMapGradientNormF1D.h" + +#include "../../../stroke/AdvancedFunctions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetViewMapGradientNormF1D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetViewMapGradientNormF1D object.\n" +"\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +" :arg sampling: The resolution used to sample the chain: the\n" +" corresponding 0D function is evaluated at each sample point and\n" +" the result is obtained by combining the resulting values into a\n" +" single one, following the method specified by iType.\n" +" :type sampling: float\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the density of the ViewMap for a given Interface1D. The\n" +" density of each :class:`FEdge` is evaluated in the proper steerable\n" +" :class:`ViewMap` depending on its orientation.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The density of the ViewMap for a given Interface1D.\n" +" :rtype: float\n"; + +static int GetViewMapGradientNormF1D___init__( BPy_GetViewMapGradientNormF1D* self, PyObject *args) +{ + PyObject *obj = 0; + int i; + float f = 2.0; + + if( !PyArg_ParseTuple(args, "i|O!f", &i, &IntegrationType_Type, &obj, &f) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetViewMapGradientNormF1D(i,t,f); + return 0; + +} + +/*-----------------------BPy_GetViewMapGradientNormF1D type definition ------------------------------*/ + +PyTypeObject GetViewMapGradientNormF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetViewMapGradientNormF1D", /* tp_name */ + sizeof(BPy_GetViewMapGradientNormF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetViewMapGradientNormF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetViewMapGradientNormF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h new file mode 100644 index 00000000000..4f07629870f --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF1D_H +#define FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetViewMapGradientNormF1D_Type; + +#define BPy_GetViewMapGradientNormF1D_Check(v) ( ((PyObject *) v)->ob_type == PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetViewMapGradientNormF1D_Type) ) + +/*---------------------------Python BPy_GetViewMapGradientNormF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetViewMapGradientNormF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp new file mode 100644 index 00000000000..6bbf15c0af2 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp @@ -0,0 +1,93 @@ +#include "BPy_GetXF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetXF1D___doc__[] = +".. method:: __init__(iType)\n" +"\n" +" Builds a GetXF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the X 3D coordinate of an Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The X 3D coordinate of the Interface1D.\n" +" :rtype: float\n"; + +static int GetXF1D___init__( BPy_GetXF1D* self, PyObject *args ) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetXF1D(t); + return 0; +} + + +/*-----------------------BPy_GetXF1D type definition ------------------------------*/ + +PyTypeObject GetXF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetXF1D", /* tp_name */ + sizeof(BPy_GetXF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetXF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetXF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h new file mode 100644 index 00000000000..5eae107daae --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETXF1D_H +#define FREESTYLE_PYTHON_GETXF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetXF1D_Type; + +#define BPy_GetXF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetXF1D_Type) ) + +/*---------------------------Python BPy_GetXF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetXF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETXF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp new file mode 100644 index 00000000000..7275ea3dcf2 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp @@ -0,0 +1,91 @@ +#include "BPy_GetYF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetYF1D___doc__[] = +".. method:: __init__(iType)\n" +"\n" +" Builds a GetYF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the Y 3D coordinate of an Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The Y 3D coordinate of the Interface1D.\n" +" :rtype: float\n"; + +static int GetYF1D___init__( BPy_GetYF1D* self, PyObject *args ) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetYF1D(t); + return 0; +} +/*-----------------------BPy_GetYF1D type definition ------------------------------*/ + +PyTypeObject GetYF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetYF1D", /* tp_name */ + sizeof(BPy_GetYF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetYF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetYF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h new file mode 100644 index 00000000000..5864c245776 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETYF1D_H +#define FREESTYLE_PYTHON_GETYF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetYF1D_Type; + +#define BPy_GetYF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetYF1D_Type) ) + +/*---------------------------Python BPy_GetYF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetYF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETYF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp new file mode 100644 index 00000000000..68f4f5e4300 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp @@ -0,0 +1,92 @@ +#include "BPy_GetZF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetZF1D___doc__[] = +".. method:: __init__(iType)\n" +"\n" +" Builds a GetZF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the Z 3D coordinate of an Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The Z 3D coordinate of the Interface1D.\n" +" :rtype: float\n"; + +static int GetZF1D___init__( BPy_GetZF1D* self, PyObject *args ) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::GetZF1D(t); + return 0; +} + +/*-----------------------BPy_GetZF1D type definition ------------------------------*/ + +PyTypeObject GetZF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetZF1D", /* tp_name */ + sizeof(BPy_GetZF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetZF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetZF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h new file mode 100644 index 00000000000..4b91a567eef --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETZF1D_H +#define FREESTYLE_PYTHON_GETZF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetZF1D_Type; + +#define BPy_GetZF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetZF1D_Type) ) + +/*---------------------------Python BPy_GetZF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_GetZF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETZF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp new file mode 100644 index 00000000000..be262632466 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp @@ -0,0 +1,99 @@ +#include "BPy_LocalAverageDepthF1D.h" + +#include "../../../stroke/AdvancedFunctions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char LocalAverageDepthF1D___doc__[] = +".. method:: __init__(sigma, iType=IntegrationType.MEAN)\n" +"\n" +" Builds a LocalAverageDepthF1D object.\n" +"\n" +" :arg sigma: The sigma used in DensityF0D and determining the window\n" +" size used in each density query.\n" +" :type sigma: float\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the average depth evaluated for an Interface1D. The\n" +" average depth is evaluated for a set of points along the\n" +" Interface1D (using the :class:`LocalAverageDepthF0D` functor) with\n" +" a user-defined sampling and then integrated into a single value\n" +" using a user-defined integration method.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The average depth evaluated for the Interface1D.\n" +" :rtype: float\n"; + +static int LocalAverageDepthF1D___init__( BPy_LocalAverageDepthF1D* self, PyObject *args) +{ + PyObject *obj = 0; + double d; + + if( !PyArg_ParseTuple(args, "d|O!", &d, &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::LocalAverageDepthF1D(d,t); + return 0; +} +/*-----------------------BPy_LocalAverageDepthF1D type definition ------------------------------*/ + +PyTypeObject LocalAverageDepthF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "LocalAverageDepthF1D", /* tp_name */ + sizeof(BPy_LocalAverageDepthF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + LocalAverageDepthF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)LocalAverageDepthF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h new file mode 100644 index 00000000000..627d10b6414 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF1D_H +#define FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject LocalAverageDepthF1D_Type; + +#define BPy_LocalAverageDepthF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &LocalAverageDepthF1D_Type) ) + +/*---------------------------Python BPy_LocalAverageDepthF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_LocalAverageDepthF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp new file mode 100644 index 00000000000..0640644ea1e --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp @@ -0,0 +1,97 @@ +#include "BPy_ZDiscontinuityF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char ZDiscontinuityF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds a ZDiscontinuityF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns a real value giving the distance between an Interface1D\n" +" and the shape that lies behind (occludee). This distance is\n" +" evaluated in the camera space and normalized between 0 and 1.\n" +" Therefore, if no oject is occluded by the shape to which the\n" +" Interface1D belongs to, 1 is returned.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The normalized distance between the Interface1D and the occludee.\n" +" :rtype: float\n"; + +static int ZDiscontinuityF1D___init__( BPy_ZDiscontinuityF1D* self, PyObject *args ) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_double.uf1D_double = new Functions1D::ZDiscontinuityF1D(t); + return 0; +} + + +/*-----------------------BPy_ZDiscontinuityF1D type definition ------------------------------*/ + +PyTypeObject ZDiscontinuityF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ZDiscontinuityF1D", /* tp_name */ + sizeof(BPy_ZDiscontinuityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ZDiscontinuityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ZDiscontinuityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h new file mode 100644 index 00000000000..e6b4be556d7 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_ZDISCONTINUITYF1D_H +#define FREESTYLE_PYTHON_ZDISCONTINUITYF1D_H + +#include "../BPy_UnaryFunction1DDouble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ZDiscontinuityF1D_Type; + +#define BPy_ZDiscontinuityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ZDiscontinuityF1D_Type) ) + +/*---------------------------Python BPy_ZDiscontinuityF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DDouble py_uf1D_double; +} BPy_ZDiscontinuityF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_ZDISCONTINUITYF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp new file mode 100644 index 00000000000..4ffa3437c69 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp @@ -0,0 +1,97 @@ +#include "BPy_QuantitativeInvisibilityF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char QuantitativeInvisibilityF1D___doc__[] = +".. method:: __init__(iType=IntegrationType.MEAN)\n" +"\n" +" Builds a QuantitativeInvisibilityF1D object.\n" +"\n" +" :arg iType: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type iType: :class:`IntegrationType`\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the Quantitative Invisibility of an Interface1D element.\n" +" If the Interface1D is a :class:`ViewEdge`, then there is no\n" +" ambiguity concerning the result. But, if the Interface1D results\n" +" of a chaining (chain, stroke), then it might be made of several 1D\n" +" elements of different Quantitative Invisibilities.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: The Quantitative Invisibility of the Interface1D.\n" +" :rtype: int\n"; + +static int QuantitativeInvisibilityF1D___init__( BPy_QuantitativeInvisibilityF1D* self, PyObject *args) +{ + PyObject *obj = 0; + + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + return -1; + + IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_uf1D_unsigned.uf1D_unsigned = new Functions1D::QuantitativeInvisibilityF1D(t); + return 0; + +} + +/*-----------------------BPy_QuantitativeInvisibilityF1D type definition ------------------------------*/ + +PyTypeObject QuantitativeInvisibilityF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "QuantitativeInvisibilityF1D", /* tp_name */ + sizeof(BPy_QuantitativeInvisibilityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + QuantitativeInvisibilityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DUnsigned_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)QuantitativeInvisibilityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h new file mode 100644 index 00000000000..5bcf5fcc0a2 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF1D_H +#define FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF1D_H + +#include "../BPy_UnaryFunction1DUnsigned.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject QuantitativeInvisibilityF1D_Type; + +#define BPy_QuantitativeInvisibilityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &QuantitativeInvisibilityF1D_Type) ) + +/*---------------------------Python BPy_QuantitativeInvisibilityF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DUnsigned py_uf1D_unsigned; +} BPy_QuantitativeInvisibilityF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp new file mode 100644 index 00000000000..a4f49922e01 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp @@ -0,0 +1,84 @@ +#include "BPy_GetOccludeeF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetOccludeeF1D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetOccludeeF1D object.\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns a list of occluded shapes covered by this Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: A list of occluded shapes covered by the Interface1D.\n" +" :rtype: list of :class:`ViewShape` objects\n"; + +static int GetOccludeeF1D___init__( BPy_GetOccludeeF1D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludeeF1D(); + return 0; +} + +/*-----------------------BPy_GetOccludeeF1D type definition ------------------------------*/ + +PyTypeObject GetOccludeeF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetOccludeeF1D", /* tp_name */ + sizeof(BPy_GetOccludeeF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludeeF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludeeF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h new file mode 100644 index 00000000000..c8d5e99a6a7 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETOCCLUDEEF1D_H +#define FREESTYLE_PYTHON_GETOCCLUDEEF1D_H + +#include "../BPy_UnaryFunction1DVectorViewShape.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetOccludeeF1D_Type; + +#define BPy_GetOccludeeF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetOccludeeF1D_Type) ) + +/*---------------------------Python BPy_GetOccludeeF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; +} BPy_GetOccludeeF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETOCCLUDEEF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp new file mode 100644 index 00000000000..f4030b5b25e --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp @@ -0,0 +1,84 @@ +#include "BPy_GetOccludersF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetOccludersF1D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetOccludersF1D object.\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns a list of occluding shapes that cover this Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: A list of occluding shapes that cover the Interface1D.\n" +" :rtype: list of :class:`ViewShape` objects\n"; + +static int GetOccludersF1D___init__( BPy_GetOccludersF1D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludersF1D(); + return 0; +} + +/*-----------------------BPy_GetOccludersF1D type definition ------------------------------*/ + +PyTypeObject GetOccludersF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetOccludersF1D", /* tp_name */ + sizeof(BPy_GetOccludersF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludersF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludersF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h new file mode 100644 index 00000000000..ad39ad25c3d --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETOCCLUDERSF1D_H +#define FREESTYLE_PYTHON_GETOCCLUDERSF1D_H + +#include "../BPy_UnaryFunction1DVectorViewShape.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetOccludersF1D_Type; + +#define BPy_GetOccludersF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetOccludersF1D_Type) ) + +/*---------------------------Python BPy_GetOccludersF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; +} BPy_GetOccludersF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETOCCLUDERSF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp new file mode 100644 index 00000000000..017dbc3436d --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp @@ -0,0 +1,84 @@ +#include "BPy_GetShapeF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetShapeF1D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetShapeF1D object.\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns a list of shapes covered by this Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: A list of shapes covered by the Interface1D.\n" +" :rtype: list of :class:`ViewShape` objects\n"; + +static int GetShapeF1D___init__( BPy_GetShapeF1D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetShapeF1D(); + return 0; +} + +/*-----------------------BPy_GetShapeF1D type definition ------------------------------*/ + +PyTypeObject GetShapeF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GetShapeF1D", /* tp_name */ + sizeof(BPy_GetShapeF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetShapeF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetShapeF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h new file mode 100644 index 00000000000..39d1268c03f --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_GETSHAPEF1D_H +#define FREESTYLE_PYTHON_GETSHAPEF1D_H + +#include "../BPy_UnaryFunction1DVectorViewShape.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GetShapeF1D_Type; + +#define BPy_GetShapeF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetShapeF1D_Type) ) + +/*---------------------------Python BPy_GetShapeF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; +} BPy_GetShapeF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_GETSHAPEF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp new file mode 100644 index 00000000000..848e0c92843 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp @@ -0,0 +1,82 @@ +#include "BPy_ChainingTimeStampF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char ChainingTimeStampF1D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a ChainingTimeStampF1D object.\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Sets the chaining time stamp of the Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n"; + +static int ChainingTimeStampF1D___init__( BPy_ChainingTimeStampF1D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf1D_void.uf1D_void = new Functions1D::ChainingTimeStampF1D(); + return 0; +} + +/*-----------------------BPy_ChainingTimeStampF1D type definition ------------------------------*/ + +PyTypeObject ChainingTimeStampF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ChainingTimeStampF1D", /* tp_name */ + sizeof(BPy_ChainingTimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainingTimeStampF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainingTimeStampF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h new file mode 100644 index 00000000000..6855ddaf14b --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H +#define FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H + +#include "../BPy_UnaryFunction1DVoid.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ChainingTimeStampF1D_Type; + +#define BPy_ChainingTimeStampF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ChainingTimeStampF1D_Type) ) + +/*---------------------------Python BPy_ChainingTimeStampF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVoid py_uf1D_void; +} BPy_ChainingTimeStampF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp new file mode 100644 index 00000000000..c1bcaacffb7 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp @@ -0,0 +1,82 @@ +#include "BPy_IncrementChainingTimeStampF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char IncrementChainingTimeStampF1D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds an IncrementChainingTimeStampF1D object.\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Increments the chaining time stamp of the Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n"; + +static int IncrementChainingTimeStampF1D___init__( BPy_IncrementChainingTimeStampF1D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf1D_void.uf1D_void = new Functions1D::IncrementChainingTimeStampF1D(); + return 0; +} + +/*-----------------------BPy_IncrementChainingTimeStampF1D type definition ------------------------------*/ + +PyTypeObject IncrementChainingTimeStampF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "IncrementChainingTimeStampF1D", /* tp_name */ + sizeof(BPy_IncrementChainingTimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncrementChainingTimeStampF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncrementChainingTimeStampF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h new file mode 100644 index 00000000000..a1d5714ab63 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_INCREMENTCHAININGTIMESTAMPF1D_H +#define FREESTYLE_PYTHON_INCREMENTCHAININGTIMESTAMPF1D_H + +#include "../BPy_UnaryFunction1DVoid.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject IncrementChainingTimeStampF1D_Type; + +#define BPy_IncrementChainingTimeStampF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &IncrementChainingTimeStampF1D_Type) ) + +/*---------------------------Python BPy_IncrementChainingTimeStampF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVoid py_uf1D_void; +} BPy_IncrementChainingTimeStampF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_INCREMENTCHAININGTIMESTAMPF1D_H */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp new file mode 100644 index 00000000000..e9a7f2095bb --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp @@ -0,0 +1,82 @@ +#include "BPy_TimeStampF1D.h" + +#include "../../../view_map/Functions1D.h" +#include "../../BPy_Convert.h" +#include "../../BPy_IntegrationType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------INSTANCE METHODS ---------------------------------- + +static char TimeStampF1D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a TimeStampF1D object.\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns the time stamp of the Interface1D.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n"; + +static int TimeStampF1D___init__( BPy_TimeStampF1D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf1D_void.uf1D_void = new Functions1D::TimeStampF1D(); + return 0; +} + +/*-----------------------BPy_TimeStampF1D type definition ------------------------------*/ + +PyTypeObject TimeStampF1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "TimeStampF1D", /* tp_name */ + sizeof(BPy_TimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TimeStampF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TimeStampF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h new file mode 100644 index 00000000000..d9bee247c09 --- /dev/null +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h @@ -0,0 +1,30 @@ +#ifndef FREESTYLE_PYTHON_TIMESTAMPF1D_H +#define FREESTYLE_PYTHON_TIMESTAMPF1D_H + +#include "../BPy_UnaryFunction1DVoid.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject TimeStampF1D_Type; + +#define BPy_TimeStampF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TimeStampF1D_Type) ) + +/*---------------------------Python BPy_TimeStampF1D structure definition----------*/ +typedef struct { + BPy_UnaryFunction1DVoid py_uf1D_void; +} BPy_TimeStampF1D; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H */ |