Blender  V3.3
BPy_CalligraphicShader.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:`CalligraphicShader`\n"
24  "\n"
25  "[Thickness Shader]\n"
26  "\n"
27  ".. method:: __init__(thickness_min, thickness_max, orientation, clamp)\n"
28  "\n"
29  " Builds a CalligraphicShader object.\n"
30  "\n"
31  " :arg thickness_min: The minimum thickness in the direction\n"
32  " perpendicular to the main direction.\n"
33  " :type thickness_min: float\n"
34  " :arg thickness_max: The maximum thickness in the main direction.\n"
35  " :type thickness_max: float\n"
36  " :arg orientation: The 2D vector giving the main direction.\n"
37  " :type orientation: :class:`mathutils.Vector`\n"
38  " :arg clamp: If true, the strokes are drawn in black when the stroke\n"
39  " direction is between -90 and 90 degrees with respect to the main\n"
40  " direction and drawn in white otherwise. If false, the strokes\n"
41  " are always drawn in black.\n"
42  " :type clamp: bool\n"
43  "\n"
44  ".. method:: shade(stroke)\n"
45  "\n"
46  " Assigns thicknesses to the stroke vertices so that the stroke looks\n"
47  " like made with a calligraphic tool, i.e. the stroke will be the\n"
48  " thickest in a main direction, and the thinnest in the direction\n"
49  " perpendicular to this one, and an interpolation in between.\n"
50  "\n"
51  " :arg stroke: A Stroke object.\n"
52  " :type stroke: :class:`freestyle.types.Stroke`\n";
53 
55  PyObject *args,
56  PyObject *kwds)
57 {
58  static const char *kwlist[] = {
59  "thickness_min", "thickness_max", "orientation", "clamp", nullptr};
60  double d1, d2;
61  float f3[2];
62  PyObject *obj4 = nullptr;
63 
64  if (!PyArg_ParseTupleAndKeywords(
65  args, kwds, "ddO&O!", (char **)kwlist, &d1, &d2, convert_v2, f3, &PyBool_Type, &obj4)) {
66  return -1;
67  }
68  Vec2f v(f3[0], f3[1]);
69  self->py_ss.ss = new CalligraphicShader(d1, d2, v, bool_from_PyBool(obj4));
70  return 0;
71 }
72 
73 /*-----------------------BPy_CalligraphicShader type definition ------------------------------*/
74 
75 PyTypeObject CalligraphicShader_Type = {
76  PyVarObject_HEAD_INIT(nullptr, 0) "CalligraphicShader", /* tp_name */
77  sizeof(BPy_CalligraphicShader), /* tp_basicsize */
78  0, /* tp_itemsize */
79  nullptr, /* tp_dealloc */
80  0, /* tp_vectorcall_offset */
81  nullptr, /* tp_getattr */
82  nullptr, /* tp_setattr */
83  nullptr, /* tp_reserved */
84  nullptr, /* tp_repr */
85  nullptr, /* tp_as_number */
86  nullptr, /* tp_as_sequence */
87  nullptr, /* tp_as_mapping */
88  nullptr, /* tp_hash */
89  nullptr, /* tp_call */
90  nullptr, /* tp_str */
91  nullptr, /* tp_getattro */
92  nullptr, /* tp_setattro */
93  nullptr, /* tp_as_buffer */
94  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
95  CalligraphicShader___doc__, /* tp_doc */
96  nullptr, /* tp_traverse */
97  nullptr, /* tp_clear */
98  nullptr, /* tp_richcompare */
99  0, /* tp_weaklistoffset */
100  nullptr, /* tp_iter */
101  nullptr, /* tp_iternext */
102  nullptr, /* tp_methods */
103  nullptr, /* tp_members */
104  nullptr, /* tp_getset */
105  &StrokeShader_Type, /* tp_base */
106  nullptr, /* tp_dict */
107  nullptr, /* tp_descr_get */
108  nullptr, /* tp_descr_set */
109  0, /* tp_dictoffset */
110  (initproc)CalligraphicShader___init__, /* tp_init */
111  nullptr, /* tp_alloc */
112  nullptr, /* tp_new */
113 };
114 
116 
117 #ifdef __cplusplus
118 }
119 #endif
static char CalligraphicShader___doc__[]
static int CalligraphicShader___init__(BPy_CalligraphicShader *self, PyObject *args, PyObject *kwds)
PyTypeObject CalligraphicShader_Type
bool bool_from_PyBool(PyObject *b)
int convert_v2(PyObject *obj, void *v)
PyTypeObject StrokeShader_Type
ATTR_WARN_UNUSED_RESULT const BMVert * v
inherits from class Rep
Definition: AppCanvas.cpp:18