Blender V5.0
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
8
10
12#include "../BPy_Convert.h"
13
14using namespace Freestyle;
15
17
18//------------------------INSTANCE METHODS ----------------------------------
19
21 /* Wrap. */
22 CalligraphicShader___doc__,
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");
54 PyObject *args,
55 PyObject *kwds)
56{
57 static const char *kwlist[] = {
58 "thickness_min", "thickness_max", "orientation", "clamp", nullptr};
59 double d1, d2;
60 float f3[2];
61 PyObject *obj4 = nullptr;
62
63 if (!PyArg_ParseTupleAndKeywords(
64 args, kwds, "ddO&O!", (char **)kwlist, &d1, &d2, convert_v2, f3, &PyBool_Type, &obj4))
65 {
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
76 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
77 /*tp_name*/ "CalligraphicShader",
78 /*tp_basicsize*/ sizeof(BPy_CalligraphicShader),
79 /*tp_itemsize*/ 0,
80 /*tp_dealloc*/ nullptr,
81 /*tp_vectorcall_offset*/ 0,
82 /*tp_getattr*/ nullptr,
83 /*tp_setattr*/ nullptr,
84 /*tp_as_async*/ nullptr,
85 /*tp_repr*/ nullptr,
86 /*tp_as_number*/ nullptr,
87 /*tp_as_sequence*/ nullptr,
88 /*tp_as_mapping*/ nullptr,
89 /*tp_hash*/ nullptr,
90 /*tp_call*/ nullptr,
91 /*tp_str*/ nullptr,
92 /*tp_getattro*/ nullptr,
93 /*tp_setattro*/ nullptr,
94 /*tp_as_buffer*/ nullptr,
95 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
96 /*tp_doc*/ CalligraphicShader___doc__,
97 /*tp_traverse*/ nullptr,
98 /*tp_clear*/ nullptr,
99 /*tp_richcompare*/ nullptr,
100 /*tp_weaklistoffset*/ 0,
101 /*tp_iter*/ nullptr,
102 /*tp_iternext*/ nullptr,
103 /*tp_methods*/ nullptr,
104 /*tp_members*/ nullptr,
105 /*tp_getset*/ nullptr,
106 /*tp_base*/ &StrokeShader_Type,
107 /*tp_dict*/ nullptr,
108 /*tp_descr_get*/ nullptr,
109 /*tp_descr_set*/ nullptr,
110 /*tp_dictoffset*/ 0,
111 /*tp_init*/ (initproc)CalligraphicShader___init__,
112 /*tp_alloc*/ nullptr,
113 /*tp_new*/ nullptr,
114};
115
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
VecMat::Vec2< float > Vec2f
Definition Geom.h:22
inherits from class Rep
Definition AppCanvas.cpp:20