Blender V5.0
BPy_StrokeAttribute.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
11#include "BPy_Convert.h"
12
13#include "../generic/py_capi_utils.hh"
14
15using namespace Freestyle;
16
18
19//-------------------MODULE INITIALIZATION--------------------------------
21{
22 if (module == nullptr) {
23 return -1;
24 }
25
26 if (PyType_Ready(&StrokeAttribute_Type) < 0) {
27 return -1;
28 }
29 PyModule_AddObjectRef(module, "StrokeAttribute", (PyObject *)&StrokeAttribute_Type);
30
32 return 0;
33}
34
35//------------------------INSTANCE METHODS ----------------------------------
36
38 /* Wrap. */
39 StrokeAttribute_doc,
40 "Class to define a set of attributes associated with a :class:`StrokeVertex`.\n"
41 "The attribute set stores the color, alpha and thickness values for a Stroke\n"
42 "Vertex.\n"
43 "\n"
44 ".. method:: __init__()\n"
45 " __init__(brother)\n"
46 " __init__(red, green, blue, alpha, thickness_right, thickness_left)\n"
47 " __init__(attribute1, attribute2, t)\n"
48 "\n"
49 " Creates a :class:`StrokeAttribute` object using either a default constructor,\n"
50 " copy constructor, overloaded constructor, or and interpolation constructor\n"
51 " to interpolate between two :class:`StrokeAttribute` objects.\n"
52 "\n"
53 " :arg brother: A StrokeAttribute object to be used as a copy constructor.\n"
54 " :type brother: :class:`StrokeAttribute`\n"
55 " :arg red: Red component of a stroke color.\n"
56 " :type red: float\n"
57 " :arg green: Green component of a stroke color.\n"
58 " :type green: float\n"
59 " :arg blue: Blue component of a stroke color.\n"
60 " :type blue: float\n"
61 " :arg alpha: Alpha component of a stroke color.\n"
62 " :type alpha: float\n"
63 " :arg thickness_right: Stroke thickness on the right.\n"
64 " :type thickness_right: float\n"
65 " :arg thickness_left: Stroke thickness on the left.\n"
66 " :type thickness_left: float\n"
67 " :arg attribute1: The first StrokeAttribute object.\n"
68 " :type attribute1: :class:`StrokeAttribute`\n"
69 " :arg attribute2: The second StrokeAttribute object.\n"
70 " :type attribute2: :class:`StrokeAttribute`\n"
71 " :arg t: The interpolation parameter (0 <= t <= 1).\n"
72 " :type t: float\n");
73static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
74{
75 static const char *kwlist_1[] = {"brother", nullptr};
76 static const char *kwlist_2[] = {"attribute1", "attribute2", "t", nullptr};
77 static const char *kwlist_3[] = {
78 "red", "green", "blue", "alpha", "thickness_right", "thickness_left", nullptr};
79 PyObject *obj1 = nullptr, *obj2 = nullptr;
80 float red, green, blue, alpha, thickness_right, thickness_left, t;
81
82 if (PyArg_ParseTupleAndKeywords(
83 args, kwds, "|O!", (char **)kwlist_1, &StrokeAttribute_Type, &obj1))
84 {
85 if (!obj1) {
86 self->sa = new StrokeAttribute();
87 }
88 else {
89 self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa));
90 }
91 }
92 else if ((void)PyErr_Clear(),
93 PyArg_ParseTupleAndKeywords(args,
94 kwds,
95 "O!O!f",
96 (char **)kwlist_2,
98 &obj1,
100 &obj2,
101 &t))
102 {
103 self->sa = new StrokeAttribute(
104 *(((BPy_StrokeAttribute *)obj1)->sa), *(((BPy_StrokeAttribute *)obj2)->sa), t);
105 }
106 else if ((void)PyErr_Clear(),
107 PyArg_ParseTupleAndKeywords(args,
108 kwds,
109 "ffffff",
110 (char **)kwlist_3,
111 &red,
112 &green,
113 &blue,
114 &alpha,
115 &thickness_right,
116 &thickness_left))
117 {
118 self->sa = new StrokeAttribute(red, green, blue, alpha, thickness_right, thickness_left);
119 }
120 else {
121 PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
122 return -1;
123 }
124 self->borrowed = false;
125 return 0;
126}
127
129{
130 if (self->sa && !self->borrowed) {
131 delete self->sa;
132 }
133 Py_TYPE(self)->tp_free((PyObject *)self);
134}
135
137{
138 stringstream repr("StrokeAttribute:");
139 repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG()
140 << " b: " << self->sa->getColorB() << " a: " << self->sa->getAlpha()
141 << " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL();
142
143 return PyC_UnicodeFromStdStr(repr.str());
144}
145
147 /* Wrap. */
148 StrokeAttribute_get_attribute_real_doc,
149 ".. method:: get_attribute_real(name)\n"
150 "\n"
151 " Returns an attribute of float type.\n"
152 "\n"
153 " :arg name: The name of the attribute.\n"
154 " :type name: str\n"
155 " :return: The attribute value.\n"
156 " :rtype: float\n");
158 PyObject *args,
159 PyObject *kwds)
160{
161 static const char *kwlist[] = {"name", nullptr};
162 char *attr;
163
164 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
165 return nullptr;
166 }
167 double a = self->sa->getAttributeReal(attr);
168 return PyFloat_FromDouble(a);
169}
170
172 /* Wrap. */
173 StrokeAttribute_get_attribute_vec2_doc,
174 ".. method:: get_attribute_vec2(name)\n"
175 "\n"
176 " Returns an attribute of two-dimensional vector type.\n"
177 "\n"
178 " :arg name: The name of the attribute.\n"
179 " :type name: str\n"
180 " :return: The attribute value.\n"
181 " :rtype: :class:`mathutils.Vector`\n");
183 PyObject *args,
184 PyObject *kwds)
185{
186 static const char *kwlist[] = {"name", nullptr};
187 char *attr;
188
189 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
190 return nullptr;
191 }
192 Vec2f a = self->sa->getAttributeVec2f(attr);
193 return Vector_from_Vec2f(a);
194}
195
197 /* Wrap. */
198 StrokeAttribute_get_attribute_vec3_doc,
199 ".. method:: get_attribute_vec3(name)\n"
200 "\n"
201 " Returns an attribute of three-dimensional vector type.\n"
202 "\n"
203 " :arg name: The name of the attribute.\n"
204 " :type name: str\n"
205 " :return: The attribute value.\n"
206 " :rtype: :class:`mathutils.Vector`\n");
208 PyObject *args,
209 PyObject *kwds)
210{
211 static const char *kwlist[] = {"name", nullptr};
212 char *attr;
213
214 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
215 return nullptr;
216 }
217 Vec3f a = self->sa->getAttributeVec3f(attr);
218 return Vector_from_Vec3f(a);
219}
220
222 /* Wrap. */
223 StrokeAttribute_has_attribute_real_doc,
224 ".. method:: has_attribute_real(name)\n"
225 "\n"
226 " Checks whether the attribute name of float type is available.\n"
227 "\n"
228 " :arg name: The name of the attribute.\n"
229 " :type name: str\n"
230 " :return: True if the attribute is available.\n"
231 " :rtype: bool\n");
233 PyObject *args,
234 PyObject *kwds)
235{
236 static const char *kwlist[] = {"name", nullptr};
237 char *attr;
238
239 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
240 return nullptr;
241 }
242 return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr));
243}
244
246 /* Wrap. */
247 StrokeAttribute_has_attribute_vec2_doc,
248 ".. method:: has_attribute_vec2(name)\n"
249 "\n"
250 " Checks whether the attribute name of two-dimensional vector type\n"
251 " is available.\n"
252 "\n"
253 " :arg name: The name of the attribute.\n"
254 " :type name: str\n"
255 " :return: True if the attribute is available.\n"
256 " :rtype: bool\n");
258 PyObject *args,
259 PyObject *kwds)
260{
261 static const char *kwlist[] = {"name", nullptr};
262 char *attr;
263
264 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
265 return nullptr;
266 }
267 return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr));
268}
269
271 /* Wrap. */
272 StrokeAttribute_has_attribute_vec3_doc,
273 ".. method:: has_attribute_vec3(name)\n"
274 "\n"
275 " Checks whether the attribute name of three-dimensional vector\n"
276 " type is available.\n"
277 "\n"
278 " :arg name: The name of the attribute.\n"
279 " :type name: str\n"
280 " :return: True if the attribute is available.\n"
281 " :rtype: bool\n");
283 PyObject *args,
284 PyObject *kwds)
285{
286 static const char *kwlist[] = {"name", nullptr};
287 char *attr;
288
289 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
290 return nullptr;
291 }
292 return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr));
293}
294
296 /* Wrap. */
297 StrokeAttribute_set_attribute_real_doc,
298 ".. method:: set_attribute_real(name, value)\n"
299 "\n"
300 " Adds a user-defined attribute of float type. If there is no\n"
301 " attribute of the given name, it is added. Otherwise, the new value\n"
302 " replaces the old one.\n"
303 "\n"
304 " :arg name: The name of the attribute.\n"
305 " :type name: str\n"
306 " :arg value: The attribute value.\n"
307 " :type value: float\n");
309 PyObject *args,
310 PyObject *kwds)
311{
312 static const char *kwlist[] = {"name", "value", nullptr};
313 char *s = nullptr;
314 double d = 0;
315
316 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) {
317 return nullptr;
318 }
319 self->sa->setAttributeReal(s, d);
320 Py_RETURN_NONE;
321}
322
324 /* Wrap. */
325 StrokeAttribute_set_attribute_vec2_doc,
326 ".. method:: set_attribute_vec2(name, value)\n"
327 "\n"
328 " Adds a user-defined attribute of two-dimensional vector type. If\n"
329 " there is no attribute of the given name, it is added. Otherwise,\n"
330 " the new value replaces the old one.\n"
331 "\n"
332 " :arg name: The name of the attribute.\n"
333 " :type name: str\n"
334 " :arg value: The attribute value.\n"
335 " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
337 PyObject *args,
338 PyObject *kwds)
339{
340 static const char *kwlist[] = {"name", "value", nullptr};
341 char *s;
342 PyObject *obj = nullptr;
343 Vec2f vec;
344
345 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
346 return nullptr;
347 }
348 if (!Vec2f_ptr_from_PyObject(obj, vec)) {
349 PyErr_SetString(PyExc_TypeError,
350 "argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
351 return nullptr;
352 }
353 self->sa->setAttributeVec2f(s, vec);
354 Py_RETURN_NONE;
355}
356
358 /* Wrap. */
359 StrokeAttribute_set_attribute_vec3_doc,
360 ".. method:: set_attribute_vec3(name, value)\n"
361 "\n"
362 " Adds a user-defined attribute of three-dimensional vector type.\n"
363 " If there is no attribute of the given name, it is added.\n"
364 " Otherwise, the new value replaces the old one.\n"
365 "\n"
366 " :arg name: The name of the attribute.\n"
367 " :type name: str\n"
368 " :arg value: The attribute value as a 3D vector.\n"
369 " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
371 PyObject *args,
372 PyObject *kwds)
373{
374 static const char *kwlist[] = {"name", "value", nullptr};
375 char *s;
376 PyObject *obj = nullptr;
377 Vec3f vec;
378
379 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
380 return nullptr;
381 }
382 if (!Vec3f_ptr_from_PyObject(obj, vec)) {
383 PyErr_SetString(PyExc_TypeError,
384 "argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
385 return nullptr;
386 }
387 self->sa->setAttributeVec3f(s, vec);
388 Py_RETURN_NONE;
389}
390
391#ifdef __GNUC__
392# ifdef __clang__
393# pragma clang diagnostic push
394# pragma clang diagnostic ignored "-Wcast-function-type"
395# else
396# pragma GCC diagnostic push
397# pragma GCC diagnostic ignored "-Wcast-function-type"
398# endif
399#endif
400
401static PyMethodDef BPy_StrokeAttribute_methods[] = {
402 {"get_attribute_real",
404 METH_VARARGS | METH_KEYWORDS,
405 StrokeAttribute_get_attribute_real_doc},
406 {"get_attribute_vec2",
408 METH_VARARGS | METH_KEYWORDS,
409 StrokeAttribute_get_attribute_vec2_doc},
410 {"get_attribute_vec3",
412 METH_VARARGS | METH_KEYWORDS,
413 StrokeAttribute_get_attribute_vec3_doc},
414 {"has_attribute_real",
416 METH_VARARGS | METH_KEYWORDS,
417 StrokeAttribute_has_attribute_real_doc},
418 {"has_attribute_vec2",
420 METH_VARARGS | METH_KEYWORDS,
421 StrokeAttribute_has_attribute_vec2_doc},
422 {"has_attribute_vec3",
424 METH_VARARGS | METH_KEYWORDS,
425 StrokeAttribute_has_attribute_vec3_doc},
426 {"set_attribute_real",
428 METH_VARARGS | METH_KEYWORDS,
429 StrokeAttribute_set_attribute_real_doc},
430 {"set_attribute_vec2",
432 METH_VARARGS | METH_KEYWORDS,
433 StrokeAttribute_set_attribute_vec2_doc},
434 {"set_attribute_vec3",
436 METH_VARARGS | METH_KEYWORDS,
437 StrokeAttribute_set_attribute_vec3_doc},
438 {nullptr, nullptr, 0, nullptr},
439};
440
441#ifdef __GNUC__
442# ifdef __clang__
443# pragma clang diagnostic pop
444# else
445# pragma GCC diagnostic pop
446# endif
447#endif
448
449/*----------------------mathutils callbacks ----------------------------*/
450
451/* subtype */
452#define MATHUTILS_SUBTYPE_COLOR 1
453#define MATHUTILS_SUBTYPE_THICKNESS 2
454
456{
457 if (!BPy_StrokeAttribute_Check(bmo->cb_user)) {
458 return -1;
459 }
460 return 0;
461}
462
464{
466 switch (subtype) {
468 bmo->data[0] = self->sa->getColorR();
469 bmo->data[1] = self->sa->getColorG();
470 bmo->data[2] = self->sa->getColorB();
471 break;
473 bmo->data[0] = self->sa->getThicknessR();
474 bmo->data[1] = self->sa->getThicknessL();
475 break;
476 default:
477 return -1;
478 }
479 return 0;
480}
481
483{
485 switch (subtype) {
487 self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]);
488 break;
490 self->sa->setThickness(bmo->data[0], bmo->data[1]);
491 break;
492 default:
493 return -1;
494 }
495 return 0;
496}
497
498static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
499{
501 switch (subtype) {
503 switch (index) {
504 case 0:
505 bmo->data[0] = self->sa->getColorR();
506 break;
507 case 1:
508 bmo->data[1] = self->sa->getColorG();
509 break;
510 case 2:
511 bmo->data[2] = self->sa->getColorB();
512 break;
513 default:
514 return -1;
515 }
516 break;
518 switch (index) {
519 case 0:
520 bmo->data[0] = self->sa->getThicknessR();
521 break;
522 case 1:
523 bmo->data[1] = self->sa->getThicknessL();
524 break;
525 default:
526 return -1;
527 }
528 break;
529 default:
530 return -1;
531 }
532 return 0;
533}
534
535static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
536{
538 switch (subtype) {
540 float r = (index == 0) ? bmo->data[0] : self->sa->getColorR();
541 float g = (index == 1) ? bmo->data[1] : self->sa->getColorG();
542 float b = (index == 2) ? bmo->data[2] : self->sa->getColorB();
543 self->sa->setColor(r, g, b);
544 break;
545 }
547 float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR();
548 float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL();
549 self->sa->setThickness(tr, tl);
550 break;
551 }
552 default:
553 return -1;
554 }
555 return 0;
556}
557
565
567
572
573/*----------------------StrokeAttribute get/setters ----------------------------*/
574
576 /* Wrap. */
577 StrokeAttribute_alpha_doc,
578 "Alpha component of the stroke color.\n"
579 "\n"
580 ":type: float\n");
581static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void * /*closure*/)
582{
583 return PyFloat_FromDouble(self->sa->getAlpha());
584}
585
587 PyObject *value,
588 void * /*closure*/)
589{
590 float scalar;
591 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
592 /* parsed item not a number */
593 PyErr_SetString(PyExc_TypeError, "value must be a number");
594 return -1;
595 }
596 self->sa->setAlpha(scalar);
597 return 0;
598}
599
601 /* Wrap. */
602 StrokeAttribute_color_doc,
603 "RGB components of the stroke color.\n"
604 "\n"
605 ":type: :class:`mathutils.Color`\n");
611
613 PyObject *value,
614 void * /*closure*/)
615{
616 float v[3];
617 if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) {
618 return -1;
619 }
620 self->sa->setColor(v[0], v[1], v[2]);
621 return 0;
622}
623
625 /* Wrap. */
626 StrokeAttribute_thickness_doc,
627 "Right and left components of the stroke thickness.\n"
628 "The right (left) component is the thickness on the right (left) of the vertex\n"
629 "when following the stroke.\n"
630 "\n"
631 ":type: :class:`mathutils.Vector`\n");
637
639 PyObject *value,
640 void * /*closure*/)
641{
642 float v[2];
643 if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) {
644 return -1;
645 }
646 self->sa->setThickness(v[0], v[1]);
647 return 0;
648}
649
651 /* Wrap. */
652 StrokeAttribute_visible_doc,
653 "The visibility flag. True if the StrokeVertex is visible.\n"
654 "\n"
655 ":type: bool\n");
656static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void * /*closure*/)
657{
658 return PyBool_from_bool(self->sa->isVisible());
659}
660
662 PyObject *value,
663 void * /*closure*/)
664{
665 if (!PyBool_Check(value)) {
666 PyErr_SetString(PyExc_TypeError, "value must be boolean");
667 return -1;
668 }
669 self->sa->setVisible(bool_from_PyBool(value));
670 return 0;
671}
672
673static PyGetSetDef BPy_StrokeAttribute_getseters[] = {
674 {"alpha",
677 StrokeAttribute_alpha_doc,
678 nullptr},
679 {"color",
682 StrokeAttribute_color_doc,
683 nullptr},
684 {"thickness",
687 StrokeAttribute_thickness_doc,
688 nullptr},
689 {"visible",
692 StrokeAttribute_visible_doc,
693 nullptr},
694 {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
695};
696
697/*-----------------------BPy_StrokeAttribute type definition ------------------------------*/
698
699PyTypeObject StrokeAttribute_Type = {
700 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
701 /*tp_name*/ "StrokeAttribute",
702 /*tp_basicsize*/ sizeof(BPy_StrokeAttribute),
703 /*tp_itemsize*/ 0,
704 /*tp_dealloc*/ (destructor)StrokeAttribute_dealloc,
705 /*tp_vectorcall_offset*/ 0,
706 /*tp_getattr*/ nullptr,
707 /*tp_setattr*/ nullptr,
708 /*tp_as_async*/ nullptr,
709 /*tp_repr*/ (reprfunc)StrokeAttribute_repr,
710 /*tp_as_number*/ nullptr,
711 /*tp_as_sequence*/ nullptr,
712 /*tp_as_mapping*/ nullptr,
713 /*tp_hash*/ nullptr,
714 /*tp_call*/ nullptr,
715 /*tp_str*/ nullptr,
716 /*tp_getattro*/ nullptr,
717 /*tp_setattro*/ nullptr,
718 /*tp_as_buffer*/ nullptr,
719 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
720 /*tp_doc*/ StrokeAttribute_doc,
721 /*tp_traverse*/ nullptr,
722 /*tp_clear*/ nullptr,
723 /*tp_richcompare*/ nullptr,
724 /*tp_weaklistoffset*/ 0,
725 /*tp_iter*/ nullptr,
726 /*tp_iternext*/ nullptr,
727 /*tp_methods*/ BPy_StrokeAttribute_methods,
728 /*tp_members*/ nullptr,
729 /*tp_getset*/ BPy_StrokeAttribute_getseters,
730 /*tp_base*/ nullptr,
731 /*tp_dict*/ nullptr,
732 /*tp_descr_get*/ nullptr,
733 /*tp_descr_set*/ nullptr,
734 /*tp_dictoffset*/ 0,
735 /*tp_init*/ (initproc)StrokeAttribute_init,
736 /*tp_alloc*/ nullptr,
737 /*tp_new*/ PyType_GenericNew,
738};
739
unsigned char uchar
bool bool_from_PyBool(PyObject *b)
bool Vec3f_ptr_from_PyObject(PyObject *obj, Vec3f &vec)
bool Vec2f_ptr_from_PyObject(PyObject *obj, Vec2f &vec)
PyObject * Vector_from_Vec3f(Vec3f &vec)
PyObject * Vector_from_Vec2f(Vec2f &vec)
PyObject * PyBool_from_bool(bool b)
static int StrokeAttribute_alpha_set(BPy_StrokeAttribute *self, PyObject *value, void *)
static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static int StrokeAttribute_visible_set(BPy_StrokeAttribute *self, PyObject *value, void *)
static PyObject * StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, PyObject *value, void *)
static PyObject * StrokeAttribute_has_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static int StrokeAttribute_mathutils_set(BaseMathObject *bmo, int subtype)
PyTypeObject StrokeAttribute_Type
static PyObject * StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
#define MATHUTILS_SUBTYPE_THICKNESS
static PyObject * StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void *)
static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
static PyObject * StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *)
void StrokeAttribute_mathutils_register_callback()
static PyObject * StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyMethodDef BPy_StrokeAttribute_methods[]
static Mathutils_Callback StrokeAttribute_mathutils_cb
static PyGetSetDef BPy_StrokeAttribute_getseters[]
static PyObject * StrokeAttribute_repr(BPy_StrokeAttribute *self)
static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
PyDoc_STRVAR(StrokeAttribute_doc, "Class to define a set of attributes associated with a :class:`StrokeVertex`.\n" "The attribute set stores the color, alpha and thickness values for a Stroke\n" "Vertex.\n" "\n" ".. method:: __init__()\n" " __init__(brother)\n" " __init__(red, green, blue, alpha, thickness_right, thickness_left)\n" " __init__(attribute1, attribute2, t)\n" "\n" " Creates a :class:`StrokeAttribute` object using either a default constructor,\n" " copy constructor, overloaded constructor, or and interpolation constructor\n" " to interpolate between two :class:`StrokeAttribute` objects.\n" "\n" " :arg brother: A StrokeAttribute object to be used as a copy constructor.\n" " :type brother: :class:`StrokeAttribute`\n" " :arg red: Red component of a stroke color.\n" " :type red: float\n" " :arg green: Green component of a stroke color.\n" " :type green: float\n" " :arg blue: Blue component of a stroke color.\n" " :type blue: float\n" " :arg alpha: Alpha component of a stroke color.\n" " :type alpha: float\n" " :arg thickness_right: Stroke thickness on the right.\n" " :type thickness_right: float\n" " :arg thickness_left: Stroke thickness on the left.\n" " :type thickness_left: float\n" " :arg attribute1: The first StrokeAttribute object.\n" " :type attribute1: :class:`StrokeAttribute`\n" " :arg attribute2: The second StrokeAttribute object.\n" " :type attribute2: :class:`StrokeAttribute`\n" " :arg t: The interpolation parameter (0 <= t <= 1).\n" " :type t: float\n")
static PyObject * StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *)
static PyObject * StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void *)
static int StrokeAttribute_mathutils_check(BaseMathObject *bmo)
static int StrokeAttribute_mathutils_get(BaseMathObject *bmo, int subtype)
static int StrokeAttribute_color_set(BPy_StrokeAttribute *self, PyObject *value, void *)
static PyObject * StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
#define MATHUTILS_SUBTYPE_COLOR
static PyObject * StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
static uchar StrokeAttribute_mathutils_cb_index
static void StrokeAttribute_dealloc(BPy_StrokeAttribute *self)
int StrokeAttribute_Init(PyObject *module)
#define BPy_StrokeAttribute_Check(v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject * self
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
Definition mathutils.cc:96
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
Definition mathutils.cc:521
PyObject * Color_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int vec_num, uchar cb_type, uchar cb_subtype)
VecMat::Vec2< float > Vec2f
Definition Geom.h:22
inherits from class Rep
Definition AppCanvas.cpp:20
static uint a[3]
Definition RandGen.cpp:82
PyObject * PyC_UnicodeFromStdStr(const std::string &str)
static struct PyModuleDef module
Definition python.cpp:796