2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
* ***** END GPL LICENSE BLOCK *****
21
/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp
25
#include "BPy_StrokeTextureShader.h"
27
#include "../../stroke/BasicStrokeShaders.h"
28
#include "../BPy_Convert.h"
29
#include "../BPy_MediumType.h"
35
///////////////////////////////////////////////////////////////////////////////////////////
37
//------------------------INSTANCE METHODS ----------------------------------
39
static char StrokeTextureShader___doc__[] =
40
"Class hierarchy: :class:`StrokeShader` > :class:`StrokeTextureShader`\n"
44
".. method:: __init__(texture_file, medium_type=Stroke.OPAQUE_MEDIUM, tips=False)\n"
46
" Builds a StrokeTextureShader object.\n"
48
" :arg texture_file: \n"
49
" :type texture_file: str\n"
50
" :arg medium_type: The medium type and therefore, the blending mode\n"
51
" that must be used for the rendering of this stroke.\n"
52
" :type medium_type: :class:`MediumType`\n"
53
" :arg tips: Tells whether the texture includes tips or not. If it\n"
54
" is the case, the texture image must respect the following format.\n"
57
" The format of a texture image including tips::\n"
67
" * A : The stroke's corpus texture.\n"
68
" * B : The stroke's left extremity texture.\n"
69
" * C : The stroke's right extremity texture.\n"
71
".. method:: shade(stroke)\n"
73
" Assigns a texture and a blending mode to the stroke in order to\n"
74
" simulate its marks system.\n"
76
" :arg stroke: A Stroke object.\n"
77
" :type stroke: :class:`Stroke`\n";
79
static int StrokeTextureShader___init__(BPy_StrokeTextureShader *self, PyObject *args, PyObject *kwds)
81
static const char *kwlist[] = {"texture_file", "medium_type", "tips", NULL};
83
PyObject *obj2 = 0, *obj3 = 0;
85
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!O!", (char **)kwlist,
86
&s1, &MediumType_Type, &obj2, &PyBool_Type, &obj3))
90
Stroke::MediumType mt = (!obj2) ? Stroke::OPAQUE_MEDIUM : MediumType_from_BPy_MediumType(obj2);
91
bool b = (!obj3) ? false : bool_from_PyBool(obj3);
92
self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1, mt, b);
96
/*-----------------------BPy_StrokeTextureShader type definition ------------------------------*/
98
PyTypeObject StrokeTextureShader_Type = {
99
PyVarObject_HEAD_INIT(NULL, 0)
100
"StrokeTextureShader", /* tp_name */
101
sizeof(BPy_StrokeTextureShader), /* tp_basicsize */
109
0, /* tp_as_number */
110
0, /* tp_as_sequence */
111
0, /* tp_as_mapping */
117
0, /* tp_as_buffer */
118
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
119
StrokeTextureShader___doc__, /* tp_doc */
122
0, /* tp_richcompare */
123
0, /* tp_weaklistoffset */
129
&StrokeShader_Type, /* tp_base */
131
0, /* tp_descr_get */
132
0, /* tp_descr_set */
133
0, /* tp_dictoffset */
134
(initproc)StrokeTextureShader___init__, /* tp_init */
139
///////////////////////////////////////////////////////////////////////////////////////////