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