Blender V4.3
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
10
11#include "BPy_Convert.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17using namespace Freestyle;
18
20
21//-------------------MODULE INITIALIZATION--------------------------------
23{
24 if (module == nullptr) {
25 return -1;
26 }
27
28 if (PyType_Ready(&StrokeAttribute_Type) < 0) {
29 return -1;
30 }
31 PyModule_AddObjectRef(module, "StrokeAttribute", (PyObject *)&StrokeAttribute_Type);
32
34 return 0;
35}
36
37//------------------------INSTANCE METHODS ----------------------------------
38
40 /* Wrap. */
41 StrokeAttribute_doc,
42 "Class to define a set of attributes associated with a :class:`StrokeVertex`.\n"
43 "The attribute set stores the color, alpha and thickness values for a Stroke\n"
44 "Vertex.\n"
45 "\n"
46 ".. method:: __init__()\n"
47 " __init__(brother)\n"
48 " __init__(red, green, blue, alpha, thickness_right, thickness_left)\n"
49 " __init__(attribute1, attribute2, t)\n"
50 "\n"
51 " Creates a :class:`StrokeAttribute` object using either a default constructor,\n"
52 " copy constructor, overloaded constructor, or and interpolation constructor\n"
53 " to interpolate between two :class:`StrokeAttribute` objects.\n"
54 "\n"
55 " :arg brother: A StrokeAttribute object to be used as a copy constructor.\n"
56 " :type brother: :class:`StrokeAttribute`\n"
57 " :arg red: Red component of a stroke color.\n"
58 " :type red: float\n"
59 " :arg green: Green component of a stroke color.\n"
60 " :type green: float\n"
61 " :arg blue: Blue component of a stroke color.\n"
62 " :type blue: float\n"
63 " :arg alpha: Alpha component of a stroke color.\n"
64 " :type alpha: float\n"
65 " :arg thickness_right: Stroke thickness on the right.\n"
66 " :type thickness_right: float\n"
67 " :arg thickness_left: Stroke thickness on the left.\n"
68 " :type thickness_left: float\n"
69 " :arg attribute1: The first StrokeAttribute object.\n"
70 " :type attribute1: :class:`StrokeAttribute`\n"
71 " :arg attribute2: The second StrokeAttribute object.\n"
72 " :type attribute2: :class:`StrokeAttribute`\n"
73 " :arg t: The interpolation parameter (0 <= t <= 1).\n"
74 " :type t: float\n");
75
76static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
77{
78 static const char *kwlist_1[] = {"brother", nullptr};
79 static const char *kwlist_2[] = {"attribute1", "attribute2", "t", nullptr};
80 static const char *kwlist_3[] = {
81 "red", "green", "blue", "alpha", "thickness_right", "thickness_left", nullptr};
82 PyObject *obj1 = nullptr, *obj2 = nullptr;
83 float red, green, blue, alpha, thickness_right, thickness_left, t;
84
85 if (PyArg_ParseTupleAndKeywords(
86 args, kwds, "|O!", (char **)kwlist_1, &StrokeAttribute_Type, &obj1))
87 {
88 if (!obj1) {
89 self->sa = new StrokeAttribute();
90 }
91 else {
92 self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa));
93 }
94 }
95 else if ((void)PyErr_Clear(),
96 PyArg_ParseTupleAndKeywords(args,
97 kwds,
98 "O!O!f",
99 (char **)kwlist_2,
101 &obj1,
103 &obj2,
104 &t))
105 {
106 self->sa = new StrokeAttribute(
107 *(((BPy_StrokeAttribute *)obj1)->sa), *(((BPy_StrokeAttribute *)obj2)->sa), t);
108 }
109 else if ((void)PyErr_Clear(),
110 PyArg_ParseTupleAndKeywords(args,
111 kwds,
112 "ffffff",
113 (char **)kwlist_3,
114 &red,
115 &green,
116 &blue,
117 &alpha,
118 &thickness_right,
119 &thickness_left))
120 {
121 self->sa = new StrokeAttribute(red, green, blue, alpha, thickness_right, thickness_left);
122 }
123 else {
124 PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
125 return -1;
126 }
127 self->borrowed = false;
128 return 0;
129}
130
132{
133 if (self->sa && !self->borrowed) {
134 delete self->sa;
135 }
136 Py_TYPE(self)->tp_free((PyObject *)self);
137}
138
140{
141 stringstream repr("StrokeAttribute:");
142 repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG()
143 << " b: " << self->sa->getColorB() << " a: " << self->sa->getAlpha()
144 << " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL();
145
146 return PyUnicode_FromString(repr.str().c_str());
147}
148
150 /* Wrap. */
151 StrokeAttribute_get_attribute_real_doc,
152 ".. method:: get_attribute_real(name)\n"
153 "\n"
154 " Returns an attribute of float type.\n"
155 "\n"
156 " :arg name: The name of the attribute.\n"
157 " :type name: str\n"
158 " :return: The attribute value.\n"
159 " :rtype: float\n");
160
162 PyObject *args,
163 PyObject *kwds)
164{
165 static const char *kwlist[] = {"name", nullptr};
166 char *attr;
167
168 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
169 return nullptr;
170 }
171 double a = self->sa->getAttributeReal(attr);
172 return PyFloat_FromDouble(a);
173}
174
176 /* Wrap. */
177 StrokeAttribute_get_attribute_vec2_doc,
178 ".. method:: get_attribute_vec2(name)\n"
179 "\n"
180 " Returns an attribute of two-dimensional vector type.\n"
181 "\n"
182 " :arg name: The name of the attribute.\n"
183 " :type name: str\n"
184 " :return: The attribute value.\n"
185 " :rtype: :class:`mathutils.Vector`\n");
186
188 PyObject *args,
189 PyObject *kwds)
190{
191 static const char *kwlist[] = {"name", nullptr};
192 char *attr;
193
194 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
195 return nullptr;
196 }
197 Vec2f a = self->sa->getAttributeVec2f(attr);
198 return Vector_from_Vec2f(a);
199}
200
202 /* Wrap. */
203 StrokeAttribute_get_attribute_vec3_doc,
204 ".. method:: get_attribute_vec3(name)\n"
205 "\n"
206 " Returns an attribute of three-dimensional vector type.\n"
207 "\n"
208 " :arg name: The name of the attribute.\n"
209 " :type name: str\n"
210 " :return: The attribute value.\n"
211 " :rtype: :class:`mathutils.Vector`\n");
212
214 PyObject *args,
215 PyObject *kwds)
216{
217 static const char *kwlist[] = {"name", nullptr};
218 char *attr;
219
220 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
221 return nullptr;
222 }
223 Vec3f a = self->sa->getAttributeVec3f(attr);
224 return Vector_from_Vec3f(a);
225}
226
228 /* Wrap. */
229 StrokeAttribute_has_attribute_real_doc,
230 ".. method:: has_attribute_real(name)\n"
231 "\n"
232 " Checks whether the attribute name of float type is available.\n"
233 "\n"
234 " :arg name: The name of the attribute.\n"
235 " :type name: str\n"
236 " :return: True if the attribute is available.\n"
237 " :rtype: bool\n");
238
240 PyObject *args,
241 PyObject *kwds)
242{
243 static const char *kwlist[] = {"name", nullptr};
244 char *attr;
245
246 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
247 return nullptr;
248 }
249 return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr));
250}
251
253 /* Wrap. */
254 StrokeAttribute_has_attribute_vec2_doc,
255 ".. method:: has_attribute_vec2(name)\n"
256 "\n"
257 " Checks whether the attribute name of two-dimensional vector type\n"
258 " is available.\n"
259 "\n"
260 " :arg name: The name of the attribute.\n"
261 " :type name: str\n"
262 " :return: True if the attribute is available.\n"
263 " :rtype: bool\n");
264
266 PyObject *args,
267 PyObject *kwds)
268{
269 static const char *kwlist[] = {"name", nullptr};
270 char *attr;
271
272 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
273 return nullptr;
274 }
275 return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr));
276}
277
279 /* Wrap. */
280 StrokeAttribute_has_attribute_vec3_doc,
281 ".. method:: has_attribute_vec3(name)\n"
282 "\n"
283 " Checks whether the attribute name of three-dimensional vector\n"
284 " type is available.\n"
285 "\n"
286 " :arg name: The name of the attribute.\n"
287 " :type name: str\n"
288 " :return: True if the attribute is available.\n"
289 " :rtype: bool\n");
290
292 PyObject *args,
293 PyObject *kwds)
294{
295 static const char *kwlist[] = {"name", nullptr};
296 char *attr;
297
298 if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
299 return nullptr;
300 }
301 return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr));
302}
303
305 /* Wrap. */
306 StrokeAttribute_set_attribute_real_doc,
307 ".. method:: set_attribute_real(name, value)\n"
308 "\n"
309 " Adds a user-defined attribute of float type. If there is no\n"
310 " attribute of the given name, it is added. Otherwise, the new value\n"
311 " replaces the old one.\n"
312 "\n"
313 " :arg name: The name of the attribute.\n"
314 " :type name: str\n"
315 " :arg value: The attribute value.\n"
316 " :type value: float\n");
317
319 PyObject *args,
320 PyObject *kwds)
321{
322 static const char *kwlist[] = {"name", "value", nullptr};
323 char *s = nullptr;
324 double d = 0;
325
326 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) {
327 return nullptr;
328 }
329 self->sa->setAttributeReal(s, d);
330 Py_RETURN_NONE;
331}
332
334 /* Wrap. */
335 StrokeAttribute_set_attribute_vec2_doc,
336 ".. method:: set_attribute_vec2(name, value)\n"
337 "\n"
338 " Adds a user-defined attribute of two-dimensional vector type. If\n"
339 " there is no attribute of the given name, it is added. Otherwise,\n"
340 " the new value replaces the old one.\n"
341 "\n"
342 " :arg name: The name of the attribute.\n"
343 " :type name: str\n"
344 " :arg value: The attribute value.\n"
345 " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
346
348 PyObject *args,
349 PyObject *kwds)
350{
351 static const char *kwlist[] = {"name", "value", nullptr};
352 char *s;
353 PyObject *obj = nullptr;
354 Vec2f vec;
355
356 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
357 return nullptr;
358 }
359 if (!Vec2f_ptr_from_PyObject(obj, vec)) {
360 PyErr_SetString(PyExc_TypeError,
361 "argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
362 return nullptr;
363 }
364 self->sa->setAttributeVec2f(s, vec);
365 Py_RETURN_NONE;
366}
367
369 /* Wrap. */
370 StrokeAttribute_set_attribute_vec3_doc,
371 ".. method:: set_attribute_vec3(name, value)\n"
372 "\n"
373 " Adds a user-defined attribute of three-dimensional vector type.\n"
374 " If there is no attribute of the given name, it is added.\n"
375 " Otherwise, the new value replaces the old one.\n"
376 "\n"
377 " :arg name: The name of the attribute.\n"
378 " :type name: str\n"
379 " :arg value: The attribute value as a 3D vector.\n"
380 " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
381
383 PyObject *args,
384 PyObject *kwds)
385{
386 static const char *kwlist[] = {"name", "value", nullptr};
387 char *s;
388 PyObject *obj = nullptr;
389 Vec3f vec;
390
391 if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
392 return nullptr;
393 }
394 if (!Vec3f_ptr_from_PyObject(obj, vec)) {
395 PyErr_SetString(PyExc_TypeError,
396 "argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
397 return nullptr;
398 }
399 self->sa->setAttributeVec3f(s, vec);
400 Py_RETURN_NONE;
401}
402
403static PyMethodDef BPy_StrokeAttribute_methods[] = {
404 {"get_attribute_real",
406 METH_VARARGS | METH_KEYWORDS,
407 StrokeAttribute_get_attribute_real_doc},
408 {"get_attribute_vec2",
410 METH_VARARGS | METH_KEYWORDS,
411 StrokeAttribute_get_attribute_vec2_doc},
412 {"get_attribute_vec3",
414 METH_VARARGS | METH_KEYWORDS,
415 StrokeAttribute_get_attribute_vec3_doc},
416 {"has_attribute_real",
418 METH_VARARGS | METH_KEYWORDS,
419 StrokeAttribute_has_attribute_real_doc},
420 {"has_attribute_vec2",
422 METH_VARARGS | METH_KEYWORDS,
423 StrokeAttribute_has_attribute_vec2_doc},
424 {"has_attribute_vec3",
426 METH_VARARGS | METH_KEYWORDS,
427 StrokeAttribute_has_attribute_vec3_doc},
428 {"set_attribute_real",
430 METH_VARARGS | METH_KEYWORDS,
431 StrokeAttribute_set_attribute_real_doc},
432 {"set_attribute_vec2",
434 METH_VARARGS | METH_KEYWORDS,
435 StrokeAttribute_set_attribute_vec2_doc},
436 {"set_attribute_vec3",
438 METH_VARARGS | METH_KEYWORDS,
439 StrokeAttribute_set_attribute_vec3_doc},
440 {nullptr, nullptr, 0, nullptr},
441};
442
443/*----------------------mathutils callbacks ----------------------------*/
444
445/* subtype */
446#define MATHUTILS_SUBTYPE_COLOR 1
447#define MATHUTILS_SUBTYPE_THICKNESS 2
448
450{
451 if (!BPy_StrokeAttribute_Check(bmo->cb_user)) {
452 return -1;
453 }
454 return 0;
455}
456
458{
460 switch (subtype) {
462 bmo->data[0] = self->sa->getColorR();
463 bmo->data[1] = self->sa->getColorG();
464 bmo->data[2] = self->sa->getColorB();
465 break;
467 bmo->data[0] = self->sa->getThicknessR();
468 bmo->data[1] = self->sa->getThicknessL();
469 break;
470 default:
471 return -1;
472 }
473 return 0;
474}
475
477{
479 switch (subtype) {
481 self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]);
482 break;
484 self->sa->setThickness(bmo->data[0], bmo->data[1]);
485 break;
486 default:
487 return -1;
488 }
489 return 0;
490}
491
492static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
493{
495 switch (subtype) {
497 switch (index) {
498 case 0:
499 bmo->data[0] = self->sa->getColorR();
500 break;
501 case 1:
502 bmo->data[1] = self->sa->getColorG();
503 break;
504 case 2:
505 bmo->data[2] = self->sa->getColorB();
506 break;
507 default:
508 return -1;
509 }
510 break;
512 switch (index) {
513 case 0:
514 bmo->data[0] = self->sa->getThicknessR();
515 break;
516 case 1:
517 bmo->data[1] = self->sa->getThicknessL();
518 break;
519 default:
520 return -1;
521 }
522 break;
523 default:
524 return -1;
525 }
526 return 0;
527}
528
529static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
530{
532 switch (subtype) {
534 float r = (index == 0) ? bmo->data[0] : self->sa->getColorR();
535 float g = (index == 1) ? bmo->data[1] : self->sa->getColorG();
536 float b = (index == 2) ? bmo->data[2] : self->sa->getColorB();
537 self->sa->setColor(r, g, b);
538 break;
539 }
541 float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR();
542 float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL();
543 self->sa->setThickness(tr, tl);
544 break;
545 }
546 default:
547 return -1;
548 }
549 return 0;
550}
551
559
561
566
567/*----------------------StrokeAttribute get/setters ----------------------------*/
568
570 /* Wrap. */
571 StrokeAttribute_alpha_doc,
572 "Alpha component of the stroke color.\n"
573 "\n"
574 ":type: float");
575
576static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void * /*closure*/)
577{
578 return PyFloat_FromDouble(self->sa->getAlpha());
579}
580
582 PyObject *value,
583 void * /*closure*/)
584{
585 float scalar;
586 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
587 /* parsed item not a number */
588 PyErr_SetString(PyExc_TypeError, "value must be a number");
589 return -1;
590 }
591 self->sa->setAlpha(scalar);
592 return 0;
593}
594
596 /* Wrap. */
597 StrokeAttribute_color_doc,
598 "RGB components of the stroke color.\n"
599 "\n"
600 ":type: :class:`mathutils.Color`");
601
607
609 PyObject *value,
610 void * /*closure*/)
611{
612 float v[3];
613 if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) {
614 return -1;
615 }
616 self->sa->setColor(v[0], v[1], v[2]);
617 return 0;
618}
619
621 /* Wrap. */
622 StrokeAttribute_thickness_doc,
623 "Right and left components of the stroke thickness.\n"
624 "The right (left) component is the thickness on the right (left) of the vertex\n"
625 "when following the stroke.\n"
626 "\n"
627 ":type: :class:`mathutils.Vector`");
628
634
636 PyObject *value,
637 void * /*closure*/)
638{
639 float v[2];
640 if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) {
641 return -1;
642 }
643 self->sa->setThickness(v[0], v[1]);
644 return 0;
645}
646
648 /* Wrap. */
649 StrokeAttribute_visible_doc,
650 "The visibility flag. True if the StrokeVertex is visible.\n"
651 "\n"
652 ":type: bool");
653
654static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void * /*closure*/)
655{
656 return PyBool_from_bool(self->sa->isVisible());
657}
658
660 PyObject *value,
661 void * /*closure*/)
662{
663 if (!PyBool_Check(value)) {
664 PyErr_SetString(PyExc_TypeError, "value must be boolean");
665 return -1;
666 }
667 self->sa->setVisible(bool_from_PyBool(value));
668 return 0;
669}
670
671static PyGetSetDef BPy_StrokeAttribute_getseters[] = {
672 {"alpha",
675 StrokeAttribute_alpha_doc,
676 nullptr},
677 {"color",
680 StrokeAttribute_color_doc,
681 nullptr},
682 {"thickness",
685 StrokeAttribute_thickness_doc,
686 nullptr},
687 {"visible",
690 StrokeAttribute_visible_doc,
691 nullptr},
692 {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
693};
694
695/*-----------------------BPy_StrokeAttribute type definition ------------------------------*/
696
697PyTypeObject StrokeAttribute_Type = {
698 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
699 /*tp_name*/ "StrokeAttribute",
700 /*tp_basicsize*/ sizeof(BPy_StrokeAttribute),
701 /*tp_itemsize*/ 0,
702 /*tp_dealloc*/ (destructor)StrokeAttribute_dealloc,
703 /*tp_vectorcall_offset*/ 0,
704 /*tp_getattr*/ nullptr,
705 /*tp_setattr*/ nullptr,
706 /*tp_as_async*/ nullptr,
707 /*tp_repr*/ (reprfunc)StrokeAttribute_repr,
708 /*tp_as_number*/ nullptr,
709 /*tp_as_sequence*/ nullptr,
710 /*tp_as_mapping*/ nullptr,
711 /*tp_hash*/ nullptr,
712 /*tp_call*/ nullptr,
713 /*tp_str*/ nullptr,
714 /*tp_getattro*/ nullptr,
715 /*tp_setattro*/ nullptr,
716 /*tp_as_buffer*/ nullptr,
717 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
718 /*tp_doc*/ StrokeAttribute_doc,
719 /*tp_traverse*/ nullptr,
720 /*tp_clear*/ nullptr,
721 /*tp_richcompare*/ nullptr,
722 /*tp_weaklistoffset*/ 0,
723 /*tp_iter*/ nullptr,
724 /*tp_iternext*/ nullptr,
725 /*tp_methods*/ BPy_StrokeAttribute_methods,
726 /*tp_members*/ nullptr,
727 /*tp_getset*/ BPy_StrokeAttribute_getseters,
728 /*tp_base*/ nullptr,
729 /*tp_dict*/ nullptr,
730 /*tp_descr_get*/ nullptr,
731 /*tp_descr_set*/ nullptr,
732 /*tp_dictoffset*/ 0,
733 /*tp_init*/ (initproc)StrokeAttribute_init,
734 /*tp_alloc*/ nullptr,
735 /*tp_new*/ PyType_GenericNew,
736};
737
739
740#ifdef __cplusplus
741}
742#endif
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)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its red
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its green
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject * self
local_group_size(16, 16) .push_constant(Type b
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
Definition mathutils.cc:97
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
Definition mathutils.cc:522
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)
inherits from class Rep
Definition AppCanvas.cpp:20
static struct PyModuleDef module
Definition python.cpp:991