Blender  V2.93
BPy_SamplingShader.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "BPy_SamplingShader.h"
22 
23 #include "../../stroke/BasicStrokeShaders.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 using namespace Freestyle;
30 
32 
33 //------------------------INSTANCE METHODS ----------------------------------
34 
35 static char SamplingShader___doc__[] =
36  "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SamplingShader`\n"
37  "\n"
38  "[Geometry shader]\n"
39  "\n"
40  ".. method:: __init__(sampling)\n"
41  "\n"
42  " Builds a SamplingShader object.\n"
43  "\n"
44  " :arg sampling: The sampling to use for the stroke resampling.\n"
45  " :type sampling: float\n"
46  "\n"
47  ".. method:: shade(stroke)\n"
48  "\n"
49  " Resamples the stroke.\n"
50  "\n"
51  " :arg stroke: A Stroke object.\n"
52  " :type stroke: :class:`freestyle.types.Stroke`\n";
53 
54 static int SamplingShader___init__(BPy_SamplingShader *self, PyObject *args, PyObject *kwds)
55 {
56  static const char *kwlist[] = {"sampling", nullptr};
57  float f;
58 
59  if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) {
60  return -1;
61  }
62  self->py_ss.ss = new StrokeShaders::SamplingShader(f);
63  return 0;
64 }
65 
66 /*-----------------------BPy_SamplingShader type definition ------------------------------*/
67 
68 PyTypeObject SamplingShader_Type = {
69  PyVarObject_HEAD_INIT(nullptr, 0) "SamplingShader", /* tp_name */
70  sizeof(BPy_SamplingShader), /* tp_basicsize */
71  0, /* tp_itemsize */
72  nullptr, /* tp_dealloc */
73  0, /* tp_vectorcall_offset */
74  nullptr, /* tp_getattr */
75  nullptr, /* tp_setattr */
76  nullptr, /* tp_reserved */
77  nullptr, /* tp_repr */
78  nullptr, /* tp_as_number */
79  nullptr, /* tp_as_sequence */
80  nullptr, /* tp_as_mapping */
81  nullptr, /* tp_hash */
82  nullptr, /* tp_call */
83  nullptr, /* tp_str */
84  nullptr, /* tp_getattro */
85  nullptr, /* tp_setattro */
86  nullptr, /* tp_as_buffer */
87  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
88  SamplingShader___doc__, /* tp_doc */
89  nullptr, /* tp_traverse */
90  nullptr, /* tp_clear */
91  nullptr, /* tp_richcompare */
92  0, /* tp_weaklistoffset */
93  nullptr, /* tp_iter */
94  nullptr, /* tp_iternext */
95  nullptr, /* tp_methods */
96  nullptr, /* tp_members */
97  nullptr, /* tp_getset */
98  &StrokeShader_Type, /* tp_base */
99  nullptr, /* tp_dict */
100  nullptr, /* tp_descr_get */
101  nullptr, /* tp_descr_set */
102  0, /* tp_dictoffset */
103  (initproc)SamplingShader___init__, /* tp_init */
104  nullptr, /* tp_alloc */
105  nullptr, /* tp_new */
106 };
107 
109 
110 #ifdef __cplusplus
111 }
112 #endif
static int SamplingShader___init__(BPy_SamplingShader *self, PyObject *args, PyObject *kwds)
PyTypeObject SamplingShader_Type
static char SamplingShader___doc__[]
PyTypeObject StrokeShader_Type
inherits from class Rep
Definition: AppCanvas.cpp:32