Blender  V3.3
BPy_SamplingShader.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "BPy_SamplingShader.h"
8 
9 #include "../../stroke/BasicStrokeShaders.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 using namespace Freestyle;
16 
18 
19 //------------------------INSTANCE METHODS ----------------------------------
20 
21 static char SamplingShader___doc__[] =
22  "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SamplingShader`\n"
23  "\n"
24  "[Geometry shader]\n"
25  "\n"
26  ".. method:: __init__(sampling)\n"
27  "\n"
28  " Builds a SamplingShader object.\n"
29  "\n"
30  " :arg sampling: The sampling to use for the stroke resampling.\n"
31  " :type sampling: float\n"
32  "\n"
33  ".. method:: shade(stroke)\n"
34  "\n"
35  " Resamples the stroke.\n"
36  "\n"
37  " :arg stroke: A Stroke object.\n"
38  " :type stroke: :class:`freestyle.types.Stroke`\n";
39 
40 static int SamplingShader___init__(BPy_SamplingShader *self, PyObject *args, PyObject *kwds)
41 {
42  static const char *kwlist[] = {"sampling", nullptr};
43  float f;
44 
45  if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) {
46  return -1;
47  }
48  self->py_ss.ss = new StrokeShaders::SamplingShader(f);
49  return 0;
50 }
51 
52 /*-----------------------BPy_SamplingShader type definition ------------------------------*/
53 
54 PyTypeObject SamplingShader_Type = {
55  PyVarObject_HEAD_INIT(nullptr, 0) "SamplingShader", /* tp_name */
56  sizeof(BPy_SamplingShader), /* tp_basicsize */
57  0, /* tp_itemsize */
58  nullptr, /* tp_dealloc */
59  0, /* tp_vectorcall_offset */
60  nullptr, /* tp_getattr */
61  nullptr, /* tp_setattr */
62  nullptr, /* tp_reserved */
63  nullptr, /* tp_repr */
64  nullptr, /* tp_as_number */
65  nullptr, /* tp_as_sequence */
66  nullptr, /* tp_as_mapping */
67  nullptr, /* tp_hash */
68  nullptr, /* tp_call */
69  nullptr, /* tp_str */
70  nullptr, /* tp_getattro */
71  nullptr, /* tp_setattro */
72  nullptr, /* tp_as_buffer */
73  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
74  SamplingShader___doc__, /* tp_doc */
75  nullptr, /* tp_traverse */
76  nullptr, /* tp_clear */
77  nullptr, /* tp_richcompare */
78  0, /* tp_weaklistoffset */
79  nullptr, /* tp_iter */
80  nullptr, /* tp_iternext */
81  nullptr, /* tp_methods */
82  nullptr, /* tp_members */
83  nullptr, /* tp_getset */
84  &StrokeShader_Type, /* tp_base */
85  nullptr, /* tp_dict */
86  nullptr, /* tp_descr_get */
87  nullptr, /* tp_descr_set */
88  0, /* tp_dictoffset */
89  (initproc)SamplingShader___init__, /* tp_init */
90  nullptr, /* tp_alloc */
91  nullptr, /* tp_new */
92 };
93 
95 
96 #ifdef __cplusplus
97 }
98 #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:18