diff options
Diffstat (limited to 'source/blender/freestyle/intern/python/StrokeShader')
22 files changed, 823 insertions, 370 deletions
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp index ca498576038..7ead138defb 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp @@ -8,8 +8,36 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for BackboneStretcherShader instance -----------*/ -static int BackboneStretcherShader___init__( BPy_BackboneStretcherShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char BackboneStretcherShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iAmount=2.0)\n" +"\n" +" Builds a BackboneStretcherShader object.\n" +"\n" +" :arg iAmount: The stretching amount value.\n" +" :type iAmount: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Stretches the stroke at its two extremities and following the\n" +" respective directions: v(1)v(0) and v(n-1)v(n).\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int BackboneStretcherShader___init__( BPy_BackboneStretcherShader* self, PyObject *args) +{ + float f = 2.0; + + if(!( PyArg_ParseTuple(args, "|f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f); + return 0; +} /*-----------------------BPy_BackboneStretcherShader type definition ------------------------------*/ @@ -34,7 +62,7 @@ PyTypeObject BackboneStretcherShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "BackboneStretcherShader objects", /* tp_doc */ + BackboneStretcherShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +82,6 @@ PyTypeObject BackboneStretcherShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int BackboneStretcherShader___init__( BPy_BackboneStretcherShader* self, PyObject *args) -{ - float f = 2.0; - - if(!( PyArg_ParseTuple(args, "|f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp index 2d1bd2abc8f..1ead40f4f6d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp @@ -8,8 +8,38 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for BezierCurveShader instance -----------*/ -static int BezierCurveShader___init__( BPy_BezierCurveShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char BezierCurveShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(error=4.0)\n" +"\n" +" Builds a BezierCurveShader object.\n" +"\n" +" :arg error: The error we're allowing for the approximation. This\n" +" error is the max distance allowed between the new curve and the\n" +" original geometry.\n" +" :type error: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Transforms the stroke backbone geometry so that it corresponds to a\n" +" Bezier Curve approximation of the original backbone geometry.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int BezierCurveShader___init__( BPy_BezierCurveShader* self, PyObject *args) +{ + float f = 4.0; + + if(!( PyArg_ParseTuple(args, "|f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::BezierCurveShader(f); + return 0; +} /*-----------------------BPy_BezierCurveShader type definition ------------------------------*/ @@ -34,7 +64,7 @@ PyTypeObject BezierCurveShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "BezierCurveShader objects", /* tp_doc */ + BezierCurveShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +84,6 @@ PyTypeObject BezierCurveShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int BezierCurveShader___init__( BPy_BezierCurveShader* self, PyObject *args) -{ - float f = 4.0; - - if(!( PyArg_ParseTuple(args, "|f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::BezierCurveShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index 75083a35af0..40afe17268e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -9,8 +9,57 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for CalligraphicShader instance -----------*/ -static int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char CalligraphicShader___doc__[] = +"[Thickness Shader]\n" +"\n" +".. method:: __init__(iMinThickness, iMaxThickness, iOrientation, iClamp)\n" +"\n" +" Builds a CalligraphicShader object.\n" +"\n" +" :arg iMinThickness: The minimum thickness in the direction\n" +" perpandicular to the main direction.\n" +" :type iMinThickness: float\n" +" :arg iMaxThickness: The maximum thickness in the main direction.\n" +" :type iMaxThickness: float\n" +" :arg iOrientation: The 2D vector giving the main direction.\n" +" :type iOrientation: :class:`Mathutils.Vector`\n" +" :arg iClamp: If true, the strokes are drawn in black when the stroke\n" +" direction is between -90 and 90 degrees with respect to the main\n" +" direction and drawn in white otherwise. If false, the strokes\n" +" are always drawn in black.\n" +" :type iClamp: bool\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns thicknesses to the stroke vertices so that the stroke looks\n" +" like made with a calligraphic tool, i.e. the stroke will be the\n" +" thickest in a main direction, and the thinest in the direction\n" +" perpendicular to this one, and an interpolation inbetween.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args) +{ + double d1, d2; + PyObject *obj3 = 0, *obj4 = 0; + + + if(!( PyArg_ParseTuple(args, "ddOO", &d1, &d2, &obj3, &obj4) )) + return -1; + Vec2f *v = Vec2f_ptr_from_PyObject(obj3); + if( !v ) { + PyErr_SetString(PyExc_TypeError, "argument 3 must be a 2D vector (either a list of 2 elements or Vector)"); + return -1; + } + self->py_ss.ss = new CalligraphicShader(d1, d2, *v, bool_from_PyBool(obj4) ); + delete v; + + return 0; + +} /*-----------------------BPy_CalligraphicShader type definition ------------------------------*/ @@ -35,7 +84,7 @@ PyTypeObject CalligraphicShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "CalligraphicShader objects", /* tp_doc */ + CalligraphicShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,28 +104,6 @@ PyTypeObject CalligraphicShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args) -{ - double d1, d2; - PyObject *obj3 = 0, *obj4 = 0; - - - if(!( PyArg_ParseTuple(args, "ddOO", &d1, &d2, &obj3, &obj4) )) - return -1; - Vec2f *v = Vec2f_ptr_from_PyObject(obj3); - if( !v ) { - PyErr_SetString(PyExc_TypeError, "argument 3 must be a 2D vector (either a list of 2 elements or Vector)"); - return -1; - } - self->py_ss.ss = new CalligraphicShader(d1, d2, *v, bool_from_PyBool(obj4) ); - delete v; - - return 0; - -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp index 1ec07a575c6..5293e449cf2 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp @@ -8,8 +8,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ColorNoiseShader instance -----------*/ -static int ColorNoiseShader___init__( BPy_ColorNoiseShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ColorNoiseShader___doc__[] = +"[Color shader]\n" +"\n" +".. method:: __init__(iAmplitude, iPeriod)\n" +"\n" +" Builds a ColorNoiseShader object.\n" +"\n" +" :arg iAmplitude: The amplitude of the noise signal.\n" +" :type iAmplitude: float\n" +" :arg iPeriod: The period of the noise signal.\n" +" :type iPeriod: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Shader to add noise to the stroke colors.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ColorNoiseShader___init__( BPy_ColorNoiseShader* self, PyObject *args) +{ + float f1, f2; + + if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2); + return 0; +} /*-----------------------BPy_ColorNoiseShader type definition ------------------------------*/ @@ -34,7 +63,7 @@ PyTypeObject ColorNoiseShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ColorNoiseShader objects", /* tp_doc */ + ColorNoiseShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +83,6 @@ PyTypeObject ColorNoiseShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ColorNoiseShader___init__( BPy_ColorNoiseShader* self, PyObject *args) -{ - float f1, f2; - - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp index 9d66baf5695..4e64e7d6c51 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp @@ -9,8 +9,42 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ColorVariationPatternShader instance -----------*/ -static int ColorVariationPatternShader___init__( BPy_ColorVariationPatternShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ColorVariationPatternShader___doc__[] = +"[Color shader]\n" +"\n" +".. method:: __init__(pattern_name, stretch=True)\n" +"\n" +" Builds a ColorVariationPatternShader object.\n" +"\n" +" :arg pattern_name: The file name of the texture file to use as\n" +" pattern.\n" +" :type pattern_name: string\n" +" :arg stretch: Tells whether the texture must be strecthed or\n" +" repeted to fit the stroke.\n" +" :type stretch: bool\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Applies a pattern to vary the original color. The new color is the\n" +" result of the multiplication of the pattern and the original color.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ColorVariationPatternShader___init__( BPy_ColorVariationPatternShader* self, PyObject *args) +{ + const char *s; + PyObject *obj = 0; + + if(!( PyArg_ParseTuple(args, "s|O", &s, &obj) )) + return -1; + + bool b = (obj) ? bool_from_PyBool(obj) : true; + self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s,b); + return 0; +} /*-----------------------BPy_ColorVariationPatternShader type definition ------------------------------*/ @@ -35,7 +69,7 @@ PyTypeObject ColorVariationPatternShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ColorVariationPatternShader objects", /* tp_doc */ + ColorVariationPatternShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,21 +89,6 @@ PyTypeObject ColorVariationPatternShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ColorVariationPatternShader___init__( BPy_ColorVariationPatternShader* self, PyObject *args) -{ - const char *s; - PyObject *obj = 0; - - if(!( PyArg_ParseTuple(args, "s|O", &s, &obj) )) - return -1; - - bool b = (obj) ? bool_from_PyBool(obj) : true; - self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s,b); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp index c6310486b6c..2b21acabc42 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp @@ -8,8 +8,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ConstantColorShader instance -----------*/ -static int ConstantColorShader___init__( BPy_ConstantColorShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ConstantColorShader___doc__[] = +"[Color shader]\n" +"\n" +".. method:: __init__(iR, iG, iB, iAlpha=1.0)\n" +"\n" +" Builds a ConstantColorShader object.\n" +"\n" +" :arg iR: The red component.\n" +" :type iR: float\n" +" :arg iG: The green component.\n" +" :type iG: float\n" +" :arg iB: The blue component.\n" +" :type iB: float\n" +" :arg iAlpha: The alpha value.\n" +" :type iAlpha: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns a constant color to every vertex of the Stroke.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ConstantColorShader___init__( BPy_ConstantColorShader* self, PyObject *args) +{ + float f1, f2, f3, f4 = 1.0; + + if(!( PyArg_ParseTuple(args, "fff|f", &f1, &f2, &f3, &f4) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4); + return 0; +} /*-----------------------BPy_ConstantColorShader type definition ------------------------------*/ @@ -34,7 +67,7 @@ PyTypeObject ConstantColorShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ConstantColorShader objects", /* tp_doc */ + ConstantColorShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +87,6 @@ PyTypeObject ConstantColorShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ConstantColorShader___init__( BPy_ConstantColorShader* self, PyObject *args) -{ - float f1, f2, f3, f4 = 1.0; - - if(!( PyArg_ParseTuple(args, "fff|f", &f1, &f2, &f3, &f4) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp index 2e94976c681..2db3685122f 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -8,8 +8,35 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ConstantThicknessShader instance -----------*/ -static int ConstantThicknessShader___init__( BPy_ConstantThicknessShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ConstantThicknessShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(thickness)\n" +"\n" +" Builds a ConstantThicknessShader object.\n" +"\n" +" :arg thickness: The thickness that must be assigned to the stroke.\n" +" :type thickness: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns an absolute constant thickness to every vertex of the Stroke.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ConstantThicknessShader___init__( BPy_ConstantThicknessShader* self, PyObject *args) +{ + float f; + + if(!( PyArg_ParseTuple(args, "f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f); + return 0; +} /*-----------------------BPy_ConstantThicknessShader type definition ------------------------------*/ @@ -34,7 +61,7 @@ PyTypeObject ConstantThicknessShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ConstantThicknessShader objects", /* tp_doc */ + ConstantThicknessShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +81,6 @@ PyTypeObject ConstantThicknessShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ConstantThicknessShader___init__( BPy_ConstantThicknessShader* self, PyObject *args) -{ - float f; - - if(!( PyArg_ParseTuple(args, "f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp index e0749914039..6dacca246b3 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp @@ -8,8 +8,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ConstrainedIncreasingThicknessShader instance -----------*/ -static int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ConstrainedIncreasingThicknessShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(iThicknessMin, iThicknessMax, iRatio)\n" +"\n" +" Builds a ConstrainedIncreasingThicknessShader object.\n" +"\n" +" :arg iThicknessMin: The minimum thickness.\n" +" :type iThicknessMin: float\n" +" :arg iThicknessMax: The maximum thickness.\n" +" :type iThicknessMax: float\n" +" :arg iRatio: The thickness/length ratio that we don't want to exceed. \n" +" :type iRatio: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Same as the :class:`IncreasingThicknessShader`, but here we allow\n" +" the user to control the thickness/length ratio so that we don't get\n" +" fat short lines.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args) +{ + float f1, f2, f3; + + if(!( PyArg_ParseTuple(args, "fff", &f1, &f2, &f3) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3); + return 0; +} /*-----------------------BPy_ConstrainedIncreasingThicknessShader type definition ------------------------------*/ @@ -34,7 +67,7 @@ PyTypeObject ConstrainedIncreasingThicknessShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ConstrainedIncreasingThicknessShader objects", /* tp_doc */ + ConstrainedIncreasingThicknessShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +87,6 @@ PyTypeObject ConstrainedIncreasingThicknessShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args) -{ - float f1, f2, f3; - - if(!( PyArg_ParseTuple(args, "fff", &f1, &f2, &f3) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp index 52da44be26d..4be1358147a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp @@ -8,8 +8,43 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for GuidingLinesShader instance -----------*/ -static int GuidingLinesShader___init__( BPy_GuidingLinesShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char GuidingLinesShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iOffset)\n" +"\n" +" Builds a GuidingLinesShader object.\n" +"\n" +" :arg iOffset: The line that replaces the stroke is initially in the\n" +" middle of the initial stroke bounding box. iOffset is the value\n" +" of the displacement which is applied to this line along its\n" +" normal.\n" +" :type iOffset: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Shader to modify the Stroke geometry so that it corresponds to its\n" +" main direction line. This shader must be used together with the\n" +" splitting operator using the curvature criterion. Indeed, the\n" +" precision of the approximation will depend on the size of the\n" +" stroke's pieces. The bigger the pieces are, the rougher the\n" +" approximation is.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int GuidingLinesShader___init__( BPy_GuidingLinesShader* self, PyObject *args) +{ + float f; + + if(!( PyArg_ParseTuple(args, "f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f); + return 0; +} /*-----------------------BPy_GuidingLinesShader type definition ------------------------------*/ @@ -34,7 +69,7 @@ PyTypeObject GuidingLinesShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "GuidingLinesShader objects", /* tp_doc */ + GuidingLinesShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +89,6 @@ PyTypeObject GuidingLinesShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int GuidingLinesShader___init__( BPy_GuidingLinesShader* self, PyObject *args) -{ - float f; - - if(!( PyArg_ParseTuple(args, "f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp index 0efc0d8902b..892585bf842 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp @@ -8,8 +8,51 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for IncreasingColorShader instance -----------*/ -static int IncreasingColorShader___init__( BPy_IncreasingColorShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char IncreasingColorShader___doc__[] = +"[Color shader]\n" +"\n" +".. method:: __init__(iRm, iGm, iBm, iAlpham, iRM, iGM, iBM, iAlphaM)\n" +"\n" +" Builds an IncreasingColorShader object.\n" +"\n" +" :arg iRm: The first color red component.\n" +" :type iRm: float\n" +" :arg iGm: The first color green component.\n" +" :type iGm: float\n" +" :arg iBm: The first color blue component.\n" +" :type iBm: float\n" +" :arg iAlpham: The first color alpha value.\n" +" :type iAlpham: float\n" +" :arg iRM: The second color red component.\n" +" :type iRM: float\n" +" :arg iGM: The second color green component.\n" +" :type iGM: float\n" +" :arg iBM: The second color blue component.\n" +" :type iBM: float\n" +" :arg iAlphaM: The second color alpha value.\n" +" :type iAlphaM: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns a varying color to the stroke. The user specifies two\n" +" colors A and B. The stroke color will change linearly from A to B\n" +" between the first and the last vertex.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int IncreasingColorShader___init__( BPy_IncreasingColorShader* self, PyObject *args) +{ + float f1, f2, f3, f4, f5, f6, f7, f8; + + if(!( PyArg_ParseTuple(args, "ffffffff", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8) )) + return -1; + + self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8); + return 0; +} /*-----------------------BPy_IncreasingColorShader type definition ------------------------------*/ @@ -34,7 +77,7 @@ PyTypeObject IncreasingColorShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "IncreasingColorShader objects", /* tp_doc */ + IncreasingColorShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +97,6 @@ PyTypeObject IncreasingColorShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int IncreasingColorShader___init__( BPy_IncreasingColorShader* self, PyObject *args) -{ - float f1, f2, f3, f4, f5, f6, f7, f8; - - if(!( PyArg_ParseTuple(args, "ffffffff", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8) )) - return -1; - - self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp index b851a0b224d..b5d067a4e44 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp @@ -8,8 +8,41 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for IncreasingThicknessShader instance -----------*/ -static int IncreasingThicknessShader___init__( BPy_IncreasingThicknessShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char IncreasingThicknessShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(iThicknessA, iThicknessB)\n" +"\n" +" Builds an IncreasingThicknessShader object.\n" +"\n" +" :arg iThicknessA: The first thickness value.\n" +" :type iThicknessA: float\n" +" :arg iThicknessB: The second thickness value.\n" +" :type iThicknessB: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns thicknesses values such as the thickness increases from a\n" +" thickness value A to a thickness value B between the first vertex\n" +" to the midpoint vertex and then decreases from B to a A between\n" +" this midpoint vertex and the last vertex. The thickness is\n" +" linearly interpolated from A to B.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int IncreasingThicknessShader___init__( BPy_IncreasingThicknessShader* self, PyObject *args) +{ + float f1, f2; + + if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) + return -1; + + self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2); + return 0; +} /*-----------------------BPy_IncreasingThicknessShader type definition ------------------------------*/ @@ -34,7 +67,7 @@ PyTypeObject IncreasingThicknessShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "IncreasingThicknessShader objects", /* tp_doc */ + IncreasingThicknessShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +87,6 @@ PyTypeObject IncreasingThicknessShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int IncreasingThicknessShader___init__( BPy_IncreasingThicknessShader* self, PyObject *args) -{ - float f1, f2; - - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) - return -1; - - self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp index e03334e6418..7c0c758a318 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp @@ -8,8 +8,42 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for PolygonalizationShader instance -----------*/ -static int PolygonalizationShader___init__( BPy_PolygonalizationShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char PolygonalizationShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iError)\n" +"\n" +" Builds a PolygonalizationShader object.\n" +"\n" +" :arg iError: The error we want our polygonal approximation to have\n" +" with respect to the original geometry. The smaller, the closer\n" +" the new stroke is to the orinal one. This error corresponds to\n" +" the maximum distance between the new stroke and the old one.\n" +" :type iError: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Modifies the Stroke geometry so that it looks more \"polygonal\".\n" +" The basic idea is to start from the minimal stroke approximation\n" +" consisting in a line joining the first vertex to the last one and\n" +" to subdivide using the original stroke vertices until a certain\n" +" error is reached.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int PolygonalizationShader___init__( BPy_PolygonalizationShader* self, PyObject *args) +{ + float f; + + if(!( PyArg_ParseTuple(args, "f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f); + return 0; +} /*-----------------------BPy_PolygonalizationShader type definition ------------------------------*/ @@ -34,7 +68,7 @@ PyTypeObject PolygonalizationShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "PolygonalizationShader objects", /* tp_doc */ + PolygonalizationShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +88,6 @@ PyTypeObject PolygonalizationShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int PolygonalizationShader___init__( BPy_PolygonalizationShader* self, PyObject *args) -{ - float f; - - if(!( PyArg_ParseTuple(args, "f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp index a14d2632af3..1dacb1499e9 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp @@ -8,8 +8,35 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SamplingShader instance -----------*/ -static int SamplingShader___init__( BPy_SamplingShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char SamplingShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(sampling)\n" +"\n" +" Builds a SamplingShader object.\n" +"\n" +" :arg sampling: The sampling to use for the stroke resampling.\n" +" :type sampling: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Resamples the stroke.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int SamplingShader___init__( BPy_SamplingShader* self, PyObject *args) +{ + float f; + + if(!( PyArg_ParseTuple(args, "f", &f) )) + return -1; + + self->py_ss.ss = new StrokeShaders::SamplingShader(f); + return 0; +} /*-----------------------BPy_SamplingShader type definition ------------------------------*/ @@ -34,7 +61,7 @@ PyTypeObject SamplingShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "SamplingShader objects", /* tp_doc */ + SamplingShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +81,6 @@ PyTypeObject SamplingShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int SamplingShader___init__( BPy_SamplingShader* self, PyObject *args) -{ - float f; - - if(!( PyArg_ParseTuple(args, "f", &f) )) - return -1; - - self->py_ss.ss = new StrokeShaders::SamplingShader(f); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp index 6b931237afb..20be1575bb3 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -8,8 +8,53 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SmoothingShader instance -----------*/ -static int SmoothingShader___init__( BPy_SmoothingShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char SmoothingShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iNbIteration, iFactorPoint, ifactorCurvature, iFactorCurvatureDifference, iAnisoPoint, iAnisNormal, iAnisoCurvature, icarricatureFactor)\n" +"\n" +" Builds a SmoothingShader object.\n" +"\n" +" :arg iNbIteration: The number of iterations (400).\n" +" :type iNbIteration: int\n" +" :arg iFactorPoint: 0.0\n" +" :type iFactorPoint: float\n" +" :arg ifactorCurvature: 0.0\n" +" :type ifactorCurvature: float\n" +" :arg iFactorCurvatureDifference: 0.2\n" +" :type iFactorCurvatureDifference: float\n" +" :arg iAnisoPoint: \n" +" :type iAnisoPoint: float\n" +" :arg iAnisNormal: 0.0\n" +" :type iAnisNormal: float\n" +" :arg iAnisoCurvature: 0.0\n" +" :type iAnisoCurvature: float\n" +" :arg icarricatureFactor: 1.0\n" +" :type icarricatureFactor: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Smoothes the stroke by moving the vertices to make the stroke\n" +" smoother. Uses curvature flow to converge towards a curve of\n" +" constant curvature. The diffusion method we use is anisotropic to\n" +" prevent the diffusion accross corners.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int SmoothingShader___init__( BPy_SmoothingShader* self, PyObject *args) +{ + int i1; + double d2, d3, d4, d5, d6, d7, d8; + + if(!( PyArg_ParseTuple(args, "iddddddd", &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8) )) + return -1; + + self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8); + return 0; +} /*-----------------------BPy_SmoothingShader type definition ------------------------------*/ @@ -34,7 +79,7 @@ PyTypeObject SmoothingShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "SmoothingShader objects", /* tp_doc */ + SmoothingShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,20 +99,6 @@ PyTypeObject SmoothingShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int SmoothingShader___init__( BPy_SmoothingShader* self, PyObject *args) -{ - int i1; - double d2, d3, d4, d5, d6, d7, d8; - - if(!( PyArg_ParseTuple(args, "iddddddd", &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8) )) - return -1; - - self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp index 4dd65c7087e..7df1d31a16d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp @@ -9,8 +9,46 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for SpatialNoiseShader instance -----------*/ -static int SpatialNoiseShader___init__( BPy_SpatialNoiseShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char SpatialNoiseShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(iAmount, ixScale, nbOctave, smooth, pureRandom)\n" +"\n" +" Builds a SpatialNoiseShader object.\n" +"\n" +" :arg iAmount: The amplitude of the noise.\n" +" :type iAmount: float\n" +" :arg ixScale: The noise frequency.\n" +" :type ixScale: float\n" +" :arg nbOctave: The number of octaves\n" +" :type nbOctave: int\n" +" :arg smooth: True if you want the noise to be smooth.\n" +" :type smooth: bool\n" +" :arg pureRandom: True if you don't want any coherence.\n" +" :type pureRandom: bool\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Spatial Noise stroke shader. Moves the vertices to make the stroke\n" +" more noisy.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int SpatialNoiseShader___init__( BPy_SpatialNoiseShader* self, PyObject *args) +{ + float f1, f2; + int i3; + PyObject *obj4 = 0, *obj5 = 0; + + if(!( PyArg_ParseTuple(args, "ffiOO", &f1, &f2, &i3, &obj4, &obj5) )) + return -1; + + self->py_ss.ss = new SpatialNoiseShader(f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5) ); + return 0; +} /*-----------------------BPy_SpatialNoiseShader type definition ------------------------------*/ @@ -35,7 +73,7 @@ PyTypeObject SpatialNoiseShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "SpatialNoiseShader objects", /* tp_doc */ + SpatialNoiseShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,21 +93,6 @@ PyTypeObject SpatialNoiseShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int SpatialNoiseShader___init__( BPy_SpatialNoiseShader* self, PyObject *args) -{ - float f1, f2; - int i3; - PyObject *obj4 = 0, *obj5 = 0; - - if(!( PyArg_ParseTuple(args, "ffiOO", &f1, &f2, &i3, &obj4, &obj5) )) - return -1; - - self->py_ss.ss = new SpatialNoiseShader(f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5) ); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp index 1e979ad7e1a..ed42a64eed0 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp @@ -10,8 +10,60 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for StrokeTextureShader instance -----------*/ -static int StrokeTextureShader___init__( BPy_StrokeTextureShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char StrokeTextureShader___doc__[] = +"[Texture shader]\n" +"\n" +".. method:: __init__(textureFile, mediumType=MediumType.OPAQUE_MEDIUM, iTips=False)\n" +"\n" +" Builds a StrokeTextureShader object.\n" +"\n" +" :arg textureFile: \n" +" :type textureFile: string\n" +" :arg mediumType: The medium type and therefore, the blending mode\n" +" that must be used for the rendering of this stroke.\n" +" :type mediumType: :class:`MediumType`\n" +" :arg iTips: Tells whether the texture includes tips or not. If it\n" +" is the case, the texture image must respect the following format.\n" +" :type iTips: bool\n" +"\n" +" The format of a texture image including tips::\n" +"\n" +" ___________\n" +" | |\n" +" | A |\n" +" |___________|\n" +" | | |\n" +" | B | C |\n" +" |_____|_____|\n" +"\n" +" * A : The stroke's corpus texture.\n" +" * B : The stroke's left extremity texture.\n" +" * C : The stroke's right extremity texture.\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns a texture and a blending mode to the stroke in order to\n" +" simulate its marks system.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int StrokeTextureShader___init__( BPy_StrokeTextureShader* self, PyObject *args) +{ + const char *s1; + PyObject *obj2 = 0, *obj3 = 0; + + if(!( PyArg_ParseTuple(args, "s|O!O", &s1, &MediumType_Type, &obj2, &obj3) )) + return -1; + + Stroke::MediumType mt = (obj2) ? MediumType_from_BPy_MediumType(obj2) : Stroke::OPAQUE_MEDIUM; + bool b = (obj3) ? bool_from_PyBool(obj3) : true; + + self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1,mt,b); + return 0; +} /*-----------------------BPy_StrokeTextureShader type definition ------------------------------*/ @@ -36,7 +88,7 @@ PyTypeObject StrokeTextureShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "StrokeTextureShader objects", /* tp_doc */ + StrokeTextureShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -56,23 +108,6 @@ PyTypeObject StrokeTextureShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int StrokeTextureShader___init__( BPy_StrokeTextureShader* self, PyObject *args) -{ - const char *s1; - PyObject *obj2 = 0, *obj3 = 0; - - if(!( PyArg_ParseTuple(args, "s|O!O", &s1, &MediumType_Type, &obj2, &obj3) )) - return -1; - - Stroke::MediumType mt = (obj2) ? MediumType_from_BPy_MediumType(obj2) : Stroke::OPAQUE_MEDIUM; - bool b = (obj3) ? bool_from_PyBool(obj3) : true; - - self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1,mt,b); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp index 27ac0bf15a5..4df76f6646b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp @@ -8,8 +8,51 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TextureAssignerShader instance -----------*/ -static int TextureAssignerShader___init__( BPy_TextureAssignerShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char TextureAssignerShader___doc__[] = +"[Texture shader]\n" +"\n" +".. method:: __init__(id)\n" +"\n" +" Builds a TextureAssignerShader object.\n" +"\n" +" :arg id: The preset number to use.\n" +" :type id: int\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Assigns a texture to the stroke in order to simulate its marks\n" +" system. This shader takes as input an integer value telling which\n" +" texture and blending mode to use among a set of predefined\n" +" textures. Here are the different presets:\n" +"\n" +" * 0: `/brushes/charcoalAlpha.bmp`, `MediumType.HUMID_MEDIUM`\n" +" * 1: `/brushes/washbrushAlpha.bmp`, `MediumType.HUMID_MEDIUM`\n" +" * 2: `/brushes/oil.bmp`, `MediumType.HUMID_MEDIUM`\n" +" * 3: `/brushes/oilnoblend.bmp`, `MediumType.HUMID_MEDIUM`\n" +" * 4: `/brushes/charcoalAlpha.bmp`, `MediumType.DRY_MEDIUM`\n" +" * 5: `/brushes/washbrushAlpha.bmp`, `MediumType.DRY_MEDIUM`\n" +" * 6: `/brushes/opaqueDryBrushAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n" +" * 7: `/brushes/opaqueBrushAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n" +"\n" +" Any other value will lead to the following preset:\n" +"\n" +" * Default: `/brushes/smoothAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int TextureAssignerShader___init__( BPy_TextureAssignerShader* self, PyObject *args) +{ + int i; + + if(!( PyArg_ParseTuple(args, "i", &i) )) + return -1; + + self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i); + return 0; +} /*-----------------------BPy_TextureAssignerShader type definition ------------------------------*/ @@ -34,7 +77,7 @@ PyTypeObject TextureAssignerShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "TextureAssignerShader objects", /* tp_doc */ + TextureAssignerShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +97,6 @@ PyTypeObject TextureAssignerShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int TextureAssignerShader___init__( BPy_TextureAssignerShader* self, PyObject *args) -{ - int i; - - if(!( PyArg_ParseTuple(args, "i", &i) )) - return -1; - - self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp index 11895239a2f..c880f05ed7b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp @@ -8,8 +8,37 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ThicknessNoiseShader instance -----------*/ -static int ThicknessNoiseShader___init__( BPy_ThicknessNoiseShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ThicknessNoiseShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(iAmplitude, iPeriod)\n" +"\n" +" Builds a ThicknessNoiseShader object.\n" +"\n" +" :arg iAmplitude: The amplitude of the noise signal.\n" +" :type iAmplitude: float\n" +" :arg iPeriod: The period of the noise signal.\n" +" :type iPeriod: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Adds some noise to the stroke thickness.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ThicknessNoiseShader___init__( BPy_ThicknessNoiseShader* self, PyObject *args) +{ + float f1, f2; + + if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) + return -1; + + self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2); + return 0; +} /*-----------------------BPy_ThicknessNoiseShader type definition ------------------------------*/ @@ -34,7 +63,7 @@ PyTypeObject ThicknessNoiseShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ThicknessNoiseShader objects", /* tp_doc */ + ThicknessNoiseShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +83,6 @@ PyTypeObject ThicknessNoiseShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ThicknessNoiseShader___init__( BPy_ThicknessNoiseShader* self, PyObject *args) -{ - float f1, f2; - - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) - return -1; - - self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp index 2759a9f9d13..f9472ae3444 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp @@ -9,8 +9,47 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for ThicknessVariationPatternShader instance -----------*/ -static int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char ThicknessVariationPatternShader___doc__[] = +"[Thickness shader]\n" +"\n" +".. method:: __init__(pattern_name, iMinThickness, iMaxThickness, stretch)\n" +"\n" +" Builds a ThicknessVariationPatternShader object.\n" +"\n" +" :arg pattern_name: The texture file name.\n" +" :type pattern_name: string\n" +" :arg iMinThickness: The minimum thickness we don't want to exceed.\n" +" :type iMinThickness: float\n" +" :arg iMaxThickness: The maximum thickness we don't want to exceed.\n" +" :type iMaxThickness: float\n" +" :arg stretch: Tells whether the pattern texture must be stretched\n" +" or repeted to fit the stroke.\n" +" :type stretch: bool\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Applies a pattern (texture) to vary thickness. The new thicknesses\n" +" are the result of the multiplication of the pattern and the\n" +" original thickness.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args) +{ + const char *s1; + float f2 = 1.0, f3 = 5.0; + PyObject *obj4 = 0; + + if(!( PyArg_ParseTuple(args, "s|ffO", &s1, &f2, &f3, &obj4) )) + return -1; + + bool b = (obj4) ? bool_from_PyBool(obj4) : true; + self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b); + return 0; +} /*-----------------------BPy_ThicknessVariationPatternShader type definition ------------------------------*/ @@ -35,7 +74,7 @@ PyTypeObject ThicknessVariationPatternShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ThicknessVariationPatternShader objects", /* tp_doc */ + ThicknessVariationPatternShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -55,22 +94,6 @@ PyTypeObject ThicknessVariationPatternShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args) -{ - const char *s1; - float f2 = 1.0, f3 = 5.0; - PyObject *obj4 = 0; - - if(!( PyArg_ParseTuple(args, "s|ffO", &s1, &f2, &f3, &obj4) )) - return -1; - - bool b = (obj4) ? bool_from_PyBool(obj4) : true; - self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp index 709dbad6a1b..ec90499a49b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp @@ -8,8 +8,36 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for TipRemoverShader instance -----------*/ -static int TipRemoverShader___init__( BPy_TipRemoverShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char TipRemoverShader___doc__[] = +"[Geometry shader]\n" +"\n" +".. method:: __init__(tipLength)\n" +"\n" +" Builds a TipRemoverShader object.\n" +"\n" +" :arg tipLength: The length of the piece of stroke we want to remove\n" +" at each extremity.\n" +" :type tipLength: float\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Removes the stroke's extremities.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int TipRemoverShader___init__( BPy_TipRemoverShader* self, PyObject *args) +{ + double d; + + if(!( PyArg_ParseTuple(args, "d", &d) )) + return -1; + + self->py_ss.ss = new StrokeShaders::TipRemoverShader(d); + return 0; +} /*-----------------------BPy_TipRemoverShader type definition ------------------------------*/ @@ -34,7 +62,7 @@ PyTypeObject TipRemoverShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "streamSTipRemoverShaderhader objects", /* tp_doc */ + TipRemoverShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +82,6 @@ PyTypeObject TipRemoverShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int TipRemoverShader___init__( BPy_TipRemoverShader* self, PyObject *args) -{ - double d; - - if(!( PyArg_ParseTuple(args, "d", &d) )) - return -1; - - self->py_ss.ss = new StrokeShaders::TipRemoverShader(d); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp index 49f724a8c3c..03881533ef6 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp @@ -8,8 +8,35 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for fstreamShader instance -----------*/ -static int fstreamShader___init__( BPy_fstreamShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char fstreamShader___doc__[] = +"[Output shader]\n" +"\n" +".. method:: __init__(iFileName)\n" +"\n" +" Builds a fstreamShader object.\n" +"\n" +" :arg iFileName: The output file name.\n" +" :type iFileName: string\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Streams the Stroke in a file.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int fstreamShader___init__( BPy_fstreamShader* self, PyObject *args) +{ + const char *s; + + if(!( PyArg_ParseTuple(args, "s", &s) )) + return -1; + + self->py_ss.ss = new StrokeShaders::fstreamShader(s); + return 0; +} /*-----------------------BPy_fstreamShader type definition ------------------------------*/ @@ -34,7 +61,7 @@ PyTypeObject fstreamShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "fstreamShader objects", /* tp_doc */ + fstreamShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,19 +81,6 @@ PyTypeObject fstreamShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int fstreamShader___init__( BPy_fstreamShader* self, PyObject *args) -{ - const char *s; - - if(!( PyArg_ParseTuple(args, "s", &s) )) - return -1; - - self->py_ss.ss = new StrokeShaders::fstreamShader(s); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp index a39bb15a329..31e0971b875 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp @@ -8,8 +8,29 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -/*--------------- Python API function prototypes for streamShader instance -----------*/ -static int streamShader___init__( BPy_streamShader* self, PyObject *args); +//------------------------INSTANCE METHODS ---------------------------------- + +static char streamShader___doc__[] = +"[Output shader]\n" +"\n" +".. method:: __init__()\n" +"\n" +" Builds a streamShader object.\n" +"\n" +".. method:: shade(s)\n" +"\n" +" Streams the Stroke into stdout.\n" +"\n" +" :arg s: A Stroke object.\n" +" :type s: :class:`Stroke`\n"; + +static int streamShader___init__( BPy_streamShader* self, PyObject *args) +{ + if(!( PyArg_ParseTuple(args, "") )) + return -1; + self->py_ss.ss = new StrokeShaders::streamShader(); + return 0; +} /*-----------------------BPy_streamShader type definition ------------------------------*/ @@ -34,7 +55,7 @@ PyTypeObject streamShader_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "streamShader objects", /* tp_doc */ + streamShader___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -54,16 +75,6 @@ PyTypeObject streamShader_Type = { 0, /* tp_new */ }; -//------------------------INSTANCE METHODS ---------------------------------- - -int streamShader___init__( BPy_streamShader* self, PyObject *args) -{ - if(!( PyArg_ParseTuple(args, "") )) - return -1; - self->py_ss.ss = new StrokeShaders::streamShader(); - return 0; -} - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus |