Blender  V2.93
BPy_SpatialNoiseShader.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_SpatialNoiseShader.h"
22 
23 #include "../../stroke/AdvancedStrokeShaders.h"
24 #include "../BPy_Convert.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 using namespace Freestyle;
31 
33 
34 //------------------------INSTANCE METHODS ----------------------------------
35 
37  "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SpatialNoiseShader`\n"
38  "\n"
39  "[Geometry shader]\n"
40  "\n"
41  ".. method:: __init__(amount, scale, num_octaves, smooth, pure_random)\n"
42  "\n"
43  " Builds a SpatialNoiseShader object.\n"
44  "\n"
45  " :arg amount: The amplitude of the noise.\n"
46  " :type amount: float\n"
47  " :arg scale: The noise frequency.\n"
48  " :type scale: float\n"
49  " :arg num_octaves: The number of octaves\n"
50  " :type num_octaves: int\n"
51  " :arg smooth: True if you want the noise to be smooth.\n"
52  " :type smooth: bool\n"
53  " :arg pure_random: True if you don't want any coherence.\n"
54  " :type pure_random: bool\n"
55  "\n"
56  ".. method:: shade(stroke)\n"
57  "\n"
58  " Spatial Noise stroke shader. Moves the vertices to make the stroke\n"
59  " more noisy.\n"
60  "\n"
61  " :arg stroke: A Stroke object.\n"
62  " :type stroke: :class:`freestyle.types.Stroke`\n";
63 
65  PyObject *args,
66  PyObject *kwds)
67 {
68  static const char *kwlist[] = {
69  "amount", "scale", "num_octaves", "smooth", "pure_random", nullptr};
70  float f1, f2;
71  int i3;
72  PyObject *obj4 = nullptr, *obj5 = nullptr;
73 
74  if (!PyArg_ParseTupleAndKeywords(args,
75  kwds,
76  "ffiO!O!",
77  (char **)kwlist,
78  &f1,
79  &f2,
80  &i3,
81  &PyBool_Type,
82  &obj4,
83  &PyBool_Type,
84  &obj5)) {
85  return -1;
86  }
87  self->py_ss.ss = new SpatialNoiseShader(
88  f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5));
89  return 0;
90 }
91 
92 /*-----------------------BPy_SpatialNoiseShader type definition ------------------------------*/
93 
94 PyTypeObject SpatialNoiseShader_Type = {
95  PyVarObject_HEAD_INIT(nullptr, 0) "SpatialNoiseShader", /* tp_name */
96  sizeof(BPy_SpatialNoiseShader), /* tp_basicsize */
97  0, /* tp_itemsize */
98  nullptr, /* tp_dealloc */
99  0, /* tp_vectorcall_offset */
100  nullptr, /* tp_getattr */
101  nullptr, /* tp_setattr */
102  nullptr, /* tp_reserved */
103  nullptr, /* tp_repr */
104  nullptr, /* tp_as_number */
105  nullptr, /* tp_as_sequence */
106  nullptr, /* tp_as_mapping */
107  nullptr, /* tp_hash */
108  nullptr, /* tp_call */
109  nullptr, /* tp_str */
110  nullptr, /* tp_getattro */
111  nullptr, /* tp_setattro */
112  nullptr, /* tp_as_buffer */
113  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
114  SpatialNoiseShader___doc__, /* tp_doc */
115  nullptr, /* tp_traverse */
116  nullptr, /* tp_clear */
117  nullptr, /* tp_richcompare */
118  0, /* tp_weaklistoffset */
119  nullptr, /* tp_iter */
120  nullptr, /* tp_iternext */
121  nullptr, /* tp_methods */
122  nullptr, /* tp_members */
123  nullptr, /* tp_getset */
124  &StrokeShader_Type, /* tp_base */
125  nullptr, /* tp_dict */
126  nullptr, /* tp_descr_get */
127  nullptr, /* tp_descr_set */
128  0, /* tp_dictoffset */
129  (initproc)SpatialNoiseShader___init__, /* tp_init */
130  nullptr, /* tp_alloc */
131  nullptr, /* tp_new */
132 };
133 
135 
136 #ifdef __cplusplus
137 }
138 #endif
bool bool_from_PyBool(PyObject *b)
static char SpatialNoiseShader___doc__[]
PyTypeObject SpatialNoiseShader_Type
static int SpatialNoiseShader___init__(BPy_SpatialNoiseShader *self, PyObject *args, PyObject *kwds)
PyTypeObject StrokeShader_Type
inherits from class Rep
Definition: AppCanvas.cpp:32