diff options
Diffstat (limited to 'source')
154 files changed, 10617 insertions, 5821 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_BBox.cpp b/source/blender/freestyle/intern/python/BPy_BBox.cpp index 3e73e871c3e..0acd32bad58 100644 --- a/source/blender/freestyle/intern/python/BPy_BBox.cpp +++ b/source/blender/freestyle/intern/python/BPy_BBox.cpp @@ -6,10 +6,44 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for BBox instance -----------*/ -static int BBox___init__(BPy_BBox *self, PyObject *args, PyObject *kwds); -static void BBox___dealloc__(BPy_BBox *self); -static PyObject * BBox___repr__(BPy_BBox *self); +//-------------------MODULE INITIALIZATION-------------------------------- +int BBox_Init( PyObject *module ) +{ + if( module == NULL ) + return -1; + + if( PyType_Ready( &BBox_Type ) < 0 ) + return -1; + + Py_INCREF( &BBox_Type ); + PyModule_AddObject(module, "BBox", (PyObject *)&BBox_Type); + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char BBox___doc__[] = +"Class for representing a bounding box.\n"; + +static int BBox___init__(BPy_BBox *self, PyObject *args, PyObject *kwds) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->bb = new BBox< Vec3r>(); + return 0; +} + +static void BBox___dealloc__(BPy_BBox* self) +{ + delete self->bb; + Py_TYPE(self)->tp_free((PyObject*)self); +} + + +static PyObject * BBox___repr__(BPy_BBox* self) +{ + return PyUnicode_FromFormat("BBox - address: %p", self->bb ); +} /*----------------------BBox instance definitions ----------------------------*/ static PyMethodDef BPy_BBox_methods[] = { @@ -39,7 +73,7 @@ PyTypeObject BBox_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "BBox objects", /* tp_doc */ + BBox___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -59,43 +93,6 @@ PyTypeObject BBox_Type = { PyType_GenericNew, /* tp_new */ }; -//-------------------MODULE INITIALIZATION-------------------------------- -int BBox_Init( PyObject *module ) -{ - if( module == NULL ) - return -1; - - if( PyType_Ready( &BBox_Type ) < 0 ) - return -1; - - Py_INCREF( &BBox_Type ); - PyModule_AddObject(module, "BBox", (PyObject *)&BBox_Type); - return 0; -} - -//------------------------INSTANCE METHODS ---------------------------------- - -int BBox___init__(BPy_BBox *self, PyObject *args, PyObject *kwds) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->bb = new BBox< Vec3r>(); - return 0; -} - -void BBox___dealloc__(BPy_BBox* self) -{ - delete self->bb; - Py_TYPE(self)->tp_free((PyObject*)self); -} - - -PyObject * BBox___repr__(BPy_BBox* self) -{ - return PyUnicode_FromFormat("BBox - address: %p", self->bb ); -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp index c6b418d727a..4bc8a0cb8bb 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp @@ -9,63 +9,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for BinaryPredicate0D instance -----------*/ -static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds); -static void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D *self); -static PyObject * BinaryPredicate0D___repr__(BPy_BinaryPredicate0D *self); - -static PyObject * BinaryPredicate0D_getName( BPy_BinaryPredicate0D *self, PyObject *args); -static PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds); - -/*----------------------BinaryPredicate0D instance definitions ----------------------------*/ -static PyMethodDef BPy_BinaryPredicate0D_methods[] = { - {"getName", ( PyCFunction ) BinaryPredicate0D_getName, METH_NOARGS, "() Returns the string of the name of the binary predicate."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_BinaryPredicate0D type definition ------------------------------*/ - -PyTypeObject BinaryPredicate0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BinaryPredicate0D", /* tp_name */ - sizeof(BPy_BinaryPredicate0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BinaryPredicate0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)BinaryPredicate0D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)BinaryPredicate0D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "BinaryPredicate0D objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_BinaryPredicate0D_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BinaryPredicate0D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int BinaryPredicate0D_Init( PyObject *module ) { @@ -82,7 +25,30 @@ int BinaryPredicate0D_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) +static char BinaryPredicate0D___doc__[] = +"Base class for binary predicates working on :class:`Interface0D`\n" +"objects. A BinaryPredicate0D is typically an ordering relation\n" +"between two Interface0D objects. The predicate evaluates a relation\n" +"between the two Interface0D instances and returns a boolean value (true\n" +"or false). It is used by invoking the __call__() method.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __call__(inter1, inter2)\n" +"\n" +" Must be overload by inherited classes. It evaluates a relation\n" +" between two Interface0D objects.\n" +"\n" +" :arg inter1: The first Interface0D object.\n" +" :type inter1: :class:`Interface0D`\n" +" :arg inter2: The second Interface0D object.\n" +" :type inter2: :class:`Interface0D`\n" +" :return: True or false.\n" +" :rtype: bool\n"; + +static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -92,7 +58,7 @@ int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyOb return 0; } -void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D* self) +static void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D* self) { if (self->bp0D) delete self->bp0D; @@ -100,18 +66,25 @@ void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D* self) } -PyObject * BinaryPredicate0D___repr__(BPy_BinaryPredicate0D* self) +static PyObject * BinaryPredicate0D___repr__(BPy_BinaryPredicate0D* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->bp0D->getName().c_str(), self->bp0D ); } +static char BinaryPredicate0D_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the binary 0D predicate.\n" +"\n" +" :return: The name of the binary 0D predicate.\n" +" :rtype: string\n"; -PyObject * BinaryPredicate0D_getName( BPy_BinaryPredicate0D *self, PyObject *args) +static PyObject * BinaryPredicate0D_getName( BPy_BinaryPredicate0D *self, PyObject *args) { return PyUnicode_FromFormat( self->bp0D->getName().c_str() ); } -PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) +static PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) { BPy_Interface0D *obj1, *obj2; @@ -137,6 +110,54 @@ PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *ar } +/*----------------------BinaryPredicate0D instance definitions ----------------------------*/ +static PyMethodDef BPy_BinaryPredicate0D_methods[] = { + {"getName", ( PyCFunction ) BinaryPredicate0D_getName, METH_NOARGS, BinaryPredicate0D_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_BinaryPredicate0D type definition ------------------------------*/ + +PyTypeObject BinaryPredicate0D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BinaryPredicate0D", /* tp_name */ + sizeof(BPy_BinaryPredicate0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BinaryPredicate0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)BinaryPredicate0D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)BinaryPredicate0D___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BinaryPredicate0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_BinaryPredicate0D_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BinaryPredicate0D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index 384aafeb567..30c63e73630 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -15,62 +15,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for BinaryPredicate1D instance -----------*/ -static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds); -static void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D *self); -static PyObject * BinaryPredicate1D___repr__(BPy_BinaryPredicate1D *self); - -static PyObject * BinaryPredicate1D_getName( BPy_BinaryPredicate1D *self, PyObject *args); -static PyObject * BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds); - -/*----------------------BinaryPredicate1D instance definitions ----------------------------*/ -static PyMethodDef BPy_BinaryPredicate1D_methods[] = { - {"getName", ( PyCFunction ) BinaryPredicate1D_getName, METH_NOARGS, "() Returns the string of the name of the binary predicate."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_BinaryPredicate1D type definition ------------------------------*/ -PyTypeObject BinaryPredicate1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BinaryPredicate1D", /* tp_name */ - sizeof(BPy_BinaryPredicate1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BinaryPredicate1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)BinaryPredicate1D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)BinaryPredicate1D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "BinaryPredicate1D objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_BinaryPredicate1D_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BinaryPredicate1D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int BinaryPredicate1D_Init( PyObject *module ) { @@ -110,10 +54,32 @@ int BinaryPredicate1D_Init( PyObject *module ) return 0; } - //------------------------INSTANCE METHODS ---------------------------------- -int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) +static char BinaryPredicate1D___doc__[] = +"Base class for binary predicates working on :class:`Interface1D`\n" +"objects. A BinaryPredicate1D is typically an ordering relation\n" +"between two Interface1D objects. The predicate evaluates a relation\n" +"between the two Interface1D instances and returns a boolean value (true\n" +"or false). It is used by invoking the __call__() method.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __call__(inter1, inter2)\n" +"\n" +" Must be overload by inherited classes. It evaluates a relation\n" +" between two Interface1D objects.\n" +"\n" +" :arg inter1: The first Interface1D object.\n" +" :type inter1: :class:`Interface1D`\n" +" :arg inter2: The second Interface1D object.\n" +" :type inter2: :class:`Interface1D`\n" +" :return: True or false.\n" +" :rtype: bool\n"; + +static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -122,24 +88,32 @@ int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyOb return 0; } -void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D* self) +static void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D* self) { if (self->bp1D) delete self->bp1D; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * BinaryPredicate1D___repr__(BPy_BinaryPredicate1D* self) +static PyObject * BinaryPredicate1D___repr__(BPy_BinaryPredicate1D* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->bp1D->getName().c_str(), self->bp1D ); } -PyObject *BinaryPredicate1D_getName( BPy_BinaryPredicate1D *self, PyObject *args) +static char BinaryPredicate1D_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the binary 1D predicate.\n" +"\n" +" :return: The name of the binary 1D predicate.\n" +" :rtype: string\n"; + +static PyObject *BinaryPredicate1D_getName( BPy_BinaryPredicate1D *self, PyObject *args) { return PyUnicode_FromFormat( self->bp1D->getName().c_str() ); } -PyObject *BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) +static PyObject *BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) { BPy_Interface1D *obj1, *obj2; @@ -164,6 +138,53 @@ PyObject *BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *arg return PyBool_from_bool( self->bp1D->result ); } +/*----------------------BinaryPredicate1D instance definitions ----------------------------*/ +static PyMethodDef BPy_BinaryPredicate1D_methods[] = { + {"getName", ( PyCFunction ) BinaryPredicate1D_getName, METH_NOARGS, BinaryPredicate1D_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_BinaryPredicate1D type definition ------------------------------*/ +PyTypeObject BinaryPredicate1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BinaryPredicate1D", /* tp_name */ + sizeof(BPy_BinaryPredicate1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BinaryPredicate1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)BinaryPredicate1D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)BinaryPredicate1D___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BinaryPredicate1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_BinaryPredicate1D_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BinaryPredicate1D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp index 43db0f0eb29..1d290b486f9 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp @@ -9,91 +9,66 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*-----------------------Python API function prototypes for the ContextFunctions module--*/ - -static PyObject * ContextFunctions_GetTimeStampCF( PyObject* self ); -static PyObject * ContextFunctions_GetCanvasWidthCF( PyObject* self ); -static PyObject * ContextFunctions_GetCanvasHeightCF( PyObject* self ); -static PyObject * ContextFunctions_LoadMapCF( PyObject *self, PyObject *args ); -static PyObject * ContextFunctions_ReadMapPixelCF( PyObject *self, PyObject *args ); -static PyObject * ContextFunctions_ReadCompleteViewMapPixelCF( PyObject *self, PyObject *args ); -static PyObject * ContextFunctions_ReadDirectionalViewMapPixelCF( PyObject *self, PyObject *args ); -static PyObject * ContextFunctions_GetSelectedFEdgeCF( PyObject *self ); - -/*-----------------------ContextFunctions module docstring-------------------------------*/ - -static char module_docstring[] = "The Blender Freestyle.ContextFunctions submodule\n\n"; - -/*-----------------------ContextFunctions module functions definitions-------------------*/ - -static PyMethodDef module_functions[] = { - {"GetTimeStampCF", (PyCFunction)ContextFunctions_GetTimeStampCF, METH_NOARGS, ""}, - {"GetCanvasWidthCF", (PyCFunction)ContextFunctions_GetCanvasWidthCF, METH_NOARGS, ""}, - {"GetCanvasHeightCF", (PyCFunction)ContextFunctions_GetCanvasHeightCF, METH_NOARGS, ""}, - {"LoadMapCF", (PyCFunction)ContextFunctions_LoadMapCF, METH_VARARGS, ""}, - {"ReadMapPixelCF", (PyCFunction)ContextFunctions_ReadMapPixelCF, METH_VARARGS, ""}, - {"ReadCompleteViewMapPixelCF", (PyCFunction)ContextFunctions_ReadCompleteViewMapPixelCF, METH_VARARGS, ""}, - {"ReadDirectionalViewMapPixelCF", (PyCFunction)ContextFunctions_ReadDirectionalViewMapPixelCF, METH_VARARGS, ""}, - {"GetSelectedFEdgeCF", (PyCFunction)ContextFunctions_GetSelectedFEdgeCF, METH_NOARGS, ""}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------ContextFunctions module definition--------------------------------*/ - -static PyModuleDef module_definition = { - PyModuleDef_HEAD_INIT, - "Freestyle.ContextFunctions", - module_docstring, - -1, - module_functions -}; - -//------------------- MODULE INITIALIZATION -------------------------------- - -int ContextFunctions_Init( PyObject *module ) -{ - PyObject *m, *d, *f; - - if( module == NULL ) - return -1; - - m = PyModule_Create(&module_definition); - if (m == NULL) - return -1; - Py_INCREF(m); - PyModule_AddObject(module, "ContextFunctions", m); - - // from ContextFunctions import * - d = PyModule_GetDict(m); - for (PyMethodDef *p = module_functions; p->ml_name; p++) { - f = PyDict_GetItemString(d, p->ml_name); - Py_INCREF(f); - PyModule_AddObject(module, p->ml_name, f); - } - - return 0; -} - //------------------------ MODULE FUNCTIONS ---------------------------------- +static char ContextFunctions_GetTimeStampCF___doc__[] = +".. function:: GetTimeStampCF()\n" +"\n" +" Returns the system time stamp.\n" +"\n" +" :return: The system time stamp.\n" +" :rtype: int\n"; + static PyObject * ContextFunctions_GetTimeStampCF( PyObject* self ) { return PyLong_FromLong( ContextFunctions::GetTimeStampCF() ); } +static char ContextFunctions_GetCanvasWidthCF___doc__[] = +".. method:: GetCanvasWidthCF()\n" +"\n" +" Returns the canvas width.\n" +"\n" +" :return: The canvas width.\n" +" :rtype: int\n"; + static PyObject * ContextFunctions_GetCanvasWidthCF( PyObject* self ) { return PyLong_FromLong( ContextFunctions::GetCanvasWidthCF() ); } +static char ContextFunctions_GetCanvasHeightCF___doc__[] = +".. method:: GetCanvasHeightCF()\n" +"\n" +" Returns the canvas height.\n" +"\n" +" :return: The canvas height.\n" +" :rtype: int\n"; + static PyObject * ContextFunctions_GetCanvasHeightCF( PyObject* self ) { return PyLong_FromLong( ContextFunctions::GetCanvasHeightCF() ); } +static char ContextFunctions_LoadMapCF___doc__[] = +".. function:: LoadMapCF(iFileName, iMapName, iNbLevels=4, iSigma=1.0)\n" +"\n" +" Loads an image map for further reading.\n" +"\n" +" :arg iFileName: The name of the image file.\n" +" :type iFileName: string\n" +" :arg iMapName: The name that will be used to access this image.\n" +" :type iMapName: string\n" +" :arg iNbLevels: The number of levels in the map pyramid\n" +" (default = 4). If iNbLevels == 0, the complete pyramid is\n" +" built.\n" +" :type iNbLevels: int\n" +" :arg iSigma: The sigma value of the gaussian function.\n" +" :type iSigma: float\n"; + static PyObject * ContextFunctions_LoadMapCF( PyObject *self, PyObject *args ) { @@ -109,6 +84,25 @@ ContextFunctions_LoadMapCF( PyObject *self, PyObject *args ) Py_RETURN_NONE; } +static char ContextFunctions_ReadMapPixelCF___doc__[] = +".. function:: ReadMapPixelCF(iMapName, level, x, y)\n" +"\n" +" Reads a pixel in a user-defined map.\n" +"\n" +" :arg iMapName: The name of the map.\n" +" :type iMapName: string\n" +" :arg level: The level of the pyramid in which we wish to read the\n" +" pixel.\n" +" :type level: int\n" +" :arg x: The x coordinate of the pixel we wish to read. The origin\n" +" is in the lower-left corner.\n" +" :type x: int\n" +" :arg y: The y coordinate of the pixel we wish to read. The origin\n" +" is in the lower-left corner.\n" +" :type y: int\n" +" :return: The floating-point value stored for that pixel.\n" +" :rtype: float\n"; + static PyObject * ContextFunctions_ReadMapPixelCF( PyObject *self, PyObject *args ) { @@ -124,6 +118,23 @@ ContextFunctions_ReadMapPixelCF( PyObject *self, PyObject *args ) return PyFloat_FromDouble( f ); } +static char ContextFunctions_ReadCompleteViewMapPixelCF___doc__[] = +".. function:: ReadCompleteViewMapPixelCF(level, x, y)\n" +"\n" +" Reads a pixel in the complete view map.\n" +"\n" +" :arg level: The level of the pyramid in which we wish to read the\n" +" pixel.\n" +" :type level: int\n" +" :arg x: The x coordinate of the pixel we wish to read. The origin\n" +" is in the lower-left corner.\n" +" :type x: int\n" +" :arg y: The y coordinate of the pixel we wish to read. The origin\n" +" is in the lower-left corner.\n" +" :type y: int\n" +" :return: The floating-point value stored for that pixel.\n" +" :rtype: float\n"; + static PyObject * ContextFunctions_ReadCompleteViewMapPixelCF( PyObject *self, PyObject *args ) { @@ -138,6 +149,26 @@ ContextFunctions_ReadCompleteViewMapPixelCF( PyObject *self, PyObject *args ) return PyFloat_FromDouble( f ); } +static char ContextFunctions_ReadDirectionalViewMapPixelCF___doc__[] = +".. function:: ReadDirectionalViewMapPixelCF(iOrientation, level, x, y)\n" +"\n" +" Reads a pixel in one of the oriented view map images.\n" +"\n" +" :arg iOrientation: The number telling which orientation we want to\n" +" check.\n" +" :type iOrientation: int\n" +" :arg level: The level of the pyramid in which we wish to read the\n" +" pixel.\n" +" :type level: int\n" +" :arg x: The x coordinate of the pixel we wish to read. The origin\n" +" is in the lower-left corner.\n" +" :type x: int\n" +" :arg y: The y coordinate of the pixel we wish to read. The origin\n" +" is in the lower-left corner.\n" +" :type y: int\n" +" :return: The floating-point value stored for that pixel.\n" +" :rtype: float\n"; + static PyObject * ContextFunctions_ReadDirectionalViewMapPixelCF( PyObject *self, PyObject *args ) { @@ -152,6 +183,14 @@ ContextFunctions_ReadDirectionalViewMapPixelCF( PyObject *self, PyObject *args ) return PyFloat_FromDouble( f ); } +static char ContextFunctions_GetSelectedFEdgeCF___doc__[] = +".. function:: GetSelectedFEdgeCF()\n" +"\n" +" Returns the selected FEdge.\n" +"\n" +" :return: The selected FEdge.\n" +" :rtype: :class:`FEdge`\n"; + static PyObject * ContextFunctions_GetSelectedFEdgeCF( PyObject *self ) { @@ -162,6 +201,60 @@ ContextFunctions_GetSelectedFEdgeCF( PyObject *self ) Py_RETURN_NONE; } +/*-----------------------ContextFunctions module docstring-------------------------------*/ + +static char module_docstring[] = "The Blender Freestyle.ContextFunctions submodule\n\n"; + +/*-----------------------ContextFunctions module functions definitions-------------------*/ + +static PyMethodDef module_functions[] = { + {"GetTimeStampCF", (PyCFunction)ContextFunctions_GetTimeStampCF, METH_NOARGS, ContextFunctions_GetTimeStampCF___doc__}, + {"GetCanvasWidthCF", (PyCFunction)ContextFunctions_GetCanvasWidthCF, METH_NOARGS, ContextFunctions_GetCanvasWidthCF___doc__}, + {"GetCanvasHeightCF", (PyCFunction)ContextFunctions_GetCanvasHeightCF, METH_NOARGS, ContextFunctions_GetCanvasHeightCF___doc__}, + {"LoadMapCF", (PyCFunction)ContextFunctions_LoadMapCF, METH_VARARGS, ContextFunctions_LoadMapCF___doc__}, + {"ReadMapPixelCF", (PyCFunction)ContextFunctions_ReadMapPixelCF, METH_VARARGS, ContextFunctions_ReadMapPixelCF___doc__}, + {"ReadCompleteViewMapPixelCF", (PyCFunction)ContextFunctions_ReadCompleteViewMapPixelCF, METH_VARARGS, ContextFunctions_ReadCompleteViewMapPixelCF___doc__}, + {"ReadDirectionalViewMapPixelCF", (PyCFunction)ContextFunctions_ReadDirectionalViewMapPixelCF, METH_VARARGS, ContextFunctions_ReadDirectionalViewMapPixelCF___doc__}, + {"GetSelectedFEdgeCF", (PyCFunction)ContextFunctions_GetSelectedFEdgeCF, METH_NOARGS, ContextFunctions_GetSelectedFEdgeCF___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------ContextFunctions module definition--------------------------------*/ + +static PyModuleDef module_definition = { + PyModuleDef_HEAD_INIT, + "Freestyle.ContextFunctions", + module_docstring, + -1, + module_functions +}; + +//------------------- MODULE INITIALIZATION -------------------------------- + +int ContextFunctions_Init( PyObject *module ) +{ + PyObject *m, *d, *f; + + if( module == NULL ) + return -1; + + m = PyModule_Create(&module_definition); + if (m == NULL) + return -1; + Py_INCREF(m); + PyModule_AddObject(module, "ContextFunctions", m); + + // from ContextFunctions import * + d = PyModule_GetDict(m); + for (PyMethodDef *p = module_functions; p->ml_name; p++) { + f = PyDict_GetItemString(d, p->ml_name); + Py_INCREF(f); + PyModule_AddObject(module, p->ml_name, f); + } + + return 0; +} + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index 3e8572d07ae..082ca32ddc7 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -31,19 +31,38 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// +//------------------------ MODULE FUNCTIONS ---------------------------------- -//static PyObject *Freestyle_testOutput( BPy_Freestyle * self ); -static PyObject *Freestyle_getCurrentScene( PyObject *self ); +#include "FRS_freestyle.h" +#include "bpy_rna.h" /* pyrna_struct_CreatePyObject() */ + +static char Freestyle_getCurrentScene___doc__[] = +".. function:: getCurrentScene()\n" +"\n" +" Returns the current scene.\n" +"\n" +" :return: The current scene.\n" +" :rtype: :class:`bpy.types.Scene`\n"; + +static PyObject *Freestyle_getCurrentScene( PyObject *self ) +{ + if (!freestyle_scene) { + PyErr_SetString(PyExc_TypeError, "current scene not available"); + return NULL; + } + PointerRNA ptr_scene; + RNA_pointer_create(NULL, &RNA_Scene, freestyle_scene, &ptr_scene); + return pyrna_struct_CreatePyObject(&ptr_scene); +} -/*-----------------------Freestyle module doc strings--------------------------*/ +/*-----------------------Freestyle module docstring----------------------------*/ static char module_docstring[] = "The Blender Freestyle module\n\n"; /*-----------------------Freestyle module method def---------------------------*/ static PyMethodDef module_functions[] = { -// {"testOutput", ( PyCFunction ) Freestyle_testOutput, METH_NOARGS, "() - Return Curve Data name"}, - {"getCurrentScene", ( PyCFunction ) Freestyle_getCurrentScene, METH_NOARGS, "() - Return the current scene."}, + {"getCurrentScene", ( PyCFunction ) Freestyle_getCurrentScene, METH_NOARGS, Freestyle_getCurrentScene___doc__}, {NULL, NULL, 0, NULL} }; @@ -101,20 +120,6 @@ PyObject *Freestyle_Init( void ) /////////////////////////////////////////////////////////////////////////////////////////// -#include "FRS_freestyle.h" -#include "bpy_rna.h" /* pyrna_struct_CreatePyObject() */ - -static PyObject *Freestyle_getCurrentScene( PyObject *self ) -{ - if (!freestyle_scene) { - PyErr_SetString(PyExc_TypeError, "current scene not available"); - return NULL; - } - PointerRNA ptr_scene; - RNA_pointer_create(NULL, &RNA_Scene, freestyle_scene, &ptr_scene); - return pyrna_struct_CreatePyObject(&ptr_scene); -} - #ifdef __cplusplus } #endif diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index 462ea7e3430..0eea750440c 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -8,112 +8,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FrsMaterial instance -----------*/ -static int FrsMaterial___init__(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds); -static void FrsMaterial___dealloc__(BPy_FrsMaterial *self); -static PyObject * FrsMaterial___repr__(BPy_FrsMaterial *self); - -static PyObject * FrsMaterial_diffuse( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_diffuseR( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_diffuseG( BPy_FrsMaterial* self) ; -static PyObject * FrsMaterial_diffuseB( BPy_FrsMaterial* self) ; -static PyObject * FrsMaterial_diffuseA( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_specular( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_specularR( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_specularG( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_specularB( BPy_FrsMaterial* self) ; -static PyObject * FrsMaterial_specularA( BPy_FrsMaterial* self) ; -static PyObject * FrsMaterial_ambient( BPy_FrsMaterial* self) ; -static PyObject * FrsMaterial_ambientR( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_ambientG( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_ambientB( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_ambientA( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_emission( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_emissionR( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_emissionG( BPy_FrsMaterial* self) ; -static PyObject * FrsMaterial_emissionB( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_emissionA( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_shininess( BPy_FrsMaterial* self); -static PyObject * FrsMaterial_setDiffuse( BPy_FrsMaterial *self, PyObject *args ); -static PyObject * FrsMaterial_setSpecular( BPy_FrsMaterial *self, PyObject *args ); -static PyObject * FrsMaterial_setAmbient( BPy_FrsMaterial *self, PyObject *args ); -static PyObject * FrsMaterial_setEmission( BPy_FrsMaterial *self, PyObject *args ); -static PyObject * FrsMaterial_setShininess( BPy_FrsMaterial *self, PyObject *args ); - -/*----------------------FrsMaterial instance definitions ----------------------------*/ -static PyMethodDef BPy_FrsMaterial_methods[] = { - {"diffuse", ( PyCFunction ) FrsMaterial_diffuse, METH_NOARGS, "() Returns the diffuse color as a 4 float array"}, - {"diffuseR", ( PyCFunction ) FrsMaterial_diffuseR, METH_NOARGS, "() Returns the red component of the diffuse color "}, - {"diffuseG", ( PyCFunction ) FrsMaterial_diffuseG, METH_NOARGS, "() Returns the green component of the diffuse color "}, - {"diffuseB", ( PyCFunction ) FrsMaterial_diffuseB, METH_NOARGS, "() Returns the blue component of the diffuse color "}, - {"diffuseA", ( PyCFunction ) FrsMaterial_diffuseA, METH_NOARGS, "() Returns the alpha component of the diffuse color "}, - {"specular", ( PyCFunction ) FrsMaterial_specular, METH_NOARGS, "() Returns the specular color as a 4 float array"}, - {"specularR", ( PyCFunction ) FrsMaterial_specularR, METH_NOARGS, "() Returns the red component of the specular color "}, - {"specularG", ( PyCFunction ) FrsMaterial_specularG, METH_NOARGS, "() Returns the green component of the specular color "}, - {"specularB", ( PyCFunction ) FrsMaterial_specularB, METH_NOARGS, "() Returns the blue component of the specular color "}, - {"specularA", ( PyCFunction ) FrsMaterial_specularA, METH_NOARGS, "() Returns the alpha component of the specular color "}, - {"ambient", ( PyCFunction ) FrsMaterial_ambient, METH_NOARGS, "() Returns the ambient color as a 4 float array"}, - {"ambientR", ( PyCFunction ) FrsMaterial_ambientR, METH_NOARGS, "() Returns the red component of the ambient color "}, - {"ambientG", ( PyCFunction ) FrsMaterial_ambientG, METH_NOARGS, "() Returns the green component of the ambient color "}, - {"ambientB", ( PyCFunction ) FrsMaterial_ambientB, METH_NOARGS, "() Returns the blue component of the ambient color "}, - {"ambientA", ( PyCFunction ) FrsMaterial_ambientA, METH_NOARGS, "() Returns the alpha component of the ambient color "}, - {"emission", ( PyCFunction ) FrsMaterial_emission, METH_NOARGS, "() Returns the emission color as a 4 float array"}, - {"emissionR", ( PyCFunction ) FrsMaterial_emissionR, METH_NOARGS, "() Returns the red component of the emission color "}, - {"emissionG", ( PyCFunction ) FrsMaterial_emissionG, METH_NOARGS, "() Returns the green component of the emission color "}, - {"emissionB", ( PyCFunction ) FrsMaterial_emissionB, METH_NOARGS, "() Returns the blue component of the emission color "}, - {"emissionA", ( PyCFunction ) FrsMaterial_emissionA, METH_NOARGS, "() Returns the alpha component of the emission color "}, - {"shininess", ( PyCFunction ) FrsMaterial_shininess, METH_NOARGS, "() Returns the shininess coefficient "}, - {"setDiffuse", ( PyCFunction ) FrsMaterial_setDiffuse, METH_NOARGS, "(float r, float g, float b, float a) Sets the diffuse color"}, - {"setSpecular", ( PyCFunction ) FrsMaterial_setSpecular, METH_NOARGS, "(float r, float g, float b, float a) Sets the specular color"}, - {"setAmbient", ( PyCFunction ) FrsMaterial_setAmbient, METH_NOARGS, "(float r, float g, float b, float a) Sets the ambient color"}, - {"setEmission", ( PyCFunction ) FrsMaterial_setEmission, METH_NOARGS, "(float r, float g, float b, float a) Sets the emission color"}, - {"setShininess", ( PyCFunction ) FrsMaterial_setShininess, METH_NOARGS, "(float r, float g, float b, float a) Sets the shininess color"}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_FrsMaterial type definition ------------------------------*/ - -PyTypeObject FrsMaterial_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FrsMaterial", /* tp_name */ - sizeof(BPy_FrsMaterial), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)FrsMaterial___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)FrsMaterial___repr__, /* 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 */ - "FrsMaterial objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FrsMaterial_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsMaterial___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int FrsMaterial_Init( PyObject *module ) { @@ -130,6 +24,36 @@ int FrsMaterial_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- +static char FrsMaterial___doc__[] = +"Class defining a material.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(m)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg m: A Material object.\n" +" :type m: :class:`FrsMaterial`\n" +"\n" +".. method:: __init__(iDiffuse, iAmbiant, iSpecular, iEmission, iShininess)\n" +"\n" +" Builds a Material from its diffuse, ambiant, specular, emissive\n" +" colors and a shininess coefficient.\n" +"\n" +" :arg iDiffuse: The diffuse color.\n" +" :type iDiffuse: :class:`Mathutils.Vector`, list of tuple of 4 float values\n" +" :arg iAmbiant: The ambiant color.\n" +" :type iAmbiant: :class:`Mathutils.Vector`, list of tuple of 4 float values\n" +" :arg iSpecular: The specular color.\n" +" :type iSpecular: :class:`Mathutils.Vector`, list of tuple of 4 float values\n" +" :arg iEmission: The emissive color.\n" +" :type iEmission: :class:`Mathutils.Vector`, list of tuple of 4 float values\n" +" :arg iShininess: The shininess coefficient.\n" +" :type iShininess: :class:`Mathutils.Vector`, list of tuple of 4 float values\n"; + static int Vec4(PyObject *obj, float *v) { if (VectorObject_Check(obj) && ((VectorObject *)obj)->size == 4) { @@ -147,7 +71,7 @@ static int Vec4(PyObject *obj, float *v) return 1; } -int FrsMaterial___init__(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds) +static int FrsMaterial___init__(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; float f1[4], f2[4], f3[4], f4[4], f5 = 0.; @@ -178,7 +102,7 @@ int FrsMaterial___init__(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds) return 0; } -void FrsMaterial___dealloc__( BPy_FrsMaterial* self) +static void FrsMaterial___dealloc__( BPy_FrsMaterial* self) { if( self->m && !self->borrowed ) delete self->m; @@ -186,12 +110,20 @@ void FrsMaterial___dealloc__( BPy_FrsMaterial* self) } -PyObject * FrsMaterial___repr__( BPy_FrsMaterial* self) +static PyObject * FrsMaterial___repr__( BPy_FrsMaterial* self) { return PyUnicode_FromFormat("FrsMaterial - address: %p", self->m ); } -PyObject * FrsMaterial_diffuse( BPy_FrsMaterial* self) { +static char FrsMaterial_diffuse___doc__[] = +".. method:: diffuse()\n" +"\n" +" Returns the diffuse color.\n" +"\n" +" :return: The diffuse color.\n" +" :rtype: Tuple of 4 float values\n"; + +static PyObject * FrsMaterial_diffuse( BPy_FrsMaterial* self) { const float *diffuse = self->m->diffuse(); PyObject *py_diffuse = PyTuple_New(4); @@ -203,23 +135,63 @@ PyObject * FrsMaterial_diffuse( BPy_FrsMaterial* self) { return py_diffuse; } -PyObject * FrsMaterial_diffuseR( BPy_FrsMaterial* self) { +static char FrsMaterial_diffuseR___doc__[] = +".. method:: diffuseR()\n" +"\n" +" Returns the red component of the diffuse color.\n" +"\n" +" :return: The red component of the diffuse color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_diffuseR( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->diffuseR() ); } -PyObject * FrsMaterial_diffuseG( BPy_FrsMaterial* self) { +static char FrsMaterial_diffuseG___doc__[] = +".. method:: diffuseG()\n" +"\n" +" Returns the green component of the diffuse color.\n" +"\n" +" :return: The green component of the diffuse color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_diffuseG( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->diffuseG() ); } -PyObject * FrsMaterial_diffuseB( BPy_FrsMaterial* self) { +static char FrsMaterial_diffuseB___doc__[] = +".. method:: diffuseB()\n" +"\n" +" Returns the blue component of the diffuse color.\n" +"\n" +" :return: The blue component of the diffuse color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_diffuseB( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->diffuseB() ); } -PyObject * FrsMaterial_diffuseA( BPy_FrsMaterial* self) { +static char FrsMaterial_diffuseA___doc__[] = +".. method:: diffuseA()\n" +"\n" +" Returns the alpha component of the diffuse color.\n" +"\n" +" :return: The alpha component of the diffuse color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_diffuseA( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->diffuseA() ); } -PyObject * FrsMaterial_specular( BPy_FrsMaterial* self) { +static char FrsMaterial_specular___doc__[] = +".. method:: specular()\n" +"\n" +" Returns the specular color.\n" +"\n" +" :return: The specular color.\n" +" :rtype: Tuple of 4 float values\n"; + +static PyObject * FrsMaterial_specular( BPy_FrsMaterial* self) { const float *specular = self->m->specular(); PyObject *py_specular = PyTuple_New(4); @@ -231,23 +203,63 @@ PyObject * FrsMaterial_specular( BPy_FrsMaterial* self) { return py_specular; } -PyObject * FrsMaterial_specularR( BPy_FrsMaterial* self) { +static char FrsMaterial_specularR___doc__[] = +".. method:: specularR()\n" +"\n" +" Returns the red component of the specular color.\n" +"\n" +" :return: The red component of the specular color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_specularR( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->specularR() ); } -PyObject * FrsMaterial_specularG( BPy_FrsMaterial* self) { +static char FrsMaterial_specularG___doc__[] = +".. method:: specularG()\n" +"\n" +" Returns the green component of the specular color.\n" +"\n" +" :return: The green component of the specular color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_specularG( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->specularG() ); } -PyObject * FrsMaterial_specularB( BPy_FrsMaterial* self) { +static char FrsMaterial_specularB___doc__[] = +".. method:: specularB()\n" +"\n" +" Returns the blue component of the specular color.\n" +"\n" +" :return: The blue component of the specular color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_specularB( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->specularB() ); } -PyObject * FrsMaterial_specularA( BPy_FrsMaterial* self) { +static char FrsMaterial_specularA___doc__[] = +".. method:: specularA()\n" +"\n" +" Returns the alpha component of the specular color.\n" +"\n" +" :return: The alpha component of the specular color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_specularA( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->specularA() ); } -PyObject * FrsMaterial_ambient( BPy_FrsMaterial* self) { +static char FrsMaterial_ambient___doc__[] = +".. method:: ambient()\n" +"\n" +" Returns the ambiant color.\n" +"\n" +" :return: The ambiant color.\n" +" :rtype: Tuple of 4 float values\n"; + +static PyObject * FrsMaterial_ambient( BPy_FrsMaterial* self) { const float *ambient = self->m->ambient(); PyObject *py_ambient = PyTuple_New(4); @@ -259,23 +271,63 @@ PyObject * FrsMaterial_ambient( BPy_FrsMaterial* self) { return py_ambient; } -PyObject * FrsMaterial_ambientR( BPy_FrsMaterial* self) { +static char FrsMaterial_ambientR___doc__[] = +".. method:: ambientR()\n" +"\n" +" Returns the red component of the ambiant color.\n" +"\n" +" :return: The red component of the ambiant color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_ambientR( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->ambientR() ); } -PyObject * FrsMaterial_ambientG( BPy_FrsMaterial* self) { +static char FrsMaterial_ambientG___doc__[] = +".. method:: ambientG()\n" +"\n" +" Returns the green component of the ambiant color.\n" +"\n" +" :return: The green component of the ambiant color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_ambientG( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->ambientG() ); } -PyObject * FrsMaterial_ambientB( BPy_FrsMaterial* self) { +static char FrsMaterial_ambientB___doc__[] = +".. method:: ambientB()\n" +"\n" +" Returns the blue component of the ambiant color.\n" +"\n" +" :return: The blue component of the ambiant color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_ambientB( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->ambientB() ); } -PyObject * FrsMaterial_ambientA( BPy_FrsMaterial* self) { +static char FrsMaterial_ambientA___doc__[] = +".. method:: ambientA()\n" +"\n" +" Returns the alpha component of the ambiant color.\n" +"\n" +" :return: The alpha component of the ambiant color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_ambientA( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->ambientA() ); } -PyObject * FrsMaterial_emission( BPy_FrsMaterial* self) { +static char FrsMaterial_emission___doc__[] = +".. method:: emission()\n" +"\n" +" Returns the emissive color.\n" +"\n" +" :return: the emissive color.\n" +" :rtype: Tuple of 4 float values\n"; + +static PyObject * FrsMaterial_emission( BPy_FrsMaterial* self) { const float *emission = self->m->emission(); PyObject *py_emission = PyTuple_New(4); @@ -287,27 +339,81 @@ PyObject * FrsMaterial_emission( BPy_FrsMaterial* self) { return py_emission; } -PyObject * FrsMaterial_emissionR( BPy_FrsMaterial* self) { +static char FrsMaterial_emissionR___doc__[] = +".. method:: emissionR()\n" +"\n" +" Returns the red component of the emissive color.\n" +"\n" +" :return: The red component of the emissive color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_emissionR( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->emissionR() ); } -PyObject * FrsMaterial_emissionG( BPy_FrsMaterial* self) { +static char FrsMaterial_emissionG___doc__[] = +".. method:: emissionG()\n" +"\n" +" Returns the green component of the emissive color.\n" +"\n" +" :return: The green component of the emissive color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_emissionG( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->emissionG() ); } -PyObject * FrsMaterial_emissionB( BPy_FrsMaterial* self) { +static char FrsMaterial_emissionB___doc__[] = +".. method:: emissionB()\n" +"\n" +" Returns the blue component of the emissive color.\n" +"\n" +" :return: The blue component of the emissive color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_emissionB( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->emissionB() ); } -PyObject * FrsMaterial_emissionA( BPy_FrsMaterial* self) { +static char FrsMaterial_emissionA___doc__[] = +".. method:: emissionA()\n" +"\n" +" Returns the alpha component of the emissive color.\n" +"\n" +" :return: The alpha component of the emissive color.\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_emissionA( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->emissionA() ); } -PyObject * FrsMaterial_shininess( BPy_FrsMaterial* self) { +static char FrsMaterial_shininess___doc__[] = +".. method:: shininess()\n" +"\n" +" Returns the shininess coefficient.\n" +"\n" +" :return: Shininess\n" +" :rtype: float\n"; + +static PyObject * FrsMaterial_shininess( BPy_FrsMaterial* self) { return PyFloat_FromDouble( self->m->shininess() ); } -PyObject * FrsMaterial_setDiffuse( BPy_FrsMaterial *self, PyObject *args ) { +static char FrsMaterial_setDiffuse___doc__[] = +".. method:: setDiffuse(r, g, b, a)\n" +"\n" +" Sets the diffuse color.\n" +"\n" +" :arg r: Red component.\n" +" :type r: float\n" +" :arg g: Green component.\n" +" :type g: float\n" +" :arg b: Blue component.\n" +" :type b: float\n" +" :arg a: Alpha component.\n" +" :type a: float\n"; + +static PyObject * FrsMaterial_setDiffuse( BPy_FrsMaterial *self, PyObject *args ) { float f1, f2, f3, f4; if(!( PyArg_ParseTuple(args, "ffff", &f1, &f2, &f3, &f4) )) @@ -318,7 +424,21 @@ PyObject * FrsMaterial_setDiffuse( BPy_FrsMaterial *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FrsMaterial_setSpecular( BPy_FrsMaterial *self, PyObject *args ) { +static char FrsMaterial_setSpecular___doc__[] = +".. method:: setSpecular(r, g, b, a)\n" +"\n" +" Sets the specular color.\n" +"\n" +" :arg r: Red component.\n" +" :type r: float\n" +" :arg g: Green component.\n" +" :type g: float\n" +" :arg b: Blue component.\n" +" :type b: float\n" +" :arg a: Alpha component.\n" +" :type a: float\n"; + +static PyObject * FrsMaterial_setSpecular( BPy_FrsMaterial *self, PyObject *args ) { float f1, f2, f3, f4; if(!( PyArg_ParseTuple(args, "ffff", &f1, &f2, &f3, &f4) )) @@ -329,7 +449,21 @@ PyObject * FrsMaterial_setSpecular( BPy_FrsMaterial *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FrsMaterial_setAmbient( BPy_FrsMaterial *self, PyObject *args ) { +static char FrsMaterial_setAmbient___doc__[] = +".. method:: setAmbient(r, g, b, a)\n" +"\n" +" Sets the ambiant color.\n" +"\n" +" :arg r: Red component.\n" +" :type r: float\n" +" :arg g: Green component.\n" +" :type g: float\n" +" :arg b: Blue component.\n" +" :type b: float\n" +" :arg a: Alpha component.\n" +" :type a: float\n"; + +static PyObject * FrsMaterial_setAmbient( BPy_FrsMaterial *self, PyObject *args ) { float f1, f2, f3, f4; if(!( PyArg_ParseTuple(args, "ffff", &f1, &f2, &f3, &f4) )) @@ -340,7 +474,21 @@ PyObject * FrsMaterial_setAmbient( BPy_FrsMaterial *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FrsMaterial_setEmission( BPy_FrsMaterial *self, PyObject *args ) { +static char FrsMaterial_setEmission___doc__[] = +".. method:: setEmission(r, g, b, a)\n" +"\n" +" Sets the emissive color.\n" +"\n" +" :arg r: Red component.\n" +" :type r: float\n" +" :arg g: Green component.\n" +" :type g: float\n" +" :arg b: Blue component.\n" +" :type b: float\n" +" :arg a: Alpha component.\n" +" :type a: float\n"; + +static PyObject * FrsMaterial_setEmission( BPy_FrsMaterial *self, PyObject *args ) { float f1, f2, f3, f4; if(!( PyArg_ParseTuple(args, "ffff", &f1, &f2, &f3, &f4) )) @@ -351,7 +499,15 @@ PyObject * FrsMaterial_setEmission( BPy_FrsMaterial *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FrsMaterial_setShininess( BPy_FrsMaterial *self, PyObject *args ) { +static char FrsMaterial_setShininess___doc__[] = +".. method:: setShininess(s)\n" +"\n" +" Sets the shininess.\n" +"\n" +" :arg s: Shininess.\n" +" :type s: float\n"; + +static PyObject * FrsMaterial_setShininess( BPy_FrsMaterial *self, PyObject *args ) { float f; if(!( PyArg_ParseTuple(args, "f", &f) )) @@ -362,6 +518,80 @@ PyObject * FrsMaterial_setShininess( BPy_FrsMaterial *self, PyObject *args ) { Py_RETURN_NONE; } +/*----------------------FrsMaterial instance definitions ----------------------------*/ +static PyMethodDef BPy_FrsMaterial_methods[] = { + {"diffuse", ( PyCFunction ) FrsMaterial_diffuse, METH_NOARGS, FrsMaterial_diffuse___doc__}, + {"diffuseR", ( PyCFunction ) FrsMaterial_diffuseR, METH_NOARGS, FrsMaterial_diffuseR___doc__}, + {"diffuseG", ( PyCFunction ) FrsMaterial_diffuseG, METH_NOARGS, FrsMaterial_diffuseG___doc__}, + {"diffuseB", ( PyCFunction ) FrsMaterial_diffuseB, METH_NOARGS, FrsMaterial_diffuseB___doc__}, + {"diffuseA", ( PyCFunction ) FrsMaterial_diffuseA, METH_NOARGS, FrsMaterial_diffuseA___doc__}, + {"specular", ( PyCFunction ) FrsMaterial_specular, METH_NOARGS, FrsMaterial_specular___doc__}, + {"specularR", ( PyCFunction ) FrsMaterial_specularR, METH_NOARGS, FrsMaterial_specularR___doc__}, + {"specularG", ( PyCFunction ) FrsMaterial_specularG, METH_NOARGS, FrsMaterial_specularG___doc__}, + {"specularB", ( PyCFunction ) FrsMaterial_specularB, METH_NOARGS, FrsMaterial_specularB___doc__}, + {"specularA", ( PyCFunction ) FrsMaterial_specularA, METH_NOARGS, FrsMaterial_specularA___doc__}, + {"ambient", ( PyCFunction ) FrsMaterial_ambient, METH_NOARGS, FrsMaterial_ambient___doc__}, + {"ambientR", ( PyCFunction ) FrsMaterial_ambientR, METH_NOARGS, FrsMaterial_ambientR___doc__}, + {"ambientG", ( PyCFunction ) FrsMaterial_ambientG, METH_NOARGS, FrsMaterial_ambientG___doc__}, + {"ambientB", ( PyCFunction ) FrsMaterial_ambientB, METH_NOARGS, FrsMaterial_ambientB___doc__}, + {"ambientA", ( PyCFunction ) FrsMaterial_ambientA, METH_NOARGS, FrsMaterial_ambientA___doc__}, + {"emission", ( PyCFunction ) FrsMaterial_emission, METH_NOARGS, FrsMaterial_emission___doc__}, + {"emissionR", ( PyCFunction ) FrsMaterial_emissionR, METH_NOARGS, FrsMaterial_emissionR___doc__}, + {"emissionG", ( PyCFunction ) FrsMaterial_emissionG, METH_NOARGS, FrsMaterial_emissionG___doc__}, + {"emissionB", ( PyCFunction ) FrsMaterial_emissionB, METH_NOARGS, FrsMaterial_emissionB___doc__}, + {"emissionA", ( PyCFunction ) FrsMaterial_emissionA, METH_NOARGS, FrsMaterial_emissionA___doc__}, + {"shininess", ( PyCFunction ) FrsMaterial_shininess, METH_NOARGS, FrsMaterial_shininess___doc__}, + {"setDiffuse", ( PyCFunction ) FrsMaterial_setDiffuse, METH_NOARGS, FrsMaterial_setDiffuse___doc__}, + {"setSpecular", ( PyCFunction ) FrsMaterial_setSpecular, METH_NOARGS, FrsMaterial_setSpecular___doc__}, + {"setAmbient", ( PyCFunction ) FrsMaterial_setAmbient, METH_NOARGS, FrsMaterial_setAmbient___doc__}, + {"setEmission", ( PyCFunction ) FrsMaterial_setEmission, METH_NOARGS, FrsMaterial_setEmission___doc__}, + {"setShininess", ( PyCFunction ) FrsMaterial_setShininess, METH_NOARGS, FrsMaterial_setShininess___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_FrsMaterial type definition ------------------------------*/ + +PyTypeObject FrsMaterial_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "FrsMaterial", /* tp_name */ + sizeof(BPy_FrsMaterial), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)FrsMaterial___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)FrsMaterial___repr__, /* 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 */ + FrsMaterial___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_FrsMaterial_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsMaterial___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 8c21fa63ba1..ed6be31bd47 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -9,72 +9,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FrsNoise instance -----------*/ -static int FrsNoise___init__(BPy_FrsNoise *self, PyObject *args, PyObject *kwds); -static void FrsNoise___dealloc__(BPy_FrsNoise *self); -static PyObject * FrsNoise___repr__(BPy_FrsNoise *self); - -static PyObject * FrsNoise_turbulence1( BPy_FrsNoise *self, PyObject *args); -static PyObject * FrsNoise_turbulence2( BPy_FrsNoise *self, PyObject *args); -static PyObject * FrsNoise_turbulence3( BPy_FrsNoise *self, PyObject *args); -static PyObject * FrsNoise_smoothNoise1( BPy_FrsNoise *self, PyObject *args); -static PyObject * FrsNoise_smoothNoise2( BPy_FrsNoise *self, PyObject *args); -static PyObject * FrsNoise_smoothNoise3( BPy_FrsNoise *self, PyObject *args); - -/*----------------------FrsNoise instance definitions ----------------------------*/ -static PyMethodDef BPy_FrsNoise_methods[] = { - {"turbulence1", ( PyCFunction ) FrsNoise_turbulence1, METH_VARARGS, "(float arg, float freq, float amp, unsigned oct=4) Returns a noise value for a 1D element"}, - {"turbulence2", ( PyCFunction ) FrsNoise_turbulence2, METH_VARARGS, "([x, y], float freq, float amp, unsigned oct=4) Returns a noise value for a 2D element"}, - {"turbulence3", ( PyCFunction ) FrsNoise_turbulence3, METH_VARARGS, "([x, y, z], float freq, float amp, unsigned oct=4) Returns a noise value for a 3D element"}, - {"smoothNoise1", ( PyCFunction ) FrsNoise_smoothNoise1, METH_VARARGS, "(float arg) Returns a smooth noise value for a 1D element "}, - {"smoothNoise2", ( PyCFunction ) FrsNoise_smoothNoise2, METH_VARARGS, "([x, y]) Returns a smooth noise value for a 2D element "}, - {"smoothNoise3", ( PyCFunction ) FrsNoise_smoothNoise3, METH_VARARGS, "([x, y, z]) Returns a smooth noise value for a 3D element "}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_FrsNoise type definition ------------------------------*/ - -PyTypeObject FrsNoise_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FrsNoise", /* tp_name */ - sizeof(BPy_FrsNoise), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)FrsNoise___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)FrsNoise___repr__, /* 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 */ - "FrsNoise objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FrsNoise_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsNoise___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int FrsNoise_Init( PyObject *module ) { @@ -91,7 +25,14 @@ int FrsNoise_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int FrsNoise___init__(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) +static char FrsNoise___doc__[] = +"Class to provide Perlin noise functionalities.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Builds a Noise object.\n"; + +static int FrsNoise___init__(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { if(!( PyArg_ParseTuple(args, "") )) return -1; @@ -99,20 +40,35 @@ int FrsNoise___init__(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) return 0; } -void FrsNoise___dealloc__(BPy_FrsNoise* self) +static void FrsNoise___dealloc__(BPy_FrsNoise* self) { delete self->n; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * FrsNoise___repr__(BPy_FrsNoise* self) +static PyObject * FrsNoise___repr__(BPy_FrsNoise* self) { return PyUnicode_FromFormat("FrsNoise - address: %p", self->n ); } - -PyObject * FrsNoise_turbulence1( BPy_FrsNoise *self , PyObject *args) { +static char FrsNoise_turbulence1___doc__[] = +".. method:: turbulence1(v, freq, amp, oct=4)\n" +"\n" +" Returns a noise value for a 1D element.\n" +"\n" +" :arg v: One-dimensional sample point.\n" +" :type v: float\n" +" :arg freq: Noise frequency.\n" +" :type freq: float\n" +" :arg amp: Amplitude.\n" +" :type amp: float\n" +" :arg oct: Number of octaves.\n" +" :type oct: int\n" +" :return: A noise value.\n" +" :rtype: float\n"; + +static PyObject * FrsNoise_turbulence1( BPy_FrsNoise *self , PyObject *args) { float f1, f2, f3; unsigned int i = 4; @@ -122,7 +78,23 @@ PyObject * FrsNoise_turbulence1( BPy_FrsNoise *self , PyObject *args) { return PyFloat_FromDouble( self->n->turbulence1(f1, f2, f3, i) ); } -PyObject * FrsNoise_turbulence2( BPy_FrsNoise *self , PyObject *args) { +static char FrsNoise_turbulence2___doc__[] = +".. method:: turbulence2(v, freq, amp, oct=4)\n" +"\n" +" Returns a noise value for a 2D element.\n" +"\n" +" :arg v: Two-dimensional sample point.\n" +" :type v: :class:`Mathutils.Vector`, list or tuple of 2 real numbers\n" +" :arg freq: Noise frequency.\n" +" :type freq: float\n" +" :arg amp: Amplitude.\n" +" :type amp: float\n" +" :arg oct: Number of octaves.\n" +" :type oct: int\n" +" :return: A noise value.\n" +" :rtype: float\n"; + +static PyObject * FrsNoise_turbulence2( BPy_FrsNoise *self , PyObject *args) { PyObject *obj1; float f2, f3; unsigned int i = 4; @@ -139,7 +111,23 @@ PyObject * FrsNoise_turbulence2( BPy_FrsNoise *self , PyObject *args) { return PyFloat_FromDouble( t ); } -PyObject * FrsNoise_turbulence3( BPy_FrsNoise *self , PyObject *args) { +static char FrsNoise_turbulence3___doc__[] = +".. method:: turbulence3(v, freq, amp, oct=4)\n" +"\n" +" Returns a noise value for a 3D element.\n" +"\n" +" :arg v: Three-dimensional sample point.\n" +" :type v: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n" +" :arg freq: Noise frequency.\n" +" :type freq: float\n" +" :arg amp: Amplitude.\n" +" :type amp: float\n" +" :arg oct: Number of octaves.\n" +" :type oct: int\n" +" :return: A noise value.\n" +" :rtype: float\n"; + +static PyObject * FrsNoise_turbulence3( BPy_FrsNoise *self , PyObject *args) { PyObject *obj1; float f2, f3; unsigned int i = 4; @@ -156,7 +144,17 @@ PyObject * FrsNoise_turbulence3( BPy_FrsNoise *self , PyObject *args) { return PyFloat_FromDouble( t ); } -PyObject * FrsNoise_smoothNoise1( BPy_FrsNoise *self , PyObject *args) { +static char FrsNoise_smoothNoise1___doc__[] = +".. method:: smoothNoise1(v)\n" +"\n" +" Returns a smooth noise value for a 1D element.\n" +"\n" +" :arg v: One-dimensional sample point.\n" +" :type v: float\n" +" :return: A smooth noise value.\n" +" :rtype: float\n"; + +static PyObject * FrsNoise_smoothNoise1( BPy_FrsNoise *self , PyObject *args) { float f; if(!( PyArg_ParseTuple(args, "f", &f) )) @@ -165,7 +163,17 @@ PyObject * FrsNoise_smoothNoise1( BPy_FrsNoise *self , PyObject *args) { return PyFloat_FromDouble( self->n->smoothNoise1(f) ); } -PyObject * FrsNoise_smoothNoise2( BPy_FrsNoise *self , PyObject *args) { +static char FrsNoise_smoothNoise2___doc__[] = +".. method:: smoothNoise2(v)\n" +"\n" +" Returns a smooth noise value for a 2D element.\n" +"\n" +" :arg v: Two-dimensional sample point.\n" +" :type v: :class:`Mathutils.Vector`, list or tuple of 2 real numbers\n" +" :return: A smooth noise value.\n" +" :rtype: float\n"; + +static PyObject * FrsNoise_smoothNoise2( BPy_FrsNoise *self , PyObject *args) { PyObject *obj; if(!( PyArg_ParseTuple(args, "O", &obj) )) @@ -180,7 +188,17 @@ PyObject * FrsNoise_smoothNoise2( BPy_FrsNoise *self , PyObject *args) { return PyFloat_FromDouble( t ); } -PyObject * FrsNoise_smoothNoise3( BPy_FrsNoise *self , PyObject *args) { +static char FrsNoise_smoothNoise3___doc__[] = +".. method:: smoothNoise3(v)\n" +"\n" +" Returns a smooth noise value for a 3D element.\n" +"\n" +" :arg v: Three-dimensional sample point.\n" +" :type v: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n" +" :return: A smooth noise value.\n" +" :rtype: float\n"; + +static PyObject * FrsNoise_smoothNoise3( BPy_FrsNoise *self , PyObject *args) { PyObject *obj; if(!( PyArg_ParseTuple(args, "O", &obj) )) @@ -195,6 +213,59 @@ PyObject * FrsNoise_smoothNoise3( BPy_FrsNoise *self , PyObject *args) { return PyFloat_FromDouble( t ); } +/*----------------------FrsNoise instance definitions ----------------------------*/ +static PyMethodDef BPy_FrsNoise_methods[] = { + {"turbulence1", ( PyCFunction ) FrsNoise_turbulence1, METH_VARARGS, FrsNoise_turbulence1___doc__}, + {"turbulence2", ( PyCFunction ) FrsNoise_turbulence2, METH_VARARGS, FrsNoise_turbulence2___doc__}, + {"turbulence3", ( PyCFunction ) FrsNoise_turbulence3, METH_VARARGS, FrsNoise_turbulence3___doc__}, + {"smoothNoise1", ( PyCFunction ) FrsNoise_smoothNoise1, METH_VARARGS, FrsNoise_smoothNoise1___doc__}, + {"smoothNoise2", ( PyCFunction ) FrsNoise_smoothNoise2, METH_VARARGS, FrsNoise_smoothNoise2___doc__}, + {"smoothNoise3", ( PyCFunction ) FrsNoise_smoothNoise3, METH_VARARGS, FrsNoise_smoothNoise3___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_FrsNoise type definition ------------------------------*/ + +PyTypeObject FrsNoise_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "FrsNoise", /* tp_name */ + sizeof(BPy_FrsNoise), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)FrsNoise___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)FrsNoise___repr__, /* 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 */ + FrsNoise___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_FrsNoise_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsNoise___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Id.cpp b/source/blender/freestyle/intern/python/BPy_Id.cpp index 3c157230cff..9254badd95d 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.cpp +++ b/source/blender/freestyle/intern/python/BPy_Id.cpp @@ -8,69 +8,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Id instance -----------*/ -static int Id___init__(BPy_Id *self, PyObject *args, PyObject *kwds); -static void Id___dealloc__(BPy_Id *self); -static PyObject * Id___repr__(BPy_Id* self); -static PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid); - -static PyObject * Id_getFirst( BPy_Id *self ); -static PyObject * Id_getSecond( BPy_Id *self); -static PyObject * Id_setFirst( BPy_Id *self , PyObject *args); -static PyObject * Id_setSecond( BPy_Id *self , PyObject *args); - -/*----------------------Id instance definitions ----------------------------*/ -static PyMethodDef BPy_Id_methods[] = { - {"getFirst", ( PyCFunction ) Id_getFirst, METH_NOARGS, "Returns the first Id number"}, - {"getSecond", ( PyCFunction ) Id_getSecond, METH_NOARGS, "Returns the second Id number" }, - {"setFirst", ( PyCFunction ) Id_setFirst, METH_VARARGS, "Sets the first number constituing the Id" }, - {"setSecond", ( PyCFunction ) Id_setSecond, METH_VARARGS, "Sets the second number constituing the Id" }, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_Id type definition ------------------------------*/ - -PyTypeObject Id_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Id", /* tp_name */ - sizeof(BPy_Id), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Id___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Id___repr__, /* 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 */ - "Id objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)Id_RichCompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Id_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Id___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int Id_Init( PyObject *module ) { @@ -87,7 +24,35 @@ int Id_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int Id___init__(BPy_Id *self, PyObject *args, PyObject *kwds) +static char Id___doc__[] = +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: An Id object.\n" +" :type iBrother: :class:`Id`\n" +"\n" +".. method:: __init__(iFirst)\n" +"\n" +" Builds an Id from an integer. The second number is set to 0.\n" +"\n" +" :arg iFirst: The first Id number.\n" +" :type iFirst: int\n" +"\n" +".. method:: __init__(iFirst, iSecond)\n" +"\n" +" Builds the Id from the two numbers.\n" +"\n" +" :arg iFirst: The first Id number.\n" +" :type iFirst: int\n" +" :arg iSecond: The second Id number.\n" +" :type iSecond: int\n"; + +static int Id___init__(BPy_Id *self, PyObject *args, PyObject *kwds) { int first = 0, second = 0; static char *kwlist[] = {"first", "second", NULL}; @@ -100,28 +65,50 @@ int Id___init__(BPy_Id *self, PyObject *args, PyObject *kwds) return 0; } -void Id___dealloc__(BPy_Id* self) +static void Id___dealloc__(BPy_Id* self) { delete self->id; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * Id___repr__(BPy_Id* self) +static PyObject * Id___repr__(BPy_Id* self) { return PyUnicode_FromFormat("[ first: %i, second: %i ](BPy_Id)", self->id->getFirst(), self->id->getSecond() ); } -PyObject *Id_getFirst( BPy_Id *self ) { +static char Id_getFirst___doc__[] = +".. method:: getFirst()\n" +"\n" +" Returns the first Id number.\n" +"\n" +" :return: The first Id number.\n" +" :rtype: int\n"; + +static PyObject *Id_getFirst( BPy_Id *self ) { return PyLong_FromLong( self->id->getFirst() ); } +static char Id_getSecond___doc__[] = +".. method:: getSecond()\n" +"\n" +" Returns the second Id number.\n" +"\n" +" :return: The second Id number.\n" +" :rtype: int\n"; -PyObject *Id_getSecond( BPy_Id *self) { +static PyObject *Id_getSecond( BPy_Id *self) { return PyLong_FromLong( self->id->getSecond() ); } +static char Id_setFirst___doc__[] = +".. method:: setFirst(iFirst)\n" +"\n" +" Sets the first number constituting the Id.\n" +"\n" +" :arg iFirst: The first number constituting the Id.\n" +" :type iFirst: int\n"; -PyObject *Id_setFirst( BPy_Id *self , PyObject *args) { +static PyObject *Id_setFirst( BPy_Id *self , PyObject *args) { unsigned int i; if( !PyArg_ParseTuple(args, "i", &i) ) @@ -132,8 +119,15 @@ PyObject *Id_setFirst( BPy_Id *self , PyObject *args) { Py_RETURN_NONE; } +static char Id_setSecond___doc__[] = +".. method:: setSecond(iSecond)\n" +"\n" +" Sets the second number constituting the Id.\n" +"\n" +" :arg iSecond: The second number constituting the Id.\n" +" :type iSecond: int\n"; -PyObject *Id_setSecond( BPy_Id *self , PyObject *args) { +static PyObject *Id_setSecond( BPy_Id *self , PyObject *args) { unsigned int i; if( !PyArg_ParseTuple(args, "i", &i) ) @@ -144,7 +138,7 @@ PyObject *Id_setSecond( BPy_Id *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) { +static PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) { switch(opid){ case Py_LT: return PyBool_from_bool( o1->id->operator<(*(o2->id)) ); @@ -169,6 +163,57 @@ PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) { Py_RETURN_NONE; } +/*----------------------Id instance definitions ----------------------------*/ +static PyMethodDef BPy_Id_methods[] = { + {"getFirst", ( PyCFunction ) Id_getFirst, METH_NOARGS, Id_getFirst___doc__}, + {"getSecond", ( PyCFunction ) Id_getSecond, METH_NOARGS, Id_getSecond___doc__}, + {"setFirst", ( PyCFunction ) Id_setFirst, METH_VARARGS, Id_setFirst___doc__}, + {"setSecond", ( PyCFunction ) Id_setSecond, METH_VARARGS, Id_setSecond___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_Id type definition ------------------------------*/ + +PyTypeObject Id_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Id", /* tp_name */ + sizeof(BPy_Id), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Id___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)Id___repr__, /* 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 */ + Id___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)Id_RichCompare, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Id_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Id___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index e55dff0ae87..050f75a2668 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -12,7 +12,88 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -static PyObject * Integrator_integrate( PyObject *self, PyObject *args ); +//------------------------ MODULE FUNCTIONS ---------------------------------- + +static char Integrator_integrate___doc__[] = +".. function:: integrate(fun, it, it_end, integration_type)\n" +"\n" +" Returns a single value from a set of values evaluated at each 0D\n" +" element of this 1D element.\n" +"\n" +" :arg fun: The UnaryFunction0D used to compute a value at each\n" +" Interface0D.\n" +" :type fun: :class:`UnaryFunction0D`\n" +" :arg it: The Interface0DIterator used to iterate over the 0D\n" +" elements of this 1D element. The integration will occur over\n" +" the 0D elements starting from the one pointed by it.\n" +" :type it: :class:`Interface0DIterator`\n" +" :arg it_end: The Interface0DIterator pointing the end of the 0D\n" +" elements of the 1D element.\n" +" :type it_end: :class:`Interface0DIterator`\n" +" :arg integration_type: The integration method used to compute a\n" +" single value from a set of values.\n" +" :type integration_type: :class:`IntegrationType`\n" +" :return: The single value obtained for the 1D element. The return\n" +" value type is float if fun is of the :class:`UnaryFunction0DDouble`\n" +" or :class:`UnaryFunction0DFloat` type, and int if fun is of the\n" +" :class:`UnaryFunction0DUnsigned` type.\n" +" :rtype: int or float\n"; + +static PyObject * Integrator_integrate( PyObject *self, PyObject *args ) +{ + PyObject *obj1, *obj4 = 0; + BPy_Interface0DIterator *obj2, *obj3; + +#if 1 + if(!( PyArg_ParseTuple(args, "O!O!O!|O!", &UnaryFunction0D_Type, &obj1, + &Interface0DIterator_Type, &obj2, &Interface0DIterator_Type, &obj3, + &IntegrationType_Type, &obj4) )) + return NULL; +#else + if(!( PyArg_ParseTuple(args, "OOO|O", &obj1, &obj2, &obj3, &obj4) )) + return NULL; + if(!BPy_UnaryFunction0D_Check(obj1)) { + PyErr_SetString(PyExc_TypeError, "argument 1 must be a UnaryFunction0D object"); + return NULL; + } + if(!BPy_Interface0DIterator_Check(obj2)) { + PyErr_SetString(PyExc_TypeError, "argument 2 must be a Interface0DIterator object"); + return NULL; + } + if(!BPy_Interface0DIterator_Check(obj3)) { + PyErr_SetString(PyExc_TypeError, "argument 3 must be a Interface0DIterator object"); + return NULL; + } + if(obj4 && !BPy_IntegrationType_Check(obj4)) { + PyErr_SetString(PyExc_TypeError, "argument 4 must be a IntegrationType object"); + return NULL; + } +#endif + + Interface0DIterator it(*(obj2->if0D_it)), it_end(*(obj3->if0D_it)); + IntegrationType t = ( obj4 ) ? IntegrationType_from_BPy_IntegrationType( obj4 ) : MEAN; + + if( BPy_UnaryFunction0DDouble_Check(obj1) ) { + UnaryFunction0D<double> *fun = ((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double; + double res = integrate( *fun, it, it_end, t ); + return PyFloat_FromDouble( res ); + + } else if( BPy_UnaryFunction0DFloat_Check(obj1) ) { + UnaryFunction0D<float> *fun = ((BPy_UnaryFunction0DFloat *)obj1)->uf0D_float; + float res = integrate( *fun, it, it_end, t ); + return PyFloat_FromDouble( res ); + + } else if( BPy_UnaryFunction0DUnsigned_Check(obj1) ) { + UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; + unsigned int res = integrate( *fun, it, it_end, t ); + return PyLong_FromLong( res ); + + } else { + string msg("unsupported function type: " + string(obj1->ob_type->tp_name)); + PyErr_SetString(PyExc_TypeError, msg.c_str()); + return NULL; + } +} /*-----------------------Integrator module docstring---------------------------------------*/ @@ -21,7 +102,7 @@ static char module_docstring[] = "The Blender Freestyle.Integrator submodule\n\n /*-----------------------Integrator module functions definitions---------------------------*/ static PyMethodDef module_functions[] = { - {"integrate", (PyCFunction)Integrator_integrate, METH_VARARGS, ""}, + {"integrate", (PyCFunction) Integrator_integrate, METH_VARARGS, Integrator_integrate___doc__}, {NULL, NULL, 0, NULL} }; @@ -37,6 +118,22 @@ static PyModuleDef module_definition = { /*-----------------------BPy_IntegrationType type definition ------------------------------*/ +static char IntegrationType___doc__[] = +"Different integration methods that can be invoked to integrate into a\n" +"single value the set of values obtained from each 0D element of an 1D\n" +"element:\n" +"\n" +"* IntegrationType.MEAN: The value computed for the 1D element is the\n" +" mean of the values obtained for the 0D elements.\n" +"* IntegrationType.MIN: The value computed for the 1D element is the\n" +" minimum of the values obtained for the 0D elements.\n" +"* IntegrationType.MAX: The value computed for the 1D element is the\n" +" maximum of the values obtained for the 0D elements.\n" +"* IntegrationType.FIRST: The value computed for the 1D element is the\n" +" first of the values obtained for the 0D elements.\n" +"* IntegrationType.LAST: The value computed for the 1D element is the\n" +" last of the values obtained for the 0D elements.\n"; + PyTypeObject IntegrationType_Type = { PyVarObject_HEAD_INIT(NULL, 0) "IntegrationType", /* tp_name */ @@ -58,7 +155,7 @@ PyTypeObject IntegrationType_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - "IntegrationType objects", /* tp_doc */ + IntegrationType___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -143,64 +240,6 @@ int IntegrationType_Init( PyObject *module ) return 0; } -//------------------------ MODULE FUNCTIONS ---------------------------------- - -static PyObject * Integrator_integrate( PyObject *self, PyObject *args ) -{ - PyObject *obj1, *obj4 = 0; - BPy_Interface0DIterator *obj2, *obj3; - -#if 1 - if(!( PyArg_ParseTuple(args, "O!O!O!|O!", &UnaryFunction0D_Type, &obj1, - &Interface0DIterator_Type, &obj2, &Interface0DIterator_Type, &obj3, - &IntegrationType_Type, &obj4) )) - return NULL; -#else - if(!( PyArg_ParseTuple(args, "OOO|O", &obj1, &obj2, &obj3, &obj4) )) - return NULL; - if(!BPy_UnaryFunction0D_Check(obj1)) { - PyErr_SetString(PyExc_TypeError, "argument 1 must be a UnaryFunction0D object"); - return NULL; - } - if(!BPy_Interface0DIterator_Check(obj2)) { - PyErr_SetString(PyExc_TypeError, "argument 2 must be a Interface0DIterator object"); - return NULL; - } - if(!BPy_Interface0DIterator_Check(obj3)) { - PyErr_SetString(PyExc_TypeError, "argument 3 must be a Interface0DIterator object"); - return NULL; - } - if(obj4 && !BPy_IntegrationType_Check(obj4)) { - PyErr_SetString(PyExc_TypeError, "argument 4 must be a IntegrationType object"); - return NULL; - } -#endif - - Interface0DIterator it(*(obj2->if0D_it)), it_end(*(obj3->if0D_it)); - IntegrationType t = ( obj4 ) ? IntegrationType_from_BPy_IntegrationType( obj4 ) : MEAN; - - if( BPy_UnaryFunction0DDouble_Check(obj1) ) { - UnaryFunction0D<double> *fun = ((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double; - double res = integrate( *fun, it, it_end, t ); - return PyFloat_FromDouble( res ); - - } else if( BPy_UnaryFunction0DFloat_Check(obj1) ) { - UnaryFunction0D<float> *fun = ((BPy_UnaryFunction0DFloat *)obj1)->uf0D_float; - float res = integrate( *fun, it, it_end, t ); - return PyFloat_FromDouble( res ); - - } else if( BPy_UnaryFunction0DUnsigned_Check(obj1) ) { - UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; - unsigned int res = integrate( *fun, it, it_end, t ); - return PyLong_FromLong( res ); - - } else { - string msg("unsupported function type: " + string(obj1->ob_type->tp_name)); - PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; - } -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp index 6e170e8e0b7..efa14848316 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp @@ -16,84 +16,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Interface0D instance -----------*/ -static int Interface0D___init__(BPy_Interface0D *self, PyObject *args, PyObject *kwds); -static void Interface0D___dealloc__(BPy_Interface0D *self); -static PyObject * Interface0D___repr__(BPy_Interface0D *self); - -static PyObject *Interface0D_getExactTypeName( BPy_Interface0D *self ); -static PyObject *Interface0D_getX( BPy_Interface0D *self ); -static PyObject *Interface0D_getY( BPy_Interface0D *self ); -static PyObject *Interface0D_getZ( BPy_Interface0D *self ); -static PyObject *Interface0D_getPoint3D( BPy_Interface0D *self ); -static PyObject *Interface0D_getProjectedX( BPy_Interface0D *self ); -static PyObject *Interface0D_getProjectedY( BPy_Interface0D *self ); -static PyObject *Interface0D_getProjectedZ( BPy_Interface0D *self ); -static PyObject *Interface0D_getPoint2D( BPy_Interface0D *self ); -static PyObject *Interface0D_getFEdge( BPy_Interface0D *self, PyObject *args ); -static PyObject *Interface0D_getId( BPy_Interface0D *self ); -static PyObject *Interface0D_getNature( BPy_Interface0D *self ); - -/*----------------------Interface0D instance definitions ----------------------------*/ -static PyMethodDef BPy_Interface0D_methods[] = { - {"getExactTypeName", ( PyCFunction ) Interface0D_getExactTypeName, METH_NOARGS, "() Returns the string of the name of the interface."}, - {"getX", ( PyCFunction ) Interface0D_getX, METH_NOARGS, "() Returns the 3D x coordinate of the point. "}, - {"getY", ( PyCFunction ) Interface0D_getY, METH_NOARGS, "() Returns the 3D y coordinate of the point. "}, - {"getZ", ( PyCFunction ) Interface0D_getZ, METH_NOARGS, "() Returns the 3D z coordinate of the point. "}, - {"getPoint3D", ( PyCFunction ) Interface0D_getPoint3D, METH_NOARGS, "() Returns the 3D point."}, - {"getProjectedX", ( PyCFunction ) Interface0D_getProjectedX, METH_NOARGS, "() Returns the 2D x coordinate of the point."}, - {"getProjectedY", ( PyCFunction ) Interface0D_getProjectedY, METH_NOARGS, "() Returns the 2D y coordinate of the point."}, - {"getProjectedZ", ( PyCFunction ) Interface0D_getProjectedZ, METH_NOARGS, "() Returns the 2D z coordinate of the point."}, - {"getPoint2D", ( PyCFunction ) Interface0D_getPoint2D, METH_NOARGS, "() Returns the 2D point."}, - {"getFEdge", ( PyCFunction ) Interface0D_getFEdge, METH_VARARGS, "(Interface0D i) Returns the FEdge that lies between this Interface0D and the Interface0D given as argument."}, - {"getId", ( PyCFunction ) Interface0D_getId, METH_NOARGS, "() Returns the Id of the point."}, - {"getNature", ( PyCFunction ) Interface0D_getNature, METH_NOARGS, "() Returns the nature of the point."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_Interface0D type definition ------------------------------*/ - -PyTypeObject Interface0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Interface0D", /* tp_name */ - sizeof(BPy_Interface0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Interface0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Interface0D___repr__, /* 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 */ - "Interface0D objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Interface0D_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Interface0D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int Interface0D_Init( PyObject *module ) { @@ -140,7 +62,14 @@ int Interface0D_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int Interface0D___init__(BPy_Interface0D *self, PyObject *args, PyObject *kwds) +static char Interface0D___doc__[] = +"Base class for any 0D element.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int Interface0D___init__(BPy_Interface0D *self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -149,88 +78,162 @@ int Interface0D___init__(BPy_Interface0D *self, PyObject *args, PyObject *kwds) return 0; } -void Interface0D___dealloc__(BPy_Interface0D* self) +static void Interface0D___dealloc__(BPy_Interface0D* self) { if( self->if0D && !self->borrowed ) delete self->if0D; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * Interface0D___repr__(BPy_Interface0D* self) +static PyObject * Interface0D___repr__(BPy_Interface0D* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->if0D->getExactTypeName().c_str(), self->if0D ); } -PyObject *Interface0D_getExactTypeName( BPy_Interface0D *self ) { +static char Interface0D_getExactTypeName___doc__[] = +".. method:: getExactTypeName()\n" +"\n" +" Returns the name of the 0D element.\n" +"\n" +" :return: Name of the interface.\n" +" :rtype: string\n"; + +static PyObject *Interface0D_getExactTypeName( BPy_Interface0D *self ) { return PyUnicode_FromFormat( self->if0D->getExactTypeName().c_str() ); } +static char Interface0D_getX___doc__[] = +".. method:: getX()\n" +"\n" +" Returns the X coordinate of the 3D point of the 0D element.\n" +"\n" +" :return: The X coordinate of the 3D point.\n" +" :rtype: float\n"; -PyObject *Interface0D_getX( BPy_Interface0D *self ) { +static PyObject *Interface0D_getX( BPy_Interface0D *self ) { double x = self->if0D->getX(); if (PyErr_Occurred()) return NULL; return PyFloat_FromDouble( x ); } +static char Interface0D_getY___doc__[] = +".. method:: getY()\n" +"\n" +" Returns the Y coordinate of the 3D point of the 0D element.\n" +"\n" +" :return: The Y coordinate of the 3D point.\n" +" :rtype: float\n"; -PyObject *Interface0D_getY( BPy_Interface0D *self ) { +static PyObject *Interface0D_getY( BPy_Interface0D *self ) { double y = self->if0D->getY(); if (PyErr_Occurred()) return NULL; return PyFloat_FromDouble( y ); } +static char Interface0D_getZ___doc__[] = +".. method:: getZ()\n" +"\n" +" Returns the Z coordinate of the 3D point of the 0D element.\n" +"\n" +" :return: The Z coordinate of the 3D point.\n" +" :rtype: float\n"; -PyObject *Interface0D_getZ( BPy_Interface0D *self ) { +static PyObject *Interface0D_getZ( BPy_Interface0D *self ) { double z = self->if0D->getZ(); if (PyErr_Occurred()) return NULL; return PyFloat_FromDouble( z ); } +static char Interface0D_getPoint3D___doc__[] = +".. method:: getPoint3D()\n" +"\n" +" Returns the location of the 0D element in the 3D space.\n" +"\n" +" :return: The 3D point of the 0D element.\n" +" :rtype: :class:`Mathutils.Vector`\n"; -PyObject *Interface0D_getPoint3D( BPy_Interface0D *self ) { +static PyObject *Interface0D_getPoint3D( BPy_Interface0D *self ) { Vec3f v( self->if0D->getPoint3D() ); if (PyErr_Occurred()) return NULL; return Vector_from_Vec3f( v ); } +static char Interface0D_getProjectedX___doc__[] = +".. method:: getProjectedX()\n" +"\n" +" Returns the X coordinate of the 2D point of the 0D element.\n" +"\n" +" :return: The X coordinate of the 2D point.\n" +" :rtype: float\n"; -PyObject *Interface0D_getProjectedX( BPy_Interface0D *self ) { +static PyObject *Interface0D_getProjectedX( BPy_Interface0D *self ) { double x = self->if0D->getProjectedX(); if (PyErr_Occurred()) return NULL; return PyFloat_FromDouble( x ); } +static char Interface0D_getProjectedY___doc__[] = +".. method:: getProjectedY()\n" +"\n" +" Returns the Y coordinate of the 2D point of the 0D element.\n" +"\n" +" :return: The Y coordinate of the 2D point.\n" +" :rtype: float\n"; -PyObject *Interface0D_getProjectedY( BPy_Interface0D *self ) { +static PyObject *Interface0D_getProjectedY( BPy_Interface0D *self ) { double y = self->if0D->getProjectedY(); if (PyErr_Occurred()) return NULL; return PyFloat_FromDouble( y ); } +static char Interface0D_getProjectedZ___doc__[] = +".. method:: getProjectedZ()\n" +"\n" +" Returns the Z coordinate of the 2D point of the 0D element.\n" +"\n" +" :return: The Z coordinate of the 2D point.\n" +" :rtype: float\n"; -PyObject *Interface0D_getProjectedZ( BPy_Interface0D *self ) { +static PyObject *Interface0D_getProjectedZ( BPy_Interface0D *self ) { double z = self->if0D->getProjectedZ(); if (PyErr_Occurred()) return NULL; return PyFloat_FromDouble( z ); } +static char Interface0D_getPoint2D___doc__[] = +".. method:: getPoint2D()\n" +"\n" +" Returns the location of the 0D element in the 2D space.\n" +"\n" +" :return: The 2D point of the 0D element.\n" +" :rtype: :class:`Mathutils.Vector`\n"; -PyObject *Interface0D_getPoint2D( BPy_Interface0D *self ) { +static PyObject *Interface0D_getPoint2D( BPy_Interface0D *self ) { Vec2f v( self->if0D->getPoint2D() ); if (PyErr_Occurred()) return NULL; return Vector_from_Vec2f( v ); } - -PyObject *Interface0D_getFEdge( BPy_Interface0D *self, PyObject *args ) { +static char Interface0D_getFEdge___doc__[] = +".. method:: getFEdge(inter)\n" +"\n" +" Returns the FEdge that lies between this 0D element and the 0D\n" +" element given as the argument.\n" +"\n" +" :arg inter: A 0D element.\n" +" :type inter: :class:`Interface0D`\n" +" :return: The FEdge lying between the two 0D elements.\n" +" :rtype: :class:`FEdge`\n"; + +static PyObject *Interface0D_getFEdge( BPy_Interface0D *self, PyObject *args ) { PyObject *py_if0D; if(!( PyArg_ParseTuple(args, "O!", &Interface0D_Type, &py_if0D) )) @@ -245,22 +248,103 @@ PyObject *Interface0D_getFEdge( BPy_Interface0D *self, PyObject *args ) { Py_RETURN_NONE; } +static char Interface0D_getId___doc__[] = +".. method:: getId()\n" +"\n" +" Returns the identifier of the 0D element.\n" +"\n" +" :return: The identifier of the 0D element.\n" +" :rtype: :class:`Id`\n"; -PyObject *Interface0D_getId( BPy_Interface0D *self ) { +static PyObject *Interface0D_getId( BPy_Interface0D *self ) { Id id( self->if0D->getId() ); if (PyErr_Occurred()) return NULL; return BPy_Id_from_Id( id ); } +static char Interface0D_getNature___doc__[] = +".. method:: getNature()\n" +"\n" +" Returns the nature of the 0D element.\n" +"\n" +" :return: The nature of the 0D element.\n" +" :rtype: :class:`Nature`\n"; -PyObject *Interface0D_getNature( BPy_Interface0D *self ) { +static PyObject *Interface0D_getNature( BPy_Interface0D *self ) { Nature::VertexNature nature = self->if0D->getNature(); if (PyErr_Occurred()) return NULL; return BPy_Nature_from_Nature( nature ); } +/*----------------------Interface0D instance definitions ----------------------------*/ +static PyMethodDef BPy_Interface0D_methods[] = { + {"getExactTypeName", ( PyCFunction ) Interface0D_getExactTypeName, METH_NOARGS, Interface0D_getExactTypeName___doc__}, + {"getX", ( PyCFunction ) Interface0D_getX, METH_NOARGS, Interface0D_getX___doc__}, + {"getY", ( PyCFunction ) Interface0D_getY, METH_NOARGS, Interface0D_getY___doc__}, + {"getZ", ( PyCFunction ) Interface0D_getZ, METH_NOARGS, Interface0D_getZ___doc__}, + {"getPoint3D", ( PyCFunction ) Interface0D_getPoint3D, METH_NOARGS, Interface0D_getPoint3D___doc__}, + {"getProjectedX", ( PyCFunction ) Interface0D_getProjectedX, METH_NOARGS, Interface0D_getProjectedX___doc__}, + {"getProjectedY", ( PyCFunction ) Interface0D_getProjectedY, METH_NOARGS, Interface0D_getProjectedY___doc__}, + {"getProjectedZ", ( PyCFunction ) Interface0D_getProjectedZ, METH_NOARGS, Interface0D_getProjectedZ___doc__}, + {"getPoint2D", ( PyCFunction ) Interface0D_getPoint2D, METH_NOARGS, Interface0D_getPoint2D___doc__}, + {"getFEdge", ( PyCFunction ) Interface0D_getFEdge, METH_VARARGS, Interface0D_getFEdge___doc__}, + {"getId", ( PyCFunction ) Interface0D_getId, METH_NOARGS, Interface0D_getId___doc__}, + {"getNature", ( PyCFunction ) Interface0D_getNature, METH_NOARGS, Interface0D_getNature___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_Interface0D type definition ------------------------------*/ + +PyTypeObject Interface0D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Interface0D", /* tp_name */ + sizeof(BPy_Interface0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Interface0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)Interface0D___repr__, /* 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 */ + Interface0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Interface0D_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Interface0D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0 /* tp_del */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index 9f4bb75411d..f35ef62030d 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -17,85 +17,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Interface1D instance -----------*/ -static int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds); -static void Interface1D___dealloc__(BPy_Interface1D *self); -static PyObject * Interface1D___repr__(BPy_Interface1D *self); - -static PyObject *Interface1D_getExactTypeName( BPy_Interface1D *self ); -static PyObject *Interface1D_getVertices( BPy_Interface1D *self ); -static PyObject *Interface1D_getPoints( BPy_Interface1D *self ); -static PyObject *Interface1D_getLength2D( BPy_Interface1D *self ); -static PyObject *Interface1D_getId( BPy_Interface1D *self ); -static PyObject *Interface1D_getNature( BPy_Interface1D *self ); -static PyObject *Interface1D_getTimeStamp( BPy_Interface1D *self ); -static PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args); -static PyObject * Interface1D_verticesBegin( BPy_Interface1D *self ); -static PyObject * Interface1D_verticesEnd( BPy_Interface1D *self ); -static PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ); -static PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ); - -/*----------------------Interface1D instance definitions ----------------------------*/ -static PyMethodDef BPy_Interface1D_methods[] = { - {"getExactTypeName", ( PyCFunction ) Interface1D_getExactTypeName, METH_NOARGS, "() Returns the string of the name of the interface."}, - {"getVertices", ( PyCFunction ) Interface1D_getVertices, METH_NOARGS, "Returns the vertices"}, - {"getPoints", ( PyCFunction ) Interface1D_getPoints, METH_NOARGS, "Returns the points. The difference with getVertices() is that here we can iterate over points of the 1D element at any given sampling. At each call, a virtual point is created."}, - {"getLength2D", ( PyCFunction ) Interface1D_getLength2D, METH_NOARGS, "Returns the 2D length of the 1D element"}, - {"getId", ( PyCFunction ) Interface1D_getId, METH_NOARGS, "Returns the Id of the 1D element"}, - {"getNature", ( PyCFunction ) Interface1D_getNature, METH_NOARGS, "Returns the nature of the 1D element"}, - {"getTimeStamp", ( PyCFunction ) Interface1D_getTimeStamp, METH_NOARGS, "Returns the time stamp of the 1D element. Mainly used for selection"}, - {"setTimeStamp", ( PyCFunction ) Interface1D_setTimeStamp, METH_VARARGS, "Sets the time stamp for the 1D element"}, - {"verticesBegin", ( PyCFunction ) Interface1D_verticesBegin, METH_NOARGS, ""}, - {"verticesEnd", ( PyCFunction ) Interface1D_verticesEnd, METH_NOARGS, ""}, - {"pointsBegin", ( PyCFunction ) Interface1D_pointsBegin, METH_VARARGS, ""}, - {"pointsEnd", ( PyCFunction ) Interface1D_pointsEnd, METH_VARARGS, ""}, - - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_Interface1D type definition ------------------------------*/ - -PyTypeObject Interface1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Interface1D", /* tp_name */ - sizeof(BPy_Interface1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Interface1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Interface1D___repr__, /* 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 */ - "Interface1D objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Interface1D_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Interface1D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int Interface1D_Init( PyObject *module ) { @@ -151,7 +72,14 @@ int Interface1D_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds) +static char Interface1D___doc__[] = +"Base class for any 1D element.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -160,48 +88,98 @@ int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds) return 0; } -void Interface1D___dealloc__(BPy_Interface1D* self) +static void Interface1D___dealloc__(BPy_Interface1D* self) { if( self->if1D && !self->borrowed ) delete self->if1D; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * Interface1D___repr__(BPy_Interface1D* self) +static PyObject * Interface1D___repr__(BPy_Interface1D* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->if1D->getExactTypeName().c_str(), self->if1D ); } -PyObject *Interface1D_getExactTypeName( BPy_Interface1D *self ) { +static char Interface1D_getExactTypeName___doc__[] = +".. method:: getExactTypeName()\n" +"\n" +" Returns the string of the name of the 1D element.\n" +"\n" +" :return: The name of the 1D element.\n" +" :rtype: string\n"; + +static PyObject *Interface1D_getExactTypeName( BPy_Interface1D *self ) { return PyUnicode_FromFormat( self->if1D->getExactTypeName().c_str() ); } -PyObject *Interface1D_getVertices( BPy_Interface1D *self ) { +#if 0 +static PyObject *Interface1D_getVertices( BPy_Interface1D *self ) { return PyList_New(0); } -PyObject *Interface1D_getPoints( BPy_Interface1D *self ) { +static PyObject *Interface1D_getPoints( BPy_Interface1D *self ) { return PyList_New(0); } +#endif + +static char Interface1D_getLength2D___doc__[] = +".. method:: getLength2D()\n" +"\n" +" Returns the 2D length of the 1D element.\n" +"\n" +" :return: The 2D length of the 1D element.\n" +" :rtype: float\n"; -PyObject *Interface1D_getLength2D( BPy_Interface1D *self ) { +static PyObject *Interface1D_getLength2D( BPy_Interface1D *self ) { return PyFloat_FromDouble( (double) self->if1D->getLength2D() ); } -PyObject *Interface1D_getId( BPy_Interface1D *self ) { +static char Interface1D_getId___doc__[] = +".. method:: getId()\n" +"\n" +" Returns the Id of the 1D element .\n" +"\n" +" :return: The Id of the 1D element .\n" +" :rtype: :class:`Id`\n"; + +static PyObject *Interface1D_getId( BPy_Interface1D *self ) { Id id( self->if1D->getId() ); return BPy_Id_from_Id( id ); } -PyObject *Interface1D_getNature( BPy_Interface1D *self ) { +static char Interface1D_getNature___doc__[] = +".. method:: getNature()\n" +"\n" +" Returns the nature of the 1D element.\n" +"\n" +" :return: The nature of the 1D element.\n" +" :rtype: :class:`Nature`\n"; + +static PyObject *Interface1D_getNature( BPy_Interface1D *self ) { return BPy_Nature_from_Nature( self->if1D->getNature() ); } -PyObject *Interface1D_getTimeStamp( BPy_Interface1D *self ) { +static char Interface1D_getTimeStamp___doc__[] = +".. method:: getTimeStamp()\n" +"\n" +" Returns the time stamp of the 1D element. Mainly used for selection.\n" +"\n" +" :return: The time stamp of the 1D element.\n" +" :rtype: int\n"; + +static PyObject *Interface1D_getTimeStamp( BPy_Interface1D *self ) { return PyLong_FromLong( self->if1D->getTimeStamp() ); } -PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args) { +static char Interface1D_setTimeStamp___doc__[] = +".. method:: setTimeStamp(iTimeStamp)\n" +"\n" +" Sets the time stamp for the 1D element.\n" +"\n" +" :arg iTimeStamp: A time stamp.\n" +" :type iTimeStamp: int\n"; + +static PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args) { int timestamp = 0 ; if( !PyArg_ParseTuple(args, "i", ×tamp) ) @@ -212,18 +190,49 @@ PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args) { Py_RETURN_NONE; } -PyObject * Interface1D_verticesBegin( BPy_Interface1D *self ) { +static char Interface1D_verticesBegin___doc__[] = +".. method:: verticesBegin()\n" +"\n" +" Returns an iterator over the Interface1D vertices, pointing to the\n" +" first vertex.\n" +"\n" +" :return: An Interface0DIterator pointing to the first vertex.\n" +" :rtype: :class:`Interface0DIterator`\n"; + +static PyObject * Interface1D_verticesBegin( BPy_Interface1D *self ) { Interface0DIterator if0D_it( self->if1D->verticesBegin() ); return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it, 0 ); } -PyObject * Interface1D_verticesEnd( BPy_Interface1D *self ) { +static char Interface1D_verticesEnd___doc__[] = +".. method:: verticesEnd()\n" +"\n" +" Returns an iterator over the Interface1D vertices, pointing after\n" +" the last vertex.\n" +"\n" +" :return: An Interface0DIterator pointing after the last vertex.\n" +" :rtype: :class:`Interface0DIterator`\n"; + +static PyObject * Interface1D_verticesEnd( BPy_Interface1D *self ) { Interface0DIterator if0D_it( self->if1D->verticesEnd() ); return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it, 1 ); } - -PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ) { +static char Interface1D_pointsBegin___doc__[] = +".. method:: pointsBegin(t=0.0)\n" +"\n" +" Returns an iterator over the Interface1D points, pointing to the\n" +" first point. The difference with verticesBegin() is that here we can\n" +" iterate over points of the 1D element at a any given sampling.\n" +" Indeed, for each iteration, a virtual point is created.\n" +"\n" +" :arg t: A sampling with which we want to iterate over points of\n" +" this 1D element.\n" +" :type t: float\n" +" :return: An Interface0DIterator pointing to the first point.\n" +" :rtype: :class:`Interface0DIterator`\n"; + +static PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ) { float f = 0; if(!( PyArg_ParseTuple(args, "|f", &f) )) @@ -233,7 +242,21 @@ PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ) { return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it, 0 ); } -PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ) { +static char Interface1D_pointsEnd___doc__[] = +".. method:: pointsEnd(t=0.0)\n" +"\n" +" Returns an iterator over the Interface1D points, pointing after the\n" +" last point. The difference with verticesEnd() is that here we can\n" +" iterate over points of the 1D element at a given sampling. Indeed,\n" +" for each iteration, a virtual point is created.\n" +"\n" +" :arg t: A sampling with which we want to iterate over points of\n" +" this 1D element.\n" +" :type t: float\n" +" :return: An Interface0DIterator pointing after the last point.\n" +" :rtype: :class:`Interface0DIterator`\n"; + +static PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ) { float f = 0; if(!( PyArg_ParseTuple(args, "|f", &f) )) @@ -243,6 +266,68 @@ PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ) { return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it, 1 ); } +/*----------------------Interface1D instance definitions ----------------------------*/ +static PyMethodDef BPy_Interface1D_methods[] = { + {"getExactTypeName", ( PyCFunction ) Interface1D_getExactTypeName, METH_NOARGS, Interface1D_getExactTypeName___doc__}, +#if 0 + {"getVertices", ( PyCFunction ) Interface1D_getVertices, METH_NOARGS, "Returns the vertices"}, + {"getPoints", ( PyCFunction ) Interface1D_getPoints, METH_NOARGS, "Returns the points. The difference with getVertices() is that here we can iterate over points of the 1D element at any given sampling. At each call, a virtual point is created."}, +#endif + {"getLength2D", ( PyCFunction ) Interface1D_getLength2D, METH_NOARGS, Interface1D_getLength2D___doc__}, + {"getId", ( PyCFunction ) Interface1D_getId, METH_NOARGS, Interface1D_getId___doc__}, + {"getNature", ( PyCFunction ) Interface1D_getNature, METH_NOARGS, Interface1D_getNature___doc__}, + {"getTimeStamp", ( PyCFunction ) Interface1D_getTimeStamp, METH_NOARGS, Interface1D_getTimeStamp___doc__}, + {"setTimeStamp", ( PyCFunction ) Interface1D_setTimeStamp, METH_VARARGS, Interface1D_setTimeStamp___doc__}, + {"verticesBegin", ( PyCFunction ) Interface1D_verticesBegin, METH_NOARGS, Interface1D_verticesBegin___doc__}, + {"verticesEnd", ( PyCFunction ) Interface1D_verticesEnd, METH_NOARGS, Interface1D_verticesEnd___doc__}, + {"pointsBegin", ( PyCFunction ) Interface1D_pointsBegin, METH_VARARGS, Interface1D_pointsBegin___doc__}, + {"pointsEnd", ( PyCFunction ) Interface1D_pointsEnd, METH_VARARGS, Interface1D_pointsEnd___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_Interface1D type definition ------------------------------*/ + +PyTypeObject Interface1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Interface1D", /* tp_name */ + sizeof(BPy_Interface1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Interface1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)Interface1D___repr__, /* 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 */ + Interface1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Interface1D_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Interface1D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index 0e06c869a87..83601c05b1a 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -20,69 +20,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Iterator instance -----------*/ -static void Iterator___dealloc__(BPy_Iterator *self); -static PyObject * Iterator___repr__(BPy_Iterator* self); - -static PyObject * Iterator_getExactTypeName(BPy_Iterator* self); -static PyObject * Iterator_increment(BPy_Iterator* self); -static PyObject * Iterator_decrement(BPy_Iterator* self); -static PyObject * Iterator_isBegin(BPy_Iterator* self); -static PyObject * Iterator_isEnd(BPy_Iterator* self); - -/*----------------------Iterator instance definitions ----------------------------*/ -static PyMethodDef BPy_Iterator_methods[] = { - {"getExactTypeName", ( PyCFunction ) Iterator_getExactTypeName, METH_NOARGS, "() Returns the string of the name of the iterator."}, - {"increment", ( PyCFunction ) Iterator_increment, METH_NOARGS, "() Increments iterator."}, - {"decrement", ( PyCFunction ) Iterator_decrement, METH_NOARGS, "() Decrements iterator."}, - {"isBegin", ( PyCFunction ) Iterator_isBegin, METH_NOARGS, "() Tests if iterator points to beginning."}, - {"isEnd", ( PyCFunction ) Iterator_isEnd, METH_NOARGS, "() Tests if iterator points to end."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_Iterator type definition ------------------------------*/ - -PyTypeObject Iterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Iterator", /* tp_name */ - sizeof(BPy_Iterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Iterator___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Iterator___repr__, /* 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 */ - "Iterator objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Iterator_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int Iterator_Init( PyObject *module ) { @@ -149,24 +86,39 @@ int Iterator_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -void Iterator___dealloc__(BPy_Iterator* self) +static char Iterator___doc__[] = +"Base class to define iterators.\n"; + +static void Iterator___dealloc__(BPy_Iterator* self) { if (self->it) delete self->it; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * Iterator___repr__(BPy_Iterator* self) +static PyObject * Iterator___repr__(BPy_Iterator* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->it->getExactTypeName().c_str(), self->it ); } -PyObject * Iterator_getExactTypeName(BPy_Iterator* self) { +static char Iterator_getExactTypeName___doc__[] = +".. method:: getExactTypeName()\n" +"\n" +" Returns the name of the iterator.\n" +"\n" +" :return: The name of the iterator.\n" +" :rtype: string\n"; + +static PyObject * Iterator_getExactTypeName(BPy_Iterator* self) { return PyUnicode_FromFormat( self->it->getExactTypeName().c_str() ); } +static char Iterator_increment___doc__[] = +".. method:: increment()\n" +"\n" +" Makes the iterator point the next element.\n"; -PyObject * Iterator_increment(BPy_Iterator* self) { +static PyObject * Iterator_increment(BPy_Iterator* self) { if (self->it->isEnd()) { PyErr_SetString(PyExc_RuntimeError , "cannot increment any more"); return NULL; @@ -176,7 +128,12 @@ PyObject * Iterator_increment(BPy_Iterator* self) { Py_RETURN_NONE; } -PyObject * Iterator_decrement(BPy_Iterator* self) { +static char Iterator_decrement___doc__[] = +".. method:: decrement()\n" +"\n" +" Makes the iterator point the previous element.\n"; + +static PyObject * Iterator_decrement(BPy_Iterator* self) { if (self->it->isBegin()) { PyErr_SetString(PyExc_RuntimeError , "cannot decrement any more"); return NULL; @@ -186,14 +143,82 @@ PyObject * Iterator_decrement(BPy_Iterator* self) { Py_RETURN_NONE; } -PyObject * Iterator_isBegin(BPy_Iterator* self) { +static char Iterator_isBegin___doc__[] = +".. method:: isBegin()\n" +"\n" +" Returns true if the interator points the first element.\n" +"\n" +" :return: True if the interator points the first element.\n" +" :rtype: bool\n"; + +static PyObject * Iterator_isBegin(BPy_Iterator* self) { return PyBool_from_bool( self->it->isBegin() ); } -PyObject * Iterator_isEnd(BPy_Iterator* self) { +static char Iterator_isEnd___doc__[] = +".. method:: isEnd()\n" +"\n" +" Returns true if the interator points the last element.\n" +"\n" +" :return: True if the interator points the last element.\n" +" :rtype: bool\n"; + +static PyObject * Iterator_isEnd(BPy_Iterator* self) { return PyBool_from_bool( self->it->isEnd() ); } +/*----------------------Iterator instance definitions ----------------------------*/ +static PyMethodDef BPy_Iterator_methods[] = { + {"getExactTypeName", ( PyCFunction ) Iterator_getExactTypeName, METH_NOARGS, Iterator_getExactTypeName___doc__}, + {"increment", ( PyCFunction ) Iterator_increment, METH_NOARGS, Iterator_increment___doc__}, + {"decrement", ( PyCFunction ) Iterator_decrement, METH_NOARGS, Iterator_decrement___doc__}, + {"isBegin", ( PyCFunction ) Iterator_isBegin, METH_NOARGS, Iterator_isBegin___doc__}, + {"isEnd", ( PyCFunction ) Iterator_isEnd, METH_NOARGS, Iterator_isEnd___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_Iterator type definition ------------------------------*/ + +PyTypeObject Iterator_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Iterator", /* tp_name */ + sizeof(BPy_Iterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Iterator___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)Iterator___repr__, /* 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 */ + Iterator___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Iterator_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp index c3ccefd4136..63a889e4786 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp +++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp @@ -10,6 +10,14 @@ extern "C" { /*-----------------------BPy_MediumType type definition ------------------------------*/ +static char MediumType___doc__[] = +"The different blending modes available to similate the interaction\n" +"media-medium:\n" +"\n" +"* Stroke.DRY_MEDIUM: To simulate a dry medium such as Pencil or Charcoal.\n" +"* Stroke.HUMID_MEDIUM: To simulate ink painting (color substraction blending).\n" +"* Stroke.OPAQUE_MEDIUM: To simulate an opaque medium (oil, spray...).\n"; + PyTypeObject MediumType_Type = { PyVarObject_HEAD_INIT(NULL, 0) "MediumType", /* tp_name */ @@ -31,7 +39,7 @@ PyTypeObject MediumType_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - "MediumType objects", /* tp_doc */ + MediumType___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp index 2019430feb1..3907ea75a66 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.cpp +++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp @@ -52,6 +52,31 @@ PyNumberMethods nature_as_number = { 0, /* unaryfunc nb_index */ }; +/*-----------------------BPy_Nature docstring ------------------------------------*/ + +static char Nature___doc__[] = +"Different possible natures of 0D and 1D elements of the ViewMap.\n" +"\n" +"Vertex natures:\n" +"\n" +"* Nature.POINT: True for any 0D element.\n" +"* Nature.S_VERTEX: True for SVertex.\n" +"* Nature.VIEW_VERTEX: True for ViewVertex.\n" +"* Nature.NON_T_VERTEX: True for NonTVertex.\n" +"* Nature.T_VERTEX: True for TVertex.\n" +"* Nature.CUSP: True for CUSP.\n" +"\n" +"Edge natures:\n" +"\n" +"* Nature.NO_FEATURE: True for non feature edges (always false for 1D\n" +" elements of the ViewMap).\n" +"* Nature.SILHOUETTE: True for silhouettes.\n" +"* Nature.BORDER: True for borders.\n" +"* Nature.CREASE: True for creases.\n" +"* Nature.RIDGE: True for ridges.\n" +"* Nature.VALLEY: True for valleys.\n" +"* Nature.SUGGESTIVE_CONTOUR: True for suggestive contours.\n"; + /*-----------------------BPy_Nature type definition ------------------------------*/ PyTypeObject Nature_Type = { @@ -75,7 +100,7 @@ PyTypeObject Nature_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - "Nature objects", /* tp_doc */ + Nature___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 557143f22c2..79c3fb64a82 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -15,85 +15,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Operators instance -----------*/ -static void Operators___dealloc__(BPy_Operators *self); - -static PyObject * Operators_select(BPy_Operators* self, PyObject *args); -static PyObject * Operators_chain(BPy_Operators* self, PyObject *args); -static PyObject * Operators_bidirectionalChain(BPy_Operators* self, PyObject *args); -static PyObject * Operators_sequentialSplit(BPy_Operators* self, PyObject *args); -static PyObject * Operators_recursiveSplit(BPy_Operators* self, PyObject *args); -static PyObject * Operators_sort(BPy_Operators* self, PyObject *args); -static PyObject * Operators_create(BPy_Operators* self, PyObject *args); -static PyObject * Operators_getViewEdgesSize( BPy_Operators* self); -static PyObject * Operators_getChainsSize( BPy_Operators* self); -static PyObject * Operators_getStrokesSize( BPy_Operators* self); - -/*----------------------Operators instance definitions ----------------------------*/ -static PyMethodDef BPy_Operators_methods[] = { - {"select", ( PyCFunction ) Operators_select, METH_VARARGS | METH_STATIC, - "select operator"}, - {"chain", ( PyCFunction ) Operators_chain, METH_VARARGS | METH_STATIC, - "chain operator"}, - {"bidirectionalChain", ( PyCFunction ) Operators_bidirectionalChain, METH_VARARGS | METH_STATIC, - "bidirectionalChain operator"}, - {"sequentialSplit", ( PyCFunction ) Operators_sequentialSplit, METH_VARARGS | METH_STATIC, - "sequentialSplit operator"}, - {"recursiveSplit", ( PyCFunction ) Operators_recursiveSplit, METH_VARARGS | METH_STATIC, - "recursiveSplit operator"}, - {"sort", ( PyCFunction ) Operators_sort, METH_VARARGS | METH_STATIC, - "sort operator"}, - {"create", ( PyCFunction ) Operators_create, METH_VARARGS | METH_STATIC, - "create operator"}, - {"getViewEdgesSize", ( PyCFunction ) Operators_getViewEdgesSize, METH_NOARGS | METH_STATIC, ""}, - {"getChainsSize", ( PyCFunction ) Operators_getChainsSize, METH_NOARGS | METH_STATIC, ""}, - {"getStrokesSize", ( PyCFunction ) Operators_getStrokesSize, METH_NOARGS | METH_STATIC, ""}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_Operators type definition ------------------------------*/ - -PyTypeObject Operators_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Operators", /* tp_name */ - sizeof(BPy_Operators), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Operators___dealloc__, /* 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, /* tp_flags */ - "Operators objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Operators_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int Operators_Init( PyObject *module ) { @@ -110,12 +31,27 @@ int Operators_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -void Operators___dealloc__(BPy_Operators* self) +static char Operators___doc__[] = +"Class defining the operators used in a style module. There are five\n" +"types of operators: Selection, chaining, splitting, sorting and\n" +"creation. All these operators are user controlled through functors,\n" +"predicates and shaders that are taken as arguments.\n"; + +static void Operators___dealloc__(BPy_Operators* self) { Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * Operators_select(BPy_Operators* self, PyObject *args) +static char Operators_select___doc__[] = +".. staticmethod:: select(pred)\n" +"\n" +" Selects the ViewEdges of the ViewMap verifying a specified\n" +" condition.\n" +"\n" +" :arg pred: The predicate expressing this condition.\n" +" :type pred: UnaryPredicate1D\n"; + +static PyObject * Operators_select(BPy_Operators* self, PyObject *args) { PyObject *obj = 0; @@ -135,9 +71,49 @@ PyObject * Operators_select(BPy_Operators* self, PyObject *args) Py_RETURN_NONE; } +static char Operators_chain___doc__[] = +".. staticmethod:: chain(it, pred, modifier)\n" +"\n" +" Builds a set of chains from the current set of ViewEdges. Each\n" +" ViewEdge of the current list starts a new chain. The chaining\n" +" operator then iterates over the ViewEdges of the ViewMap using the\n" +" user specified iterator. This operator only iterates using the\n" +" increment operator and is therefore unidirectional.\n" +"\n" +" :arg it: The iterator on the ViewEdges of the ViewMap. It contains\n" +" the chaining rule.\n" +" :type it: :class:`ViewEdgeIterator`\n" +" :arg pred: The predicate on the ViewEdge that expresses the\n" +" stopping condition.\n" +" :type pred: :class:`UnaryPredicate1D`\n" +" :arg modifier: A function that takes a ViewEdge as argument and\n" +" that is used to modify the processed ViewEdge state (the\n" +" timestamp incrementation is a typical illustration of such a\n" +" modifier).\n" +" :type modifier: :class:`UnaryFunction1DVoid`\n" +"\n" +".. staticmethod:: chain(it, pred)\n" +"\n" +" Builds a set of chains from the current set of ViewEdges. Each\n" +" ViewEdge of the current list starts a new chain. The chaining\n" +" operator then iterates over the ViewEdges of the ViewMap using the\n" +" user specified iterator. This operator only iterates using the\n" +" increment operator and is therefore unidirectional. This chaining\n" +" operator is different from the previous one because it doesn't take\n" +" any modifier as argument. Indeed, the time stamp (insuring that a\n" +" ViewEdge is processed one time) is automatically managed in this\n" +" case.\n" +"\n" +" :arg it: The iterator on the ViewEdges of the ViewMap. It contains\n" +" the chaining rule. \n" +" :type it: :class:`ViewEdgeIterator`\n" +" :arg pred: The predicate on the ViewEdge that expresses the\n" +" stopping condition.\n" +" :type pred: :class:`UnaryPredicate1D`\n"; + // CHANGE: first parameter is a chaining iterator, not just a view -PyObject * Operators_chain(BPy_Operators* self, PyObject *args) +static PyObject * Operators_chain(BPy_Operators* self, PyObject *args) { PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; @@ -182,7 +158,50 @@ PyObject * Operators_chain(BPy_Operators* self, PyObject *args) Py_RETURN_NONE; } -PyObject * Operators_bidirectionalChain(BPy_Operators* self, PyObject *args) +static char Operators_bidirectionalChain___doc__[] = +".. staticmethod:: bidirectionalChain(it, pred)\n" +"\n" +" Builds a set of chains from the current set of ViewEdges. Each\n" +" ViewEdge of the current list potentially starts a new chain. The\n" +" chaining operator then iterates over the ViewEdges of the ViewMap\n" +" using the user specified iterator. This operator iterates both using\n" +" the increment and decrement operators and is therefore bidirectional.\n" +" This operator works with a ChainingIterator which contains the\n" +" chaining rules. It is this last one which can be told to chain only\n" +" edges that belong to the selection or not to process twice a ViewEdge\n" +" during the chaining. Each time a ViewEdge is added to a chain, its\n" +" chaining time stamp is incremented. This allows you to keep track of\n" +" the number of chains to which a ViewEdge belongs to.\n" +"\n" +" :arg it: The ChainingIterator on the ViewEdges of the ViewMap. It\n" +" contains the chaining rule.\n" +" :type it: :class:`ChainingIterator`\n" +" :arg pred: The predicate on the ViewEdge that expresses the\n" +" stopping condition.\n" +" :type pred: :class:`UnaryPredicate1D`\n" +"\n" +".. staticmethod:: bidirectionalChain(it)\n" +"\n" +" The only difference with the above bidirectional chaining algorithm\n" +" is that we don't need to pass a stopping criterion. This might be\n" +" desirable when the stopping criterion is already contained in the\n" +" iterator definition. Builds a set of chains from the current set of\n" +" ViewEdges. Each ViewEdge of the current list potentially starts a new\n" +" chain. The chaining operator then iterates over the ViewEdges of the\n" +" ViewMap using the user specified iterator. This operator iterates\n" +" both using the increment and decrement operators and is therefore\n" +" bidirectional. This operator works with a ChainingIterator which\n" +" contains the chaining rules. It is this last one which can be told to\n" +" chain only edges that belong to the selection or not to process twice\n" +" a ViewEdge during the chaining. Each time a ViewEdge is added to a\n" +" chain, its chaining time stamp is incremented. This allows you to\n" +" keep track of the number of chains to which a ViewEdge belongs to.\n" +"\n" +" :arg it: The ChainingIterator on the ViewEdges of the ViewMap. It\n" +" contains the chaining rule.\n" +" :type it: :class:`ChainingIterator`\n"; + +static PyObject * Operators_bidirectionalChain(BPy_Operators* self, PyObject *args) { PyObject *obj1 = 0, *obj2 = 0; @@ -219,7 +238,48 @@ PyObject * Operators_bidirectionalChain(BPy_Operators* self, PyObject *args) Py_RETURN_NONE; } -PyObject * Operators_sequentialSplit(BPy_Operators* self, PyObject *args) +static char Operators_sequentialSplit___doc__[] = +".. staticmethod:: sequentialSplit(startingPred, stoppingPred, sampling=0.0)\n" +"\n" +" Splits each chain of the current set of chains in a sequential way.\n" +" The points of each chain are processed (with a specified sampling)\n" +" sequentially. Each time a user specified starting condition is\n" +" verified, a new chain begins and ends as soon as a user-defined\n" +" stopping predicate is verified. This allows chains overlapping rather\n" +" than chains partitioning. The first point of the initial chain is the\n" +" first point of one of the resulting chains. The splitting ends when\n" +" no more chain can start.\n" +"\n" +" :arg startingPred: The predicate on a point that expresses the\n" +" starting condition.\n" +" :type startingPred: :class:`UnaryPredicate0D`\n" +" :arg stoppingPred: The predicate on a point that expresses the\n" +" stopping condition.\n" +" :type stoppingPred: :class:`UnaryPredicate0D`\n" +" :arg sampling: The resolution used to sample the chain for the\n" +" predicates evaluation. (The chain is not actually resampled;\n" +" a virtual point only progresses along the curve using this\n" +" resolution.)\n" +" :type sampling: float\n" +"\n" +".. staticmethod:: sequentialSplit(pred, sampling=0.0)\n" +"\n" +" Splits each chain of the current set of chains in a sequential way.\n" +" The points of each chain are processed (with a specified sampling)\n" +" sequentially and each time a user specified condition is verified,\n" +" the chain is split into two chains. The resulting set of chains is a\n" +" partition of the initial chain\n" +"\n" +" :arg pred: The predicate on a point that expresses the splitting\n" +" condition.\n" +" :type pred: :class:`UnaryPredicate0D`\n" +" :arg sampling: The resolution used to sample the chain for the\n" +" predicate evaluation. (The chain is not actually resampled; a\n" +" virtual point only progresses along the curve using this\n" +" resolution.)\n" +" :type sampling: float\n"; + +static PyObject * Operators_sequentialSplit(BPy_Operators* self, PyObject *args) { PyObject *obj1 = 0, *obj2 = 0; float f = 0.0; @@ -265,7 +325,63 @@ PyObject * Operators_sequentialSplit(BPy_Operators* self, PyObject *args) Py_RETURN_NONE; } -PyObject * Operators_recursiveSplit(BPy_Operators* self, PyObject *args) +static char Operators_recursiveSplit___doc__[] = +".. staticmethod:: recursiveSplit(func, pred, sampling=0.0)\n" +"\n" +" Splits the current set of chains in a recursive way. We process the\n" +" points of each chain (with a specified sampling) to find the point\n" +" minimizing a specified function. The chain is split in two at this\n" +" point and the two new chains are processed in the same way. The\n" +" recursivity level is controlled through a predicate 1D that expresses\n" +" a stopping condition on the chain that is about to be processed.\n" +"\n" +" :arg func: The Unary Function evaluated at each point of the chain.\n" +" The splitting point is the point minimizing this function.\n" +" :type func: :class:`UnaryFunction0DDouble`\n" +" :arg pred: The Unary Predicate expressing the recursivity stopping\n" +" condition. This predicate is evaluated for each curve before it\n" +" actually gets split. If pred(chain) is true, the curve won't be\n" +" split anymore.\n" +" :type pred: :class:`UnaryPredicate1D`\n" +" :arg sampling: The resolution used to sample the chain for the\n" +" predicates evaluation. (The chain is not actually resampled, a\n" +" virtual point only progresses along the curve using this\n" +" resolution.)\n" +" :type sampling: float\n" +"\n" +".. staticmethod:: recursiveSplit(func, pred0d, pred, sampling=0.0)\n" +"\n" +" Splits the current set of chains in a recursive way. We process the\n" +" points of each chain (with a specified sampling) to find the point\n" +" minimizing a specified function. The chain is split in two at this\n" +" point and the two new chains are processed in the same way. The user\n" +" can specify a 0D predicate to make a first selection on the points\n" +" that can potentially be split. A point that doesn't verify the 0D\n" +" predicate won't be candidate in realizing the min. The recursivity\n" +" level is controlled through a predicate 1D that expresses a stopping\n" +" condition on the chain that is about to be processed.\n" +"\n" +" :arg func: The Unary Function evaluated at each point of the chain.\n" +" The splitting point is the point minimizing this function.\n" +" :type func: :class:`UnaryFunction0DDouble`\n" +" :arg pred0d: The Unary Predicate 0D used to select the candidate\n" +" points where the split can occur. For example, it is very likely\n" +" that would rather have your chain splitting around its middle\n" +" point than around one of its extremities. A 0D predicate working\n" +" on the curvilinear abscissa allows to add this kind of constraints.\n" +" :type pred0d: :class:`UnaryPredicate0D`\n" +" :arg pred: The Unary Predicate expressing the recursivity stopping\n" +" condition. This predicate is evaluated for each curve before it\n" +" actually gets split. If pred(chain) is true, the curve won't be\n" +" split anymore.\n" +" :type pred: :class:`UnaryPredicate1D`\n" +" :arg sampling: The resolution used to sample the chain for the\n" +" predicates evaluation. (The chain is not actually resampled; a\n" +" virtual point only progresses along the curve using this\n" +" resolution.)\n" +" :type sampling: float\n"; + +static PyObject * Operators_recursiveSplit(BPy_Operators* self, PyObject *args) { PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; float f = 0.0; @@ -322,7 +438,16 @@ PyObject * Operators_recursiveSplit(BPy_Operators* self, PyObject *args) Py_RETURN_NONE; } -PyObject * Operators_sort(BPy_Operators* self, PyObject *args) +static char Operators_sort___doc__[] = +".. staticmethod:: sort(pred)\n" +"\n" +" Sorts the current set of chains (or viewedges) according to the\n" +" comparison predicate given as argument.\n" +"\n" +" :arg pred: The binary predicate used for the comparison.\n" +" :type pred: BinaryPredicate1D\n"; + +static PyObject * Operators_sort(BPy_Operators* self, PyObject *args) { PyObject *obj = 0; @@ -341,7 +466,19 @@ PyObject * Operators_sort(BPy_Operators* self, PyObject *args) Py_RETURN_NONE; } -PyObject * Operators_create(BPy_Operators* self, PyObject *args) +static char Operators_create___doc__[] = +".. staticmethod:: create(pred, shaders)\n" +"\n" +" Creates and shades the strokes from the current set of chains. A\n" +" predicate can be specified to make a selection pass on the chains.\n" +"\n" +" :arg pred: The predicate that a chain must verify in order to be\n" +" transform as a stroke.\n" +" :type pred: :class:`UnaryPredicate1D`\n" +" :arg shaders: The list of shaders used to shade the strokes.\n" +" :type shaders: List of StrokeShader objects\n"; + +static PyObject * Operators_create(BPy_Operators* self, PyObject *args) { PyObject *obj1 = 0, *obj2 = 0; @@ -372,18 +509,99 @@ PyObject * Operators_create(BPy_Operators* self, PyObject *args) Py_RETURN_NONE; } -PyObject * Operators_getViewEdgesSize( BPy_Operators* self) { +static char Operators_getViewEdgesSize___doc__[] = +".. staticmethod:: getViewEdgesSize()\n" +"\n" +" Returns the number of ViewEdges.\n" +"\n" +" :return: The number of ViewEdges.\n" +" :rtype: int\n"; + +static PyObject * Operators_getViewEdgesSize( BPy_Operators* self) { return PyLong_FromLong( Operators::getViewEdgesSize() ); } -PyObject * Operators_getChainsSize( BPy_Operators* self ) { +static char Operators_getChainsSize___doc__[] = +".. staticmethod:: getChainsSize()\n" +"\n" +" Returns the number of Chains.\n" +"\n" +" :return: The number of Chains.\n" +" :rtype: int\n"; + +static PyObject * Operators_getChainsSize( BPy_Operators* self ) { return PyLong_FromLong( Operators::getChainsSize() ); } -PyObject * Operators_getStrokesSize( BPy_Operators* self) { +static char Operators_getStrokesSize___doc__[] = +".. staticmethod:: getStrokesSize()\n" +"\n" +" Returns the number of Strokes.\n" +"\n" +" :return: The number of Strokes.\n" +" :rtype: int\n"; + +static PyObject * Operators_getStrokesSize( BPy_Operators* self) { return PyLong_FromLong( Operators::getStrokesSize() ); } +/*----------------------Operators instance definitions ----------------------------*/ +static PyMethodDef BPy_Operators_methods[] = { + {"select", ( PyCFunction ) Operators_select, METH_VARARGS | METH_STATIC, Operators_select___doc__}, + {"chain", ( PyCFunction ) Operators_chain, METH_VARARGS | METH_STATIC, Operators_chain___doc__}, + {"bidirectionalChain", ( PyCFunction ) Operators_bidirectionalChain, METH_VARARGS | METH_STATIC, Operators_bidirectionalChain___doc__}, + {"sequentialSplit", ( PyCFunction ) Operators_sequentialSplit, METH_VARARGS | METH_STATIC, Operators_sequentialSplit___doc__}, + {"recursiveSplit", ( PyCFunction ) Operators_recursiveSplit, METH_VARARGS | METH_STATIC, Operators_recursiveSplit___doc__}, + {"sort", ( PyCFunction ) Operators_sort, METH_VARARGS | METH_STATIC, Operators_sort___doc__}, + {"create", ( PyCFunction ) Operators_create, METH_VARARGS | METH_STATIC, Operators_create___doc__}, + {"getViewEdgesSize", ( PyCFunction ) Operators_getViewEdgesSize, METH_NOARGS | METH_STATIC, Operators_getViewEdgesSize___doc__}, + {"getChainsSize", ( PyCFunction ) Operators_getChainsSize, METH_NOARGS | METH_STATIC, Operators_getChainsSize___doc__}, + {"getStrokesSize", ( PyCFunction ) Operators_getStrokesSize, METH_NOARGS | METH_STATIC, Operators_getStrokesSize___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_Operators type definition ------------------------------*/ + +PyTypeObject Operators_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Operators", /* tp_name */ + sizeof(BPy_Operators), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Operators___dealloc__, /* 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, /* tp_flags */ + Operators___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Operators_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index 9ab2fbac096..512a19359a5 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -12,79 +12,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SShape instance -----------*/ -static int SShape___init__(BPy_SShape *self, PyObject *args, PyObject *kwds); -static void SShape___dealloc__(BPy_SShape *self); -static PyObject * SShape___repr__(BPy_SShape* self); - -static PyObject * SShape_AddEdge( BPy_SShape *self , PyObject *args); -static PyObject * SShape_AddNewVertex( BPy_SShape *self , PyObject *args); -static PyObject * SShape_setBBox( BPy_SShape *self , PyObject *args); -static PyObject * SShape_ComputeBBox( BPy_SShape *self ); -static PyObject * SShape_bbox( BPy_SShape *self ); -static PyObject * SShape_getVertexList( BPy_SShape *self ); -static PyObject * SShape_getEdgeList( BPy_SShape *self ); -static PyObject * SShape_getId( BPy_SShape *self ); -static PyObject * SShape_setId( BPy_SShape *self , PyObject *args); - -/*----------------------SShape instance definitions ----------------------------*/ -static PyMethodDef BPy_SShape_methods[] = { - {"AddEdge", ( PyCFunction ) SShape_AddEdge, METH_VARARGS, "(FEdge fe) Adds a FEdge to the list of FEdges. "}, - {"AddNewVertex", ( PyCFunction ) SShape_AddNewVertex, METH_VARARGS, "(SVertex sv) Adds a SVertex to the list of SVertex of this Shape. The SShape attribute of the SVertex is also set to 'this'."}, - {"setBBox", ( PyCFunction ) SShape_setBBox, METH_VARARGS, "(BBox bb) Sets the Bounding Box of the Shape"}, - {"ComputeBBox", ( PyCFunction ) SShape_ComputeBBox, METH_NOARGS, "() Compute the bbox of the SShape"}, - {"bbox", ( PyCFunction ) SShape_bbox, METH_NOARGS, "() Returns the bounding box of the shape."}, - {"getVertexList", ( PyCFunction ) SShape_getVertexList, METH_NOARGS, "() Returns the list of SVertex of the Shape"}, - {"getEdgeList", ( PyCFunction ) SShape_getEdgeList, METH_NOARGS, "() Returns the list of FEdges of the Shape."}, - {"getId", ( PyCFunction ) SShape_getId, METH_NOARGS, "() Returns the Id of the Shape. "}, - {"setId", ( PyCFunction ) SShape_setId, METH_VARARGS, "(Id id) Sets the Id of the shape. "}, - - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_SShape type definition ------------------------------*/ - -PyTypeObject SShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SShape", /* tp_name */ - sizeof(BPy_SShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)SShape___repr__, /* 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 */ - "SShape objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_SShape_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SShape___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int SShape_Init( PyObject *module ) { @@ -101,7 +28,22 @@ int SShape_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int SShape___init__(BPy_SShape *self, PyObject *args, PyObject *kwds) +static char SShape___doc__[] = +"Class to define a feature shape. It is the gathering of feature\n" +"elements from an identified input shape.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: An SShape object.\n" +" :type iBrother: :class:`SShape`\n"; + +static int SShape___init__(BPy_SShape *self, PyObject *args, PyObject *kwds) { PyObject *obj = NULL; @@ -119,19 +61,27 @@ int SShape___init__(BPy_SShape *self, PyObject *args, PyObject *kwds) return 0; } -void SShape___dealloc__(BPy_SShape *self) +static void SShape___dealloc__(BPy_SShape *self) { if( self->ss && !self->borrowed ) delete self->ss; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * SShape___repr__(BPy_SShape *self) +static PyObject * SShape___repr__(BPy_SShape *self) { return PyUnicode_FromFormat("SShape - address: %p", self->ss ); } -PyObject * SShape_AddEdge( BPy_SShape *self , PyObject *args) { +static char SShape_AddEdge___doc__[] = +".. method:: AddEdge(iEdge)\n" +"\n" +" Adds an FEdge to the list of FEdges.\n" +"\n" +" :arg iEdge: An FEdge object.\n" +" :type iEdge: :class:`FEdge`\n"; + +static PyObject * SShape_AddEdge( BPy_SShape *self , PyObject *args) { PyObject *py_fe = 0; if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) )) @@ -142,7 +92,16 @@ PyObject * SShape_AddEdge( BPy_SShape *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * SShape_AddNewVertex( BPy_SShape *self , PyObject *args) { +static char SShape_AddNewVertex___doc__[] = +".. method:: AddNewVertex(iv)\n" +"\n" +" Adds an SVertex to the list of SVertex of this Shape. The SShape\n" +" attribute of the SVertex is also set to this SShape.\n" +"\n" +" :arg iv: An SVertex object.\n" +" :type iv: :class:`SVertex`\n"; + +static PyObject * SShape_AddNewVertex( BPy_SShape *self , PyObject *args) { PyObject *py_sv = 0; if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) @@ -153,7 +112,15 @@ PyObject * SShape_AddNewVertex( BPy_SShape *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * SShape_setBBox( BPy_SShape *self , PyObject *args) { +static char SShape_setBBox___doc__[] = +".. method:: setBBox(iBBox)\n" +"\n" +" Sets the bounding box of the SShape.\n" +"\n" +" :arg iBBox: The bounding box of the SShape.\n" +" :type iBBox: :class:`BBox`\n"; + +static PyObject * SShape_setBBox( BPy_SShape *self , PyObject *args) { PyObject *py_bb = 0; if(!( PyArg_ParseTuple(args, "O!", &BBox_Type, &py_bb) )) @@ -164,19 +131,39 @@ PyObject * SShape_setBBox( BPy_SShape *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * SShape_ComputeBBox( BPy_SShape *self ) { +static char SShape_ComputeBBox___doc__[] = +".. method:: ComputeBBox()\n" +"\n" +" Compute the bbox of the SShape.\n"; + +static PyObject * SShape_ComputeBBox( BPy_SShape *self ) { self->ss->ComputeBBox(); Py_RETURN_NONE; } -PyObject * SShape_bbox( BPy_SShape *self ) { +static char SShape_bbox___doc__[] = +".. method:: bbox()\n" +"\n" +" Returns the bounding box of the SShape.\n" +"\n" +" :return: the bounding box of the SShape.\n" +" :rtype: :class:`BBox`\n"; + +static PyObject * SShape_bbox( BPy_SShape *self ) { BBox<Vec3r> bb( self->ss->bbox() ); return BPy_BBox_from_BBox( bb ); } +static char SShape_getVertexList___doc__[] = +".. method:: getVertexList()\n" +"\n" +" Returns the list of vertices of the SShape.\n" +"\n" +" :return: The list of vertices objects.\n" +" :rtype: List of :class:`SVertex` objects\n"; -PyObject * SShape_getVertexList( BPy_SShape *self ) { +static PyObject * SShape_getVertexList( BPy_SShape *self ) { PyObject *py_vertices = PyList_New(0); vector< SVertex * > vertices = self->ss->getVertexList(); @@ -189,8 +176,15 @@ PyObject * SShape_getVertexList( BPy_SShape *self ) { return py_vertices; } +static char SShape_getEdgeList___doc__[] = +".. method:: getEdgeList()\n" +"\n" +" Returns the list of edges of the SShape.\n" +"\n" +" :return: The list of edges of the SShape.\n" +" :rtype: List of :class:`FEdge` objects\n"; -PyObject * SShape_getEdgeList( BPy_SShape *self ) { +static PyObject * SShape_getEdgeList( BPy_SShape *self ) { PyObject *py_edges = PyList_New(0); vector< FEdge * > edges = self->ss->getEdgeList(); @@ -203,12 +197,28 @@ PyObject * SShape_getEdgeList( BPy_SShape *self ) { return py_edges; } -PyObject * SShape_getId( BPy_SShape *self ) { +static char SShape_getId___doc__[] = +".. method:: getId()\n" +"\n" +" Returns the Id of the SShape.\n" +"\n" +" :return: The Id of the SShape.\n" +" :rtype: :class:`Id`\n"; + +static PyObject * SShape_getId( BPy_SShape *self ) { Id id( self->ss->getId() ); return BPy_Id_from_Id( id ); } -PyObject * SShape_setId( BPy_SShape *self , PyObject *args) { +static char SShape_setId___doc__[] = +".. method:: setId(id)\n" +"\n" +" Sets the Id of the SShape.\n" +"\n" +" :arg id: The Id of the SShape.\n" +" :type id: :class:`Id`\n"; + +static PyObject * SShape_setId( BPy_SShape *self , PyObject *args) { PyObject *py_id; if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) )) @@ -219,11 +229,66 @@ PyObject * SShape_setId( BPy_SShape *self , PyObject *args) { Py_RETURN_NONE; } - // const Material & material (unsigned i) const // const vector< Material > & materials () const // void SetMaterials (const vector< Material > &iMaterials) +/*----------------------SShape instance definitions ----------------------------*/ +static PyMethodDef BPy_SShape_methods[] = { + {"AddEdge", ( PyCFunction ) SShape_AddEdge, METH_VARARGS, SShape_AddEdge___doc__}, + {"AddNewVertex", ( PyCFunction ) SShape_AddNewVertex, METH_VARARGS, SShape_AddNewVertex___doc__}, + {"setBBox", ( PyCFunction ) SShape_setBBox, METH_VARARGS, SShape_setBBox___doc__}, + {"ComputeBBox", ( PyCFunction ) SShape_ComputeBBox, METH_NOARGS, SShape_ComputeBBox___doc__}, + {"bbox", ( PyCFunction ) SShape_bbox, METH_NOARGS, SShape_bbox___doc__}, + {"getVertexList", ( PyCFunction ) SShape_getVertexList, METH_NOARGS, SShape_getVertexList___doc__}, + {"getEdgeList", ( PyCFunction ) SShape_getEdgeList, METH_NOARGS, SShape_getEdgeList___doc__}, + {"getId", ( PyCFunction ) SShape_getId, METH_NOARGS, SShape_getId___doc__}, + {"setId", ( PyCFunction ) SShape_setId, METH_VARARGS, SShape_setId___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_SShape type definition ------------------------------*/ + +PyTypeObject SShape_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "SShape", /* tp_name */ + sizeof(BPy_SShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)SShape___repr__, /* 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 */ + SShape___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_SShape_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SShape___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 30fb7a5c2e3..875edaea2d5 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -8,107 +8,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for StrokeAttribute instance -----------*/ -static int StrokeAttribute___init__(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds); -static void StrokeAttribute___dealloc__(BPy_StrokeAttribute *self); -static PyObject * StrokeAttribute___repr__(BPy_StrokeAttribute *self); - -static PyObject * StrokeAttribute_getColorR( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_getColorG( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_getColorB( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_getColorRGB( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_getAlpha( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_getThicknessR( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_getThicknessL( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_getThicknessRL( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_isVisible( BPy_StrokeAttribute *self ); -static PyObject * StrokeAttribute_getAttributeReal( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_getAttributeVec2f( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_getAttributeVec3f( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_isAttributeAvailableReal( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_isAttributeAvailableVec2f( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_isAttributeAvailableVec3f( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_setColor( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_setAlpha( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_setThickness( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_setVisible( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_setAttributeReal( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_setAttributeVec2f( BPy_StrokeAttribute *self, PyObject *args ); -static PyObject * StrokeAttribute_setAttributeVec3f( BPy_StrokeAttribute *self, PyObject *args ); - - -/*----------------------StrokeAttribute instance definitions ----------------------------*/ -static PyMethodDef BPy_StrokeAttribute_methods[] = { - {"getColorR", ( PyCFunction ) StrokeAttribute_getColorR, METH_NOARGS, "Returns the R color component. "}, - {"getColorG", ( PyCFunction ) StrokeAttribute_getColorG, METH_NOARGS, "Returns the G color component. "}, - {"getColorB", ( PyCFunction ) StrokeAttribute_getColorB, METH_NOARGS, "Returns the B color component. "}, - {"getColorRGB", ( PyCFunction ) StrokeAttribute_getColorRGB, METH_NOARGS, "Returns the RGB color components."}, - {"getAlpha", ( PyCFunction ) StrokeAttribute_getAlpha, METH_NOARGS, "Returns the alpha color component."}, - {"getThicknessR", ( PyCFunction ) StrokeAttribute_getThicknessR, METH_NOARGS, "Returns the thickness on the right of the vertex when following the stroke. "}, - {"getThicknessL", ( PyCFunction ) StrokeAttribute_getThicknessL, METH_NOARGS, "Returns the thickness on the left of the vertex when following the stroke."}, - {"getThicknessRL", ( PyCFunction ) StrokeAttribute_getThicknessRL, METH_NOARGS, "Returns the thickness on the right and on the left of the vertex when following the stroke. "}, - {"isVisible", ( PyCFunction ) StrokeAttribute_isVisible, METH_NOARGS, "Returns true if the strokevertex is visible, false otherwise"}, - {"getAttributeReal", ( PyCFunction ) StrokeAttribute_getAttributeReal, METH_VARARGS, "(name) Returns an attribute of type real specified by name."}, - {"getAttributeVec2f", ( PyCFunction ) StrokeAttribute_getAttributeVec2f, METH_VARARGS, "(name) Returns an attribute of type Vec2f specified by name."}, - {"getAttributeVec3f", ( PyCFunction ) StrokeAttribute_getAttributeVec3f, METH_VARARGS, "(name) Returns an attribute of type Vec3f specified by name."}, - {"isAttributeAvailableReal", ( PyCFunction ) StrokeAttribute_isAttributeAvailableReal, METH_VARARGS, "(name) Checks whether the real attribute specified by name is available"}, - {"isAttributeAvailableVec2f", ( PyCFunction ) StrokeAttribute_isAttributeAvailableVec2f, METH_VARARGS, "(name) Checks whether the Vec2f attribute specified by name is available"}, - {"isAttributeAvailableVec3f", ( PyCFunction ) StrokeAttribute_isAttributeAvailableVec3f, METH_VARARGS, "(name) Checks whether the Vec3f attribute specified by name is available"}, - {"setColor", ( PyCFunction ) StrokeAttribute_setColor, METH_VARARGS, "(float a)Sets the attribute's alpha value. "}, - {"setAlpha", ( PyCFunction ) StrokeAttribute_setAlpha, METH_VARARGS, "(float a) Sets the attribute's alpha value."}, - {"setThickness", ( PyCFunction ) StrokeAttribute_setThickness, METH_VARARGS, ""}, - {"setVisible", ( PyCFunction ) StrokeAttribute_setVisible, METH_VARARGS, ""}, - {"setAttributeReal", ( PyCFunction ) StrokeAttribute_setAttributeReal, METH_VARARGS, "(name, float att) Adds a user defined attribute of type real. If there is no attribute of specified by name, it is added. Otherwise, the new value replaces the old one."}, - {"setAttributeVec2f", ( PyCFunction ) StrokeAttribute_setAttributeVec2f, METH_VARARGS, "(name, float att) Adds a user defined attribute of type Vec2f. If there is no attribute of specified by name, it is added. Otherwise, the new value replaces the old one."}, - {"setAttributeVec3f", ( PyCFunction ) StrokeAttribute_setAttributeVec3f, METH_VARARGS, "(name, float att) Adds a user defined attribute of type Vec4f. If there is no attribute of specified by name, it is added. Otherwise, the new value replaces the old one."}, - {NULL, NULL, 0, NULL} -}; - - - -/*-----------------------BPy_StrokeAttribute type definition ------------------------------*/ - -PyTypeObject StrokeAttribute_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeAttribute", /* tp_name */ - sizeof(BPy_StrokeAttribute), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)StrokeAttribute___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)StrokeAttribute___repr__, /* 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 */ - "StrokeAttribute objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_StrokeAttribute_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeAttribute___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int StrokeAttribute_Init( PyObject *module ) { @@ -124,7 +23,52 @@ int StrokeAttribute_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int StrokeAttribute___init__(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) +static char StrokeAttribute___doc__[] = +"Class to define a set of attributes associated with a :class:`StrokeVertex`.\n" +"The attribute set stores the color, alpha and thickness values for a Stroke\n" +"Vertex.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A StrokeAttribute object.\n" +" :type iBrother: :class:`StrokeAttribute`\n" +"\n" +".. method:: __init__(iRColor, iGColor, iBColor, iAlpha, iRThickness, iLThickness)\n" +"\n" +" Builds a stroke vertex attribute from a set of parameters.\n" +"\n" +" :arg iRColor: Red component of a stroke color.\n" +" :type iRColor: float\n" +" :arg iGColor: Green component of a stroke color.\n" +" :type iGColor: float\n" +" :arg iBColor: Blue component of a stroke color.\n" +" :type iBColor: float\n" +" :arg iAlpha: Alpha component of a stroke color.\n" +" :type iAlpha: float\n" +" :arg iRThickness: Stroke thickness on the right.\n" +" :type iRThickness: float\n" +" :arg iLThickness: Stroke thickness on the left.\n" +" :type iLThickness: float\n" +"\n" +".. method:: __init__(a1, a2, t)\n" +"\n" +" Interpolation constructor. Builds a StrokeAttribute from two\n" +" StrokeAttribute objects and an interpolation parameter.\n" +"\n" +" :arg a1: The first StrokeAttribute object.\n" +" :type a1: :class:`StrokeAttribute`\n" +" :arg a2: The second StrokeAttribute object.\n" +" :type a2: :class:`StrokeAttribute`\n" +" :arg t: The interpolation parameter.\n" +" :type t: float\n"; + +static int StrokeAttribute___init__(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0, *obj4 = 0, *obj5 = 0 , *obj6 = 0; @@ -164,14 +108,14 @@ int StrokeAttribute___init__(BPy_StrokeAttribute *self, PyObject *args, PyObject } -void StrokeAttribute___dealloc__(BPy_StrokeAttribute* self) +static void StrokeAttribute___dealloc__(BPy_StrokeAttribute* self) { if( self->sa && !self->borrowed ) delete self->sa; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * StrokeAttribute___repr__(BPy_StrokeAttribute* self) +static PyObject * StrokeAttribute___repr__(BPy_StrokeAttribute* self) { stringstream repr("StrokeAttribute:"); repr << " r: " << self->sa->getColorR() @@ -185,44 +129,132 @@ PyObject * StrokeAttribute___repr__(BPy_StrokeAttribute* self) } -PyObject *StrokeAttribute_getColorR( BPy_StrokeAttribute *self ) { +static char StrokeAttribute_getColorR___doc__[] = +".. method:: getColorR()\n" +"\n" +" Returns the red component of the stroke color.\n" +"\n" +" :return: Red component of the stroke color.\n" +" :rtype: float\n"; + +static PyObject *StrokeAttribute_getColorR( BPy_StrokeAttribute *self ) { return PyFloat_FromDouble( self->sa->getColorR() ); } -PyObject *StrokeAttribute_getColorG( BPy_StrokeAttribute *self ) { +static char StrokeAttribute_getColorG___doc__[] = +".. method:: getColorG()\n" +"\n" +" Returns the green component of the stroke color.\n" +"\n" +" :return: Green component of the stroke color.\n" +" :rtype: float\n"; + +static PyObject *StrokeAttribute_getColorG( BPy_StrokeAttribute *self ) { return PyFloat_FromDouble( self->sa->getColorG() ); } -PyObject *StrokeAttribute_getColorB( BPy_StrokeAttribute *self ) { +static char StrokeAttribute_getColorB___doc__[] = +".. method:: getColorB()\n" +"\n" +" Returns the blue component of the stroke color.\n" +"\n" +" :return: Blue component of the stroke color.\n" +" :rtype: float\n"; + +static PyObject *StrokeAttribute_getColorB( BPy_StrokeAttribute *self ) { return PyFloat_FromDouble( self->sa->getColorB() ); } -PyObject *StrokeAttribute_getColorRGB( BPy_StrokeAttribute *self ) { +static char StrokeAttribute_getColorRGB___doc__[] = +".. method:: getColorRGB()\n" +"\n" +" Returns the RGB components of the stroke color.\n" +"\n" +" :return: RGB components of the stroke color.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static PyObject *StrokeAttribute_getColorRGB( BPy_StrokeAttribute *self ) { Vec3f v( self->sa->getColorRGB() ); return Vector_from_Vec3f( v ); } -PyObject *StrokeAttribute_getAlpha( BPy_StrokeAttribute *self ) { +static char StrokeAttribute_getAlpha___doc__[] = +".. method:: getAlpha()\n" +"\n" +" Returns the alpha component of the stroke color.\n" +"\n" +" :return: Alpha component of the stroke color.\n" +" :rtype: float\n"; + +static PyObject *StrokeAttribute_getAlpha( BPy_StrokeAttribute *self ) { return PyFloat_FromDouble( self->sa->getAlpha() ); } -PyObject *StrokeAttribute_getThicknessR( BPy_StrokeAttribute *self ) { +static char StrokeAttribute_getThicknessR___doc__[] = +".. method:: getThicknessR()\n" +"\n" +" Returns the thickness on the right of the vertex when following\n" +" the stroke.\n" +"\n" +" :return: The thickness on the right of the vertex.\n" +" :rtype: float\n"; + +static PyObject *StrokeAttribute_getThicknessR( BPy_StrokeAttribute *self ) { return PyFloat_FromDouble( self->sa->getThicknessR() ); } -PyObject *StrokeAttribute_getThicknessL( BPy_StrokeAttribute *self ) { + +static char StrokeAttribute_getThicknessL___doc__[] = +".. method:: getThicknessL()\n" +"\n" +" Returns the thickness on the left of the vertex when following\n" +" the stroke.\n" +"\n" +" :return: The thickness on the left of the vertex.\n" +" :rtype: float\n"; + +static PyObject *StrokeAttribute_getThicknessL( BPy_StrokeAttribute *self ) { return PyFloat_FromDouble( self->sa->getThicknessL() ); } -PyObject *StrokeAttribute_getThicknessRL( BPy_StrokeAttribute *self ) { + +static char StrokeAttribute_getThicknessRL___doc__[] = +".. method:: getThicknessRL()\n" +"\n" +" Returns the thickness on the right and on the left of the vertex\n" +" when following the stroke.\n" +"\n" +" :return: A two-dimensional vector. The first value is the\n" +" thickness on the right of the vertex when following the stroke,\n" +" and the second one is the thickness on the left.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static PyObject *StrokeAttribute_getThicknessRL( BPy_StrokeAttribute *self ) { Vec2f v( self->sa->getThicknessRL() ); return Vector_from_Vec2f( v ); } -PyObject *StrokeAttribute_isVisible( BPy_StrokeAttribute *self ) { +static char StrokeAttribute_isVisible___doc__[] = +".. method:: isVisible()\n" +"\n" +" Returns true if the StrokeVertex is visible, false otherwise.\n" +"\n" +" :return: True if the StrokeVertex is visible, false otherwise.\n" +" :rtype: bool\n"; + +static PyObject *StrokeAttribute_isVisible( BPy_StrokeAttribute *self ) { return PyBool_from_bool( self->sa->isVisible() ); } - -PyObject *StrokeAttribute_getAttributeReal( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_getAttributeReal___doc__[] = +".. method:: getAttributeReal(iName)\n" +"\n" +" Returns an attribute of float type.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :return: The attribute value.\n" +" :rtype: float\n"; + +static PyObject *StrokeAttribute_getAttributeReal( BPy_StrokeAttribute *self, PyObject *args ) { char *attr; if(!( PyArg_ParseTuple(args, "s", &attr) )) @@ -232,7 +264,17 @@ PyObject *StrokeAttribute_getAttributeReal( BPy_StrokeAttribute *self, PyObject return PyFloat_FromDouble( a ); } -PyObject *StrokeAttribute_getAttributeVec2f( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_getAttributeVec2f___doc__[] = +".. method:: getAttributeVec2f(iName)\n" +"\n" +" Returns an attribute of two-dimensional vector type.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :return: The attribute value.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static PyObject *StrokeAttribute_getAttributeVec2f( BPy_StrokeAttribute *self, PyObject *args ) { char *attr; if(!( PyArg_ParseTuple(args, "s", &attr) )) @@ -242,8 +284,17 @@ PyObject *StrokeAttribute_getAttributeVec2f( BPy_StrokeAttribute *self, PyObject return Vector_from_Vec2f( a ); } - -PyObject *StrokeAttribute_getAttributeVec3f( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_getAttributeVec3f___doc__[] = +".. method:: getAttributeVec3f(iName)\n" +"\n" +" Returns an attribute of three-dimensional vector type.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :return: The attribute value.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static PyObject *StrokeAttribute_getAttributeVec3f( BPy_StrokeAttribute *self, PyObject *args ) { char *attr; if(!( PyArg_ParseTuple(args, "s", &attr) )) @@ -253,7 +304,17 @@ PyObject *StrokeAttribute_getAttributeVec3f( BPy_StrokeAttribute *self, PyObject return Vector_from_Vec3f( a ); } -PyObject *StrokeAttribute_isAttributeAvailableReal( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_isAttributeAvailableReal___doc__[] = +".. method:: isAttributeAvailableReal(iName)\n" +"\n" +" Checks whether the attribute iName of float type is available.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :return: True if the attribute is availbale.\n" +" :rtype: bool\n"; + +static PyObject *StrokeAttribute_isAttributeAvailableReal( BPy_StrokeAttribute *self, PyObject *args ) { char *attr; if(!( PyArg_ParseTuple(args, "s", &attr) )) @@ -262,7 +323,18 @@ PyObject *StrokeAttribute_isAttributeAvailableReal( BPy_StrokeAttribute *self, P return PyBool_from_bool( self->sa->isAttributeAvailableReal( attr ) ); } -PyObject *StrokeAttribute_isAttributeAvailableVec2f( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_isAttributeAvailableVec2f___doc__[] = +".. method:: isAttributeAvailableVec2f(iName)\n" +"\n" +" Checks whether the attribute iName of two-dimensional vector type\n" +" is available.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :return: True if the attribute is availbale.\n" +" :rtype: bool\n"; + +static PyObject *StrokeAttribute_isAttributeAvailableVec2f( BPy_StrokeAttribute *self, PyObject *args ) { char *attr; if(!( PyArg_ParseTuple(args, "s", &attr) )) @@ -271,7 +343,18 @@ PyObject *StrokeAttribute_isAttributeAvailableVec2f( BPy_StrokeAttribute *self, return PyBool_from_bool( self->sa->isAttributeAvailableVec2f( attr ) ); } -PyObject *StrokeAttribute_isAttributeAvailableVec3f( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_isAttributeAvailableVec3f___doc__[] = +".. method:: isAttributeAvailableVec3f(iName)\n" +"\n" +" Checks whether the attribute iName of three-dimensional vector\n" +" type is available.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :return: True if the attribute is availbale.\n" +" :rtype: bool\n"; + +static PyObject *StrokeAttribute_isAttributeAvailableVec3f( BPy_StrokeAttribute *self, PyObject *args ) { char *attr; if(!( PyArg_ParseTuple(args, "s", &attr) )) @@ -281,7 +364,26 @@ PyObject *StrokeAttribute_isAttributeAvailableVec3f( BPy_StrokeAttribute *self, } -PyObject * StrokeAttribute_setColor( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_setColor___doc__[] = +".. method:: setColor(r, g, b)\n" +"\n" +" Sets the stroke color.\n" +"\n" +" :arg r: Red component of the stroke color.\n" +" :type r: float\n" +" :arg g: Green component of the stroke color.\n" +" :type g: float\n" +" :arg b: Blue component of the stroke color.\n" +" :type b: float\n" +"\n" +".. method:: setColor(iRGB)\n" +"\n" +" Sets the stroke color.\n" +"\n" +" :arg iRGB: The new RGB values.\n" +" :type iRGB: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n"; + +static PyObject * StrokeAttribute_setColor( BPy_StrokeAttribute *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0 ; if(!( PyArg_ParseTuple(args, "O|OO", &obj1, &obj2, &obj3) )) @@ -311,7 +413,15 @@ PyObject * StrokeAttribute_setColor( BPy_StrokeAttribute *self, PyObject *args ) Py_RETURN_NONE; } -PyObject * StrokeAttribute_setAlpha( BPy_StrokeAttribute *self, PyObject *args ){ +static char StrokeAttribute_setAlpha___doc__[] = +".. method:: setAlpha(alpha)\n" +"\n" +" Sets the alpha component of the stroke color.\n" +"\n" +" :arg alpha: The new alpha value.\n" +" :type alpha: float\n"; + +static PyObject * StrokeAttribute_setAlpha( BPy_StrokeAttribute *self, PyObject *args ){ float f = 0; if(!( PyArg_ParseTuple(args, "f", &f) )) @@ -321,7 +431,27 @@ PyObject * StrokeAttribute_setAlpha( BPy_StrokeAttribute *self, PyObject *args ) Py_RETURN_NONE; } -PyObject * StrokeAttribute_setThickness( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_setThickness___doc__[] = +".. method:: setThickness(tr, tl)\n" +"\n" +" Sets the stroke thickness.\n" +"\n" +" :arg tr: The thickness on the right of the vertex when following\n" +" the stroke.\n" +" :type tr: float\n" +" :arg tl: The thickness on the left of the vertex when following\n" +" the stroke.\n" +" :type tl: float\n" +"\n" +".. method:: setThickness(tRL)\n" +"\n" +" Sets the stroke thickness.\n" +"\n" +" :arg tRL: The thickness on the right and on the left of the vertex\n" +" when following the stroke.\n" +" :type tRL: :class:`Mathutils.Vector`, list or tuple of 2 real numbers\n"; + +static PyObject * StrokeAttribute_setThickness( BPy_StrokeAttribute *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0; if(!( PyArg_ParseTuple(args, "O|O", &obj1, &obj2) )) @@ -350,7 +480,15 @@ PyObject * StrokeAttribute_setThickness( BPy_StrokeAttribute *self, PyObject *ar Py_RETURN_NONE; } -PyObject * StrokeAttribute_setVisible( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_setVisible___doc__[] = +".. method:: setVisible(iVisible)\n" +"\n" +" Sets the visibility flag. True means the StrokeVertex is visible.\n" +"\n" +" :arg iVisible: True if the StrokeVertex is visible.\n" +" :type iVisible: bool\n"; + +static PyObject * StrokeAttribute_setVisible( BPy_StrokeAttribute *self, PyObject *args ) { PyObject *py_b; if(!( PyArg_ParseTuple(args, "O", &py_b) )) @@ -361,8 +499,19 @@ PyObject * StrokeAttribute_setVisible( BPy_StrokeAttribute *self, PyObject *args Py_RETURN_NONE; } - -PyObject * StrokeAttribute_setAttributeReal( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_setAttributeReal___doc__[] = +".. method:: setAttributeReal(iName, att)\n" +"\n" +" Adds a user-defined attribute of float type. If there is no\n" +" attribute of the given name, it is added. Otherwise, the new value\n" +" replaces the old one.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :arg att: The attribute value.\n" +" :type att: float\n"; + +static PyObject * StrokeAttribute_setAttributeReal( BPy_StrokeAttribute *self, PyObject *args ) { char *s = 0; double d = 0; @@ -373,7 +522,19 @@ PyObject * StrokeAttribute_setAttributeReal( BPy_StrokeAttribute *self, PyObject Py_RETURN_NONE; } -PyObject * StrokeAttribute_setAttributeVec2f( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_setAttributeVec2f___doc__[] = +".. method:: setAttributeVec2f(iName, att)\n" +"\n" +" Adds a user-defined attribute of two-dimensional vector type. If\n" +" there is no attribute of the given name, it is added. Otherwise,\n" +" the new value replaces the old one.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :arg att: The attribute value.\n" +" :type att: :class:`Mathutils.Vector`, list or tuple of 2 real numbers\n"; + +static PyObject * StrokeAttribute_setAttributeVec2f( BPy_StrokeAttribute *self, PyObject *args ) { char *s; PyObject *obj = 0; @@ -390,7 +551,19 @@ PyObject * StrokeAttribute_setAttributeVec2f( BPy_StrokeAttribute *self, PyObjec Py_RETURN_NONE; } -PyObject * StrokeAttribute_setAttributeVec3f( BPy_StrokeAttribute *self, PyObject *args ) { +static char StrokeAttribute_setAttributeVec3f___doc__[] = +".. method:: setAttributeVec3f(iName, att)\n" +"\n" +" Adds a user-defined attribute of three-dimensional vector type.\n" +" If there is no attribute of the given name, it is added.\n" +" Otherwise, the new value replaces the old one.\n" +"\n" +" :arg iName: The name of the attribute.\n" +" :type iName: string\n" +" :arg att: The attribute value.\n" +" :type att: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n"; + +static PyObject * StrokeAttribute_setAttributeVec3f( BPy_StrokeAttribute *self, PyObject *args ) { char *s; PyObject *obj = 0; @@ -407,6 +580,76 @@ PyObject * StrokeAttribute_setAttributeVec3f( BPy_StrokeAttribute *self, PyObjec Py_RETURN_NONE; } +/*----------------------StrokeAttribute instance definitions ----------------------------*/ +static PyMethodDef BPy_StrokeAttribute_methods[] = { + {"getColorR", ( PyCFunction ) StrokeAttribute_getColorR, METH_NOARGS, StrokeAttribute_getColorR___doc__}, + {"getColorG", ( PyCFunction ) StrokeAttribute_getColorG, METH_NOARGS, StrokeAttribute_getColorG___doc__}, + {"getColorB", ( PyCFunction ) StrokeAttribute_getColorB, METH_NOARGS, StrokeAttribute_getColorB___doc__}, + {"getColorRGB", ( PyCFunction ) StrokeAttribute_getColorRGB, METH_NOARGS, StrokeAttribute_getColorRGB___doc__}, + {"getAlpha", ( PyCFunction ) StrokeAttribute_getAlpha, METH_NOARGS, StrokeAttribute_getAlpha___doc__}, + {"getThicknessR", ( PyCFunction ) StrokeAttribute_getThicknessR, METH_NOARGS, StrokeAttribute_getThicknessR___doc__}, + {"getThicknessL", ( PyCFunction ) StrokeAttribute_getThicknessL, METH_NOARGS, StrokeAttribute_getThicknessL___doc__}, + {"getThicknessRL", ( PyCFunction ) StrokeAttribute_getThicknessRL, METH_NOARGS, StrokeAttribute_getThicknessRL___doc__}, + {"isVisible", ( PyCFunction ) StrokeAttribute_isVisible, METH_NOARGS, StrokeAttribute_isVisible___doc__}, + {"getAttributeReal", ( PyCFunction ) StrokeAttribute_getAttributeReal, METH_VARARGS, StrokeAttribute_getAttributeReal___doc__}, + {"getAttributeVec2f", ( PyCFunction ) StrokeAttribute_getAttributeVec2f, METH_VARARGS, StrokeAttribute_getAttributeVec2f___doc__}, + {"getAttributeVec3f", ( PyCFunction ) StrokeAttribute_getAttributeVec3f, METH_VARARGS, StrokeAttribute_getAttributeVec3f___doc__}, + {"isAttributeAvailableReal", ( PyCFunction ) StrokeAttribute_isAttributeAvailableReal, METH_VARARGS, StrokeAttribute_isAttributeAvailableReal___doc__}, + {"isAttributeAvailableVec2f", ( PyCFunction ) StrokeAttribute_isAttributeAvailableVec2f, METH_VARARGS, StrokeAttribute_isAttributeAvailableVec2f___doc__}, + {"isAttributeAvailableVec3f", ( PyCFunction ) StrokeAttribute_isAttributeAvailableVec3f, METH_VARARGS, StrokeAttribute_isAttributeAvailableVec3f___doc__}, + {"setColor", ( PyCFunction ) StrokeAttribute_setColor, METH_VARARGS, StrokeAttribute_setColor___doc__}, + {"setAlpha", ( PyCFunction ) StrokeAttribute_setAlpha, METH_VARARGS, StrokeAttribute_setAlpha___doc__}, + {"setThickness", ( PyCFunction ) StrokeAttribute_setThickness, METH_VARARGS, StrokeAttribute_setThickness___doc__}, + {"setVisible", ( PyCFunction ) StrokeAttribute_setVisible, METH_VARARGS, StrokeAttribute_setVisible___doc__}, + {"setAttributeReal", ( PyCFunction ) StrokeAttribute_setAttributeReal, METH_VARARGS, StrokeAttribute_setAttributeReal___doc__}, + {"setAttributeVec2f", ( PyCFunction ) StrokeAttribute_setAttributeVec2f, METH_VARARGS, StrokeAttribute_setAttributeVec2f___doc__}, + {"setAttributeVec3f", ( PyCFunction ) StrokeAttribute_setAttributeVec3f, METH_VARARGS, StrokeAttribute_setAttributeVec3f___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_StrokeAttribute type definition ------------------------------*/ + +PyTypeObject StrokeAttribute_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "StrokeAttribute", /* tp_name */ + sizeof(BPy_StrokeAttribute), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)StrokeAttribute___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)StrokeAttribute___repr__, /* 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 */ + StrokeAttribute___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_StrokeAttribute_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeAttribute___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index 637d917fb6d..820f029223f 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -32,64 +32,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for StrokeShader instance -----------*/ -static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds); -static void StrokeShader___dealloc__(BPy_StrokeShader *self); -static PyObject * StrokeShader___repr__(BPy_StrokeShader *self); - -static PyObject * StrokeShader_getName( BPy_StrokeShader *self, PyObject *args); -static PyObject * StrokeShader_shade( BPy_StrokeShader *self , PyObject *args); - -/*----------------------StrokeShader instance definitions ----------------------------*/ -static PyMethodDef BPy_StrokeShader_methods[] = { - {"getName", ( PyCFunction ) StrokeShader_getName, METH_NOARGS, "() Returns the string of the name of the binary predicate."}, - {"shade", ( PyCFunction ) StrokeShader_shade, METH_VARARGS, "(Stroke s) The shading method. This method must be overloaded by inherited classes. The shading method is designed to modify any Stroke's attribute such as Thickness, Color, Geometry, Texture, Blending mode... The basic way to achieve this operation consists in iterating over the StrokeVertices of the Stroke and to modify each one's StrokeAttribute."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_StrokeShader type definition ------------------------------*/ - -PyTypeObject StrokeShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeShader", /* tp_name */ - sizeof(BPy_StrokeShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)StrokeShader___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)StrokeShader___repr__, /* 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 */ - "StrokeShader objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_StrokeShader_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeShader___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int StrokeShader_Init( PyObject *module ) { @@ -216,7 +158,26 @@ int StrokeShader_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds) +static char StrokeShader___doc__[] = +"Base class for stroke shaders. Any stroke shader must inherit from\n" +"this class and overload the shade() method. A StrokeShader is\n" +"designed to modify stroke attributes such as thickness, color,\n" +"geometry, texture, blending mode, and so on. The basic way for this\n" +"operation is to iterate over the stroke vertices of the :class:`Stroke`\n" +"and to modify the :class:`StrokeAttribute` of each vertex. Here is a\n" +"code example of such an iteration::\n" +"\n" +" it = ioStroke.strokeVerticesBegin()\n" +" while it.isEnd() == 0:\n" +" att = it.getObject().attribute()\n" +" ## perform here any attribute modification\n" +" it.increment()\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -225,7 +186,7 @@ int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds return 0; } -void StrokeShader___dealloc__(BPy_StrokeShader* self) +static void StrokeShader___dealloc__(BPy_StrokeShader* self) { if (self->ss) delete self->ss; @@ -233,18 +194,33 @@ void StrokeShader___dealloc__(BPy_StrokeShader* self) } -PyObject * StrokeShader___repr__(BPy_StrokeShader* self) +static PyObject * StrokeShader___repr__(BPy_StrokeShader* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->ss->getName().c_str(), self->ss ); } +static char StrokeShader_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of this stroke shader.\n" +"\n" +" :return: The name of this stroke shader.\n" +" :rtype: string\n"; -PyObject * StrokeShader_getName( BPy_StrokeShader *self, PyObject *args) +static PyObject * StrokeShader_getName( BPy_StrokeShader *self, PyObject *args) { return PyUnicode_FromFormat( self->ss->getName().c_str() ); } -PyObject *StrokeShader_shade( BPy_StrokeShader *self , PyObject *args) { +static char StrokeShader_shade___doc__[] = +".. method:: shade(s)\n" +"\n" +" The shading method. Must be overloaded by inherited classes.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static PyObject *StrokeShader_shade( BPy_StrokeShader *self , PyObject *args) { PyObject *py_s = 0; if(!( PyArg_ParseTuple(args, "O!", &Stroke_Type, &py_s) )) @@ -264,7 +240,55 @@ PyObject *StrokeShader_shade( BPy_StrokeShader *self , PyObject *args) { Py_RETURN_NONE; } +/*----------------------StrokeShader instance definitions ----------------------------*/ +static PyMethodDef BPy_StrokeShader_methods[] = { + {"getName", ( PyCFunction ) StrokeShader_getName, METH_NOARGS, StrokeShader_getName___doc__}, + {"shade", ( PyCFunction ) StrokeShader_shade, METH_VARARGS, StrokeShader_shade___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_StrokeShader type definition ------------------------------*/ +PyTypeObject StrokeShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "StrokeShader", /* tp_name */ + sizeof(BPy_StrokeShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)StrokeShader___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)StrokeShader___repr__, /* 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 */ + StrokeShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_StrokeShader_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeShader___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp index 8558daf0693..b254786897c 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp @@ -18,10 +18,63 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0D instance -----------*/ +//-------------------MODULE INITIALIZATION-------------------------------- +int UnaryFunction0D_Init( PyObject *module ) +{ + if( module == NULL ) + return -1; -static void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D *self); -static PyObject * UnaryFunction0D___repr__(BPy_UnaryFunction0D *self); + if( PyType_Ready( &UnaryFunction0D_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction0D_Type ); + PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type); + + UnaryFunction0DDouble_Init( module ); + UnaryFunction0DEdgeNature_Init( module ); + UnaryFunction0DFloat_Init( module ); + UnaryFunction0DId_Init( module ); + UnaryFunction0DMaterial_Init( module ); + UnaryFunction0DUnsigned_Init( module ); + UnaryFunction0DVec2f_Init( module ); + UnaryFunction0DVec3f_Init( module ); + UnaryFunction0DVectorViewShape_Init( module ); + UnaryFunction0DViewShape_Init( module ); + + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction0D___doc__[] = +"Base class for Unary Functions (functors) working on\n" +":class:`Interface0DIterator`. A unary function will be used by\n" +"invoking __call__() on an Interface0DIterator. In Python, several\n" +"different subclasses of UnaryFunction0D are used depending on the\n" +"types of functors' return values. For example, you would inherit from\n" +"a :class:`UnaryFunction0DDouble` if you wish to define a function that\n" +"returns a double value. Available UnaryFunction0D subclasses are:\n" +"\n" +"* :class:`UnaryFunction0DDouble`\n" +"* :class:`UnaryFunction0DEdgeNature`\n" +"* :class:`UnaryFunction0DFloat`\n" +"* :class:`UnaryFunction0DId`\n" +"* :class:`UnaryFunction0DMaterial`\n" +"* :class:`UnaryFunction0DUnsigned`\n" +"* :class:`UnaryFunction0DVec2f`\n" +"* :class:`UnaryFunction0DVec3f`\n" +"* :class:`UnaryFunction0DVectorViewShape`\n" +"* :class:`UnaryFunction0DViewShape`\n"; + +static void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D* self) +{ + Py_TYPE(self)->tp_free((PyObject*)self); +} + + +static PyObject * UnaryFunction0D___repr__(BPy_UnaryFunction0D* self) +{ + return PyUnicode_FromFormat("UnaryFunction0D"); +} /*-----------------------BPy_UnaryFunction0D type definition ------------------------------*/ @@ -46,7 +99,7 @@ PyTypeObject UnaryFunction0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0D objects", /* tp_doc */ + UnaryFunction0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -66,44 +119,6 @@ PyTypeObject UnaryFunction0D_Type = { PyType_GenericNew, /* tp_new */ }; -//-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0D_Init( PyObject *module ) -{ - if( module == NULL ) - return -1; - - if( PyType_Ready( &UnaryFunction0D_Type ) < 0 ) - return -1; - Py_INCREF( &UnaryFunction0D_Type ); - PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type); - - UnaryFunction0DDouble_Init( module ); - UnaryFunction0DEdgeNature_Init( module ); - UnaryFunction0DFloat_Init( module ); - UnaryFunction0DId_Init( module ); - UnaryFunction0DMaterial_Init( module ); - UnaryFunction0DUnsigned_Init( module ); - UnaryFunction0DVec2f_Init( module ); - UnaryFunction0DVec3f_Init( module ); - UnaryFunction0DVectorViewShape_Init( module ); - UnaryFunction0DViewShape_Init( module ); - - return 0; -} - -//------------------------INSTANCE METHODS ---------------------------------- - -void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D* self) -{ - Py_TYPE(self)->tp_free((PyObject*)self); -} - - -PyObject * UnaryFunction0D___repr__(BPy_UnaryFunction0D* self) -{ - return PyUnicode_FromFormat("UnaryFunction0D"); -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp index c05ba35422f..a9ca73003f5 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp @@ -15,10 +15,57 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1D instance -----------*/ +//-------------------MODULE INITIALIZATION-------------------------------- +int UnaryFunction1D_Init( PyObject *module ) +{ + if( module == NULL ) + return -1; + + if( PyType_Ready( &UnaryFunction1D_Type ) < 0 ) + return -1; + Py_INCREF( &UnaryFunction1D_Type ); + PyModule_AddObject(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type); + + UnaryFunction1DDouble_Init( module ); + UnaryFunction1DEdgeNature_Init( module ); + UnaryFunction1DFloat_Init( module ); + UnaryFunction1DUnsigned_Init( module ); + UnaryFunction1DVec2f_Init( module ); + UnaryFunction1DVec3f_Init( module ); + UnaryFunction1DVectorViewShape_Init( module ); + UnaryFunction1DVoid_Init( module ); + return 0; +} + +//------------------------INSTANCE METHODS ---------------------------------- + +static char UnaryFunction1D___doc__[] = +"Base class for Unary Functions (functors) working on\n" +":class:`Interface1D`. A unary function will be used by invoking\n" +"__call__() on an Interface1D. In Python, several different subclasses\n" +"of UnaryFunction1D are used depending on the types of functors' return\n" +"values. For example, you would inherit from a\n" +":class:`UnaryFunction1DDouble` if you wish to define a function that\n" +"returns a double value. Available UnaryFunction1D subclasses are:\n" +"\n" +"* :class:`UnaryFunction1DDouble`\n" +"* :class:`UnaryFunction1DEdgeNature`\n" +"* :class:`UnaryFunction1DFloat`\n" +"* :class:`UnaryFunction1DUnsigned`\n" +"* :class:`UnaryFunction1DVec2f`\n" +"* :class:`UnaryFunction1DVec3f`\n" +"* :class:`UnaryFunction1DVectorViewShape`\n" +"* :class:`UnaryFunction1DVoid`\n"; + +static void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D* self) +{ + Py_TYPE(self)->tp_free((PyObject*)self); +} -static void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D *self); -static PyObject * UnaryFunction1D___repr__(BPy_UnaryFunction1D *self); +static PyObject * UnaryFunction1D___repr__(BPy_UnaryFunction1D* self) +{ + return PyUnicode_FromFormat("UnaryFunction1D"); +} /*-----------------------BPy_UnaryFunction1D type definition ------------------------------*/ @@ -43,7 +90,7 @@ PyTypeObject UnaryFunction1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction1D objects", /* tp_doc */ + UnaryFunction1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -63,41 +110,6 @@ PyTypeObject UnaryFunction1D_Type = { PyType_GenericNew, /* tp_new */ }; -//-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1D_Init( PyObject *module ) -{ - if( module == NULL ) - return -1; - - if( PyType_Ready( &UnaryFunction1D_Type ) < 0 ) - return -1; - Py_INCREF( &UnaryFunction1D_Type ); - PyModule_AddObject(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type); - - UnaryFunction1DDouble_Init( module ); - UnaryFunction1DEdgeNature_Init( module ); - UnaryFunction1DFloat_Init( module ); - UnaryFunction1DUnsigned_Init( module ); - UnaryFunction1DVec2f_Init( module ); - UnaryFunction1DVec3f_Init( module ); - UnaryFunction1DVectorViewShape_Init( module ); - UnaryFunction1DVoid_Init( module ); - return 0; -} - -//------------------------INSTANCE METHODS ---------------------------------- - -void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D* self) -{ - Py_TYPE(self)->tp_free((PyObject*)self); -} - - -PyObject * UnaryFunction1D___repr__(BPy_UnaryFunction1D* self) -{ - return PyUnicode_FromFormat("UnaryFunction1D"); -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index 0a2a943b346..9de3c5cc389 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -11,63 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryPredicate0D instance -----------*/ -static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds); -static void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D *self); -static PyObject * UnaryPredicate0D___repr__(BPy_UnaryPredicate0D *self); -static PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds); - -static PyObject * UnaryPredicate0D_getName( BPy_UnaryPredicate0D *self ); - -/*----------------------UnaryPredicate0D instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryPredicate0D_methods[] = { - {"getName", ( PyCFunction ) UnaryPredicate0D_getName, METH_NOARGS, "Returns the string of the name of the UnaryPredicate0D."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryPredicate0D type definition ------------------------------*/ - -PyTypeObject UnaryPredicate0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryPredicate0D", /* tp_name */ - sizeof(BPy_UnaryPredicate0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryPredicate0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryPredicate0D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryPredicate0D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryPredicate0D objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryPredicate0D_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryPredicate0D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryPredicate0D_Init( PyObject *module ) { @@ -94,7 +37,29 @@ int UnaryPredicate0D_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) +static char UnaryPredicate0D___doc__[] = +"Base class for unary predicates that work on\n" +":class:`Interface0DIterator`. A UnaryPredicate0D is a functor that\n" +"evaluates a condition on an Interface0DIterator and returns true or\n" +"false depending on whether this condition is satisfied or not. The\n" +"UnaryPredicate0D is used by invoking its __call__() method. Any\n" +"inherited class must overload the __call__() method.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Must be overload by inherited classes.\n" +"\n" +" :arg it: The Interface0DIterator pointing onto the Interface0D at\n" +" which we wish to evaluate the predicate.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: True if the condition is satisfied, false otherwise.\n" +" :rtype: bool\n"; + +static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -103,26 +68,32 @@ int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObje return 0; } -void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D* self) +static void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D* self) { if (self->up0D) delete self->up0D; Py_TYPE(self)->tp_free((PyObject*)self); } - -PyObject * UnaryPredicate0D___repr__(BPy_UnaryPredicate0D* self) +static PyObject * UnaryPredicate0D___repr__(BPy_UnaryPredicate0D* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->up0D->getName().c_str(), self->up0D ); } +static char UnaryPredicate0D_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the UnaryPredicate0D.\n" +"\n" +" :return: The name of the UnaryPredicate0D.\n" +" :rtype: string\n"; -PyObject * UnaryPredicate0D_getName( BPy_UnaryPredicate0D *self ) +static PyObject * UnaryPredicate0D_getName( BPy_UnaryPredicate0D *self ) { return PyUnicode_FromFormat( self->up0D->getName().c_str() ); } -PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) { PyObject *py_if0D_it; @@ -154,6 +125,54 @@ PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args return PyBool_from_bool( self->up0D->result ); } +/*----------------------UnaryPredicate0D instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryPredicate0D_methods[] = { + {"getName", ( PyCFunction ) UnaryPredicate0D_getName, METH_NOARGS, UnaryPredicate0D_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryPredicate0D type definition ------------------------------*/ + +PyTypeObject UnaryPredicate0D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryPredicate0D", /* tp_name */ + sizeof(BPy_UnaryPredicate0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryPredicate0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryPredicate0D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryPredicate0D___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryPredicate0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryPredicate0D_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryPredicate0D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index be0062644fd..8f68bba17b1 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -19,63 +19,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryPredicate1D instance -----------*/ -static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds); -static void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D *self); -static PyObject * UnaryPredicate1D___repr__(BPy_UnaryPredicate1D *self); -static PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds); - -static PyObject * UnaryPredicate1D_getName( BPy_UnaryPredicate1D *self, PyObject *args); - -/*----------------------UnaryPredicate1D instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryPredicate1D_methods[] = { - {"getName", ( PyCFunction ) UnaryPredicate1D_getName, METH_NOARGS, ""}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryPredicate1D type definition ------------------------------*/ - -PyTypeObject UnaryPredicate1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryPredicate1D", /* tp_name */ - sizeof(BPy_UnaryPredicate1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryPredicate1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryPredicate1D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryPredicate1D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryPredicate1D objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryPredicate1D_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryPredicate1D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryPredicate1D_Init( PyObject *module ) { @@ -137,7 +80,28 @@ int UnaryPredicate1D_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) +static char UnaryPredicate1D___doc__[] = +"Base class for unary predicates that work on :class:`Interface1D`. A\n" +"UnaryPredicate1D is a functor that evaluates a condition on a\n" +"Interface1D and returns true or false depending on whether this\n" +"condition is satisfied or not. The UnaryPredicate1D is used by\n" +"invoking its __call__() method. Any inherited class must overload the\n" +"__call__() method.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Must be overload by inherited classes.\n" +"\n" +" :arg inter: The Interface1D on which we wish to evaluate the predicate.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True if the condition is satisfied, false otherwise.\n" +" :rtype: bool\n"; + +static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) { if( !PyArg_ParseTuple(args, "") ) return -1; @@ -146,21 +110,31 @@ int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObje return 0; } -void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D* self) +static void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D* self) { if (self->up1D) delete self->up1D; Py_TYPE(self)->tp_free((PyObject*)self); } - -PyObject * UnaryPredicate1D___repr__(BPy_UnaryPredicate1D* self) +static PyObject * UnaryPredicate1D___repr__(BPy_UnaryPredicate1D* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->up1D->getName().c_str(), self->up1D ); } - -PyObject * UnaryPredicate1D_getName( BPy_UnaryPredicate1D *self, PyObject *args) +static char UnaryPredicate1D_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the string of the name of the UnaryPredicate1D.\n" +"\n" +" Reimplemented in TrueUP1D, FalseUP1D, QuantitativeInvisibilityUP1D,\n" +" ContourUP1D, ExternalContourUP1D, EqualToTimeStampUP1D,\n" +" EqualToChainingTimeStampUP1D, ShapeUP1D, and DensityLowerThanUP1D.\n" +"\n" +" :return: \n" +" :rtype: string\n"; + +static PyObject * UnaryPredicate1D_getName( BPy_UnaryPredicate1D *self, PyObject *args) { return PyUnicode_FromFormat( self->up1D->getName().c_str() ); } @@ -197,6 +171,54 @@ static PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObjec return PyBool_from_bool( self->up1D->result ); } +/*----------------------UnaryPredicate1D instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryPredicate1D_methods[] = { + {"getName", ( PyCFunction ) UnaryPredicate1D_getName, METH_NOARGS, UnaryPredicate1D_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryPredicate1D type definition ------------------------------*/ + +PyTypeObject UnaryPredicate1D_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryPredicate1D", /* tp_name */ + sizeof(BPy_UnaryPredicate1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryPredicate1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryPredicate1D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryPredicate1D___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryPredicate1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryPredicate1D_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryPredicate1D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp index 19ba7469a24..c9667103e5a 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp @@ -11,68 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ViewMap instance -----------*/ -static int ViewMap___init__(BPy_ViewMap *self, PyObject *args, PyObject *kwds); -static void ViewMap___dealloc__(BPy_ViewMap *self); -static PyObject * ViewMap___repr__(BPy_ViewMap* self); - -static PyObject * ViewMap_getClosestViewEdge( BPy_ViewMap *self , PyObject *args); -static PyObject * ViewMap_getClosestFEdge( BPy_ViewMap *self , PyObject *args); -static PyObject * ViewMap_getScene3dBBox( BPy_ViewMap *self , PyObject *args); -static PyObject * ViewMap_setScene3dBBox( BPy_ViewMap *self , PyObject *args); - -/*---------------------- BPy_ViewShape instance definitions ----------------------------*/ -static PyMethodDef BPy_ViewMap_methods[] = { - {"getClosestViewEdge", ( PyCFunction ) ViewMap_getClosestViewEdge, METH_VARARGS, "(double x, double y) Gets the viewedge the nearest to the 2D position specified as argument "}, - {"getClosestFEdge", ( PyCFunction ) ViewMap_getClosestFEdge, METH_VARARGS, "(double x, double y) Gets the Fedge the nearest to the 2D position specified as argument "}, - {"getScene3dBBox", ( PyCFunction ) ViewMap_getScene3dBBox, METH_NOARGS, "() Returns the scene 3D bounding box. "}, - {"setScene3dBBox", ( PyCFunction ) ViewMap_setScene3dBBox, METH_VARARGS, "(BBox bb) Sets the scene 3D bounding box."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_ViewMap type definition ------------------------------*/ - -PyTypeObject ViewMap_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewMap", /* tp_name */ - sizeof(BPy_ViewMap), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ViewMap___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)ViewMap___repr__, /* 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 */ - "ViewMap objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewMap_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewMap___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int ViewMap_Init( PyObject *module ) { @@ -89,25 +27,44 @@ int ViewMap_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int ViewMap___init__(BPy_ViewMap *self, PyObject *args, PyObject *kwds) +static char ViewMap___doc__[] = +"Class defining the ViewMap.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int ViewMap___init__(BPy_ViewMap *self, PyObject *args, PyObject *kwds) { self->vm = new ViewMap(); return 0; } -void ViewMap___dealloc__(BPy_ViewMap *self) +static void ViewMap___dealloc__(BPy_ViewMap *self) { if( self->vm ) delete self->vm; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * ViewMap___repr__(BPy_ViewMap *self) +static PyObject * ViewMap___repr__(BPy_ViewMap *self) { return PyUnicode_FromFormat("ViewMap - address: %p", self->vm ); } -PyObject * ViewMap_getClosestViewEdge( BPy_ViewMap *self , PyObject *args) { +static char ViewMap_getClosestViewEdge___doc__[] = +".. method:: getClosestViewEdge(x, y)\n" +"\n" +" Gets the ViewEdge nearest to the 2D point specified as arguments.\n" +"\n" +" :arg x: X coordinate of a 2D point.\n" +" :type x: float\n" +" :arg y: Y coordinate of a 2D point.\n" +" :type y: float\n" +" :return: The ViewEdge nearest to the specified 2D point.\n" +" :rtype: :class:`ViewEdge`\n"; + +static PyObject * ViewMap_getClosestViewEdge( BPy_ViewMap *self , PyObject *args) { double x, y; if(!( PyArg_ParseTuple(args, "dd", &x, &y) )) @@ -120,7 +77,19 @@ PyObject * ViewMap_getClosestViewEdge( BPy_ViewMap *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * ViewMap_getClosestFEdge( BPy_ViewMap *self , PyObject *args) { +static char ViewMap_getClosestFEdge___doc__[] = +".. method:: getClosestFEdge(x, y)\n" +"\n" +" Gets the FEdge nearest to the 2D point specified as arguments.\n" +"\n" +" :arg x: X coordinate of a 2D point.\n" +" :type x: float\n" +" :arg y: Y coordinate of a 2D point.\n" +" :type y: float\n" +" :return: The FEdge nearest to the specified 2D point.\n" +" :rtype: :class:`FEdge`\n"; + +static PyObject * ViewMap_getClosestFEdge( BPy_ViewMap *self , PyObject *args) { double x, y; if(!( PyArg_ParseTuple(args, "dd", &x, &y) )) @@ -133,12 +102,28 @@ PyObject * ViewMap_getClosestFEdge( BPy_ViewMap *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * ViewMap_getScene3dBBox( BPy_ViewMap *self , PyObject *args) { +static char ViewMap_getScene3dBBox___doc__[] = +".. method:: getScene3dBBox()\n" +"\n" +" Returns the scene 3D bounding box.\n" +"\n" +" :return: The scene 3D bounding box.\n" +" :rtype: :class:`BBox`\n"; + +static PyObject * ViewMap_getScene3dBBox( BPy_ViewMap *self , PyObject *args) { BBox<Vec3r> bb( self->vm->getScene3dBBox() ); return BPy_BBox_from_BBox( bb ); } -PyObject * ViewMap_setScene3dBBox( BPy_ViewMap *self , PyObject *args) { +static char ViewMap_setScene3dBBox___doc__[] = +".. method:: setScene3dBBox(bbox)\n" +"\n" +" Sets the scene 3D bounding box.\n" +"\n" +" :arg bbox: The scene 3D bounding box.\n" +" :type bbox: :class:`BBox`\n"; + +static PyObject * ViewMap_setScene3dBBox( BPy_ViewMap *self , PyObject *args) { PyObject *py_bb = 0; if(!( PyArg_ParseTuple(args, "O!", &BBox_Type, &py_bb) )) @@ -149,6 +134,59 @@ PyObject * ViewMap_setScene3dBBox( BPy_ViewMap *self , PyObject *args) { Py_RETURN_NONE; } +// static ViewMap *getInstance (); + +/*---------------------- BPy_ViewShape instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewMap_methods[] = { + {"getClosestViewEdge", ( PyCFunction ) ViewMap_getClosestViewEdge, METH_VARARGS, ViewMap_getClosestViewEdge___doc__}, + {"getClosestFEdge", ( PyCFunction ) ViewMap_getClosestFEdge, METH_VARARGS, ViewMap_getClosestFEdge___doc__}, + {"getScene3dBBox", ( PyCFunction ) ViewMap_getScene3dBBox, METH_NOARGS, ViewMap_getScene3dBBox___doc__}, + {"setScene3dBBox", ( PyCFunction ) ViewMap_setScene3dBBox, METH_VARARGS, ViewMap_setScene3dBBox___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewMap type definition ------------------------------*/ + +PyTypeObject ViewMap_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ViewMap", /* tp_name */ + sizeof(BPy_ViewMap), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ViewMap___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)ViewMap___repr__, /* 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 */ + ViewMap___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewMap_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewMap___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 46ac5e44d0d..8849b6b3776 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -11,78 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ViewShape instance -----------*/ -static int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwds); -static void ViewShape___dealloc__(BPy_ViewShape *self); -static PyObject * ViewShape___repr__(BPy_ViewShape* self); - -static PyObject * ViewShape_sshape( BPy_ViewShape *self ); -static PyObject * ViewShape_vertices( BPy_ViewShape *self ); -static PyObject * ViewShape_edges( BPy_ViewShape *self ); -static PyObject * ViewShape_getId( BPy_ViewShape *self ); -static PyObject * ViewShape_setSShape( BPy_ViewShape *self , PyObject *args); -static PyObject * ViewShape_setVertices( BPy_ViewShape *self , PyObject *args); -static PyObject * ViewShape_setEdges( BPy_ViewShape *self , PyObject *args); -static PyObject * ViewShape_AddEdge( BPy_ViewShape *self , PyObject *args); -static PyObject * ViewShape_AddVertex( BPy_ViewShape *self , PyObject *args); - -/*---------------------- BPy_ViewShape instance definitions ----------------------------*/ -static PyMethodDef BPy_ViewShape_methods[] = { - {"sshape", ( PyCFunction ) ViewShape_sshape, METH_NOARGS, "() Returns the SShape on top of which this ViewShape is built. "}, - {"vertices", ( PyCFunction ) ViewShape_vertices, METH_NOARGS, "() Returns the list of ViewVertex contained in this ViewShape."}, - {"edges", ( PyCFunction ) ViewShape_edges, METH_NOARGS, "() Returns the list of ViewEdge contained in this ViewShape. "}, - {"getId", ( PyCFunction ) ViewShape_getId, METH_NOARGS, "() Returns the ViewShape id. "}, - {"setSShape", ( PyCFunction ) ViewShape_setSShape, METH_VARARGS, "(SShape ss) Sets the SShape on top of which the ViewShape is built. "}, - {"setVertices", ( PyCFunction ) ViewShape_setVertices, METH_VARARGS, "([<ViewVertex>]) Sets the list of ViewVertex contained in this ViewShape."}, - {"setEdges", ( PyCFunction ) ViewShape_setEdges, METH_VARARGS, "([<ViewEdge>]) Sets the list of ViewEdge contained in this ViewShape."}, - {"AddEdge", ( PyCFunction ) ViewShape_AddEdge, METH_VARARGS, "(ViewEdge ve) Adds a ViewEdge to the list "}, - {"AddVertex", ( PyCFunction ) ViewShape_AddVertex, METH_VARARGS, "(ViewVertex ve) Adds a ViewVertex to the list. "}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_ViewShape type definition ------------------------------*/ - -PyTypeObject ViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewShape", /* tp_name */ - sizeof(BPy_ViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)ViewShape___repr__, /* 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 */ - "ViewShape objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewShape_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int ViewShape_Init( PyObject *module ) { @@ -99,7 +27,29 @@ int ViewShape_Init( PyObject *module ) //------------------------INSTANCE METHODS ---------------------------------- -int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwds) +static char ViewShape___doc__[] = +"Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n" +"and :class:`ViewEdge`) that are issued from the same input shape.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A ViewShape object.\n" +" :type iBrother: :class:`ViewShape`\n" +"\n" +".. method:: __init__(iSShape)\n" +"\n" +" Builds a ViewShape from an SShape.\n" +"\n" +" :arg iSShape: An SShape object.\n" +" :type iSShape: :class:`SShape`\n"; + +static int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -124,24 +74,39 @@ int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwds) return 0; } -void ViewShape___dealloc__(BPy_ViewShape *self) +static void ViewShape___dealloc__(BPy_ViewShape *self) { if( self->vs && !self->borrowed ) delete self->vs; Py_TYPE(self)->tp_free((PyObject*)self); } -PyObject * ViewShape___repr__(BPy_ViewShape *self) +static PyObject * ViewShape___repr__(BPy_ViewShape *self) { return PyUnicode_FromFormat("ViewShape - address: %p", self->vs ); } -PyObject * ViewShape_sshape( BPy_ViewShape *self ) { +static char ViewShape_sshape___doc__[] = +".. method:: sshape()\n" +"\n" +" Returns the SShape on top of which this ViewShape is built.\n" +"\n" +" :return: The SShape on top of which this ViewShape is built.\n" +" :rtype: :class:`SShape`\n"; + +static PyObject * ViewShape_sshape( BPy_ViewShape *self ) { return BPy_SShape_from_SShape( *(self->vs->sshape()) ); } +static char ViewShape_vertices___doc__[] = +".. method:: vertices()\n" +"\n" +" Returns the list of ViewVertex objects contained in this ViewShape.\n" +"\n" +" :return: The list of ViewVertex objects.\n" +" :rtype: List of :class:`ViewVertex` objects\n"; -PyObject * ViewShape_vertices( BPy_ViewShape *self ) { +static PyObject * ViewShape_vertices( BPy_ViewShape *self ) { PyObject *py_vertices = PyList_New(0); vector< ViewVertex * > vertices = self->vs->vertices(); @@ -154,8 +119,15 @@ PyObject * ViewShape_vertices( BPy_ViewShape *self ) { return py_vertices; } +static char ViewShape_edges___doc__[] = +".. method:: edges()\n" +"\n" +" Returns the list of ViewEdge objects contained in this ViewShape.\n" +"\n" +" :return: The list of ViewEdge objects.\n" +" :rtype: List of :class:`ViewEdge` objects\n"; -PyObject * ViewShape_edges( BPy_ViewShape *self ) { +static PyObject * ViewShape_edges( BPy_ViewShape *self ) { PyObject *py_edges = PyList_New(0); vector< ViewEdge * > edges = self->vs->edges(); @@ -168,12 +140,28 @@ PyObject * ViewShape_edges( BPy_ViewShape *self ) { return py_edges; } -PyObject * ViewShape_getId( BPy_ViewShape *self ) { +static char ViewShape_getId___doc__[] = +".. method:: getId()\n" +"\n" +" Returns the ViewShape id.\n" +"\n" +" :return: An Id object.\n" +" :rtype: :class:`Id`\n"; + +static PyObject * ViewShape_getId( BPy_ViewShape *self ) { Id id( self->vs->getId() ); return BPy_Id_from_Id( id ); } -PyObject * ViewShape_setSShape( BPy_ViewShape *self , PyObject *args) { +static char ViewShape_setSShape___doc__[] = +".. method:: setSShape(iSShape)\n" +"\n" +" Sets the SShape on top of which the ViewShape is built.\n" +"\n" +" :arg iSShape: An SShape object.\n" +" :type iSShape: :class:`SShape`\n"; + +static PyObject * ViewShape_setSShape( BPy_ViewShape *self , PyObject *args) { PyObject *py_ss = 0; if(!( PyArg_ParseTuple(args, "O!", &SShape_Type, &py_ss) )) @@ -184,7 +172,15 @@ PyObject * ViewShape_setSShape( BPy_ViewShape *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * ViewShape_setVertices( BPy_ViewShape *self , PyObject *args) { +static char ViewShape_setVertices___doc__[] = +".. method:: setVertices(iVertices)\n" +"\n" +" Sets the list of ViewVertex objects contained in this ViewShape.\n" +"\n" +" :arg iVertices: The list of ViewVertex objects.\n" +" :type iVertices: List of :class:`ViewVertex` objects\n"; + +static PyObject * ViewShape_setVertices( BPy_ViewShape *self , PyObject *args) { PyObject *list = 0; PyObject *tmp; @@ -208,7 +204,15 @@ PyObject * ViewShape_setVertices( BPy_ViewShape *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * ViewShape_setEdges( BPy_ViewShape *self , PyObject *args) { +static char ViewShape_setEdges___doc__[] = +".. method:: setEdges(iEdges)\n" +"\n" +" Sets the list of ViewEdge objects contained in this ViewShape.\n" +"\n" +" :arg iEdges: The list of ViewEdge objects.\n" +" :type iEdges: List of :class:`ViewEdge` objects.\n"; + +static PyObject * ViewShape_setEdges( BPy_ViewShape *self , PyObject *args) { PyObject *list = 0; PyObject *tmp; @@ -232,7 +236,15 @@ PyObject * ViewShape_setEdges( BPy_ViewShape *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * ViewShape_AddEdge( BPy_ViewShape *self , PyObject *args) { +static char ViewShape_AddEdge___doc__[] = +".. method:: AddEdge(iEdge)\n" +"\n" +" Adds a ViewEdge to the list of ViewEdge objects.\n" +"\n" +" :arg iEdge: A ViewEdge object.\n" +" :type iEdge: :class:`ViewEdge`\n"; + +static PyObject * ViewShape_AddEdge( BPy_ViewShape *self , PyObject *args) { PyObject *py_ve = 0; if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) )) @@ -243,7 +255,15 @@ PyObject * ViewShape_AddEdge( BPy_ViewShape *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * ViewShape_AddVertex( BPy_ViewShape *self , PyObject *args) { +static char ViewShape_AddVertex___doc__[] = +".. method:: AddVertex(iVertex)\n" +"\n" +" Adds a ViewVertex to the list of the ViewVertex objects.\n" +"\n" +" :arg iVertex: A ViewVertex object.\n" +" :type iVertex: :class:`ViewVertex`\n"; + +static PyObject * ViewShape_AddVertex( BPy_ViewShape *self , PyObject *args) { PyObject *py_vv = 0; if(!( PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv) )) @@ -254,7 +274,64 @@ PyObject * ViewShape_AddVertex( BPy_ViewShape *self , PyObject *args) { Py_RETURN_NONE; } -// virtual ViewShape * dupplicate () +// virtual ViewShape * duplicate () + +/*---------------------- BPy_ViewShape instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewShape_methods[] = { + {"sshape", ( PyCFunction ) ViewShape_sshape, METH_NOARGS, ViewShape_sshape___doc__}, + {"vertices", ( PyCFunction ) ViewShape_vertices, METH_NOARGS, ViewShape_vertices___doc__}, + {"edges", ( PyCFunction ) ViewShape_edges, METH_NOARGS, ViewShape_edges___doc__}, + {"getId", ( PyCFunction ) ViewShape_getId, METH_NOARGS, ViewShape_getId___doc__}, + {"setSShape", ( PyCFunction ) ViewShape_setSShape, METH_VARARGS, ViewShape_setSShape___doc__}, + {"setVertices", ( PyCFunction ) ViewShape_setVertices, METH_VARARGS, ViewShape_setVertices___doc__}, + {"setEdges", ( PyCFunction ) ViewShape_setEdges, METH_VARARGS, ViewShape_setEdges___doc__}, + {"AddEdge", ( PyCFunction ) ViewShape_AddEdge, METH_VARARGS, ViewShape_AddEdge___doc__}, + {"AddVertex", ( PyCFunction ) ViewShape_AddVertex, METH_VARARGS, ViewShape_AddVertex___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewShape type definition ------------------------------*/ + +PyTypeObject ViewShape_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ViewShape", /* tp_name */ + sizeof(BPy_ViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)ViewShape___repr__, /* 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 */ + ViewShape___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewShape_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewShape___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp index feef632992c..78566d915d6 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp @@ -6,8 +6,27 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FalseBP1D instance -----------*/ -static int FalseBP1D___init__(BPy_FalseBP1D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char FalseBP1D___doc__[] = +".. method:: __call__(inter1, inter2)\n" +"\n" +" Always returns false.\n" +"\n" +" :arg inter1: The first Interface1D object.\n" +" :type inter1: :class:`Interface1D`\n" +" :arg inter2: The second Interface1D object.\n" +" :type inter2: :class:`Interface1D`\n" +" :return: False.\n" +" :rtype: bool\n"; + +static int FalseBP1D___init__( BPy_FalseBP1D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_bp1D.bp1D = new Predicates1D::FalseBP1D(); + return 0; +} /*-----------------------BPy_FalseBP1D type definition ------------------------------*/ PyTypeObject FalseBP1D_Type = { @@ -31,7 +50,7 @@ PyTypeObject FalseBP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "FalseBP1D objects", /* tp_doc */ + FalseBP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -51,16 +70,6 @@ PyTypeObject FalseBP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int FalseBP1D___init__( BPy_FalseBP1D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_bp1D.bp1D = new Predicates1D::FalseBP1D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp index 09677e33725..5249e2ba6b0 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp @@ -6,10 +6,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Length2DBP1D instance -----------*/ -static int Length2DBP1D___init__(BPy_Length2DBP1D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char Length2DBP1D___doc__[] = +".. method:: __call__(inter1, inter2)\n" +"\n" +" Returns true if the 2D length of inter1 is less than the 2D length\n" +" of inter2.\n" +"\n" +" :arg inter1: The first Interface1D object.\n" +" :type inter1: :class:`Interface1D`\n" +" :arg inter2: The second Interface1D object.\n" +" :type inter2: :class:`Interface1D`\n" +" :return: True or false.\n" +" :rtype: bool\n"; + +static int Length2DBP1D___init__( BPy_Length2DBP1D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_bp1D.bp1D = new Predicates1D::Length2DBP1D(); + return 0; +} /*-----------------------BPy_Length2DBP1D type definition ------------------------------*/ + PyTypeObject Length2DBP1D_Type = { PyVarObject_HEAD_INIT(NULL, 0) "Length2DBP1D", /* tp_name */ @@ -31,7 +52,7 @@ PyTypeObject Length2DBP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Length2DBP1D objects", /* tp_doc */ + Length2DBP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -51,16 +72,6 @@ PyTypeObject Length2DBP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int Length2DBP1D___init__( BPy_Length2DBP1D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_bp1D.bp1D = new Predicates1D::Length2DBP1D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp index a8fa365a6fe..5255752ff71 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp @@ -6,10 +6,30 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SameShapeIdBP1D instance -----------*/ -static int SameShapeIdBP1D___init__(BPy_SameShapeIdBP1D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char SameShapeIdBP1D___doc__[] = +".. method:: __call__(inter1, inter2)\n" +"\n" +" Returns true if inter1 and inter2 belong to the same shape.\n" +"\n" +" :arg inter1: The first Interface1D object.\n" +" :type inter1: :class:`Interface1D`\n" +" :arg inter2: The second Interface1D object.\n" +" :type inter2: :class:`Interface1D`\n" +" :return: True or false.\n" +" :rtype: bool\n"; + +static int SameShapeIdBP1D___init__( BPy_SameShapeIdBP1D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_bp1D.bp1D = new Predicates1D::SameShapeIdBP1D(); + return 0; +} /*-----------------------BPy_SameShapeIdBP1D type definition ------------------------------*/ + PyTypeObject SameShapeIdBP1D_Type = { PyVarObject_HEAD_INIT(NULL, 0) "SameShapeIdBP1D", /* tp_name */ @@ -31,7 +51,7 @@ PyTypeObject SameShapeIdBP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "SameShapeIdBP1D objects", /* tp_doc */ + SameShapeIdBP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -51,16 +71,6 @@ PyTypeObject SameShapeIdBP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int SameShapeIdBP1D___init__( BPy_SameShapeIdBP1D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_bp1D.bp1D = new Predicates1D::SameShapeIdBP1D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp index 1dd6231182f..6df906a31d5 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp @@ -6,10 +6,30 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TrueBP1D instance -----------*/ -static int TrueBP1D___init__( BPy_TrueBP1D* self, PyObject *args ); +//------------------------INSTANCE METHODS ---------------------------------- + +static char TrueBP1D___doc__[] = +".. method:: __call__(inter1, inter2)\n" +"\n" +" Always returns true.\n" +"\n" +" :arg inter1: The first Interface1D object.\n" +" :type inter1: :class:`Interface1D`\n" +" :arg inter2: The second Interface1D object.\n" +" :type inter2: :class:`Interface1D`\n" +" :return: True.\n" +" :rtype: bool\n"; + +static int TrueBP1D___init__( BPy_TrueBP1D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_bp1D.bp1D = new Predicates1D::TrueBP1D(); + return 0; +} /*-----------------------BPy_TrueBP1D type definition ------------------------------*/ + PyTypeObject TrueBP1D_Type = { PyVarObject_HEAD_INIT(NULL, 0) "TrueBP1D", /* tp_name */ @@ -31,7 +51,7 @@ PyTypeObject TrueBP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "TrueBP1D objects", /* tp_doc */ + TrueBP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -51,16 +71,6 @@ PyTypeObject TrueBP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int TrueBP1D___init__( BPy_TrueBP1D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_bp1D.bp1D = new Predicates1D::TrueBP1D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp index 38333cc91cd..5f433ae3e22 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp @@ -9,10 +9,39 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ViewMapGradientNormBP1D instance -----------*/ -static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D* self, PyObject *args ); +//------------------------INSTANCE METHODS ---------------------------------- + +//ViewMapGradientNormBP1D(int level, IntegrationType iType=MEAN, float sampling=2.0) + +static char ViewMapGradientNormBP1D___doc__[] = +".. method:: __call__(inter1, inter2)\n" +"\n" +" Returns true if the evaluation of the Gradient norm Function is\n" +" higher for inter1 than for inter2.\n" +"\n" +" :arg inter1: The first Interface1D object.\n" +" :type inter1: :class:`Interface1D`\n" +" :arg inter2: The second Interface1D object.\n" +" :type inter2: :class:`Interface1D`\n" +" :return: True or false.\n" +" :rtype: bool\n"; + +static int ViewMapGradientNormBP1D___init__( BPy_ViewMapGradientNormBP1D* self, PyObject *args ) +{ + int i; + PyObject *obj; + 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_bp1D.bp1D = new Predicates1D::ViewMapGradientNormBP1D(i,t,f); + return 0; +} /*-----------------------BPy_ViewMapGradientNormBP1D type definition ------------------------------*/ + PyTypeObject ViewMapGradientNormBP1D_Type = { PyVarObject_HEAD_INIT(NULL, 0) "ViewMapGradientNormBP1D", /* tp_name */ @@ -34,7 +63,7 @@ PyTypeObject ViewMapGradientNormBP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ViewMapGradientNormBP1D objects", /* tp_doc */ + ViewMapGradientNormBP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,24 +83,6 @@ PyTypeObject ViewMapGradientNormBP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -//ViewMapGradientNormBP1D(int level, IntegrationType iType=MEAN, float sampling=2.0) - -int ViewMapGradientNormBP1D___init__( BPy_ViewMapGradientNormBP1D* self, PyObject *args ) -{ - int i; - PyObject *obj; - 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_bp1D.bp1D = new Predicates1D::ViewMapGradientNormBP1D(i,t,f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index 48aa1e5aa1c..35f8c82f794 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -9,76 +9,55 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for CurvePoint instance -----------*/ -static int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *kwds); -static PyObject * CurvePoint___copy__( BPy_CurvePoint *self ); -static PyObject * CurvePoint_A( BPy_CurvePoint *self ); -static PyObject * CurvePoint_B( BPy_CurvePoint *self ); -static PyObject * CurvePoint_t2d( BPy_CurvePoint *self ); -static PyObject *CurvePoint_setA( BPy_CurvePoint *self , PyObject *args); -static PyObject *CurvePoint_setB( BPy_CurvePoint *self , PyObject *args); -static PyObject *CurvePoint_setT2d( BPy_CurvePoint *self , PyObject *args); -static PyObject *CurvePoint_curvatureFredo( BPy_CurvePoint *self , PyObject *args); - -/*----------------------CurvePoint instance definitions ----------------------------*/ -static PyMethodDef BPy_CurvePoint_methods[] = { - {"__copy__", ( PyCFunction ) CurvePoint___copy__, METH_NOARGS, "() Cloning method."}, - {"A", ( PyCFunction ) CurvePoint_A, METH_NOARGS, "() Returns the first SVertex upon which the CurvePoint is built."}, - {"B", ( PyCFunction ) CurvePoint_B, METH_NOARGS, "() Returns the second SVertex upon which the CurvePoint is built."}, - {"t2d", ( PyCFunction ) CurvePoint_t2d, METH_NOARGS, "() Returns the interpolation parameter."}, - {"setA", ( PyCFunction ) CurvePoint_setA, METH_VARARGS, "(SVertex sv) Sets the first SVertex upon which to build the CurvePoint."}, - {"setB", ( PyCFunction ) CurvePoint_setB, METH_VARARGS, "(SVertex sv) Sets the second SVertex upon which to build the CurvePoint."}, - {"setT2d", ( PyCFunction ) CurvePoint_setT2d, METH_VARARGS, "() Sets the 2D interpolation parameter to use."}, - {"curvatureFredo", ( PyCFunction ) CurvePoint_curvatureFredo, METH_NOARGS, "() angle in radians."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_CurvePoint type definition ------------------------------*/ - -PyTypeObject CurvePoint_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "CurvePoint", /* tp_name */ - sizeof(BPy_CurvePoint), /* 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 */ - "CurvePoint objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_CurvePoint_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurvePoint___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) +static char CurvePoint___doc__[] = +"Class to represent a point of a curve. A CurvePoint can be any point\n" +"of a 1D curve (it doesn't have to be a vertex of the curve). Any\n" +":class:`Interface1D` is built upon ViewEdges, themselves built upon\n" +"FEdges. Therefore, a curve is basically a polyline made of a list of\n" +":class:`SVertex` objects. Thus, a CurvePoint is built by linearly\n" +"interpolating two :class:`SVertex` instances. CurvePoint can be used\n" +"as virtual points while querying 0D information along a curve at a\n" +"given resolution.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Defult constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A CurvePoint object.\n" +" :type iBrother: :class:`CurvePoint`\n" +"\n" +".. method:: __init__(iA, iB, t2d)\n" +"\n" +" Builds a CurvePoint from two SVertex and an interpolation parameter.\n" +"\n" +" :arg iA: The first SVertex.\n" +" :type iA: :class:`SVertex`\n" +" :arg iB: The second SVertex.\n" +" :type iB: :class:`SVertex`\n" +" :arg t2d: A 2D interpolation parameter used to linearly interpolate\n" +" iA and iB.\n" +" :type t2d: float\n" +"\n" +".. method:: __init__(iA, iB, t2d)\n" +"\n" +" Builds a CurvePoint from two CurvePoint and an interpolation\n" +" parameter.\n" +"\n" +" :arg iA: The first CurvePoint.\n" +" :type iA: :class:`CurvePoint`\n" +" :arg iB: The second CurvePoint.\n" +" :type iB: :class:`CurvePoint`\n" +" :arg t2d: The 2D interpolation parameter used to linearly\n" +" interpolate iA and iB.\n" +" :type t2d: float\n"; + +static int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0; @@ -121,7 +100,7 @@ int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) return 0; } -PyObject * CurvePoint___copy__( BPy_CurvePoint *self ) { +static PyObject * CurvePoint___copy__( BPy_CurvePoint *self ) { BPy_CurvePoint *py_cp; py_cp = (BPy_CurvePoint *) CurvePoint_Type.tp_new( &CurvePoint_Type, 0, 0 ); @@ -133,7 +112,15 @@ PyObject * CurvePoint___copy__( BPy_CurvePoint *self ) { return (PyObject *) py_cp; } -PyObject * CurvePoint_A( BPy_CurvePoint *self ) { +static char CurvePoint_A___doc__[] = +".. method:: A()\n" +"\n" +" Returns the first SVertex upon which the CurvePoint is built.\n" +"\n" +" :return: The first SVertex.\n" +" :rtype: :class:`SVertex`\n"; + +static PyObject * CurvePoint_A( BPy_CurvePoint *self ) { SVertex *A = self->cp->A(); if( A ) return BPy_SVertex_from_SVertex( *A ); @@ -141,7 +128,15 @@ PyObject * CurvePoint_A( BPy_CurvePoint *self ) { Py_RETURN_NONE; } -PyObject * CurvePoint_B( BPy_CurvePoint *self ) { +static char CurvePoint_B___doc__[] = +".. method:: B()\n" +"\n" +" Returns the second SVertex upon which the CurvePoint is built.\n" +"\n" +" :return: The second SVertex.\n" +" :rtype: :class:`SVertex`\n"; + +static PyObject * CurvePoint_B( BPy_CurvePoint *self ) { SVertex *B = self->cp->B(); if( B ) return BPy_SVertex_from_SVertex( *B ); @@ -149,11 +144,27 @@ PyObject * CurvePoint_B( BPy_CurvePoint *self ) { Py_RETURN_NONE; } -PyObject * CurvePoint_t2d( BPy_CurvePoint *self ) { +static char CurvePoint_t2d___doc__[] = +".. method:: t2d()\n" +"\n" +" Returns the 2D interpolation parameter.\n" +"\n" +" :return: The 2D interpolation parameter.\n" +" :rtype: float\n"; + +static PyObject * CurvePoint_t2d( BPy_CurvePoint *self ) { return PyFloat_FromDouble( self->cp->t2d() ); } -PyObject *CurvePoint_setA( BPy_CurvePoint *self , PyObject *args) { +static char CurvePoint_setA___doc__[] = +".. method:: setA(iA)\n" +"\n" +" Sets the first SVertex upon which to build the CurvePoint.\n" +"\n" +" :arg iA: The first SVertex.\n" +" :type iA: :class:`SVertex`\n"; + +static PyObject *CurvePoint_setA( BPy_CurvePoint *self , PyObject *args) { PyObject *py_sv; if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) @@ -164,7 +175,15 @@ PyObject *CurvePoint_setA( BPy_CurvePoint *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *CurvePoint_setB( BPy_CurvePoint *self , PyObject *args) { +static char CurvePoint_setB___doc__[] = +".. method:: setB(iB)\n" +"\n" +" Sets the first SVertex upon which to build the CurvePoint.\n" +"\n" +" :arg iB: The second SVertex.\n" +" :type iB: :class:`SVertex`\n"; + +static PyObject *CurvePoint_setB( BPy_CurvePoint *self , PyObject *args) { PyObject *py_sv; if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) @@ -175,7 +194,15 @@ PyObject *CurvePoint_setB( BPy_CurvePoint *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *CurvePoint_setT2d( BPy_CurvePoint *self , PyObject *args) { +static char CurvePoint_setT2d___doc__[] = +".. method:: setT2d(t)\n" +"\n" +" Sets the 2D interpolation parameter to use.\n" +"\n" +" :arg t: The 2D interpolation parameter.\n" +" :type t: float\n"; + +static PyObject *CurvePoint_setT2d( BPy_CurvePoint *self , PyObject *args) { float t; if(!( PyArg_ParseTuple(args, "f", &t) )) @@ -186,14 +213,74 @@ PyObject *CurvePoint_setT2d( BPy_CurvePoint *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *CurvePoint_curvatureFredo( BPy_CurvePoint *self , PyObject *args) { +static char CurvePoint_curvatureFredo___doc__[] = +".. method:: curvatureFredo()\n" +"\n" +" Returns the angle in radians.\n" +"\n" +" :return: The angle in radians.\n" +" :rtype: float\n"; + +static PyObject *CurvePoint_curvatureFredo( BPy_CurvePoint *self , PyObject *args) { return PyFloat_FromDouble( self->cp->curvatureFredo() ); } ///bool operator== (const CurvePoint &b) +/*----------------------CurvePoint instance definitions ----------------------------*/ +static PyMethodDef BPy_CurvePoint_methods[] = { + {"__copy__", ( PyCFunction ) CurvePoint___copy__, METH_NOARGS, "() Cloning method."}, + {"A", ( PyCFunction ) CurvePoint_A, METH_NOARGS, CurvePoint_A___doc__}, + {"B", ( PyCFunction ) CurvePoint_B, METH_NOARGS, CurvePoint_B___doc__}, + {"t2d", ( PyCFunction ) CurvePoint_t2d, METH_NOARGS, CurvePoint_t2d___doc__}, + {"setA", ( PyCFunction ) CurvePoint_setA, METH_VARARGS, CurvePoint_setA___doc__}, + {"setB", ( PyCFunction ) CurvePoint_setB, METH_VARARGS, CurvePoint_setB___doc__}, + {"setT2d", ( PyCFunction ) CurvePoint_setT2d, METH_VARARGS, CurvePoint_setT2d___doc__}, + {"curvatureFredo", ( PyCFunction ) CurvePoint_curvatureFredo, METH_NOARGS, CurvePoint_curvatureFredo___doc__}, + {NULL, NULL, 0, NULL} +}; - +/*-----------------------BPy_CurvePoint type definition ------------------------------*/ +PyTypeObject CurvePoint_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "CurvePoint", /* tp_name */ + sizeof(BPy_CurvePoint), /* 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 */ + CurvePoint___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_CurvePoint_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurvePoint___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index 84299ef3779..751955e1951 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -10,78 +10,32 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SVertex instance -----------*/ -static int SVertex___init__(BPy_SVertex *self, PyObject *args, PyObject *kwds); -static PyObject * SVertex___copy__( BPy_SVertex *self ); -static PyObject * SVertex_normals( BPy_SVertex *self ); -static PyObject * SVertex_normalsSize( BPy_SVertex *self ); -static PyObject * SVertex_viewvertex( BPy_SVertex *self ); -static PyObject * SVertex_setPoint3D( BPy_SVertex *self , PyObject *args); -static PyObject * SVertex_setPoint2D( BPy_SVertex *self , PyObject *args); -static PyObject * SVertex_AddNormal( BPy_SVertex *self , PyObject *args); -static PyObject * SVertex_setId( BPy_SVertex *self , PyObject *args); -static PyObject *SVertex_AddFEdge( BPy_SVertex *self , PyObject *args); - -/*----------------------SVertex instance definitions ----------------------------*/ -static PyMethodDef BPy_SVertex_methods[] = { - {"__copy__", ( PyCFunction ) SVertex___copy__, METH_NOARGS, "() Cloning method."}, - {"normals", ( PyCFunction ) SVertex_normals, METH_NOARGS, "Returns the normals for this Vertex as a list. In a smooth surface, a vertex has exactly one normal. In a sharp surface, a vertex can have any number of normals."}, - {"normalsSize", ( PyCFunction ) SVertex_normalsSize, METH_NOARGS, "Returns the number of different normals for this vertex." }, - {"viewvertex", ( PyCFunction ) SVertex_viewvertex, METH_NOARGS, "If this SVertex is also a ViewVertex, this method returns a pointer onto this ViewVertex. 0 is returned otherwise." }, - {"setPoint3D", ( PyCFunction ) SVertex_setPoint3D, METH_VARARGS, "Sets the 3D coordinates of the SVertex." }, - {"setPoint2D", ( PyCFunction ) SVertex_setPoint2D, METH_VARARGS, "Sets the 3D projected coordinates of the SVertex." }, - {"AddNormal", ( PyCFunction ) SVertex_AddNormal, METH_VARARGS, "Adds a normal to the Svertex's set of normals. If the same normal is already in the set, nothing changes." }, - {"setId", ( PyCFunction ) SVertex_setId, METH_VARARGS, "Sets the Id." }, - {"AddFEdge", ( PyCFunction ) SVertex_AddFEdge, METH_VARARGS, "Add an FEdge to the list of edges emanating from this SVertex." }, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_SVertex type definition ------------------------------*/ - -PyTypeObject SVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SVertex", /* tp_name */ - sizeof(BPy_SVertex), /* 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 */ - "SVertex objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_SVertex_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SVertex___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; +static char SVertex___doc__[] = +"Class to define a vertex of the embedding.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A SVertex object.\n" +" :type iBrother: :class:`SVertex`\n" +"\n" +".. method:: __init__(iPoint3D, id)\n" +"\n" +" Builds a SVertex from 3D coordinates and an Id.\n" +"\n" +" :arg iPoint3D: A three-dimensional vector.\n" +" :type iPoint3D: :class:`Mathutils.Vector`\n" +" :arg id: An Id object.\n" +" :type id: :class:`Id`\n"; //------------------------INSTANCE METHODS ---------------------------------- -int SVertex___init__(BPy_SVertex *self, PyObject *args, PyObject *kwds) +static int SVertex___init__(BPy_SVertex *self, PyObject *args, PyObject *kwds) { PyObject *py_point = 0; BPy_Id *py_id = 0; @@ -116,7 +70,7 @@ int SVertex___init__(BPy_SVertex *self, PyObject *args, PyObject *kwds) return 0; } -PyObject * SVertex___copy__( BPy_SVertex *self ) { +static PyObject * SVertex___copy__( BPy_SVertex *self ) { BPy_SVertex *py_svertex; py_svertex = (BPy_SVertex *) SVertex_Type.tp_new( &SVertex_Type, 0, 0 ); @@ -128,8 +82,17 @@ PyObject * SVertex___copy__( BPy_SVertex *self ) { return (PyObject *) py_svertex; } - -PyObject * SVertex_normals( BPy_SVertex *self ) { +static char SVertex_normals___doc__[] = +".. method:: normals()\n" +"\n" +" Returns the normals for this Vertex as a list. In a smooth surface,\n" +" a vertex has exactly one normal. In a sharp surface, a vertex can\n" +" have any number of normals.\n" +"\n" +" :return: A list of normals.\n" +" :rtype: List of :class:`Mathutils.Vector` objects\n"; + +static PyObject * SVertex_normals( BPy_SVertex *self ) { PyObject *py_normals; set< Vec3r > normals; @@ -144,11 +107,28 @@ PyObject * SVertex_normals( BPy_SVertex *self ) { return py_normals; } -PyObject * SVertex_normalsSize( BPy_SVertex *self ) { +static char SVertex_normalsSize___doc__[] = +".. method:: normalsSize()\n" +"\n" +" Returns the number of different normals for this vertex.\n" +"\n" +" :return: The number of normals.\n" +" :rtype: int\n"; + +static PyObject * SVertex_normalsSize( BPy_SVertex *self ) { return PyLong_FromLong( self->sv->normalsSize() ); } -PyObject * SVertex_viewvertex( BPy_SVertex *self ) { +static char SVertex_viewvertex___doc__[] = +".. method:: viewvertex()\n" +"\n" +" If this SVertex is also a ViewVertex, this method returns the\n" +" ViewVertex. None is returned otherwise.\n" +"\n" +" :return: The ViewVertex object.\n" +" :rtype: :class:`ViewVertex`\n"; + +static PyObject * SVertex_viewvertex( BPy_SVertex *self ) { ViewVertex *vv = self->sv->viewvertex(); if( vv ) return Any_BPy_ViewVertex_from_ViewVertex( *vv ); @@ -156,7 +136,15 @@ PyObject * SVertex_viewvertex( BPy_SVertex *self ) { Py_RETURN_NONE; } -PyObject *SVertex_setPoint3D( BPy_SVertex *self , PyObject *args) { +static char SVertex_setPoint3D___doc__[] = +".. method:: setPoint3D(p)\n" +"\n" +" Sets the 3D coordinates of the SVertex.\n" +"\n" +" :arg p: A three-dimensional vector.\n" +" :type p: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n"; + +static PyObject *SVertex_setPoint3D( BPy_SVertex *self , PyObject *args) { PyObject *py_point; if(!( PyArg_ParseTuple(args, "O", &py_point) )) @@ -172,7 +160,15 @@ PyObject *SVertex_setPoint3D( BPy_SVertex *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *SVertex_setPoint2D( BPy_SVertex *self , PyObject *args) { +static char SVertex_setPoint2D___doc__[] = +".. method:: setPoint2D(p)\n" +"\n" +" Sets the 2D projected coordinates of the SVertex.\n" +"\n" +" :arg p: A three-dimensional vector.\n" +" :type p: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n"; + +static PyObject *SVertex_setPoint2D( BPy_SVertex *self , PyObject *args) { PyObject *py_point; if(!( PyArg_ParseTuple(args, "O", &py_point) )) @@ -188,7 +184,16 @@ PyObject *SVertex_setPoint2D( BPy_SVertex *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *SVertex_AddNormal( BPy_SVertex *self , PyObject *args) { +static char SVertex_AddNormal___doc__[] = +".. method:: AddNormal(n)\n" +"\n" +" Adds a normal to the SVertex's set of normals. If the same normal\n" +" is already in the set, nothing changes.\n" +"\n" +" :arg n: A three-dimensional vector.\n" +" :type n: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n"; + +static PyObject *SVertex_AddNormal( BPy_SVertex *self , PyObject *args) { PyObject *py_normal; if(!( PyArg_ParseTuple(args, "O", &py_normal) )) @@ -204,7 +209,15 @@ PyObject *SVertex_AddNormal( BPy_SVertex *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *SVertex_setId( BPy_SVertex *self , PyObject *args) { +static char SVertex_setId___doc__[] = +".. method:: setId(id)\n" +"\n" +" Sets the identifier of the SVertex.\n" +"\n" +" :arg id: The identifier.\n" +" :type id: :class:`Id`\n"; + +static PyObject *SVertex_setId( BPy_SVertex *self , PyObject *args) { BPy_Id *py_id; if( !PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) ) @@ -215,7 +228,15 @@ PyObject *SVertex_setId( BPy_SVertex *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *SVertex_AddFEdge( BPy_SVertex *self , PyObject *args) { +static char SVertex_AddFEdge___doc__[] = +".. method:: AddFEdge(fe)\n" +"\n" +" Add an FEdge to the list of edges emanating from this SVertex.\n" +"\n" +" :arg fe: An FEdge.\n" +" :type fe: :class:`FEdge`\n"; + +static PyObject *SVertex_AddFEdge( BPy_SVertex *self , PyObject *args) { PyObject *py_fe; if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) )) @@ -226,10 +247,64 @@ PyObject *SVertex_AddFEdge( BPy_SVertex *self , PyObject *args) { Py_RETURN_NONE; } - // virtual bool operator== (const SVertex &iBrother) // ViewVertex * viewvertex () +/*----------------------SVertex instance definitions ----------------------------*/ +static PyMethodDef BPy_SVertex_methods[] = { + {"__copy__", ( PyCFunction ) SVertex___copy__, METH_NOARGS, "() Cloning method."}, + {"normals", ( PyCFunction ) SVertex_normals, METH_NOARGS, SVertex_normals___doc__}, + {"normalsSize", ( PyCFunction ) SVertex_normalsSize, METH_NOARGS, SVertex_normalsSize___doc__}, + {"viewvertex", ( PyCFunction ) SVertex_viewvertex, METH_NOARGS, SVertex_viewvertex___doc__}, + {"setPoint3D", ( PyCFunction ) SVertex_setPoint3D, METH_VARARGS, SVertex_setPoint3D___doc__}, + {"setPoint2D", ( PyCFunction ) SVertex_setPoint2D, METH_VARARGS, SVertex_setPoint2D___doc__}, + {"AddNormal", ( PyCFunction ) SVertex_AddNormal, METH_VARARGS, SVertex_AddNormal___doc__}, + {"setId", ( PyCFunction ) SVertex_setId, METH_VARARGS, SVertex_setId___doc__}, + {"AddFEdge", ( PyCFunction ) SVertex_AddFEdge, METH_VARARGS, SVertex_AddFEdge___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_SVertex type definition ------------------------------*/ +PyTypeObject SVertex_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "SVertex", /* tp_name */ + sizeof(BPy_SVertex), /* 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 */ + SVertex___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_SVertex_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SVertex___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp index 8e7a9fe547d..9b81ce56400 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp @@ -10,68 +10,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ViewVertex instance -----------*/ -static int ViewVertex___init__( BPy_ViewVertex *self, PyObject *args, PyObject *kwds ); -static PyObject * ViewVertex_setNature( BPy_ViewVertex *self, PyObject *args ); -static PyObject * ViewVertex_edgesBegin( BPy_ViewVertex *self ); -static PyObject * ViewVertex_edgesEnd( BPy_ViewVertex *self ); -static PyObject * ViewVertex_edgesIterator( BPy_ViewVertex *self, PyObject *args ); - -/*----------------------ViewVertex instance definitions ----------------------------*/ -static PyMethodDef BPy_ViewVertex_methods[] = { - {"setNature", ( PyCFunction ) ViewVertex_setNature, METH_VARARGS, "(Nature n) Sets the nature of the vertex."}, - {"edgesBegin", ( PyCFunction ) ViewVertex_edgesBegin, METH_NOARGS, "() Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing). "}, - {"edgesEnd", ( PyCFunction ) ViewVertex_edgesEnd, METH_NOARGS, "() Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after the last ViewEdge."}, - {"edgesIterator", ( PyCFunction ) ViewVertex_edgesIterator, METH_VARARGS, "(ViewEdge ve) Returns an orientedViewEdgeIterator pointing to the ViewEdge given as argument. "}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_ViewVertex type definition ------------------------------*/ - -PyTypeObject ViewVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewVertex", /* tp_name */ - sizeof(BPy_ViewVertex), /* 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 */ - "ViewVertex objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewVertex_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewVertex___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int ViewVertex___init__( BPy_ViewVertex *self, PyObject *args, PyObject *kwds ) +static char ViewVertex___doc__[] = +"Class to define a view vertex. A view vertex is a feature vertex\n" +"corresponding to a point of the image graph, where the characteristics\n" +"of an edge (e.g., nature and visibility) might change. A\n" +":class:`ViewVertex` can be of two kinds: A :class:`TVertex` when it\n" +"corresponds to the intersection between two ViewEdges or a\n" +":class:`NonTVertex` when it corresponds to a vertex of the initial\n" +"input mesh (it is the case for vertices such as corners for example).\n" +"Thus, this class can be specialized into two classes, the\n" +":class:`TVertex` class and the :class:`NonTVertex` class.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A ViewVertex object.\n" +" :type iBrother: :class:`ViewVertex`\n"; + +static int ViewVertex___init__( BPy_ViewVertex *self, PyObject *args, PyObject *kwds ) { if( !PyArg_ParseTuple(args, "") ) return -1; @@ -81,9 +44,15 @@ int ViewVertex___init__( BPy_ViewVertex *self, PyObject *args, PyObject *kwds ) return 0; } +static char ViewVertex_setNature___doc__[] = +".. method:: setNature(iNature)\n" +"\n" +" Sets the nature of the vertex.\n" +"\n" +" :arg iNature: A Nature object.\n" +" :type iNature: :class:`Nature`\n"; - -PyObject * ViewVertex_setNature( BPy_ViewVertex *self, PyObject *args ) { +static PyObject * ViewVertex_setNature( BPy_ViewVertex *self, PyObject *args ) { PyObject *py_n; if( !self->vv ) @@ -98,7 +67,19 @@ PyObject * ViewVertex_setNature( BPy_ViewVertex *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * ViewVertex_edgesBegin( BPy_ViewVertex *self ) { +static char ViewVertex_edgesBegin___doc__[] = +".. method:: edgesBegin()\n" +"\n" +" Returns an iterator over the ViewEdges that goes to or comes from\n" +" this ViewVertex pointing to the first ViewEdge of the list. The\n" +" orientedViewEdgeIterator allows to iterate in CCW order over these\n" +" ViewEdges and to get the orientation for each ViewEdge\n" +" (incoming/outgoing).\n" +"\n" +" :return: An orientedViewEdgeIterator pointing to the first ViewEdge.\n" +" :rtype: :class:`orientedViewEdgeIterator`\n"; + +static PyObject * ViewVertex_edgesBegin( BPy_ViewVertex *self ) { if( !self->vv ) Py_RETURN_NONE; @@ -106,7 +87,16 @@ PyObject * ViewVertex_edgesBegin( BPy_ViewVertex *self ) { return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ove_it, 0 ); } -PyObject * ViewVertex_edgesEnd( BPy_ViewVertex *self ) { +static char ViewVertex_edgesEnd___doc__[] = +".. method:: edgesEnd()\n" +"\n" +" Returns an orientedViewEdgeIterator over the ViewEdges around this\n" +" ViewVertex, pointing after the last ViewEdge.\n" +"\n" +" :return: An orientedViewEdgeIterator pointing after the last ViewEdge.\n" +" :rtype: :class:`orientedViewEdgeIterator`\n"; + +static PyObject * ViewVertex_edgesEnd( BPy_ViewVertex *self ) { #if 0 if( !self->vv ) Py_RETURN_NONE; @@ -119,8 +109,18 @@ PyObject * ViewVertex_edgesEnd( BPy_ViewVertex *self ) { #endif } - -PyObject * ViewVertex_edgesIterator( BPy_ViewVertex *self, PyObject *args ) { +static char ViewVertex_edgesIterator___doc__[] = +".. method:: edgesIterator(iEdge)\n" +"\n" +" Returns an orientedViewEdgeIterator pointing to the ViewEdge given\n" +" as argument.\n" +"\n" +" :arg iEdge: A ViewEdge object.\n" +" :type iEdge: :class:`ViewEdge`\n" +" :return: An orientedViewEdgeIterator pointing to the given ViewEdge.\n" +" :rtype: :class:`orientedViewEdgeIterator`\n"; + +static PyObject * ViewVertex_edgesIterator( BPy_ViewVertex *self, PyObject *args ) { PyObject *py_ve; if( !self->vv ) @@ -134,6 +134,56 @@ PyObject * ViewVertex_edgesIterator( BPy_ViewVertex *self, PyObject *args ) { return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ove_it, 0 ); } +/*----------------------ViewVertex instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewVertex_methods[] = { + {"setNature", ( PyCFunction ) ViewVertex_setNature, METH_VARARGS, ViewVertex_setNature___doc__}, + {"edgesBegin", ( PyCFunction ) ViewVertex_edgesBegin, METH_NOARGS, ViewVertex_edgesBegin___doc__}, + {"edgesEnd", ( PyCFunction ) ViewVertex_edgesEnd, METH_NOARGS, ViewVertex_edgesEnd___doc__}, + {"edgesIterator", ( PyCFunction ) ViewVertex_edgesIterator, METH_VARARGS, ViewVertex_edgesIterator___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewVertex type definition ------------------------------*/ +PyTypeObject ViewVertex_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ViewVertex", /* tp_name */ + sizeof(BPy_ViewVertex), /* 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 */ + ViewVertex___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewVertex_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewVertex___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 4e4713c8a3d..91002b81c87 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -10,88 +10,58 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for StrokeVertex instance -----------*/ -static int StrokeVertex___init__(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds); - -static PyObject * StrokeVertex_x( BPy_StrokeVertex *self ); -static PyObject * StrokeVertex_y( BPy_StrokeVertex *self ); -static PyObject * StrokeVertex_getPoint( BPy_StrokeVertex *self ); -static PyObject * StrokeVertex_attribute( BPy_StrokeVertex *self ); -static PyObject * StrokeVertex_curvilinearAbscissa( BPy_StrokeVertex *self ); -static PyObject * StrokeVertex_strokeLength( BPy_StrokeVertex *self ); -static PyObject * StrokeVertex_u( BPy_StrokeVertex *self ); -static PyObject * StrokeVertex_setX( BPy_StrokeVertex *self , PyObject *args); -static PyObject * StrokeVertex_setY( BPy_StrokeVertex *self , PyObject *args); -static PyObject * StrokeVertex_setPoint( BPy_StrokeVertex *self , PyObject *args); -static PyObject * StrokeVertex_setAttribute( BPy_StrokeVertex *self , PyObject *args); -static PyObject * StrokeVertex_setCurvilinearAbscissa( BPy_StrokeVertex *self , PyObject *args); -static PyObject * StrokeVertex_setStrokeLength( BPy_StrokeVertex *self , PyObject *args); - -/*----------------------StrokeVertex instance definitions ----------------------------*/ -static PyMethodDef BPy_StrokeVertex_methods[] = { -// {"__copy__", ( PyCFunction ) StrokeVertex___copy__, METH_NOARGS, "() Cloning method."}, - {"x", ( PyCFunction ) StrokeVertex_x, METH_NOARGS, "() Returns the 2D point x coordinate"}, - {"y", ( PyCFunction ) StrokeVertex_y, METH_NOARGS, "() Returns the 2D point y coordinate"}, - {"getPoint", ( PyCFunction ) StrokeVertex_getPoint, METH_NOARGS, "() Returns the 2D point coordinates as a Vec2d"}, - {"attribute", ( PyCFunction ) StrokeVertex_attribute, METH_NOARGS, "() Returns the StrokeAttribute of this StrokeVertex"}, - {"curvilinearAbscissa", ( PyCFunction ) StrokeVertex_curvilinearAbscissa, METH_NOARGS, "() Returns the curvilinear abscissa "}, - {"strokeLength", ( PyCFunction ) StrokeVertex_strokeLength, METH_NOARGS, "() Returns the length of the Stroke to which this StrokeVertex belongs"}, - {"u", ( PyCFunction ) StrokeVertex_u, METH_NOARGS, "() Returns the curvilinear abscissa of this StrokeVertex in the Stroke"}, - {"setX", ( PyCFunction ) StrokeVertex_setX, METH_VARARGS, "(double r) Sets the 2D x value "}, - {"setY", ( PyCFunction ) StrokeVertex_setY, METH_VARARGS, "(double r) Sets the 2D y value "}, - {"setPoint", ( PyCFunction ) StrokeVertex_setPoint, METH_VARARGS, "(double x, double y) / ( [x,y] ) Sets the 2D x and y values"}, - {"setAttribute", ( PyCFunction ) StrokeVertex_setAttribute, METH_VARARGS, "(StrokeAttribute sa) Sets the attribute."}, - {"setCurvilinearAbscissa", ( PyCFunction ) StrokeVertex_setCurvilinearAbscissa, METH_VARARGS, "(double r) Sets the curvilinear abscissa of this StrokeVertex in the Stroke"}, - {"setStrokeLength", ( PyCFunction ) StrokeVertex_setStrokeLength, METH_VARARGS, "(double r) Sets the Stroke's length (it's only a value stored by the Stroke Vertex, it won't change the real Stroke's length.) "}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_StrokeVertex type definition ------------------------------*/ - -PyTypeObject StrokeVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeVertex", /* tp_name */ - sizeof(BPy_StrokeVertex), /* 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 */ - "StrokeVertex objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_StrokeVertex_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &CurvePoint_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeVertex___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int StrokeVertex___init__(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds) +static char StrokeVertex___doc__[] = +"Class to define a stroke vertex.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A StrokeVertex object.\n" +" :type iBrother: :class:`StrokeVertex`\n" +"\n" +".. method:: __init__(iA, iB, t3)\n" +"\n" +" Builds a stroke vertex from 2 stroke vertices and an interpolation\n" +" parameter.\n" +"\n" +" :arg iA: The first StrokeVertex.\n" +" :type iA: :class:`StrokeVertex`\n" +" :arg iB: The second StrokeVertex.\n" +" :type iB: :class:`StrokeVertex`\n" +" :arg t3: An interpolation parameter.\n" +" :type t3: float\n" +"\n" +".. method:: __init__(iPoint)\n" +"\n" +" Builds a stroke vertex from a CurvePoint\n" +"\n" +" :arg iPoint: A CurvePoint object.\n" +" :type iPoint: :class:`CurvePoint`\n" +"\n" +".. method:: __init__(iSVertex)\n" +"\n" +" Builds a stroke vertex from a SVertex\n" +"\n" +" :arg iSVertex: An SVertex object.\n" +" :type iSVertex: :class:`SVertex`\n" +"\n" +".. method:: __init__(iSVertex, iAttribute)\n" +"\n" +" Builds a stroke vertex from an SVertex and a StrokeAttribute object.\n" +"\n" +" :arg iSVertex: An SVertex object.\n" +" :type iSVertex: :class:`SVertex`\n" +" :arg iAttribute: A StrokeAttribute object.\n" +" :type iAttribute: :class:`StrokeAttribute`\n"; + +static int StrokeVertex___init__(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0; @@ -136,37 +106,100 @@ int StrokeVertex___init__(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds return 0; } -PyObject * StrokeVertex_x( BPy_StrokeVertex *self ) { +static char StrokeVertex_x___doc__[] = +".. method:: x()\n" +"\n" +" Returns the 2D point X coordinate.\n" +"\n" +" :return: The X coordinate.\n" +" :rtype: float\n"; + +static PyObject * StrokeVertex_x( BPy_StrokeVertex *self ) { return PyFloat_FromDouble( self->sv->x() ); } -PyObject * StrokeVertex_y( BPy_StrokeVertex *self ) { +static char StrokeVertex_y___doc__[] = +".. method:: y()\n" +"\n" +" Returns the 2D point Y coordinate.\n" +"\n" +" :return: The Y coordinate.\n" +" :rtype: float\n"; + +static PyObject * StrokeVertex_y( BPy_StrokeVertex *self ) { return PyFloat_FromDouble( self->sv->y() ); } -PyObject * StrokeVertex_getPoint( BPy_StrokeVertex *self ) { +static char StrokeVertex_getPoint___doc__[] = +".. method:: getPoint()\n" +"\n" +" Returns the 2D point coordinates as a two-dimensional vector.\n" +"\n" +" :return: The 2D coordinates.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static PyObject * StrokeVertex_getPoint( BPy_StrokeVertex *self ) { Vec2f v( self->sv->getPoint() ); return Vector_from_Vec2f( v ); } -PyObject * StrokeVertex_attribute( BPy_StrokeVertex *self ) { +static char StrokeVertex_attribute___doc__[] = +".. method:: attribute()\n" +"\n" +" Returns the StrokeAttribute for this StrokeVertex.\n" +"\n" +" :return: The StrokeAttribute object.\n" +" :rtype: :class:`StrokeAttribute`\n"; + +static PyObject * StrokeVertex_attribute( BPy_StrokeVertex *self ) { return BPy_StrokeAttribute_from_StrokeAttribute( self->sv->attribute() ); } -PyObject * StrokeVertex_curvilinearAbscissa( BPy_StrokeVertex *self ) { +static char StrokeVertex_curvilinearAbscissa___doc__[] = +".. method:: curvilinearAbscissa()\n" +"\n" +" Returns the curvilinear abscissa.\n" +"\n" +" :return: The curvilinear abscissa.\n" +" :rtype: float\n"; + +static PyObject * StrokeVertex_curvilinearAbscissa( BPy_StrokeVertex *self ) { return PyFloat_FromDouble( self->sv->curvilinearAbscissa() ); } -PyObject * StrokeVertex_strokeLength( BPy_StrokeVertex *self ) { +static char StrokeVertex_strokeLength___doc__[] = +".. method:: strokeLength()\n" +"\n" +" Returns the length of the Stroke to which this StrokeVertex belongs\n" +"\n" +" :return: The stroke length.\n" +" :rtype: float\n"; + +static PyObject * StrokeVertex_strokeLength( BPy_StrokeVertex *self ) { return PyFloat_FromDouble( self->sv->strokeLength() ); } -PyObject * StrokeVertex_u( BPy_StrokeVertex *self ) { +static char StrokeVertex_u___doc__[] = +".. method:: u()\n" +"\n" +" Returns the curvilinear abscissa of this StrokeVertex in the Stroke\n" +"\n" +" :return: The curvilinear abscissa.\n" +" :rtype: float\n"; + +static PyObject * StrokeVertex_u( BPy_StrokeVertex *self ) { return PyFloat_FromDouble( self->sv->u() ); } +static char StrokeVertex_setX___doc__[] = +".. method:: setX(x)\n" +"\n" +" Sets the 2D point X coordinate.\n" +"\n" +" :arg x: The X coordinate.\n" +" :type x: float\n"; -PyObject *StrokeVertex_setX( BPy_StrokeVertex *self , PyObject *args) { +static PyObject *StrokeVertex_setX( BPy_StrokeVertex *self , PyObject *args) { double r; if(!( PyArg_ParseTuple(args, "d", &r) )) @@ -177,7 +210,15 @@ PyObject *StrokeVertex_setX( BPy_StrokeVertex *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *StrokeVertex_setY( BPy_StrokeVertex *self , PyObject *args) { +static char StrokeVertex_setY___doc__[] = +".. method:: setY(y)\n" +"\n" +" Sets the 2D point Y coordinate.\n" +"\n" +" :arg y: The Y coordinate.\n" +" :type y: float\n"; + +static PyObject *StrokeVertex_setY( BPy_StrokeVertex *self , PyObject *args) { double r; if(!( PyArg_ParseTuple(args, "d", &r) )) @@ -188,8 +229,24 @@ PyObject *StrokeVertex_setY( BPy_StrokeVertex *self , PyObject *args) { Py_RETURN_NONE; } - -PyObject *StrokeVertex_setPoint( BPy_StrokeVertex *self , PyObject *args) { +static char StrokeVertex_setPoint___doc__[] = +".. method:: setPoint(x, y)\n" +"\n" +" Sets the 2D point X and Y coordinates.\n" +"\n" +" :arg x: The X coordinate.\n" +" :type x: float\n" +" :arg y: The Y coordinate.\n" +" :type y: float\n" +"\n" +".. method:: SetPoint(p)\n" +"\n" +" Sets the 2D point X and Y coordinates.\n" +"\n" +" :arg p: A two-dimensional vector.\n" +" :type p: :class:`Mathutils.Vector`, list or tuple of 2 real numbers\n"; + +static PyObject *StrokeVertex_setPoint( BPy_StrokeVertex *self , PyObject *args) { PyObject *obj1 = 0, *obj2 = 0; if(!( PyArg_ParseTuple(args, "O|O", &obj1, &obj2) )) @@ -213,7 +270,15 @@ PyObject *StrokeVertex_setPoint( BPy_StrokeVertex *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *StrokeVertex_setAttribute( BPy_StrokeVertex *self , PyObject *args) { +static char StrokeVertex_setAttribute___doc__[] = +".. method:: setAttribute(iAttribute)\n" +"\n" +" Sets the attribute.\n" +"\n" +" :arg iAttribute: A StrokeAttribute object.\n" +" :type iAttribute: :class:`StrokeAttribute`\n"; + +static PyObject *StrokeVertex_setAttribute( BPy_StrokeVertex *self , PyObject *args) { PyObject *py_sa; if(!( PyArg_ParseTuple(args, "O!", &StrokeAttribute_Type, &py_sa) )) @@ -224,7 +289,15 @@ PyObject *StrokeVertex_setAttribute( BPy_StrokeVertex *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *StrokeVertex_setCurvilinearAbscissa( BPy_StrokeVertex *self , PyObject *args) { +static char StrokeVertex_setCurvilinearAbscissa___doc__[] = +".. method:: setCurvilinearAbscissa(iAbscissa)\n" +"\n" +" Sets the curvilinear abscissa of this StrokeVertex in the Stroke\n" +"\n" +" :arg iAbscissa: The curvilinear abscissa.\n" +" :type iAbscissa: float\n"; + +static PyObject *StrokeVertex_setCurvilinearAbscissa( BPy_StrokeVertex *self , PyObject *args) { double r; if(!( PyArg_ParseTuple(args, "d", &r) )) @@ -235,8 +308,16 @@ PyObject *StrokeVertex_setCurvilinearAbscissa( BPy_StrokeVertex *self , PyObject Py_RETURN_NONE; } +static char StrokeVertex_setStrokeLength___doc__[] = +".. method:: setStrokeLength(iLength)\n" +"\n" +" Sets the stroke length (it is only a value retained by the\n" +" StrokeVertex, and it won't change the real stroke length).\n" +"\n" +" :arg iLength: The stroke length.\n" +" :type iLength: float\n"; -PyObject *StrokeVertex_setStrokeLength( BPy_StrokeVertex *self , PyObject *args) { +static PyObject *StrokeVertex_setStrokeLength( BPy_StrokeVertex *self , PyObject *args) { double r; if(!( PyArg_ParseTuple(args, "d", &r) )) @@ -250,6 +331,67 @@ PyObject *StrokeVertex_setStrokeLength( BPy_StrokeVertex *self , PyObject *args) // real operator[] (const int i) const // real & operator[] (const int i) +/*----------------------StrokeVertex instance definitions ----------------------------*/ +static PyMethodDef BPy_StrokeVertex_methods[] = { +// {"__copy__", ( PyCFunction ) StrokeVertex___copy__, METH_NOARGS, "() Cloning method."}, + {"x", ( PyCFunction ) StrokeVertex_x, METH_NOARGS, StrokeVertex_x___doc__}, + {"y", ( PyCFunction ) StrokeVertex_y, METH_NOARGS, StrokeVertex_y___doc__}, + {"getPoint", ( PyCFunction ) StrokeVertex_getPoint, METH_NOARGS, StrokeVertex_getPoint___doc__}, + {"attribute", ( PyCFunction ) StrokeVertex_attribute, METH_NOARGS, StrokeVertex_attribute___doc__}, + {"curvilinearAbscissa", ( PyCFunction ) StrokeVertex_curvilinearAbscissa, METH_NOARGS, StrokeVertex_curvilinearAbscissa___doc__}, + {"strokeLength", ( PyCFunction ) StrokeVertex_strokeLength, METH_NOARGS, StrokeVertex_strokeLength___doc__}, + {"u", ( PyCFunction ) StrokeVertex_u, METH_NOARGS, StrokeVertex_u___doc__}, + {"setX", ( PyCFunction ) StrokeVertex_setX, METH_VARARGS, StrokeVertex_setX___doc__}, + {"setY", ( PyCFunction ) StrokeVertex_setY, METH_VARARGS, StrokeVertex_setY___doc__}, + {"setPoint", ( PyCFunction ) StrokeVertex_setPoint, METH_VARARGS, StrokeVertex_setPoint___doc__}, + {"setAttribute", ( PyCFunction ) StrokeVertex_setAttribute, METH_VARARGS, StrokeVertex_setAttribute___doc__}, + {"setCurvilinearAbscissa", ( PyCFunction ) StrokeVertex_setCurvilinearAbscissa, METH_VARARGS, StrokeVertex_setCurvilinearAbscissa___doc__}, + {"setStrokeLength", ( PyCFunction ) StrokeVertex_setStrokeLength, METH_VARARGS, StrokeVertex_setStrokeLength___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_StrokeVertex type definition ------------------------------*/ +PyTypeObject StrokeVertex_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "StrokeVertex", /* tp_name */ + sizeof(BPy_StrokeVertex), /* 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 */ + StrokeVertex___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_StrokeVertex_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &CurvePoint_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeVertex___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp index 8aca6ef9ede..c842be49136 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp @@ -9,22 +9,101 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for NonTVertex___init__ instance -----------*/ -static int NonTVertex___init__(BPy_NonTVertex *self, PyObject *args, PyObject *kwds); +//------------------------INSTANCE METHODS ---------------------------------- + +static char NonTVertex___doc__[] = +"View vertex for corners, cusps, etc. associated to a single SVertex.\n" +"Can be associated to 2 or more view edges.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A NonTVertex object.\n" +" :type iBrother: :class:`NonTVertex`\n" +"\n" +".. method:: __init__(iSVertex)\n" +"\n" +" Builds a NonTVertex from a SVertex.\n" +"\n" +" :arg iSVertex: An SVertex object.\n" +" :type iSVertex: :class:`SVertex`\n"; + +static int NonTVertex___init__(BPy_NonTVertex *self, PyObject *args, PyObject *kwds) +{ + + PyObject *obj = 0; + + if (! PyArg_ParseTuple(args, "|O!", &SVertex_Type, &obj) ) + return -1; + + if( !obj ){ + self->ntv = new NonTVertex(); + + } else if( ((BPy_SVertex *) obj)->sv ) { + self->ntv = new NonTVertex( ((BPy_SVertex *) obj)->sv ); + + } else { + PyErr_SetString(PyExc_TypeError, "invalid argument"); + return -1; + } + + self->py_vv.vv = self->ntv; + self->py_vv.py_if0D.if0D = self->ntv; + self->py_vv.py_if0D.borrowed = 0; -static PyObject * NonTVertex_svertex( BPy_NonTVertex *self ); -static PyObject * NonTVertex_setSVertex( BPy_NonTVertex *self, PyObject *args); + return 0; +} + +static char NonTVertex_svertex___doc__[] = +".. method:: svertex()\n" +"\n" +" Returns the SVertex on top of which this NonTVertex is built.\n" +"\n" +" :return: The SVertex on top of which this NonTVertex is built.\n" +" :rtype: :class:`SVertex`\n"; + +static PyObject * NonTVertex_svertex( BPy_NonTVertex *self ) { + SVertex *v = self->ntv->svertex(); + if( v ){ + return BPy_SVertex_from_SVertex( *v ); + } + + Py_RETURN_NONE; +} + +static char NonTVertex_setSVertex___doc__[] = +".. method:: setSVertex(iSVertex)\n" +"\n" +" Sets the SVertex on top of which this NonTVertex is built.\n" +"\n" +" :arg iSVertex: The SVertex on top of which this NonTVertex is built.\n" +" :type iSVertex: :class:`SVertex`\n"; + +static PyObject * NonTVertex_setSVertex( BPy_NonTVertex *self, PyObject *args) { + PyObject *py_sv; + + if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) + return NULL; + + self->ntv->setSVertex( ((BPy_SVertex *) py_sv)->sv ); + + Py_RETURN_NONE; +} /*----------------------NonTVertex instance definitions ----------------------------*/ static PyMethodDef BPy_NonTVertex_methods[] = { // {"__copy__", ( PyCFunction ) NonTVertex___copy__, METH_NOARGS, "() Cloning method."}, - {"svertex", ( PyCFunction ) NonTVertex_svertex, METH_NOARGS, "() Returns the SVertex on top of which this NonTVertex is built. "}, - {"setSVertex", ( PyCFunction ) NonTVertex_setSVertex, METH_VARARGS, "(SVertex sv) Sets the SVertex on top of which this NonTVertex is built. "}, + {"svertex", ( PyCFunction ) NonTVertex_svertex, METH_NOARGS, NonTVertex_svertex___doc__}, + {"setSVertex", ( PyCFunction ) NonTVertex_setSVertex, METH_VARARGS, NonTVertex_setSVertex___doc__}, {NULL, NULL, 0, NULL} }; /*-----------------------BPy_NonTVertex type definition ------------------------------*/ - PyTypeObject NonTVertex_Type = { PyVarObject_HEAD_INIT(NULL, 0) "NonTVertex", /* tp_name */ @@ -46,7 +125,7 @@ PyTypeObject NonTVertex_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "NonTVertex objects", /* tp_doc */ + NonTVertex___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -66,55 +145,6 @@ PyTypeObject NonTVertex_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int NonTVertex___init__(BPy_NonTVertex *self, PyObject *args, PyObject *kwds) -{ - - PyObject *obj = 0; - - if (! PyArg_ParseTuple(args, "|O!", &SVertex_Type, &obj) ) - return -1; - - if( !obj ){ - self->ntv = new NonTVertex(); - - } else if( ((BPy_SVertex *) obj)->sv ) { - self->ntv = new NonTVertex( ((BPy_SVertex *) obj)->sv ); - - } else { - PyErr_SetString(PyExc_TypeError, "invalid argument"); - return -1; - } - - self->py_vv.vv = self->ntv; - self->py_vv.py_if0D.if0D = self->ntv; - self->py_vv.py_if0D.borrowed = 0; - - return 0; -} - -PyObject * NonTVertex_svertex( BPy_NonTVertex *self ) { - SVertex *v = self->ntv->svertex(); - if( v ){ - return BPy_SVertex_from_SVertex( *v ); - } - - Py_RETURN_NONE; -} - -PyObject * NonTVertex_setSVertex( BPy_NonTVertex *self, PyObject *args) { - PyObject *py_sv; - - if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) - return NULL; - - self->ntv->setSVertex( ((BPy_SVertex *) py_sv)->sv ); - - Py_RETURN_NONE; -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp index 90b6e578b4d..f7e36e753b5 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp @@ -12,76 +12,27 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TVertex___init__ instance -----------*/ -static int TVertex___init__(BPy_TVertex *self, PyObject *args, PyObject *kwds); - -static PyObject * TVertex_frontSVertex( BPy_TVertex *self ); -static PyObject * TVertex_backSVertex( BPy_TVertex *self ); -static PyObject * TVertex_setFrontSVertex( BPy_TVertex *self, PyObject *args); -static PyObject * TVertex_setBackSVertex( BPy_TVertex *self, PyObject *args); -static PyObject * TVertex_setId( BPy_TVertex *self, PyObject *args); -static PyObject * TVertex_getSVertex( BPy_TVertex *self, PyObject *args); -static PyObject * TVertex_mate( BPy_TVertex *self, PyObject *args); - -/*----------------------TVertex instance definitions ----------------------------*/ -static PyMethodDef BPy_TVertex_methods[] = { -// {"__copy__", ( PyCFunction ) TVertex___copy__, METH_NOARGS, "() Cloning method."}, - {"frontSVertex", ( PyCFunction ) TVertex_frontSVertex, METH_NOARGS, "() Returns the SVertex that is closer to the viewpoint. "}, - {"backSVertex", ( PyCFunction ) TVertex_backSVertex, METH_NOARGS, "() Returns the SVertex that is further away from the viewpoint. "}, - {"setFrontSVertex", ( PyCFunction ) TVertex_setFrontSVertex, METH_VARARGS, "(SVertex sv) Sets the SVertex that is closer to the viewpoint. "}, - {"setBackSVertex", ( PyCFunction ) TVertex_setBackSVertex, METH_VARARGS, "(SVertex sv) Sets the SVertex that is further away from the viewpoint. "}, - {"setId", ( PyCFunction ) TVertex_setId, METH_VARARGS, "(Id id) Sets the Id."}, - {"getSVertex", ( PyCFunction ) TVertex_getSVertex, METH_VARARGS, "(FEdge fe) Returns the SVertex (among the 2) belonging to the FEdge iFEdge "}, - {"mate", ( PyCFunction ) TVertex_mate, METH_VARARGS, "(ViewEdge ve) Returns the mate edge of iEdgeA. For example, if iEdgeA is frontEdgeA, then frontEdgeB is returned. If iEdgeA is frontEdgeB then frontEdgeA is returned. Same for back edges"}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_TVertex type definition ------------------------------*/ - -PyTypeObject TVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "TVertex", /* tp_name */ - sizeof(BPy_TVertex), /* 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 */ - "TVertex objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_TVertex_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &ViewVertex_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TVertex___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int TVertex___init__(BPy_TVertex *self, PyObject *args, PyObject *kwds) +static char TVertex___doc__[] = +"Class to define a T vertex, i.e. an intersection between two edges.\n" +"It points towards two SVertex and four ViewEdges. Among the\n" +"ViewEdges, two are front and the other two are back. Basically a\n" +"front edge hides part of a back edge. So, among the back edges, one\n" +"is of invisibility N and the other of invisibility N+1.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A TVertex object.\n" +" :type iBrother: :class:`TVertex`\n"; + +static int TVertex___init__(BPy_TVertex *self, PyObject *args, PyObject *kwds) { if( !PyArg_ParseTuple(args, "") ) return -1; @@ -93,8 +44,15 @@ int TVertex___init__(BPy_TVertex *self, PyObject *args, PyObject *kwds) return 0; } +static char TVertex_frontSVertex___doc__[] = +".. method:: frontSVertex()\n" +"\n" +" Returns the SVertex that is closer to the viewpoint.\n" +"\n" +" :return: The SVertex that is closer to the viewpoint.\n" +" :rtype: :class:`SVertex`\n"; -PyObject * TVertex_frontSVertex( BPy_TVertex *self ) { +static PyObject * TVertex_frontSVertex( BPy_TVertex *self ) { SVertex *v = self->tv->frontSVertex(); if( v ){ return BPy_SVertex_from_SVertex( *v ); @@ -103,7 +61,15 @@ PyObject * TVertex_frontSVertex( BPy_TVertex *self ) { Py_RETURN_NONE; } -PyObject * TVertex_backSVertex( BPy_TVertex *self ) { +static char TVertex_backSVertex___doc__[] = +".. method:: backSVertex()\n" +"\n" +" Returns the SVertex that is further away from the viewpoint.\n" +"\n" +" :return: The SVertex that is further away from the viewpoint.\n" +" :rtype: :class:`SVertex`\n"; + +static PyObject * TVertex_backSVertex( BPy_TVertex *self ) { SVertex *v = self->tv->backSVertex(); if( v ){ return BPy_SVertex_from_SVertex( *v ); @@ -112,7 +78,15 @@ PyObject * TVertex_backSVertex( BPy_TVertex *self ) { Py_RETURN_NONE; } -PyObject * TVertex_setFrontSVertex( BPy_TVertex *self, PyObject *args) { +static char TVertex_setFrontSVertex___doc__[] = +".. method:: setFrontSVertex(iFrontSVertex)\n" +"\n" +" Sets the SVertex that is closer to the viewpoint.\n" +"\n" +" :arg iFrontSVertex: An SVertex object.\n" +" :type iFrontSVertex: :class:`SVertex`\n"; + +static PyObject * TVertex_setFrontSVertex( BPy_TVertex *self, PyObject *args) { PyObject *py_sv; if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) @@ -123,7 +97,15 @@ PyObject * TVertex_setFrontSVertex( BPy_TVertex *self, PyObject *args) { Py_RETURN_NONE; } -PyObject * TVertex_setBackSVertex( BPy_TVertex *self, PyObject *args) { +static char TVertex_setBackSVertex___doc__[] = +".. method:: setBackSVertex(iBackSVertex)\n" +"\n" +" Sets the SVertex that is further away from the viewpoint.\n" +"\n" +" :arg iBackSVertex: An SVertex object.\n" +" :type iBackSVertex: :class:`SVertex`\n"; + +static PyObject * TVertex_setBackSVertex( BPy_TVertex *self, PyObject *args) { PyObject *py_sv; if(!( PyArg_ParseTuple(args, "O", &SVertex_Type, &py_sv) )) @@ -134,7 +116,15 @@ PyObject * TVertex_setBackSVertex( BPy_TVertex *self, PyObject *args) { Py_RETURN_NONE; } -PyObject * TVertex_setId( BPy_TVertex *self, PyObject *args) { +static char TVertex_setId___doc__[] = +".. method:: setId(iId)\n" +"\n" +" Sets the Id.\n" +"\n" +" :arg iId: An Id object.\n" +" :type iId: :class:`Id`\n"; + +static PyObject * TVertex_setId( BPy_TVertex *self, PyObject *args) { PyObject *py_id; if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) )) @@ -146,7 +136,17 @@ PyObject * TVertex_setId( BPy_TVertex *self, PyObject *args) { Py_RETURN_NONE; } -PyObject * TVertex_getSVertex( BPy_TVertex *self, PyObject *args) { +static char TVertex_getSVertex___doc__[] = +".. method:: getSVertex(iFEdge)\n" +"\n" +" Returns the SVertex (among the 2) belonging to the given FEdge.\n" +"\n" +" :arg iFEdge: An FEdge object.\n" +" :type iFEdge: :class:`FEdge`\n" +" :return: The SVertex belonging to the given FEdge.\n" +" :rtype: :class:`SVertex`\n"; + +static PyObject * TVertex_getSVertex( BPy_TVertex *self, PyObject *args) { PyObject *py_fe; if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) )) @@ -160,7 +160,19 @@ PyObject * TVertex_getSVertex( BPy_TVertex *self, PyObject *args) { Py_RETURN_NONE; } -PyObject * TVertex_mate( BPy_TVertex *self, PyObject *args) { +static char TVertex_mate___doc__[] = +".. method:: mate(iEdgeA)\n" +"\n" +" Returns the mate edge of the ViewEdge given as argument. If the\n" +" ViewEdge is frontEdgeA, frontEdgeB is returned. If the ViewEdge is\n" +" frontEdgeB, frontEdgeA is returned. Same for back edges.\n" +"\n" +" :arg iEdgeA: A ViewEdge object.\n" +" :type iEdgeA: :class:`ViewEdge`\n" +" :return: The mate edge of the given ViewEdge.\n" +" :rtype: :class:`ViewEdge`\n"; + +static PyObject * TVertex_mate( BPy_TVertex *self, PyObject *args) { PyObject *py_ve; if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) )) @@ -174,7 +186,61 @@ PyObject * TVertex_mate( BPy_TVertex *self, PyObject *args) { Py_RETURN_NONE; } - +/*----------------------TVertex instance definitions ----------------------------*/ +static PyMethodDef BPy_TVertex_methods[] = { +// {"__copy__", ( PyCFunction ) TVertex___copy__, METH_NOARGS, "() Cloning method."}, + {"frontSVertex", ( PyCFunction ) TVertex_frontSVertex, METH_NOARGS, TVertex_frontSVertex___doc__}, + {"backSVertex", ( PyCFunction ) TVertex_backSVertex, METH_NOARGS, TVertex_backSVertex___doc__}, + {"setFrontSVertex", ( PyCFunction ) TVertex_setFrontSVertex, METH_VARARGS, TVertex_setFrontSVertex___doc__}, + {"setBackSVertex", ( PyCFunction ) TVertex_setBackSVertex, METH_VARARGS, TVertex_setBackSVertex___doc__}, + {"setId", ( PyCFunction ) TVertex_setId, METH_VARARGS, TVertex_setId___doc__}, + {"getSVertex", ( PyCFunction ) TVertex_getSVertex, METH_VARARGS, TVertex_getSVertex___doc__}, + {"mate", ( PyCFunction ) TVertex_mate, METH_VARARGS, TVertex_mate___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_TVertex type definition ------------------------------*/ +PyTypeObject TVertex_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "TVertex", /* tp_name */ + sizeof(BPy_TVertex), /* 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 */ + TVertex___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_TVertex_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &ViewVertex_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TVertex___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp index 266c420f241..5e4f9257afb 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp @@ -12,92 +12,40 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FEdge instance -----------*/ -static int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds); -static PyObject * FEdge___copy__( BPy_FEdge *self ); -static PyObject * FEdge_vertexA( BPy_FEdge *self ); -static PyObject * FEdge_vertexB( BPy_FEdge *self ); -static PyObject * FEdge___getitem__( BPy_FEdge *self, PyObject *args ); -static PyObject * FEdge_nextEdge( BPy_FEdge *self ); -static PyObject * FEdge_previousEdge( BPy_FEdge *self ); -static PyObject * FEdge_viewedge( BPy_FEdge *self ); -static PyObject * FEdge_isSmooth( BPy_FEdge *self ); -static PyObject * FEdge_setVertexA( BPy_FEdge *self , PyObject *args); -static PyObject * FEdge_setVertexB( BPy_FEdge *self , PyObject *args); -static PyObject * FEdge_setId( BPy_FEdge *self , PyObject *args); -static PyObject * FEdge_setNextEdge( BPy_FEdge *self , PyObject *args); -static PyObject * FEdge_setPreviousEdge( BPy_FEdge *self , PyObject *args); -static PyObject * FEdge_setSmooth( BPy_FEdge *self , PyObject *args); -static PyObject * FEdge_setNature( BPy_FEdge *self, PyObject *args ); -static PyObject * FEdge_setViewEdge( BPy_FEdge *self, PyObject *args ); - -/*----------------------FEdge instance definitions ----------------------------*/ -static PyMethodDef BPy_FEdge_methods[] = { - {"__copy__", ( PyCFunction ) FEdge___copy__, METH_NOARGS, "() Cloning method."}, - {"vertexA", ( PyCFunction ) FEdge_vertexA, METH_NOARGS, "() Returns the first SVertex."}, - {"vertexB", ( PyCFunction ) FEdge_vertexB, METH_NOARGS, "() Returns the second SVertex."}, - {"__getitem__", ( PyCFunction ) FEdge___getitem__, METH_VARARGS, "(int i) Returns the first SVertex if i=0, the seccond SVertex if i=1."}, - {"nextEdge", ( PyCFunction ) FEdge_nextEdge, METH_NOARGS, "() Returns the FEdge following this one in the ViewEdge. If this FEdge is the last of the ViewEdge, 0 is returned."}, - {"previousEdge", ( PyCFunction ) FEdge_previousEdge, METH_NOARGS, "Returns the Edge preceding this one in the ViewEdge. If this FEdge is the first one of the ViewEdge, 0 is returned."}, - {"viewedge", ( PyCFunction ) FEdge_viewedge, METH_NOARGS, "Returns a pointer to the ViewEdge to which this FEdge belongs to."}, - {"isSmooth", ( PyCFunction ) FEdge_isSmooth, METH_NOARGS, "() Returns true if this FEdge is a smooth FEdge."}, - {"setVertexA", ( PyCFunction ) FEdge_setVertexA, METH_VARARGS, "(SVertex v) Sets the first SVertex. ."}, - {"setVertexB", ( PyCFunction ) FEdge_setVertexB, METH_VARARGS, "(SVertex v) Sets the second SVertex. "}, - {"setId", ( PyCFunction ) FEdge_setId, METH_VARARGS, "(Id id) Sets the FEdge Id ."}, - {"setNextEdge", ( PyCFunction ) FEdge_setNextEdge, METH_VARARGS, "(FEdge e) Sets the pointer to the next FEdge. "}, - {"setPreviousEdge", ( PyCFunction ) FEdge_setPreviousEdge, METH_VARARGS, "(FEdge e) Sets the pointer to the previous FEdge. "}, - {"setSmooth", ( PyCFunction ) FEdge_setSmooth, METH_VARARGS, "(bool b) Sets the flag telling whether this FEdge is smooth or sharp. true for Smooth, false for Sharp. "}, - {"setViewEdge", ( PyCFunction ) FEdge_setViewEdge, METH_VARARGS, "(ViewEdge ve) Sets the ViewEdge to which this FEdge belongs to."}, - {"setNature", ( PyCFunction ) FEdge_setNature, METH_VARARGS, "(Nature n) Sets the nature of this FEdge. "}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_FEdge type definition ------------------------------*/ - -PyTypeObject FEdge_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FEdge", /* tp_name */ - sizeof(BPy_FEdge), /* 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 */ - "FEdge objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FEdge_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdge___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds) +static char FEdge___doc__[] = +"Base Class for feature edges. This FEdge can represent a silhouette,\n" +"a crease, a ridge/valley, a border or a suggestive contour. For\n" +"silhouettes, the FEdge is oriented so that the visible face lies on\n" +"the left of the edge. For borders, the FEdge is oriented so that the\n" +"face lies on the left of the edge. An FEdge can represent an initial\n" +"edge of the mesh or runs accross a face of the initial mesh depending\n" +"on the smoothness or sharpness of the mesh. This class is specialized\n" +"into a smooth and a sharp version since their properties slightly vary\n" +"from one to the other.\n" +"\n" +".. method:: FEdge()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: FEdge(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: An FEdge object.\n" +" :type iBrother: :class:`FEdge`\n" +"\n" +".. method:: FEdge(vA, vB)\n" +"\n" +" Builds an FEdge going from vA to vB.\n" +"\n" +" :arg vA: The first SVertex.\n" +" :type vA: :class:`SVertex`\n" +" :arg vB: The second SVertex.\n" +" :type vB: :class:`SVertex`\n"; + +static int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0; @@ -125,7 +73,7 @@ int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds) } -PyObject * FEdge___copy__( BPy_FEdge *self ) { +static PyObject * FEdge___copy__( BPy_FEdge *self ) { BPy_FEdge *py_fe; py_fe = (BPy_FEdge *) FEdge_Type.tp_new( &FEdge_Type, 0, 0 ); @@ -137,7 +85,15 @@ PyObject * FEdge___copy__( BPy_FEdge *self ) { return (PyObject *) py_fe; } -PyObject * FEdge_vertexA( BPy_FEdge *self ) { +static char FEdge_vertexA___doc__[] = +".. method:: vertexA()\n" +"\n" +" Returns the first SVertex.\n" +"\n" +" :return: The first SVertex.\n" +" :rtype: :class:`SVertex`\n"; + +static PyObject * FEdge_vertexA( BPy_FEdge *self ) { SVertex *A = self->fe->vertexA(); if( A ){ return BPy_SVertex_from_SVertex( *A ); @@ -146,7 +102,15 @@ PyObject * FEdge_vertexA( BPy_FEdge *self ) { Py_RETURN_NONE; } -PyObject * FEdge_vertexB( BPy_FEdge *self ) { +static char FEdge_vertexB___doc__[] = +".. method:: vertexB()\n" +"\n" +" Returns the second SVertex.\n" +"\n" +" :return: The second SVertex.\n" +" :rtype: :class:`SVertex`\n"; + +static PyObject * FEdge_vertexB( BPy_FEdge *self ) { SVertex *B = self->fe->vertexB(); if( B ){ return BPy_SVertex_from_SVertex( *B ); @@ -156,7 +120,7 @@ PyObject * FEdge_vertexB( BPy_FEdge *self ) { } -PyObject * FEdge___getitem__( BPy_FEdge *self, PyObject *args ) { +static PyObject * FEdge___getitem__( BPy_FEdge *self, PyObject *args ) { int i; if(!( PyArg_ParseTuple(args, "i", &i) )) @@ -173,7 +137,16 @@ PyObject * FEdge___getitem__( BPy_FEdge *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FEdge_nextEdge( BPy_FEdge *self ) { +static char FEdge_nextEdge___doc__[] = +".. method:: nextEdge()\n" +"\n" +" Returns the FEdge following this one in the ViewEdge. If this FEdge\n" +" is the last of the ViewEdge, None is returned.\n" +"\n" +" :return: The edge following this one in the ViewEdge.\n" +" :rtype: :class:`FEdge`\n"; + +static PyObject * FEdge_nextEdge( BPy_FEdge *self ) { FEdge *fe = self->fe->nextEdge(); if( fe ) return Any_BPy_FEdge_from_FEdge( *fe ); @@ -181,7 +154,16 @@ PyObject * FEdge_nextEdge( BPy_FEdge *self ) { Py_RETURN_NONE; } -PyObject * FEdge_previousEdge( BPy_FEdge *self ) { +static char FEdge_previousEdge___doc__[] = +".. method:: previousEdge()\n" +"\n" +" Returns the FEdge preceding this one in the ViewEdge. If this FEdge\n" +" is the first one of the ViewEdge, None is returned.\n" +"\n" +" :return: The edge preceding this one in the ViewEdge.\n" +" :rtype: :class:`FEdge`\n"; + +static PyObject * FEdge_previousEdge( BPy_FEdge *self ) { FEdge *fe = self->fe->previousEdge(); if( fe ) return Any_BPy_FEdge_from_FEdge( *fe ); @@ -189,7 +171,15 @@ PyObject * FEdge_previousEdge( BPy_FEdge *self ) { Py_RETURN_NONE; } -PyObject * FEdge_viewedge( BPy_FEdge *self ) { +static char FEdge_viewedge___doc__[] = +".. method:: viewedge()\n" +"\n" +" Returns the ViewEdge to which this FEdge belongs to.\n" +"\n" +" :return: The ViewEdge to which this FEdge belongs to.\n" +" :rtype: :class:`ViewEdge`\n"; + +static PyObject * FEdge_viewedge( BPy_FEdge *self ) { ViewEdge *ve = self->fe->viewedge(); if( ve ) return BPy_ViewEdge_from_ViewEdge( *ve ); @@ -197,11 +187,27 @@ PyObject * FEdge_viewedge( BPy_FEdge *self ) { Py_RETURN_NONE; } -PyObject * FEdge_isSmooth( BPy_FEdge *self ) { +static char FEdge_isSmooth___doc__[] = +".. method:: isSmooth()\n" +"\n" +" Returns true if this FEdge is a smooth FEdge.\n" +"\n" +" :return: True if this FEdge is a smooth FEdge.\n" +" :rtype: bool\n"; + +static PyObject * FEdge_isSmooth( BPy_FEdge *self ) { return PyBool_from_bool( self->fe->isSmooth() ); } -PyObject *FEdge_setVertexA( BPy_FEdge *self , PyObject *args) { +static char FEdge_setVertexA___doc__[] = +".. method:: setVertexA(vA)\n" +"\n" +" Sets the first SVertex.\n" +"\n" +" :arg vA: An SVertex object.\n" +" :type vA: :class:`SVertex`\n"; + +static PyObject *FEdge_setVertexA( BPy_FEdge *self , PyObject *args) { PyObject *py_sv; if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) @@ -212,7 +218,15 @@ PyObject *FEdge_setVertexA( BPy_FEdge *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *FEdge_setVertexB( BPy_FEdge *self , PyObject *args) { +static char FEdge_setVertexB___doc__[] = +".. method:: setVertexB(vB)\n" +"\n" +" Sets the second SVertex.\n" +"\n" +" :arg vB: An SVertex object.\n" +" :type vB: :class:`SVertex`\n"; + +static PyObject *FEdge_setVertexB( BPy_FEdge *self , PyObject *args) { PyObject *py_sv; if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) { @@ -225,7 +239,15 @@ PyObject *FEdge_setVertexB( BPy_FEdge *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *FEdge_setId( BPy_FEdge *self , PyObject *args) { +static char FEdge_setId___doc__[] = +".. method:: setId(id)\n" +"\n" +" Sets the Id of this FEdge.\n" +"\n" +" :arg id: An Id object.\n" +" :type id: :class:`Id`\n"; + +static PyObject *FEdge_setId( BPy_FEdge *self , PyObject *args) { PyObject *py_id; if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) )) @@ -236,8 +258,15 @@ PyObject *FEdge_setId( BPy_FEdge *self , PyObject *args) { Py_RETURN_NONE; } +static char FEdge_setNextEdge___doc__[] = +".. method:: setNextEdge(iEdge)\n" +"\n" +" Sets the pointer to the next FEdge.\n" +"\n" +" :arg iEdge: An FEdge object.\n" +" :type iEdge: :class:`FEdge`\n"; -PyObject *FEdge_setNextEdge( BPy_FEdge *self , PyObject *args) { +static PyObject *FEdge_setNextEdge( BPy_FEdge *self , PyObject *args) { PyObject *py_fe; if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) )) @@ -248,7 +277,15 @@ PyObject *FEdge_setNextEdge( BPy_FEdge *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *FEdge_setPreviousEdge( BPy_FEdge *self , PyObject *args) { +static char FEdge_setPreviousEdge___doc__[] = +".. method:: setPreviousEdge(iEdge)\n" +"\n" +" Sets the pointer to the previous FEdge.\n" +"\n" +" :arg iEdge: An FEdge object.\n" +" :type iEdge: :class:`FEdge`\n"; + +static PyObject *FEdge_setPreviousEdge( BPy_FEdge *self , PyObject *args) { PyObject *py_fe; if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) )) @@ -259,7 +296,15 @@ PyObject *FEdge_setPreviousEdge( BPy_FEdge *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * FEdge_setNature( BPy_FEdge *self, PyObject *args ) { +static char FEdge_setNature___doc__[] = +".. method:: setNature(iNature)\n" +"\n" +" Sets the nature of this FEdge.\n" +"\n" +" :arg iNature: A Nature object.\n" +" :type iNature: :class:`Nature`\n"; + +static PyObject * FEdge_setNature( BPy_FEdge *self, PyObject *args ) { PyObject *py_n; if(!( PyArg_ParseTuple(args, "O!", &Nature_Type, &py_n) )) @@ -271,8 +316,15 @@ PyObject * FEdge_setNature( BPy_FEdge *self, PyObject *args ) { Py_RETURN_NONE; } +static char FEdge_setViewEdge___doc__[] = +".. method:: setViewEdge(iViewEdge)\n" +"\n" +" Sets the ViewEdge to which this FEdge belongs to.\n" +"\n" +" :arg iViewEdge: A ViewEdge object.\n" +" :type iViewEdge: :class:`ViewEdge`\n"; -PyObject * FEdge_setViewEdge( BPy_FEdge *self, PyObject *args ) { +static PyObject * FEdge_setViewEdge( BPy_FEdge *self, PyObject *args ) { PyObject *py_ve; if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) )) @@ -284,9 +336,16 @@ PyObject * FEdge_setViewEdge( BPy_FEdge *self, PyObject *args ) { Py_RETURN_NONE; } +static char FEdge_setSmooth___doc__[] = +".. method:: setSmooth(iFlag)\n" +"\n" +" Sets the flag telling whether this FEdge is smooth or sharp. True\n" +" for Smooth, false for Sharp.\n" +"\n" +" :arg iFlag: True for Smooth, false for Sharp.\n" +" :type iFlag: bool\n"; - -PyObject *FEdge_setSmooth( BPy_FEdge *self , PyObject *args) { +static PyObject *FEdge_setSmooth( BPy_FEdge *self , PyObject *args) { PyObject *py_b; if(!( PyArg_ParseTuple(args, "O", &py_b) )) @@ -297,6 +356,71 @@ PyObject *FEdge_setSmooth( BPy_FEdge *self , PyObject *args) { Py_RETURN_NONE; } +/*----------------------FEdge instance definitions ----------------------------*/ + +static PyMethodDef BPy_FEdge_methods[] = { + {"__copy__", ( PyCFunction ) FEdge___copy__, METH_NOARGS, "() Cloning method."}, + {"vertexA", ( PyCFunction ) FEdge_vertexA, METH_NOARGS, FEdge_vertexA___doc__}, + {"vertexB", ( PyCFunction ) FEdge_vertexB, METH_NOARGS, FEdge_vertexB___doc__}, + {"__getitem__", ( PyCFunction ) FEdge___getitem__, METH_VARARGS, "(int i) Returns the first SVertex if i=0, the seccond SVertex if i=1."}, + {"nextEdge", ( PyCFunction ) FEdge_nextEdge, METH_NOARGS, FEdge_nextEdge___doc__}, + {"previousEdge", ( PyCFunction ) FEdge_previousEdge, METH_NOARGS, FEdge_previousEdge___doc__}, + {"viewedge", ( PyCFunction ) FEdge_viewedge, METH_NOARGS, FEdge_viewedge___doc__}, + {"isSmooth", ( PyCFunction ) FEdge_isSmooth, METH_NOARGS, FEdge_isSmooth___doc__}, + {"setVertexA", ( PyCFunction ) FEdge_setVertexA, METH_VARARGS, FEdge_setVertexA___doc__}, + {"setVertexB", ( PyCFunction ) FEdge_setVertexB, METH_VARARGS, FEdge_setVertexB___doc__}, + {"setId", ( PyCFunction ) FEdge_setId, METH_VARARGS, FEdge_setId___doc__}, + {"setNextEdge", ( PyCFunction ) FEdge_setNextEdge, METH_VARARGS, FEdge_setNextEdge___doc__}, + {"setPreviousEdge", ( PyCFunction ) FEdge_setPreviousEdge, METH_VARARGS, FEdge_setPreviousEdge___doc__}, + {"setSmooth", ( PyCFunction ) FEdge_setSmooth, METH_VARARGS, FEdge_setSmooth___doc__}, + {"setViewEdge", ( PyCFunction ) FEdge_setViewEdge, METH_VARARGS, FEdge_setViewEdge___doc__}, + {"setNature", ( PyCFunction ) FEdge_setNature, METH_VARARGS, FEdge_setNature___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_FEdge type definition ------------------------------*/ + +PyTypeObject FEdge_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "FEdge", /* tp_name */ + sizeof(BPy_FEdge), /* 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 */ + FEdge___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_FEdge_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdge___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index ef9cd8bfebd..1ec9e3efc53 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -11,68 +11,32 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FrsCurve instance -----------*/ -static int FrsCurve___init__(BPy_FrsCurve *self, PyObject *args, PyObject *kwds); -static PyObject * FrsCurve_push_vertex_back( BPy_FrsCurve *self, PyObject *args ); -static PyObject * FrsCurve_push_vertex_front( BPy_FrsCurve *self, PyObject *args ); -static PyObject * FrsCurve_empty( BPy_FrsCurve *self ); -static PyObject * FrsCurve_nSegments( BPy_FrsCurve *self ); - -/*----------------------FrsCurve instance definitions ----------------------------*/ -static PyMethodDef BPy_FrsCurve_methods[] = { - {"push_vertex_back", ( PyCFunction ) FrsCurve_push_vertex_back, METH_VARARGS, "(CurvePoint cp | SVertex sv) Adds a single vertex at the front of the Curve."}, - {"push_vertex_front", ( PyCFunction ) FrsCurve_push_vertex_front, METH_VARARGS, "(CurvePoint cp | SVertex sv) Adds a single vertex at the end of the Curve."}, - {"empty", ( PyCFunction ) FrsCurve_empty, METH_NOARGS, "() Returns true is the Curve doesn't have any Vertex yet."}, - {"nSegments", ( PyCFunction ) FrsCurve_nSegments, METH_NOARGS, "() Returns the number of segments in the oplyline constituing the Curve."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_FrsCurve type definition ------------------------------*/ - -PyTypeObject FrsCurve_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FrsCurve", /* tp_name */ - sizeof(BPy_FrsCurve), /* 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 */ - "FrsCurve objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FrsCurve_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsCurve___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- - -int FrsCurve___init__(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) + +static char FrsCurve___doc__[] = +"Base class for curves made of CurvePoints. :class:`SVertex` is the\n" +"type of the initial curve vertices. A :class:`Chain` is a\n" +"specialization of a Curve.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default Constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy Constructor.\n" +"\n" +" :arg iBrother: A FrsCurve object.\n" +" :type iBrother: :class:`FrsCurve`\n" +"\n" +".. method:: __init__(iId)\n" +"\n" +" Builds a FrsCurve from its Id.\n" +"\n" +" :arg iId: An Id object.\n" +" :type iId: :class:`Id`\n"; + +static int FrsCurve___init__(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { PyObject *obj = 0; @@ -100,8 +64,15 @@ int FrsCurve___init__(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) return 0; } +static char FrsCurve_push_vertex_back___doc__[] = +".. method:: push_vertex_back(iVertex)\n" +"\n" +" Adds a single vertex at the end of the FrsCurve.\n" +"\n" +" :arg iVertex: A vertex object.\n" +" :type iVertex: :class:`SVertex` or :class:`CurvePoint`\n"; -PyObject * FrsCurve_push_vertex_back( BPy_FrsCurve *self, PyObject *args ) { +static PyObject * FrsCurve_push_vertex_back( BPy_FrsCurve *self, PyObject *args ) { PyObject *obj; if(!( PyArg_ParseTuple(args, "O", &obj) )) @@ -119,7 +90,15 @@ PyObject * FrsCurve_push_vertex_back( BPy_FrsCurve *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FrsCurve_push_vertex_front( BPy_FrsCurve *self, PyObject *args ) { +static char FrsCurve_push_vertex_front___doc__[] = +".. method:: push_vertex_front(iVertex)\n" +"\n" +" Adds a single vertex at the front of the FrsCurve.\n" +"\n" +" :arg iVertex: A vertex object.\n" +" :type iVertex: :class:`SVertex` or :class:`CurvePoint`\n"; + +static PyObject * FrsCurve_push_vertex_front( BPy_FrsCurve *self, PyObject *args ) { PyObject *obj; if(!( PyArg_ParseTuple(args, "O", &obj) )) @@ -137,14 +116,83 @@ PyObject * FrsCurve_push_vertex_front( BPy_FrsCurve *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FrsCurve_empty( BPy_FrsCurve *self ) { +static char FrsCurve_empty___doc__[] = +".. method:: empty()\n" +"\n" +" Returns true if the FrsCurve doesn't have any Vertex yet.\n" +"\n" +" :return: True if the FrsCurve has no vertices.\n" +" :rtype: bool\n"; + +static PyObject * FrsCurve_empty( BPy_FrsCurve *self ) { return PyBool_from_bool( self->c->empty() ); } -PyObject * FrsCurve_nSegments( BPy_FrsCurve *self ) { +static char FrsCurve_nSegments___doc__[] = +".. method:: nSegments()\n" +"\n" +" Returns the number of segments in the polyline constituing the\n" +" FrsCurve.\n" +"\n" +" :return: The number of segments.\n" +" :rtype: int\n"; + +static PyObject * FrsCurve_nSegments( BPy_FrsCurve *self ) { return PyLong_FromLong( self->c->nSegments() ); } +/*----------------------FrsCurve instance definitions ----------------------------*/ +static PyMethodDef BPy_FrsCurve_methods[] = { + {"push_vertex_back", ( PyCFunction ) FrsCurve_push_vertex_back, METH_VARARGS, FrsCurve_push_vertex_back___doc__}, + {"push_vertex_front", ( PyCFunction ) FrsCurve_push_vertex_front, METH_VARARGS, FrsCurve_push_vertex_front___doc__}, + {"empty", ( PyCFunction ) FrsCurve_empty, METH_NOARGS, FrsCurve_empty___doc__}, + {"nSegments", ( PyCFunction ) FrsCurve_nSegments, METH_NOARGS, FrsCurve_nSegments___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_FrsCurve type definition ------------------------------*/ + +PyTypeObject FrsCurve_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "FrsCurve", /* tp_name */ + sizeof(BPy_FrsCurve), /* 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 */ + FrsCurve___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_FrsCurve_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsCurve___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 8f88ee1f1f9..4edcc52fabf 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -13,107 +13,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Stroke instance -----------*/ -static int Stroke___init__(BPy_Stroke *self, PyObject *args, PyObject *kwds); -static PyObject * Stroke___iter__(PyObject *self); - -static Py_ssize_t Stroke_length( BPy_Stroke *self ); -static PyObject * Stroke_item( BPy_Stroke *self, Py_ssize_t i ); -static PyObject * Stroke___getitem__( BPy_Stroke *self, PyObject *item ); - -static PyObject * Stroke_ComputeSampling( BPy_Stroke *self, PyObject *args ); -static PyObject * Stroke_Resample( BPy_Stroke *self, PyObject *args ); -static PyObject * Stroke_InsertVertex( BPy_Stroke *self, PyObject *args ); -static PyObject * Stroke_RemoveVertex( BPy_Stroke *self, PyObject *args ); -static PyObject * Stroke_getMediumType( BPy_Stroke *self ); -static PyObject * Stroke_getTextureId( BPy_Stroke *self ); -static PyObject * Stroke_hasTips( BPy_Stroke *self ); -static PyObject * Stroke_setId( BPy_Stroke *self , PyObject *args); -static PyObject * Stroke_setLength( BPy_Stroke *self , PyObject *args); -static PyObject * Stroke_setMediumType( BPy_Stroke *self , PyObject *args); -static PyObject * Stroke_setTextureId( BPy_Stroke *self , PyObject *args); -static PyObject * Stroke_setTips( BPy_Stroke *self , PyObject *args); -static PyObject * Stroke_strokeVerticesBegin( BPy_Stroke *self , PyObject *args); -static PyObject * Stroke_strokeVerticesEnd( BPy_Stroke *self ); -static PyObject * Stroke_strokeVerticesSize( BPy_Stroke *self ); - -/*----------------------Stroke instance definitions ----------------------------*/ -static PyMethodDef BPy_Stroke_methods[] = { - {"__getitem__", ( PyCFunction ) Stroke___getitem__, METH_O, "(int i) Returns the i-th StrokeVertex constituting the Stroke."}, - {"ComputeSampling", ( PyCFunction ) Stroke_ComputeSampling, METH_VARARGS, "(int nVertices) Compute the sampling needed to get nVertices vertices. If the specified number of vertices is less than the actual number of vertices, the actual sampling value is returned."}, - {"Resample", ( PyCFunction ) Stroke_Resample, METH_VARARGS, "(float f | int n) Resampling method. If the argument is a float, Resamples the curve with a given sampling; if this sampling is < to the actual sampling value, no resampling is done. If the argument is an integer, Resamples the curve so that it eventually has n. That means it is going to add n-vertices_size, if vertices_size is the number of points we already have. Is vertices_size >= n, no resampling is done."}, - {"RemoveVertex", ( PyCFunction ) Stroke_RemoveVertex, METH_VARARGS, "(StrokeVertex sv) Removes the stroke vertex sv from the stroke. The length and curvilinear abscissa are updated consequently."}, - {"InsertVertex", ( PyCFunction ) Stroke_InsertVertex, METH_VARARGS, "(StrokeVertex sv, StrokeVertexIterator next) Inserts the stroke vertex iVertex in the stroke before next. The length, curvilinear abscissa are updated consequently."}, - {"getMediumType", ( PyCFunction ) Stroke_getMediumType, METH_NOARGS, "() Returns the MediumType used for this Stroke."}, - {"getTextureId", ( PyCFunction ) Stroke_getTextureId, METH_NOARGS, "() Returns the id of the texture used to simulate th marks system for this Stroke."}, - {"hasTips", ( PyCFunction ) Stroke_hasTips, METH_NOARGS, "() Returns true if this Stroke uses a texture with tips, false otherwise."}, - {"setId", ( PyCFunction ) Stroke_setId, METH_VARARGS, "(Id id) Sets the Id of the Stroke."}, - {"setLength", ( PyCFunction ) Stroke_setLength, METH_VARARGS, "(float l) Sets the 2D length of the Stroke."}, - {"setMediumType", ( PyCFunction ) Stroke_setMediumType, METH_VARARGS, "(MediumType mt) Sets the medium type that must be used for this Stroke."}, - {"setTextureId", ( PyCFunction ) Stroke_setTextureId, METH_VARARGS, "(unsigned int id) Sets the texture id to be used to simulate the marks system for this Stroke."}, - {"setTips", ( PyCFunction ) Stroke_setTips, METH_VARARGS, "(bool b) Sets the flag telling whether this stroke is using a texture with tips or not."}, - {"strokeVerticesBegin", ( PyCFunction ) Stroke_strokeVerticesBegin, METH_VARARGS, "(float t=0.f) Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can specifly a sampling value t to resample the Stroke on the fly if needed. "}, - {"strokeVerticesEnd", ( PyCFunction ) Stroke_strokeVerticesEnd, METH_NOARGS, "() Returns a StrokeVertexIterator pointing after the last StrokeVertex of the Stroke."}, - {"strokeVerticesSize", ( PyCFunction ) Stroke_strokeVerticesSize, METH_NOARGS, "() Returns the number of StrokeVertex constituing the Stroke."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_Stroke type definition ------------------------------*/ - -static PySequenceMethods Stroke_as_sequence = { - (lenfunc)Stroke_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - (ssizeargfunc)Stroke_item, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* sq_ass_slice */ - NULL, /* sq_contains */ - NULL, /* sq_inplace_concat */ - NULL, /* sq_inplace_repeat */ -}; - -PyTypeObject Stroke_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Stroke", /* tp_name */ - sizeof(BPy_Stroke), /* 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 */ - &Stroke_as_sequence, /* 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 */ - "Stroke objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)Stroke___iter__, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Stroke_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Stroke___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- // Stroke () @@ -122,7 +21,35 @@ PyTypeObject Stroke_Type = { // pb: - need to be able to switch representation: InputVertexIterator <=> position // - is it even used ? not even in SWIG version -int Stroke___init__(BPy_Stroke *self, PyObject *args, PyObject *kwds) +static char Stroke___doc__[] = +"Class to define a stroke. A stroke is made of a set of 2D vertices\n" +"(:class:`StrokeVertex`), regularly spaced out. This set of vertices\n" +"defines the stroke's backbone geometry. Each of these stroke vertices\n" +"defines the stroke's shape and appearance at this vertex position.\n" +"\n" +".. method:: Stroke()\n" +"\n" +" Default constructor\n" +"\n" +".. method:: Stroke(iBrother)\n" +"\n" +" Copy constructor\n" +"\n" +" :arg iBrother: \n" +" :type iBrother: :class:`Stroke`\n" +"\n" +".. method:: Stroke(iBegin, iEnd)\n" +"\n" +" Builds a stroke from a set of StrokeVertex. This constructor is\n" +" templated by an iterator type. This iterator type must allow the\n" +" vertices parsing using the ++ operator.\n" +"\n" +" :arg iBegin: The iterator pointing to the first vertex.\n" +" :type iBegin: InputVertexIterator\n" +" :arg iEnd: The iterator pointing to the end of the vertex list.\n" +" :type iEnd: InputVertexIterator\n"; + +static int Stroke___init__(BPy_Stroke *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = NULL, *obj2 = NULL; @@ -150,16 +77,16 @@ int Stroke___init__(BPy_Stroke *self, PyObject *args, PyObject *kwds) return 0; } -PyObject * Stroke___iter__( PyObject *self ) { +static PyObject * Stroke___iter__( PyObject *self ) { StrokeInternal::StrokeVertexIterator sv_it( ((BPy_Stroke *)self)->s->strokeVerticesBegin() ); return BPy_StrokeVertexIterator_from_StrokeVertexIterator( sv_it, 0 ); } -Py_ssize_t Stroke_length( BPy_Stroke *self ) { +static Py_ssize_t Stroke_length( BPy_Stroke *self ) { return self->s->strokeVerticesSize(); } -PyObject * Stroke_item( BPy_Stroke *self, Py_ssize_t i ) { +static PyObject * Stroke_item( BPy_Stroke *self, Py_ssize_t i ) { if (i < 0 || i >= (Py_ssize_t)self->s->strokeVerticesSize()) { PyErr_SetString(PyExc_IndexError, "subscript index out of range"); return NULL; @@ -167,7 +94,7 @@ PyObject * Stroke_item( BPy_Stroke *self, Py_ssize_t i ) { return BPy_StrokeVertex_from_StrokeVertex( self->s->strokeVerticeAt(i) ); } -PyObject * Stroke___getitem__( BPy_Stroke *self, PyObject *item ) { +static PyObject * Stroke___getitem__( BPy_Stroke *self, PyObject *item ) { long i; if (!PyLong_Check(item)) { @@ -183,7 +110,22 @@ PyObject * Stroke___getitem__( BPy_Stroke *self, PyObject *item ) { return Stroke_item(self, i); } -PyObject * Stroke_ComputeSampling( BPy_Stroke *self, PyObject *args ) { +static char Stroke_ComputeSampling___doc__[] = +".. method:: ComputeSampling(iNVertices)\n" +"\n" +" Compute the sampling needed to get iNVertices vertices. If the\n" +" specified number of vertices is less than the actual number of\n" +" vertices, the actual sampling value is returned. (To remove Vertices,\n" +" use the RemoveVertex() method of this class.)\n" +"\n" +" :arg iNVertices: The number of stroke vertices we eventually want\n" +" in our Stroke.\n" +" :type iNVertices: int\n" +" :return: The sampling that must be used in the Resample(float)\n" +" method.\n" +" :rtype: float\n"; + +static PyObject * Stroke_ComputeSampling( BPy_Stroke *self, PyObject *args ) { int i; if(!( PyArg_ParseTuple(args, "i", &i) )) @@ -192,7 +134,26 @@ PyObject * Stroke_ComputeSampling( BPy_Stroke *self, PyObject *args ) { return PyFloat_FromDouble( self->s->ComputeSampling( i ) ); } -PyObject * Stroke_Resample( BPy_Stroke *self, PyObject *args ) { +static char Stroke_Resample___doc__[] = +".. method:: Resample(iNPoints)\n" +"\n" +" Resamples the stroke so that it eventually has iNPoints. That means\n" +" it is going to add iNPoints-vertices_size, if vertices_size is the\n" +" number of points we already have. If vertices_size >= iNPoints, no\n" +" resampling is done.\n" +"\n" +" :arg iNPoints: The number of vertices we eventually want in our stroke.\n" +" :type iNPoints: int\n" +"\n" +".. method:: Resample(iSampling)\n" +"\n" +" Resamples the stroke with a given sampling. If the sampling is\n" +" smaller than the actual sampling value, no resampling is done.\n" +"\n" +" :arg iSampling: The new sampling value.\n" +" :type iSampling: float\n"; + +static PyObject * Stroke_Resample( BPy_Stroke *self, PyObject *args ) { PyObject *obj; if(!( PyArg_ParseTuple(args, "O", &obj) )) @@ -210,7 +171,19 @@ PyObject * Stroke_Resample( BPy_Stroke *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * Stroke_InsertVertex( BPy_Stroke *self, PyObject *args ) { +static char Stroke_InsertVertex___doc__[] = +".. method:: InsertVertex(iVertex, next)\n" +"\n" +" Inserts the stroke vertex iVertex in the stroke before next. The\n" +" length, curvilinear abscissa are updated consequently.\n" +"\n" +" :arg iVertex: The StrokeVertex to insert in the Stroke.\n" +" :type iVertex: :class:`StrokeVertex`\n" +" :arg next: A StrokeVertexIterator pointing to the StrokeVertex\n" +" before which iVertex must be inserted.\n" +" :type next: :class:`StrokeVertexIterator`\n"; + +static PyObject * Stroke_InsertVertex( BPy_Stroke *self, PyObject *args ) { PyObject *py_sv = 0, *py_sv_it = 0; if(!( PyArg_ParseTuple(args, "O!O!", &StrokeVertex_Type, &py_sv, &StrokeVertexIterator_Type, &py_sv_it) )) @@ -223,7 +196,16 @@ PyObject * Stroke_InsertVertex( BPy_Stroke *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * Stroke_RemoveVertex( BPy_Stroke *self, PyObject *args ) { +static char Stroke_RemoveVertex___doc__[] = +".. method:: RemoveVertex(iVertex)\n" +"\n" +" Removes the stroke vertex iVertex from the stroke. The length and\n" +" curvilinear abscissa are updated consequently.\n" +"\n" +" :arg iVertex: \n" +" :type iVertex: :class:`StrokeVertex`\n"; + +static PyObject * Stroke_RemoveVertex( BPy_Stroke *self, PyObject *args ) { PyObject *py_sv; if(!( PyArg_ParseTuple(args, "O!", &StrokeVertex_Type, &py_sv) )) @@ -239,20 +221,53 @@ PyObject * Stroke_RemoveVertex( BPy_Stroke *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * Stroke_getMediumType( BPy_Stroke *self ) { +static char Stroke_getMediumType___doc__[] = +".. method:: getMediumType()\n" +"\n" +" Returns the MediumType used for this Stroke.\n" +"\n" +" :return: the MediumType used for this Stroke.\n" +" :rtype: :class:`MediumType`\n"; + +static PyObject * Stroke_getMediumType( BPy_Stroke *self ) { return BPy_MediumType_from_MediumType( self->s->getMediumType() ); } -PyObject * Stroke_getTextureId( BPy_Stroke *self ) { +static char Stroke_getTextureId___doc__[] = +".. method:: getTextureId()\n" +"\n" +" Returns the ID of the texture used to simulate th marks system for\n" +" this Stroke\n" +"\n" +" :return: The texture ID.\n" +" :rtype: int\n"; + +static PyObject * Stroke_getTextureId( BPy_Stroke *self ) { return PyLong_FromLong( self->s->getTextureId() ); } -PyObject * Stroke_hasTips( BPy_Stroke *self ) { +static char Stroke_hasTips___doc__[] = +".. method:: hasTips()\n" +"\n" +" Returns true if this Stroke uses a texture with tips, false\n" +" otherwise.\n" +"\n" +" :return: True if this Stroke uses a texture with tips.\n" +" :rtype: bool\n"; + +static PyObject * Stroke_hasTips( BPy_Stroke *self ) { return PyBool_from_bool( self->s->hasTips() ); } +static char Stroke_setId___doc__[] = +".. method:: setId(id)\n" +"\n" +" Sets the Id of the Stroke.\n" +"\n" +" :arg id: the Id of the Stroke.\n" +" :type id: :class:`Id`\n"; -PyObject *Stroke_setId( BPy_Stroke *self , PyObject *args) { +static PyObject *Stroke_setId( BPy_Stroke *self , PyObject *args) { PyObject *py_id; if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) )) @@ -263,7 +278,15 @@ PyObject *Stroke_setId( BPy_Stroke *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *Stroke_setLength( BPy_Stroke *self , PyObject *args) { +static char Stroke_setLength___doc__[] = +".. method:: setLength(iLength)\n" +"\n" +" Sets the 2D length of the Stroke.\n" +"\n" +" :arg iLength: The 2D length of the Stroke.\n" +" :type iLength: float\n"; + +static PyObject *Stroke_setLength( BPy_Stroke *self , PyObject *args) { float f; if(!( PyArg_ParseTuple(args, "f", &f) )) @@ -274,7 +297,15 @@ PyObject *Stroke_setLength( BPy_Stroke *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *Stroke_setMediumType( BPy_Stroke *self , PyObject *args) { +static char Stroke_setMediumType___doc__[] = +".. method:: setMediumType(iType)\n" +"\n" +" Sets the medium type that must be used for this Stroke.\n" +"\n" +" :arg iType: A MediumType object.\n" +" :type iType: :class:`MediumType`\n"; + +static PyObject *Stroke_setMediumType( BPy_Stroke *self , PyObject *args) { PyObject *py_mt; if(!( PyArg_ParseTuple(args, "O!", &MediumType_Type, &py_mt) )) @@ -285,7 +316,16 @@ PyObject *Stroke_setMediumType( BPy_Stroke *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *Stroke_setTextureId( BPy_Stroke *self , PyObject *args) { +static char Stroke_setTextureId___doc__[] = +".. method:: setTextureId(iId)\n" +"\n" +" Sets the texture ID to be used to simulate the marks system for this\n" +" Stroke.\n" +"\n" +" :arg iId: A texture ID.\n" +" :type iId: int\n"; + +static PyObject *Stroke_setTextureId( BPy_Stroke *self , PyObject *args) { unsigned int i; if(!( PyArg_ParseTuple(args, "I", &i) )) @@ -296,7 +336,16 @@ PyObject *Stroke_setTextureId( BPy_Stroke *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *Stroke_setTips( BPy_Stroke *self , PyObject *args) { +static char Stroke_setTips___doc__[] = +".. method:: setTips(iTips)\n" +"\n" +" Sets the flag telling whether this stroke is using a texture with\n" +" tips or not.\n" +"\n" +" :arg iTips: True if this stroke uses a texture with tips.\n" +" :type iTips: bool\n"; + +static PyObject *Stroke_setTips( BPy_Stroke *self , PyObject *args) { PyObject *py_b; if(!( PyArg_ParseTuple(args, "O", &py_b) )) @@ -307,7 +356,20 @@ PyObject *Stroke_setTips( BPy_Stroke *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * Stroke_strokeVerticesBegin( BPy_Stroke *self , PyObject *args) { +static char Stroke_strokeVerticesBegin___doc__[] = +".. method:: strokeVerticesBegin(t=0.0)\n" +"\n" +" Returns a StrokeVertexIterator pointing on the first StrokeVertex of\n" +" the Stroke. O ne can specify a sampling value to resample the Stroke\n" +" on the fly if needed.\n" +"\n" +" :arg t: The resampling value with which we want our Stroke to be\n" +" resampled. If 0 is specified, no resampling is done.\n" +" :type t: float\n" +" :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n" +" :rtype: :class:`StrokeVertexIterator`\n"; + +static PyObject * Stroke_strokeVerticesBegin( BPy_Stroke *self , PyObject *args) { float f = 0; if(!( PyArg_ParseTuple(args, "|f", &f) )) @@ -317,15 +379,110 @@ PyObject * Stroke_strokeVerticesBegin( BPy_Stroke *self , PyObject *args) { return BPy_StrokeVertexIterator_from_StrokeVertexIterator( sv_it, 0 ); } -PyObject * Stroke_strokeVerticesEnd( BPy_Stroke *self ) { +static char Stroke_strokeVerticesEnd___doc__[] = +".. method:: strokeVerticesEnd()\n" +"\n" +" Returns a StrokeVertexIterator pointing after the last StrokeVertex\n" +" of the Stroke.\n" +"\n" +" :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n" +" :rtype: :class:`StrokeVertexIterator`\n"; + +static PyObject * Stroke_strokeVerticesEnd( BPy_Stroke *self ) { StrokeInternal::StrokeVertexIterator sv_it( self->s->strokeVerticesEnd() ); return BPy_StrokeVertexIterator_from_StrokeVertexIterator( sv_it, 1 ); } -PyObject * Stroke_strokeVerticesSize( BPy_Stroke *self ) { +static char Stroke_strokeVerticesSize___doc__[] = +".. method:: strokeVerticesSize()\n" +"\n" +" Returns the number of StrokeVertex constituing the Stroke.\n" +"\n" +" :return: The number of stroke vertices.\n" +" :rtype: int\n"; + +static PyObject * Stroke_strokeVerticesSize( BPy_Stroke *self ) { return PyLong_FromLong( self->s->strokeVerticesSize() ); } +/*----------------------Stroke instance definitions ----------------------------*/ + +static PyMethodDef BPy_Stroke_methods[] = { + {"__getitem__", ( PyCFunction ) Stroke___getitem__, METH_O, "(int i) Returns the i-th StrokeVertex constituting the Stroke."}, + {"ComputeSampling", ( PyCFunction ) Stroke_ComputeSampling, METH_VARARGS, Stroke_ComputeSampling___doc__}, + {"Resample", ( PyCFunction ) Stroke_Resample, METH_VARARGS, Stroke_Resample___doc__}, + {"RemoveVertex", ( PyCFunction ) Stroke_RemoveVertex, METH_VARARGS, Stroke_RemoveVertex___doc__}, + {"InsertVertex", ( PyCFunction ) Stroke_InsertVertex, METH_VARARGS, Stroke_InsertVertex___doc__}, + {"getMediumType", ( PyCFunction ) Stroke_getMediumType, METH_NOARGS, Stroke_getMediumType___doc__}, + {"getTextureId", ( PyCFunction ) Stroke_getTextureId, METH_NOARGS, Stroke_getTextureId___doc__}, + {"hasTips", ( PyCFunction ) Stroke_hasTips, METH_NOARGS, Stroke_hasTips___doc__}, + {"setId", ( PyCFunction ) Stroke_setId, METH_VARARGS, Stroke_setId___doc__}, + {"setLength", ( PyCFunction ) Stroke_setLength, METH_VARARGS, Stroke_setLength___doc__}, + {"setMediumType", ( PyCFunction ) Stroke_setMediumType, METH_VARARGS, Stroke_setMediumType___doc__}, + {"setTextureId", ( PyCFunction ) Stroke_setTextureId, METH_VARARGS, Stroke_setTextureId___doc__}, + {"setTips", ( PyCFunction ) Stroke_setTips, METH_VARARGS, Stroke_setTips___doc__}, + {"strokeVerticesBegin", ( PyCFunction ) Stroke_strokeVerticesBegin, METH_VARARGS, Stroke_strokeVerticesBegin___doc__}, + {"strokeVerticesEnd", ( PyCFunction ) Stroke_strokeVerticesEnd, METH_NOARGS, Stroke_strokeVerticesEnd___doc__}, + {"strokeVerticesSize", ( PyCFunction ) Stroke_strokeVerticesSize, METH_NOARGS, Stroke_strokeVerticesSize___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_Stroke type definition ------------------------------*/ + +static PySequenceMethods Stroke_as_sequence = { + (lenfunc)Stroke_length, /* sq_length */ + NULL, /* sq_concat */ + NULL, /* sq_repeat */ + (ssizeargfunc)Stroke_item, /* sq_item */ + NULL, /* sq_slice */ + NULL, /* sq_ass_item */ + NULL, /* sq_ass_slice */ + NULL, /* sq_contains */ + NULL, /* sq_inplace_concat */ + NULL, /* sq_inplace_repeat */ +}; + +PyTypeObject Stroke_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Stroke", /* tp_name */ + sizeof(BPy_Stroke), /* 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 */ + &Stroke_as_sequence, /* 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 */ + Stroke___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)Stroke___iter__, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Stroke_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Stroke___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index 837dbb700c9..49ef52f87aa 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -14,102 +14,25 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ViewEdge instance -----------*/ -static int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds); - -static PyObject * ViewEdge_A( BPy_ViewEdge *self ); -static PyObject * ViewEdge_B( BPy_ViewEdge *self ); -static PyObject * ViewEdge_fedgeA( BPy_ViewEdge *self ) ; -static PyObject * ViewEdge_fedgeB( BPy_ViewEdge *self ) ; -static PyObject * ViewEdge_viewShape( BPy_ViewEdge *self ) ; -static PyObject * ViewEdge_aShape( BPy_ViewEdge *self ) ; -static PyObject * ViewEdge_isClosed( BPy_ViewEdge *self ); -static PyObject * ViewEdge_getChainingTimeStamp( BPy_ViewEdge *self ); -static PyObject * ViewEdge_setChainingTimeStamp( BPy_ViewEdge *self, PyObject *args) ; -static PyObject * ViewEdge_setA( BPy_ViewEdge *self , PyObject *args) ; -static PyObject * ViewEdge_setB( BPy_ViewEdge *self , PyObject *args); -static PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args ); -static PyObject * ViewEdge_setFEdgeA( BPy_ViewEdge *self, PyObject *args ) ; -static PyObject * ViewEdge_setFEdgeB( BPy_ViewEdge *self, PyObject *args ) ; -static PyObject * ViewEdge_setShape( BPy_ViewEdge *self, PyObject *args ) ; -static PyObject * ViewEdge_setId( BPy_ViewEdge *self, PyObject *args ) ; -static PyObject * ViewEdge_UpdateFEdges( BPy_ViewEdge *self ); -static PyObject * ViewEdge_setaShape( BPy_ViewEdge *self, PyObject *args ); -static PyObject * ViewEdge_setQI( BPy_ViewEdge *self, PyObject *args ); -static PyObject * ViewEdge_qi( BPy_ViewEdge *self ); - - -/*----------------------ViewEdge instance definitions ----------------------------*/ -static PyMethodDef BPy_ViewEdge_methods[] = { - {"A", ( PyCFunction ) ViewEdge_A, METH_NOARGS, "() Returns the first ViewVertex."}, - {"B", ( PyCFunction ) ViewEdge_B, METH_NOARGS, "() Returns the second ViewVertex."}, - {"fedgeA", ( PyCFunction ) ViewEdge_fedgeA, METH_NOARGS, "() Returns the first FEdge that constitues this ViewEdge."}, - {"fedgeB", ( PyCFunction ) ViewEdge_fedgeB, METH_NOARGS, "() Returns the last FEdge that constitues this ViewEdge."}, - {"viewShape", ( PyCFunction ) ViewEdge_viewShape, METH_NOARGS, "() Returns the ViewShape to which this ViewEdge belongs to . "}, - {"aShape", ( PyCFunction ) ViewEdge_aShape, METH_NOARGS, "() Returns the shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no object is occluded, 0 is returned."}, - {"isClosed", ( PyCFunction ) ViewEdge_isClosed, METH_NOARGS, "() Tells whether this ViewEdge forms a closed loop or not."}, - {"getChainingTimeStamp", ( PyCFunction ) ViewEdge_getChainingTimeStamp, METH_NOARGS, "() Returns the time stamp of this ViewEdge."}, - {"setChainingTimeStamp", ( PyCFunction ) ViewEdge_setChainingTimeStamp, METH_VARARGS, "(int ts) Sets the time stamp value."}, - {"setA", ( PyCFunction ) ViewEdge_setA, METH_VARARGS, "(ViewVertex sv) Sets the first ViewVertex of the ViewEdge."}, - {"setB", ( PyCFunction ) ViewEdge_setB, METH_VARARGS, "(ViewVertex sv) Sets the last ViewVertex of the ViewEdge."}, - {"setNature", ( PyCFunction ) ViewEdge_setNature, METH_VARARGS, "(Nature n) Sets the nature of the ViewEdge."}, - {"setFEdgeA", ( PyCFunction ) ViewEdge_setFEdgeA, METH_VARARGS, "(FEdge fe) Sets the first FEdge of the ViewEdge."}, - {"setFEdgeB", ( PyCFunction ) ViewEdge_setFEdgeB, METH_VARARGS, "(FEdge fe) Sets the last FEdge of the ViewEdge."}, - {"setShape", ( PyCFunction ) ViewEdge_setShape, METH_VARARGS, "(ViewShape vs) Sets the ViewShape to which this ViewEdge belongs to."}, - {"setId", ( PyCFunction ) ViewEdge_setId, METH_VARARGS, "(Id id) Sets the ViewEdge id."}, - {"UpdateFEdges", ( PyCFunction ) ViewEdge_UpdateFEdges, METH_NOARGS, "() Sets ViewEdge to this for all embedded fedges"}, - {"setaShape", ( PyCFunction ) ViewEdge_setaShape, METH_VARARGS, "(ViewShape vs) Sets the occluded ViewShape"}, - {"setQI", ( PyCFunction ) ViewEdge_setQI, METH_VARARGS, "(int qi) Sets the quantitative invisibility value."}, - {"qi", ( PyCFunction ) ViewEdge_qi, METH_NOARGS, "() Returns the quantitative invisibility of the ViewEdge."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_ViewEdge type definition ------------------------------*/ - -PyTypeObject ViewEdge_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewEdge", /* tp_name */ - sizeof(BPy_ViewEdge), /* 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 */ - "ViewEdge objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewEdge_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewEdge___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds) +static char ViewEdge___doc__[] = +"Class defining a ViewEdge. A ViewEdge in an edge of the image graph.\n" +"it connnects two :class:`ViewVertex` objects. It is made by connecting\n" +"a set of FEdges.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A ViewEdge object.\n" +" :type iBrother: :class:`ViewEdge`\n"; + +static int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -120,8 +43,15 @@ int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds) return 0; } +static char ViewEdge_A___doc__[] = +".. method:: A()\n" +"\n" +" Returns the first ViewVertex.\n" +"\n" +" :return: The first ViewVertex.\n" +" :rtype: :class:`ViewVertex`\n"; -PyObject * ViewEdge_A( BPy_ViewEdge *self ) { +static PyObject * ViewEdge_A( BPy_ViewEdge *self ) { ViewVertex *v = self->ve->A(); if( v ){ return Any_BPy_ViewVertex_from_ViewVertex( *v ); @@ -130,7 +60,15 @@ PyObject * ViewEdge_A( BPy_ViewEdge *self ) { Py_RETURN_NONE; } -PyObject * ViewEdge_B( BPy_ViewEdge *self ) { +static char ViewEdge_B___doc__[] = +".. method:: B()\n" +"\n" +" Returns the second ViewVertex.\n" +"\n" +" :return: The second ViewVertex.\n" +" :rtype: :class:`ViewVertex`\n"; + +static PyObject * ViewEdge_B( BPy_ViewEdge *self ) { ViewVertex *v = self->ve->B(); if( v ){ return Any_BPy_ViewVertex_from_ViewVertex( *v ); @@ -139,7 +77,15 @@ PyObject * ViewEdge_B( BPy_ViewEdge *self ) { Py_RETURN_NONE; } -PyObject * ViewEdge_fedgeA( BPy_ViewEdge *self ) { +static char ViewEdge_fedgeA___doc__[] = +".. method:: fedgeA()\n" +"\n" +" Returns the first FEdge that constitutes this ViewEdge.\n" +"\n" +" :return: The first FEdge constituting this ViewEdge.\n" +" :rtype: :class:`FEdge`\n"; + +static PyObject * ViewEdge_fedgeA( BPy_ViewEdge *self ) { FEdge *A = self->ve->fedgeA(); if( A ){ return Any_BPy_FEdge_from_FEdge( *A ); @@ -148,7 +94,15 @@ PyObject * ViewEdge_fedgeA( BPy_ViewEdge *self ) { Py_RETURN_NONE; } -PyObject * ViewEdge_fedgeB( BPy_ViewEdge *self ) { +static char ViewEdge_fedgeB___doc__[] = +".. method:: fedgeB()\n" +"\n" +" Returns the last FEdge that constitutes this ViewEdge.\n" +"\n" +" :return: The last FEdge constituting this ViewEdge.\n" +" :rtype: :class:`FEdge`\n"; + +static PyObject * ViewEdge_fedgeB( BPy_ViewEdge *self ) { FEdge *B = self->ve->fedgeB(); if( B ){ return Any_BPy_FEdge_from_FEdge( *B ); @@ -157,7 +111,15 @@ PyObject * ViewEdge_fedgeB( BPy_ViewEdge *self ) { Py_RETURN_NONE; } -PyObject * ViewEdge_viewShape( BPy_ViewEdge *self ) { +static char ViewEdge_viewShape___doc__[] = +".. method:: viewShape()\n" +"\n" +" Returns the ViewShape to which this ViewEdge belongs to.\n" +"\n" +" :return: The ViewShape to which this ViewEdge belongs to.\n" +" :rtype: :class:`ViewShape`\n"; + +static PyObject * ViewEdge_viewShape( BPy_ViewEdge *self ) { ViewShape *vs = self->ve->viewShape(); if( vs ){ return BPy_ViewShape_from_ViewShape( *vs ); @@ -166,7 +128,16 @@ PyObject * ViewEdge_viewShape( BPy_ViewEdge *self ) { Py_RETURN_NONE; } -PyObject * ViewEdge_aShape( BPy_ViewEdge *self ) { +static char ViewEdge_aShape___doc__[] = +".. method:: aShape()\n" +"\n" +" Returns the shape that is occluded by the ViewShape to which this\n" +" ViewEdge belongs to. If no object is occluded, None is returned.\n" +"\n" +" :return: The occluded ViewShape.\n" +" :rtype: :class:`ViewShape`\n"; + +static PyObject * ViewEdge_aShape( BPy_ViewEdge *self ) { ViewShape *vs = self->ve->aShape(); if( vs ){ return BPy_ViewShape_from_ViewShape( *vs ); @@ -175,15 +146,39 @@ PyObject * ViewEdge_aShape( BPy_ViewEdge *self ) { Py_RETURN_NONE; } -PyObject * ViewEdge_isClosed( BPy_ViewEdge *self ) { +static char ViewEdge_isClosed___doc__[] = +".. method:: isClosed()\n" +"\n" +" Tells whether this ViewEdge forms a closed loop or not.\n" +"\n" +" :return: True if this ViewEdge forms a closed loop.\n" +" :rtype: bool\n"; + +static PyObject * ViewEdge_isClosed( BPy_ViewEdge *self ) { return PyBool_from_bool( self->ve->isClosed() ); } -PyObject * ViewEdge_getChainingTimeStamp( BPy_ViewEdge *self ) { +static char ViewEdge_getChainingTimeStamp___doc__[] = +".. method:: getChainingTimeStamp()\n" +"\n" +" Returns the time stamp of this ViewEdge.\n" +"\n" +" :return: The time stamp.\n" +" :rtype: int\n"; + +static PyObject * ViewEdge_getChainingTimeStamp( BPy_ViewEdge *self ) { return PyLong_FromLong( self->ve->getChainingTimeStamp() ); } -PyObject * ViewEdge_setChainingTimeStamp( BPy_ViewEdge *self, PyObject *args) { +static char ViewEdge_setChainingTimeStamp___doc__[] = +".. method:: setChainingTimeStamp(ts)\n" +"\n" +" Sets the time stamp value.\n" +"\n" +" :arg ts: The time stamp.\n" +" :type ts: int\n"; + +static PyObject * ViewEdge_setChainingTimeStamp( BPy_ViewEdge *self, PyObject *args) { int timestamp = 0 ; if( !PyArg_ParseTuple(args, "i", ×tamp) ) @@ -194,7 +189,15 @@ PyObject * ViewEdge_setChainingTimeStamp( BPy_ViewEdge *self, PyObject *args) { Py_RETURN_NONE; } -PyObject *ViewEdge_setA( BPy_ViewEdge *self , PyObject *args) { +static char ViewEdge_setA___doc__[] = +".. method:: setA(iA)\n" +"\n" +" Sets the first ViewVertex of the ViewEdge.\n" +"\n" +" :arg iA: The first ViewVertex of the ViewEdge.\n" +" :type iA: :class:`ViewVertex`\n"; + +static PyObject *ViewEdge_setA( BPy_ViewEdge *self , PyObject *args) { PyObject *py_vv; if(!( PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv) )) @@ -205,7 +208,15 @@ PyObject *ViewEdge_setA( BPy_ViewEdge *self , PyObject *args) { Py_RETURN_NONE; } -PyObject *ViewEdge_setB( BPy_ViewEdge *self , PyObject *args) { +static char ViewEdge_setB___doc__[] = +".. method:: setB(iB)\n" +"\n" +" Sets the last ViewVertex of the ViewEdge.\n" +"\n" +" :arg iB: The last ViewVertex of the ViewEdge.\n" +" :type iB: :class:`ViewVertex`\n"; + +static PyObject *ViewEdge_setB( BPy_ViewEdge *self , PyObject *args) { PyObject *py_vv; if(!( PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv) )) @@ -216,7 +227,15 @@ PyObject *ViewEdge_setB( BPy_ViewEdge *self , PyObject *args) { Py_RETURN_NONE; } -PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args ) { +static char ViewEdge_setNature___doc__[] = +".. method:: setNature(iNature)\n" +"\n" +" Sets the nature of the ViewEdge.\n" +"\n" +" :arg iNature: The nature of the ViewEdge.\n" +" :type iNature: :class:`Nature`\n"; + +static PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args ) { PyObject *py_n; if(!( PyArg_ParseTuple(args, "O!", &Nature_Type, &py_n) )) @@ -228,7 +247,15 @@ PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * ViewEdge_setFEdgeA( BPy_ViewEdge *self, PyObject *args ) { +static char ViewEdge_setFEdgeA___doc__[] = +".. method:: setFEdgeA(iFEdge)\n" +"\n" +" Sets the first FEdge of the ViewEdge.\n" +"\n" +" :arg iFEdge: The first FEdge of the ViewEdge.\n" +" :type iFEdge: :class:`FEdge`\n"; + +static PyObject * ViewEdge_setFEdgeA( BPy_ViewEdge *self, PyObject *args ) { PyObject *py_fe; if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) )) @@ -239,7 +266,15 @@ PyObject * ViewEdge_setFEdgeA( BPy_ViewEdge *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * ViewEdge_setFEdgeB( BPy_ViewEdge *self, PyObject *args ) { +static char ViewEdge_setFEdgeB___doc__[] = +".. method:: setFEdgeB(iFEdge)\n" +"\n" +" Sets the last FEdge of the ViewEdge.\n" +"\n" +" :arg iFEdge: The last FEdge of the ViewEdge.\n" +" :type iFEdge: :class:`FEdge`\n"; + +static PyObject * ViewEdge_setFEdgeB( BPy_ViewEdge *self, PyObject *args ) { PyObject *py_fe; if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) )) @@ -250,7 +285,15 @@ PyObject * ViewEdge_setFEdgeB( BPy_ViewEdge *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * ViewEdge_setShape( BPy_ViewEdge *self, PyObject *args ) { +static char ViewEdge_setShape___doc__[] = +".. method:: setShape(iVShape)\n" +"\n" +" Sets the ViewShape to which this ViewEdge belongs to.\n" +"\n" +" :arg iVShape: The ViewShape to which this ViewEdge belongs to.\n" +" :type iVShape: :class:`ViewShape`\n"; + +static PyObject * ViewEdge_setShape( BPy_ViewEdge *self, PyObject *args ) { PyObject *py_vs; if(!( PyArg_ParseTuple(args, "O", &ViewShape_Type, &py_vs) )) @@ -261,7 +304,15 @@ PyObject * ViewEdge_setShape( BPy_ViewEdge *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * ViewEdge_setId( BPy_ViewEdge *self, PyObject *args ) { +static char ViewEdge_setId___doc__[] = +".. method:: setId(id)\n" +"\n" +" Sets the ViewEdge id.\n" +"\n" +" :arg id: An Id object.\n" +" :type id: :class:`Id`\n"; + +static PyObject * ViewEdge_setId( BPy_ViewEdge *self, PyObject *args ) { PyObject *py_id; if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) )) @@ -273,13 +324,26 @@ PyObject * ViewEdge_setId( BPy_ViewEdge *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * ViewEdge_UpdateFEdges( BPy_ViewEdge *self ) { +static char ViewEdge_UpdateFEdges___doc__[] = +".. method:: UpdateFEdges()\n" +"\n" +" Sets Viewedge to this for all embedded fedges.\n"; + +static PyObject * ViewEdge_UpdateFEdges( BPy_ViewEdge *self ) { self->ve->UpdateFEdges(); Py_RETURN_NONE; } -PyObject * ViewEdge_setaShape( BPy_ViewEdge *self, PyObject *args ) { +static char ViewEdge_setaShape___doc__[] = +".. method:: setaShape(iShape)\n" +"\n" +" Sets the occluded ViewShape.\n" +"\n" +" :arg iShape: A ViewShape object.\n" +" :type iShape: :class:`ViewShape`\n"; + +static PyObject * ViewEdge_setaShape( BPy_ViewEdge *self, PyObject *args ) { PyObject *py_vs; if(!( PyArg_ParseTuple(args, "O!", &ViewShape_Type, &py_vs) )) @@ -291,7 +355,15 @@ PyObject * ViewEdge_setaShape( BPy_ViewEdge *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * ViewEdge_setQI( BPy_ViewEdge *self, PyObject *args ) { +static char ViewEdge_setQI___doc__[] = +".. method:: setQI(qi)\n" +"\n" +" Sets the quantitative invisibility value of the ViewEdge.\n" +"\n" +" :arg qi: The quantitative invisibility.\n" +" :type qi: int\n"; + +static PyObject * ViewEdge_setQI( BPy_ViewEdge *self, PyObject *args ) { int qi; if(!( PyArg_ParseTuple(args, "i", &qi) )) @@ -302,10 +374,86 @@ PyObject * ViewEdge_setQI( BPy_ViewEdge *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * ViewEdge_qi( BPy_ViewEdge *self ) { +static char ViewEdge_qi___doc__[] = +".. method:: getChainingTimeStamp()\n" +"\n" +" Returns the quantitative invisibility value of the ViewEdge.\n" +"\n" +" :return: The quantitative invisibility.\n" +" :rtype: int\n"; + +static PyObject * ViewEdge_qi( BPy_ViewEdge *self ) { return PyLong_FromLong( self->ve->qi() ); } +/*----------------------ViewEdge instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewEdge_methods[] = { + {"A", ( PyCFunction ) ViewEdge_A, METH_NOARGS, ViewEdge_A___doc__}, + {"B", ( PyCFunction ) ViewEdge_B, METH_NOARGS, ViewEdge_B___doc__}, + {"fedgeA", ( PyCFunction ) ViewEdge_fedgeA, METH_NOARGS, ViewEdge_fedgeA___doc__}, + {"fedgeB", ( PyCFunction ) ViewEdge_fedgeB, METH_NOARGS, ViewEdge_fedgeB___doc__}, + {"viewShape", ( PyCFunction ) ViewEdge_viewShape, METH_NOARGS, ViewEdge_viewShape___doc__}, + {"aShape", ( PyCFunction ) ViewEdge_aShape, METH_NOARGS, ViewEdge_aShape___doc__}, + {"isClosed", ( PyCFunction ) ViewEdge_isClosed, METH_NOARGS, ViewEdge_isClosed___doc__}, + {"getChainingTimeStamp", ( PyCFunction ) ViewEdge_getChainingTimeStamp, METH_NOARGS, ViewEdge_getChainingTimeStamp___doc__}, + {"setChainingTimeStamp", ( PyCFunction ) ViewEdge_setChainingTimeStamp, METH_VARARGS, ViewEdge_setChainingTimeStamp___doc__}, + {"setA", ( PyCFunction ) ViewEdge_setA, METH_VARARGS, ViewEdge_setA___doc__}, + {"setB", ( PyCFunction ) ViewEdge_setB, METH_VARARGS, ViewEdge_setB___doc__}, + {"setNature", ( PyCFunction ) ViewEdge_setNature, METH_VARARGS, ViewEdge_setNature___doc__}, + {"setFEdgeA", ( PyCFunction ) ViewEdge_setFEdgeA, METH_VARARGS, ViewEdge_setFEdgeA___doc__}, + {"setFEdgeB", ( PyCFunction ) ViewEdge_setFEdgeB, METH_VARARGS, ViewEdge_setFEdgeB___doc__}, + {"setShape", ( PyCFunction ) ViewEdge_setShape, METH_VARARGS, ViewEdge_setShape___doc__}, + {"setId", ( PyCFunction ) ViewEdge_setId, METH_VARARGS, ViewEdge_setId___doc__}, + {"UpdateFEdges", ( PyCFunction ) ViewEdge_UpdateFEdges, METH_NOARGS, ViewEdge_UpdateFEdges___doc__}, + {"setaShape", ( PyCFunction ) ViewEdge_setaShape, METH_VARARGS, ViewEdge_setaShape___doc__}, + {"setQI", ( PyCFunction ) ViewEdge_setQI, METH_VARARGS, ViewEdge_setQI___doc__}, + {"qi", ( PyCFunction ) ViewEdge_qi, METH_NOARGS, ViewEdge_qi___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewEdge type definition ------------------------------*/ + +PyTypeObject ViewEdge_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ViewEdge", /* tp_name */ + sizeof(BPy_ViewEdge), /* 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 */ + ViewEdge___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewEdge_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewEdge___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp index e3b6927dbbc..7958a35b851 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp @@ -10,64 +10,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Chain instance -----------*/ -static int Chain___init__(BPy_Chain *self, PyObject *args, PyObject *kwds); -static PyObject * Chain_push_viewedge_back( BPy_Chain *self, PyObject *args ); -static PyObject * Chain_push_viewedge_front( BPy_Chain *self, PyObject *args ); - - -/*----------------------Chain instance definitions ----------------------------*/ -static PyMethodDef BPy_Chain_methods[] = { - {"push_viewedge_back", ( PyCFunction ) Chain_push_viewedge_back, METH_VARARGS, "(ViewEdge ve, bool orientation) Adds a ViewEdge at the end of the chain."}, - {"push_viewedge_front", ( PyCFunction ) Chain_push_viewedge_front, METH_VARARGS, "(ViewEdge ve, bool orientation) Adds a ViewEdge at the beginning of the chain."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_Chain type definition ------------------------------*/ - -PyTypeObject Chain_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Chain", /* tp_name */ - sizeof(BPy_Chain), /* 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 */ - "Chain objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Chain_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &FrsCurve_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Chain___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- +static char Chain___doc__[] = +"Class to represent a 1D elements issued from the chaining process. A\n" +"Chain is the last step before the :class:`Stroke` and is used in the\n" +"Splitting and Creation processes.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Defult constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: A Chain object.\n" +" :type iBrother: :class:`Chain`\n" +"\n" +".. method:: __init__(id)\n" +"\n" +" Builds a chain from its Id.\n" +"\n" +" :arg id: An Id object.\n" +" :type id: :class:`Id`\n"; + int Chain___init__(BPy_Chain *self, PyObject *args, PyObject *kwds) { @@ -97,6 +64,16 @@ int Chain___init__(BPy_Chain *self, PyObject *args, PyObject *kwds) return 0; } +static char Chain_push_viewedge_back___doc__[] = +".. method:: push_viewedge_back(iViewEdge, orientation)\n" +"\n" +" Adds a ViewEdge at the end of the Chain.\n" +"\n" +" :arg iViewEdge: The ViewEdge that must be added.\n" +" :type iViewEdge: :class:`ViewEdge`\n" +" :arg orientation: The orientation with which the ViewEdge must be\n" +" processed.\n" +" :type orientation: bool\n"; PyObject * Chain_push_viewedge_back( BPy_Chain *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0; @@ -111,6 +88,17 @@ PyObject * Chain_push_viewedge_back( BPy_Chain *self, PyObject *args ) { Py_RETURN_NONE; } +static char Chain_push_viewedge_front___doc__[] = +".. method:: push_viewedge_front(iViewEdge, orientation)\n" +"\n" +" Adds a ViewEdge at the beginning of the Chain.\n" +"\n" +" :arg iViewEdge: The ViewEdge that must be added.\n" +" :type iViewEdge: :class:`ViewEdge`\n" +" :arg orientation: The orientation with which the ViewEdge must be\n" +" processed.\n" +" :type orientation: bool\n"; + PyObject * Chain_push_viewedge_front( BPy_Chain *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0; @@ -124,9 +112,55 @@ PyObject * Chain_push_viewedge_front( BPy_Chain *self, PyObject *args ) { Py_RETURN_NONE; } +/*----------------------Chain instance definitions ----------------------------*/ +static PyMethodDef BPy_Chain_methods[] = { + {"push_viewedge_back", ( PyCFunction ) Chain_push_viewedge_back, METH_VARARGS, Chain_push_viewedge_back___doc__}, + {"push_viewedge_front", ( PyCFunction ) Chain_push_viewedge_front, METH_VARARGS, Chain_push_viewedge_front___doc__}, + {NULL, NULL, 0, NULL} +}; +/*-----------------------BPy_Chain type definition ------------------------------*/ - +PyTypeObject Chain_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "Chain", /* tp_name */ + sizeof(BPy_Chain), /* 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 */ + Chain___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Chain_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &FrsCurve_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Chain___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index e699d843ed8..2c666534d66 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -9,81 +9,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FEdgeSharp instance -----------*/ -static int FEdgeSharp___init__(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds); - -static PyObject * FEdgeSharp_normalA( BPy_FEdgeSharp *self ) ; -static PyObject * FEdgeSharp_normalB( BPy_FEdgeSharp *self ); -static PyObject * FEdgeSharp_aMaterialIndex( BPy_FEdgeSharp *self ) ; -static PyObject * FEdgeSharp_bMaterialIndex( BPy_FEdgeSharp *self ); -static PyObject * FEdgeSharp_aMaterial( BPy_FEdgeSharp *self ); -static PyObject * FEdgeSharp_bMaterial( BPy_FEdgeSharp *self ); -static PyObject * FEdgeSharp_setNormalA( BPy_FEdgeSharp *self, PyObject *args ); -static PyObject * FEdgeSharp_setNormalB( BPy_FEdgeSharp *self, PyObject *args ); -static PyObject * FEdgeSharp_setaMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ); -static PyObject * FEdgeSharp_setbMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ); - -/*----------------------FEdgeSharp instance definitions ----------------------------*/ -static PyMethodDef BPy_FEdgeSharp_methods[] = { - {"normalA", ( PyCFunction ) FEdgeSharp_normalA, METH_NOARGS, "() Returns the normal to the face lying on the right of the FEdge. If this FEdge is a border, it has no Face on its right and therefore, no normal."}, - {"normalB", ( PyCFunction ) FEdgeSharp_normalB, METH_NOARGS, "() Returns the normal to the face lying on the left of the FEdge."}, - {"aMaterialIndex", ( PyCFunction ) FEdgeSharp_aMaterialIndex, METH_NOARGS, "() Returns the index of the material of the face lying on the right of the FEdge. If this FEdge is a border, it has no Face on its right and therefore, no material. "}, - {"bMaterialIndex", ( PyCFunction ) FEdgeSharp_bMaterialIndex, METH_NOARGS, "() Returns the material of the face lying on the left of the FEdge. "}, - {"aMaterial", ( PyCFunction ) FEdgeSharp_aMaterial, METH_NOARGS, "() Returns the material of the face lying on the right of the FEdge. If this FEdge is a border, it has no Face on its right and therefore, no material."}, - {"bMaterial", ( PyCFunction ) FEdgeSharp_bMaterial, METH_NOARGS, "() Returns the material of the face lying on the left of the FEdge."}, - {"setNormalA", ( PyCFunction ) FEdgeSharp_setNormalA, METH_VARARGS, "([x,y,z]) Sets the normal to the face lying on the right of the FEdge."}, - {"setNormalB", ( PyCFunction ) FEdgeSharp_setNormalB, METH_VARARGS, "([x,y,z]) Sets the normal to the face lying on the left of the FEdge. "}, - {"setaMaterialIndex", ( PyCFunction ) FEdgeSharp_setaMaterialIndex, METH_VARARGS, "(unsigned int i) Sets the index of the material lying on the right of the FEdge. "}, - {"setbMaterialIndex", ( PyCFunction ) FEdgeSharp_setbMaterialIndex, METH_VARARGS, "(unsigned int i) Sets the index of the material lying on the left of the FEdge. "}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_FEdgeSharp type definition ------------------------------*/ - -PyTypeObject FEdgeSharp_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FEdgeSharp", /* tp_name */ - sizeof(BPy_FEdgeSharp), /* 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 */ - "FEdgeSharp objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FEdgeSharp_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &FEdge_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdgeSharp___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int FEdgeSharp___init__(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds) +static char FEdgeSharp___doc__[] = +"Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial\n" +"edge of the input mesh. It can be a silhouette, a crease or a border.\n" +"If it is a crease edge, then it is borded by two faces of the mesh.\n" +"Face a lies on its right whereas Face b lies on its left. If it is a\n" +"border edge, then it doesn't have any face on its right, and thus Face\n" +"a is None.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: An FEdgeSharp object.\n" +" :type iBrother: :class:`FEdgeSharp`\n" +"\n" +".. method:: __init__(vA, vB)\n" +"\n" +" Builds an FEdgeSharp going from vA to vB.\n" +"\n" +" :arg vA: The first SVertex object.\n" +" :type vA: :class:`SVertex`\n" +" :arg vB: The second SVertex object.\n" +" :type vB: :class:`SVertex`\n"; + +static int FEdgeSharp___init__(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0; @@ -111,36 +67,100 @@ int FEdgeSharp___init__(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds) return 0; } - -PyObject * FEdgeSharp_normalA( BPy_FEdgeSharp *self ) { +static char FEdgeSharp_normalA___doc__[] = +".. method:: normalA()\n" +"\n" +" Returns the normal to the face lying on the right of the FEdge. If\n" +" this FEdge is a border, it has no Face on its right and therefore, no\n" +" normal.\n" +"\n" +" :return: The normal to the face lying on the right of the FEdge.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static PyObject * FEdgeSharp_normalA( BPy_FEdgeSharp *self ) { Vec3r v( self->fes->normalA() ); return Vector_from_Vec3r( v ); } -PyObject * FEdgeSharp_normalB( BPy_FEdgeSharp *self ) { +static char FEdgeSharp_normalB___doc__[] = +".. method:: normalB()\n" +"\n" +" Returns the normal to the face lying on the left of the FEdge.\n" +"\n" +" :return: The normal to the face lying on the left of the FEdge.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static PyObject * FEdgeSharp_normalB( BPy_FEdgeSharp *self ) { Vec3r v( self->fes->normalB() ); return Vector_from_Vec3r( v ); } -PyObject * FEdgeSharp_aMaterialIndex( BPy_FEdgeSharp *self ) { +static char FEdgeSharp_aMaterialIndex___doc__[] = +".. method:: aMaterialIndex()\n" +"\n" +" Returns the index of the material of the face lying on the right of\n" +" the FEdge. If this FEdge is a border, it has no Face on its right and\n" +" therefore, no material.\n" +"\n" +" :return: The index of the material of the face lying on the right of\n" +" the FEdge.\n" +" :rtype: int\n"; + +static PyObject * FEdgeSharp_aMaterialIndex( BPy_FEdgeSharp *self ) { return PyLong_FromLong( self->fes->aFrsMaterialIndex() ); } -PyObject * FEdgeSharp_bMaterialIndex( BPy_FEdgeSharp *self ) { +static char FEdgeSharp_bMaterialIndex___doc__[] = +".. method:: bMaterialIndex()\n" +"\n" +" Returns the index of the material of the face lying on the left of\n" +" the FEdge.\n" +"\n" +" :return: The index of the material of the face lying on the left of\n" +" the FEdge.\n" +" :rtype: int\n"; + +static PyObject * FEdgeSharp_bMaterialIndex( BPy_FEdgeSharp *self ) { return PyLong_FromLong( self->fes->bFrsMaterialIndex() ); } -PyObject * FEdgeSharp_aMaterial( BPy_FEdgeSharp *self ) { +static char FEdgeSharp_aMaterial___doc__[] = +".. method:: aMaterial()\n" +"\n" +" Returns the material of the face lying on the right of the FEdge. If\n" +" this FEdge is a border, it has no Face on its right and therefore, no\n" +" material.\n" +"\n" +" :return: The material of the face lying on the right of the FEdge.\n" +" :rtype: :class:`Material`\n"; + +static PyObject * FEdgeSharp_aMaterial( BPy_FEdgeSharp *self ) { FrsMaterial m( self->fes->aFrsMaterial() ); return BPy_FrsMaterial_from_FrsMaterial(m); } -PyObject * FEdgeSharp_bMaterial( BPy_FEdgeSharp *self ) { +static char FEdgeSharp_bMaterial___doc__[] = +".. method:: bMaterial()\n" +"\n" +" Returns the material of the face lying on the left of the FEdge.\n" +"\n" +" :return: The material of the face lying on the left of the FEdge.\n" +" :rtype: :class:`Material`\n"; + +static PyObject * FEdgeSharp_bMaterial( BPy_FEdgeSharp *self ) { FrsMaterial m( self->fes->aFrsMaterial() ); return BPy_FrsMaterial_from_FrsMaterial(m); } -PyObject * FEdgeSharp_setNormalA( BPy_FEdgeSharp *self, PyObject *args ) { +static char FEdgeSharp_setNormalA___doc__[] = +".. method:: setNormalA(iNormal)\n" +"\n" +" Sets the normal to the face lying on the right of the FEdge.\n" +"\n" +" :arg iNormal: A three-dimensional vector.\n" +" :type iNormal: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n"; + +static PyObject * FEdgeSharp_setNormalA( BPy_FEdgeSharp *self, PyObject *args ) { PyObject *obj = 0; if(!( PyArg_ParseTuple(args, "O", &obj) )) @@ -156,7 +176,15 @@ PyObject * FEdgeSharp_setNormalA( BPy_FEdgeSharp *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FEdgeSharp_setNormalB( BPy_FEdgeSharp *self, PyObject *args ) { +static char FEdgeSharp_setNormalB___doc__[] = +".. method:: setNormalB(iNormal)\n" +"\n" +" Sets the normal to the face lying on the left of the FEdge.\n" +"\n" +" :arg iNormal: A three-dimensional vector.\n" +" :type iNormal: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n"; + +static PyObject * FEdgeSharp_setNormalB( BPy_FEdgeSharp *self, PyObject *args ) { PyObject *obj = 0; if(!( PyArg_ParseTuple(args, "O", &obj) )) @@ -172,7 +200,15 @@ PyObject * FEdgeSharp_setNormalB( BPy_FEdgeSharp *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FEdgeSharp_setaMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ) { +static char FEdgeSharp_setaMaterialIndex___doc__[] = +".. method:: setaMaterialIndex(i)\n" +"\n" +" Sets the index of the material lying on the right of the FEdge.\n" +"\n" +" :arg i: A material index.\n" +" :type i: int\n"; + +static PyObject * FEdgeSharp_setaMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ) { unsigned int i; if(!( PyArg_ParseTuple(args, "I", &i) )) @@ -183,7 +219,15 @@ PyObject * FEdgeSharp_setaMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ) Py_RETURN_NONE; } -PyObject * FEdgeSharp_setbMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ) { +static char FEdgeSharp_setbMaterialIndex___doc__[] = +".. method:: setbMaterialIndex(i)\n" +"\n" +" Sets the index of the material lying on the left of the FEdge.\n" +"\n" +" :arg i: A material index.\n" +" :type i: int\n"; + +static PyObject * FEdgeSharp_setbMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ) { unsigned int i; if(!( PyArg_ParseTuple(args, "I", &i) )) @@ -194,6 +238,64 @@ PyObject * FEdgeSharp_setbMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ) Py_RETURN_NONE; } +/*----------------------FEdgeSharp instance definitions ----------------------------*/ +static PyMethodDef BPy_FEdgeSharp_methods[] = { + {"normalA", ( PyCFunction ) FEdgeSharp_normalA, METH_NOARGS, FEdgeSharp_normalA___doc__}, + {"normalB", ( PyCFunction ) FEdgeSharp_normalB, METH_NOARGS, FEdgeSharp_normalB___doc__}, + {"aMaterialIndex", ( PyCFunction ) FEdgeSharp_aMaterialIndex, METH_NOARGS, FEdgeSharp_aMaterialIndex___doc__}, + {"bMaterialIndex", ( PyCFunction ) FEdgeSharp_bMaterialIndex, METH_NOARGS, FEdgeSharp_bMaterialIndex___doc__}, + {"aMaterial", ( PyCFunction ) FEdgeSharp_aMaterial, METH_NOARGS, FEdgeSharp_aMaterial___doc__}, + {"bMaterial", ( PyCFunction ) FEdgeSharp_bMaterial, METH_NOARGS, FEdgeSharp_bMaterial___doc__}, + {"setNormalA", ( PyCFunction ) FEdgeSharp_setNormalA, METH_VARARGS, FEdgeSharp_setNormalA___doc__}, + {"setNormalB", ( PyCFunction ) FEdgeSharp_setNormalB, METH_VARARGS, FEdgeSharp_setNormalB___doc__}, + {"setaMaterialIndex", ( PyCFunction ) FEdgeSharp_setaMaterialIndex, METH_VARARGS, FEdgeSharp_setaMaterialIndex___doc__}, + {"setbMaterialIndex", ( PyCFunction ) FEdgeSharp_setbMaterialIndex, METH_VARARGS, FEdgeSharp_setbMaterialIndex___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_FEdgeSharp type definition ------------------------------*/ + +PyTypeObject FEdgeSharp_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "FEdgeSharp", /* tp_name */ + sizeof(BPy_FEdgeSharp), /* 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 */ + FEdgeSharp___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_FEdgeSharp_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &FEdge_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdgeSharp___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index bdf17f1a7ad..71dbe6f2136 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -9,73 +9,34 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FEdgeSmooth instance -----------*/ -static int FEdgeSmooth___init__(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds); - -static PyObject * FEdgeSmooth_normal( BPy_FEdgeSmooth *self ) ; -static PyObject * FEdgeSmooth_materialIndex( BPy_FEdgeSmooth *self ) ; -static PyObject * FEdgeSmooth_material( BPy_FEdgeSmooth *self ); -static PyObject * FEdgeSmooth_setNormal( BPy_FEdgeSmooth *self, PyObject *args ); -static PyObject * FEdgeSmooth_setMaterialIndex( BPy_FEdgeSmooth *self, PyObject *args ); - - -/*----------------------FEdgeSmooth instance definitions ----------------------------*/ -static PyMethodDef BPy_FEdgeSmooth_methods[] = { - {"normal", ( PyCFunction ) FEdgeSmooth_normal, METH_NOARGS, "() Returns the normal to the Face it is running accross."}, - {"materialIndex", ( PyCFunction ) FEdgeSmooth_materialIndex, METH_NOARGS, "() Returns the index of the material of the face it is running accross. "}, - {"material", ( PyCFunction ) FEdgeSmooth_material, METH_NOARGS, "() Returns the material of the face it is running accross. "}, - {"setNormal", ( PyCFunction ) FEdgeSmooth_setNormal, METH_VARARGS, "([x,y,z]) Sets the normal to the Face it is running accross."}, - {"setMaterialIndex", ( PyCFunction ) FEdgeSmooth_setMaterialIndex, METH_VARARGS, "(unsigned int i) Sets the index of the material of the face it is running accross. "}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_FEdgeSmooth type definition ------------------------------*/ - -PyTypeObject FEdgeSmooth_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FEdgeSmooth", /* tp_name */ - sizeof(BPy_FEdgeSmooth), /* 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 */ - "FEdgeSmooth objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FEdgeSmooth_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &FEdge_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdgeSmooth___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- - -int FEdgeSmooth___init__(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds) +static char FEdgeSmooth___doc__[] = +"Class defining a smooth edge. This kind of edge typically runs across\n" +"a face of the input mesh. It can be a silhouette, a ridge or valley,\n" +"a suggestive contour.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: An FEdgeSmooth object.\n" +" :type iBrother: :class:`FEdgeSmooth`\n" +"\n" +".. method:: __init__(vA, vB)\n" +"\n" +" Builds an FEdgeSmooth going from vA to vB.\n" +"\n" +" :arg vA: The first SVertex object.\n" +" :type vA: :class:`SVertex`\n" +" :arg vB: The second SVertex object.\n" +" :type vB: :class:`SVertex`\n"; + +static int FEdgeSmooth___init__(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0; @@ -103,22 +64,53 @@ int FEdgeSmooth___init__(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds) return 0; } -PyObject * FEdgeSmooth_normal( BPy_FEdgeSmooth *self ) { +static char FEdgeSmooth_normal___doc__[] = +".. method:: normal()\n" +"\n" +" Returns the normal to the Face it is running accross.\n" +"\n" +" :return: The normal to the Face it is running accross.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static PyObject * FEdgeSmooth_normal( BPy_FEdgeSmooth *self ) { Vec3r v( self->fes->normal() ); return Vector_from_Vec3r( v ); } -PyObject * FEdgeSmooth_materialIndex( BPy_FEdgeSmooth *self ) { +static char FEdgeSmooth_materialIndex___doc__[] = +".. method:: materialIndex()\n" +"\n" +" Returns the index of the material of the face it is running accross.\n" +"\n" +" :return: The index of the material of the face it is running accross.\n" +" :rtype: int\n"; + +static PyObject * FEdgeSmooth_materialIndex( BPy_FEdgeSmooth *self ) { return PyLong_FromLong( self->fes->frs_materialIndex() ); } +static char FEdgeSmooth_material___doc__[] = +".. method:: material()\n" +"\n" +" Returns the material of the face it is running accross.\n" +"\n" +" :return: The material of the face it is running accross.\n" +" :rtype: :class:`Material`\n"; -PyObject * FEdgeSmooth_material( BPy_FEdgeSmooth *self ) { +static PyObject * FEdgeSmooth_material( BPy_FEdgeSmooth *self ) { FrsMaterial m( self->fes->frs_material() ); return BPy_FrsMaterial_from_FrsMaterial(m); } -PyObject * FEdgeSmooth_setNormal( BPy_FEdgeSmooth *self, PyObject *args ) { +static char FEdgeSmooth_setNormal___doc__[] = +".. method:: setNormal(iNormal)\n" +"\n" +" Sets the normal to the Face it is running accross.\n" +"\n" +" :arg iNormal: A three-dimensional vector.\n" +" :type iNormal: :class:`Mathutils.Vector`, list or tuple of 3 real numbers\n"; + +static PyObject * FEdgeSmooth_setNormal( BPy_FEdgeSmooth *self, PyObject *args ) { PyObject *obj = 0; if(!( PyArg_ParseTuple(args, "O", &obj) )) @@ -134,7 +126,15 @@ PyObject * FEdgeSmooth_setNormal( BPy_FEdgeSmooth *self, PyObject *args ) { Py_RETURN_NONE; } -PyObject * FEdgeSmooth_setMaterialIndex( BPy_FEdgeSmooth *self, PyObject *args ) { +static char FEdgeSmooth_setMaterialIndex___doc__[] = +".. method:: setMaterialIndex(i)\n" +"\n" +" Sets the index of the material of the face it is running accross.\n" +"\n" +" :arg i: The index of the material of the face it is running accross.\n" +" :type i: int\n"; + +static PyObject * FEdgeSmooth_setMaterialIndex( BPy_FEdgeSmooth *self, PyObject *args ) { unsigned int i; if(!( PyArg_ParseTuple(args, "I", &i) )) @@ -145,6 +145,59 @@ PyObject * FEdgeSmooth_setMaterialIndex( BPy_FEdgeSmooth *self, PyObject *args ) Py_RETURN_NONE; } +/*----------------------FEdgeSmooth instance definitions ----------------------------*/ +static PyMethodDef BPy_FEdgeSmooth_methods[] = { + {"normal", ( PyCFunction ) FEdgeSmooth_normal, METH_NOARGS, FEdgeSmooth_normal___doc__}, + {"materialIndex", ( PyCFunction ) FEdgeSmooth_materialIndex, METH_NOARGS, FEdgeSmooth_materialIndex___doc__}, + {"material", ( PyCFunction ) FEdgeSmooth_material, METH_NOARGS, FEdgeSmooth_material___doc__}, + {"setNormal", ( PyCFunction ) FEdgeSmooth_setNormal, METH_VARARGS, FEdgeSmooth_setNormal___doc__}, + {"setMaterialIndex", ( PyCFunction ) FEdgeSmooth_setMaterialIndex, METH_VARARGS, FEdgeSmooth_setMaterialIndex___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_FEdgeSmooth type definition ------------------------------*/ + +PyTypeObject FEdgeSmooth_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "FEdgeSmooth", /* tp_name */ + sizeof(BPy_FEdgeSmooth), /* 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 */ + FEdgeSmooth___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_FEdgeSmooth_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &FEdge_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdgeSmooth___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp index dcc56b406e1..a4fe0164f78 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp @@ -9,66 +9,35 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for AdjacencyIterator instance -----------*/ -static int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args); -static PyObject * AdjacencyIterator_iternext(BPy_AdjacencyIterator *self); - -static PyObject * AdjacencyIterator_isIncoming(BPy_AdjacencyIterator *self); -static PyObject * AdjacencyIterator_getObject(BPy_AdjacencyIterator *self); - -/*----------------------AdjacencyIterator instance definitions ----------------------------*/ -static PyMethodDef BPy_AdjacencyIterator_methods[] = { - {"isIncoming", ( PyCFunction ) AdjacencyIterator_isIncoming, METH_NOARGS, "() Returns true if the current ViewEdge is is coming towards the iteration vertex. False otherwise."}, - {"getObject", ( PyCFunction ) AdjacencyIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_AdjacencyIterator type definition ------------------------------*/ - -PyTypeObject AdjacencyIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "AdjacencyIterator", /* tp_name */ - sizeof(BPy_AdjacencyIterator), /* 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 */ - "AdjacencyIterator objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */ - BPy_AdjacencyIterator_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)AdjacencyIterator___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args ) +static char AdjacencyIterator___doc__[] = +"Class for representing adjacency iterators used in the chaining\n" +"process. An AdjacencyIterator is created in the increment() and\n" +"decrement() methods of a :class:`ChainingIterator` and passed to the\n" +"traverse() method of the ChainingIterator.\n" +"\n" +".. method:: __init__(iVertex, iRestrictToSelection=True, iRestrictToUnvisited=True)\n" +"\n" +" Builds a AdjacencyIterator object.\n" +"\n" +" :arg iVertex: The vertex which is the next crossing.\n" +" :type iVertex: :class:`ViewVertex`\n" +" :arg iRestrictToSelection: Indicates whether to force the chaining\n" +" to stay within the set of selected ViewEdges or not.\n" +" :type iRestrictToSelection: bool\n" +" :arg iRestrictToUnvisited: Indicates whether a ViewEdge that has\n" +" already been chained must be ignored ot not.\n" +" :type iRestrictToUnvisited: bool\n" +"\n" +".. method:: __init__(it)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg it: An AdjacencyIterator object.\n" +" :type it: :class:`AdjacencyIterator`\n"; + +static int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0; @@ -98,7 +67,7 @@ int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args ) } -PyObject * AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) { +static PyObject * AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) { if (self->a_it->isEnd()) { PyErr_SetNone(PyExc_StopIteration); return NULL; @@ -108,11 +77,29 @@ PyObject * AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) { return BPy_ViewEdge_from_ViewEdge( *ve ); } -PyObject * AdjacencyIterator_isIncoming(BPy_AdjacencyIterator *self) { +static char AdjacencyIterator_isIncoming___doc__[] = +".. method:: isIncoming()\n" +"\n" +" Returns true if the current ViewEdge is coming towards the\n" +" iteration vertex. False otherwise.\n" +"\n" +" :return: True if the current ViewEdge is coming towards the\n" +" iteration vertex\n" +" :rtype: bool\n"; + +static PyObject * AdjacencyIterator_isIncoming(BPy_AdjacencyIterator *self) { return PyBool_from_bool(self->a_it->isIncoming()); } -PyObject * AdjacencyIterator_getObject(BPy_AdjacencyIterator *self) { +static char AdjacencyIterator_getObject___doc__[] = +".. method:: getObject()\n" +"\n" +" Returns the pointed ViewEdge.\n" +"\n" +" :return: The pointed ViewEdge.\n" +" :rtype: ViewEdge* operator\n"; + +static PyObject * AdjacencyIterator_getObject(BPy_AdjacencyIterator *self) { ViewEdge *ve = self->a_it->operator*(); if( ve ) @@ -121,6 +108,55 @@ PyObject * AdjacencyIterator_getObject(BPy_AdjacencyIterator *self) { Py_RETURN_NONE; } +/*----------------------AdjacencyIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_AdjacencyIterator_methods[] = { + {"isIncoming", ( PyCFunction ) AdjacencyIterator_isIncoming, METH_NOARGS, AdjacencyIterator_isIncoming___doc__}, + {"getObject", ( PyCFunction ) AdjacencyIterator_getObject, METH_NOARGS, AdjacencyIterator_getObject___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_AdjacencyIterator type definition ------------------------------*/ + +PyTypeObject AdjacencyIterator_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "AdjacencyIterator", /* tp_name */ + sizeof(BPy_AdjacencyIterator), /* 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 */ + AdjacencyIterator___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */ + BPy_AdjacencyIterator_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)AdjacencyIterator___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp index f6750dc23d3..624d983da4d 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp @@ -11,56 +11,70 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ChainPredicateIterator instance -----------*/ -static int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *args); -static void ChainPredicateIterator___dealloc__(BPy_ChainPredicateIterator *self); - -/*-----------------------BPy_ChainPredicateIterator type definition ------------------------------*/ - -PyTypeObject ChainPredicateIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ChainPredicateIterator", /* tp_name */ - sizeof(BPy_ChainPredicateIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ChainPredicateIterator___dealloc__, /* 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 */ - "ChainPredicateIterator objects", /* 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 */ - &ChainingIterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainPredicateIterator___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *args ) +static char ChainPredicateIterator___doc__[] = +"A \"generic\" user-controlled ViewEdge iterator. This iterator is in\n" +"particular built from a unary predicate and a binary predicate.\n" +"First, the unary predicate is evaluated for all potential next\n" +"ViewEdges in order to only keep the ones respecting a certain\n" +"constraint. Then, the binary predicate is evaluated on the current\n" +"ViewEdge together with each ViewEdge of the previous selection. The\n" +"first ViewEdge respecting both the unary predicate and the binary\n" +"predicate is kept as the next one. If none of the potential next\n" +"ViewEdge respects these two predicates, None is returned.\n" +"\n" +".. method:: __init__(iRestrictToSelection=True, iRestrictToUnvisited=True, begin=None, orientation=True)\n" +"\n" +" Builds a ChainPredicateIterator from a starting ViewEdge and its\n" +" orientation.\n" +"\n" +" :arg iRestrictToSelection: Indicates whether to force the chaining\n" +" to stay within the set of selected ViewEdges or not.\n" +" :type iRestrictToSelection: bool\n" +" :arg iRestrictToUnvisited: Indicates whether a ViewEdge that has\n" +" already been chained must be ignored ot not.\n" +" :type iRestrictToUnvisited: bool\n" +" :arg begin: The ViewEdge from where to start the iteration.\n" +" :type begin: :class:`ViewEdge` or None\n" +" :arg orientation: If true, we'll look for the next ViewEdge among\n" +" the ViewEdges that surround the ending ViewVertex of begin. If\n" +" false, we'll search over the ViewEdges surrounding the ending\n" +" ViewVertex of begin. \n" +" :type orientation: bool\n" +"\n" +".. method:: __init__(upred, bpred, iRestrictToSelection=True, iRestrictToUnvisited=True, begin=None, orientation=True)\n" +"\n" +" Builds a ChainPredicateIterator from a unary predicate, a binary\n" +" predicate, a starting ViewEdge and its orientation.\n" +"\n" +" :arg upred: The unary predicate that the next ViewEdge must satisfy.\n" +" :type upred: :class:`UnaryPredicate1D`\n" +" :arg bpred: The binary predicate that the next ViewEdge must\n" +" satisfy together with the actual pointed ViewEdge.\n" +" :type bpred: :class:`BinaryPredicate1D`\n" +" :arg iRestrictToSelection: Indicates whether to force the chaining\n" +" to stay within the set of selected ViewEdges or not.\n" +" :type iRestrictToSelection: bool\n" +" :arg iRestrictToUnvisited: Indicates whether a ViewEdge that has\n" +" already been chained must be ignored ot not.\n" +" :type iRestrictToUnvisited: bool\n" +" :arg begin: The ViewEdge from where to start the iteration.\n" +" :type begin: :class:`ViewEdge`\n" +" :arg orientation: If true, we'll look for the next ViewEdge among\n" +" the ViewEdges that surround the ending ViewVertex of begin. If\n" +" false, we'll search over the ViewEdges surrounding the ending\n" +" ViewVertex of begin.\n" +" :type orientation: bool\n" +"\n" +".. method:: __init__(brother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg brother: A ChainPredicateIterator object.\n" +" :type brother: :class:`ChainPredicateIterator`\n"; + +static int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0, *obj5 = 0, *obj6 = 0; @@ -132,13 +146,56 @@ int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject * } -void ChainPredicateIterator___dealloc__(BPy_ChainPredicateIterator *self) +static void ChainPredicateIterator___dealloc__(BPy_ChainPredicateIterator *self) { Py_XDECREF( self->upred ); Py_XDECREF( self->bpred ); ChainingIterator_Type.tp_dealloc((PyObject *)self); } +/*-----------------------BPy_ChainPredicateIterator type definition ------------------------------*/ + +PyTypeObject ChainPredicateIterator_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ChainPredicateIterator", /* tp_name */ + sizeof(BPy_ChainPredicateIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ChainPredicateIterator___dealloc__, /* 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 */ + ChainPredicateIterator___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 */ + &ChainingIterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainPredicateIterator___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp index 3c7f3cd7836..00e62ad30d4 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp @@ -9,8 +9,75 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ChainSilhouetteIterator instance -----------*/ -static int ChainSilhouetteIterator___init__(BPy_ChainSilhouetteIterator *self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +// ChainSilhouetteIterator (bool iRestrictToSelection=true, ViewEdge *begin=NULL, bool orientation=true) +// ChainSilhouetteIterator (const ChainSilhouetteIterator &brother) + +static char ChainSilhouetteIterator___doc__[] = +"A ViewEdge Iterator used to follow ViewEdges the most naturally. For\n" +"example, it will follow visible ViewEdges of same nature. As soon, as\n" +"the nature or the visibility changes, the iteration stops (by setting\n" +"the pointed ViewEdge to 0). In the case of an iteration over a set of\n" +"ViewEdge that are both Silhouette and Crease, there will be a\n" +"precedence of the silhouette over the crease criterion.\n" +"\n" +".. method:: __init__(iRestrictToSelection=True, begin=None, orientation=True)\n" +"\n" +" Builds a ChainSilhouetteIterator from the first ViewEdge used for\n" +" iteration and its orientation.\n" +"\n" +" :arg iRestrictToSelection: Indicates whether to force the chaining\n" +" to stay within the set of selected ViewEdges or not.\n" +" :type iRestrictToSelection: bool\n" +" :arg begin: The ViewEdge from where to start the iteration.\n" +" :type begin: :class:`ViewEdge`\n" +" :arg orientation: If true, we'll look for the next ViewEdge among\n" +" the ViewEdges that surround the ending ViewVertex of begin. If\n" +" false, we'll search over the ViewEdges surrounding the ending\n" +" ViewVertex of begin.\n" +" :type orientation: bool\n" +"\n" +".. method:: __init__(brother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg brother: A ChainSilhouetteIterator object.\n" +" :type brother: :class:`ChainSilhouetteIterator`\n"; + +static int ChainSilhouetteIterator___init__(BPy_ChainSilhouetteIterator *self, PyObject *args ) +{ + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + + if (!( PyArg_ParseTuple(args, "|OOO", &obj1, &obj2, &obj3) )) + return -1; + + if( obj1 && BPy_ChainSilhouetteIterator_Check(obj1) ) { + self->cs_it = new ChainSilhouetteIterator(*( ((BPy_ChainSilhouetteIterator *) obj1)->cs_it )); + + } else { + bool restrictToSelection = ( obj1 ) ? bool_from_PyBool(obj1) : true; + ViewEdge *begin; + if ( !obj2 || obj2 == Py_None ) + begin = NULL; + else if ( BPy_ViewEdge_Check(obj2) ) + begin = ((BPy_ViewEdge *) obj2)->ve; + else { + PyErr_SetString(PyExc_TypeError, "2nd argument must be either a ViewEdge object or None"); + return -1; + } + bool orientation = ( obj3 ) ? bool_from_PyBool(obj3) : true; + + self->cs_it = new ChainSilhouetteIterator( restrictToSelection, begin, orientation); + } + + self->py_c_it.c_it = self->cs_it; + self->py_c_it.py_ve_it.ve_it = self->cs_it; + self->py_c_it.py_ve_it.py_it.it = self->cs_it; + + return 0; + +} /*-----------------------BPy_ChainSilhouetteIterator type definition ------------------------------*/ @@ -35,7 +102,7 @@ PyTypeObject ChainSilhouetteIterator_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ChainSilhouetteIterator objects", /* tp_doc */ + ChainSilhouetteIterator___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,46 +122,6 @@ PyTypeObject ChainSilhouetteIterator_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -// ChainSilhouetteIterator (bool iRestrictToSelection=true, ViewEdge *begin=NULL, bool orientation=true) -// ChainSilhouetteIterator (const ChainSilhouetteIterator &brother) - -int ChainSilhouetteIterator___init__(BPy_ChainSilhouetteIterator *self, PyObject *args ) -{ - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; - - if (!( PyArg_ParseTuple(args, "|OOO", &obj1, &obj2, &obj3) )) - return -1; - - if( obj1 && BPy_ChainSilhouetteIterator_Check(obj1) ) { - self->cs_it = new ChainSilhouetteIterator(*( ((BPy_ChainSilhouetteIterator *) obj1)->cs_it )); - - } else { - bool restrictToSelection = ( obj1 ) ? bool_from_PyBool(obj1) : true; - ViewEdge *begin; - if ( !obj2 || obj2 == Py_None ) - begin = NULL; - else if ( BPy_ViewEdge_Check(obj2) ) - begin = ((BPy_ViewEdge *) obj2)->ve; - else { - PyErr_SetString(PyExc_TypeError, "2nd argument must be either a ViewEdge object or None"); - return -1; - } - bool orientation = ( obj3 ) ? bool_from_PyBool(obj3) : true; - - self->cs_it = new ChainSilhouetteIterator( restrictToSelection, begin, orientation); - } - - self->py_c_it.c_it = self->cs_it; - self->py_c_it.py_ve_it.ve_it = self->cs_it; - self->py_c_it.py_ve_it.py_it.it = self->cs_it; - - return 0; - -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index 52c5b080c52..9d3b1e5c0be 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp @@ -11,71 +11,43 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ChainingIterator instance -----------*/ -static int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args); -static PyObject * ChainingIterator_init( BPy_ChainingIterator *self ); -static PyObject * ChainingIterator_traverse( BPy_ChainingIterator *self, PyObject *args ); -static PyObject * ChainingIterator_getVertex( BPy_ChainingIterator *self ); -static PyObject * ChainingIterator_isIncrementing( BPy_ChainingIterator *self ); - -static PyObject * ChainingIterator_getObject( BPy_ChainingIterator *self); - -/*----------------------ChainingIterator instance definitions ----------------------------*/ -static PyMethodDef BPy_ChainingIterator_methods[] = { - {"init", ( PyCFunction ) ChainingIterator_init, METH_NOARGS, "() Inits the iterator context. This method is called each time a new chain is started. It can be used to reset some history information that you might want to keep."}, - {"traverse", ( PyCFunction ) ChainingIterator_traverse, METH_VARARGS, "(AdjacencyIterator ai) This method iterates over the potential next ViewEdges and returns the one that will be followed next. Returns the next ViewEdge to follow or 0 when the end of the chain is reached. "}, - {"getVertex", ( PyCFunction ) ChainingIterator_getVertex, METH_NOARGS, "() Returns the vertex which is the next crossing "}, - {"isIncrementing", ( PyCFunction ) ChainingIterator_isIncrementing, METH_NOARGS, "() Returns true if the current iteration is an incrementation."}, - {"getObject", ( PyCFunction ) ChainingIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_ChainingIterator type definition ------------------------------*/ - -PyTypeObject ChainingIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ChainingIterator", /* tp_name */ - sizeof(BPy_ChainingIterator), /* 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 */ - "ChainingIterator objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ChainingIterator_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &ViewEdgeIterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainingIterator___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args ) +static char ChainingIterator___doc__[] = +"Base class for chaining iterators. This class is designed to be\n" +"overloaded in order to describe chaining rules. It makes the\n" +"description of chaining rules easier. The two main methods that need\n" +"to overloaded are traverse() and init(). traverse() tells which\n" +":class:`ViewEdge` to follow, among the adjacent ones. If you specify\n" +"restriction rules (such as \"Chain only ViewEdges of the selection\"),\n" +"they will be included in the adjacency iterator (i.e, the adjacent\n" +"iterator will only stop on \"valid\" edges).\n" +"\n" +".. method:: __init__(iRestrictToSelection=True, iRestrictToUnvisited=True, begin=None, orientation=True)\n" +"\n" +" Builds a Chaining Iterator from the first ViewEdge used for\n" +" iteration and its orientation.\n" +"\n" +" :arg iRestrictToSelection: Indicates whether to force the chaining\n" +" to stay within the set of selected ViewEdges or not.\n" +" :type iRestrictToSelection: bool\n" +" :arg iRestrictToUnvisited: Indicates whether a ViewEdge that has\n" +" already been chained must be ignored ot not.\n" +" :type iRestrictToUnvisited: bool\n" +" :arg begin: The ViewEdge from which to start the chain.\n" +" :type begin: :class:`ViewEdge` or None\n" +" :arg orientation: The direction to follow to explore the graph. If\n" +" true, the direction indicated by the first ViewEdge is used.\n" +" :type orientation: bool\n" +"\n" +".. method:: __init__(brother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg brother: \n" +" :type brother: ChainingIterator\n"; + +static int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; @@ -110,7 +82,14 @@ int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args ) return 0; } -PyObject *ChainingIterator_init( BPy_ChainingIterator *self ) { +static char ChainingIterator_init___doc__[] = +".. method:: init()\n" +"\n" +" Initializes the iterator context. This method is called each\n" +" time a new chain is started. It can be used to reset some\n" +" history information that you might want to keep.\n"; + +static PyObject *ChainingIterator_init( BPy_ChainingIterator *self ) { if( typeid(*(self->c_it)) == typeid(ChainingIterator) ) { PyErr_SetString(PyExc_TypeError, "init() method not properly overridden"); return NULL; @@ -120,7 +99,21 @@ PyObject *ChainingIterator_init( BPy_ChainingIterator *self ) { Py_RETURN_NONE; } -PyObject *ChainingIterator_traverse( BPy_ChainingIterator *self, PyObject *args ) { +static char ChainingIterator_traverse___doc__[] = +".. method:: traverse(it)\n" +"\n" +" This method iterates over the potential next ViewEdges and returns\n" +" the one that will be followed next. Returns the next ViewEdge to\n" +" follow or None when the end of the chain is reached.\n" +"\n" +" :arg it: The iterator over the ViewEdges adjacent to the end vertex\n" +" of the current ViewEdge. The adjacency iterator reflects the\n" +" restriction rules by only iterating over the valid ViewEdges.\n" +" :type it: :class:`AdjacencyIterator`\n" +" :return: Returns the next ViewEdge to follow, or None if chaining ends.\n" +" :rtype: :class:`ViewEdge` or None\n"; + +static PyObject *ChainingIterator_traverse( BPy_ChainingIterator *self, PyObject *args ) { PyObject *py_a_it; if(!( PyArg_ParseTuple(args, "O!", &AdjacencyIterator_Type, &py_a_it) )) @@ -136,8 +129,15 @@ PyObject *ChainingIterator_traverse( BPy_ChainingIterator *self, PyObject *args Py_RETURN_NONE; } +static char ChainingIterator_getVertex___doc__[] = +".. method:: getVertex()\n" +"\n" +" Returns the vertex which is the next crossing.\n" +"\n" +" :return: The vertex which is the next crossing.\n" +" :rtype: :class:`ViewVertex`\n"; -PyObject *ChainingIterator_getVertex( BPy_ChainingIterator *self ) { +static PyObject *ChainingIterator_getVertex( BPy_ChainingIterator *self ) { ViewVertex *v = self->c_it->getVertex(); if( v ) return Any_BPy_ViewVertex_from_ViewVertex( *v ); @@ -145,11 +145,27 @@ PyObject *ChainingIterator_getVertex( BPy_ChainingIterator *self ) { Py_RETURN_NONE; } -PyObject *ChainingIterator_isIncrementing( BPy_ChainingIterator *self ) { +static char ChainingIterator_isIncrementing___doc__[] = +".. method:: isIncrementing()\n" +"\n" +" Returns true if the current iteration is an incrementation.\n" +"\n" +" :return: True if the current iteration is an incrementation.\n" +" :rtype: bool\n"; + +static PyObject *ChainingIterator_isIncrementing( BPy_ChainingIterator *self ) { return PyBool_from_bool( self->c_it->isIncrementing() ); } -PyObject * ChainingIterator_getObject( BPy_ChainingIterator *self) { +static char ChainingIterator_getObject___doc__[] = +".. method:: getObject()\n" +"\n" +" Returns the pointed ViewEdge.\n" +"\n" +" :return: The pointed ViewEdge.\n" +" :rtype: :class:`ViewEdge`\n"; + +static PyObject * ChainingIterator_getObject( BPy_ChainingIterator *self) { ViewEdge *ve = self->c_it->operator*(); if( ve ) @@ -158,7 +174,58 @@ PyObject * ChainingIterator_getObject( BPy_ChainingIterator *self) { Py_RETURN_NONE; } +/*----------------------ChainingIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_ChainingIterator_methods[] = { + {"init", ( PyCFunction ) ChainingIterator_init, METH_NOARGS, ChainingIterator_init___doc__}, + {"traverse", ( PyCFunction ) ChainingIterator_traverse, METH_VARARGS, ChainingIterator_traverse___doc__}, + {"getVertex", ( PyCFunction ) ChainingIterator_getVertex, METH_NOARGS, ChainingIterator_getVertex___doc__}, + {"isIncrementing", ( PyCFunction ) ChainingIterator_isIncrementing, METH_NOARGS, ChainingIterator_isIncrementing___doc__}, + {"getObject", ( PyCFunction ) ChainingIterator_getObject, METH_NOARGS, ChainingIterator_getObject___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ChainingIterator type definition ------------------------------*/ +PyTypeObject ChainingIterator_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ChainingIterator", /* tp_name */ + sizeof(BPy_ChainingIterator), /* 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 */ + ChainingIterator___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ChainingIterator_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &ViewEdgeIterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainingIterator___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp index 0086a99a442..9af842b7612 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp @@ -9,20 +9,113 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for CurvePointIterator instance -----------*/ -static int CurvePointIterator___init__(BPy_CurvePointIterator *self, PyObject *args); -static PyObject * CurvePointIterator_t( BPy_CurvePointIterator *self ); -static PyObject * CurvePointIterator_u( BPy_CurvePointIterator *self ); -static PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator *self ); +//------------------------INSTANCE METHODS ---------------------------------- + +static char CurvePointIterator___doc__[] = +"Class representing an iterator on a curve. Allows an iterating\n" +"outside initial vertices. A CurvePoint is instanciated and returned\n" +"by getObject().\n" +"\n" +".. method:: __init__(step=0.0)\n" +"\n" +" Builds a CurvePointIterator object.\n" +"\n" +" :arg step: A resampling resolution with which the curve is resampled.\n" +" If zero, no resampling is done (i.e., the iterator iterates over\n" +" initial vertices).\n" +" :type step: float\n" +"\n" +".. method:: __init__(brother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg brother: A CurvePointIterator object.\n" +" :type brother: :class:`CurvePointIterator`\n"; + +static int CurvePointIterator___init__(BPy_CurvePointIterator *self, PyObject *args ) +{ + PyObject *obj = 0; + + if (! PyArg_ParseTuple(args, "|O", &obj) ) + return -1; + + if( !obj ){ + self->cp_it = new CurveInternal::CurvePointIterator(); + + } else if( BPy_CurvePointIterator_Check(obj) ) { + self->cp_it = new CurveInternal::CurvePointIterator(*( ((BPy_CurvePointIterator *) obj)->cp_it )); + + } else if( PyFloat_Check(obj) ) { + self->cp_it = new CurveInternal::CurvePointIterator( PyFloat_AsDouble(obj) ); + + } else { + PyErr_SetString(PyExc_TypeError, "invalid argument"); + return -1; + } -static PyObject * CurvePointIterator_getObject(BPy_CurvePointIterator *self); + self->py_it.it = self->cp_it; + + return 0; +} + +static char CurvePointIterator_t___doc__[] = +".. method:: t()\n" +"\n" +" Returns the curvilinear abscissa.\n" +"\n" +" :return: The curvilinear abscissa.\n" +" :rtype: float\n"; + +PyObject * CurvePointIterator_t( BPy_CurvePointIterator *self ) { + return PyFloat_FromDouble( self->cp_it->t() ); +} + +static char CurvePointIterator_u___doc__[] = +".. method:: u()\n" +"\n" +" Returns the point parameter in the curve (0<=u<=1).\n" +"\n" +" :return: The point parameter.\n" +" :rtype: float\n"; + +static PyObject * CurvePointIterator_u( BPy_CurvePointIterator *self ) { + return PyFloat_FromDouble( self->cp_it->u() ); +} + +static char CurvePointIterator_castToInterface0DIterator___doc__[] = +".. method:: castToInterface0DIterator()\n" +"\n" +" Returns an Interface0DIterator converted from this\n" +" CurvePointIterator. Useful for any call to a function of the\n" +" UnaryFunction0D type.\n" +"\n" +" :return: An Interface0DIterator object converted from the\n" +" iterator.\n" +" :rtype: :class:`Interface0DIterator`\n"; + +static PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator *self ) { + Interface0DIterator it( self->cp_it->castToInterface0DIterator() ); + return BPy_Interface0DIterator_from_Interface0DIterator( it, 0 ); +} + +static char CurvePointIterator_getObject___doc__[] = +".. method:: getObject()\n" +"\n" +" Returns a CurvePoint pointed by the iterator.\n" +"\n" +" :return: \n" +" :rtype: :class:`CurvePoint`\n"; + +static PyObject * CurvePointIterator_getObject(BPy_CurvePointIterator *self) { + return BPy_CurvePoint_from_CurvePoint( self->cp_it->operator*() ); +} /*----------------------CurvePointIterator instance definitions ----------------------------*/ static PyMethodDef BPy_CurvePointIterator_methods[] = { - {"t", ( PyCFunction ) CurvePointIterator_t, METH_NOARGS, "() Returns the curvilinear abscissa."}, - {"u", ( PyCFunction ) CurvePointIterator_u, METH_NOARGS, "() Returns the point parameter in the curve 0<=u<=1."}, - {"castToInterface0DIterator", ( PyCFunction ) CurvePointIterator_castToInterface0DIterator, METH_NOARGS, "() Casts this CurvePointIterator into an Interface0DIterator. Useful for any call to a function of the type UnaryFunction0D."}, - {"getObject", ( PyCFunction ) CurvePointIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"}, + {"t", ( PyCFunction ) CurvePointIterator_t, METH_NOARGS, CurvePointIterator_t___doc__}, + {"u", ( PyCFunction ) CurvePointIterator_u, METH_NOARGS, CurvePointIterator_u___doc__}, + {"castToInterface0DIterator", ( PyCFunction ) CurvePointIterator_castToInterface0DIterator, METH_NOARGS, CurvePointIterator_castToInterface0DIterator___doc__}, + {"getObject", ( PyCFunction ) CurvePointIterator_getObject, METH_NOARGS, CurvePointIterator_getObject___doc__}, {NULL, NULL, 0, NULL} }; @@ -49,7 +142,7 @@ PyTypeObject CurvePointIterator_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "CurvePointIterator objects", /* tp_doc */ + CurvePointIterator___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -69,52 +162,6 @@ PyTypeObject CurvePointIterator_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int CurvePointIterator___init__(BPy_CurvePointIterator *self, PyObject *args ) -{ - PyObject *obj = 0; - - if (! PyArg_ParseTuple(args, "|O", &obj) ) - return -1; - - if( !obj ){ - self->cp_it = new CurveInternal::CurvePointIterator(); - - } else if( BPy_CurvePointIterator_Check(obj) ) { - self->cp_it = new CurveInternal::CurvePointIterator(*( ((BPy_CurvePointIterator *) obj)->cp_it )); - - } else if( PyFloat_Check(obj) ) { - self->cp_it = new CurveInternal::CurvePointIterator( PyFloat_AsDouble(obj) ); - - } else { - PyErr_SetString(PyExc_TypeError, "invalid argument"); - return -1; - } - - self->py_it.it = self->cp_it; - - return 0; -} - -PyObject * CurvePointIterator_t( BPy_CurvePointIterator *self ) { - return PyFloat_FromDouble( self->cp_it->t() ); -} - -PyObject * CurvePointIterator_u( BPy_CurvePointIterator *self ) { - return PyFloat_FromDouble( self->cp_it->u() ); -} - -PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator *self ) { - Interface0DIterator it( self->cp_it->castToInterface0DIterator() ); - return BPy_Interface0DIterator_from_Interface0DIterator( it, 0 ); -} - -PyObject * CurvePointIterator_getObject(BPy_CurvePointIterator *self) { - return BPy_CurvePoint_from_CurvePoint( self->cp_it->operator*() ); -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index 3fbea715e8d..7276f7cd46b 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -8,20 +8,94 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Interface0DIterator instance -----------*/ -static int Interface0DIterator___init__(BPy_Interface0DIterator *self, PyObject *args); -static PyObject * Interface0DIterator_iternext( BPy_Interface0DIterator *self ); +//------------------------INSTANCE METHODS ---------------------------------- + +static char Interface0DIterator___doc__[] = +"Class defining an iterator over Interface0D elements. An instance of\n" +"this iterator is always obtained from a 1D element.\n" +"\n" +".. method:: __init__(it)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n"; + +static int Interface0DIterator___init__(BPy_Interface0DIterator *self, PyObject *args ) +{ + PyObject *obj = 0; + + if (!( PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj) )) + return -1; + + self->if0D_it = new Interface0DIterator(*( ((BPy_Interface0DIterator *) obj)->if0D_it )); + self->py_it.it = self->if0D_it; + self->reversed = 0; + + return 0; +} + +static PyObject * Interface0DIterator_iternext( BPy_Interface0DIterator *self ) { + Interface0D *if0D; + if (self->reversed) { + if (self->if0D_it->isBegin()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + self->if0D_it->decrement(); + if0D = self->if0D_it->operator->(); + } else { + if (self->if0D_it->isEnd()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + if0D = self->if0D_it->operator->(); + self->if0D_it->increment(); + } + return Any_BPy_Interface0D_from_Interface0D( *if0D ); +} -static PyObject * Interface0DIterator_t( BPy_Interface0DIterator *self ); -static PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self ); +static char Interface0DIterator_t___doc__[] = +".. method:: t()\n" +"\n" +" Returns the curvilinear abscissa.\n" +"\n" +" :return: The curvilinear abscissa.\n" +" :rtype: float\n"; -static PyObject * Interface0DIterator_getObject(BPy_Interface0DIterator *self); +static PyObject * Interface0DIterator_t( BPy_Interface0DIterator *self ) { + return PyFloat_FromDouble( self->if0D_it->t() ); +} + +static char Interface0DIterator_u___doc__[] = +".. method:: u()\n" +"\n" +" Returns the point parameter in the curve 0<=u<=1.\n" +"\n" +" :return: The point parameter.\n" +" :rtype: float\n"; + +static PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self ) { + return PyFloat_FromDouble( self->if0D_it->u() ); +} + +static char Interface0DIterator_getObject___doc__[] = +".. method:: getObject()\n" +"\n" +" Returns the pointed Interface0D.\n" +"\n" +" :return: The pointed Interface0D.\n" +" :rtype: :class:`Interface0D`\n"; + +static PyObject * Interface0DIterator_getObject(BPy_Interface0DIterator *self) { + return Any_BPy_Interface0D_from_Interface0D( self->if0D_it->operator*() ); +} /*----------------------Interface0DIterator instance definitions ----------------------------*/ static PyMethodDef BPy_Interface0DIterator_methods[] = { - {"t", ( PyCFunction ) Interface0DIterator_t, METH_NOARGS, "() Returns the curvilinear abscissa."}, - {"u", ( PyCFunction ) Interface0DIterator_u, METH_NOARGS, "() Returns the point parameter in the curve 0<=u<=1."}, - {"getObject", ( PyCFunction ) Interface0DIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"}, + {"t", ( PyCFunction ) Interface0DIterator_t, METH_NOARGS, Interface0DIterator_t___doc__}, + {"u", ( PyCFunction ) Interface0DIterator_u, METH_NOARGS, Interface0DIterator_u___doc__}, + {"getObject", ( PyCFunction ) Interface0DIterator_getObject, METH_NOARGS, Interface0DIterator_getObject___doc__}, {NULL, NULL, 0, NULL} }; @@ -48,7 +122,7 @@ PyTypeObject Interface0DIterator_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Interface0DIterator objects", /* tp_doc */ + Interface0DIterator___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -68,55 +142,6 @@ PyTypeObject Interface0DIterator_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int Interface0DIterator___init__(BPy_Interface0DIterator *self, PyObject *args ) -{ - PyObject *obj = 0; - - if (!( PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj) )) - return -1; - - self->if0D_it = new Interface0DIterator(*( ((BPy_Interface0DIterator *) obj)->if0D_it )); - self->py_it.it = self->if0D_it; - self->reversed = 0; - - return 0; -} - -PyObject * Interface0DIterator_iternext( BPy_Interface0DIterator *self ) { - Interface0D *if0D; - if (self->reversed) { - if (self->if0D_it->isBegin()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - self->if0D_it->decrement(); - if0D = self->if0D_it->operator->(); - } else { - if (self->if0D_it->isEnd()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - if0D = self->if0D_it->operator->(); - self->if0D_it->increment(); - } - return Any_BPy_Interface0D_from_Interface0D( *if0D ); -} - -PyObject * Interface0DIterator_t( BPy_Interface0DIterator *self ) { - return PyFloat_FromDouble( self->if0D_it->t() ); -} - -PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self ) { - return PyFloat_FromDouble( self->if0D_it->u() ); -} - -PyObject * Interface0DIterator_getObject(BPy_Interface0DIterator *self) { - return Any_BPy_Interface0D_from_Interface0D( self->if0D_it->operator*() ); -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp index 5e5d45c61fd..06329ce2e30 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp @@ -10,68 +10,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SVertexIterator instance -----------*/ -static int SVertexIterator___init__(BPy_SVertexIterator *self, PyObject *args); - -static PyObject * SVertexIterator_t( BPy_SVertexIterator *self ); -static PyObject * SVertexIterator_u( BPy_SVertexIterator *self ); - -static PyObject * SVertexIterator_getObject( BPy_SVertexIterator *self); - -/*----------------------SVertexIterator instance definitions ----------------------------*/ -static PyMethodDef BPy_SVertexIterator_methods[] = { - {"t", ( PyCFunction ) SVertexIterator_t, METH_NOARGS, "() Returns the curvilinear abscissa."}, - {"u", ( PyCFunction ) SVertexIterator_u, METH_NOARGS, "() Returns the point parameter in the curve 0<=u<=1."}, - {"getObject", ( PyCFunction ) SVertexIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_SVertexIterator type definition ------------------------------*/ - -PyTypeObject SVertexIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SVertexIterator", /* tp_name */ - sizeof(BPy_SVertexIterator), /* 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 */ - "SVertexIterator objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_SVertexIterator_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SVertexIterator___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int SVertexIterator___init__(BPy_SVertexIterator *self, PyObject *args ) +static char SVertexIterator___doc__[] = +"Class representing an iterator over :class:`SVertex` of a\n" +":class:`ViewEdge`. An instance of an SVertexIterator can be obtained\n" +"from a ViewEdge by calling verticesBegin() or verticesEnd().\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(it)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg it: An SVertexIterator object.\n" +" :type it: :class:`SVertexIterator`\n" +"\n" +".. method:: __init__(v, begin, prev, next, t)\n" +"\n" +" Builds an SVertexIterator that starts iteration from an SVertex\n" +" object v.\n" +"\n" +" :arg v: The SVertex from which the iterator starts iteration.\n" +" :type v: :class:`SVertex`\n" +" :arg begin: The first vertex of a view edge.\n" +" :type begin: :class:`SVertex`\n" +" :arg prev: The previous FEdge coming to v.\n" +" :type prev: :class:`FEdge`\n" +" :arg next: The next FEdge going out from v.\n" +" :type next: :class:`FEdge`\n" +" :arg t: The curvilinear abscissa at v.\n" +" :type t: float\n"; + +static int SVertexIterator___init__(BPy_SVertexIterator *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; float f = 0; @@ -107,15 +80,39 @@ int SVertexIterator___init__(BPy_SVertexIterator *self, PyObject *args ) return 0; } -PyObject * SVertexIterator_t( BPy_SVertexIterator *self ) { +static char SVertexIterator_t___doc__[] = +".. method:: t()\n" +"\n" +" Returns the curvilinear abscissa.\n" +"\n" +" :return: The curvilinear abscissa.\n" +" :rtype: float\n"; + +static PyObject * SVertexIterator_t( BPy_SVertexIterator *self ) { return PyFloat_FromDouble( self->sv_it->t() ); } -PyObject * SVertexIterator_u( BPy_SVertexIterator *self ) { +static char SVertexIterator_u___doc__[] = +".. method:: u()\n" +"\n" +" Returns the point parameter (0<=u<=1).\n" +"\n" +" :return: The point parameter.\n" +" :rtype: float\n"; + +static PyObject * SVertexIterator_u( BPy_SVertexIterator *self ) { return PyFloat_FromDouble( self->sv_it->u() ); } -PyObject * SVertexIterator_getObject( BPy_SVertexIterator *self) { +static char SVertexIterator_getObject___doc__[] = +".. method:: getObject()\n" +"\n" +" Returns the pointed SVertex.\n" +"\n" +" :return: the pointed SVertex.\n" +" :rtype: :class:`SVertex`\n"; + +static PyObject * SVertexIterator_getObject( BPy_SVertexIterator *self) { SVertex *sv = self->sv_it->operator->(); if( sv ) @@ -124,6 +121,56 @@ PyObject * SVertexIterator_getObject( BPy_SVertexIterator *self) { Py_RETURN_NONE; } +/*----------------------SVertexIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_SVertexIterator_methods[] = { + {"t", ( PyCFunction ) SVertexIterator_t, METH_NOARGS, SVertexIterator_t___doc__}, + {"u", ( PyCFunction ) SVertexIterator_u, METH_NOARGS, SVertexIterator_u___doc__}, + {"getObject", ( PyCFunction ) SVertexIterator_getObject, METH_NOARGS, SVertexIterator_getObject___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_SVertexIterator type definition ------------------------------*/ + +PyTypeObject SVertexIterator_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "SVertexIterator", /* tp_name */ + sizeof(BPy_SVertexIterator), /* 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 */ + SVertexIterator___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_SVertexIterator_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SVertexIterator___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp index fbfe9a66861..607109ce3ad 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp @@ -9,71 +9,34 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for StrokeVertexIterator instance -----------*/ -static int StrokeVertexIterator___init__(BPy_StrokeVertexIterator *self, PyObject *args); -static PyObject * StrokeVertexIterator_iternext( BPy_StrokeVertexIterator *self ); -static PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self ); -static PyObject * StrokeVertexIterator_u( BPy_StrokeVertexIterator *self ); -static PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexIterator *self ); - -static PyObject * StrokeVertexIterator_getObject( BPy_StrokeVertexIterator *self); - - -/*----------------------StrokeVertexIterator instance definitions ----------------------------*/ -static PyMethodDef BPy_StrokeVertexIterator_methods[] = { - {"t", ( PyCFunction ) StrokeVertexIterator_t, METH_NOARGS, "() Returns the curvilinear abscissa."}, - {"u", ( PyCFunction ) StrokeVertexIterator_u, METH_NOARGS, "() Returns the point parameter in the curve 0<=u<=1."}, - {"castToInterface0DIterator", ( PyCFunction ) StrokeVertexIterator_castToInterface0DIterator, METH_NOARGS, "() Casts this StrokeVertexIterator into an Interface0DIterator. Useful for any call to a function of the type UnaryFunction0D."}, - {"getObject", ( PyCFunction ) StrokeVertexIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_StrokeVertexIterator type definition ------------------------------*/ - -PyTypeObject StrokeVertexIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeVertexIterator", /* tp_name */ - sizeof(BPy_StrokeVertexIterator), /* 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 */ - "StrokeVertexIterator objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)StrokeVertexIterator_iternext, /* tp_iternext */ - BPy_StrokeVertexIterator_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeVertexIterator___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int StrokeVertexIterator___init__(BPy_StrokeVertexIterator *self, PyObject *args ) +static char StrokeVertexIterator___doc__[] = + +"Class defining an iterator designed to iterate over the\n" +":class:`StrokeVertex` of a :class:`Stroke`. An instance of a\n" +"StrokeVertexIterator can only be obtained from a Stroke by calling\n" +"strokeVerticesBegin() or strokeVerticesEnd(). It is iterating over\n" +"the same vertices as an :class:`Interface0DIterator`. The difference\n" +"resides in the object access. Indeed, an Interface0DIterator allows\n" +"only an access to an Interface0D whereas we could need to access the\n" +"specialized StrokeVertex type. In this case, one should use a\n" +"StrokeVertexIterator. The castToInterface0DIterator() method is\n" +"useful to get an Interface0DIterator from a StrokeVertexIterator in\n" +"order to call any functions of the UnaryFunction0D type.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(it)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg it: A StrokeVertexIterator object.\n" +" :type it: :class:`StrokeVertexIterator`\n"; + +static int StrokeVertexIterator___init__(BPy_StrokeVertexIterator *self, PyObject *args ) { PyObject *obj = 0; @@ -97,7 +60,7 @@ int StrokeVertexIterator___init__(BPy_StrokeVertexIterator *self, PyObject *args return 0; } -PyObject * StrokeVertexIterator_iternext( BPy_StrokeVertexIterator *self ) { +static PyObject * StrokeVertexIterator_iternext( BPy_StrokeVertexIterator *self ) { StrokeVertex *sv; if (self->reversed) { if (self->sv_it->isBegin()) { @@ -117,20 +80,54 @@ PyObject * StrokeVertexIterator_iternext( BPy_StrokeVertexIterator *self ) { return BPy_StrokeVertex_from_StrokeVertex( *sv ); } -PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self ) { +static char StrokeVertexIterator_t___doc__[] = +".. method:: t()\n" +"\n" +" Returns the curvilinear abscissa of the current point.\n" +"\n" +" :return: The curvilinear abscissa of the current point.\n" +" :rtype: float\n"; + +static PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self ) { return PyFloat_FromDouble( self->sv_it->t() ); } -PyObject * StrokeVertexIterator_u( BPy_StrokeVertexIterator *self ) { +static char StrokeVertexIterator_u___doc__[] = +".. method:: u()\n" +"\n" +" Returns the point parameter in the stroke (0<=u<=1).\n" +"\n" +" :return: The point parameter in the stroke\n" +" :rtype: float\n"; + +static PyObject * StrokeVertexIterator_u( BPy_StrokeVertexIterator *self ) { return PyFloat_FromDouble( self->sv_it->u() ); } -PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexIterator *self ) { +static char StrokeVertexIterator_castToInterface0DIterator___doc__[] = +".. method:: castToInterface0DIterator()\n" +"\n" +" Returns an Interface0DIterator converted from this\n" +" StrokeVertexIterator. Useful for any call to a function of the\n" +" UnaryFunction0D type.\n" +"\n" +" :return: An Interface0DIterator converted from the StrokeVertexIterator.\n" +" :rtype: :class:`Interface0DIterator`\n"; + +static PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexIterator *self ) { Interface0DIterator it( self->sv_it->castToInterface0DIterator() ); return BPy_Interface0DIterator_from_Interface0DIterator( it, 0 ); } -PyObject * StrokeVertexIterator_getObject( BPy_StrokeVertexIterator *self) { +static char StrokeVertexIterator_getObject___doc__[] = +".. method:: getObject()\n" +"\n" +" Returns the pointed StrokeVertex.\n" +"\n" +" :return: The pointed StrokeVertex.\n" +" :rtype: :class:`StrokeVertex`\n"; + +static PyObject * StrokeVertexIterator_getObject( BPy_StrokeVertexIterator *self) { StrokeVertex *sv = self->sv_it->operator->(); if( sv ) return BPy_StrokeVertex_from_StrokeVertex( *sv ); @@ -138,6 +135,57 @@ PyObject * StrokeVertexIterator_getObject( BPy_StrokeVertexIterator *self) { Py_RETURN_NONE; } +/*----------------------StrokeVertexIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_StrokeVertexIterator_methods[] = { + {"t", ( PyCFunction ) StrokeVertexIterator_t, METH_NOARGS, StrokeVertexIterator_t___doc__}, + {"u", ( PyCFunction ) StrokeVertexIterator_u, METH_NOARGS, StrokeVertexIterator_u___doc__}, + {"castToInterface0DIterator", ( PyCFunction ) StrokeVertexIterator_castToInterface0DIterator, METH_NOARGS, StrokeVertexIterator_castToInterface0DIterator___doc__}, + {"getObject", ( PyCFunction ) StrokeVertexIterator_getObject, METH_NOARGS, StrokeVertexIterator_getObject___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_StrokeVertexIterator type definition ------------------------------*/ + +PyTypeObject StrokeVertexIterator_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "StrokeVertexIterator", /* tp_name */ + sizeof(BPy_StrokeVertexIterator), /* 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 */ + StrokeVertexIterator___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)StrokeVertexIterator_iternext, /* tp_iternext */ + BPy_StrokeVertexIterator_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeVertexIterator___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp index 29c7b6e9413..856cebb308c 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -10,79 +10,35 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ViewEdgeIterator instance -----------*/ -static int ViewEdgeIterator___init__(BPy_ViewEdgeIterator *self, PyObject *args); - -static PyObject * ViewEdgeIterator_getCurrentEdge( BPy_ViewEdgeIterator *self ); -static PyObject * ViewEdgeIterator_setCurrentEdge( BPy_ViewEdgeIterator *self, PyObject *args ); -static PyObject * ViewEdgeIterator_getBegin( BPy_ViewEdgeIterator *self ); -static PyObject * ViewEdgeIterator_setBegin( BPy_ViewEdgeIterator *self, PyObject *args ); -static PyObject * ViewEdgeIterator_getOrientation( BPy_ViewEdgeIterator *self ); -static PyObject * ViewEdgeIterator_setOrientation( BPy_ViewEdgeIterator *self, PyObject *args ); -static PyObject * ViewEdgeIterator_changeOrientation( BPy_ViewEdgeIterator *self ); - -static PyObject * ViewEdgeIterator_getObject(BPy_ViewEdgeIterator *self); - - -/*----------------------ViewEdgeIterator instance definitions ----------------------------*/ -static PyMethodDef BPy_ViewEdgeIterator_methods[] = { - {"getCurrentEdge", ( PyCFunction ) ViewEdgeIterator_getCurrentEdge, METH_NOARGS, "() Returns the current pointed ViewEdge."}, - {"setCurrentEdge", ( PyCFunction ) ViewEdgeIterator_setCurrentEdge, METH_VARARGS, "(ViewEdge ve) Sets the current pointed ViewEdge. "}, - {"getBegin", ( PyCFunction ) ViewEdgeIterator_getBegin, METH_NOARGS, "() Returns the first ViewEdge used for the iteration."}, - {"setBegin", ( PyCFunction ) ViewEdgeIterator_setBegin, METH_VARARGS, "(ViewEdge ve) Sets the first ViewEdge used for the iteration."}, - {"getOrientation", ( PyCFunction ) ViewEdgeIterator_getOrientation, METH_NOARGS, "() Gets the orientation of the pointed ViewEdge in the iteration. "}, - {"setOrientation", ( PyCFunction ) ViewEdgeIterator_setOrientation, METH_VARARGS, "(bool b) Sets the orientation of the pointed ViewEdge in the iteration. "}, - {"changeOrientation", ( PyCFunction ) ViewEdgeIterator_changeOrientation, METH_NOARGS, "() Changes the current orientation."}, - {"getObject", ( PyCFunction ) ViewEdgeIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_ViewEdgeIterator type definition ------------------------------*/ - -PyTypeObject ViewEdgeIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewEdgeIterator", /* tp_name */ - sizeof(BPy_ViewEdgeIterator), /* 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 */ - "ViewEdgeIterator objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewEdgeIterator_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewEdgeIterator___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //------------------------INSTANCE METHODS ---------------------------------- -int ViewEdgeIterator___init__(BPy_ViewEdgeIterator *self, PyObject *args ) +static char ViewEdgeIterator___doc__[] = +"Base class for iterators over ViewEdges of the :class:`ViewMap` Graph.\n" +"Basically the increment() operator of this class should be able to\n" +"take the decision of \"where\" (on which ViewEdge) to go when pointing\n" +"on a given ViewEdge.\n" +"\n" +".. method:: __init__(begin=None, orientation=True)\n" +"\n" +" Builds a ViewEdgeIterator from a starting ViewEdge and its\n" +" orientation.\n" +"\n" +" :arg begin: The ViewEdge from where to start the iteration.\n" +" :type begin: :class:`ViewEdge`\n" +" :arg orientation: If true, we'll look for the next ViewEdge among\n" +" the ViewEdges that surround the ending ViewVertex of begin. If\n" +" false, we'll search over the ViewEdges surrounding the ending\n" +" ViewVertex of begin.\n" +" :type orientation: bool\n" +"\n" +".. method:: __init__(it)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg it: A ViewEdgeIterator object.\n" +" :type it: :class:`ViewEdgeIterator`\n"; + +static int ViewEdgeIterator___init__(BPy_ViewEdgeIterator *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0; @@ -113,8 +69,15 @@ int ViewEdgeIterator___init__(BPy_ViewEdgeIterator *self, PyObject *args ) return 0; } +static char ViewEdgeIterator_getCurrentEdge___doc__[] = +".. method:: getCurrentEdge()\n" +"\n" +" Returns the current pointed ViewEdge.\n" +"\n" +" :return: The current pointed ViewEdge.\n" +" :rtype: :class:`ViewEdge`\n"; -PyObject *ViewEdgeIterator_getCurrentEdge( BPy_ViewEdgeIterator *self ) { +static PyObject *ViewEdgeIterator_getCurrentEdge( BPy_ViewEdgeIterator *self ) { ViewEdge *ve = self->ve_it->getCurrentEdge(); if( ve ) return BPy_ViewEdge_from_ViewEdge( *ve ); @@ -122,7 +85,15 @@ PyObject *ViewEdgeIterator_getCurrentEdge( BPy_ViewEdgeIterator *self ) { Py_RETURN_NONE; } -PyObject *ViewEdgeIterator_setCurrentEdge( BPy_ViewEdgeIterator *self, PyObject *args ) { +static char ViewEdgeIterator_setCurrentEdge___doc__[] = +".. method:: setCurrentEdge(edge)\n" +"\n" +" Sets the current pointed ViewEdge.\n" +"\n" +" :arg edge: The current pointed ViewEdge.\n" +" :type edge: :class:`ViewEdge`\n"; + +static PyObject *ViewEdgeIterator_setCurrentEdge( BPy_ViewEdgeIterator *self, PyObject *args ) { PyObject *py_ve; if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) )) @@ -133,8 +104,15 @@ PyObject *ViewEdgeIterator_setCurrentEdge( BPy_ViewEdgeIterator *self, PyObject Py_RETURN_NONE; } +static char ViewEdgeIterator_getBegin___doc__[] = +".. method:: getBegin()\n" +"\n" +" Returns the first ViewEdge used for the iteration.\n" +"\n" +" :return: The first ViewEdge used for the iteration.\n" +" :rtype: :class:`ViewEdge`\n"; -PyObject *ViewEdgeIterator_getBegin( BPy_ViewEdgeIterator *self ) { +static PyObject *ViewEdgeIterator_getBegin( BPy_ViewEdgeIterator *self ) { ViewEdge *ve = self->ve_it->getBegin(); if( ve ) return BPy_ViewEdge_from_ViewEdge( *ve ); @@ -142,7 +120,15 @@ PyObject *ViewEdgeIterator_getBegin( BPy_ViewEdgeIterator *self ) { Py_RETURN_NONE; } -PyObject *ViewEdgeIterator_setBegin( BPy_ViewEdgeIterator *self, PyObject *args ) { +static char ViewEdgeIterator_setBegin___doc__[] = +".. method:: setBegin(begin)\n" +"\n" +" Sets the first ViewEdge used for the iteration.\n" +"\n" +" :arg begin: The first ViewEdge used for the iteration.\n" +" :type begin: :class:`ViewEdge`\n"; + +static PyObject *ViewEdgeIterator_setBegin( BPy_ViewEdgeIterator *self, PyObject *args ) { PyObject *py_ve; if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) )) @@ -153,11 +139,30 @@ PyObject *ViewEdgeIterator_setBegin( BPy_ViewEdgeIterator *self, PyObject *args Py_RETURN_NONE; } -PyObject *ViewEdgeIterator_getOrientation( BPy_ViewEdgeIterator *self ) { +static char ViewEdgeIterator_getOrientation___doc__[] = +".. method:: getOrientation()\n" +"\n" +" Returns the orientation of the pointed ViewEdge in the iteration.\n" +"\n" +" :return: The orientation of the pointed ViewEdge in the iteration.\n" +" :rtype: bool\n"; + +static PyObject *ViewEdgeIterator_getOrientation( BPy_ViewEdgeIterator *self ) { return PyBool_from_bool( self->ve_it->getOrientation() ); } -PyObject *ViewEdgeIterator_setOrientation( BPy_ViewEdgeIterator *self, PyObject *args ) { +static char ViewEdgeIterator_setOrientation___doc__[] = +".. method:: setOrientation(orientation)\n" +"\n" +" Sets the orientation of the pointed ViewEdge in the iteration.\n" +"\n" +" :arg orientation: If true, we'll look for the next ViewEdge among\n" +" the ViewEdges that surround the ending ViewVertex of begin. If\n" +" false, we'll search over the ViewEdges surrounding the ending\n" +" ViewVertex of begin.\n" +" :type orientation: bool\n"; + +static PyObject *ViewEdgeIterator_setOrientation( BPy_ViewEdgeIterator *self, PyObject *args ) { PyObject *py_b; if(!( PyArg_ParseTuple(args, "O", &py_b) )) @@ -168,13 +173,26 @@ PyObject *ViewEdgeIterator_setOrientation( BPy_ViewEdgeIterator *self, PyObject Py_RETURN_NONE; } -PyObject *ViewEdgeIterator_changeOrientation( BPy_ViewEdgeIterator *self ) { +static char ViewEdgeIterator_changeOrientation___doc__[] = +".. method:: changeOrientation()\n" +"\n" +" Changes the current orientation.\n"; + +static PyObject *ViewEdgeIterator_changeOrientation( BPy_ViewEdgeIterator *self ) { self->ve_it->changeOrientation(); Py_RETURN_NONE; } -PyObject * ViewEdgeIterator_getObject( BPy_ViewEdgeIterator *self) { +static char ViewEdgeIterator_getObject___doc__[] = +".. method:: getObject()\n" +"\n" +" Returns the pointed ViewEdge.\n" +"\n" +" :return: The pointed ViewEdge.\n" +" :rtype: :class:`ViewEdge`\n"; + +static PyObject * ViewEdgeIterator_getObject( BPy_ViewEdgeIterator *self) { ViewEdge *ve = self->ve_it->operator*(); if( ve ) @@ -183,6 +201,61 @@ PyObject * ViewEdgeIterator_getObject( BPy_ViewEdgeIterator *self) { Py_RETURN_NONE; } +/*----------------------ViewEdgeIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewEdgeIterator_methods[] = { + {"getCurrentEdge", ( PyCFunction ) ViewEdgeIterator_getCurrentEdge, METH_NOARGS, ViewEdgeIterator_getCurrentEdge___doc__}, + {"setCurrentEdge", ( PyCFunction ) ViewEdgeIterator_setCurrentEdge, METH_VARARGS, ViewEdgeIterator_setCurrentEdge___doc__}, + {"getBegin", ( PyCFunction ) ViewEdgeIterator_getBegin, METH_NOARGS, ViewEdgeIterator_getBegin___doc__}, + {"setBegin", ( PyCFunction ) ViewEdgeIterator_setBegin, METH_VARARGS, ViewEdgeIterator_setBegin___doc__}, + {"getOrientation", ( PyCFunction ) ViewEdgeIterator_getOrientation, METH_NOARGS, ViewEdgeIterator_getOrientation___doc__}, + {"setOrientation", ( PyCFunction ) ViewEdgeIterator_setOrientation, METH_VARARGS, ViewEdgeIterator_setOrientation___doc__}, + {"changeOrientation", ( PyCFunction ) ViewEdgeIterator_changeOrientation, METH_NOARGS, ViewEdgeIterator_changeOrientation___doc__}, + {"getObject", ( PyCFunction ) ViewEdgeIterator_getObject, METH_NOARGS, ViewEdgeIterator_getObject___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewEdgeIterator type definition ------------------------------*/ + +PyTypeObject ViewEdgeIterator_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ViewEdgeIterator", /* tp_name */ + sizeof(BPy_ViewEdgeIterator), /* 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 */ + ViewEdgeIterator___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewEdgeIterator_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewEdgeIterator___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp index 27f71d4cfc0..c080426daa8 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -8,16 +8,83 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for orientedViewEdgeIterator instance -----------*/ -static int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args); -static PyObject * orientedViewEdgeIterator_iternext(BPy_orientedViewEdgeIterator *self); +//------------------------INSTANCE METHODS ---------------------------------- + +static char orientedViewEdgeIterator___doc__[] = +"Class representing an iterator over oriented ViewEdges around a\n" +":class:`ViewVertex`. This iterator allows a CCW iteration (in the image\n" +"plane). An instance of an orientedViewEdgeIterator can only be\n" +"obtained from a ViewVertex by calling edgesBegin() or edgesEnd().\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n" +"\n" +".. method:: __init__(iBrother)\n" +"\n" +" Copy constructor.\n" +"\n" +" :arg iBrother: An orientedViewEdgeIterator object.\n" +" :type iBrother: :class:`orientedViewEdgeIterator`\n"; + +static int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args ) +{ + PyObject *obj = 0; + + if (!( PyArg_ParseTuple(args, "|O", &obj) )) + return -1; + + if( !obj ) + self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(); + else if( BPy_orientedViewEdgeIterator_Check(obj) ) + self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(*( ((BPy_orientedViewEdgeIterator *) obj)->ove_it )); + else { + PyErr_SetString(PyExc_TypeError, "invalid argument"); + return -1; + } + + self->py_it.it = self->ove_it; + self->reversed = 0; + + return 0; +} -static PyObject * orientedViewEdgeIterator_getObject(BPy_orientedViewEdgeIterator *self); +static PyObject * orientedViewEdgeIterator_iternext( BPy_orientedViewEdgeIterator *self ) { + ViewVertex::directedViewEdge *dve; + if (self->reversed) { + if (self->ove_it->isBegin()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + self->ove_it->decrement(); + dve = self->ove_it->operator->(); + } else { + if (self->ove_it->isEnd()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + dve = self->ove_it->operator->(); + self->ove_it->increment(); + } + return BPy_directedViewEdge_from_directedViewEdge( *dve ); +} +static char orientedViewEdgeIterator_getObject___doc__[] = +".. method:: getObject()\n" +"\n" +" Returns the pointed oriented ViewEdge.\n" +"\n" +" :return: A tuple of the pointed ViewEdge and a boolean value. If\n" +" the boolean value is true, the ViewEdge is incoming.\n" +" :rtype: (:class:`directedViewEdge`, bool)\n"; + +static PyObject * orientedViewEdgeIterator_getObject( BPy_orientedViewEdgeIterator *self) { + return BPy_directedViewEdge_from_directedViewEdge( self->ove_it->operator*() ); +} /*----------------------orientedViewEdgeIterator instance definitions ----------------------------*/ static PyMethodDef BPy_orientedViewEdgeIterator_methods[] = { - {"getObject", ( PyCFunction ) orientedViewEdgeIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"}, + {"getObject", ( PyCFunction ) orientedViewEdgeIterator_getObject, METH_NOARGS, orientedViewEdgeIterator_getObject___doc__}, {NULL, NULL, 0, NULL} }; @@ -44,7 +111,7 @@ PyTypeObject orientedViewEdgeIterator_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "orientedViewEdgeIterator objects", /* tp_doc */ + orientedViewEdgeIterator___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -64,54 +131,6 @@ PyTypeObject orientedViewEdgeIterator_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args ) -{ - PyObject *obj = 0; - - if (!( PyArg_ParseTuple(args, "|O", &obj) )) - return -1; - - if( !obj ) - self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(); - else if( BPy_orientedViewEdgeIterator_Check(obj) ) - self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(*( ((BPy_orientedViewEdgeIterator *) obj)->ove_it )); - else { - PyErr_SetString(PyExc_TypeError, "invalid argument"); - return -1; - } - - self->py_it.it = self->ove_it; - self->reversed = 0; - - return 0; -} - -PyObject * orientedViewEdgeIterator_iternext( BPy_orientedViewEdgeIterator *self ) { - ViewVertex::directedViewEdge *dve; - if (self->reversed) { - if (self->ove_it->isBegin()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - self->ove_it->decrement(); - dve = self->ove_it->operator->(); - } else { - if (self->ove_it->isEnd()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - dve = self->ove_it->operator->(); - self->ove_it->increment(); - } - return BPy_directedViewEdge_from_directedViewEdge( *dve ); -} - -PyObject * orientedViewEdgeIterator_getObject( BPy_orientedViewEdgeIterator *self) { - return BPy_directedViewEdge_from_directedViewEdge( self->ove_it->operator*() ); -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp index ca498576038..7ead138defb 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp @@ -8,8 +8,36 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for BackboneStretcherShader instance -----------*/ -static int BackboneStretcherShader___init__( BPy_BackboneStretcherShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char BackboneStretcherShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iAmount=2.0)\n" +"\n" +" Builds a BackboneStretcherShader object.\n" +"\n" +" :arg iAmount: The stretching amount value.\n" +" :type iAmount: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Stretches the stroke at its two extremities and following the\n" +" respective directions: v(1)v(0) and v(n-1)v(n).\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int BackboneStretcherShader___init__( BPy_BackboneStretcherShader* self, PyObject *args) +{ + float f = 2.0; + + if(!( PyArg_ParseTuple(args, "|f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f); + return 0; +} /*-----------------------BPy_BackboneStretcherShader type definition ------------------------------*/ @@ -34,7 +62,7 @@ PyTypeObject BackboneStretcherShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "BackboneStretcherShader objects", /* tp_doc */ + BackboneStretcherShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +82,6 @@ PyTypeObject BackboneStretcherShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int BackboneStretcherShader___init__( BPy_BackboneStretcherShader* self, PyObject *args) -{ - float f = 2.0; - - if(!( PyArg_ParseTuple(args, "|f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp index 2d1bd2abc8f..1ead40f4f6d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp @@ -8,8 +8,38 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for BezierCurveShader instance -----------*/ -static int BezierCurveShader___init__( BPy_BezierCurveShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char BezierCurveShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(error=4.0)\n" +"\n" +" Builds a BezierCurveShader object.\n" +"\n" +" :arg error: The error we're allowing for the approximation. This\n" +" error is the max distance allowed between the new curve and the\n" +" original geometry.\n" +" :type error: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Transforms the stroke backbone geometry so that it corresponds to a\n" +" Bezier Curve approximation of the original backbone geometry.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int BezierCurveShader___init__( BPy_BezierCurveShader* self, PyObject *args) +{ + float f = 4.0; + + if(!( PyArg_ParseTuple(args, "|f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::BezierCurveShader(f); + return 0; +} /*-----------------------BPy_BezierCurveShader type definition ------------------------------*/ @@ -34,7 +64,7 @@ PyTypeObject BezierCurveShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "BezierCurveShader objects", /* tp_doc */ + BezierCurveShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +84,6 @@ PyTypeObject BezierCurveShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int BezierCurveShader___init__( BPy_BezierCurveShader* self, PyObject *args) -{ - float f = 4.0; - - if(!( PyArg_ParseTuple(args, "|f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::BezierCurveShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index 75083a35af0..40afe17268e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -9,8 +9,57 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for CalligraphicShader instance -----------*/ -static int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char CalligraphicShader___doc__[] = +"[Thickness Shader]\n" +"\n" +".. method:: __init__(iMinThickness, iMaxThickness, iOrientation, iClamp)\n" +"\n" +" Builds a CalligraphicShader object.\n" +"\n" +" :arg iMinThickness: The minimum thickness in the direction\n" +" perpandicular to the main direction.\n" +" :type iMinThickness: float\n" +" :arg iMaxThickness: The maximum thickness in the main direction.\n" +" :type iMaxThickness: float\n" +" :arg iOrientation: The 2D vector giving the main direction.\n" +" :type iOrientation: :class:`Mathutils.Vector`\n" +" :arg iClamp: If true, the strokes are drawn in black when the stroke\n" +" direction is between -90 and 90 degrees with respect to the main\n" +" direction and drawn in white otherwise. If false, the strokes\n" +" are always drawn in black.\n" +" :type iClamp: bool\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns thicknesses to the stroke vertices so that the stroke looks\n" +" like made with a calligraphic tool, i.e. the stroke will be the\n" +" thickest in a main direction, and the thinest in the direction\n" +" perpendicular to this one, and an interpolation inbetween.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args) +{ + double d1, d2; + PyObject *obj3 = 0, *obj4 = 0; + + + if(!( PyArg_ParseTuple(args, "ddOO", &d1, &d2, &obj3, &obj4) )) + return -1; + Vec2f *v = Vec2f_ptr_from_PyObject(obj3); + if( !v ) { + PyErr_SetString(PyExc_TypeError, "argument 3 must be a 2D vector (either a list of 2 elements or Vector)"); + return -1; + } + self->py_ss.ss = new CalligraphicShader(d1, d2, *v, bool_from_PyBool(obj4) ); + delete v; + + return 0; + +} /*-----------------------BPy_CalligraphicShader type definition ------------------------------*/ @@ -35,7 +84,7 @@ PyTypeObject CalligraphicShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "CalligraphicShader objects", /* tp_doc */ + CalligraphicShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,28 +104,6 @@ PyTypeObject CalligraphicShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args) -{ - double d1, d2; - PyObject *obj3 = 0, *obj4 = 0; - - - if(!( PyArg_ParseTuple(args, "ddOO", &d1, &d2, &obj3, &obj4) )) - return -1; - Vec2f *v = Vec2f_ptr_from_PyObject(obj3); - if( !v ) { - PyErr_SetString(PyExc_TypeError, "argument 3 must be a 2D vector (either a list of 2 elements or Vector)"); - return -1; - } - self->py_ss.ss = new CalligraphicShader(d1, d2, *v, bool_from_PyBool(obj4) ); - delete v; - - return 0; - -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp index 1ec07a575c6..5293e449cf2 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp @@ -8,8 +8,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ColorNoiseShader instance -----------*/ -static int ColorNoiseShader___init__( BPy_ColorNoiseShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ColorNoiseShader___doc__[] = +"[Color shader]\n" +"\n" +".. method:: __init__(iAmplitude, iPeriod)\n" +"\n" +" Builds a ColorNoiseShader object.\n" +"\n" +" :arg iAmplitude: The amplitude of the noise signal.\n" +" :type iAmplitude: float\n" +" :arg iPeriod: The period of the noise signal.\n" +" :type iPeriod: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Shader to add noise to the stroke colors.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ColorNoiseShader___init__( BPy_ColorNoiseShader* self, PyObject *args) +{ + float f1, f2; + + if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2); + return 0; +} /*-----------------------BPy_ColorNoiseShader type definition ------------------------------*/ @@ -34,7 +63,7 @@ PyTypeObject ColorNoiseShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ColorNoiseShader objects", /* tp_doc */ + ColorNoiseShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +83,6 @@ PyTypeObject ColorNoiseShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ColorNoiseShader___init__( BPy_ColorNoiseShader* self, PyObject *args) -{ - float f1, f2; - - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp index 9d66baf5695..4e64e7d6c51 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp @@ -9,8 +9,42 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ColorVariationPatternShader instance -----------*/ -static int ColorVariationPatternShader___init__( BPy_ColorVariationPatternShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ColorVariationPatternShader___doc__[] = +"[Color shader]\n" +"\n" +".. method:: __init__(pattern_name, stretch=True)\n" +"\n" +" Builds a ColorVariationPatternShader object.\n" +"\n" +" :arg pattern_name: The file name of the texture file to use as\n" +" pattern.\n" +" :type pattern_name: string\n" +" :arg stretch: Tells whether the texture must be strecthed or\n" +" repeted to fit the stroke.\n" +" :type stretch: bool\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Applies a pattern to vary the original color. The new color is the\n" +" result of the multiplication of the pattern and the original color.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ColorVariationPatternShader___init__( BPy_ColorVariationPatternShader* self, PyObject *args) +{ + const char *s; + PyObject *obj = 0; + + if(!( PyArg_ParseTuple(args, "s|O", &s, &obj) )) + return -1; + + bool b = (obj) ? bool_from_PyBool(obj) : true; + self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s,b); + return 0; +} /*-----------------------BPy_ColorVariationPatternShader type definition ------------------------------*/ @@ -35,7 +69,7 @@ PyTypeObject ColorVariationPatternShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ColorVariationPatternShader objects", /* tp_doc */ + ColorVariationPatternShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,21 +89,6 @@ PyTypeObject ColorVariationPatternShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ColorVariationPatternShader___init__( BPy_ColorVariationPatternShader* self, PyObject *args) -{ - const char *s; - PyObject *obj = 0; - - if(!( PyArg_ParseTuple(args, "s|O", &s, &obj) )) - return -1; - - bool b = (obj) ? bool_from_PyBool(obj) : true; - self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s,b); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp index c6310486b6c..2b21acabc42 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp @@ -8,8 +8,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ConstantColorShader instance -----------*/ -static int ConstantColorShader___init__( BPy_ConstantColorShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ConstantColorShader___doc__[] = +"[Color shader]\n" +"\n" +".. method:: __init__(iR, iG, iB, iAlpha=1.0)\n" +"\n" +" Builds a ConstantColorShader object.\n" +"\n" +" :arg iR: The red component.\n" +" :type iR: float\n" +" :arg iG: The green component.\n" +" :type iG: float\n" +" :arg iB: The blue component.\n" +" :type iB: float\n" +" :arg iAlpha: The alpha value.\n" +" :type iAlpha: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns a constant color to every vertex of the Stroke.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ConstantColorShader___init__( BPy_ConstantColorShader* self, PyObject *args) +{ + float f1, f2, f3, f4 = 1.0; + + if(!( PyArg_ParseTuple(args, "fff|f", &f1, &f2, &f3, &f4) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4); + return 0; +} /*-----------------------BPy_ConstantColorShader type definition ------------------------------*/ @@ -34,7 +67,7 @@ PyTypeObject ConstantColorShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ConstantColorShader objects", /* tp_doc */ + ConstantColorShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +87,6 @@ PyTypeObject ConstantColorShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ConstantColorShader___init__( BPy_ConstantColorShader* self, PyObject *args) -{ - float f1, f2, f3, f4 = 1.0; - - if(!( PyArg_ParseTuple(args, "fff|f", &f1, &f2, &f3, &f4) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp index 2e94976c681..2db3685122f 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -8,8 +8,35 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ConstantThicknessShader instance -----------*/ -static int ConstantThicknessShader___init__( BPy_ConstantThicknessShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ConstantThicknessShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(thickness)\n" +"\n" +" Builds a ConstantThicknessShader object.\n" +"\n" +" :arg thickness: The thickness that must be assigned to the stroke.\n" +" :type thickness: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns an absolute constant thickness to every vertex of the Stroke.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ConstantThicknessShader___init__( BPy_ConstantThicknessShader* self, PyObject *args) +{ + float f; + + if(!( PyArg_ParseTuple(args, "f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f); + return 0; +} /*-----------------------BPy_ConstantThicknessShader type definition ------------------------------*/ @@ -34,7 +61,7 @@ PyTypeObject ConstantThicknessShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ConstantThicknessShader objects", /* tp_doc */ + ConstantThicknessShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +81,6 @@ PyTypeObject ConstantThicknessShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ConstantThicknessShader___init__( BPy_ConstantThicknessShader* self, PyObject *args) -{ - float f; - - if(!( PyArg_ParseTuple(args, "f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp index e0749914039..6dacca246b3 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp @@ -8,8 +8,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ConstrainedIncreasingThicknessShader instance -----------*/ -static int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ConstrainedIncreasingThicknessShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(iThicknessMin, iThicknessMax, iRatio)\n" +"\n" +" Builds a ConstrainedIncreasingThicknessShader object.\n" +"\n" +" :arg iThicknessMin: The minimum thickness.\n" +" :type iThicknessMin: float\n" +" :arg iThicknessMax: The maximum thickness.\n" +" :type iThicknessMax: float\n" +" :arg iRatio: The thickness/length ratio that we don't want to exceed. \n" +" :type iRatio: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Same as the :class:`IncreasingThicknessShader`, but here we allow\n" +" the user to control the thickness/length ratio so that we don't get\n" +" fat short lines.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args) +{ + float f1, f2, f3; + + if(!( PyArg_ParseTuple(args, "fff", &f1, &f2, &f3) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3); + return 0; +} /*-----------------------BPy_ConstrainedIncreasingThicknessShader type definition ------------------------------*/ @@ -34,7 +67,7 @@ PyTypeObject ConstrainedIncreasingThicknessShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ConstrainedIncreasingThicknessShader objects", /* tp_doc */ + ConstrainedIncreasingThicknessShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +87,6 @@ PyTypeObject ConstrainedIncreasingThicknessShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args) -{ - float f1, f2, f3; - - if(!( PyArg_ParseTuple(args, "fff", &f1, &f2, &f3) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp index 52da44be26d..4be1358147a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp @@ -8,8 +8,43 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GuidingLinesShader instance -----------*/ -static int GuidingLinesShader___init__( BPy_GuidingLinesShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GuidingLinesShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iOffset)\n" +"\n" +" Builds a GuidingLinesShader object.\n" +"\n" +" :arg iOffset: The line that replaces the stroke is initially in the\n" +" middle of the initial stroke bounding box. iOffset is the value\n" +" of the displacement which is applied to this line along its\n" +" normal.\n" +" :type iOffset: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Shader to modify the Stroke geometry so that it corresponds to its\n" +" main direction line. This shader must be used together with the\n" +" splitting operator using the curvature criterion. Indeed, the\n" +" precision of the approximation will depend on the size of the\n" +" stroke's pieces. The bigger the pieces are, the rougher the\n" +" approximation is.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int GuidingLinesShader___init__( BPy_GuidingLinesShader* self, PyObject *args) +{ + float f; + + if(!( PyArg_ParseTuple(args, "f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f); + return 0; +} /*-----------------------BPy_GuidingLinesShader type definition ------------------------------*/ @@ -34,7 +69,7 @@ PyTypeObject GuidingLinesShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GuidingLinesShader objects", /* tp_doc */ + GuidingLinesShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +89,6 @@ PyTypeObject GuidingLinesShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GuidingLinesShader___init__( BPy_GuidingLinesShader* self, PyObject *args) -{ - float f; - - if(!( PyArg_ParseTuple(args, "f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp index 0efc0d8902b..892585bf842 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp @@ -8,8 +8,51 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for IncreasingColorShader instance -----------*/ -static int IncreasingColorShader___init__( BPy_IncreasingColorShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char IncreasingColorShader___doc__[] = +"[Color shader]\n" +"\n" +".. method:: __init__(iRm, iGm, iBm, iAlpham, iRM, iGM, iBM, iAlphaM)\n" +"\n" +" Builds an IncreasingColorShader object.\n" +"\n" +" :arg iRm: The first color red component.\n" +" :type iRm: float\n" +" :arg iGm: The first color green component.\n" +" :type iGm: float\n" +" :arg iBm: The first color blue component.\n" +" :type iBm: float\n" +" :arg iAlpham: The first color alpha value.\n" +" :type iAlpham: float\n" +" :arg iRM: The second color red component.\n" +" :type iRM: float\n" +" :arg iGM: The second color green component.\n" +" :type iGM: float\n" +" :arg iBM: The second color blue component.\n" +" :type iBM: float\n" +" :arg iAlphaM: The second color alpha value.\n" +" :type iAlphaM: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns a varying color to the stroke. The user specifies two\n" +" colors A and B. The stroke color will change linearly from A to B\n" +" between the first and the last vertex.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int IncreasingColorShader___init__( BPy_IncreasingColorShader* self, PyObject *args) +{ + float f1, f2, f3, f4, f5, f6, f7, f8; + + if(!( PyArg_ParseTuple(args, "ffffffff", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8) )) + return -1; + + self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8); + return 0; +} /*-----------------------BPy_IncreasingColorShader type definition ------------------------------*/ @@ -34,7 +77,7 @@ PyTypeObject IncreasingColorShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "IncreasingColorShader objects", /* tp_doc */ + IncreasingColorShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +97,6 @@ PyTypeObject IncreasingColorShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int IncreasingColorShader___init__( BPy_IncreasingColorShader* self, PyObject *args) -{ - float f1, f2, f3, f4, f5, f6, f7, f8; - - if(!( PyArg_ParseTuple(args, "ffffffff", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8) )) - return -1; - - self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp index b851a0b224d..b5d067a4e44 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp @@ -8,8 +8,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for IncreasingThicknessShader instance -----------*/ -static int IncreasingThicknessShader___init__( BPy_IncreasingThicknessShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char IncreasingThicknessShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(iThicknessA, iThicknessB)\n" +"\n" +" Builds an IncreasingThicknessShader object.\n" +"\n" +" :arg iThicknessA: The first thickness value.\n" +" :type iThicknessA: float\n" +" :arg iThicknessB: The second thickness value.\n" +" :type iThicknessB: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns thicknesses values such as the thickness increases from a\n" +" thickness value A to a thickness value B between the first vertex\n" +" to the midpoint vertex and then decreases from B to a A between\n" +" this midpoint vertex and the last vertex. The thickness is\n" +" linearly interpolated from A to B.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int IncreasingThicknessShader___init__( BPy_IncreasingThicknessShader* self, PyObject *args) +{ + float f1, f2; + + if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) + return -1; + + self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2); + return 0; +} /*-----------------------BPy_IncreasingThicknessShader type definition ------------------------------*/ @@ -34,7 +67,7 @@ PyTypeObject IncreasingThicknessShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "IncreasingThicknessShader objects", /* tp_doc */ + IncreasingThicknessShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +87,6 @@ PyTypeObject IncreasingThicknessShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int IncreasingThicknessShader___init__( BPy_IncreasingThicknessShader* self, PyObject *args) -{ - float f1, f2; - - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) - return -1; - - self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp index e03334e6418..7c0c758a318 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp @@ -8,8 +8,42 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for PolygonalizationShader instance -----------*/ -static int PolygonalizationShader___init__( BPy_PolygonalizationShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char PolygonalizationShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iError)\n" +"\n" +" Builds a PolygonalizationShader object.\n" +"\n" +" :arg iError: The error we want our polygonal approximation to have\n" +" with respect to the original geometry. The smaller, the closer\n" +" the new stroke is to the orinal one. This error corresponds to\n" +" the maximum distance between the new stroke and the old one.\n" +" :type iError: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Modifies the Stroke geometry so that it looks more \"polygonal\".\n" +" The basic idea is to start from the minimal stroke approximation\n" +" consisting in a line joining the first vertex to the last one and\n" +" to subdivide using the original stroke vertices until a certain\n" +" error is reached.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int PolygonalizationShader___init__( BPy_PolygonalizationShader* self, PyObject *args) +{ + float f; + + if(!( PyArg_ParseTuple(args, "f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f); + return 0; +} /*-----------------------BPy_PolygonalizationShader type definition ------------------------------*/ @@ -34,7 +68,7 @@ PyTypeObject PolygonalizationShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "PolygonalizationShader objects", /* tp_doc */ + PolygonalizationShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +88,6 @@ PyTypeObject PolygonalizationShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int PolygonalizationShader___init__( BPy_PolygonalizationShader* self, PyObject *args) -{ - float f; - - if(!( PyArg_ParseTuple(args, "f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp index a14d2632af3..1dacb1499e9 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp @@ -8,8 +8,35 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SamplingShader instance -----------*/ -static int SamplingShader___init__( BPy_SamplingShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char SamplingShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(sampling)\n" +"\n" +" Builds a SamplingShader object.\n" +"\n" +" :arg sampling: The sampling to use for the stroke resampling.\n" +" :type sampling: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Resamples the stroke.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int SamplingShader___init__( BPy_SamplingShader* self, PyObject *args) +{ + float f; + + if(!( PyArg_ParseTuple(args, "f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::SamplingShader(f); + return 0; +} /*-----------------------BPy_SamplingShader type definition ------------------------------*/ @@ -34,7 +61,7 @@ PyTypeObject SamplingShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "SamplingShader objects", /* tp_doc */ + SamplingShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +81,6 @@ PyTypeObject SamplingShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int SamplingShader___init__( BPy_SamplingShader* self, PyObject *args) -{ - float f; - - if(!( PyArg_ParseTuple(args, "f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::SamplingShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp index 6b931237afb..20be1575bb3 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -8,8 +8,53 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SmoothingShader instance -----------*/ -static int SmoothingShader___init__( BPy_SmoothingShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char SmoothingShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iNbIteration, iFactorPoint, ifactorCurvature, iFactorCurvatureDifference, iAnisoPoint, iAnisNormal, iAnisoCurvature, icarricatureFactor)\n" +"\n" +" Builds a SmoothingShader object.\n" +"\n" +" :arg iNbIteration: The number of iterations (400).\n" +" :type iNbIteration: int\n" +" :arg iFactorPoint: 0.0\n" +" :type iFactorPoint: float\n" +" :arg ifactorCurvature: 0.0\n" +" :type ifactorCurvature: float\n" +" :arg iFactorCurvatureDifference: 0.2\n" +" :type iFactorCurvatureDifference: float\n" +" :arg iAnisoPoint: \n" +" :type iAnisoPoint: float\n" +" :arg iAnisNormal: 0.0\n" +" :type iAnisNormal: float\n" +" :arg iAnisoCurvature: 0.0\n" +" :type iAnisoCurvature: float\n" +" :arg icarricatureFactor: 1.0\n" +" :type icarricatureFactor: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Smoothes the stroke by moving the vertices to make the stroke\n" +" smoother. Uses curvature flow to converge towards a curve of\n" +" constant curvature. The diffusion method we use is anisotropic to\n" +" prevent the diffusion accross corners.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int SmoothingShader___init__( BPy_SmoothingShader* self, PyObject *args) +{ + int i1; + double d2, d3, d4, d5, d6, d7, d8; + + if(!( PyArg_ParseTuple(args, "iddddddd", &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8) )) + return -1; + + self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8); + return 0; +} /*-----------------------BPy_SmoothingShader type definition ------------------------------*/ @@ -34,7 +79,7 @@ PyTypeObject SmoothingShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "SmoothingShader objects", /* tp_doc */ + SmoothingShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,20 +99,6 @@ PyTypeObject SmoothingShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int SmoothingShader___init__( BPy_SmoothingShader* self, PyObject *args) -{ - int i1; - double d2, d3, d4, d5, d6, d7, d8; - - if(!( PyArg_ParseTuple(args, "iddddddd", &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8) )) - return -1; - - self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp index 4dd65c7087e..7df1d31a16d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp @@ -9,8 +9,46 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SpatialNoiseShader instance -----------*/ -static int SpatialNoiseShader___init__( BPy_SpatialNoiseShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char SpatialNoiseShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iAmount, ixScale, nbOctave, smooth, pureRandom)\n" +"\n" +" Builds a SpatialNoiseShader object.\n" +"\n" +" :arg iAmount: The amplitude of the noise.\n" +" :type iAmount: float\n" +" :arg ixScale: The noise frequency.\n" +" :type ixScale: float\n" +" :arg nbOctave: The number of octaves\n" +" :type nbOctave: int\n" +" :arg smooth: True if you want the noise to be smooth.\n" +" :type smooth: bool\n" +" :arg pureRandom: True if you don't want any coherence.\n" +" :type pureRandom: bool\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Spatial Noise stroke shader. Moves the vertices to make the stroke\n" +" more noisy.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int SpatialNoiseShader___init__( BPy_SpatialNoiseShader* self, PyObject *args) +{ + float f1, f2; + int i3; + PyObject *obj4 = 0, *obj5 = 0; + + if(!( PyArg_ParseTuple(args, "ffiOO", &f1, &f2, &i3, &obj4, &obj5) )) + return -1; + + self->py_ss.ss = new SpatialNoiseShader(f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5) ); + return 0; +} /*-----------------------BPy_SpatialNoiseShader type definition ------------------------------*/ @@ -35,7 +73,7 @@ PyTypeObject SpatialNoiseShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "SpatialNoiseShader objects", /* tp_doc */ + SpatialNoiseShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,21 +93,6 @@ PyTypeObject SpatialNoiseShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int SpatialNoiseShader___init__( BPy_SpatialNoiseShader* self, PyObject *args) -{ - float f1, f2; - int i3; - PyObject *obj4 = 0, *obj5 = 0; - - if(!( PyArg_ParseTuple(args, "ffiOO", &f1, &f2, &i3, &obj4, &obj5) )) - return -1; - - self->py_ss.ss = new SpatialNoiseShader(f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5) ); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp index 1e979ad7e1a..ed42a64eed0 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp @@ -10,8 +10,60 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for StrokeTextureShader instance -----------*/ -static int StrokeTextureShader___init__( BPy_StrokeTextureShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char StrokeTextureShader___doc__[] = +"[Texture shader]\n" +"\n" +".. method:: __init__(textureFile, mediumType=MediumType.OPAQUE_MEDIUM, iTips=False)\n" +"\n" +" Builds a StrokeTextureShader object.\n" +"\n" +" :arg textureFile: \n" +" :type textureFile: string\n" +" :arg mediumType: The medium type and therefore, the blending mode\n" +" that must be used for the rendering of this stroke.\n" +" :type mediumType: :class:`MediumType`\n" +" :arg iTips: Tells whether the texture includes tips or not. If it\n" +" is the case, the texture image must respect the following format.\n" +" :type iTips: bool\n" +"\n" +" The format of a texture image including tips::\n" +"\n" +" ___________\n" +" | |\n" +" | A |\n" +" |___________|\n" +" | | |\n" +" | B | C |\n" +" |_____|_____|\n" +"\n" +" * A : The stroke's corpus texture.\n" +" * B : The stroke's left extremity texture.\n" +" * C : The stroke's right extremity texture.\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns a texture and a blending mode to the stroke in order to\n" +" simulate its marks system.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int StrokeTextureShader___init__( BPy_StrokeTextureShader* self, PyObject *args) +{ + const char *s1; + PyObject *obj2 = 0, *obj3 = 0; + + if(!( PyArg_ParseTuple(args, "s|O!O", &s1, &MediumType_Type, &obj2, &obj3) )) + return -1; + + Stroke::MediumType mt = (obj2) ? MediumType_from_BPy_MediumType(obj2) : Stroke::OPAQUE_MEDIUM; + bool b = (obj3) ? bool_from_PyBool(obj3) : true; + + self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1,mt,b); + return 0; +} /*-----------------------BPy_StrokeTextureShader type definition ------------------------------*/ @@ -36,7 +88,7 @@ PyTypeObject StrokeTextureShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "StrokeTextureShader objects", /* tp_doc */ + StrokeTextureShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,23 +108,6 @@ PyTypeObject StrokeTextureShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int StrokeTextureShader___init__( BPy_StrokeTextureShader* self, PyObject *args) -{ - const char *s1; - PyObject *obj2 = 0, *obj3 = 0; - - if(!( PyArg_ParseTuple(args, "s|O!O", &s1, &MediumType_Type, &obj2, &obj3) )) - return -1; - - Stroke::MediumType mt = (obj2) ? MediumType_from_BPy_MediumType(obj2) : Stroke::OPAQUE_MEDIUM; - bool b = (obj3) ? bool_from_PyBool(obj3) : true; - - self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1,mt,b); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp index 27ac0bf15a5..4df76f6646b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp @@ -8,8 +8,51 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TextureAssignerShader instance -----------*/ -static int TextureAssignerShader___init__( BPy_TextureAssignerShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char TextureAssignerShader___doc__[] = +"[Texture shader]\n" +"\n" +".. method:: __init__(id)\n" +"\n" +" Builds a TextureAssignerShader object.\n" +"\n" +" :arg id: The preset number to use.\n" +" :type id: int\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns a texture to the stroke in order to simulate its marks\n" +" system. This shader takes as input an integer value telling which\n" +" texture and blending mode to use among a set of predefined\n" +" textures. Here are the different presets:\n" +"\n" +" * 0: `/brushes/charcoalAlpha.bmp`, `MediumType.HUMID_MEDIUM`\n" +" * 1: `/brushes/washbrushAlpha.bmp`, `MediumType.HUMID_MEDIUM`\n" +" * 2: `/brushes/oil.bmp`, `MediumType.HUMID_MEDIUM`\n" +" * 3: `/brushes/oilnoblend.bmp`, `MediumType.HUMID_MEDIUM`\n" +" * 4: `/brushes/charcoalAlpha.bmp`, `MediumType.DRY_MEDIUM`\n" +" * 5: `/brushes/washbrushAlpha.bmp`, `MediumType.DRY_MEDIUM`\n" +" * 6: `/brushes/opaqueDryBrushAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n" +" * 7: `/brushes/opaqueBrushAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n" +"\n" +" Any other value will lead to the following preset:\n" +"\n" +" * Default: `/brushes/smoothAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int TextureAssignerShader___init__( BPy_TextureAssignerShader* self, PyObject *args) +{ + int i; + + if(!( PyArg_ParseTuple(args, "i", &i) )) + return -1; + + self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i); + return 0; +} /*-----------------------BPy_TextureAssignerShader type definition ------------------------------*/ @@ -34,7 +77,7 @@ PyTypeObject TextureAssignerShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "TextureAssignerShader objects", /* tp_doc */ + TextureAssignerShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +97,6 @@ PyTypeObject TextureAssignerShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int TextureAssignerShader___init__( BPy_TextureAssignerShader* self, PyObject *args) -{ - int i; - - if(!( PyArg_ParseTuple(args, "i", &i) )) - return -1; - - self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp index 11895239a2f..c880f05ed7b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp @@ -8,8 +8,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ThicknessNoiseShader instance -----------*/ -static int ThicknessNoiseShader___init__( BPy_ThicknessNoiseShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ThicknessNoiseShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(iAmplitude, iPeriod)\n" +"\n" +" Builds a ThicknessNoiseShader object.\n" +"\n" +" :arg iAmplitude: The amplitude of the noise signal.\n" +" :type iAmplitude: float\n" +" :arg iPeriod: The period of the noise signal.\n" +" :type iPeriod: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Adds some noise to the stroke thickness.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ThicknessNoiseShader___init__( BPy_ThicknessNoiseShader* self, PyObject *args) +{ + float f1, f2; + + if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2); + return 0; +} /*-----------------------BPy_ThicknessNoiseShader type definition ------------------------------*/ @@ -34,7 +63,7 @@ PyTypeObject ThicknessNoiseShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ThicknessNoiseShader objects", /* tp_doc */ + ThicknessNoiseShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +83,6 @@ PyTypeObject ThicknessNoiseShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ThicknessNoiseShader___init__( BPy_ThicknessNoiseShader* self, PyObject *args) -{ - float f1, f2; - - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp index 2759a9f9d13..f9472ae3444 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp @@ -9,8 +9,47 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ThicknessVariationPatternShader instance -----------*/ -static int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ThicknessVariationPatternShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(pattern_name, iMinThickness, iMaxThickness, stretch)\n" +"\n" +" Builds a ThicknessVariationPatternShader object.\n" +"\n" +" :arg pattern_name: The texture file name.\n" +" :type pattern_name: string\n" +" :arg iMinThickness: The minimum thickness we don't want to exceed.\n" +" :type iMinThickness: float\n" +" :arg iMaxThickness: The maximum thickness we don't want to exceed.\n" +" :type iMaxThickness: float\n" +" :arg stretch: Tells whether the pattern texture must be stretched\n" +" or repeted to fit the stroke.\n" +" :type stretch: bool\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Applies a pattern (texture) to vary thickness. The new thicknesses\n" +" are the result of the multiplication of the pattern and the\n" +" original thickness.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args) +{ + const char *s1; + float f2 = 1.0, f3 = 5.0; + PyObject *obj4 = 0; + + if(!( PyArg_ParseTuple(args, "s|ffO", &s1, &f2, &f3, &obj4) )) + return -1; + + bool b = (obj4) ? bool_from_PyBool(obj4) : true; + self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b); + return 0; +} /*-----------------------BPy_ThicknessVariationPatternShader type definition ------------------------------*/ @@ -35,7 +74,7 @@ PyTypeObject ThicknessVariationPatternShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ThicknessVariationPatternShader objects", /* tp_doc */ + ThicknessVariationPatternShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,22 +94,6 @@ PyTypeObject ThicknessVariationPatternShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args) -{ - const char *s1; - float f2 = 1.0, f3 = 5.0; - PyObject *obj4 = 0; - - if(!( PyArg_ParseTuple(args, "s|ffO", &s1, &f2, &f3, &obj4) )) - return -1; - - bool b = (obj4) ? bool_from_PyBool(obj4) : true; - self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp index 709dbad6a1b..ec90499a49b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp @@ -8,8 +8,36 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TipRemoverShader instance -----------*/ -static int TipRemoverShader___init__( BPy_TipRemoverShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char TipRemoverShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(tipLength)\n" +"\n" +" Builds a TipRemoverShader object.\n" +"\n" +" :arg tipLength: The length of the piece of stroke we want to remove\n" +" at each extremity.\n" +" :type tipLength: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Removes the stroke's extremities.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int TipRemoverShader___init__( BPy_TipRemoverShader* self, PyObject *args) +{ + double d; + + if(!( PyArg_ParseTuple(args, "d", &d) )) + return -1; + + self->py_ss.ss = new StrokeShaders::TipRemoverShader(d); + return 0; +} /*-----------------------BPy_TipRemoverShader type definition ------------------------------*/ @@ -34,7 +62,7 @@ PyTypeObject TipRemoverShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "streamSTipRemoverShaderhader objects", /* tp_doc */ + TipRemoverShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +82,6 @@ PyTypeObject TipRemoverShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int TipRemoverShader___init__( BPy_TipRemoverShader* self, PyObject *args) -{ - double d; - - if(!( PyArg_ParseTuple(args, "d", &d) )) - return -1; - - self->py_ss.ss = new StrokeShaders::TipRemoverShader(d); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp index 49f724a8c3c..03881533ef6 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp @@ -8,8 +8,35 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for fstreamShader instance -----------*/ -static int fstreamShader___init__( BPy_fstreamShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char fstreamShader___doc__[] = +"[Output shader]\n" +"\n" +".. method:: __init__(iFileName)\n" +"\n" +" Builds a fstreamShader object.\n" +"\n" +" :arg iFileName: The output file name.\n" +" :type iFileName: string\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Streams the Stroke in a file.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int fstreamShader___init__( BPy_fstreamShader* self, PyObject *args) +{ + const char *s; + + if(!( PyArg_ParseTuple(args, "s", &s) )) + return -1; + + self->py_ss.ss = new StrokeShaders::fstreamShader(s); + return 0; +} /*-----------------------BPy_fstreamShader type definition ------------------------------*/ @@ -34,7 +61,7 @@ PyTypeObject fstreamShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "fstreamShader objects", /* tp_doc */ + fstreamShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +81,6 @@ PyTypeObject fstreamShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int fstreamShader___init__( BPy_fstreamShader* self, PyObject *args) -{ - const char *s; - - if(!( PyArg_ParseTuple(args, "s", &s) )) - return -1; - - self->py_ss.ss = new StrokeShaders::fstreamShader(s); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp index a39bb15a329..31e0971b875 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp @@ -8,8 +8,29 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for streamShader instance -----------*/ -static int streamShader___init__( BPy_streamShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char streamShader___doc__[] = +"[Output shader]\n" +"\n" +".. method:: __init__()\n" +"\n" +" Builds a streamShader object.\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Streams the Stroke into stdout.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int streamShader___init__( BPy_streamShader* self, PyObject *args) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_ss.ss = new StrokeShaders::streamShader(); + return 0; +} /*-----------------------BPy_streamShader type definition ------------------------------*/ @@ -34,7 +55,7 @@ PyTypeObject streamShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "streamShader objects", /* tp_doc */ + streamShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,16 +75,6 @@ PyTypeObject streamShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int streamShader___init__( BPy_streamShader* self, PyObject *args) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_ss.ss = new StrokeShaders::streamShader(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index 080eaaec372..a6810d0a7c5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -22,63 +22,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DDouble instance -----------*/ -static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble* self); -static PyObject * UnaryFunction0DDouble___repr__(BPy_UnaryFunction0DDouble* self); - -static PyObject * UnaryFunction0DDouble_getName( BPy_UnaryFunction0DDouble *self); -static PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DDouble instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DDouble_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DDouble_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DDouble type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DDouble_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DDouble", /* tp_name */ - sizeof(BPy_UnaryFunction0DDouble), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DDouble___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DDouble___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DDouble___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DDouble objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DDouble_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DDouble___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DDouble_Init( PyObject *module ) { @@ -146,7 +89,15 @@ int UnaryFunction0DDouble_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DDouble___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return a float value.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -155,25 +106,32 @@ int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self, PyObject *ar return 0; } -void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble* self) +static void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble* self) { if (self->uf0D_double) delete self->uf0D_double; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DDouble___repr__(BPy_UnaryFunction0DDouble* self) +static PyObject * UnaryFunction0DDouble___repr__(BPy_UnaryFunction0DDouble* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_double->getName().c_str(), self->uf0D_double ); } -PyObject * UnaryFunction0DDouble_getName( BPy_UnaryFunction0DDouble *self ) +static char UnaryFunction0DDouble_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DDouble_getName( BPy_UnaryFunction0DDouble *self ) { return PyUnicode_FromFormat( self->uf0D_double->getName().c_str() ); } -PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -199,6 +157,55 @@ PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyOb } +/*----------------------UnaryFunction0DDouble instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DDouble_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DDouble_getName, METH_NOARGS, UnaryFunction0DDouble_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DDouble type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DDouble_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DDouble", /* tp_name */ + sizeof(BPy_UnaryFunction0DDouble), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DDouble___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DDouble___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DDouble___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DDouble___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DDouble_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DDouble___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index c050b29f65b..aa2ae5e36b5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -11,63 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DEdgeNature instance -----------*/ -static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature* self); -static PyObject * UnaryFunction0DEdgeNature___repr__(BPy_UnaryFunction0DEdgeNature* self); - -static PyObject * UnaryFunction0DEdgeNature_getName( BPy_UnaryFunction0DEdgeNature *self); -static PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DEdgeNature instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DEdgeNature_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DEdgeNature_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DEdgeNature type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DEdgeNature_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DEdgeNature", /* tp_name */ - sizeof(BPy_UnaryFunction0DEdgeNature), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DEdgeNature___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DEdgeNature___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DEdgeNature___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DEdgeNature objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DEdgeNature_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DEdgeNature___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DEdgeNature_Init( PyObject *module ) { @@ -90,7 +33,15 @@ int UnaryFunction0DEdgeNature_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DEdgeNature___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return a :class:`Nature` object.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -99,25 +50,32 @@ int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self, PyOb return 0; } -void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature* self) +static void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature* self) { if (self->uf0D_edgenature) delete self->uf0D_edgenature; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DEdgeNature___repr__(BPy_UnaryFunction0DEdgeNature* self) +static PyObject * UnaryFunction0DEdgeNature___repr__(BPy_UnaryFunction0DEdgeNature* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_edgenature->getName().c_str(), self->uf0D_edgenature ); } -PyObject * UnaryFunction0DEdgeNature_getName( BPy_UnaryFunction0DEdgeNature *self ) +static char UnaryFunction0DEdgeNature_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DEdgeNature_getName( BPy_UnaryFunction0DEdgeNature *self ) { return PyUnicode_FromFormat( self->uf0D_edgenature->getName().c_str() ); } -PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -143,6 +101,55 @@ PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *se } +/*----------------------UnaryFunction0DEdgeNature instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DEdgeNature_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DEdgeNature_getName, METH_NOARGS, UnaryFunction0DEdgeNature_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DEdgeNature type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DEdgeNature_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DEdgeNature", /* tp_name */ + sizeof(BPy_UnaryFunction0DEdgeNature), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DEdgeNature___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DEdgeNature___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DEdgeNature___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DEdgeNature___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DEdgeNature_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DEdgeNature___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index 8bf9136cdc2..ade1082cf64 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -16,63 +16,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DFloat instance -----------*/ -static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat* self); -static PyObject * UnaryFunction0DFloat___repr__(BPy_UnaryFunction0DFloat* self); - -static PyObject * UnaryFunction0DFloat_getName( BPy_UnaryFunction0DFloat *self); -static PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DFloat instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DFloat_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DFloat_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DFloat type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DFloat_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DFloat", /* tp_name */ - sizeof(BPy_UnaryFunction0DFloat), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DFloat___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DFloat___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DFloat___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DFloat objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DFloat_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DFloat___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DFloat_Init( PyObject *module ) { @@ -120,7 +63,15 @@ int UnaryFunction0DFloat_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DFloat___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return a float value.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -129,25 +80,32 @@ int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self, PyObject *args return 0; } -void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat* self) +static void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat* self) { if (self->uf0D_float) delete self->uf0D_float; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DFloat___repr__(BPy_UnaryFunction0DFloat* self) +static PyObject * UnaryFunction0DFloat___repr__(BPy_UnaryFunction0DFloat* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_float->getName().c_str(), self->uf0D_float ); } -PyObject * UnaryFunction0DFloat_getName( BPy_UnaryFunction0DFloat *self ) +static char UnaryFunction0DFloat_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DFloat_getName( BPy_UnaryFunction0DFloat *self ) { return PyUnicode_FromFormat( self->uf0D_float->getName().c_str() ); } -PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -173,6 +131,55 @@ PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObje } +/*----------------------UnaryFunction0DFloat instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DFloat_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DFloat_getName, METH_NOARGS, UnaryFunction0DFloat_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DFloat type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DFloat_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DFloat", /* tp_name */ + sizeof(BPy_UnaryFunction0DFloat), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DFloat___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DFloat___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DFloat___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DFloat___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DFloat_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DFloat___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index 25c251087a1..a29eabcc063 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -11,63 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DId instance -----------*/ -static int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId* self); -static PyObject * UnaryFunction0DId___repr__(BPy_UnaryFunction0DId* self); - -static PyObject * UnaryFunction0DId_getName( BPy_UnaryFunction0DId *self); -static PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DId instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DId_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DId_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DId type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DId_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DId", /* tp_name */ - sizeof(BPy_UnaryFunction0DId), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DId___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DId___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DId___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DId objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DId_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DId___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DId_Init( PyObject *module ) { @@ -90,7 +33,15 @@ int UnaryFunction0DId_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DId___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return an :class:`Id` object.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -99,25 +50,32 @@ int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self, PyObject *args, PyOb return 0; } -void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId* self) +static void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId* self) { if (self->uf0D_id) delete self->uf0D_id; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DId___repr__(BPy_UnaryFunction0DId* self) +static PyObject * UnaryFunction0DId___repr__(BPy_UnaryFunction0DId* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_id->getName().c_str(), self->uf0D_id ); } -PyObject * UnaryFunction0DId_getName( BPy_UnaryFunction0DId *self ) +static char UnaryFunction0DId_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DId_getName( BPy_UnaryFunction0DId *self ) { return PyUnicode_FromFormat( self->uf0D_id->getName().c_str() ); } -PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -142,6 +100,55 @@ PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *ar return BPy_Id_from_Id( self->uf0D_id->result ); } +/*----------------------UnaryFunction0DId instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DId_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DId_getName, METH_NOARGS, UnaryFunction0DId_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DId type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DId_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DId", /* tp_name */ + sizeof(BPy_UnaryFunction0DId), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DId___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DId___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DId___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DId___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DId_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DId___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index 7029280fb61..d7518b107a6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -11,63 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DMaterial instance -----------*/ -static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* self); -static PyObject * UnaryFunction0DMaterial___repr__(BPy_UnaryFunction0DMaterial* self); - -static PyObject * UnaryFunction0DMaterial_getName( BPy_UnaryFunction0DMaterial *self); -static PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DMaterial instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DMaterial_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DMaterial_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DMaterial type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DMaterial_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DMaterial", /* tp_name */ - sizeof(BPy_UnaryFunction0DMaterial), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DMaterial___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DMaterial___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DMaterial___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DMaterial objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DMaterial_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DMaterial___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DMaterial_Init( PyObject *module ) { @@ -90,7 +33,15 @@ int UnaryFunction0DMaterial_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DMaterial___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return a :class:`FrsMaterial` object.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -99,7 +50,7 @@ int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self, PyObject return 0; } -void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* self) +static void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* self) { if (self->uf0D_material) delete self->uf0D_material; @@ -107,17 +58,25 @@ void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* self) } -PyObject * UnaryFunction0DMaterial___repr__(BPy_UnaryFunction0DMaterial* self) +static PyObject * UnaryFunction0DMaterial___repr__(BPy_UnaryFunction0DMaterial* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_material->getName().c_str(), self->uf0D_material ); } -PyObject * UnaryFunction0DMaterial_getName( BPy_UnaryFunction0DMaterial *self ) +static char UnaryFunction0DMaterial_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DMaterial_getName( BPy_UnaryFunction0DMaterial *self ) { return PyUnicode_FromFormat( self->uf0D_material->getName().c_str() ); } -PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -143,6 +102,55 @@ PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, } +/*----------------------UnaryFunction0DMaterial instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DMaterial_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DMaterial_getName, METH_NOARGS, UnaryFunction0DMaterial_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DMaterial type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DMaterial_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DMaterial", /* tp_name */ + sizeof(BPy_UnaryFunction0DMaterial), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DMaterial___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DMaterial___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DMaterial___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DMaterial___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DMaterial_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DMaterial___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 475e134b18e..ddf42e7851d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -11,63 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DUnsigned instance -----------*/ -static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned* self); -static PyObject * UnaryFunction0DUnsigned___repr__(BPy_UnaryFunction0DUnsigned* self); - -static PyObject * UnaryFunction0DUnsigned_getName( BPy_UnaryFunction0DUnsigned *self); -static PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DUnsigned instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DUnsigned_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DUnsigned_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DUnsigned type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DUnsigned_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DUnsigned", /* tp_name */ - sizeof(BPy_UnaryFunction0DUnsigned), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DUnsigned___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DUnsigned___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DUnsigned___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DUnsigned objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DUnsigned_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DUnsigned___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DUnsigned_Init( PyObject *module ) { @@ -90,7 +33,15 @@ int UnaryFunction0DUnsigned_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DUnsigned___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return an int value.\n" +"\n" +".. method:: __init__()\n" +"\n" + " Default constructor.\n"; + +static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -99,25 +50,32 @@ int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self, PyObject return 0; } -void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned* self) +static void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned* self) { if (self->uf0D_unsigned) delete self->uf0D_unsigned; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DUnsigned___repr__(BPy_UnaryFunction0DUnsigned* self) +static PyObject * UnaryFunction0DUnsigned___repr__(BPy_UnaryFunction0DUnsigned* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_unsigned->getName().c_str(), self->uf0D_unsigned ); } -PyObject * UnaryFunction0DUnsigned_getName( BPy_UnaryFunction0DUnsigned *self ) +static char UnaryFunction0DUnsigned_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DUnsigned_getName( BPy_UnaryFunction0DUnsigned *self ) { return PyUnicode_FromFormat( self->uf0D_unsigned->getName().c_str() ); } -PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -143,6 +101,55 @@ PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, } +/*----------------------UnaryFunction0DUnsigned instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DUnsigned_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DUnsigned_getName, METH_NOARGS, UnaryFunction0DUnsigned_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DUnsigned type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DUnsigned_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DUnsigned", /* tp_name */ + sizeof(BPy_UnaryFunction0DUnsigned), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DUnsigned___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DUnsigned___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DUnsigned___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DUnsigned___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DUnsigned_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DUnsigned___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index eb09a9459d5..faca476f319 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -12,63 +12,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DVec2f instance -----------*/ -static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f* self); -static PyObject * UnaryFunction0DVec2f___repr__(BPy_UnaryFunction0DVec2f* self); - -static PyObject * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self); -static PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DVec2f instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DVec2f_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DVec2f_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DVec2f type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DVec2f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DVec2f", /* tp_name */ - sizeof(BPy_UnaryFunction0DVec2f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVec2f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVec2f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVec2f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DVec2f objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DVec2f_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVec2f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DVec2f_Init( PyObject *module ) { @@ -96,7 +39,15 @@ int UnaryFunction0DVec2f_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DVec2f___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return a 2D vector.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -105,25 +56,32 @@ int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self, PyObject *args return 0; } -void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f* self) +static void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f* self) { if (self->uf0D_vec2f) delete self->uf0D_vec2f; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DVec2f___repr__(BPy_UnaryFunction0DVec2f* self) +static PyObject * UnaryFunction0DVec2f___repr__(BPy_UnaryFunction0DVec2f* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vec2f->getName().c_str(), self->uf0D_vec2f ); } -PyObject * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self ) +static char UnaryFunction0DVec2f_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self ) { return PyUnicode_FromFormat( self->uf0D_vec2f->getName().c_str() ); } -PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -149,6 +107,55 @@ PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObje } +/*----------------------UnaryFunction0DVec2f instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DVec2f_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DVec2f_getName, METH_NOARGS, UnaryFunction0DVec2f_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DVec2f type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DVec2f_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DVec2f", /* tp_name */ + sizeof(BPy_UnaryFunction0DVec2f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVec2f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DVec2f___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVec2f___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVec2f___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DVec2f_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVec2f___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index 67610ae13a9..f329007fd70 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -11,63 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DVec3f instance -----------*/ -static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f* self); -static PyObject * UnaryFunction0DVec3f___repr__(BPy_UnaryFunction0DVec3f* self); - -static PyObject * UnaryFunction0DVec3f_getName( BPy_UnaryFunction0DVec3f *self); -static PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DVec3f instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DVec3f_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DVec3f_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DVec3f type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DVec3f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DVec3f", /* tp_name */ - sizeof(BPy_UnaryFunction0DVec3f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVec3f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVec3f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVec3f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DVec3f objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DVec3f_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVec3f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DVec3f_Init( PyObject *module ) { @@ -90,7 +33,15 @@ int UnaryFunction0DVec3f_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DVec3f___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return a 3D vector.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -99,25 +50,32 @@ int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self, PyObject *args return 0; } -void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f* self) +static void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f* self) { if (self->uf0D_vec3f) delete self->uf0D_vec3f; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DVec3f___repr__(BPy_UnaryFunction0DVec3f* self) +static PyObject * UnaryFunction0DVec3f___repr__(BPy_UnaryFunction0DVec3f* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vec3f->getName().c_str(), self->uf0D_vec3f ); } -PyObject * UnaryFunction0DVec3f_getName( BPy_UnaryFunction0DVec3f *self ) +static char UnaryFunction0DVec3f_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DVec3f_getName( BPy_UnaryFunction0DVec3f *self ) { return PyUnicode_FromFormat( self->uf0D_vec3f->getName().c_str() ); } -PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -143,6 +101,55 @@ PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObje } +/*----------------------UnaryFunction0DVec3f instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DVec3f_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DVec3f_getName, METH_NOARGS, UnaryFunction0DVec3f_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DVec3f type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DVec3f_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DVec3f", /* tp_name */ + sizeof(BPy_UnaryFunction0DVec3f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVec3f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DVec3f___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVec3f___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVec3f___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DVec3f_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVec3f___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 5fcbff2c8de..351935141c5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -11,63 +11,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DVectorViewShape instance -----------*/ -static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVectorViewShape* self); -static PyObject * UnaryFunction0DVectorViewShape___repr__(BPy_UnaryFunction0DVectorViewShape* self); - -static PyObject * UnaryFunction0DVectorViewShape_getName( BPy_UnaryFunction0DVectorViewShape *self); -static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DVectorViewShape instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DVectorViewShape_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DVectorViewShape_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DVectorViewShape type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DVectorViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DVectorViewShape", /* tp_name */ - sizeof(BPy_UnaryFunction0DVectorViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVectorViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVectorViewShape___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVectorViewShape___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DVectorViewShape objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DVectorViewShape_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVectorViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DVectorViewShape_Init( PyObject *module ) { @@ -90,7 +33,16 @@ int UnaryFunction0DVectorViewShape_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DVectorViewShape___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return a list of :class:`ViewShape`\n" +"objects.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -99,25 +51,32 @@ int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* return 0; } -void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVectorViewShape* self) +static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVectorViewShape* self) { if (self->uf0D_vectorviewshape) delete self->uf0D_vectorviewshape; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DVectorViewShape___repr__(BPy_UnaryFunction0DVectorViewShape* self) +static PyObject * UnaryFunction0DVectorViewShape___repr__(BPy_UnaryFunction0DVectorViewShape* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vectorviewshape->getName().c_str(), self->uf0D_vectorviewshape ); } -PyObject * UnaryFunction0DVectorViewShape_getName( BPy_UnaryFunction0DVectorViewShape *self ) +static char UnaryFunction0DVectorViewShape_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DVectorViewShape_getName( BPy_UnaryFunction0DVectorViewShape *self ) { return PyUnicode_FromFormat( self->uf0D_vectorviewshape->getName().c_str() ); } -PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -147,6 +106,55 @@ PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorVie return list; } +/*----------------------UnaryFunction0DVectorViewShape instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DVectorViewShape_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DVectorViewShape_getName, METH_NOARGS, UnaryFunction0DVectorViewShape_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DVectorViewShape type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DVectorViewShape_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DVectorViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction0DVectorViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVectorViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DVectorViewShape___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVectorViewShape___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVectorViewShape___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DVectorViewShape_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVectorViewShape___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index 095ee066987..e3e8538009d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -12,63 +12,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction0DViewShape instance -----------*/ -static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self, PyObject *args, PyObject *kwds); -static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape* self); -static PyObject * UnaryFunction0DViewShape___repr__(BPy_UnaryFunction0DViewShape* self); - -static PyObject * UnaryFunction0DViewShape_getName( BPy_UnaryFunction0DViewShape *self); -static PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds); - -/*----------------------UnaryFunction0DViewShape instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction0DViewShape_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DViewShape_getName, METH_NOARGS, "() Returns the string of the name of the unary 0D function."}, - {NULL, NULL, 0, NULL} -}; - -/*-----------------------BPy_UnaryFunction0DViewShape type definition ------------------------------*/ - -PyTypeObject UnaryFunction0DViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DViewShape", /* tp_name */ - sizeof(BPy_UnaryFunction0DViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DViewShape___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DViewShape___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "UnaryFunction0DViewShape objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_UnaryFunction0DViewShape_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0DViewShape_Init( PyObject *module ) { @@ -96,7 +39,15 @@ int UnaryFunction0DViewShape_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self, PyObject *args, PyObject *kwds) +static char UnaryFunction0DViewShape___doc__[] = +"Base class for unary functions (functors) that work on\n" +":class:`Interface0DIterator` and return a :class:`ViewShape` object.\n" +"\n" +".. method:: __init__()\n" +"\n" +" Default constructor.\n"; + +static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self, PyObject *args, PyObject *kwds) { if ( !PyArg_ParseTuple(args, "") ) return -1; @@ -105,25 +56,32 @@ int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self, PyObje return 0; } -void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape* self) +static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape* self) { if (self->uf0D_viewshape) delete self->uf0D_viewshape; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction0DViewShape___repr__(BPy_UnaryFunction0DViewShape* self) +static PyObject * UnaryFunction0DViewShape___repr__(BPy_UnaryFunction0DViewShape* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_viewshape->getName().c_str(), self->uf0D_viewshape ); } -PyObject * UnaryFunction0DViewShape_getName( BPy_UnaryFunction0DViewShape *self ) +static char UnaryFunction0DViewShape_getName___doc__[] = +".. method:: getName()\n" +"\n" +" Returns the name of the unary 0D predicate.\n" +"\n" +" :return: The name of the unary 0D predicate.\n" +" :rtype: string\n"; + +static PyObject * UnaryFunction0DViewShape_getName( BPy_UnaryFunction0DViewShape *self ) { return PyUnicode_FromFormat( self->uf0D_viewshape->getName().c_str() ); } -PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -149,6 +107,55 @@ PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self } +/*----------------------UnaryFunction0DViewShape instance definitions ----------------------------*/ +static PyMethodDef BPy_UnaryFunction0DViewShape_methods[] = { + {"getName", ( PyCFunction ) UnaryFunction0DViewShape_getName, METH_NOARGS, UnaryFunction0DViewShape_getName___doc__}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_UnaryFunction0DViewShape type definition ------------------------------*/ + +PyTypeObject UnaryFunction0DViewShape_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "UnaryFunction0DViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction0DViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DViewShape___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DViewShape___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DViewShape___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_UnaryFunction0DViewShape_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DViewShape___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp index a79bb7d819a..8acb96f8d0f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp @@ -8,8 +8,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ShapeIdF0D instance -----------*/ -static int ShapeIdF0D___init__(BPy_ShapeIdF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ShapeIdF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a ShapeIdF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the :class:`Id` of the Shape the :class:`Interface0D`\n" +" pointed by the Interface0DIterator belongs to. This evaluation can\n" +" be ambiguous (in the case of a :class:`TVertex` for example). This\n" +" functor tries to remove this ambiguity using the context offered by\n" +" the 1D element to which the Interface0DIterator belongs to.\n" +" However, there still can be problematic cases, and the user willing\n" +" to deal with this cases in a specific way should implement its own\n" +" getShapeIdF0D functor.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The Id of the Shape the pointed Interface0D belongs to.\n" +" :rtype: :class:`Id`\n"; + +static int ShapeIdF0D___init__( BPy_ShapeIdF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_id.uf0D_id = new Functions0D::ShapeIdF0D(); + self->py_uf0D_id.uf0D_id->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_ShapeIdF0D type definition ------------------------------*/ @@ -34,7 +63,7 @@ PyTypeObject ShapeIdF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ShapeIdF0D objects", /* tp_doc */ + ShapeIdF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +83,6 @@ PyTypeObject ShapeIdF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ShapeIdF0D___init__( BPy_ShapeIdF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_id.uf0D_id = new Functions0D::ShapeIdF0D(); - self->py_uf0D_id.uf0D_id->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp index 204fa9837f7..1f709947d0e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp @@ -8,8 +8,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for MaterialF0D instance -----------*/ -static int MaterialF0D___init__(BPy_MaterialF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char MaterialF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a MaterialF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the material of the object evaluated at the\n" +" :class:`Interface0D` pointed by the Interface0DIterator. This\n" +" evaluation can be ambiguous (in the case of a :class:`TVertex` for\n" +" example. This functor tries to remove this ambiguity using the\n" +" context offered by the 1D element to which the Interface0DIterator\n" +" belongs to and by arbitrary chosing the material of the face that\n" +" lies on its left when following the 1D element if there are two\n" +" different materials on each side of the point. However, there\n" +" still can be problematic cases, and the user willing to deal with\n" +" this cases in a specific way should implement its own getMaterial\n" +" functor.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The material of the object evaluated at the pointed\n" +" Interface0D.\n" +" :rtype: :class:`Material`\n"; + +static int MaterialF0D___init__( BPy_MaterialF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_material.uf0D_material = new Functions0D::MaterialF0D(); + self->py_uf0D_material.uf0D_material->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_MaterialF0D type definition ------------------------------*/ @@ -34,7 +67,7 @@ PyTypeObject MaterialF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "MaterialF0D objects", /* tp_doc */ + MaterialF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +87,6 @@ PyTypeObject MaterialF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int MaterialF0D___init__( BPy_MaterialF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_material.uf0D_material = new Functions0D::MaterialF0D(); - self->py_uf0D_material.uf0D_material->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp index 83db8e0effa..0216d01baba 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp @@ -8,8 +8,32 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for CurveNatureF0D instance -----------*/ - static int CurveNatureF0D___init__(BPy_CurveNatureF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char CurveNatureF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a CurveNatureF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the :class:`Nature` of the 1D element the Interface0D pointed\n" +" by the Interface0DIterator belongs to.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The nature of the 1D element to which the pointed Interface0D\n" +" belongs.\n" +" :rtype: :class:`Nature`\n"; + +static int CurveNatureF0D___init__( BPy_CurveNatureF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_edgenature.uf0D_edgenature = new Functions0D::CurveNatureF0D(); + self->py_uf0D_edgenature.uf0D_edgenature->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_CurveNatureF0D type definition ------------------------------*/ @@ -34,7 +58,7 @@ PyTypeObject CurveNatureF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "CurveNatureF0D objects", /* tp_doc */ + CurveNatureF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +78,6 @@ PyTypeObject CurveNatureF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int CurveNatureF0D___init__( BPy_CurveNatureF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_edgenature.uf0D_edgenature = new Functions0D::CurveNatureF0D(); - self->py_uf0D_edgenature.uf0D_edgenature->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp index 5304f4e5cce..e5b2413044d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp @@ -8,8 +8,34 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Normal2DF0D instance -----------*/ -static int Normal2DF0D___init__(BPy_Normal2DF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char Normal2DF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a Normal2DF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns a two-dimensional vector giving the normalized 2D normal to\n" +" the 1D element to which the :class:`Interface0D` pointed by the\n" +" Interface0DIterator belongs. The normal is evaluated at the pointed\n" +" Interface0D.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The 2D normal of the 1D element evaluated at the pointed\n" +" Interface0D.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static int Normal2DF0D___init__( BPy_Normal2DF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::Normal2DF0D(); + self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_Normal2DF0D type definition ------------------------------*/ @@ -34,7 +60,7 @@ PyTypeObject Normal2DF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Normal2DF0D objects", /* tp_doc */ + Normal2DF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +80,6 @@ PyTypeObject Normal2DF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int Normal2DF0D___init__( BPy_Normal2DF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::Normal2DF0D(); - self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp index 6fb50c4908d..e111abd4592 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp @@ -8,8 +8,34 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for VertexOrientation2DF0D instance -----------*/ -static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char VertexOrientation2DF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a VertexOrientation2DF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns a two-dimensional vector giving the 2D oriented tangent to\n" +" the 1D element to which the :class:`Interface0D` pointed by the\n" +" Interface0DIterator belongs. The 2D oriented tangent is evaluated\n" +" at the pointed Interface0D.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The 2D oriented tangent to the 1D element evaluated at the\n" +" pointed Interface0D.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static int VertexOrientation2DF0D___init__( BPy_VertexOrientation2DF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::VertexOrientation2DF0D(); + self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_VertexOrientation2DF0D type definition ------------------------------*/ @@ -34,7 +60,7 @@ PyTypeObject VertexOrientation2DF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "VertexOrientation2DF0D objects", /* tp_doc */ + VertexOrientation2DF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +80,6 @@ PyTypeObject VertexOrientation2DF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int VertexOrientation2DF0D___init__( BPy_VertexOrientation2DF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::VertexOrientation2DF0D(); - self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp index a827f1e66b5..4ed0450b011 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp @@ -8,8 +8,34 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for VertexOrientation3DF0D instance -----------*/ -static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char VertexOrientation3DF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a VertexOrientation3DF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns a three-dimensional vector giving the 3D oriented tangent\n" +" to the 1D element to which the :class:`Interface0D` pointed by the\n" +" Interface0DIterator belongs. The 3D oriented tangent is evaluated\n" +" at the pointed Interface0D.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The 3D oriented tangent to the 1D element evaluated at the\n" +" pointed Interface0D.\n" +" :rtype: :class:`Mathutils.Vector`\n"; + +static int VertexOrientation3DF0D___init__( BPy_VertexOrientation3DF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_vec3f.uf0D_vec3f = new Functions0D::VertexOrientation3DF0D(); + self->py_uf0D_vec3f.uf0D_vec3f->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_VertexOrientation3DF0D type definition ------------------------------*/ @@ -34,7 +60,7 @@ PyTypeObject VertexOrientation3DF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "VertexOrientation3DF0D objects", /* tp_doc */ + VertexOrientation3DF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +80,6 @@ PyTypeObject VertexOrientation3DF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int VertexOrientation3DF0D___init__( BPy_VertexOrientation3DF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_vec3f.uf0D_vec3f = new Functions0D::VertexOrientation3DF0D(); - self->py_uf0D_vec3f.uf0D_vec3f->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp index e2ab9f8758a..d4af0b2f95d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetOccludeeF0D instance -----------*/ -static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetOccludeeF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetOccludeeF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the :class:`ViewShape` that the Interface0D pointed by the\n" +" Interface0DIterator occludes.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The ViewShape occluded by the pointed Interface0D.\n" +" :rtype: :class:`ViewShape`\n"; + +static int GetOccludeeF0D___init__( BPy_GetOccludeeF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetOccludeeF0D(); + self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetOccludeeF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetOccludeeF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetOccludeeF0D objects", /* tp_doc */ + GetOccludeeF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetOccludeeF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetOccludeeF0D___init__( BPy_GetOccludeeF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetOccludeeF0D(); - self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp index 7a74a059e59..331ee590b91 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetShapeF0D instance -----------*/ -static int GetShapeF0D___init__(BPy_GetShapeF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetShapeF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetShapeF0D.cpp object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the :class:`ViewShape` containing the Interface0D pointed\n" +" by the Interface0DIterator.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The ViewShape containing the pointed Interface0D.\n" +" :rtype: :class:`ViewShape`\n"; + +static int GetShapeF0D___init__( BPy_GetShapeF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetShapeF0D(); + self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetShapeF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetShapeF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetShapeF0D objects", /* tp_doc */ + GetShapeF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetShapeF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetShapeF0D___init__( BPy_GetShapeF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetShapeF0D(); - self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp index 245b6534300..9223c7d0088 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp @@ -8,8 +8,34 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Curvature2DAngleF0D instance -----------*/ -static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char Curvature2DAngleF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a Curvature2DAngleF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns a real value giving the 2D curvature (as an angle) of the\n" +" 1D element to which the :class:`Interface0D` pointed by the\n" +" Interface0DIterator belongs. The 2D curvature is evaluated at the\n" +" Interface0D.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The 2D curvature of the 1D element evaluated at the\n" +" pointed Interface0D.\n" +" :rtype: float\n"; + +static int Curvature2DAngleF0D___init__( BPy_Curvature2DAngleF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::Curvature2DAngleF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_Curvature2DAngleF0D type definition ------------------------------*/ @@ -34,7 +60,7 @@ PyTypeObject Curvature2DAngleF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Curvature2DAngleF0D objects", /* tp_doc */ + Curvature2DAngleF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +80,6 @@ PyTypeObject Curvature2DAngleF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int Curvature2DAngleF0D___init__( BPy_Curvature2DAngleF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::Curvature2DAngleF0D(); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp index d8b9a13f5b1..4b2f56104a2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp @@ -8,8 +8,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for DensityF0D instance -----------*/ -static int DensityF0D___init__(BPy_DensityF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char DensityF0D___doc__[] = +".. method:: __init__(sigma=2.0)\n" +"\n" +" Builds a DensityF0D object.\n" +"\n" +" :arg sigma: The gaussian sigma value ndicating the X value for\n" +" which the gaussian function is 0.5. It leads to the window size\n" +" value (the larger, the smoother).\n" +" :type sigma: float\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the density of the (result) image evaluated at the\n" +" :class:`Interface0D` pointed by the Interface0DIterator. This\n" +" density is evaluated using a pixels square window around the\n" +" evaluation point and integrating these values using a gaussian.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The density of the image evaluated at the pointed\n" +" Interface0D.\n" +" :rtype: float\n"; + +static int DensityF0D___init__( BPy_DensityF0D* self, PyObject *args) +{ + double d = 2; + + if( !PyArg_ParseTuple(args, "|d", &d) ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::DensityF0D(d); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_DensityF0D type definition ------------------------------*/ @@ -34,7 +67,7 @@ PyTypeObject DensityF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "DensityF0D objects", /* tp_doc */ + DensityF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +87,6 @@ PyTypeObject DensityF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int DensityF0D___init__( BPy_DensityF0D* self, PyObject *args) -{ - double d = 2; - - if( !PyArg_ParseTuple(args, "|d", &d) ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::DensityF0D(d); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp index 741a07614d7..f11555a1e3c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetProjectedXF0D instance -----------*/ -static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetProjectedXF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetProjectedXF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the X 3D projected coordinate of the :class:`Interface0D`\n" +" pointed by the Interface0DIterator.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The X 3D projected coordinate of the pointed Interface0D.\n" +" :rtype: float\n"; + +static int GetProjectedXF0D___init__( BPy_GetProjectedXF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedXF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetProjectedXF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetProjectedXF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetProjectedXF0D objects", /* tp_doc */ + GetProjectedXF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetProjectedXF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetProjectedXF0D___init__( BPy_GetProjectedXF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedXF0D(); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp index 4bf2e3134ad..fa00514869a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetProjectedYF0D instance -----------*/ -static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetProjectedYF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetProjectedYF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the Y 3D projected coordinate of the :class:`Interface0D`\n" +" pointed by the Interface0DIterator.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The Y 3D projected coordinate of the pointed Interface0D.\n" +" :rtype: float\n"; + +static int GetProjectedYF0D___init__( BPy_GetProjectedYF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedYF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetProjectedYF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetProjectedYF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetProjectedYF0D objects", /* tp_doc */ + GetProjectedYF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetProjectedYF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetProjectedYF0D___init__( BPy_GetProjectedYF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedYF0D(); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp index d463f446694..19f61fc8203 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetProjectedZF0D instance -----------*/ -static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetProjectedZF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetProjectedZF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the Z 3D projected coordinate of the :class:`Interface0D`\n" +" pointed by the Interface0DIterator.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The Z 3D projected coordinate of the pointed Interface0D.\n" +" :rtype: float\n"; + +static int GetProjectedZF0D___init__( BPy_GetProjectedZF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedZF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetProjectedZF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetProjectedZF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetProjectedZF0D objects", /* tp_doc */ + GetProjectedZF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetProjectedZF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetProjectedZF0D___init__( BPy_GetProjectedZF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedZF0D(); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp index 8f524a8128b..0dde08e6f35 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetXF0D instance -----------*/ -static int GetXF0D___init__(BPy_GetXF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetXF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetXF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the X 3D coordinate of the :class:`Interface0D` pointed by\n" +" the Interface0DIterator.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The X 3D coordinate of the pointed Interface0D.\n" +" :rtype: float\n"; + +static int GetXF0D___init__( BPy_GetXF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::GetXF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetXF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetXF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetXF0D objects", /* tp_doc */ + GetXF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetXF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetXF0D___init__( BPy_GetXF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::GetXF0D(); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp index df497e93944..4775c65c199 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetYF0D instance -----------*/ -static int GetYF0D___init__(BPy_GetYF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetYF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetYF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the Y 3D coordinate of the :class:`Interface0D` pointed by\n" +" the Interface0DIterator.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The Y 3D coordinate of the pointed Interface0D.\n" +" :rtype: float\n"; + +static int GetYF0D___init__( BPy_GetYF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::GetYF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetYF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetYF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetYF0D objects", /* tp_doc */ + GetYF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetYF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetYF0D___init__( BPy_GetYF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::GetYF0D(); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp index 45d3a5e0a2e..7a5fdfadf92 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetZF0D instance -----------*/ -static int GetZF0D___init__(BPy_GetZF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetZF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetZF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the Z 3D coordinate of the :class:`Interface0D` pointed by\n" +" the Interface0DIterator.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The Z 3D coordinate of the pointed Interface0D.\n" +" :rtype: float\n"; + +static int GetZF0D___init__( BPy_GetZF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::GetZF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetZF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetZF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetZF0D objects", /* tp_doc */ + GetZF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetZF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetZF0D___init__( BPy_GetZF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::GetZF0D(); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp index 3b8a0490fb9..5c07913100e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp @@ -8,8 +8,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for LocalAverageDepthF0D instance -----------*/ -static int LocalAverageDepthF0D___init__(BPy_LocalAverageDepthF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char LocalAverageDepthF0D___doc__[] = +".. method:: __init__(maskSize=5.0)\n" +"\n" +" Builds a LocalAverageDepthF0D object.\n" +"\n" +" :arg maskSize: The size of the mask.\n" +" :type maskSize: float\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the average depth around the :class:`Interface0D` pointed\n" +" by the Interface0DIterator. The result is obtained by querying the\n" +" depth buffer on a window around that point.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The average depth around the pointed Interface0D.\n" +" :rtype: float\n"; + +static int LocalAverageDepthF0D___init__( BPy_LocalAverageDepthF0D* self, PyObject *args) +{ + double d = 5.0; + + if( !PyArg_ParseTuple(args, "|d", &d) ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::LocalAverageDepthF0D(d); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_LocalAverageDepthF0D type definition ------------------------------*/ @@ -34,7 +63,7 @@ PyTypeObject LocalAverageDepthF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "LocalAverageDepthF0D objects", /* tp_doc */ + LocalAverageDepthF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +83,6 @@ PyTypeObject LocalAverageDepthF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int LocalAverageDepthF0D___init__( BPy_LocalAverageDepthF0D* self, PyObject *args) -{ - double d = 5.0; - - if( !PyArg_ParseTuple(args, "|d", &d) ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::LocalAverageDepthF0D(d); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp index 4aaabbd919f..f9bcbb6ee21 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp @@ -8,8 +8,36 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ZDiscontinuityF0D instance -----------*/ -static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ZDiscontinuityF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a ZDiscontinuityF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns a real value giving the distance between the\n" +" :class:`Interface0D` pointed by the Interface0DIterator and the\n" +" shape that lies behind (occludee). This distance is evaluated in\n" +" the camera space and normalized between 0 and 1. Therefore, if no\n" +" oject is occluded by the shape to which the Interface0D belongs to,\n" +" 1 is returned.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The normalized distance between the pointed Interface0D\n" +" and the occludee.\n" +" :rtype: float\n"; + +static int ZDiscontinuityF0D___init__( BPy_ZDiscontinuityF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_double.uf0D_double = new Functions0D::ZDiscontinuityF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_ZDiscontinuityF0D type definition ------------------------------*/ @@ -34,7 +62,7 @@ PyTypeObject ZDiscontinuityF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ZDiscontinuityF0D objects", /* tp_doc */ + ZDiscontinuityF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +82,6 @@ PyTypeObject ZDiscontinuityF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ZDiscontinuityF0D___init__( BPy_ZDiscontinuityF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_double.uf0D_double = new Functions0D::ZDiscontinuityF0D(); - self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp index 06af72a45fd..9dfcf776103 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp @@ -8,8 +8,32 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetCurvilinearAbscissaF0D instance -----------*/ -static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetCurvilinearAbscissaF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetCurvilinearAbscissaF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the curvilinear abscissa of the :class:`Interface0D`\n" +" pointed by the Interface0DIterator in the context of its 1D\n" +" element.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The curvilinear abscissa of the pointed Interface0D.\n" +" :rtype: float\n"; + +static int GetCurvilinearAbscissaF0D___init__( BPy_GetCurvilinearAbscissaF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_float.uf0D_float = new Functions0D::GetCurvilinearAbscissaF0D(); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetCurvilinearAbscissaF0D type definition ------------------------------*/ @@ -34,7 +58,7 @@ PyTypeObject GetCurvilinearAbscissaF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetCurvilinearAbscissaF0D objects", /* tp_doc */ + GetCurvilinearAbscissaF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +78,6 @@ PyTypeObject GetCurvilinearAbscissaF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetCurvilinearAbscissaF0D___init__( BPy_GetCurvilinearAbscissaF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_float.uf0D_float = new Functions0D::GetCurvilinearAbscissaF0D(); - self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp index f13d67e53d2..d8861ac2f77 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp @@ -8,8 +8,31 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetParameterF0D instance -----------*/ -static int GetParameterF0D___init__(BPy_GetParameterF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetParameterF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetParameterF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the parameter of the :class:`Interface0D` pointed by the\n" +" Interface0DIterator in the context of its 1D element.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The parameter of an Interface0D.\n" +" :rtype: float\n"; + +static int GetParameterF0D___init__( BPy_GetParameterF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_float.uf0D_float = new Functions0D::GetParameterF0D(); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetParameterF0D type definition ------------------------------*/ @@ -34,7 +57,7 @@ PyTypeObject GetParameterF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetParameterF0D objects", /* tp_doc */ + GetParameterF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +77,6 @@ PyTypeObject GetParameterF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetParameterF0D___init__( BPy_GetParameterF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_float.uf0D_float = new Functions0D::GetParameterF0D(); - self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp index 68c159d077a..b753727fbf5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp @@ -8,8 +8,38 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetViewMapGradientNormF0D instance -----------*/ -static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetViewMapGradientNormF0D___doc__[] = +".. method:: __init__(level)\n" +"\n" +" Builds a GetViewMapGradientNormF0D object.\n" +"\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the norm of the gradient of the global viewmap density\n" +" image.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The norm of the gradient of the global viewmap density\n" +" image.\n" +" :rtype: float\n"; + +static int GetViewMapGradientNormF0D___init__( BPy_GetViewMapGradientNormF0D* self, PyObject *args) +{ + int i; + + if( !PyArg_ParseTuple(args, "i", &i) ) + return -1; + self->py_uf0D_float.uf0D_float = new Functions0D::GetViewMapGradientNormF0D(i); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetViewMapGradientNormF0D type definition ------------------------------*/ @@ -34,7 +64,7 @@ PyTypeObject GetViewMapGradientNormF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetViewMapGradientNormF0D objects", /* tp_doc */ + GetViewMapGradientNormF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +84,6 @@ PyTypeObject GetViewMapGradientNormF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetViewMapGradientNormF0D___init__( BPy_GetViewMapGradientNormF0D* self, PyObject *args) -{ - int i; - - if( !PyArg_ParseTuple(args, "i", &i) ) - return -1; - self->py_uf0D_float.uf0D_float = new Functions0D::GetViewMapGradientNormF0D(i); - self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp index 619e59757f0..660f2b9f0c5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp @@ -8,8 +8,36 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ReadCompleteViewMapPixelF0D instance -----------*/ - static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ReadCompleteViewMapPixelF0D___doc__[] = +".. method:: __init__(level)\n" +"\n" +" Builds a ReadCompleteViewMapPixelF0D object.\n" +"\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Reads a pixel in one of the level of the complete viewmap.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: A pixel in one of the level of the complete viewmap.\n" +" :rtype: float\n"; + +static int ReadCompleteViewMapPixelF0D___init__( BPy_ReadCompleteViewMapPixelF0D* self, PyObject *args) +{ + int i; + + if( !PyArg_ParseTuple(args, "i", &i) ) + return -1; + self->py_uf0D_float.uf0D_float = new Functions0D::ReadCompleteViewMapPixelF0D(i); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_ReadCompleteViewMapPixelF0D type definition ------------------------------*/ @@ -34,7 +62,7 @@ PyTypeObject ReadCompleteViewMapPixelF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ReadCompleteViewMapPixelF0D objects", /* tp_doc */ + ReadCompleteViewMapPixelF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +82,6 @@ PyTypeObject ReadCompleteViewMapPixelF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ReadCompleteViewMapPixelF0D___init__( BPy_ReadCompleteViewMapPixelF0D* self, PyObject *args) -{ - int i; - - if( !PyArg_ParseTuple(args, "i", &i) ) - return -1; - self->py_uf0D_float.uf0D_float = new Functions0D::ReadCompleteViewMapPixelF0D(i); - self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp index b7e656ca842..6826bda4c09 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp @@ -8,8 +8,39 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ReadMapPixelF0D instance -----------*/ -static int ReadMapPixelF0D___init__(BPy_ReadMapPixelF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ReadMapPixelF0D___doc__[] = +".. method:: __init__(iMapName, level)\n" +"\n" +" Builds a ReadMapPixelF0D object.\n" +"\n" +" :arg iMapName: The name of the map to be read.\n" +" :type iMapName: string\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Reads a pixel in a map.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: A pixel in a map.\n" +" :rtype: float\n"; + +static int ReadMapPixelF0D___init__( BPy_ReadMapPixelF0D* self, PyObject *args) +{ + const char *s; + int i; + + if( !PyArg_ParseTuple(args, "si", &s, &i) ) + return -1; + self->py_uf0D_float.uf0D_float = new Functions0D::ReadMapPixelF0D(s,i); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_ReadMapPixelF0D type definition ------------------------------*/ @@ -34,7 +65,7 @@ PyTypeObject ReadMapPixelF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ReadMapPixelF0D objects", /* tp_doc */ + ReadMapPixelF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,20 +85,6 @@ PyTypeObject ReadMapPixelF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ReadMapPixelF0D___init__( BPy_ReadMapPixelF0D* self, PyObject *args) -{ - const char *s; - int i; - - if( !PyArg_ParseTuple(args, "si", &s, &i) ) - return -1; - self->py_uf0D_float.uf0D_float = new Functions0D::ReadMapPixelF0D(s,i); - self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index bf6e004f2e3..5d551d9b910 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -8,8 +8,40 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ReadSteerableViewMapPixelF0D instance -----------*/ -static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ReadSteerableViewMapPixelF0D___doc__[] = +".. method:: __init__(nOrientation, level)\n" +"\n" +" Builds a ReadSteerableViewMapPixelF0D object.\n" +"\n" +" :arg nOrientation: The integer belonging to [0, 4] indicating the\n" +" orientation (E, NE, N, NW) we are interested in.\n" +" :type nOrientation: int\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Reads a pixel in one of the level of one of the steerable viewmaps.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: A pixel in one of the level of one of the steerable viewmaps.\n" +" :rtype: float\n"; + +static int ReadSteerableViewMapPixelF0D___init__( BPy_ReadSteerableViewMapPixelF0D* self, PyObject *args) +{ + unsigned int u; + int i; + + if( !PyArg_ParseTuple(args, "Ii", &u, &i) ) + return -1; + self->py_uf0D_float.uf0D_float = new Functions0D::ReadSteerableViewMapPixelF0D(u,i); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_ReadSteerableViewMapPixelF0D type definition ------------------------------*/ @@ -34,7 +66,7 @@ PyTypeObject ReadSteerableViewMapPixelF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ReadSteerableViewMapPixelF0D objects", /* tp_doc */ + ReadSteerableViewMapPixelF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,20 +86,6 @@ PyTypeObject ReadSteerableViewMapPixelF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ReadSteerableViewMapPixelF0D___init__( BPy_ReadSteerableViewMapPixelF0D* self, PyObject *args) -{ - unsigned int u; - int i; - - if( !PyArg_ParseTuple(args, "Ii", &u, &i) ) - return -1; - self->py_uf0D_float.uf0D_float = new Functions0D::ReadSteerableViewMapPixelF0D(u,i); - self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp index c61c458a85f..91093e482ff 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp @@ -8,8 +8,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for QuantitativeInvisibilityF0D instance -----------*/ -static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char QuantitativeInvisibilityF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a QuantitativeInvisibilityF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns the quantitative invisibility of the :class:`Interface0D`\n" +" pointed by the Interface0DIterator. This evaluation can be\n" +" ambiguous (in the case of a :class:`TVertex` for example). This\n" +" functor tries to remove this ambiguity using the context offered by\n" +" the 1D element to which the Interface0D belongs to. However, there\n" +" still can be problematic cases, and the user willing to deal with\n" +" this cases in a specific way should implement its own getQIF0D\n" +" functor.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: The quantitative invisibility of the pointed Interface0D.\n" +" :rtype: int\n"; + +static int QuantitativeInvisibilityF0D___init__( BPy_QuantitativeInvisibilityF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_unsigned.uf0D_unsigned = new Functions0D::QuantitativeInvisibilityF0D(); + self->py_uf0D_unsigned.uf0D_unsigned->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_QuantitativeInvisibilityF0D type definition ------------------------------*/ @@ -34,7 +63,7 @@ PyTypeObject QuantitativeInvisibilityF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "QuantitativeInvisibilityF0D objects", /* tp_doc */ + QuantitativeInvisibilityF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +83,6 @@ PyTypeObject QuantitativeInvisibilityF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int QuantitativeInvisibilityF0D___init__( BPy_QuantitativeInvisibilityF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_unsigned.uf0D_unsigned = new Functions0D::QuantitativeInvisibilityF0D(); - self->py_uf0D_unsigned.uf0D_unsigned->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp index f351d266a80..943d1950016 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp @@ -8,8 +8,32 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetOccludersF0D instance -----------*/ -static int GetOccludersF0D___init__(BPy_GetOccludersF0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GetOccludersF0D___doc__[] = +".. method:: __init__()\n" +"\n" +" Builds a GetOccludersF0D object.\n" +"\n" +".. method:: __call__(it)\n" +"\n" +" Returns a list of :class:`ViewShape` objects occluding the\n" +" :class:`Interface0D` pointed by the Interface0DIterator.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: A list of ViewShape objects occluding the pointed\n" +" Interface0D.\n" +" :rtype: list of :class:`ViewShape` objects\n"; + +static int GetOccludersF0D___init__( BPy_GetOccludersF0D* self, PyObject *args ) +{ + if( !PyArg_ParseTuple(args, "") ) + return -1; + self->py_uf0D_vectorviewshape.uf0D_vectorviewshape = new Functions0D::GetOccludersF0D(); + self->py_uf0D_vectorviewshape.uf0D_vectorviewshape->py_uf0D = (PyObject *)self; + return 0; +} /*-----------------------BPy_GetOccludersF0D type definition ------------------------------*/ @@ -34,7 +58,7 @@ PyTypeObject GetOccludersF0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetOccludersF0D objects", /* tp_doc */ + GetOccludersF0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,17 +78,6 @@ PyTypeObject GetOccludersF0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GetOccludersF0D___init__( BPy_GetOccludersF0D* self, PyObject *args ) -{ - if( !PyArg_ParseTuple(args, "") ) - return -1; - self->py_uf0D_vectorviewshape.uf0D_vectorviewshape = new Functions0D::GetOccludersF0D(); - self->py_uf0D_vectorviewshape.uf0D_vectorviewshape->py_uf0D = (PyObject *)self; - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index f6cb776fb70..7721b35b2a8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -26,67 +26,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1DDouble instance -----------*/ -static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *args); -static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble* self); -static PyObject * UnaryFunction1DDouble___repr__(BPy_UnaryFunction1DDouble* self); - -static PyObject * UnaryFunction1DDouble_getName( BPy_UnaryFunction1DDouble *self); -static PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds); -static PyObject * UnaryFunction1DDouble_setIntegrationType(BPy_UnaryFunction1DDouble* self, PyObject *args); -static PyObject * UnaryFunction1DDouble_getIntegrationType(BPy_UnaryFunction1DDouble* self); - -/*----------------------UnaryFunction1DDouble instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DDouble_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DDouble_getName, METH_NOARGS, "() Returns the string of the name of the unary 1D function."}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DDouble_setIntegrationType, METH_VARARGS, "(IntegrationType i) Sets the integration method" }, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DDouble_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, - {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 objects", /* 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 */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1DDouble_Init( PyObject *module ) { @@ -174,7 +113,23 @@ int UnaryFunction1DDouble_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *args) +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; @@ -192,25 +147,32 @@ int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *ar return 0; } -void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble* self) +static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble* self) { if (self->uf1D_double) delete self->uf1D_double; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction1DDouble___repr__(BPy_UnaryFunction1DDouble* self) +static PyObject * UnaryFunction1DDouble___repr__(BPy_UnaryFunction1DDouble* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_double->getName().c_str(), self->uf1D_double ); } -PyObject * UnaryFunction1DDouble_getName( BPy_UnaryFunction1DDouble *self ) +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: string\n"; + +static PyObject * UnaryFunction1DDouble_getName( BPy_UnaryFunction1DDouble *self ) { return PyUnicode_FromFormat( self->uf1D_double->getName().c_str() ); } -PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -236,7 +198,15 @@ PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyOb } -PyObject * UnaryFunction1DDouble_setIntegrationType(BPy_UnaryFunction1DDouble* self, PyObject *args) +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; @@ -247,10 +217,68 @@ PyObject * UnaryFunction1DDouble_setIntegrationType(BPy_UnaryFunction1DDouble* s Py_RETURN_NONE; } -PyObject * UnaryFunction1DDouble_getIntegrationType(BPy_UnaryFunction1DDouble* self) { +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 */ +}; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index b870d3bccbe..9cff857cdbe 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -12,67 +12,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1DEdgeNature instance -----------*/ -static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyObject *args); -static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* self); -static PyObject * UnaryFunction1DEdgeNature___repr__(BPy_UnaryFunction1DEdgeNature* self); - -static PyObject * UnaryFunction1DEdgeNature_getName( BPy_UnaryFunction1DEdgeNature *self); -static PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds); -static PyObject * UnaryFunction1DEdgeNature_setIntegrationType(BPy_UnaryFunction1DEdgeNature* self, PyObject *args); -static PyObject * UnaryFunction1DEdgeNature_getIntegrationType(BPy_UnaryFunction1DEdgeNature* self); - -/*----------------------UnaryFunction1DEdgeNature instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DEdgeNature_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DEdgeNature_getName, METH_NOARGS, "() Returns the string of the name of the unary 1D function."}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DEdgeNature_setIntegrationType, METH_VARARGS, "(IntegrationType i) Sets the integration method" }, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DEdgeNature_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, - {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 objects", /* 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 */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1DEdgeNature_Init( PyObject *module ) { @@ -95,7 +34,23 @@ int UnaryFunction1DEdgeNature_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyObject *args) +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; @@ -112,25 +67,33 @@ int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyOb return 0; } -void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* self) + +static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* self) { if (self->uf1D_edgenature) delete self->uf1D_edgenature; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction1DEdgeNature___repr__(BPy_UnaryFunction1DEdgeNature* self) +static PyObject * UnaryFunction1DEdgeNature___repr__(BPy_UnaryFunction1DEdgeNature* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_edgenature->getName().c_str(), self->uf1D_edgenature ); } -PyObject * UnaryFunction1DEdgeNature_getName( BPy_UnaryFunction1DEdgeNature *self ) +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: string\n"; + +static PyObject * UnaryFunction1DEdgeNature_getName( BPy_UnaryFunction1DEdgeNature *self ) { return PyUnicode_FromFormat( self->uf1D_edgenature->getName().c_str() ); } -PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -156,7 +119,15 @@ PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *se } -PyObject * UnaryFunction1DEdgeNature_setIntegrationType(BPy_UnaryFunction1DEdgeNature* self, PyObject *args) +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; @@ -167,10 +138,69 @@ PyObject * UnaryFunction1DEdgeNature_setIntegrationType(BPy_UnaryFunction1DEdgeN Py_RETURN_NONE; } -PyObject * UnaryFunction1DEdgeNature_getIntegrationType(BPy_UnaryFunction1DEdgeNature* self) { +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 diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index cf55129e3db..ff20ee6d7c4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -10,67 +10,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1DFloat instance -----------*/ -static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args); -static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self); -static PyObject * UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat* self); - -static PyObject * UnaryFunction1DFloat_getName( BPy_UnaryFunction1DFloat *self); -static PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds); -static PyObject * UnaryFunction1DFloat_setIntegrationType(BPy_UnaryFunction1DFloat* self, PyObject *args); -static PyObject * UnaryFunction1DFloat_getIntegrationType(BPy_UnaryFunction1DFloat* self); - -/*----------------------UnaryFunction1DFloat instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DFloat_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DFloat_getName, METH_NOARGS, "() Returns the string of the name of the unary 1D function."}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DFloat_setIntegrationType, METH_VARARGS, "(IntegrationType i) Sets the integration method" }, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DFloat_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, - {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 objects", /* 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 */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1DFloat_Init( PyObject *module ) { @@ -88,7 +27,23 @@ int UnaryFunction1DFloat_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args) +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; @@ -105,25 +60,33 @@ int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args return 0; } -void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self) + +static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self) { if (self->uf1D_float) delete self->uf1D_float; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat* self) +static PyObject * UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_float->getName().c_str(), self->uf1D_float ); } -PyObject * UnaryFunction1DFloat_getName( BPy_UnaryFunction1DFloat *self ) +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: string\n"; + +static PyObject * UnaryFunction1DFloat_getName( BPy_UnaryFunction1DFloat *self ) { return PyUnicode_FromFormat( self->uf1D_float->getName().c_str() ); } -PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -149,7 +112,15 @@ PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObje } -PyObject * UnaryFunction1DFloat_setIntegrationType(BPy_UnaryFunction1DFloat* self, PyObject *args) +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; @@ -160,10 +131,69 @@ PyObject * UnaryFunction1DFloat_setIntegrationType(BPy_UnaryFunction1DFloat* sel Py_RETURN_NONE; } -PyObject * UnaryFunction1DFloat_getIntegrationType(BPy_UnaryFunction1DFloat* self) { +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 diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index 7c068981794..bbdfd8dc4f2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -12,67 +12,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1DUnsigned instance -----------*/ -static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject *args); -static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* self); -static PyObject * UnaryFunction1DUnsigned___repr__(BPy_UnaryFunction1DUnsigned* self); - -static PyObject * UnaryFunction1DUnsigned_getName( BPy_UnaryFunction1DUnsigned *self); -static PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds); -static PyObject * UnaryFunction1DUnsigned_setIntegrationType(BPy_UnaryFunction1DUnsigned* self, PyObject *args); -static PyObject * UnaryFunction1DUnsigned_getIntegrationType(BPy_UnaryFunction1DUnsigned* self); - -/*----------------------UnaryFunction1DUnsigned instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DUnsigned_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DUnsigned_getName, METH_NOARGS, "() Returns the string of the name of the unary 1D function."}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DUnsigned_setIntegrationType, METH_VARARGS, "(IntegrationType i) Sets the integration method" }, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DUnsigned_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, - {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 objects", /* 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 */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1DUnsigned_Init( PyObject *module ) { @@ -95,7 +34,23 @@ int UnaryFunction1DUnsigned_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject *args) +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; @@ -112,25 +67,33 @@ int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject return 0; } -void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* self) + +static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* self) { if (self->uf1D_unsigned) delete self->uf1D_unsigned; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction1DUnsigned___repr__(BPy_UnaryFunction1DUnsigned* self) +static PyObject * UnaryFunction1DUnsigned___repr__(BPy_UnaryFunction1DUnsigned* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_unsigned->getName().c_str(), self->uf1D_unsigned ); } -PyObject * UnaryFunction1DUnsigned_getName( BPy_UnaryFunction1DUnsigned *self ) +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: string\n"; + +static PyObject * UnaryFunction1DUnsigned_getName( BPy_UnaryFunction1DUnsigned *self ) { return PyUnicode_FromFormat( self->uf1D_unsigned->getName().c_str() ); } -PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -156,7 +119,15 @@ PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, } -PyObject * UnaryFunction1DUnsigned_setIntegrationType(BPy_UnaryFunction1DUnsigned* self, PyObject *args) +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; @@ -167,10 +138,69 @@ PyObject * UnaryFunction1DUnsigned_setIntegrationType(BPy_UnaryFunction1DUnsigne Py_RETURN_NONE; } -PyObject * UnaryFunction1DUnsigned_getIntegrationType(BPy_UnaryFunction1DUnsigned* self) { +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 diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index 770aa8e50cc..1847c72bbeb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -13,67 +13,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1DVec2f instance -----------*/ -static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args); -static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self); -static PyObject * UnaryFunction1DVec2f___repr__(BPy_UnaryFunction1DVec2f* self); - -static PyObject * UnaryFunction1DVec2f_getName( BPy_UnaryFunction1DVec2f *self); -static PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds); -static PyObject * UnaryFunction1DVec2f_setIntegrationType(BPy_UnaryFunction1DVec2f* self, PyObject *args); -static PyObject * UnaryFunction1DVec2f_getIntegrationType(BPy_UnaryFunction1DVec2f* self); - -/*----------------------UnaryFunction1DVec2f instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DVec2f_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DVec2f_getName, METH_NOARGS, "() Returns the string of the name of the unary 1D function."}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVec2f_setIntegrationType, METH_VARARGS, "(IntegrationType i) Sets the integration method" }, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVec2f_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, - {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 objects", /* 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 */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1DVec2f_Init( PyObject *module ) { @@ -101,7 +40,23 @@ int UnaryFunction1DVec2f_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args) +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; @@ -118,25 +73,33 @@ int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args return 0; } -void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self) + +static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self) { if (self->uf1D_vec2f) delete self->uf1D_vec2f; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction1DVec2f___repr__(BPy_UnaryFunction1DVec2f* self) +static PyObject * UnaryFunction1DVec2f___repr__(BPy_UnaryFunction1DVec2f* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec2f->getName().c_str(), self->uf1D_vec2f ); } -PyObject * UnaryFunction1DVec2f_getName( BPy_UnaryFunction1DVec2f *self ) +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: string\n"; + +static PyObject * UnaryFunction1DVec2f_getName( BPy_UnaryFunction1DVec2f *self ) { return PyUnicode_FromFormat( self->uf1D_vec2f->getName().c_str() ); } -PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -162,7 +125,15 @@ PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObje } -PyObject * UnaryFunction1DVec2f_setIntegrationType(BPy_UnaryFunction1DVec2f* self, PyObject *args) +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; @@ -173,10 +144,69 @@ PyObject * UnaryFunction1DVec2f_setIntegrationType(BPy_UnaryFunction1DVec2f* sel Py_RETURN_NONE; } -PyObject * UnaryFunction1DVec2f_getIntegrationType(BPy_UnaryFunction1DVec2f* self) { +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 diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 05ba1175690..ae31fd5c9fd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -12,67 +12,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1DVec3f instance -----------*/ -static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f* self, PyObject *args); -static void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self); -static PyObject * UnaryFunction1DVec3f___repr__(BPy_UnaryFunction1DVec3f* self); - -static PyObject * UnaryFunction1DVec3f_getName( BPy_UnaryFunction1DVec3f *self); -static PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds); -static PyObject * UnaryFunction1DVec3f_setIntegrationType(BPy_UnaryFunction1DVec3f* self, PyObject *args); -static PyObject * UnaryFunction1DVec3f_getIntegrationType(BPy_UnaryFunction1DVec3f* self); - -/*----------------------UnaryFunction1DVec3f instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DVec3f_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DVec3f_getName, METH_NOARGS, "() Returns the string of the name of the unary 1D function."}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVec3f_setIntegrationType, METH_VARARGS, "(IntegrationType i) Sets the integration method" }, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVec3f_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, - {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 objects", /* 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 */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1DVec3f_Init( PyObject *module ) { @@ -95,6 +34,22 @@ int UnaryFunction1DVec3f_Init( PyObject *module ) { //------------------------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; @@ -125,6 +80,14 @@ 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: string\n"; + PyObject * UnaryFunction1DVec3f_getName( BPy_UnaryFunction1DVec3f *self ) { return PyUnicode_FromFormat( self->uf1D_vec3f->getName().c_str() ); @@ -156,6 +119,14 @@ PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObje } +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; @@ -167,10 +138,69 @@ PyObject * UnaryFunction1DVec3f_setIntegrationType(BPy_UnaryFunction1DVec3f* sel 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 diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index f3730c6c19f..4a0787e24cc 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -14,67 +14,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1DVectorViewShape instance -----------*/ -static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args); -static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVectorViewShape* self); -static PyObject * UnaryFunction1DVectorViewShape___repr__(BPy_UnaryFunction1DVectorViewShape* self); - -static PyObject * UnaryFunction1DVectorViewShape_getName( BPy_UnaryFunction1DVectorViewShape *self); -static PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds); -static PyObject * UnaryFunction1DVectorViewShape_setIntegrationType(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args); -static PyObject * UnaryFunction1DVectorViewShape_getIntegrationType(BPy_UnaryFunction1DVectorViewShape* self); - -/*----------------------UnaryFunction1DVectorViewShape instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DVectorViewShape_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DVectorViewShape_getName, METH_NOARGS, "() Returns the string of the name of the unary 1D function."}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVectorViewShape_setIntegrationType, METH_VARARGS, "(IntegrationType i) Sets the integration method" }, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVectorViewShape_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, - {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 objects", /* 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 */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1DVectorViewShape_Init( PyObject *module ) { @@ -105,10 +44,26 @@ int UnaryFunction1DVectorViewShape_Init( PyObject *module ) { return 0; } - //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args) +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; @@ -126,25 +81,32 @@ int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* return 0; } -void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVectorViewShape* self) +static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVectorViewShape* self) { if (self->uf1D_vectorviewshape) delete self->uf1D_vectorviewshape; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction1DVectorViewShape___repr__(BPy_UnaryFunction1DVectorViewShape* self) +static PyObject * UnaryFunction1DVectorViewShape___repr__(BPy_UnaryFunction1DVectorViewShape* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vectorviewshape->getName().c_str(), self->uf1D_vectorviewshape ); } -PyObject * UnaryFunction1DVectorViewShape_getName( BPy_UnaryFunction1DVectorViewShape *self ) +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: string\n"; + +static PyObject * UnaryFunction1DVectorViewShape_getName( BPy_UnaryFunction1DVectorViewShape *self ) { return PyUnicode_FromFormat( self->uf1D_vectorviewshape->getName().c_str() ); } -PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -174,7 +136,15 @@ PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorVie return list; } -PyObject * UnaryFunction1DVectorViewShape_setIntegrationType(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args) +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; @@ -185,10 +155,69 @@ PyObject * UnaryFunction1DVectorViewShape_setIntegrationType(BPy_UnaryFunction1D Py_RETURN_NONE; } -PyObject * UnaryFunction1DVectorViewShape_getIntegrationType(BPy_UnaryFunction1DVectorViewShape* self) { +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 diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index f8166437d09..ddc75d34462 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -15,68 +15,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for UnaryFunction1DVoid instance -----------*/ -static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args); -static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid* self); -static PyObject * UnaryFunction1DVoid___repr__(BPy_UnaryFunction1DVoid* self); - -static PyObject * UnaryFunction1DVoid_getName( BPy_UnaryFunction1DVoid *self); -static PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds); - -static PyObject * UnaryFunction1DVoid_setIntegrationType(BPy_UnaryFunction1DVoid* self, PyObject *args); -static PyObject * UnaryFunction1DVoid_getIntegrationType(BPy_UnaryFunction1DVoid* self); - -/*----------------------UnaryFunction1DVoid instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DVoid_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DVoid_getName, METH_NOARGS, "() Returns the string of the name of the unary 1D function."}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVoid_setIntegrationType, METH_VARARGS, "(IntegrationType i) Sets the integration method" }, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVoid_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, - {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 objects", /* 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 */ -}; - //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1DVoid_Init( PyObject *module ) { @@ -109,7 +47,23 @@ int UnaryFunction1DVoid_Init( PyObject *module ) { //------------------------INSTANCE METHODS ---------------------------------- -int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args) +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; @@ -127,25 +81,32 @@ int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args) return 0; } -void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid* self) +static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid* self) { if (self->uf1D_void) delete self->uf1D_void; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } - -PyObject * UnaryFunction1DVoid___repr__(BPy_UnaryFunction1DVoid* self) +static PyObject * UnaryFunction1DVoid___repr__(BPy_UnaryFunction1DVoid* self) { return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_void->getName().c_str(), self->uf1D_void ); } -PyObject * UnaryFunction1DVoid_getName( BPy_UnaryFunction1DVoid *self ) +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: string\n"; + +static PyObject * UnaryFunction1DVoid_getName( BPy_UnaryFunction1DVoid *self ) { return PyUnicode_FromFormat( self->uf1D_void->getName().c_str() ); } -PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) { PyObject *obj; @@ -170,7 +131,15 @@ PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject Py_RETURN_NONE; } -PyObject * UnaryFunction1DVoid_setIntegrationType(BPy_UnaryFunction1DVoid* self, PyObject *args) +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; @@ -181,10 +150,68 @@ PyObject * UnaryFunction1DVoid_setIntegrationType(BPy_UnaryFunction1DVoid* self, Py_RETURN_NONE; } -PyObject * UnaryFunction1DVoid_getIntegrationType(BPy_UnaryFunction1DVoid* self) { +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 */ +}; /////////////////////////////////////////////////////////////////////////////////////////// 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 index 122d5bcc9b2..3ee5daec439 100644 --- 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 @@ -10,8 +10,42 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for CurveNatureF1D instance -----------*/ -static int CurveNatureF1D___init__( BPy_CurveNatureF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +70,7 @@ PyTypeObject CurveNatureF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "CurveNatureF1D objects", /* tp_doc */ + CurveNatureF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,20 +90,6 @@ PyTypeObject CurveNatureF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index f18334a0251..61c5dbd55b1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp @@ -10,8 +10,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Normal2DF1D instance -----------*/ -static int Normal2DF1D___init__( BPy_Normal2DF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +65,7 @@ PyTypeObject Normal2DF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Normal2DF1D objects", /* tp_doc */ + Normal2DF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,20 +85,6 @@ PyTypeObject Normal2DF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index c121e72d2f2..6b984c9d386 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp @@ -10,8 +10,39 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Orientation2DF1D instance -----------*/ - static int Orientation2DF1D___init__( BPy_Orientation2DF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +67,7 @@ PyTypeObject Orientation2DF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Orientation2DF1D objects", /* tp_doc */ + Orientation2DF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,22 +87,6 @@ PyTypeObject Orientation2DF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; - -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index d6acba68452..862e4af7e82 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp @@ -10,8 +10,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Orientation3DF1D instance -----------*/ -static int Orientation3DF1D___init__( BPy_Orientation3DF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +65,7 @@ PyTypeObject Orientation3DF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Orientation3DF1D objects", /* tp_doc */ + Orientation3DF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,20 +85,6 @@ PyTypeObject Orientation3DF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index c78aa624c61..da80aaa0b6e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp @@ -10,9 +10,38 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for Curvature2DAngleF1D instance -----------*/ -static int Curvature2DAngleF1D___init__(BPy_Curvature2DAngleF1D* self, PyObject *args); +//------------------------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 = { @@ -36,7 +65,7 @@ PyTypeObject Curvature2DAngleF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Curvature2DAngleF1D objects", /* tp_doc */ + Curvature2DAngleF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,20 +85,6 @@ PyTypeObject Curvature2DAngleF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; - -} /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index f30a1e1c236..7035375a3f6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp @@ -10,8 +10,52 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for DensityF1D instance -----------*/ -static int DensityF1D___init__(BPy_DensityF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +80,7 @@ PyTypeObject DensityF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "DensityF1D objects", /* tp_doc */ + DensityF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,23 +100,6 @@ PyTypeObject DensityF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; - -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index e4525a42533..5343d9e3236 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp @@ -10,8 +10,53 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetCompleteViewMapDensityF1D instance -----------*/ -static int GetCompleteViewMapDensityF1D___init__(BPy_GetCompleteViewMapDensityF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +81,7 @@ PyTypeObject GetCompleteViewMapDensityF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetCompleteViewMapDensityF1D objects", /* tp_doc */ + GetCompleteViewMapDensityF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,23 +101,6 @@ PyTypeObject GetCompleteViewMapDensityF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; - -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 689ee289a1a..5f543c30027 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -10,8 +10,57 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetDirectionalViewMapDensityF1D instance -----------*/ -static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDensityF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +85,7 @@ PyTypeObject GetDirectionalViewMapDensityF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetDirectionalViewMapDensityF1D objects", /* tp_doc */ + GetDirectionalViewMapDensityF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,23 +105,6 @@ PyTypeObject GetDirectionalViewMapDensityF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; - -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 126832c487f..3c8fa2f1f0f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp @@ -10,8 +10,38 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetProjectedXF1D instance -----------*/ -static int GetProjectedXF1D___init__(BPy_GetProjectedXF1D* self, PyObject *args ); +//------------------------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 ------------------------------*/ @@ -36,7 +66,7 @@ PyTypeObject GetProjectedXF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetProjectedXF1D objects", /* tp_doc */ + GetProjectedXF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,21 +86,6 @@ PyTypeObject GetProjectedXF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 6e27c1cfe45..ce655172778 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp @@ -10,8 +10,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetProjectedYF1D instance -----------*/ - static int GetProjectedYF1D___init__(BPy_GetProjectedYF1D* self, PyObject *args ); +//------------------------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 ------------------------------*/ @@ -36,7 +65,7 @@ PyTypeObject GetProjectedYF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetProjectedYF1D objects", /* tp_doc */ + GetProjectedYF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,20 +85,6 @@ PyTypeObject GetProjectedYF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 7d395e75ce4..df1cefeab4c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp @@ -10,8 +10,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetProjectedZF1D instance -----------*/ -static int GetProjectedZF1D___init__(BPy_GetProjectedZF1D* self, PyObject *args ); +//------------------------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 ------------------------------*/ @@ -36,7 +65,7 @@ PyTypeObject GetProjectedZF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetProjectedZF1D objects", /* tp_doc */ + GetProjectedZF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,20 +85,6 @@ PyTypeObject GetProjectedZF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index dbc7ad5bbf0..7cd08a2da0b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp @@ -10,8 +10,50 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetSteerableViewMapDensityF1D instance -----------*/ -static int GetSteerableViewMapDensityF1D___init__(BPy_GetSteerableViewMapDensityF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +78,7 @@ PyTypeObject GetSteerableViewMapDensityF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetSteerableViewMapDensityF1D objects", /* tp_doc */ + GetSteerableViewMapDensityF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,23 +98,6 @@ PyTypeObject GetSteerableViewMapDensityF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; - -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 2b9878d3fd2..b34d56b37d3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp @@ -10,8 +10,50 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetViewMapGradientNormF1D instance -----------*/ -static int GetViewMapGradientNormF1D___init__(BPy_GetViewMapGradientNormF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +78,7 @@ PyTypeObject GetViewMapGradientNormF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetViewMapGradientNormF1D objects", /* tp_doc */ + GetViewMapGradientNormF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,23 +98,6 @@ PyTypeObject GetViewMapGradientNormF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; - -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index b40969e07cd..6bbf15c0af2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp @@ -10,8 +10,38 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetXF1D instance -----------*/ -static int GetXF1D___init__(BPy_GetXF1D* self, PyObject *args ); +//------------------------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 ------------------------------*/ @@ -36,7 +66,7 @@ PyTypeObject GetXF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetXF1D objects", /* tp_doc */ + GetXF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,21 +86,6 @@ PyTypeObject GetXF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index dd38caa626c..7275ea3dcf2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp @@ -10,9 +10,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetYF1D instance -----------*/ -static int GetYF1D___init__(BPy_GetYF1D* self, PyObject *args ); +//------------------------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 = { @@ -36,7 +64,7 @@ PyTypeObject GetYF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetYF1D objects", /* tp_doc */ + GetYF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,19 +84,6 @@ PyTypeObject GetYF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index ae0ed09c390..68f4f5e4300 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp @@ -10,8 +10,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetZF1D instance -----------*/ -static int GetZF1D___init__(BPy_GetZF1D* self, PyObject *args ); +//------------------------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 ------------------------------*/ @@ -36,7 +65,7 @@ PyTypeObject GetZF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetZF1D objects", /* tp_doc */ + GetZF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,20 +85,6 @@ PyTypeObject GetZF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 23c8c9b9924..be262632466 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp @@ -10,9 +10,45 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for LocalAverageDepthF1D instance -----------*/ -static int LocalAverageDepthF1D___init__(BPy_LocalAverageDepthF1D* self, PyObject *args); +//------------------------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 = { @@ -36,7 +72,7 @@ PyTypeObject LocalAverageDepthF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "LocalAverageDepthF1D objects", /* tp_doc */ + LocalAverageDepthF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,20 +92,6 @@ PyTypeObject LocalAverageDepthF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 5a498794284..0640644ea1e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp @@ -10,8 +10,42 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ZDiscontinuityF1D instance -----------*/ -static int ZDiscontinuityF1D___init__(BPy_ZDiscontinuityF1D* self, PyObject *args ); +//------------------------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 ------------------------------*/ @@ -36,7 +70,7 @@ PyTypeObject ZDiscontinuityF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ZDiscontinuityF1D objects", /* tp_doc */ + ZDiscontinuityF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,21 +90,6 @@ PyTypeObject ZDiscontinuityF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 724284b2188..4ffa3437c69 100644 --- 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 @@ -10,8 +10,42 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for QuantitativeInvisibilityF1D instance -----------*/ -static int QuantitativeInvisibilityF1D___init__(BPy_QuantitativeInvisibilityF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +70,7 @@ PyTypeObject QuantitativeInvisibilityF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "QuantitativeInvisibilityF1D objects", /* tp_doc */ + QuantitativeInvisibilityF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,21 +90,6 @@ PyTypeObject QuantitativeInvisibilityF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; - -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index d8552ebe872..a4f49922e01 100644 --- 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 @@ -10,8 +10,29 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetOccludeeF1D instance -----------*/ -static int GetOccludeeF1D___init__(BPy_GetOccludeeF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +57,7 @@ PyTypeObject GetOccludeeF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetOccludeeF1D objects", /* tp_doc */ + GetOccludeeF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,16 +77,6 @@ PyTypeObject GetOccludeeF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 9f1d90f2f0e..f4030b5b25e 100644 --- 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 @@ -10,8 +10,29 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetOccludersF1D instance -----------*/ -static int GetOccludersF1D___init__(BPy_GetOccludersF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +57,7 @@ PyTypeObject GetOccludersF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetOccludersF1D objects", /* tp_doc */ + GetOccludersF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,16 +77,6 @@ PyTypeObject GetOccludersF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 2f6322dda26..017dbc3436d 100644 --- 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 @@ -10,8 +10,29 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GetShapeF1D instance -----------*/ -static int GetShapeF1D___init__(BPy_GetShapeF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +57,7 @@ PyTypeObject GetShapeF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GetShapeF1D objects", /* tp_doc */ + GetShapeF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,16 +77,6 @@ PyTypeObject GetShapeF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index b4b3cef8213..848e0c92843 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp @@ -10,8 +10,27 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ChainingTimeStampF1D instance -----------*/ -static int ChainingTimeStampF1D___init__(BPy_ChainingTimeStampF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +55,7 @@ PyTypeObject ChainingTimeStampF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ChainingTimeStampF1D objects", /* tp_doc */ + ChainingTimeStampF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,16 +75,6 @@ PyTypeObject ChainingTimeStampF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 99e38462b80..c1bcaacffb7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp @@ -10,8 +10,27 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for IncrementChainingTimeStampF1D instance -----------*/ -static int IncrementChainingTimeStampF1D___init__(BPy_IncrementChainingTimeStampF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +55,7 @@ PyTypeObject IncrementChainingTimeStampF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "IncrementChainingTimeStampF1D objects", /* tp_doc */ + IncrementChainingTimeStampF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,16 +75,6 @@ PyTypeObject IncrementChainingTimeStampF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 index 95b43fdb17a..e9a7f2095bb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp @@ -10,8 +10,27 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TimeStampF1D instance -----------*/ -static int TimeStampF1D___init__(BPy_TimeStampF1D* self, PyObject *args); +//------------------------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 ------------------------------*/ @@ -36,7 +55,7 @@ PyTypeObject TimeStampF1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "TimeStampF1D objects", /* tp_doc */ + TimeStampF1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,16 +75,6 @@ PyTypeObject TimeStampF1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -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; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp index a39ac9d02b3..c2c956e3eab 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp @@ -6,9 +6,25 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FalseUP0D instance -----------*/ +//------------------------INSTANCE METHODS ---------------------------------- -static int FalseUP0D___init__(BPy_FalseUP0D* self, PyObject *args); +static char FalseUP0D___doc__[] = +".. method:: __call__(it)\n" +"\n" +" Always returns false.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: False.\n" +" :rtype: bool\n"; + +static int FalseUP0D___init__( BPy_FalseUP0D* self, PyObject *args) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_up0D.up0D = new Predicates0D::FalseUP0D(); + return 0; +} /*-----------------------BPy_FalseUP0D type definition ------------------------------*/ @@ -33,7 +49,7 @@ PyTypeObject FalseUP0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "FalseUP0D objects", /* tp_doc */ + FalseUP0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -53,16 +69,6 @@ PyTypeObject FalseUP0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int FalseUP0D___init__( BPy_FalseUP0D* self, PyObject *args) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_up0D.up0D = new Predicates0D::FalseUP0D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp index f5745df534b..9097f4e38bc 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp @@ -6,8 +6,25 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TrueUP0D instance -----------*/ -static int TrueUP0D___init__(BPy_TrueUP0D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char TrueUP0D___doc__[] = +".. method:: __call__(it)\n" +"\n" +" Always returns true.\n" +"\n" +" :arg it: An Interface0DIterator object.\n" +" :type it: :class:`Interface0DIterator`\n" +" :return: True.\n" +" :rtype: bool\n"; + +static int TrueUP0D___init__( BPy_TrueUP0D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_up0D.up0D = new Predicates0D::TrueUP0D(); + return 0; +} /*-----------------------BPy_TrueUP0D type definition ------------------------------*/ @@ -32,7 +49,7 @@ PyTypeObject TrueUP0D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "TrueUP0D objects", /* tp_doc */ + TrueUP0D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,16 +69,6 @@ PyTypeObject TrueUP0D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int TrueUP0D___init__( BPy_TrueUP0D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_up0D.up0D = new Predicates0D::TrueUP0D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp index 40dae69fd8a..b5a16c3c238 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp @@ -6,8 +6,26 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ContourUP1D instance -----------*/ -static int ContourUP1D___init__(BPy_ContourUP1D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ContourUP1D___doc__[] = +".. method:: __call__(inter)\n" +"\n" +" Returns true if the Interface1D is a contour. An Interface1D is a\n" +" contour if it is borded by a different shape on each of its sides.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True if the Interface1D is a contour, false otherwise.\n" +" :rtype: bool\n"; + +static int ContourUP1D___init__( BPy_ContourUP1D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_up1D.up1D = new Predicates1D::ContourUP1D(); + return 0; +} /*-----------------------BPy_ContourUP1D type definition ------------------------------*/ @@ -32,7 +50,7 @@ PyTypeObject ContourUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ContourUP1D objects", /* tp_doc */ + ContourUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,16 +70,6 @@ PyTypeObject ContourUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ContourUP1D___init__( BPy_ContourUP1D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_up1D.up1D = new Predicates1D::ContourUP1D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp index 3e4b9924258..97bd6409bf2 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp @@ -8,8 +8,40 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for DensityLowerThanUP1D instance -----------*/ -static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char DensityLowerThanUP1D___doc__[] = +".. method:: __init__(threshold, sigma=2.0)\n" +"\n" +" Builds a DensityLowerThanUP1D object.\n" +"\n" +" :arg threshold: The value of the threshold density. Any Interface1D\n" +" having a density lower than this threshold will match.\n" +" :type threshold: float\n" +" :arg sigma: The sigma value defining the density evaluation window\n" +" size used in the :class:`DensityF0D` functor.\n" +" :type sigma: float\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns true if the density evaluated for the Interface1D is less\n" +" than a user-defined density value.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True if the density is lower than a threshold.\n" +" :rtype: bool\n"; + +static int DensityLowerThanUP1D___init__( BPy_DensityLowerThanUP1D* self, PyObject *args ) +{ + double d1, d2 = 2.0; + + if( !PyArg_ParseTuple(args, "d|d", &d1, &d2) ) + return -1; + + self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1,d2); + return 0; +} /*-----------------------BPy_DensityLowerThanUP1D type definition ------------------------------*/ @@ -34,7 +66,7 @@ PyTypeObject DensityLowerThanUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "DensityLowerThanUP1D objects", /* tp_doc */ + DensityLowerThanUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +86,6 @@ PyTypeObject DensityLowerThanUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int DensityLowerThanUP1D___init__( BPy_DensityLowerThanUP1D* self, PyObject *args ) -{ - double d1, d2 = 2.0; - - if( !PyArg_ParseTuple(args, "d|d", &d1, &d2) ) - return -1; - - self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1,d2); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp index d8db3e2ed0f..3a5c66aef59 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp @@ -6,8 +6,36 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for EqualToChainingTimeStampUP1D instance -----------*/ -static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1D* self, PyObject *args ); +//------------------------INSTANCE METHODS ---------------------------------- + +static char EqualToChainingTimeStampUP1D___doc__[] = +".. method:: __init__(ts)\n" +"\n" +" Builds a EqualToChainingTimeStampUP1D object.\n" +"\n" +" :arg ts: A time stamp value.\n" +" :type ts: int\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns true if the Interface1D's time stamp is equal to a certain\n" +" user-defined value.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True if the time stamp is equal to a user-defined value.\n" +" :rtype: bool\n"; + +static int EqualToChainingTimeStampUP1D___init__( BPy_EqualToChainingTimeStampUP1D* self, PyObject *args ) +{ + unsigned u; + + if( !PyArg_ParseTuple(args, "I", &u) ) + return -1; + + self->py_up1D.up1D = new Predicates1D::EqualToChainingTimeStampUP1D(u); + return 0; +} /*-----------------------BPy_EqualToChainingTimeStampUP1D type definition ------------------------------*/ @@ -32,7 +60,7 @@ PyTypeObject EqualToChainingTimeStampUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "EqualToChainingTimeStampUP1D objects", /* tp_doc */ + EqualToChainingTimeStampUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,19 +80,6 @@ PyTypeObject EqualToChainingTimeStampUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int EqualToChainingTimeStampUP1D___init__( BPy_EqualToChainingTimeStampUP1D* self, PyObject *args ) -{ - unsigned u; - - if( !PyArg_ParseTuple(args, "I", &u) ) - return -1; - - self->py_up1D.up1D = new Predicates1D::EqualToChainingTimeStampUP1D(u); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp index d27bf47b57a..2427f6d0169 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp @@ -6,8 +6,36 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for EqualToTimeStampUP1D instance -----------*/ -static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D* self, PyObject *args ); +//------------------------INSTANCE METHODS ---------------------------------- + +static char EqualToTimeStampUP1D___doc__[] = +".. method:: __init__(ts)\n" +"\n" +" Builds a EqualToTimeStampUP1D object.\n" +"\n" +" :arg ts: A time stamp value.\n" +" :type ts: int\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns true if the Interface1D's time stamp is equal to a certain\n" +" user-defined value.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True if the time stamp is equal to a user-defined value.\n" +" :rtype: bool\n"; + +static int EqualToTimeStampUP1D___init__( BPy_EqualToTimeStampUP1D* self, PyObject *args ) +{ + unsigned u; + + if( !PyArg_ParseTuple(args, "I", &u) ) + return -1; + + self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u); + return 0; +} /*-----------------------BPy_EqualToTimeStampUP1D type definition ------------------------------*/ @@ -32,7 +60,7 @@ PyTypeObject EqualToTimeStampUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "EqualToTimeStampUP1D objects", /* tp_doc */ + EqualToTimeStampUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,19 +80,6 @@ PyTypeObject EqualToTimeStampUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int EqualToTimeStampUP1D___init__( BPy_EqualToTimeStampUP1D* self, PyObject *args ) -{ - unsigned u; - - if( !PyArg_ParseTuple(args, "I", &u) ) - return -1; - - self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp index 09d6c5e3ae4..f94b6653c7e 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp @@ -6,8 +6,28 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ExternalContourUP1D instance -----------*/ -static int ExternalContourUP1D___init__(BPy_ExternalContourUP1D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ExternalContourUP1D___doc__[] = +".. method:: __call__(inter)\n" +"\n" +" Returns true if the Interface1D is an external contour. An\n" +" Interface1D is an external contour if it is borded by no shape on\n" +" one of its sides.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True if the Interface1D is an external contour, false\n" +" otherwise.\n" +" :rtype: bool\n"; + +static int ExternalContourUP1D___init__( BPy_ExternalContourUP1D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_up1D.up1D = new Predicates1D::ExternalContourUP1D(); + return 0; +} /*-----------------------BPy_ExternalContourUP1D type definition ------------------------------*/ @@ -32,7 +52,7 @@ PyTypeObject ExternalContourUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ExternalContourUP1D objects", /* tp_doc */ + ExternalContourUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,16 +72,6 @@ PyTypeObject ExternalContourUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ExternalContourUP1D___init__( BPy_ExternalContourUP1D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_up1D.up1D = new Predicates1D::ExternalContourUP1D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp index ada7eabe834..fa8b145f83a 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp @@ -6,8 +6,25 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for FalseUP1D instance -----------*/ -static int FalseUP1D___init__(BPy_FalseUP1D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char FalseUP1D___doc__[] = +".. method:: __call__(inter)\n" +"\n" +" Always returns false.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: False.\n" +" :rtype: bool\n"; + +static int FalseUP1D___init__( BPy_FalseUP1D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_up1D.up1D = new Predicates1D::FalseUP1D(); + return 0; +} /*-----------------------BPy_FalseUP1D type definition ------------------------------*/ @@ -32,7 +49,7 @@ PyTypeObject FalseUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "FalseUP1D objects", /* tp_doc */ + FalseUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,16 +69,6 @@ PyTypeObject FalseUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int FalseUP1D___init__( BPy_FalseUP1D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_up1D.up1D = new Predicates1D::FalseUP1D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp index b297be28d70..ebc27787776 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp @@ -6,8 +6,39 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for QuantitativeInvisibilityUP1D instance -----------*/ -static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1D* self, PyObject *args ); +//------------------------INSTANCE METHODS ---------------------------------- + +static char QuantitativeInvisibilityUP1D___doc__[] = +".. method:: __init__(qi=0)\n" +"\n" +" Builds a QuantitativeInvisibilityUP1D object.\n" +"\n" +" :arg qi: The Quantitative Invisibility you want the Interface1D to\n" +" have.\n" +" :type qi: int\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns true if the Quantitative Invisibility evaluated at an\n" +" Interface1D, using the :class:`QuantitativeInvisibilityF1D`\n" +" functor, equals a certain user-defined value.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True if Quantitative Invisibility equals a user-defined\n" +" value.\n" +" :rtype: bool\n"; + +static int QuantitativeInvisibilityUP1D___init__( BPy_QuantitativeInvisibilityUP1D* self, PyObject *args ) +{ + int i = 0; + + if( !PyArg_ParseTuple(args, "|i", &i) ) + return -1; + + self->py_up1D.up1D = new Predicates1D::QuantitativeInvisibilityUP1D(i); + return 0; +} /*-----------------------BPy_QuantitativeInvisibilityUP1D type definition ------------------------------*/ @@ -32,7 +63,7 @@ PyTypeObject QuantitativeInvisibilityUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "QuantitativeInvisibilityUP1D objects", /* tp_doc */ + QuantitativeInvisibilityUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,19 +83,6 @@ PyTypeObject QuantitativeInvisibilityUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int QuantitativeInvisibilityUP1D___init__( BPy_QuantitativeInvisibilityUP1D* self, PyObject *args ) -{ - int i = 0; - - if( !PyArg_ParseTuple(args, "|i", &i) ) - return -1; - - self->py_up1D.up1D = new Predicates1D::QuantitativeInvisibilityUP1D(i); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp index 1726bd80ae1..50a1de751fb 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp @@ -6,8 +6,39 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ShapeUP1D instance -----------*/ -static int ShapeUP1D___init__(BPy_ShapeUP1D* self, PyObject *args ); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ShapeUP1D___doc__[] = +".. method:: __init__(idFirst, idSecond=0)\n" +"\n" +" Builds a ShapeUP1D object.\n" +"\n" +" :arg idFirst: The first Id component.\n" +" :type idFirst: int\n" +" :arg idSecond: The second Id component.\n" +" :type idSecond: int\n" +"\n" +".. method:: __call__(inter)\n" +"\n" +" Returns true if the shape to which the Interface1D belongs to has\n" +" the same :class:`Id` as the one specified by the user.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True if Interface1D belongs to the shape of the\n" +" user-specified Id.\n" +" :rtype: bool\n"; + +static int ShapeUP1D___init__( BPy_ShapeUP1D* self, PyObject *args ) +{ + unsigned u1, u2 = 0; + + if( !PyArg_ParseTuple(args, "I|I", &u1, &u2) ) + return -1; + + self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1,u2); + return 0; +} /*-----------------------BPy_ShapeUP1D type definition ------------------------------*/ @@ -32,7 +63,7 @@ PyTypeObject ShapeUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ShapeUP1D objects", /* tp_doc */ + ShapeUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,19 +83,6 @@ PyTypeObject ShapeUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ShapeUP1D___init__( BPy_ShapeUP1D* self, PyObject *args ) -{ - unsigned u1, u2 = 0; - - if( !PyArg_ParseTuple(args, "I|I", &u1, &u2) ) - return -1; - - self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1,u2); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp index ea7b8d934be..320b1eb1c31 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp @@ -6,8 +6,25 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TrueUP1D instance -----------*/ -static int TrueUP1D___init__(BPy_TrueUP1D* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char TrueUP1D___doc__[] = +".. method:: __call__(inter)\n" +"\n" +" Always returns true.\n" +"\n" +" :arg inter: An Interface1D object.\n" +" :type inter: :class:`Interface1D`\n" +" :return: True.\n" +" :rtype: bool\n"; + +static int TrueUP1D___init__( BPy_TrueUP1D* self, PyObject *args ) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_up1D.up1D = new Predicates1D::TrueUP1D(); + return 0; +} /*-----------------------BPy_TrueUP1D type definition ------------------------------*/ @@ -32,7 +49,7 @@ PyTypeObject TrueUP1D_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "TrueUP1D objects", /* tp_doc */ + TrueUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -52,16 +69,6 @@ PyTypeObject TrueUP1D_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int TrueUP1D___init__( BPy_TrueUP1D* self, PyObject *args ) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_up1D.up1D = new Predicates1D::TrueUP1D(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus |