Blender V4.5
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");
73
74static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
75{
76 static const char *kwlist_1[] = {"brother", nullptr};
77 static const char *kwlist_2[] = {"attribute1", "attribute2", "t", nullptr};
78 static const char *kwlist_3[] = {
79 "red", "green", "blue", "alpha", "thickness_right", "thickness_left", nullptr};
80 PyObject *obj1 = nullptr, *obj2 = nullptr;
81 float red, green, blue, alpha, thickness_right, thickness_left, t;
82
83 if (PyArg_ParseTupleAndKeywords(
84 args, kwds, "|O!", (char **)kwlist_1, &StrokeAttribute_Type, &obj1))
85 {
86 if (!obj1) {
87 self->sa = new StrokeAttribute();
88 }
89 else {
90 self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa));
91 }
92 }
93 else if ((void)PyErr_Clear(),
94 PyArg_ParseTupleAndKeywords(args,
95 kwds,
96 "O!O!f",
97 (char **)kwlist_2,
99 &obj1,
101 &obj2,
102 &t))
103 {
104 self->sa = new StrokeAttribute(
105 *(((BPy_StrokeAttribute *)obj1)->sa), *(((BPy_StrokeAttribute *)obj2)->sa), t);
106 }
107 else if ((void)PyErr_Clear(),
108 PyArg_ParseTupleAndKeywords(args,
109 kwds,
110 "ffffff",
111 (char **)kwlist_3,
112 &red,
113 &green,
114 &blue,
115 &alpha,
116 &thickness_right,
117 &thickness_left))
118 {
119 self->sa = new StrokeAttribute(red, green, blue, alpha, thickness_right, thickness_left);
120 }
121 else {
122 PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
123 return -1;
124 }
125 self->borrowed = false;
126 return 0;
127}
128
130{
131 if (self->sa && !self->borrowed) {
132 delete self->sa;
133 }
134 Py_TYPE(self)->tp_free((PyObject *)self);
135}
136
138{
139 stringstream repr("StrokeAttribute:");
140 repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG()
141 << " b: " << self->sa->getColorB() << " a: " << self->sa->getAlpha()
142 << " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL();
143
144 return PyC_UnicodeFromStdStr(repr.str());
145}
146
148 /* Wrap. */
149 StrokeAttribute_get_attribute_real_doc,
150 ".. method:: get_attribute_real(name)\n"
151 "\n"
152 " Returns an attribute of float type.\n"
153 "\n"
154 " :arg name: The name of the attribute.\n"
155 " :type name: str\n"
156 " :return: The attribute value.\n"
157 " :rtype: float\n");
158
160 PyObject *args,
161 PyObject *kwds)
162{
163 static const char *kwlist[] = {"name", nullptr};
164 char *attr;
165
166 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
167 return nullptr;
168 }
169 double a = self->sa->getAttributeReal(attr);
170 return PyFloat_FromDouble(a);
171}
172
174 /* Wrap. */
175 StrokeAttribute_get_attribute_vec2_doc,
176 ".. method:: get_attribute_vec2(name)\n"
177 "\n"
178 " Returns an attribute of two-dimensional vector type.\n"
179 "\n"
180 " :arg name: The name of the attribute.\n"
181 " :type name: str\n"
182 " :return: The attribute value.\n"
183 " :rtype: :class:`mathutils.Vector`\n");
184
186 PyObject *args,
187 PyObject *kwds)
188{
189 static const char *kwlist[] = {"name", nullptr};
190 char *attr;
191
192 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
193 return nullptr;
194 }
195 Vec2f a = self->sa->getAttributeVec2f(attr);
196 return Vector_from_Vec2f(a);
197}
198
200 /* Wrap. */
201 StrokeAttribute_get_attribute_vec3_doc,
202 ".. method:: get_attribute_vec3(name)\n"
203 "\n"
204 " Returns an attribute of three-dimensional vector type.\n"
205 "\n"
206 " :arg name: The name of the attribute.\n"
207 " :type name: str\n"
208 " :return: The attribute value.\n"
209 " :rtype: :class:`mathutils.Vector`\n");
210
212 PyObject *args,
213 PyObject *kwds)
214{
215 static const char *kwlist[] = {"name", nullptr};
216 char *attr;
217
218 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
219 return nullptr;
220 }
221 Vec3f a = self->sa->getAttributeVec3f(attr);
222 return Vector_from_Vec3f(a);
223}
224
226 /* Wrap. */
227 StrokeAttribute_has_attribute_real_doc,
228 ".. method:: has_attribute_real(name)\n"
229 "\n"
230 " Checks whether the attribute name of float type is available.\n"
231 "\n"
232 " :arg name: The name of the attribute.\n"
233 " :type name: str\n"
234 " :return: True if the attribute is available.\n"
235 " :rtype: bool\n");
236
238 PyObject *args,
239 PyObject *kwds)
240{
241 static const char *kwlist[] = {"name", nullptr};
242 char *attr;
243
244 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
245 return nullptr;
246 }
247 return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr));
248}
249
251 /* Wrap. */
252 StrokeAttribute_has_attribute_vec2_doc,
253 ".. method:: has_attribute_vec2(name)\n"
254 "\n"
255 " Checks whether the attribute name of two-dimensional vector type\n"
256 " is available.\n"
257 "\n"
258 " :arg name: The name of the attribute.\n"
259 " :type name: str\n"
260 " :return: True if the attribute is available.\n"
261 " :rtype: bool\n");
262
264 PyObject *args,
265 PyObject *kwds)
266{
267 static const char *kwlist[] = {"name", nullptr};
268 char *attr;
269
270 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
271 return nullptr;
272 }
273 return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr));
274}
275
277 /* Wrap. */
278 StrokeAttribute_has_attribute_vec3_doc,
279 ".. method:: has_attribute_vec3(name)\n"
280 "\n"
281 " Checks whether the attribute name of three-dimensional vector\n"
282 " type is available.\n"
283 "\n"
284 " :arg name: The name of the attribute.\n"
285 " :type name: str\n"
286 " :return: True if the attribute is available.\n"
287 " :rtype: bool\n");
288
290 PyObject *args,
291 PyObject *kwds)
292{
293 static const char *kwlist[] = {"name", nullptr};
294 char *attr;
295
296 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
297 return nullptr;
298 }
299 return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr));
300}
301
303 /* Wrap. */
304 StrokeAttribute_set_attribute_real_doc,
305 ".. method:: set_attribute_real(name, value)\n"
306 "\n"
307 " Adds a user-defined attribute of float type. If there is no\n"
308 " attribute of the given name, it is added. Otherwise, the new value\n"
309 " replaces the old one.\n"
310 "\n"
311 " :arg name: The name of the attribute.\n"
312 " :type name: str\n"
313 " :arg value: The attribute value.\n"
314 " :type value: float\n");
315
317 PyObject *args,
318 PyObject *kwds)
319{
320 static const char *kwlist[] = {"name", "value", nullptr};
321 char *s = nullptr;
322 double d = 0;
323
324 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) {
325 return nullptr;
326 }
327 self->sa->setAttributeReal(s, d);
328 Py_RETURN_NONE;
329}
330
332 /* Wrap. */
333 StrokeAttribute_set_attribute_vec2_doc,
334 ".. method:: set_attribute_vec2(name, value)\n"
335 "\n"
336 " Adds a user-defined attribute of two-dimensional vector type. If\n"
337 " there is no attribute of the given name, it is added. Otherwise,\n"
338 " the new value replaces the old one.\n"
339 "\n"
340 " :arg name: The name of the attribute.\n"
341 " :type name: str\n"
342 " :arg value: The attribute value.\n"
343 " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
344
346 PyObject *args,
347 PyObject *kwds)
348{
349 static const char *kwlist[] = {"name", "value", nullptr};
350 char *s;
351 PyObject *obj = nullptr;
352 Vec2f vec;
353
354 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
355 return nullptr;
356 }
357 if (!Vec2f_ptr_from_PyObject(obj, vec)) {
358 PyErr_SetString(PyExc_TypeError,
359 "argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
360 return nullptr;
361 }
362 self->sa->setAttributeVec2f(s, vec);
363 Py_RETURN_NONE;
364}
365
367 /* Wrap. */
368 StrokeAttribute_set_attribute_vec3_doc,
369 ".. method:: set_attribute_vec3(name, value)\n"
370 "\n"
371 " Adds a user-defined attribute of three-dimensional vector type.\n"
372 " If there is no attribute of the given name, it is added.\n"
373 " Otherwise, the new value replaces the old one.\n"
374 "\n"
375 " :arg name: The name of the attribute.\n"
376 " :type name: str\n"
377 " :arg value: The attribute value as a 3D vector.\n"
378 " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
379
381 PyObject *args,
382 PyObject *kwds)
383{
384 static const char *kwlist[] = {"name", "value", nullptr};
385 char *s;
386 PyObject *obj = nullptr;
387 Vec3f vec;
388
389 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
390 return nullptr;
391 }
392 if (!Vec3f_ptr_from_PyObject(obj, vec)) {
393 PyErr_SetString(PyExc_TypeError,
394 "argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
395 return nullptr;
396 }
397 self->sa->setAttributeVec3f(s, vec);
398 Py_RETURN_NONE;
399}
400
401#ifdef __GNUC__
402# ifdef __clang__
403# pragma clang diagnostic push
404# pragma clang diagnostic ignored "-Wcast-function-type"
405# else
406# pragma GCC diagnostic push
407# pragma GCC diagnostic ignored "-Wcast-function-type"
408# endif
409#endif
410
411static PyMethodDef BPy_StrokeAttribute_methods[] = {
412 {"get_attribute_real",
414 METH_VARARGS | METH_KEYWORDS,
415 StrokeAttribute_get_attribute_real_doc},
416 {"get_attribute_vec2",
418 METH_VARARGS | METH_KEYWORDS,
419 StrokeAttribute_get_attribute_vec2_doc},
420 {"get_attribute_vec3",
422 METH_VARARGS | METH_KEYWORDS,
423 StrokeAttribute_get_attribute_vec3_doc},
424 {"has_attribute_real",
426 METH_VARARGS | METH_KEYWORDS,
427 StrokeAttribute_has_attribute_real_doc},
428 {"has_attribute_vec2",
430 METH_VARARGS | METH_KEYWORDS,
431 StrokeAttribute_has_attribute_vec2_doc},
432 {"has_attribute_vec3",
434 METH_VARARGS | METH_KEYWORDS,
435 StrokeAttribute_has_attribute_vec3_doc},
436 {"set_attribute_real",
438 METH_VARARGS | METH_KEYWORDS,
439 StrokeAttribute_set_attribute_real_doc},
440 {"set_attribute_vec2",
442 METH_VARARGS | METH_KEYWORDS,
443 StrokeAttribute_set_attribute_vec2_doc},
444 {"set_attribute_vec3",
446 METH_VARARGS | METH_KEYWORDS,
447 StrokeAttribute_set_attribute_vec3_doc},
448 {nullptr, nullptr, 0, nullptr},
449};
450
451#ifdef __GNUC__
452# ifdef __clang__
453# pragma clang diagnostic pop
454# else
455# pragma GCC diagnostic pop
456# endif
457#endif
458
459/*----------------------mathutils callbacks ----------------------------*/
460
461/* subtype */
462#define MATHUTILS_SUBTYPE_COLOR 1
463#define MATHUTILS_SUBTYPE_THICKNESS 2
464
466{
467 if (!BPy_StrokeAttribute_Check(bmo->cb_user)) {
468 return -1;
469 }
470 return 0;
471}
472
474{
476 switch (subtype) {
478 bmo->data[0] = self->sa->getColorR();
479 bmo->data[1] = self->sa->getColorG();
480 bmo->data[2] = self->sa->getColorB();
481 break;
483 bmo->data[0] = self->sa->getThicknessR();
484 bmo->data[1] = self->sa->getThicknessL();
485 break;
486 default:
487 return -1;
488 }
489 return 0;
490}
491
493{
495 switch (subtype) {
497 self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]);
498 break;
500 self->sa->setThickness(bmo->data[0], bmo->data[1]);
501 break;
502 default:
503 return -1;
504 }
505 return 0;
506}
507
508static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
509{
511 switch (subtype) {
513 switch (index) {
514 case 0:
515 bmo->data[0] = self->sa->getColorR();
516 break;
517 case 1:
518 bmo->data[1] = self->sa->getColorG();
519 break;
520 case 2:
521 bmo->data[2] = self->sa->getColorB();
522 break;
523 default:
524 return -1;
525 }
526 break;
528 switch (index) {
529 case 0:
530 bmo->data[0] = self->sa->getThicknessR();
531 break;
532 case 1:
533 bmo->data[1] = self->sa->getThicknessL();
534 break;
535 default:
536 return -1;
537 }
538 break;
539 default:
540 return -1;
541 }
542 return 0;
543}
544
545static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
546{
548 switch (subtype) {
550 float r = (index == 0) ? bmo->data[0] : self->sa->getColorR();
551 float g = (index == 1) ? bmo->data[1] : self->sa->getColorG();
552 float b = (index == 2) ? bmo->data[2] : self->sa->getColorB();
553 self->sa->setColor(r, g, b);
554 break;
555 }
557 float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR();
558 float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL();
559 self->sa->setThickness(tr, tl);
560 break;
561 }
562 default:
563 return -1;
564 }
565 return 0;
566}
567
575
577
582
583/*----------------------StrokeAttribute get/setters ----------------------------*/
584
586 /* Wrap. */
587 StrokeAttribute_alpha_doc,
588 "Alpha component of the stroke color.\n"
589 "\n"
590 ":type: float");
591
592static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void * /*closure*/)
593{
594 return PyFloat_FromDouble(self->sa->getAlpha());
595}
596
598 PyObject *value,
599 void * /*closure*/)
600{
601 float scalar;
602 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
603 /* parsed item not a number */
604 PyErr_SetString(PyExc_TypeError, "value must be a number");
605 return -1;
606 }
607 self->sa->setAlpha(scalar);
608 return 0;
609}
610
612 /* Wrap. */
613 StrokeAttribute_color_doc,
614 "RGB components of the stroke color.\n"
615 "\n"
616 ":type: :class:`mathutils.Color`");
617
623
625 PyObject *value,
626 void * /*closure*/)
627{
628 float v[3];
629 if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) {
630 return -1;
631 }
632 self->sa->setColor(v[0], v[1], v[2]);
633 return 0;
634}
635
637 /* Wrap. */
638 StrokeAttribute_thickness_doc,
639 "Right and left components of the stroke thickness.\n"
640 "The right (left) component is the thickness on the right (left) of the vertex\n"
641 "when following the stroke.\n"
642 "\n"
643 ":type: :class:`mathutils.Vector`");
644
650
652 PyObject *value,
653 void * /*closure*/)
654{
655 float v[2];
656 if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) {
657 return -1;
658 }
659 self->sa->setThickness(v[0], v[1]);
660 return 0;
661}
662
664 /* Wrap. */
665 StrokeAttribute_visible_doc,
666 "The visibility flag. True if the StrokeVertex is visible.\n"
667 "\n"
668 ":type: bool");
669
670static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void * /*closure*/)
671{
672 return PyBool_from_bool(self->sa->isVisible());
673}
674
676 PyObject *value,
677 void * /*closure*/)
678{
679 if (!PyBool_Check(value)) {
680 PyErr_SetString(PyExc_TypeError, "value must be boolean");
681 return -1;
682 }
683 self->sa->setVisible(bool_from_PyBool(value));
684 return 0;
685}
686
687static PyGetSetDef BPy_StrokeAttribute_getseters[] = {
688 {"alpha",
691 StrokeAttribute_alpha_doc,
692 nullptr},
693 {"color",
696 StrokeAttribute_color_doc,
697 nullptr},
698 {"thickness",
701 StrokeAttribute_thickness_doc,
702 nullptr},
703 {"visible",
706 StrokeAttribute_visible_doc,
707 nullptr},
708 {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
709};
710
711/*-----------------------BPy_StrokeAttribute type definition ------------------------------*/
712
713PyTypeObject StrokeAttribute_Type = {
714 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
715 /*tp_name*/ "StrokeAttribute",
716 /*tp_basicsize*/ sizeof(BPy_StrokeAttribute),
717 /*tp_itemsize*/ 0,
718 /*tp_dealloc*/ (destructor)StrokeAttribute_dealloc,
719 /*tp_vectorcall_offset*/ 0,
720 /*tp_getattr*/ nullptr,
721 /*tp_setattr*/ nullptr,
722 /*tp_as_async*/ nullptr,
723 /*tp_repr*/ (reprfunc)StrokeAttribute_repr,
724 /*tp_as_number*/ nullptr,
725 /*tp_as_sequence*/ nullptr,
726 /*tp_as_mapping*/ nullptr,
727 /*tp_hash*/ nullptr,
728 /*tp_call*/ nullptr,
729 /*tp_str*/ nullptr,
730 /*tp_getattro*/ nullptr,
731 /*tp_setattro*/ nullptr,
732 /*tp_as_buffer*/ nullptr,
733 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
734 /*tp_doc*/ StrokeAttribute_doc,
735 /*tp_traverse*/ nullptr,
736 /*tp_clear*/ nullptr,
737 /*tp_richcompare*/ nullptr,
738 /*tp_weaklistoffset*/ 0,
739 /*tp_iter*/ nullptr,
740 /*tp_iternext*/ nullptr,
741 /*tp_methods*/ BPy_StrokeAttribute_methods,
742 /*tp_members*/ nullptr,
743 /*tp_getset*/ BPy_StrokeAttribute_getseters,
744 /*tp_base*/ nullptr,
745 /*tp_dict*/ nullptr,
746 /*tp_descr_get*/ nullptr,
747 /*tp_descr_set*/ nullptr,
748 /*tp_dictoffset*/ 0,
749 /*tp_init*/ (initproc)StrokeAttribute_init,
750 /*tp_alloc*/ nullptr,
751 /*tp_new*/ PyType_GenericNew,
752};
753
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