Freestyle Python API improvements - part 7.

Fix for PyGetSetDef and proper handling of keyword arguments were done in
UnaryPredicate0D, UnaryPredicate1D, BinaryPredicate1D, and StrokeShader classes.
Style modules were updated accordingly.  Additional code clean-up was also made.
This commit is contained in:
2013-02-23 01:12:23 +00:00
parent 0fb83d78fa
commit 68b0a8e390
51 changed files with 654 additions and 615 deletions

View File

@@ -39,7 +39,7 @@ bpred = TrueBP1D()
Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred) ) Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred) )
shaders_list = [ shaders_list = [
ConstantThicknessShader(4), ConstantThicknessShader(4),
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, 0), StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),
SamplingShader(2), SamplingShader(2),
pyDiffusion2Shader(offset, nbIter), pyDiffusion2Shader(offset, nbIter),
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1) IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1)

View File

@@ -33,7 +33,7 @@ from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.select(QuantitativeInvisibilityUP1D(0))
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [ shaders_list = [
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, 0), StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),
ConstantThicknessShader(5), ConstantThicknessShader(5),
py2DCurvatureColorShader() py2DCurvatureColorShader()
] ]

View File

@@ -38,7 +38,7 @@ Operators.select(QuantitativeInvisibilityUP1D(0))
Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(3,0)) Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(3,0))
shaders_list = [ shaders_list = [
SamplingShader(2), SamplingShader(2),
SpatialNoiseShader(15, 120, 2, 1, 1), SpatialNoiseShader(15, 120, 2, True, True),
IncreasingThicknessShader(5, 30), IncreasingThicknessShader(5, 30),
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1), SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
IncreasingColorShader(0,0.2,0,1,0.2,0.7,0.2,1), IncreasingColorShader(0,0.2,0,1,0.2,0.7,0.2,1),

View File

@@ -38,7 +38,7 @@ Operators.select(QuantitativeInvisibilityUP1D(0))
Operators.bidirectionalChain(pySketchyChainingIterator(3)) Operators.bidirectionalChain(pySketchyChainingIterator(3))
shaders_list = [ shaders_list = [
SamplingShader(4), SamplingShader(4),
SpatialNoiseShader(6, 120, 2, 1, 1), SpatialNoiseShader(6, 120, 2, True, True),
IncreasingThicknessShader(4, 10), IncreasingThicknessShader(4, 10),
SmoothingShader(100, 0.1, 0, 0.2, 0, 0, 0, 1), SmoothingShader(100, 0.1, 0, 0.2, 0, 0, 0, 1),
pyBackboneStretcherNoCuspShader(20), pyBackboneStretcherNoCuspShader(20),

View File

@@ -38,7 +38,7 @@ Operators.select(upred)
Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(3,1)) Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(3,1))
shaders_list = [ shaders_list = [
SamplingShader(4), SamplingShader(4),
SpatialNoiseShader(20, 220, 2, 1, 1), SpatialNoiseShader(20, 220, 2, True, True),
IncreasingThicknessShader(4, 8), IncreasingThicknessShader(4, 8),
SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5), SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5),
ConstantColorShader(0.6,0.2,0.0), ConstantColorShader(0.6,0.2,0.0),

View File

@@ -36,7 +36,7 @@ Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvi
shaders_list = [ shaders_list = [
SamplingShader(3), SamplingShader(3),
BezierCurveShader(4), BezierCurveShader(4),
StrokeTextureShader("washbrushAlpha.bmp", Stroke.DRY_MEDIUM, 1), StrokeTextureShader("washbrushAlpha.bmp", Stroke.DRY_MEDIUM, True),
ConstantThicknessShader(40), ConstantThicknessShader(40),
ConstantColorShader(0,0,0,1), ConstantColorShader(0,0,0,1),
] ]

View File

@@ -12,7 +12,7 @@ Operators.bidirectionalChain(ChainSilhouetteIterator())
#Operators.sequentialSplit(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2) #Operators.sequentialSplit(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2)
Operators.sort(pyZBP1D()) Operators.sort(pyZBP1D())
shaders_list = [ shaders_list = [
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, 0), StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),
ConstantThicknessShader(3), ConstantThicknessShader(3),
SamplingShader(5.0), SamplingShader(5.0),
ConstantColorShader(0,0,0,1) ConstantColorShader(0,0,0,1)

View File

@@ -10,15 +10,15 @@ extern "C" {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION-------------------------------- //-------------------MODULE INITIALIZATION--------------------------------
int BinaryPredicate0D_Init( PyObject *module ) int BinaryPredicate0D_Init(PyObject *module)
{ {
if( module == NULL ) if (module == NULL)
return -1; return -1;
if( PyType_Ready( &BinaryPredicate0D_Type ) < 0 ) if (PyType_Ready(&BinaryPredicate0D_Type) < 0)
return -1; return -1;
Py_INCREF( &BinaryPredicate0D_Type ); Py_INCREF(&BinaryPredicate0D_Type);
PyModule_AddObject(module, "BinaryPredicate0D", (PyObject *)&BinaryPredicate0D_Type); PyModule_AddObject(module, "BinaryPredicate0D", (PyObject *)&BinaryPredicate0D_Type);
return 0; return 0;
} }
@@ -50,11 +50,12 @@ static char BinaryPredicate0D___doc__[] =
static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds)
{ {
if ( !PyArg_ParseTuple(args, "") ) static const char *kwlist[] = {NULL};
return -1;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->bp0D = new BinaryPredicate0D(); self->bp0D = new BinaryPredicate0D();
self->bp0D->py_bp0D = (PyObject *) self; self->bp0D->py_bp0D = (PyObject *)self;
return 0; return 0;
} }
@@ -62,58 +63,53 @@ static void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D* self)
{ {
if (self->bp0D) if (self->bp0D)
delete self->bp0D; delete self->bp0D;
Py_TYPE(self)->tp_free((PyObject*)self); Py_TYPE(self)->tp_free((PyObject*)self);
} }
static 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 ); return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->bp0D);
} }
static char BinaryPredicate0D_getName___doc__[] = static PyObject * BinaryPredicate0D___call__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds)
".. method:: getName()\n"
"\n"
" Returns the name of the binary 0D predicate.\n"
"\n"
" :return: The name of the binary 0D predicate.\n"
" :rtype: str\n";
static PyObject * BinaryPredicate0D_getName( BPy_BinaryPredicate0D *self, PyObject *args)
{
return PyUnicode_FromString( self->bp0D->getName().c_str() );
}
static PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"inter1", "inter2", NULL};
BPy_Interface0D *obj1, *obj2; BPy_Interface0D *obj1, *obj2;
if( kwds != NULL ) { if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); &Interface0D_Type, &obj1, &Interface0D_Type, &obj2))
{
return NULL; return NULL;
} }
if( !PyArg_ParseTuple(args, "O!O!", &Interface0D_Type, &obj1, &Interface0D_Type, &obj2) ) if (typeid(*(self->bp0D)) == typeid(BinaryPredicate0D)) {
return NULL;
if( typeid(*(self->bp0D)) == typeid(BinaryPredicate0D) ) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
return NULL; return NULL;
} }
if (self->bp0D->operator()( *(obj1->if0D) , *(obj2->if0D) ) < 0) { if (self->bp0D->operator()(*(obj1->if0D) , *(obj2->if0D)) < 0) {
if (!PyErr_Occurred()) { if (!PyErr_Occurred()) {
string msg(self->bp0D->getName() + " __call__ method failed"); string class_name(Py_TYPE(self)->tp_name);
PyErr_SetString(PyExc_RuntimeError, msg.c_str()); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str());
} }
return NULL; return NULL;
} }
return PyBool_from_bool( self->bp0D->result ); return PyBool_from_bool(self->bp0D->result);
} }
/*----------------------BinaryPredicate0D instance definitions ----------------------------*/ /*----------------------BinaryPredicate0D get/setters ----------------------------*/
static PyMethodDef BPy_BinaryPredicate0D_methods[] = {
{"getName", ( PyCFunction ) BinaryPredicate0D_getName, METH_NOARGS, BinaryPredicate0D_getName___doc__}, PyDoc_STRVAR(BinaryPredicate0D_name_doc,
{NULL, NULL, 0, NULL} "The name of the binary 0D predicate.\n"
"\n"
":type: str");
static PyObject *BinaryPredicate0D_name_get(BPy_BinaryPredicate0D *self, void *UNUSED(closure))
{
return PyUnicode_FromString(Py_TYPE(self)->tp_name);
}
static PyGetSetDef BPy_BinaryPredicate0D_getseters[] = {
{(char *)"name", (getter)BinaryPredicate0D_name_get, (setter)NULL, (char *)BinaryPredicate0D_name_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
}; };
/*-----------------------BPy_BinaryPredicate0D type definition ------------------------------*/ /*-----------------------BPy_BinaryPredicate0D type definition ------------------------------*/
@@ -146,9 +142,9 @@ PyTypeObject BinaryPredicate0D_Type = {
0, /* tp_weaklistoffset */ 0, /* tp_weaklistoffset */
0, /* tp_iter */ 0, /* tp_iter */
0, /* tp_iternext */ 0, /* tp_iternext */
BPy_BinaryPredicate0D_methods, /* tp_methods */ 0, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
0, /* tp_getset */ BPy_BinaryPredicate0D_getseters, /* tp_getset */
0, /* tp_base */ 0, /* tp_base */
0, /* tp_dict */ 0, /* tp_dict */
0, /* tp_descr_get */ 0, /* tp_descr_get */

View File

@@ -16,39 +16,39 @@ extern "C" {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION-------------------------------- //-------------------MODULE INITIALIZATION--------------------------------
int BinaryPredicate1D_Init( PyObject *module ) int BinaryPredicate1D_Init(PyObject *module)
{ {
if( module == NULL ) if (module == NULL)
return -1; return -1;
if( PyType_Ready( &BinaryPredicate1D_Type ) < 0 ) if (PyType_Ready(&BinaryPredicate1D_Type) < 0)
return -1; return -1;
Py_INCREF( &BinaryPredicate1D_Type ); Py_INCREF(&BinaryPredicate1D_Type);
PyModule_AddObject(module, "BinaryPredicate1D", (PyObject *)&BinaryPredicate1D_Type); PyModule_AddObject(module, "BinaryPredicate1D", (PyObject *)&BinaryPredicate1D_Type);
if( PyType_Ready( &FalseBP1D_Type ) < 0 ) if (PyType_Ready(&FalseBP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &FalseBP1D_Type ); Py_INCREF(&FalseBP1D_Type);
PyModule_AddObject(module, "FalseBP1D", (PyObject *)&FalseBP1D_Type); PyModule_AddObject(module, "FalseBP1D", (PyObject *)&FalseBP1D_Type);
if( PyType_Ready( &Length2DBP1D_Type ) < 0 ) if (PyType_Ready(&Length2DBP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &Length2DBP1D_Type ); Py_INCREF(&Length2DBP1D_Type);
PyModule_AddObject(module, "Length2DBP1D", (PyObject *)&Length2DBP1D_Type); PyModule_AddObject(module, "Length2DBP1D", (PyObject *)&Length2DBP1D_Type);
if( PyType_Ready( &SameShapeIdBP1D_Type ) < 0 ) if (PyType_Ready(&SameShapeIdBP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &SameShapeIdBP1D_Type ); Py_INCREF(&SameShapeIdBP1D_Type);
PyModule_AddObject(module, "SameShapeIdBP1D", (PyObject *)&SameShapeIdBP1D_Type); PyModule_AddObject(module, "SameShapeIdBP1D", (PyObject *)&SameShapeIdBP1D_Type);
if( PyType_Ready( &TrueBP1D_Type ) < 0 ) if (PyType_Ready(&TrueBP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &TrueBP1D_Type ); Py_INCREF(&TrueBP1D_Type);
PyModule_AddObject(module, "TrueBP1D", (PyObject *)&TrueBP1D_Type); PyModule_AddObject(module, "TrueBP1D", (PyObject *)&TrueBP1D_Type);
if( PyType_Ready( &ViewMapGradientNormBP1D_Type ) < 0 ) if (PyType_Ready(&ViewMapGradientNormBP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &ViewMapGradientNormBP1D_Type ); Py_INCREF(&ViewMapGradientNormBP1D_Type);
PyModule_AddObject(module, "ViewMapGradientNormBP1D", (PyObject *)&ViewMapGradientNormBP1D_Type); PyModule_AddObject(module, "ViewMapGradientNormBP1D", (PyObject *)&ViewMapGradientNormBP1D_Type);
return 0; return 0;
@@ -81,10 +81,12 @@ static char BinaryPredicate1D___doc__[] =
static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds)
{ {
if ( !PyArg_ParseTuple(args, "") ) static const char *kwlist[] = {NULL};
return -1;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->bp1D = new BinaryPredicate1D(); self->bp1D = new BinaryPredicate1D();
self->bp1D->py_bp1D = (PyObject *) self; self->bp1D->py_bp1D = (PyObject *)self;
return 0; return 0;
} }
@@ -92,56 +94,53 @@ static void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D* self)
{ {
if (self->bp1D) if (self->bp1D)
delete self->bp1D; delete self->bp1D;
Py_TYPE(self)->tp_free((PyObject*)self); Py_TYPE(self)->tp_free((PyObject*)self);
} }
static 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 ); return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->bp1D);
} }
static char BinaryPredicate1D_getName___doc__[] = static PyObject *BinaryPredicate1D___call__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds)
".. method:: getName()\n"
"\n"
" Returns the name of the binary 1D predicate.\n"
"\n"
" :return: The name of the binary 1D predicate.\n"
" :rtype: str\n";
static PyObject *BinaryPredicate1D_getName( BPy_BinaryPredicate1D *self, PyObject *args)
{
return PyUnicode_FromString( self->bp1D->getName().c_str() );
}
static PyObject *BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"inter1", "inter2", NULL};
BPy_Interface1D *obj1, *obj2; BPy_Interface1D *obj1, *obj2;
if( kwds != NULL ) { if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); &Interface1D_Type, &obj1, &Interface1D_Type, &obj2))
{
return NULL; return NULL;
} }
if( !PyArg_ParseTuple(args, "O!O!", &Interface1D_Type, &obj1, &Interface1D_Type, &obj2) ) if (typeid(*(self->bp1D)) == typeid(BinaryPredicate1D)) {
return NULL;
if( typeid(*(self->bp1D)) == typeid(BinaryPredicate1D) ) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
return NULL; return NULL;
} }
if (self->bp1D->operator()( *(obj1->if1D) , *(obj2->if1D) ) < 0) { if (self->bp1D->operator()(*(obj1->if1D) , *(obj2->if1D)) < 0) {
if (!PyErr_Occurred()) { if (!PyErr_Occurred()) {
string msg(self->bp1D->getName() + " __call__ method failed"); string class_name(Py_TYPE(self)->tp_name);
PyErr_SetString(PyExc_RuntimeError, msg.c_str()); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str());
} }
return NULL; return NULL;
} }
return PyBool_from_bool( self->bp1D->result ); return PyBool_from_bool(self->bp1D->result);
} }
/*----------------------BinaryPredicate1D instance definitions ----------------------------*/ /*----------------------BinaryPredicate0D get/setters ----------------------------*/
static PyMethodDef BPy_BinaryPredicate1D_methods[] = {
{"getName", ( PyCFunction ) BinaryPredicate1D_getName, METH_NOARGS, BinaryPredicate1D_getName___doc__}, PyDoc_STRVAR(BinaryPredicate1D_name_doc,
{NULL, NULL, 0, NULL} "The name of the binary 1D predicate.\n"
"\n"
":type: str");
static PyObject *BinaryPredicate1D_name_get(BPy_BinaryPredicate1D *self, void *UNUSED(closure))
{
return PyUnicode_FromString(Py_TYPE(self)->tp_name);
}
static PyGetSetDef BPy_BinaryPredicate1D_getseters[] = {
{(char *)"name", (getter)BinaryPredicate1D_name_get, (setter)NULL, (char *)BinaryPredicate1D_name_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
}; };
/*-----------------------BPy_BinaryPredicate1D type definition ------------------------------*/ /*-----------------------BPy_BinaryPredicate1D type definition ------------------------------*/
@@ -173,9 +172,9 @@ PyTypeObject BinaryPredicate1D_Type = {
0, /* tp_weaklistoffset */ 0, /* tp_weaklistoffset */
0, /* tp_iter */ 0, /* tp_iter */
0, /* tp_iternext */ 0, /* tp_iternext */
BPy_BinaryPredicate1D_methods, /* tp_methods */ 0, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
0, /* tp_getset */ BPy_BinaryPredicate1D_getseters, /* tp_getset */
0, /* tp_base */ 0, /* tp_base */
0, /* tp_dict */ 0, /* tp_dict */
0, /* tp_descr_get */ 0, /* tp_descr_get */

View File

@@ -33,124 +33,124 @@ extern "C" {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION-------------------------------- //-------------------MODULE INITIALIZATION--------------------------------
int StrokeShader_Init( PyObject *module ) int StrokeShader_Init(PyObject *module)
{ {
if( module == NULL ) if (module == NULL)
return -1; return -1;
if( PyType_Ready( &StrokeShader_Type ) < 0 ) if (PyType_Ready(&StrokeShader_Type) < 0)
return -1; return -1;
Py_INCREF( &StrokeShader_Type ); Py_INCREF(&StrokeShader_Type);
PyModule_AddObject(module, "StrokeShader", (PyObject *)&StrokeShader_Type); PyModule_AddObject(module, "StrokeShader", (PyObject *)&StrokeShader_Type);
if( PyType_Ready( &BackboneStretcherShader_Type ) < 0 ) if (PyType_Ready(&BackboneStretcherShader_Type) < 0)
return -1; return -1;
Py_INCREF( &BackboneStretcherShader_Type ); Py_INCREF(&BackboneStretcherShader_Type);
PyModule_AddObject(module, "BackboneStretcherShader", (PyObject *)&BackboneStretcherShader_Type); PyModule_AddObject(module, "BackboneStretcherShader", (PyObject *)&BackboneStretcherShader_Type);
if( PyType_Ready( &BezierCurveShader_Type ) < 0 ) if (PyType_Ready(&BezierCurveShader_Type) < 0)
return -1; return -1;
Py_INCREF( &BezierCurveShader_Type ); Py_INCREF(&BezierCurveShader_Type);
PyModule_AddObject(module, "BezierCurveShader", (PyObject *)&BezierCurveShader_Type); PyModule_AddObject(module, "BezierCurveShader", (PyObject *)&BezierCurveShader_Type);
if( PyType_Ready( &CalligraphicShader_Type ) < 0 ) if (PyType_Ready(&CalligraphicShader_Type) < 0)
return -1; return -1;
Py_INCREF( &CalligraphicShader_Type ); Py_INCREF(&CalligraphicShader_Type);
PyModule_AddObject(module, "CalligraphicShader", (PyObject *)&CalligraphicShader_Type); PyModule_AddObject(module, "CalligraphicShader", (PyObject *)&CalligraphicShader_Type);
if( PyType_Ready( &ColorNoiseShader_Type ) < 0 ) if (PyType_Ready(&ColorNoiseShader_Type) < 0)
return -1; return -1;
Py_INCREF( &ColorNoiseShader_Type ); Py_INCREF(&ColorNoiseShader_Type);
PyModule_AddObject(module, "ColorNoiseShader", (PyObject *)&ColorNoiseShader_Type); PyModule_AddObject(module, "ColorNoiseShader", (PyObject *)&ColorNoiseShader_Type);
if( PyType_Ready( &ColorVariationPatternShader_Type ) < 0 ) if (PyType_Ready(&ColorVariationPatternShader_Type) < 0)
return -1; return -1;
Py_INCREF( &ColorVariationPatternShader_Type ); Py_INCREF(&ColorVariationPatternShader_Type);
PyModule_AddObject(module, "ColorVariationPatternShader", (PyObject *)&ColorVariationPatternShader_Type); PyModule_AddObject(module, "ColorVariationPatternShader", (PyObject *)&ColorVariationPatternShader_Type);
if( PyType_Ready( &ConstantColorShader_Type ) < 0 ) if (PyType_Ready(&ConstantColorShader_Type) < 0)
return -1; return -1;
Py_INCREF( &ConstantColorShader_Type ); Py_INCREF(&ConstantColorShader_Type);
PyModule_AddObject(module, "ConstantColorShader", (PyObject *)&ConstantColorShader_Type); PyModule_AddObject(module, "ConstantColorShader", (PyObject *)&ConstantColorShader_Type);
if( PyType_Ready( &ConstantThicknessShader_Type ) < 0 ) if (PyType_Ready(&ConstantThicknessShader_Type) < 0)
return -1; return -1;
Py_INCREF( &ConstantThicknessShader_Type ); Py_INCREF(&ConstantThicknessShader_Type);
PyModule_AddObject(module, "ConstantThicknessShader", (PyObject *)&ConstantThicknessShader_Type); PyModule_AddObject(module, "ConstantThicknessShader", (PyObject *)&ConstantThicknessShader_Type);
if( PyType_Ready( &ConstrainedIncreasingThicknessShader_Type ) < 0 ) if (PyType_Ready(&ConstrainedIncreasingThicknessShader_Type) < 0)
return -1; return -1;
Py_INCREF( &ConstrainedIncreasingThicknessShader_Type ); Py_INCREF(&ConstrainedIncreasingThicknessShader_Type);
PyModule_AddObject(module, "ConstrainedIncreasingThicknessShader", (PyObject *)&ConstrainedIncreasingThicknessShader_Type); PyModule_AddObject(module, "ConstrainedIncreasingThicknessShader", (PyObject *)&ConstrainedIncreasingThicknessShader_Type);
if( PyType_Ready( &fstreamShader_Type ) < 0 ) if (PyType_Ready(&fstreamShader_Type) < 0)
return -1; return -1;
Py_INCREF( &fstreamShader_Type ); Py_INCREF(&fstreamShader_Type);
PyModule_AddObject(module, "fstreamShader", (PyObject *)&fstreamShader_Type); PyModule_AddObject(module, "fstreamShader", (PyObject *)&fstreamShader_Type);
if( PyType_Ready( &GuidingLinesShader_Type ) < 0 ) if (PyType_Ready(&GuidingLinesShader_Type) < 0)
return -1; return -1;
Py_INCREF( &GuidingLinesShader_Type ); Py_INCREF(&GuidingLinesShader_Type);
PyModule_AddObject(module, "GuidingLinesShader", (PyObject *)&GuidingLinesShader_Type); PyModule_AddObject(module, "GuidingLinesShader", (PyObject *)&GuidingLinesShader_Type);
if( PyType_Ready( &IncreasingColorShader_Type ) < 0 ) if (PyType_Ready(&IncreasingColorShader_Type) < 0)
return -1; return -1;
Py_INCREF( &IncreasingColorShader_Type ); Py_INCREF(&IncreasingColorShader_Type);
PyModule_AddObject(module, "IncreasingColorShader", (PyObject *)&IncreasingColorShader_Type); PyModule_AddObject(module, "IncreasingColorShader", (PyObject *)&IncreasingColorShader_Type);
if( PyType_Ready( &IncreasingThicknessShader_Type ) < 0 ) if (PyType_Ready(&IncreasingThicknessShader_Type) < 0)
return -1; return -1;
Py_INCREF( &IncreasingThicknessShader_Type ); Py_INCREF(&IncreasingThicknessShader_Type);
PyModule_AddObject(module, "IncreasingThicknessShader", (PyObject *)&IncreasingThicknessShader_Type); PyModule_AddObject(module, "IncreasingThicknessShader", (PyObject *)&IncreasingThicknessShader_Type);
if( PyType_Ready( &PolygonalizationShader_Type ) < 0 ) if (PyType_Ready(&PolygonalizationShader_Type) < 0)
return -1; return -1;
Py_INCREF( &PolygonalizationShader_Type ); Py_INCREF(&PolygonalizationShader_Type);
PyModule_AddObject(module, "PolygonalizationShader", (PyObject *)&PolygonalizationShader_Type); PyModule_AddObject(module, "PolygonalizationShader", (PyObject *)&PolygonalizationShader_Type);
if( PyType_Ready( &SamplingShader_Type ) < 0 ) if (PyType_Ready(&SamplingShader_Type) < 0)
return -1; return -1;
Py_INCREF( &SamplingShader_Type ); Py_INCREF(&SamplingShader_Type);
PyModule_AddObject(module, "SamplingShader", (PyObject *)&SamplingShader_Type); PyModule_AddObject(module, "SamplingShader", (PyObject *)&SamplingShader_Type);
if( PyType_Ready( &SmoothingShader_Type ) < 0 ) if (PyType_Ready(&SmoothingShader_Type) < 0)
return -1; return -1;
Py_INCREF( &SmoothingShader_Type ); Py_INCREF(&SmoothingShader_Type);
PyModule_AddObject(module, "SmoothingShader", (PyObject *)&SmoothingShader_Type); PyModule_AddObject(module, "SmoothingShader", (PyObject *)&SmoothingShader_Type);
if( PyType_Ready( &SpatialNoiseShader_Type ) < 0 ) if (PyType_Ready(&SpatialNoiseShader_Type) < 0)
return -1; return -1;
Py_INCREF( &SpatialNoiseShader_Type ); Py_INCREF(&SpatialNoiseShader_Type);
PyModule_AddObject(module, "SpatialNoiseShader", (PyObject *)&SpatialNoiseShader_Type); PyModule_AddObject(module, "SpatialNoiseShader", (PyObject *)&SpatialNoiseShader_Type);
if( PyType_Ready( &streamShader_Type ) < 0 ) if (PyType_Ready(&streamShader_Type) < 0)
return -1; return -1;
Py_INCREF( &streamShader_Type ); Py_INCREF(&streamShader_Type);
PyModule_AddObject(module, "streamShader", (PyObject *)&streamShader_Type); PyModule_AddObject(module, "streamShader", (PyObject *)&streamShader_Type);
if( PyType_Ready( &StrokeTextureShader_Type ) < 0 ) if (PyType_Ready(&StrokeTextureShader_Type) < 0)
return -1; return -1;
Py_INCREF( &StrokeTextureShader_Type ); Py_INCREF(&StrokeTextureShader_Type);
PyModule_AddObject(module, "StrokeTextureShader", (PyObject *)&StrokeTextureShader_Type); PyModule_AddObject(module, "StrokeTextureShader", (PyObject *)&StrokeTextureShader_Type);
if( PyType_Ready( &TextureAssignerShader_Type ) < 0 ) if (PyType_Ready(&TextureAssignerShader_Type) < 0)
return -1; return -1;
Py_INCREF( &TextureAssignerShader_Type ); Py_INCREF(&TextureAssignerShader_Type);
PyModule_AddObject(module, "TextureAssignerShader", (PyObject *)&TextureAssignerShader_Type); PyModule_AddObject(module, "TextureAssignerShader", (PyObject *)&TextureAssignerShader_Type);
if( PyType_Ready( &ThicknessNoiseShader_Type ) < 0 ) if (PyType_Ready(&ThicknessNoiseShader_Type) < 0)
return -1; return -1;
Py_INCREF( &ThicknessNoiseShader_Type ); Py_INCREF(&ThicknessNoiseShader_Type);
PyModule_AddObject(module, "ThicknessNoiseShader", (PyObject *)&ThicknessNoiseShader_Type); PyModule_AddObject(module, "ThicknessNoiseShader", (PyObject *)&ThicknessNoiseShader_Type);
if( PyType_Ready( &ThicknessVariationPatternShader_Type ) < 0 ) if (PyType_Ready(&ThicknessVariationPatternShader_Type) < 0)
return -1; return -1;
Py_INCREF( &ThicknessVariationPatternShader_Type ); Py_INCREF(&ThicknessVariationPatternShader_Type);
PyModule_AddObject(module, "ThicknessVariationPatternShader", (PyObject *)&ThicknessVariationPatternShader_Type); PyModule_AddObject(module, "ThicknessVariationPatternShader", (PyObject *)&ThicknessVariationPatternShader_Type);
if( PyType_Ready( &TipRemoverShader_Type ) < 0 ) if (PyType_Ready(&TipRemoverShader_Type) < 0)
return -1; return -1;
Py_INCREF( &TipRemoverShader_Type ); Py_INCREF(&TipRemoverShader_Type);
PyModule_AddObject(module, "TipRemoverShader", (PyObject *)&TipRemoverShader_Type); PyModule_AddObject(module, "TipRemoverShader", (PyObject *)&TipRemoverShader_Type);
return 0; return 0;
@@ -168,8 +168,8 @@ static char StrokeShader___doc__[] =
"code example of such an iteration::\n" "code example of such an iteration::\n"
"\n" "\n"
" it = ioStroke.strokeVerticesBegin()\n" " it = ioStroke.strokeVerticesBegin()\n"
" while it.isEnd() == 0:\n" " while not it.is_end:\n"
" att = it.getObject().attribute()\n" " att = it.object.attribute\n"
" ## perform here any attribute modification\n" " ## perform here any attribute modification\n"
" it.increment()\n" " it.increment()\n"
"\n" "\n"
@@ -179,10 +179,12 @@ static char StrokeShader___doc__[] =
static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds) static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds)
{ {
if ( !PyArg_ParseTuple(args, "") ) static const char *kwlist[] = {NULL};
return -1;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->ss = new StrokeShader(); self->ss = new StrokeShader();
self->ss->py_ss = (PyObject *) self; self->ss->py_ss = (PyObject *)self;
return 0; return 0;
} }
@@ -190,63 +192,66 @@ static void StrokeShader___dealloc__(BPy_StrokeShader* self)
{ {
if (self->ss) if (self->ss)
delete self->ss; delete self->ss;
Py_TYPE(self)->tp_free((PyObject*)self); Py_TYPE(self)->tp_free((PyObject*)self);
} }
static 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 ); 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: str\n";
static PyObject * StrokeShader_getName( BPy_StrokeShader *self, PyObject *args)
{
return PyUnicode_FromString( self->ss->getName().c_str() );
} }
static char StrokeShader_shade___doc__[] = static char StrokeShader_shade___doc__[] =
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" The shading method. Must be overloaded by inherited classes.\n" " The shading method. Must be overloaded by inherited classes.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static PyObject *StrokeShader_shade( BPy_StrokeShader *self , PyObject *args) { static PyObject *StrokeShader_shade(BPy_StrokeShader *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {"stroke", NULL};
PyObject *py_s = 0; PyObject *py_s = 0;
if(!( PyArg_ParseTuple(args, "O!", &Stroke_Type, &py_s) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Stroke_Type, &py_s))
return NULL; return NULL;
if( typeid(*(self->ss)) == typeid(StrokeShader) ) { if (typeid(*(self->ss)) == typeid(StrokeShader)) {
PyErr_SetString(PyExc_TypeError, "shade method not properly overridden"); PyErr_SetString(PyExc_TypeError, "shade method not properly overridden");
return NULL; return NULL;
} }
if (self->ss->shade(*( ((BPy_Stroke *) py_s)->s )) < 0) { if (self->ss->shade(*(((BPy_Stroke *)py_s)->s)) < 0) {
if (!PyErr_Occurred()) { if (!PyErr_Occurred()) {
string msg(self->ss->getName() + " shade method failed"); string class_name(Py_TYPE(self)->tp_name);
PyErr_SetString(PyExc_RuntimeError, msg.c_str()); PyErr_SetString(PyExc_RuntimeError, (class_name + " shade method failed").c_str());
} }
return NULL; return NULL;
} }
Py_RETURN_NONE; Py_RETURN_NONE;
} }
/*----------------------StrokeShader instance definitions ----------------------------*/
static PyMethodDef BPy_StrokeShader_methods[] = { static PyMethodDef BPy_StrokeShader_methods[] = {
{"getName", ( PyCFunction ) StrokeShader_getName, METH_NOARGS, StrokeShader_getName___doc__}, {"shade", (PyCFunction)StrokeShader_shade, METH_VARARGS | METH_KEYWORDS, StrokeShader_shade___doc__},
{"shade", ( PyCFunction ) StrokeShader_shade, METH_VARARGS, StrokeShader_shade___doc__},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
/*----------------------StrokeShader get/setters ----------------------------*/
PyDoc_STRVAR(StrokeShader_name_doc,
"The name of the stroke shader.\n"
"\n"
":type: str");
static PyObject *StrokeShader_name_get(BPy_StrokeShader *self, void *UNUSED(closure))
{
return PyUnicode_FromString(Py_TYPE(self)->tp_name);
}
static PyGetSetDef BPy_StrokeShader_getseters[] = {
{(char *)"name", (getter)StrokeShader_name_get, (setter)NULL, (char *)StrokeShader_name_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------BPy_StrokeShader type definition ------------------------------*/ /*-----------------------BPy_StrokeShader type definition ------------------------------*/
PyTypeObject StrokeShader_Type = { PyTypeObject StrokeShader_Type = {
@@ -279,7 +284,7 @@ PyTypeObject StrokeShader_Type = {
0, /* tp_iternext */ 0, /* tp_iternext */
BPy_StrokeShader_methods, /* tp_methods */ BPy_StrokeShader_methods, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
0, /* tp_getset */ BPy_StrokeShader_getseters, /* tp_getset */
0, /* tp_base */ 0, /* tp_base */
0, /* tp_dict */ 0, /* tp_dict */
0, /* tp_descr_get */ 0, /* tp_descr_get */

View File

@@ -12,24 +12,24 @@ extern "C" {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION-------------------------------- //-------------------MODULE INITIALIZATION--------------------------------
int UnaryPredicate0D_Init( PyObject *module ) int UnaryPredicate0D_Init(PyObject *module)
{ {
if( module == NULL ) if (module == NULL)
return -1; return -1;
if( PyType_Ready( &UnaryPredicate0D_Type ) < 0 ) if (PyType_Ready(&UnaryPredicate0D_Type) < 0)
return -1; return -1;
Py_INCREF( &UnaryPredicate0D_Type ); Py_INCREF(&UnaryPredicate0D_Type);
PyModule_AddObject(module, "UnaryPredicate0D", (PyObject *)&UnaryPredicate0D_Type); PyModule_AddObject(module, "UnaryPredicate0D", (PyObject *)&UnaryPredicate0D_Type);
if( PyType_Ready( &FalseUP0D_Type ) < 0 ) if (PyType_Ready(&FalseUP0D_Type) < 0)
return -1; return -1;
Py_INCREF( &FalseUP0D_Type ); Py_INCREF(&FalseUP0D_Type);
PyModule_AddObject(module, "FalseUP0D", (PyObject *)&FalseUP0D_Type); PyModule_AddObject(module, "FalseUP0D", (PyObject *)&FalseUP0D_Type);
if( PyType_Ready( &TrueUP0D_Type ) < 0 ) if (PyType_Ready(&TrueUP0D_Type) < 0)
return -1; return -1;
Py_INCREF( &TrueUP0D_Type ); Py_INCREF(&TrueUP0D_Type);
PyModule_AddObject(module, "TrueUP0D", (PyObject *)&TrueUP0D_Type); PyModule_AddObject(module, "TrueUP0D", (PyObject *)&TrueUP0D_Type);
return 0; return 0;
@@ -61,10 +61,12 @@ static char UnaryPredicate0D___doc__[] =
static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds)
{ {
if ( !PyArg_ParseTuple(args, "") ) static const char *kwlist[] = {NULL};
return -1;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->up0D = new UnaryPredicate0D(); self->up0D = new UnaryPredicate0D();
self->up0D->py_up0D = (PyObject *) self; self->up0D->py_up0D = (PyObject *)self;
return 0; return 0;
} }
@@ -72,63 +74,58 @@ static void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D* self)
{ {
if (self->up0D) if (self->up0D)
delete self->up0D; delete self->up0D;
Py_TYPE(self)->tp_free((PyObject*)self); Py_TYPE(self)->tp_free((PyObject*)self);
} }
static 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 ); return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->up0D);
} }
static char UnaryPredicate0D_getName___doc__[] = static PyObject * UnaryPredicate0D___call__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds)
".. method:: getName()\n"
"\n"
" Returns the name of the UnaryPredicate0D.\n"
"\n"
" :return: The name of the UnaryPredicate0D.\n"
" :rtype: str\n";
static PyObject * UnaryPredicate0D_getName( BPy_UnaryPredicate0D *self )
{
return PyUnicode_FromString( self->up0D->getName().c_str() );
}
static PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"it", NULL};
PyObject *py_if0D_it; PyObject *py_if0D_it;
if( kwds != NULL ) { if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &py_if0D_it))
PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported");
return NULL;
}
if( !PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &py_if0D_it) )
return NULL; return NULL;
Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *) py_if0D_it)->if0D_it; Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it;
if( !if0D_it ) { if (!if0D_it) {
string msg(self->up0D->getName() + " has no Interface0DIterator"); string msg(self->up0D->getName() + " has no Interface0DIterator");
PyErr_SetString(PyExc_RuntimeError, msg.c_str()); PyErr_SetString(PyExc_RuntimeError, msg.c_str());
return NULL; return NULL;
} }
if( typeid(*(self->up0D)) == typeid(UnaryPredicate0D) ) { if (typeid(*(self->up0D)) == typeid(UnaryPredicate0D)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
return NULL; return NULL;
} }
if (self->up0D->operator()(*if0D_it) < 0) { if (self->up0D->operator()(*if0D_it) < 0) {
if (!PyErr_Occurred()) { if (!PyErr_Occurred()) {
string msg(self->up0D->getName() + " __call__ method failed"); string class_name(Py_TYPE(self)->tp_name);
PyErr_SetString(PyExc_RuntimeError, msg.c_str()); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str());
} }
return NULL; return NULL;
} }
return PyBool_from_bool( self->up0D->result ); return PyBool_from_bool(self->up0D->result);
} }
/*----------------------UnaryPredicate0D instance definitions ----------------------------*/ /*----------------------UnaryPredicate0D get/setters ----------------------------*/
static PyMethodDef BPy_UnaryPredicate0D_methods[] = {
{"getName", ( PyCFunction ) UnaryPredicate0D_getName, METH_NOARGS, UnaryPredicate0D_getName___doc__}, PyDoc_STRVAR(UnaryPredicate0D_name_doc,
{NULL, NULL, 0, NULL} "The name of the unary 0D predicate.\n"
"\n"
":type: str");
static PyObject *UnaryPredicate0D_name_get(BPy_UnaryPredicate0D *self, void *UNUSED(closure))
{
return PyUnicode_FromString(Py_TYPE(self)->tp_name);
}
static PyGetSetDef BPy_UnaryPredicate0D_getseters[] = {
{(char *)"name", (getter)UnaryPredicate0D_name_get, (setter)NULL, (char *)UnaryPredicate0D_name_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
}; };
/*-----------------------BPy_UnaryPredicate0D type definition ------------------------------*/ /*-----------------------BPy_UnaryPredicate0D type definition ------------------------------*/
@@ -161,9 +158,9 @@ PyTypeObject UnaryPredicate0D_Type = {
0, /* tp_weaklistoffset */ 0, /* tp_weaklistoffset */
0, /* tp_iter */ 0, /* tp_iter */
0, /* tp_iternext */ 0, /* tp_iternext */
BPy_UnaryPredicate0D_methods, /* tp_methods */ 0, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
0, /* tp_getset */ BPy_UnaryPredicate0D_getseters, /* tp_getset */
0, /* tp_base */ 0, /* tp_base */
0, /* tp_dict */ 0, /* tp_dict */
0, /* tp_descr_get */ 0, /* tp_descr_get */
@@ -179,6 +176,3 @@ PyTypeObject UnaryPredicate0D_Type = {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -21,64 +21,64 @@ extern "C" {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION-------------------------------- //-------------------MODULE INITIALIZATION--------------------------------
int UnaryPredicate1D_Init( PyObject *module ) int UnaryPredicate1D_Init(PyObject *module)
{ {
if( module == NULL ) if (module == NULL)
return -1; return -1;
if( PyType_Ready( &UnaryPredicate1D_Type ) < 0 ) if (PyType_Ready(&UnaryPredicate1D_Type) < 0)
return -1; return -1;
Py_INCREF( &UnaryPredicate1D_Type ); Py_INCREF(&UnaryPredicate1D_Type);
PyModule_AddObject(module, "UnaryPredicate1D", (PyObject *)&UnaryPredicate1D_Type); PyModule_AddObject(module, "UnaryPredicate1D", (PyObject *)&UnaryPredicate1D_Type);
if( PyType_Ready( &ContourUP1D_Type ) < 0 ) if (PyType_Ready(&ContourUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &ContourUP1D_Type ); Py_INCREF(&ContourUP1D_Type);
PyModule_AddObject(module, "ContourUP1D", (PyObject *)&ContourUP1D_Type); PyModule_AddObject(module, "ContourUP1D", (PyObject *)&ContourUP1D_Type);
if( PyType_Ready( &DensityLowerThanUP1D_Type ) < 0 ) if (PyType_Ready(&DensityLowerThanUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &DensityLowerThanUP1D_Type ); Py_INCREF(&DensityLowerThanUP1D_Type);
PyModule_AddObject(module, "DensityLowerThanUP1D", (PyObject *)&DensityLowerThanUP1D_Type); PyModule_AddObject(module, "DensityLowerThanUP1D", (PyObject *)&DensityLowerThanUP1D_Type);
if( PyType_Ready( &EqualToChainingTimeStampUP1D_Type ) < 0 ) if (PyType_Ready(&EqualToChainingTimeStampUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &EqualToChainingTimeStampUP1D_Type ); Py_INCREF(&EqualToChainingTimeStampUP1D_Type);
PyModule_AddObject(module, "EqualToChainingTimeStampUP1D", (PyObject *)&EqualToChainingTimeStampUP1D_Type); PyModule_AddObject(module, "EqualToChainingTimeStampUP1D", (PyObject *)&EqualToChainingTimeStampUP1D_Type);
if( PyType_Ready( &EqualToTimeStampUP1D_Type ) < 0 ) if (PyType_Ready(&EqualToTimeStampUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &EqualToTimeStampUP1D_Type ); Py_INCREF(&EqualToTimeStampUP1D_Type);
PyModule_AddObject(module, "EqualToTimeStampUP1D", (PyObject *)&EqualToTimeStampUP1D_Type); PyModule_AddObject(module, "EqualToTimeStampUP1D", (PyObject *)&EqualToTimeStampUP1D_Type);
if( PyType_Ready( &ExternalContourUP1D_Type ) < 0 ) if (PyType_Ready(&ExternalContourUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &ExternalContourUP1D_Type ); Py_INCREF(&ExternalContourUP1D_Type);
PyModule_AddObject(module, "ExternalContourUP1D", (PyObject *)&ExternalContourUP1D_Type); PyModule_AddObject(module, "ExternalContourUP1D", (PyObject *)&ExternalContourUP1D_Type);
if( PyType_Ready( &FalseUP1D_Type ) < 0 ) if (PyType_Ready(&FalseUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &FalseUP1D_Type ); Py_INCREF(&FalseUP1D_Type);
PyModule_AddObject(module, "FalseUP1D", (PyObject *)&FalseUP1D_Type); PyModule_AddObject(module, "FalseUP1D", (PyObject *)&FalseUP1D_Type);
if( PyType_Ready( &QuantitativeInvisibilityUP1D_Type ) < 0 ) if (PyType_Ready(&QuantitativeInvisibilityUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &QuantitativeInvisibilityUP1D_Type ); Py_INCREF(&QuantitativeInvisibilityUP1D_Type);
PyModule_AddObject(module, "QuantitativeInvisibilityUP1D", (PyObject *)&QuantitativeInvisibilityUP1D_Type); PyModule_AddObject(module, "QuantitativeInvisibilityUP1D", (PyObject *)&QuantitativeInvisibilityUP1D_Type);
if( PyType_Ready( &ShapeUP1D_Type ) < 0 ) if (PyType_Ready(&ShapeUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &ShapeUP1D_Type ); Py_INCREF(&ShapeUP1D_Type);
PyModule_AddObject(module, "ShapeUP1D", (PyObject *)&ShapeUP1D_Type); PyModule_AddObject(module, "ShapeUP1D", (PyObject *)&ShapeUP1D_Type);
if( PyType_Ready( &TrueUP1D_Type ) < 0 ) if (PyType_Ready(&TrueUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &TrueUP1D_Type ); Py_INCREF(&TrueUP1D_Type);
PyModule_AddObject(module, "TrueUP1D", (PyObject *)&TrueUP1D_Type); PyModule_AddObject(module, "TrueUP1D", (PyObject *)&TrueUP1D_Type);
if( PyType_Ready( &WithinImageBoundaryUP1D_Type ) < 0 ) if (PyType_Ready(&WithinImageBoundaryUP1D_Type) < 0)
return -1; return -1;
Py_INCREF( &WithinImageBoundaryUP1D_Type ); Py_INCREF(&WithinImageBoundaryUP1D_Type);
PyModule_AddObject(module, "WithinImageBoundaryUP1D", (PyObject *)&WithinImageBoundaryUP1D_Type); PyModule_AddObject(module, "WithinImageBoundaryUP1D", (PyObject *)&WithinImageBoundaryUP1D_Type);
return 0; return 0;
@@ -109,10 +109,12 @@ static char UnaryPredicate1D___doc__[] =
static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds)
{ {
if( !PyArg_ParseTuple(args, "") ) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->up1D = new UnaryPredicate1D(); self->up1D = new UnaryPredicate1D();
self->up1D->py_up1D = (PyObject *) self; self->up1D->py_up1D = (PyObject *)self;
return 0; return 0;
} }
@@ -120,67 +122,58 @@ static void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D* self)
{ {
if (self->up1D) if (self->up1D)
delete self->up1D; delete self->up1D;
Py_TYPE(self)->tp_free((PyObject*)self); Py_TYPE(self)->tp_free((PyObject*)self);
} }
static 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 ); return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->up1D);
} }
static char UnaryPredicate1D_getName___doc__[] = static PyObject * UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds)
".. 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: str\n";
static PyObject * UnaryPredicate1D_getName( BPy_UnaryPredicate1D *self, PyObject *args)
{
return PyUnicode_FromString( self->up1D->getName().c_str() );
}
static PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"inter", NULL};
PyObject *py_if1D; PyObject *py_if1D;
if( kwds != NULL ) { if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D))
PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported");
return NULL;
}
if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &py_if1D) )
return NULL; return NULL;
Interface1D *if1D = ((BPy_Interface1D *) py_if1D)->if1D; Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D;
if( !if1D ) { if (!if1D) {
string msg(self->up1D->getName() + " has no Interface0DIterator"); string msg(self->up1D->getName() + " has no Interface0DIterator");
PyErr_SetString(PyExc_RuntimeError, msg.c_str()); PyErr_SetString(PyExc_RuntimeError, msg.c_str());
return NULL; return NULL;
} }
if( typeid(*(self->up1D)) == typeid(UnaryPredicate1D) ) { if (typeid(*(self->up1D)) == typeid(UnaryPredicate1D)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
return NULL; return NULL;
} }
if( self->up1D->operator()(*if1D) < 0 ) { if (self->up1D->operator()(*if1D) < 0) {
if (!PyErr_Occurred()) { if (!PyErr_Occurred()) {
string msg(self->up1D->getName() + " __call__ method failed"); string class_name(Py_TYPE(self)->tp_name);
PyErr_SetString(PyExc_RuntimeError, msg.c_str()); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str());
} }
return NULL; return NULL;
} }
return PyBool_from_bool( self->up1D->result ); return PyBool_from_bool(self->up1D->result);
} }
/*----------------------UnaryPredicate1D instance definitions ----------------------------*/ /*----------------------UnaryPredicate1D get/setters ----------------------------*/
static PyMethodDef BPy_UnaryPredicate1D_methods[] = {
{"getName", ( PyCFunction ) UnaryPredicate1D_getName, METH_NOARGS, UnaryPredicate1D_getName___doc__}, PyDoc_STRVAR(UnaryPredicate1D_name_doc,
{NULL, NULL, 0, NULL} "The name of the unary 1D predicate.\n"
"\n"
":type: str");
static PyObject *UnaryPredicate1D_name_get(BPy_UnaryPredicate1D *self, void *UNUSED(closure))
{
return PyUnicode_FromString(Py_TYPE(self)->tp_name);
}
static PyGetSetDef BPy_UnaryPredicate1D_getseters[] = {
{(char *)"name", (getter)UnaryPredicate1D_name_get, (setter)NULL, (char *)UnaryPredicate1D_name_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
}; };
/*-----------------------BPy_UnaryPredicate1D type definition ------------------------------*/ /*-----------------------BPy_UnaryPredicate1D type definition ------------------------------*/
@@ -213,9 +206,9 @@ PyTypeObject UnaryPredicate1D_Type = {
0, /* tp_weaklistoffset */ 0, /* tp_weaklistoffset */
0, /* tp_iter */ 0, /* tp_iter */
0, /* tp_iternext */ 0, /* tp_iternext */
BPy_UnaryPredicate1D_methods, /* tp_methods */ 0, /* tp_methods */
0, /* tp_members */ 0, /* tp_members */
0, /* tp_getset */ BPy_UnaryPredicate1D_getseters, /* tp_getset */
0, /* tp_base */ 0, /* tp_base */
0, /* tp_dict */ 0, /* tp_dict */
0, /* tp_descr_get */ 0, /* tp_descr_get */
@@ -231,6 +224,3 @@ PyTypeObject UnaryPredicate1D_Type = {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -22,9 +22,11 @@ static char FalseBP1D___doc__[] =
" :return: False.\n" " :return: False.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int FalseBP1D___init__( BPy_FalseBP1D* self, PyObject *args ) static int FalseBP1D___init__(BPy_FalseBP1D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_bp1D.bp1D = new Predicates1D::FalseBP1D(); self->py_bp1D.bp1D = new Predicates1D::FalseBP1D();
return 0; return 0;

View File

@@ -23,9 +23,11 @@ static char Length2DBP1D___doc__[] =
" :return: True or false.\n" " :return: True or false.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int Length2DBP1D___init__( BPy_Length2DBP1D* self, PyObject *args ) static int Length2DBP1D___init__(BPy_Length2DBP1D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_bp1D.bp1D = new Predicates1D::Length2DBP1D(); self->py_bp1D.bp1D = new Predicates1D::Length2DBP1D();
return 0; return 0;

View File

@@ -22,9 +22,11 @@ static char SameShapeIdBP1D___doc__[] =
" :return: True or false.\n" " :return: True or false.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int SameShapeIdBP1D___init__( BPy_SameShapeIdBP1D* self, PyObject *args ) static int SameShapeIdBP1D___init__(BPy_SameShapeIdBP1D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_bp1D.bp1D = new Predicates1D::SameShapeIdBP1D(); self->py_bp1D.bp1D = new Predicates1D::SameShapeIdBP1D();
return 0; return 0;

View File

@@ -22,9 +22,11 @@ static char TrueBP1D___doc__[] =
" :return: True.\n" " :return: True.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int TrueBP1D___init__( BPy_TrueBP1D* self, PyObject *args ) static int TrueBP1D___init__(BPy_TrueBP1D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_bp1D.bp1D = new Predicates1D::TrueBP1D(); self->py_bp1D.bp1D = new Predicates1D::TrueBP1D();
return 0; return 0;

View File

@@ -16,6 +16,22 @@ extern "C" {
static char ViewMapGradientNormBP1D___doc__[] = static char ViewMapGradientNormBP1D___doc__[] =
"Class hierarchy: :class:`BinaryPredicate1D` > :class:`ViewMapGradientNormBP1D`\n" "Class hierarchy: :class:`BinaryPredicate1D` > :class:`ViewMapGradientNormBP1D`\n"
"\n" "\n"
".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n"
"\n"
" Builds a ViewMapGradientNormBP1D object.\n"
"\n"
" :arg level: The level of the pyramid from which the pixel must be\n"
" read.\n"
" :type level: int\n"
" :arg integration_type: The integration method used to compute a single value\n"
" from a set of values.\n"
" :type integration_type: :class:`IntegrationType`\n"
" :arg sampling: The resolution used to sample the chain:\n"
" GetViewMapGradientNormF0D 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 integration_type.\n"
" :type sampling: float\n"
"\n"
".. method:: __call__(inter1, inter2)\n" ".. method:: __call__(inter1, inter2)\n"
"\n" "\n"
" Returns true if the evaluation of the Gradient norm Function is\n" " Returns true if the evaluation of the Gradient norm Function is\n"
@@ -28,17 +44,17 @@ static char ViewMapGradientNormBP1D___doc__[] =
" :return: True or false.\n" " :return: True or false.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int ViewMapGradientNormBP1D___init__( BPy_ViewMapGradientNormBP1D* self, PyObject *args ) static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"level", "integration_type", "sampling", NULL};
PyObject *obj = 0;
int i; int i;
PyObject *obj;
float f = 2.0; float f = 2.0;
if(!( PyArg_ParseTuple(args, "i|O!f", &i, &IntegrationType_Type, &obj, &f) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f))
return -1; return -1;
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_bp1D.bp1D = new Predicates1D::ViewMapGradientNormBP1D(i, t, f);
self->py_bp1D.bp1D = new Predicates1D::ViewMapGradientNormBP1D(i,t,f);
return 0; return 0;
} }

View File

@@ -15,28 +15,28 @@ static char BackboneStretcherShader___doc__[] =
"\n" "\n"
"[Geometry shader]\n" "[Geometry shader]\n"
"\n" "\n"
".. method:: __init__(iAmount=2.0)\n" ".. method:: __init__(amount=2.0)\n"
"\n" "\n"
" Builds a BackboneStretcherShader object.\n" " Builds a BackboneStretcherShader object.\n"
"\n" "\n"
" :arg iAmount: The stretching amount value.\n" " :arg amount: The stretching amount value.\n"
" :type iAmount: float\n" " :type amount: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Stretches the stroke at its two extremities and following the\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" " respective directions: v(1)v(0) and v(n-1)v(n).\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int BackboneStretcherShader___init__( BPy_BackboneStretcherShader* self, PyObject *args) static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"amount", NULL};
float f = 2.0; float f = 2.0;
if(!( PyArg_ParseTuple(args, "|f", &f) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f); self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f);
return 0; return 0;
} }

View File

@@ -24,21 +24,21 @@ static char BezierCurveShader___doc__[] =
" original geometry.\n" " original geometry.\n"
" :type error: float\n" " :type error: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Transforms the stroke backbone geometry so that it corresponds to a\n" " Transforms the stroke backbone geometry so that it corresponds to a\n"
" Bezier Curve approximation of the original backbone geometry.\n" " Bezier Curve approximation of the original backbone geometry.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int BezierCurveShader___init__( BPy_BezierCurveShader* self, PyObject *args) static int BezierCurveShader___init__(BPy_BezierCurveShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"error", NULL};
float f = 4.0; float f = 4.0;
if(!( PyArg_ParseTuple(args, "|f", &f) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::BezierCurveShader(f); self->py_ss.ss = new StrokeShaders::BezierCurveShader(f);
return 0; return 0;
} }

View File

@@ -16,51 +16,53 @@ static char CalligraphicShader___doc__[] =
"\n" "\n"
"[Thickness Shader]\n" "[Thickness Shader]\n"
"\n" "\n"
".. method:: __init__(iMinThickness, iMaxThickness, iOrientation, iClamp)\n" ".. method:: __init__(thickness_min, thickness_max, orientation, clamp)\n"
"\n" "\n"
" Builds a CalligraphicShader object.\n" " Builds a CalligraphicShader object.\n"
"\n" "\n"
" :arg iMinThickness: The minimum thickness in the direction\n" " :arg thickness_min: The minimum thickness in the direction\n"
" perpendicular to the main direction.\n" " perpendicular to the main direction.\n"
" :type iMinThickness: float\n" " :type thickness_min: float\n"
" :arg iMaxThickness: The maximum thickness in the main direction.\n" " :arg thickness_max: The maximum thickness in the main direction.\n"
" :type iMaxThickness: float\n" " :type thickness_max: float\n"
" :arg iOrientation: The 2D vector giving the main direction.\n" " :arg orientation: The 2D vector giving the main direction.\n"
" :type iOrientation: :class:`mathutils.Vector`\n" " :type orientation: :class:`mathutils.Vector`\n"
" :arg iClamp: If true, the strokes are drawn in black when the stroke\n" " :arg clamp: 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 is between -90 and 90 degrees with respect to the main\n"
" direction and drawn in white otherwise. If false, the strokes\n" " direction and drawn in white otherwise. If false, the strokes\n"
" are always drawn in black.\n" " are always drawn in black.\n"
" :type iClamp: bool\n" " :type clamp: bool\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Assigns thicknesses to the stroke vertices so that the stroke looks\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" " 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" " thickest in a main direction, and the thinest in the direction\n"
" perpendicular to this one, and an interpolation inbetween.\n" " perpendicular to this one, and an interpolation inbetween.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args) static int convert_v2(PyObject *obj, void *v)
{ {
double d1, d2; return float_array_from_PyObject(obj, (float *)v, 2);
PyObject *obj3 = 0, *obj4 = 0; }
if(!( PyArg_ParseTuple(args, "ddOO", &d1, &d2, &obj3, &obj4) )) static int CalligraphicShader___init__(BPy_CalligraphicShader* self, PyObject *args, PyObject *kwds)
return -1; {
Vec2f *v = Vec2f_ptr_from_PyObject(obj3); static const char *kwlist[] = {"thickness_min", "thickness_max", "orientation", "clamp", NULL};
if( !v ) { double d1, d2;
PyErr_SetString(PyExc_TypeError, "argument 3 must be a 2D vector (either a list of 2 elements or Vector)"); float f3[2];
PyObject *obj4 = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "ddO&O!", (char **)kwlist,
&d1, &d2, convert_v2, f3, &PyBool_Type, &obj4))
{
return -1; return -1;
} }
self->py_ss.ss = new CalligraphicShader(d1, d2, *v, bool_from_PyBool(obj4) ); Vec2f v(f3[0], f3[1]);
delete v; self->py_ss.ss = new CalligraphicShader(d1, d2, v, bool_from_PyBool(obj4));
return 0; return 0;
} }
/*-----------------------BPy_CalligraphicShader type definition ------------------------------*/ /*-----------------------BPy_CalligraphicShader type definition ------------------------------*/

View File

@@ -15,29 +15,29 @@ static char ColorNoiseShader___doc__[] =
"\n" "\n"
"[Color shader]\n" "[Color shader]\n"
"\n" "\n"
".. method:: __init__(iAmplitude, iPeriod)\n" ".. method:: __init__(amplitude, period)\n"
"\n" "\n"
" Builds a ColorNoiseShader object.\n" " Builds a ColorNoiseShader object.\n"
"\n" "\n"
" :arg iAmplitude: The amplitude of the noise signal.\n" " :arg amplitude: The amplitude of the noise signal.\n"
" :type iAmplitude: float\n" " :type amplitude: float\n"
" :arg iPeriod: The period of the noise signal.\n" " :arg period: The period of the noise signal.\n"
" :type iPeriod: float\n" " :type period: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Shader to add noise to the stroke colors.\n" " Shader to add noise to the stroke colors.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int ColorNoiseShader___init__( BPy_ColorNoiseShader* self, PyObject *args) static int ColorNoiseShader___init__(BPy_ColorNoiseShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"amplitude", "period", NULL};
float f1, f2; float f1, f2;
if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2); self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2);
return 0; return 0;
} }

View File

@@ -27,24 +27,24 @@ static char ColorVariationPatternShader___doc__[] =
" repeted to fit the stroke.\n" " repeted to fit the stroke.\n"
" :type stretch: bool\n" " :type stretch: bool\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Applies a pattern to vary the original color. The new color is the\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" " result of the multiplication of the pattern and the original color.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int ColorVariationPatternShader___init__( BPy_ColorVariationPatternShader* self, PyObject *args) static int ColorVariationPatternShader___init__(BPy_ColorVariationPatternShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"pattern_name", "stretch", NULL};
const char *s; const char *s;
PyObject *obj = 0; PyObject *obj = 0;
if(!( PyArg_ParseTuple(args, "s|O", &s, &obj) ))
return -1;
bool b = (obj) ? bool_from_PyBool(obj) : true; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!", (char **)kwlist, &s, &PyBool_Type, &obj))
self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s,b); return -1;
bool b = (!obj) ? true : bool_from_PyBool(obj);
self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s, b);
return 0; return 0;
} }

View File

@@ -15,33 +15,33 @@ static char ConstantColorShader___doc__[] =
"\n" "\n"
"[Color shader]\n" "[Color shader]\n"
"\n" "\n"
".. method:: __init__(iR, iG, iB, iAlpha=1.0)\n" ".. method:: __init__(red, green, blue, alpha=1.0)\n"
"\n" "\n"
" Builds a ConstantColorShader object.\n" " Builds a ConstantColorShader object.\n"
"\n" "\n"
" :arg iR: The red component.\n" " :arg red: The red component.\n"
" :type iR: float\n" " :type red: float\n"
" :arg iG: The green component.\n" " :arg green: The green component.\n"
" :type iG: float\n" " :type green: float\n"
" :arg iB: The blue component.\n" " :arg blue: The blue component.\n"
" :type iB: float\n" " :type blue: float\n"
" :arg iAlpha: The alpha value.\n" " :arg alpha: The alpha value.\n"
" :type iAlpha: float\n" " :type alpha: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Assigns a constant color to every vertex of the Stroke.\n" " Assigns a constant color to every vertex of the Stroke.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int ConstantColorShader___init__( BPy_ConstantColorShader* self, PyObject *args) static int ConstantColorShader___init__(BPy_ConstantColorShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"red", "green", "blue", "alpha", NULL};
float f1, f2, f3, f4 = 1.0; float f1, f2, f3, f4 = 1.0;
if(!( PyArg_ParseTuple(args, "fff|f", &f1, &f2, &f3, &f4) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|f", (char **)kwlist, &f1, &f2, &f3, &f4))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4); self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4);
return 0; return 0;
} }

View File

@@ -22,20 +22,20 @@ static char ConstantThicknessShader___doc__[] =
" :arg thickness: The thickness that must be assigned to the stroke.\n" " :arg thickness: The thickness that must be assigned to the stroke.\n"
" :type thickness: float\n" " :type thickness: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Assigns an absolute constant thickness to every vertex of the Stroke.\n" " Assigns an absolute constant thickness to every vertex of the Stroke.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int ConstantThicknessShader___init__( BPy_ConstantThicknessShader* self, PyObject *args) static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"thickness", NULL};
float f; float f;
if(!( PyArg_ParseTuple(args, "f", &f) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f); self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f);
return 0; return 0;
} }

View File

@@ -15,33 +15,33 @@ static char ConstrainedIncreasingThicknessShader___doc__[] =
"\n" "\n"
"[Thickness shader]\n" "[Thickness shader]\n"
"\n" "\n"
".. method:: __init__(iThicknessMin, iThicknessMax, iRatio)\n" ".. method:: __init__(thickness_min, thickness_max, ratio)\n"
"\n" "\n"
" Builds a ConstrainedIncreasingThicknessShader object.\n" " Builds a ConstrainedIncreasingThicknessShader object.\n"
"\n" "\n"
" :arg iThicknessMin: The minimum thickness.\n" " :arg thickness_min: The minimum thickness.\n"
" :type iThicknessMin: float\n" " :type thickness_min: float\n"
" :arg iThicknessMax: The maximum thickness.\n" " :arg thickness_max: The maximum thickness.\n"
" :type iThicknessMax: float\n" " :type thickness_max: float\n"
" :arg iRatio: The thickness/length ratio that we don't want to exceed. \n" " :arg ratio: The thickness/length ratio that we don't want to exceed. \n"
" :type iRatio: float\n" " :type ratio: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Same as the :class:`IncreasingThicknessShader`, but here we allow\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" " the user to control the thickness/length ratio so that we don't get\n"
" fat short lines.\n" " fat short lines.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args) static int ConstrainedIncreasingThicknessShader___init__(BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"thickness_min", "thickness_max", "ratio", NULL};
float f1, f2, f3; float f1, f2, f3;
if(!( PyArg_ParseTuple(args, "fff", &f1, &f2, &f3) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff", (char **)kwlist, &f1, &f2, &f3))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3); self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3);
return 0; return 0;
} }

View File

@@ -15,17 +15,17 @@ static char GuidingLinesShader___doc__[] =
"\n" "\n"
"[Geometry shader]\n" "[Geometry shader]\n"
"\n" "\n"
".. method:: __init__(iOffset)\n" ".. method:: __init__(offset)\n"
"\n" "\n"
" Builds a GuidingLinesShader object.\n" " Builds a GuidingLinesShader object.\n"
"\n" "\n"
" :arg iOffset: The line that replaces the stroke is initially in the\n" " :arg offset: The line that replaces the stroke is initially in the\n"
" middle of the initial stroke bounding box. iOffset is the value\n" " middle of the initial stroke bounding box. offset is the value\n"
" of the displacement which is applied to this line along its\n" " of the displacement which is applied to this line along its\n"
" normal.\n" " normal.\n"
" :type iOffset: float\n" " :type offset: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Shader to modify the Stroke geometry so that it corresponds to its\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" " main direction line. This shader must be used together with the\n"
@@ -34,16 +34,16 @@ static char GuidingLinesShader___doc__[] =
" stroke's pieces. The bigger the pieces are, the rougher the\n" " stroke's pieces. The bigger the pieces are, the rougher the\n"
" approximation is.\n" " approximation is.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int GuidingLinesShader___init__( BPy_GuidingLinesShader* self, PyObject *args) static int GuidingLinesShader___init__(BPy_GuidingLinesShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"offset", NULL};
float f; float f;
if(!( PyArg_ParseTuple(args, "f", &f) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f); self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f);
return 0; return 0;
} }

View File

@@ -15,43 +15,44 @@ static char IncreasingColorShader___doc__[] =
"\n" "\n"
"[Color shader]\n" "[Color shader]\n"
"\n" "\n"
".. method:: __init__(iRm, iGm, iBm, iAlpham, iRM, iGM, iBM, iAlphaM)\n" ".. method:: __init__(red_min, green_min, blue_min, alpha_min, red_max, green_max, blue_max, alpha_max)\n"
"\n" "\n"
" Builds an IncreasingColorShader object.\n" " Builds an IncreasingColorShader object.\n"
"\n" "\n"
" :arg iRm: The first color red component.\n" " :arg red_min: The first color red component.\n"
" :type iRm: float\n" " :type red_min: float\n"
" :arg iGm: The first color green component.\n" " :arg green_min: The first color green component.\n"
" :type iGm: float\n" " :type green_min: float\n"
" :arg iBm: The first color blue component.\n" " :arg blue_min: The first color blue component.\n"
" :type iBm: float\n" " :type blue_min: float\n"
" :arg iAlpham: The first color alpha value.\n" " :arg alpha_min: The first color alpha value.\n"
" :type iAlpham: float\n" " :type alpha_min: float\n"
" :arg iRM: The second color red component.\n" " :arg red_max: The second color red component.\n"
" :type iRM: float\n" " :type red_max: float\n"
" :arg iGM: The second color green component.\n" " :arg green_max: The second color green component.\n"
" :type iGM: float\n" " :type green_max: float\n"
" :arg iBM: The second color blue component.\n" " :arg blue_max: The second color blue component.\n"
" :type iBM: float\n" " :type blue_max: float\n"
" :arg iAlphaM: The second color alpha value.\n" " :arg alpha_max: The second color alpha value.\n"
" :type iAlphaM: float\n" " :type alpha_max: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Assigns a varying color to the stroke. The user specifies two\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" " colors A and B. The stroke color will change linearly from A to B\n"
" between the first and the last vertex.\n" " between the first and the last vertex.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int IncreasingColorShader___init__( BPy_IncreasingColorShader* self, PyObject *args) static int IncreasingColorShader___init__(BPy_IncreasingColorShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"red_min", "green_min", "blue_min", "alpha_min",
"red_max", "green_max", "blue_max", "alpha_max", NULL};
float f1, f2, f3, f4, f5, f6, f7, f8; float f1, f2, f3, f4, f5, f6, f7, f8;
if(!( PyArg_ParseTuple(args, "ffffffff", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "ffffffff", (char **)kwlist, &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8); self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8);
return 0; return 0;
} }

View File

@@ -15,16 +15,16 @@ static char IncreasingThicknessShader___doc__[] =
"\n" "\n"
"[Thickness shader]\n" "[Thickness shader]\n"
"\n" "\n"
".. method:: __init__(iThicknessA, iThicknessB)\n" ".. method:: __init__(thickness_A, thickness_B)\n"
"\n" "\n"
" Builds an IncreasingThicknessShader object.\n" " Builds an IncreasingThicknessShader object.\n"
"\n" "\n"
" :arg iThicknessA: The first thickness value.\n" " :arg thickness_A: The first thickness value.\n"
" :type iThicknessA: float\n" " :type thickness_A: float\n"
" :arg iThicknessB: The second thickness value.\n" " :arg thickness_B: The second thickness value.\n"
" :type iThicknessB: float\n" " :type thickness_B: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Assigns thicknesses values such as the thickness increases from a\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" " thickness value A to a thickness value B between the first vertex\n"
@@ -32,16 +32,16 @@ static char IncreasingThicknessShader___doc__[] =
" this midpoint vertex and the last vertex. The thickness is\n" " this midpoint vertex and the last vertex. The thickness is\n"
" linearly interpolated from A to B.\n" " linearly interpolated from A to B.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int IncreasingThicknessShader___init__( BPy_IncreasingThicknessShader* self, PyObject *args) static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"thickness_A", "thickness_B", NULL};
float f1, f2; float f1, f2;
if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2); self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2);
return 0; return 0;
} }

View File

@@ -15,17 +15,17 @@ static char PolygonalizationShader___doc__[] =
"\n" "\n"
"[Geometry shader]\n" "[Geometry shader]\n"
"\n" "\n"
".. method:: __init__(iError)\n" ".. method:: __init__(error)\n"
"\n" "\n"
" Builds a PolygonalizationShader object.\n" " Builds a PolygonalizationShader object.\n"
"\n" "\n"
" :arg iError: The error we want our polygonal approximation to have\n" " :arg error: The error we want our polygonal approximation to have\n"
" with respect to the original geometry. The smaller, the closer\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 new stroke is to the orinal one. This error corresponds to\n"
" the maximum distance between the new stroke and the old one.\n" " the maximum distance between the new stroke and the old one.\n"
" :type iError: float\n" " :type error: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Modifies the Stroke geometry so that it looks more \"polygonal\".\n" " Modifies the Stroke geometry so that it looks more \"polygonal\".\n"
" The basic idea is to start from the minimal stroke approximation\n" " The basic idea is to start from the minimal stroke approximation\n"
@@ -33,16 +33,16 @@ static char PolygonalizationShader___doc__[] =
" to subdivide using the original stroke vertices until a certain\n" " to subdivide using the original stroke vertices until a certain\n"
" error is reached.\n" " error is reached.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int PolygonalizationShader___init__( BPy_PolygonalizationShader* self, PyObject *args) static int PolygonalizationShader___init__(BPy_PolygonalizationShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"error", NULL};
float f; float f;
if(!( PyArg_ParseTuple(args, "f", &f) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f); self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f);
return 0; return 0;
} }

View File

@@ -22,20 +22,20 @@ static char SamplingShader___doc__[] =
" :arg sampling: The sampling to use for the stroke resampling.\n" " :arg sampling: The sampling to use for the stroke resampling.\n"
" :type sampling: float\n" " :type sampling: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Resamples the stroke.\n" " Resamples the stroke.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int SamplingShader___init__( BPy_SamplingShader* self, PyObject *args) static int SamplingShader___init__(BPy_SamplingShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"sampling", NULL};
float f; float f;
if(!( PyArg_ParseTuple(args, "f", &f) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::SamplingShader(f); self->py_ss.ss = new StrokeShaders::SamplingShader(f);
return 0; return 0;
} }

View File

@@ -15,45 +15,53 @@ static char SmoothingShader___doc__[] =
"\n" "\n"
"[Geometry shader]\n" "[Geometry shader]\n"
"\n" "\n"
".. method:: __init__(iNbIteration, iFactorPoint, ifactorCurvature, iFactorCurvatureDifference, iAnisoPoint, iAnisNormal, iAnisoCurvature, icarricatureFactor)\n" ".. method:: __init__(num_iterations=100, factor_point=0.1,\n"
" factor_curvature=0.0, factor_curvature_difference=0.2,\n"
" aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0,\n"
" carricature_factor=1.0)\n"
"\n" "\n"
" Builds a SmoothingShader object.\n" " Builds a SmoothingShader object.\n"
"\n" "\n"
" :arg iNbIteration: The number of iterations (400).\n" " :arg num_iterations: The number of iterations.\n"
" :type iNbIteration: int\n" " :type num_iterations: int\n"
" :arg iFactorPoint: 0.0\n" " :arg factor_point: 0.1\n"
" :type iFactorPoint: float\n" " :type factor_point: float\n"
" :arg ifactorCurvature: 0.0\n" " :arg factor_curvature: 0.0\n"
" :type ifactorCurvature: float\n" " :type factor_curvature: float\n"
" :arg iFactorCurvatureDifference: 0.2\n" " :arg factor_curvature_difference: 0.2\n"
" :type iFactorCurvatureDifference: float\n" " :type factor_curvature_difference: float\n"
" :arg iAnisoPoint: \n" " :arg aniso_point: 0.0\n"
" :type iAnisoPoint: float\n" " :type aniso_point: float\n"
" :arg iAnisNormal: 0.0\n" " :arg aniso_normal: 0.0\n"
" :type iAnisNormal: float\n" " :type aniso_normal: float\n"
" :arg iAnisoCurvature: 0.0\n" " :arg aniso_curvature: 0.0\n"
" :type iAnisoCurvature: float\n" " :type aniso_curvature: float\n"
" :arg icarricatureFactor: 1.0\n" " :arg carricature_factor: 1.0\n"
" :type icarricatureFactor: float\n" " :type carricature_factor: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Smoothes the stroke by moving the vertices to make the stroke\n" " Smoothes the stroke by moving the vertices to make the stroke\n"
" smoother. Uses curvature flow to converge towards a curve of\n" " smoother. Uses curvature flow to converge towards a curve of\n"
" constant curvature. The diffusion method we use is anisotropic to\n" " constant curvature. The diffusion method we use is anisotropic to\n"
" prevent the diffusion accross corners.\n" " prevent the diffusion accross corners.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int SmoothingShader___init__( BPy_SmoothingShader* self, PyObject *args) static int SmoothingShader___init__(BPy_SmoothingShader* self, PyObject *args, PyObject *kwds)
{ {
int i1; static const char *kwlist[] = {"num_iterations", "factor_point", "factor_curvature",
double d2, d3, d4, d5, d6, d7, d8; "factor_curvature_difference", "aniso_point", "aniso_normal",
"aniso_curvature", "carricature_factor", NULL};
int i1 = 100;
double d2 = 0.1, d3 = 0.0, d4 = 0.2, d5 = 0.0, d6 = 0.0, d7 = 0.0, d8 = 1.0;
if(!( PyArg_ParseTuple(args, "iddddddd", &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iddddddd", (char **)kwlist,
&i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8))
{
return -1; return -1;
}
self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8); self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8);
return 0; return 0;
} }

View File

@@ -16,39 +16,42 @@ static char SpatialNoiseShader___doc__[] =
"\n" "\n"
"[Geometry shader]\n" "[Geometry shader]\n"
"\n" "\n"
".. method:: __init__(iAmount, ixScale, nbOctave, smooth, pureRandom)\n" ".. method:: __init__(amount, scale, num_octaves, smooth, pure_random)\n"
"\n" "\n"
" Builds a SpatialNoiseShader object.\n" " Builds a SpatialNoiseShader object.\n"
"\n" "\n"
" :arg iAmount: The amplitude of the noise.\n" " :arg amount: The amplitude of the noise.\n"
" :type iAmount: float\n" " :type amount: float\n"
" :arg ixScale: The noise frequency.\n" " :arg scale: The noise frequency.\n"
" :type ixScale: float\n" " :type scale: float\n"
" :arg nbOctave: The number of octaves\n" " :arg num_octaves: The number of octaves\n"
" :type nbOctave: int\n" " :type num_octaves: int\n"
" :arg smooth: True if you want the noise to be smooth.\n" " :arg smooth: True if you want the noise to be smooth.\n"
" :type smooth: bool\n" " :type smooth: bool\n"
" :arg pureRandom: True if you don't want any coherence.\n" " :arg pure_random: True if you don't want any coherence.\n"
" :type pureRandom: bool\n" " :type pure_random: bool\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Spatial Noise stroke shader. Moves the vertices to make the stroke\n" " Spatial Noise stroke shader. Moves the vertices to make the stroke\n"
" more noisy.\n" " more noisy.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int SpatialNoiseShader___init__( BPy_SpatialNoiseShader* self, PyObject *args) static int SpatialNoiseShader___init__(BPy_SpatialNoiseShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"amount", "scale", "num_octaves", "smooth", "pure_random", NULL};
float f1, f2; float f1, f2;
int i3; int i3;
PyObject *obj4 = 0, *obj5 = 0; 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) ); if (!PyArg_ParseTupleAndKeywords(args, kwds, "ffiO!O!", (char **)kwlist,
&f1, &f2, &i3, &PyBool_Type, &obj4, &PyBool_Type, &obj5))
{
return -1;
}
self->py_ss.ss = new SpatialNoiseShader(f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5));
return 0; return 0;
} }

View File

@@ -17,18 +17,18 @@ static char StrokeTextureShader___doc__[] =
"\n" "\n"
"[Texture shader]\n" "[Texture shader]\n"
"\n" "\n"
".. method:: __init__(textureFile, mediumType=MediumType.OPAQUE_MEDIUM, iTips=False)\n" ".. method:: __init__(texture_file, medium_type=MediumType.OPAQUE_MEDIUM, tips=False)\n"
"\n" "\n"
" Builds a StrokeTextureShader object.\n" " Builds a StrokeTextureShader object.\n"
"\n" "\n"
" :arg textureFile: \n" " :arg texture_file: \n"
" :type textureFile: str\n" " :type texture_file: str\n"
" :arg mediumType: The medium type and therefore, the blending mode\n" " :arg medium_type: The medium type and therefore, the blending mode\n"
" that must be used for the rendering of this stroke.\n" " that must be used for the rendering of this stroke.\n"
" :type mediumType: :class:`MediumType`\n" " :type medium_type: :class:`MediumType`\n"
" :arg iTips: Tells whether the texture includes tips or not. If it\n" " :arg tips: Tells whether the texture includes tips or not. If it\n"
" is the case, the texture image must respect the following format.\n" " is the case, the texture image must respect the following format.\n"
" :type iTips: bool\n" " :type tips: bool\n"
"\n" "\n"
" The format of a texture image including tips::\n" " The format of a texture image including tips::\n"
"\n" "\n"
@@ -44,26 +44,28 @@ static char StrokeTextureShader___doc__[] =
" * B : The stroke's left extremity texture.\n" " * B : The stroke's left extremity texture.\n"
" * C : The stroke's right extremity texture.\n" " * C : The stroke's right extremity texture.\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Assigns a texture and a blending mode to the stroke in order to\n" " Assigns a texture and a blending mode to the stroke in order to\n"
" simulate its marks system.\n" " simulate its marks system.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int StrokeTextureShader___init__( BPy_StrokeTextureShader* self, PyObject *args) static int StrokeTextureShader___init__(BPy_StrokeTextureShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"texture_file", "medium_type", "tips", NULL};
const char *s1; const char *s1;
PyObject *obj2 = 0, *obj3 = 0; 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; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!O!", (char **)kwlist,
bool b = (obj3) ? bool_from_PyBool(obj3) : true; &s1, &MediumType_Type, &obj2, &PyBool_Type, &obj3))
{
self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1,mt,b); return -1;
}
Stroke::MediumType mt = (!obj2) ? Stroke::OPAQUE_MEDIUM : MediumType_from_BPy_MediumType(obj2);
bool b = (!obj3) ? false : bool_from_PyBool(obj3);
self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1, mt, b);
return 0; return 0;
} }

View File

@@ -15,14 +15,14 @@ static char TextureAssignerShader___doc__[] =
"\n" "\n"
"[Texture shader]\n" "[Texture shader]\n"
"\n" "\n"
".. method:: __init__(id)\n" ".. method:: __init__(preset)\n"
"\n" "\n"
" Builds a TextureAssignerShader object.\n" " Builds a TextureAssignerShader object.\n"
"\n" "\n"
" :arg id: The preset number to use.\n" " :arg preset: The preset number to use.\n"
" :type id: int\n" " :type preset: int\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Assigns a texture to the stroke in order to simulate its marks\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" " system. This shader takes as input an integer value telling which\n"
@@ -42,16 +42,16 @@ static char TextureAssignerShader___doc__[] =
"\n" "\n"
" * Default: `/brushes/smoothAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n" " * Default: `/brushes/smoothAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int TextureAssignerShader___init__( BPy_TextureAssignerShader* self, PyObject *args) static int TextureAssignerShader___init__(BPy_TextureAssignerShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"preset", NULL};
int i; int i;
if(!( PyArg_ParseTuple(args, "i", &i) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i); self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i);
return 0; return 0;
} }

View File

@@ -15,29 +15,29 @@ static char ThicknessNoiseShader___doc__[] =
"\n" "\n"
"[Thickness shader]\n" "[Thickness shader]\n"
"\n" "\n"
".. method:: __init__(iAmplitude, iPeriod)\n" ".. method:: __init__(amplitude, period)\n"
"\n" "\n"
" Builds a ThicknessNoiseShader object.\n" " Builds a ThicknessNoiseShader object.\n"
"\n" "\n"
" :arg iAmplitude: The amplitude of the noise signal.\n" " :arg amplitude: The amplitude of the noise signal.\n"
" :type iAmplitude: float\n" " :type amplitude: float\n"
" :arg iPeriod: The period of the noise signal.\n" " :arg period: The period of the noise signal.\n"
" :type iPeriod: float\n" " :type period: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Adds some noise to the stroke thickness.\n" " Adds some noise to the stroke thickness.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int ThicknessNoiseShader___init__( BPy_ThicknessNoiseShader* self, PyObject *args) static int ThicknessNoiseShader___init__(BPy_ThicknessNoiseShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"amplitude", "period", NULL};
float f1, f2; float f1, f2;
if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) ))
return -1;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2))
return -1;
self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2); self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2);
return 0; return 0;
} }

View File

@@ -16,39 +16,39 @@ static char ThicknessVariationPatternShader___doc__[] =
"\n" "\n"
"[Thickness shader]\n" "[Thickness shader]\n"
"\n" "\n"
".. method:: __init__(pattern_name, iMinThickness, iMaxThickness, stretch)\n" ".. method:: __init__(pattern_name, thickness_min=1.0, thickness_max=5.0, stretch=True)\n"
"\n" "\n"
" Builds a ThicknessVariationPatternShader object.\n" " Builds a ThicknessVariationPatternShader object.\n"
"\n" "\n"
" :arg pattern_name: The texture file name.\n" " :arg pattern_name: The texture file name.\n"
" :type pattern_name: str\n" " :type pattern_name: str\n"
" :arg iMinThickness: The minimum thickness we don't want to exceed.\n" " :arg thickness_min: The minimum thickness we don't want to exceed.\n"
" :type iMinThickness: float\n" " :type thickness_min: float\n"
" :arg iMaxThickness: The maximum thickness we don't want to exceed.\n" " :arg thickness_max: The maximum thickness we don't want to exceed.\n"
" :type iMaxThickness: float\n" " :type thickness_max: float\n"
" :arg stretch: Tells whether the pattern texture must be stretched\n" " :arg stretch: Tells whether the pattern texture must be stretched\n"
" or repeted to fit the stroke.\n" " or repeated to fit the stroke.\n"
" :type stretch: bool\n" " :type stretch: bool\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Applies a pattern (texture) to vary thickness. The new thicknesses\n" " Applies a pattern (texture) to vary thickness. The new thicknesses\n"
" are the result of the multiplication of the pattern and the\n" " are the result of the multiplication of the pattern and the\n"
" original thickness.\n" " original thickness.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args) static int ThicknessVariationPatternShader___init__(BPy_ThicknessVariationPatternShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"pattern_name", "thickness_min", "thickness_max", "stretch", NULL};
const char *s1; const char *s1;
float f2 = 1.0, f3 = 5.0; float f2 = 1.0, f3 = 5.0;
PyObject *obj4 = 0; PyObject *obj4 = 0;
if(!( PyArg_ParseTuple(args, "s|ffO", &s1, &f2, &f3, &obj4) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ffO!", (char **)kwlist, &s1, &f2, &f3, &PyBool_Type, &obj4))
return -1; return -1;
bool b = (!obj4) ? true : bool_from_PyBool(obj4);
bool b = (obj4) ? bool_from_PyBool(obj4) : true;
self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b); self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b);
return 0; return 0;
} }

View File

@@ -15,28 +15,28 @@ static char TipRemoverShader___doc__[] =
"\n" "\n"
"[Geometry shader]\n" "[Geometry shader]\n"
"\n" "\n"
".. method:: __init__(tipLength)\n" ".. method:: __init__(tip_length)\n"
"\n" "\n"
" Builds a TipRemoverShader object.\n" " Builds a TipRemoverShader object.\n"
"\n" "\n"
" :arg tipLength: The length of the piece of stroke we want to remove\n" " :arg tip_length: The length of the piece of stroke we want to remove\n"
" at each extremity.\n" " at each extremity.\n"
" :type tipLength: float\n" " :type tip_length: float\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Removes the stroke's extremities.\n" " Removes the stroke's extremities.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int TipRemoverShader___init__( BPy_TipRemoverShader* self, PyObject *args) static int TipRemoverShader___init__(BPy_TipRemoverShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"tip_length", NULL};
double d; double d;
if(!( PyArg_ParseTuple(args, "d", &d) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "d", (char **)kwlist, &d))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::TipRemoverShader(d); self->py_ss.ss = new StrokeShaders::TipRemoverShader(d);
return 0; return 0;
} }

View File

@@ -15,27 +15,27 @@ static char fstreamShader___doc__[] =
"\n" "\n"
"[Output shader]\n" "[Output shader]\n"
"\n" "\n"
".. method:: __init__(iFileName)\n" ".. method:: __init__(filename)\n"
"\n" "\n"
" Builds a fstreamShader object.\n" " Builds a fstreamShader object.\n"
"\n" "\n"
" :arg iFileName: The output file name.\n" " :arg filename: The output file name.\n"
" :type iFileName: str\n" " :type filename: str\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Streams the Stroke in a file.\n" " Streams the Stroke in a file.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int fstreamShader___init__( BPy_fstreamShader* self, PyObject *args) static int fstreamShader___init__(BPy_fstreamShader* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"filename", NULL};
const char *s; const char *s;
if(!( PyArg_ParseTuple(args, "s", &s) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &s))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::fstreamShader(s); self->py_ss.ss = new StrokeShaders::fstreamShader(s);
return 0; return 0;
} }

View File

@@ -19,16 +19,18 @@ static char streamShader___doc__[] =
"\n" "\n"
" Builds a streamShader object.\n" " Builds a streamShader object.\n"
"\n" "\n"
".. method:: shade(s)\n" ".. method:: shade(stroke)\n"
"\n" "\n"
" Streams the Stroke into stdout.\n" " Streams the Stroke into stdout.\n"
"\n" "\n"
" :arg s: A Stroke object.\n" " :arg stroke: A Stroke object.\n"
" :type s: :class:`Stroke`\n"; " :type stroke: :class:`Stroke`\n";
static int streamShader___init__( BPy_streamShader* self, PyObject *args) static int streamShader___init__(BPy_streamShader* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_ss.ss = new StrokeShaders::streamShader(); self->py_ss.ss = new StrokeShaders::streamShader();
return 0; return 0;

View File

@@ -20,9 +20,11 @@ static char FalseUP0D___doc__[] =
" :return: False.\n" " :return: False.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int FalseUP0D___init__( BPy_FalseUP0D* self, PyObject *args) static int FalseUP0D___init__(BPy_FalseUP0D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_up0D.up0D = new Predicates0D::FalseUP0D(); self->py_up0D.up0D = new Predicates0D::FalseUP0D();
return 0; return 0;

View File

@@ -20,9 +20,11 @@ static char TrueUP0D___doc__[] =
" :return: True.\n" " :return: True.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int TrueUP0D___init__( BPy_TrueUP0D* self, PyObject *args ) static int TrueUP0D___init__(BPy_TrueUP0D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_up0D.up0D = new Predicates0D::TrueUP0D(); self->py_up0D.up0D = new Predicates0D::TrueUP0D();
return 0; return 0;

View File

@@ -21,9 +21,11 @@ static char ContourUP1D___doc__[] =
" :return: True if the Interface1D is a contour, false otherwise.\n" " :return: True if the Interface1D is a contour, false otherwise.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int ContourUP1D___init__( BPy_ContourUP1D* self, PyObject *args ) static int ContourUP1D___init__(BPy_ContourUP1D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::ContourUP1D(); self->py_up1D.up1D = new Predicates1D::ContourUP1D();
return 0; return 0;

View File

@@ -34,14 +34,14 @@ static char DensityLowerThanUP1D___doc__[] =
" :return: True if the density is lower than a threshold.\n" " :return: True if the density is lower than a threshold.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int DensityLowerThanUP1D___init__( BPy_DensityLowerThanUP1D* self, PyObject *args ) static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"threshold", "sigma", NULL};
double d1, d2 = 2.0; double d1, d2 = 2.0;
if( !PyArg_ParseTuple(args, "d|d", &d1, &d2) ) if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1, d2);
self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1,d2);
return 0; return 0;
} }

View File

@@ -28,13 +28,13 @@ static char EqualToChainingTimeStampUP1D___doc__[] =
" :return: True if the time stamp is equal to a user-defined value.\n" " :return: True if the time stamp is equal to a user-defined value.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int EqualToChainingTimeStampUP1D___init__( BPy_EqualToChainingTimeStampUP1D* self, PyObject *args ) static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1D* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"ts", NULL};
unsigned u; unsigned u;
if( !PyArg_ParseTuple(args, "I", &u) ) if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::EqualToChainingTimeStampUP1D(u); self->py_up1D.up1D = new Predicates1D::EqualToChainingTimeStampUP1D(u);
return 0; return 0;
} }

View File

@@ -28,13 +28,13 @@ static char EqualToTimeStampUP1D___doc__[] =
" :return: True if the time stamp is equal to a user-defined value.\n" " :return: True if the time stamp is equal to a user-defined value.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int EqualToTimeStampUP1D___init__( BPy_EqualToTimeStampUP1D* self, PyObject *args ) static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"ts", NULL};
unsigned u; unsigned u;
if( !PyArg_ParseTuple(args, "I", &u) ) if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u); self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u);
return 0; return 0;
} }

View File

@@ -23,9 +23,11 @@ static char ExternalContourUP1D___doc__[] =
" otherwise.\n" " otherwise.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int ExternalContourUP1D___init__( BPy_ExternalContourUP1D* self, PyObject *args ) static int ExternalContourUP1D___init__(BPy_ExternalContourUP1D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::ExternalContourUP1D(); self->py_up1D.up1D = new Predicates1D::ExternalContourUP1D();
return 0; return 0;

View File

@@ -20,9 +20,11 @@ static char FalseUP1D___doc__[] =
" :return: False.\n" " :return: False.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int FalseUP1D___init__( BPy_FalseUP1D* self, PyObject *args ) static int FalseUP1D___init__(BPy_FalseUP1D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::FalseUP1D(); self->py_up1D.up1D = new Predicates1D::FalseUP1D();
return 0; return 0;

View File

@@ -31,13 +31,13 @@ static char QuantitativeInvisibilityUP1D___doc__[] =
" value.\n" " value.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int QuantitativeInvisibilityUP1D___init__( BPy_QuantitativeInvisibilityUP1D* self, PyObject *args ) static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1D* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"qi", NULL};
int i = 0; int i = 0;
if( !PyArg_ParseTuple(args, "|i", &i) ) if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", (char **)kwlist, &i))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::QuantitativeInvisibilityUP1D(i); self->py_up1D.up1D = new Predicates1D::QuantitativeInvisibilityUP1D(i);
return 0; return 0;
} }

View File

@@ -11,14 +11,14 @@ extern "C" {
static char ShapeUP1D___doc__[] = static char ShapeUP1D___doc__[] =
"Class hierarchy: :class:`UnaryPredicate1D` > :class:`ShapeUP1D`\n" "Class hierarchy: :class:`UnaryPredicate1D` > :class:`ShapeUP1D`\n"
"\n" "\n"
".. method:: __init__(idFirst, idSecond=0)\n" ".. method:: __init__(first, second=0)\n"
"\n" "\n"
" Builds a ShapeUP1D object.\n" " Builds a ShapeUP1D object.\n"
"\n" "\n"
" :arg idFirst: The first Id component.\n" " :arg first: The first Id component.\n"
" :type idFirst: int\n" " :type first: int\n"
" :arg idSecond: The second Id component.\n" " :arg second: The second Id component.\n"
" :type idSecond: int\n" " :type second: int\n"
"\n" "\n"
".. method:: __call__(inter)\n" ".. method:: __call__(inter)\n"
"\n" "\n"
@@ -31,14 +31,14 @@ static char ShapeUP1D___doc__[] =
" user-specified Id.\n" " user-specified Id.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int ShapeUP1D___init__( BPy_ShapeUP1D* self, PyObject *args ) static int ShapeUP1D___init__(BPy_ShapeUP1D* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"first", "second", NULL};
unsigned u1, u2 = 0; unsigned u1, u2 = 0;
if( !PyArg_ParseTuple(args, "I|I", &u1, &u2) ) if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1, u2);
self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1,u2);
return 0; return 0;
} }

View File

@@ -20,9 +20,11 @@ static char TrueUP1D___doc__[] =
" :return: True.\n" " :return: True.\n"
" :rtype: bool\n"; " :rtype: bool\n";
static int TrueUP1D___init__( BPy_TrueUP1D* self, PyObject *args ) static int TrueUP1D___init__(BPy_TrueUP1D* self, PyObject *args, PyObject *kwds)
{ {
if(!( PyArg_ParseTuple(args, "") )) static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::TrueUP1D(); self->py_up1D.up1D = new Predicates1D::TrueUP1D();
return 0; return 0;

View File

@@ -28,11 +28,12 @@ static char WithinImageBoundaryUP1D___doc__[] =
"\n" "\n"
" Returns true if the Interface1D intersects with image boundary.\n"; " Returns true if the Interface1D intersects with image boundary.\n";
static int WithinImageBoundaryUP1D___init__( BPy_WithinImageBoundaryUP1D* self, PyObject *args ) static int WithinImageBoundaryUP1D___init__(BPy_WithinImageBoundaryUP1D* self, PyObject *args, PyObject *kwds)
{ {
static const char *kwlist[] = {"xmin", "ymin", "xmax", "ymax", NULL};
double xmin, ymin, xmax, ymax; double xmin, ymin, xmax, ymax;
if(!( PyArg_ParseTuple(args, "dddd", &xmin, &ymin, &xmax, &ymax) )) if (!PyArg_ParseTupleAndKeywords(args, kwds, "dddd", (char **)kwlist, &xmin, &ymin, &xmax, &ymax))
return -1; return -1;
self->py_up1D.up1D = new Predicates1D::WithinImageBoundaryUP1D(xmin, ymin, xmax, ymax); self->py_up1D.up1D = new Predicates1D::WithinImageBoundaryUP1D(xmin, ymin, xmax, ymax);
return 0; return 0;