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