diff options
Diffstat (limited to 'source/blender/freestyle/intern/python/StrokeShader')
44 files changed, 2787 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp new file mode 100644 index 00000000000..7ead138defb --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp @@ -0,0 +1,89 @@ +#include "BPy_BackboneStretcherShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject BackboneStretcherShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BackboneStretcherShader", /* tp_name */ + sizeof(BPy_BackboneStretcherShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BackboneStretcherShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BackboneStretcherShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h new file mode 100644 index 00000000000..35a74c0bda2 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_BACKBONESTRETCHERSHADER_H +#define FREESTYLE_PYTHON_BACKBONESTRETCHERSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject BackboneStretcherShader_Type; + +#define BPy_BackboneStretcherShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &BackboneStretcherShader_Type) ) + +/*---------------------------Python BPy_BackboneStretcherShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_BackboneStretcherShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_BACKBONESTRETCHERSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp new file mode 100644 index 00000000000..1ead40f4f6d --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp @@ -0,0 +1,91 @@ +#include "BPy_BezierCurveShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject BezierCurveShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BezierCurveShader", /* tp_name */ + sizeof(BPy_BezierCurveShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BezierCurveShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BezierCurveShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h new file mode 100644 index 00000000000..b94ef88acea --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_BEZIERCURVESHADER_H +#define FREESTYLE_PYTHON_BEZIERCURVESHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject BezierCurveShader_Type; + +#define BPy_BezierCurveShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &BezierCurveShader_Type) ) + +/*---------------------------Python BPy_BezierCurveShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_BezierCurveShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_BEZIERCURVESHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp new file mode 100644 index 00000000000..acb2569f83c --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -0,0 +1,111 @@ +#include "BPy_CalligraphicShader.h" + +#include "../../stroke/AdvancedStrokeShaders.h" +#include "../BPy_Convert.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject CalligraphicShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "CalligraphicShader", /* tp_name */ + sizeof(BPy_CalligraphicShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CalligraphicShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CalligraphicShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h new file mode 100644 index 00000000000..c573b0184ad --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_CALLIGRAPHICSHADER_H +#define FREESTYLE_PYTHON_CALLIGRAPHICSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject CalligraphicShader_Type; + +#define BPy_CalligraphicShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &CalligraphicShader_Type) + +/*---------------------------Python BPy_CalligraphicShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_CalligraphicShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_CALLIGRAPHICSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp new file mode 100644 index 00000000000..5293e449cf2 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp @@ -0,0 +1,90 @@ +#include "BPy_ColorNoiseShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject ColorNoiseShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ColorNoiseShader", /* tp_name */ + sizeof(BPy_ColorNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ColorNoiseShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ColorNoiseShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h new file mode 100644 index 00000000000..694b847565e --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_COLORNOISESHADER_H +#define FREESTYLE_PYTHON_COLORNOISESHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ColorNoiseShader_Type; + +#define BPy_ColorNoiseShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ColorNoiseShader_Type) ) + +/*---------------------------Python BPy_ColorNoiseShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_ColorNoiseShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_COLORNOISESHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp new file mode 100644 index 00000000000..9c0817fa1a2 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp @@ -0,0 +1,96 @@ +#include "BPy_ColorVariationPatternShader.h" + +#include "../../stroke/BasicStrokeShaders.h" +#include "../BPy_Convert.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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: str\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 ------------------------------*/ + +PyTypeObject ColorVariationPatternShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ColorVariationPatternShader", /* tp_name */ + sizeof(BPy_ColorVariationPatternShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ColorVariationPatternShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ColorVariationPatternShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h new file mode 100644 index 00000000000..b1898ebfecf --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H +#define FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ColorVariationPatternShader_Type; + +#define BPy_ColorVariationPatternShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ColorVariationPatternShader_Type) ) + +/*---------------------------Python BPy_ColorVariationPatternShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_ColorVariationPatternShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp new file mode 100644 index 00000000000..2b21acabc42 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp @@ -0,0 +1,94 @@ +#include "BPy_ConstantColorShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject ConstantColorShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ConstantColorShader", /* tp_name */ + sizeof(BPy_ConstantColorShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstantColorShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstantColorShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h new file mode 100644 index 00000000000..30a09d852fd --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_CONSTANTCOLORSHADER_H +#define FREESTYLE_PYTHON_CONSTANTCOLORSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ConstantColorShader_Type; + +#define BPy_ConstantColorShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ConstantColorShader_Type) ) + +/*---------------------------Python BPy_ConstantColorShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_ConstantColorShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_CONSTANTCOLORSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp new file mode 100644 index 00000000000..2db3685122f --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -0,0 +1,88 @@ +#include "BPy_ConstantThicknessShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject ConstantThicknessShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ConstantThicknessShader", /* tp_name */ + sizeof(BPy_ConstantThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstantThicknessShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstantThicknessShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h new file mode 100644 index 00000000000..bb7f3c0f622 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_CONSTANTTHICKNESSSHADER_H +#define FREESTYLE_PYTHON_CONSTANTTHICKNESSSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ConstantThicknessShader_Type; + +#define BPy_ConstantThicknessShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ConstantThicknessShader_Type) ) + +/*---------------------------Python BPy_ConstantThicknessShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_ConstantThicknessShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_CONSTANTTHICKNESSSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp new file mode 100644 index 00000000000..6dacca246b3 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp @@ -0,0 +1,94 @@ +#include "BPy_ConstrainedIncreasingThicknessShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject ConstrainedIncreasingThicknessShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ConstrainedIncreasingThicknessShader", /* tp_name */ + sizeof(BPy_ConstrainedIncreasingThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstrainedIncreasingThicknessShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstrainedIncreasingThicknessShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h new file mode 100644 index 00000000000..38a8aa2bfe0 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_CONSTRAINEDINCREASINGTHICKNESSSHADER_H +#define FREESTYLE_PYTHON_CONSTRAINEDINCREASINGTHICKNESSSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ConstrainedIncreasingThicknessShader_Type; + +#define BPy_ConstrainedIncreasingThicknessShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ConstrainedIncreasingThicknessShader_Type) ) + +/*---------------------------Python BPy_ConstrainedIncreasingThicknessShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_ConstrainedIncreasingThicknessShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_CONSTRAINEDINCREASINGTHICKNESSSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp new file mode 100644 index 00000000000..4be1358147a --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp @@ -0,0 +1,96 @@ +#include "BPy_GuidingLinesShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject GuidingLinesShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "GuidingLinesShader", /* tp_name */ + sizeof(BPy_GuidingLinesShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GuidingLinesShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GuidingLinesShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h new file mode 100644 index 00000000000..e25704c33ba --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_GUIDINGLINESSHADER_H +#define FREESTYLE_PYTHON_GUIDINGLINESSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject GuidingLinesShader_Type; + +#define BPy_GuidingLinesShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GuidingLinesShader_Type) ) + +/*---------------------------Python BPy_GuidingLinesShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_GuidingLinesShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_GUIDINGLINESSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp new file mode 100644 index 00000000000..892585bf842 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp @@ -0,0 +1,104 @@ +#include "BPy_IncreasingColorShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject IncreasingColorShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "IncreasingColorShader", /* tp_name */ + sizeof(BPy_IncreasingColorShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncreasingColorShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncreasingColorShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h new file mode 100644 index 00000000000..9bc82e98098 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_INCREASINGCOLORSHADER_H +#define FREESTYLE_PYTHON_INCREASINGCOLORSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject IncreasingColorShader_Type; + +#define BPy_IncreasingColorShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &IncreasingColorShader_Type) ) + +/*---------------------------Python BPy_IncreasingColorShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_IncreasingColorShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_INCREASINGCOLORSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp new file mode 100644 index 00000000000..b5d067a4e44 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp @@ -0,0 +1,94 @@ +#include "BPy_IncreasingThicknessShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject IncreasingThicknessShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "IncreasingThicknessShader", /* tp_name */ + sizeof(BPy_IncreasingThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncreasingThicknessShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncreasingThicknessShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h new file mode 100644 index 00000000000..33d883b1860 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_INCREASINGTHICKNESSSHADER_H +#define FREESTYLE_PYTHON_INCREASINGTHICKNESSSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject IncreasingThicknessShader_Type; + +#define BPy_IncreasingThicknessShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &IncreasingThicknessShader_Type) ) + +/*---------------------------Python BPy_IncreasingThicknessShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_IncreasingThicknessShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_INCREASINGTHICKNESSSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp new file mode 100644 index 00000000000..7c0c758a318 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp @@ -0,0 +1,95 @@ +#include "BPy_PolygonalizationShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject PolygonalizationShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "PolygonalizationShader", /* tp_name */ + sizeof(BPy_PolygonalizationShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + PolygonalizationShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PolygonalizationShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h new file mode 100644 index 00000000000..85bcc00e869 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_POLYGONALIZATIONSHADER_H +#define FREESTYLE_PYTHON_POLYGONALIZATIONSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject PolygonalizationShader_Type; + +#define BPy_PolygonalizationShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &PolygonalizationShader_Type) ) + +/*---------------------------Python BPy_PolygonalizationShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_PolygonalizationShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_POLYGONALIZATIONSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp new file mode 100644 index 00000000000..1dacb1499e9 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp @@ -0,0 +1,88 @@ +#include "BPy_SamplingShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject SamplingShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "SamplingShader", /* tp_name */ + sizeof(BPy_SamplingShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SamplingShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SamplingShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h new file mode 100644 index 00000000000..dfc6efb3319 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_SAMPLINGSHADER_H +#define FREESTYLE_PYTHON_SAMPLINGSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject SamplingShader_Type; + +#define BPy_SamplingShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SamplingShader_Type) ) + +/*---------------------------Python BPy_SamplingShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_SamplingShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_SAMPLINGSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp new file mode 100644 index 00000000000..20be1575bb3 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -0,0 +1,106 @@ +#include "BPy_SmoothingShader.h" + +#include "../../stroke/AdvancedStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject SmoothingShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "SmoothingShader", /* tp_name */ + sizeof(BPy_SmoothingShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SmoothingShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SmoothingShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h new file mode 100644 index 00000000000..18d6ca3cc30 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHONSMOOTHINGSHADER_H +#define FREESTYLE_PYTHONSMOOTHINGSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject SmoothingShader_Type; + +#define BPy_SmoothingShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SmoothingShader_Type) ) + +/*---------------------------Python BPy_SmoothingShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_SmoothingShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHONSMOOTHINGSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp new file mode 100644 index 00000000000..7df1d31a16d --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp @@ -0,0 +1,100 @@ +#include "BPy_SpatialNoiseShader.h" + +#include "../../stroke/AdvancedStrokeShaders.h" +#include "../BPy_Convert.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject SpatialNoiseShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "SpatialNoiseShader", /* tp_name */ + sizeof(BPy_SpatialNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SpatialNoiseShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SpatialNoiseShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h new file mode 100644 index 00000000000..46e1c12385d --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_SPATIALNOISESHADER_H +#define FREESTYLE_PYTHON_SPATIALNOISESHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject SpatialNoiseShader_Type; + +#define BPy_SpatialNoiseShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SpatialNoiseShader_Type) ) + +/*---------------------------Python BPy_SpatialNoiseShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_SpatialNoiseShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_SPATIALNOISESHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp new file mode 100644 index 00000000000..77f82790c23 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp @@ -0,0 +1,115 @@ +#include "BPy_StrokeTextureShader.h" + +#include "../../stroke/BasicStrokeShaders.h" +#include "../BPy_Convert.h" +#include "../BPy_MediumType.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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: str\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 ------------------------------*/ + +PyTypeObject StrokeTextureShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "StrokeTextureShader", /* tp_name */ + sizeof(BPy_StrokeTextureShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeTextureShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeTextureShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h new file mode 100644 index 00000000000..c65506f2f14 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_STROKETEXTURESHADER_H +#define FREESTYLE_PYTHON_STROKETEXTURESHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject StrokeTextureShader_Type; + +#define BPy_StrokeTextureShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &StrokeTextureShader_Type) ) + +/*---------------------------Python BPy_StrokeTextureShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_StrokeTextureShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_STROKETEXTURESHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp new file mode 100644 index 00000000000..4df76f6646b --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp @@ -0,0 +1,104 @@ +#include "BPy_TextureAssignerShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject TextureAssignerShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "TextureAssignerShader", /* tp_name */ + sizeof(BPy_TextureAssignerShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TextureAssignerShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TextureAssignerShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h new file mode 100644 index 00000000000..9cffc1c1662 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H +#define FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject TextureAssignerShader_Type; + +#define BPy_TextureAssignerShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TextureAssignerShader_Type) ) + +/*---------------------------Python BPy_TextureAssignerShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_TextureAssignerShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp new file mode 100644 index 00000000000..c880f05ed7b --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp @@ -0,0 +1,90 @@ +#include "BPy_ThicknessNoiseShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject ThicknessNoiseShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ThicknessNoiseShader", /* tp_name */ + sizeof(BPy_ThicknessNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ThicknessNoiseShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ThicknessNoiseShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h new file mode 100644 index 00000000000..c3ef101683e --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_THICKNESSNOISESHADER_H +#define FREESTYLE_PYTHON_THICKNESSNOISESHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ThicknessNoiseShader_Type; + +#define BPy_ThicknessNoiseShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ThicknessNoiseShader_Type) ) + +/*---------------------------Python BPy_ThicknessNoiseShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_ThicknessNoiseShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_THICKNESSNOISESHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp new file mode 100644 index 00000000000..097de7a432c --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp @@ -0,0 +1,101 @@ +#include "BPy_ThicknessVariationPatternShader.h" + +#include "../../stroke/BasicStrokeShaders.h" +#include "../BPy_Convert.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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: str\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 ------------------------------*/ + +PyTypeObject ThicknessVariationPatternShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "ThicknessVariationPatternShader", /* tp_name */ + sizeof(BPy_ThicknessVariationPatternShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ThicknessVariationPatternShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ThicknessVariationPatternShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h new file mode 100644 index 00000000000..302c9e005ae --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H +#define FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ThicknessVariationPatternShader_Type; + +#define BPy_ThicknessVariationPatternShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ThicknessVariationPatternShader_Type) ) + +/*---------------------------Python BPy_ThicknessVariationPatternShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_ThicknessVariationPatternShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp new file mode 100644 index 00000000000..ec90499a49b --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp @@ -0,0 +1,89 @@ +#include "BPy_TipRemoverShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject TipRemoverShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "TipRemoverShader", /* tp_name */ + sizeof(BPy_TipRemoverShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TipRemoverShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TipRemoverShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h new file mode 100644 index 00000000000..a1b2e3988bc --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_TIPREMOVERSHADER_H +#define FREESTYLE_PYTHON_TIPREMOVERSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject TipRemoverShader_Type; + +#define BPy_TipRemoverShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TipRemoverShader_Type) ) + +/*---------------------------Python BPy_TipRemoverShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_TipRemoverShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_TIPREMOVERSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp new file mode 100644 index 00000000000..806f4e8f9a5 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp @@ -0,0 +1,88 @@ +#include "BPy_fstreamShader.h" + +#include "../../stroke/AdvancedStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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: str\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 ------------------------------*/ + +PyTypeObject fstreamShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "fstreamShader", /* tp_name */ + sizeof(BPy_fstreamShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + fstreamShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)fstreamShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h new file mode 100644 index 00000000000..843d50505db --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_FSTREAMSHADER_H +#define FREESTYLE_PYTHON_FSTREAMSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject fstreamShader_Type; + +#define BPy_fstreamShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &fstreamShader_Type) ) + +/*---------------------------Python BPy_fstreamShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_fstreamShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_FSTREAMSHADER_H */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp new file mode 100644 index 00000000000..31e0971b875 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp @@ -0,0 +1,82 @@ +#include "BPy_streamShader.h" + +#include "../../stroke/BasicStrokeShaders.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +//------------------------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 ------------------------------*/ + +PyTypeObject streamShader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "streamShader", /* tp_name */ + sizeof(BPy_streamShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + streamShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)streamShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h new file mode 100644 index 00000000000..38056d5fa59 --- /dev/null +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h @@ -0,0 +1,31 @@ +#ifndef FREESTYLE_PYTHON_STREAMSHADER_H +#define FREESTYLE_PYTHON_STREAMSHADER_H + +#include "../BPy_StrokeShader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject streamShader_Type; + +#define BPy_streamShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &streamShader_Type) ) + +/*---------------------------Python BPy_streamShader structure definition----------*/ +typedef struct { + BPy_StrokeShader py_ss; +} BPy_streamShader; + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_STREAMSHADER_H */ |