Blender V5.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
8
10
11#include "BPy_Convert.h"
12
13#include "../generic/py_capi_utils.hh"
14
15using namespace Freestyle;
16
18
19//-------------------MODULE INITIALIZATION--------------------------------
20int StrokeAttribute_Init(PyObject *module)
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__(*args)\n"
45 "\n"
46 " Accepted call signatures:\n"
47 "\n"
48 " - ``__init__()``\n"
49 " - ``__init__(brother)``\n"
50 " - ``__init__(red, green, blue, alpha, thickness_right, thickness_left)``\n"
51 " - ``__init__(attribute1, attribute2, t)``\n"
52 "\n"
53 " Creates a :class:`StrokeAttribute` object using either a default constructor,\n"
54 " copy constructor, overloaded constructor, or and interpolation constructor\n"
55 " to interpolate between two :class:`StrokeAttribute` objects.\n"
56 "\n"
57 " :param brother: A StrokeAttribute object to be used as a copy constructor.\n"
58 " :type brother: :class:`StrokeAttribute`\n"
59 " :param red: Red component of a stroke color.\n"
60 " :type red: float\n"
61 " :param green: Green component of a stroke color.\n"
62 " :type green: float\n"
63 " :param blue: Blue component of a stroke color.\n"
64 " :type blue: float\n"
65 " :param alpha: Alpha component of a stroke color.\n"
66 " :type alpha: float\n"
67 " :param thickness_right: Stroke thickness on the right.\n"
68 " :type thickness_right: float\n"
69 " :param thickness_left: Stroke thickness on the left.\n"
70 " :type thickness_left: float\n"
71 " :param attribute1: The first StrokeAttribute object.\n"
72 " :type attribute1: :class:`StrokeAttribute`\n"
73 " :param attribute2: The second StrokeAttribute object.\n"
74 " :type attribute2: :class:`StrokeAttribute`\n"
75 " :param t: The interpolation parameter (0 <= t <= 1).\n"
76 " :type t: float\n");
77static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
78{
79 static const char *kwlist_1[] = {"brother", nullptr};
80 static const char *kwlist_2[] = {"attribute1", "attribute2", "t", nullptr};
81 static const char *kwlist_3[] = {
82 "red", "green", "blue", "alpha", "thickness_right", "thickness_left", nullptr};
83 PyObject *obj1 = nullptr, *obj2 = nullptr;
84 float red, green, blue, alpha, thickness_right, thickness_left, t;
85
86 if (PyArg_ParseTupleAndKeywords(args,
87 kwds,
88 "|" /* Optional arguments. */
89 "O!" /* `brother` */
90 ":__init__",
91 (char **)kwlist_1,
93 &obj1))
94 {
95 if (!obj1) {
96 self->sa = new StrokeAttribute();
97 }
98 else {
99 self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa));
100 }
101 }
102 else if ((void)PyErr_Clear(),
103 PyArg_ParseTupleAndKeywords(args,
104 kwds,
105 "O!" /* `attribute1` */
106 "O!" /* `attribute2` */
107 "f" /* `t` */
108 ":__init__",
109 (char **)kwlist_2,
111 &obj1,
113 &obj2,
114 &t))
115 {
116 self->sa = new StrokeAttribute(
117 *(((BPy_StrokeAttribute *)obj1)->sa), *(((BPy_StrokeAttribute *)obj2)->sa), t);
118 }
119 else if ((void)PyErr_Clear(),
120 PyArg_ParseTupleAndKeywords(args,
121 kwds,
122 "f" /* `red` */
123 "f" /* `green` */
124 "f" /* `blue` */
125 "f" /* `alpha` */
126 "f" /* `thickness_right` */
127 "f" /* `thickness_left` */
128 ":__init__",
129 (char **)kwlist_3,
130 &red,
131 &green,
132 &blue,
133 &alpha,
134 &thickness_right,
135 &thickness_left))
136 {
137 self->sa = new StrokeAttribute(red, green, blue, alpha, thickness_right, thickness_left);
138 }
139 else {
140 PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
141 return -1;
142 }
143 self->borrowed = false;
144 return 0;
145}
146
148{
149 if (self->sa && !self->borrowed) {
150 delete self->sa;
151 }
152 Py_TYPE(self)->tp_free((PyObject *)self);
153}
154
156{
157 stringstream repr("StrokeAttribute:");
158 repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG()
159 << " b: " << self->sa->getColorB() << " a: " << self->sa->getAlpha()
160 << " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL();
161
162 return blender::PyC_UnicodeFromStdStr(repr.str());
163}
164
166 /* Wrap. */
167 StrokeAttribute_get_attribute_real_doc,
168 ".. method:: get_attribute_real(name)\n"
169 "\n"
170 " Returns an attribute of float type.\n"
171 "\n"
172 " :param name: The name of the attribute.\n"
173 " :type name: str\n"
174 " :return: The attribute value.\n"
175 " :rtype: float\n");
177 PyObject *args,
178 PyObject *kwds)
179{
180 static const char *kwlist[] = {"name", nullptr};
181 char *attr;
182
183 if (!PyArg_ParseTupleAndKeywords(args,
184 kwds,
185 "s" /* `name` */
186 ":get_attribute_real",
187 (char **)kwlist,
188 &attr))
189 {
190 return nullptr;
191 }
192 double a = self->sa->getAttributeReal(attr);
193 return PyFloat_FromDouble(a);
194}
195
197 /* Wrap. */
198 StrokeAttribute_get_attribute_vec2_doc,
199 ".. method:: get_attribute_vec2(name)\n"
200 "\n"
201 " Returns an attribute of two-dimensional vector type.\n"
202 "\n"
203 " :param 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,
215 kwds,
216 "s" /* `name` */
217 ":get_attribute_vec2",
218 (char **)kwlist,
219 &attr))
220 {
221 return nullptr;
222 }
223 Vec2f a = self->sa->getAttributeVec2f(attr);
224 return Vector_from_Vec2f(a);
225}
226
228 /* Wrap. */
229 StrokeAttribute_get_attribute_vec3_doc,
230 ".. method:: get_attribute_vec3(name)\n"
231 "\n"
232 " Returns an attribute of three-dimensional vector type.\n"
233 "\n"
234 " :param name: The name of the attribute.\n"
235 " :type name: str\n"
236 " :return: The attribute value.\n"
237 " :rtype: :class:`mathutils.Vector`\n");
239 PyObject *args,
240 PyObject *kwds)
241{
242 static const char *kwlist[] = {"name", nullptr};
243 char *attr;
244
245 if (!PyArg_ParseTupleAndKeywords(args,
246 kwds,
247 "s" /* `name` */
248 ":get_attribute_vec3",
249 (char **)kwlist,
250 &attr))
251 {
252 return nullptr;
253 }
254 Vec3f a = self->sa->getAttributeVec3f(attr);
255 return Vector_from_Vec3f(a);
256}
257
259 /* Wrap. */
260 StrokeAttribute_has_attribute_real_doc,
261 ".. method:: has_attribute_real(name)\n"
262 "\n"
263 " Checks whether the attribute name of float type is available.\n"
264 "\n"
265 " :param name: The name of the attribute.\n"
266 " :type name: str\n"
267 " :return: True if the attribute is available.\n"
268 " :rtype: bool\n");
270 PyObject *args,
271 PyObject *kwds)
272{
273 static const char *kwlist[] = {"name", nullptr};
274 char *attr;
275
276 if (!PyArg_ParseTupleAndKeywords(args,
277 kwds,
278 "s" /* `name` */
279 ":has_attribute_real",
280 (char **)kwlist,
281 &attr))
282 {
283 return nullptr;
284 }
285 return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr));
286}
287
289 /* Wrap. */
290 StrokeAttribute_has_attribute_vec2_doc,
291 ".. method:: has_attribute_vec2(name)\n"
292 "\n"
293 " Checks whether the attribute name of two-dimensional vector type\n"
294 " is available.\n"
295 "\n"
296 " :param name: The name of the attribute.\n"
297 " :type name: str\n"
298 " :return: True if the attribute is available.\n"
299 " :rtype: bool\n");
301 PyObject *args,
302 PyObject *kwds)
303{
304 static const char *kwlist[] = {"name", nullptr};
305 char *attr;
306
307 if (!PyArg_ParseTupleAndKeywords(args,
308 kwds,
309 "s" /* `name` */
310 ":has_attribute_vec2",
311 (char **)kwlist,
312 &attr))
313 {
314 return nullptr;
315 }
316 return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr));
317}
318
320 /* Wrap. */
321 StrokeAttribute_has_attribute_vec3_doc,
322 ".. method:: has_attribute_vec3(name)\n"
323 "\n"
324 " Checks whether the attribute name of three-dimensional vector\n"
325 " type is available.\n"
326 "\n"
327 " :param name: The name of the attribute.\n"
328 " :type name: str\n"
329 " :return: True if the attribute is available.\n"
330 " :rtype: bool\n");
332 PyObject *args,
333 PyObject *kwds)
334{
335 static const char *kwlist[] = {"name", nullptr};
336 char *attr;
337
338 if (!PyArg_ParseTupleAndKeywords(args,
339 kwds,
340 "s" /* `name` */
341 ":has_attribute_vec3",
342 (char **)kwlist,
343 &attr))
344 {
345 return nullptr;
346 }
347 return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr));
348}
349
351 /* Wrap. */
352 StrokeAttribute_set_attribute_real_doc,
353 ".. method:: set_attribute_real(name, value)\n"
354 "\n"
355 " Adds a user-defined attribute of float type. If there is no\n"
356 " attribute of the given name, it is added. Otherwise, the new value\n"
357 " replaces the old one.\n"
358 "\n"
359 " :param name: The name of the attribute.\n"
360 " :type name: str\n"
361 " :param value: The attribute value.\n"
362 " :type value: float\n");
364 PyObject *args,
365 PyObject *kwds)
366{
367 static const char *kwlist[] = {"name", "value", nullptr};
368 char *s = nullptr;
369 double d = 0;
370
371 if (!PyArg_ParseTupleAndKeywords(args,
372 kwds,
373 "s" /* `name` */
374 "d" /* `value` */
375 ":set_attribute_real",
376 (char **)kwlist,
377 &s,
378 &d))
379 {
380 return nullptr;
381 }
382 self->sa->setAttributeReal(s, d);
383 Py_RETURN_NONE;
384}
385
387 /* Wrap. */
388 StrokeAttribute_set_attribute_vec2_doc,
389 ".. method:: set_attribute_vec2(name, value)\n"
390 "\n"
391 " Adds a user-defined attribute of two-dimensional vector type. If\n"
392 " there is no attribute of the given name, it is added. Otherwise,\n"
393 " the new value replaces the old one.\n"
394 "\n"
395 " :param name: The name of the attribute.\n"
396 " :type name: str\n"
397 " :param value: The attribute value.\n"
398 " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
400 PyObject *args,
401 PyObject *kwds)
402{
403 static const char *kwlist[] = {"name", "value", nullptr};
404 char *s;
405 PyObject *obj = nullptr;
406 Vec2f vec;
407
408 if (!PyArg_ParseTupleAndKeywords(args,
409 kwds,
410 "s" /* `name` */
411 "O" /* `value` */
412 ":set_attribute_vec2",
413 (char **)kwlist,
414 &s,
415 &obj))
416 {
417 return nullptr;
418 }
419 if (!Vec2f_ptr_from_PyObject(obj, vec)) {
420 PyErr_SetString(PyExc_TypeError,
421 "argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
422 return nullptr;
423 }
424 self->sa->setAttributeVec2f(s, vec);
425 Py_RETURN_NONE;
426}
427
429 /* Wrap. */
430 StrokeAttribute_set_attribute_vec3_doc,
431 ".. method:: set_attribute_vec3(name, value)\n"
432 "\n"
433 " Adds a user-defined attribute of three-dimensional vector type.\n"
434 " If there is no attribute of the given name, it is added.\n"
435 " Otherwise, the new value replaces the old one.\n"
436 "\n"
437 " :param name: The name of the attribute.\n"
438 " :type name: str\n"
439 " :param value: The attribute value as a 3D vector.\n"
440 " :type value: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
442 PyObject *args,
443 PyObject *kwds)
444{
445 static const char *kwlist[] = {"name", "value", nullptr};
446 char *s;
447 PyObject *obj = nullptr;
448 Vec3f vec;
449
450 if (!PyArg_ParseTupleAndKeywords(args,
451 kwds,
452 "s" /* `name` */
453 "O" /* `value` */
454 ":set_attribute_vec3",
455 (char **)kwlist,
456 &s,
457 &obj))
458 {
459 return nullptr;
460 }
461 if (!Vec3f_ptr_from_PyObject(obj, vec)) {
462 PyErr_SetString(PyExc_TypeError,
463 "argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
464 return nullptr;
465 }
466 self->sa->setAttributeVec3f(s, vec);
467 Py_RETURN_NONE;
468}
469
470#ifdef __GNUC__
471# ifdef __clang__
472# pragma clang diagnostic push
473# pragma clang diagnostic ignored "-Wcast-function-type"
474# else
475# pragma GCC diagnostic push
476# pragma GCC diagnostic ignored "-Wcast-function-type"
477# endif
478#endif
479
480static PyMethodDef BPy_StrokeAttribute_methods[] = {
481 {"get_attribute_real",
483 METH_VARARGS | METH_KEYWORDS,
484 StrokeAttribute_get_attribute_real_doc},
485 {"get_attribute_vec2",
487 METH_VARARGS | METH_KEYWORDS,
488 StrokeAttribute_get_attribute_vec2_doc},
489 {"get_attribute_vec3",
491 METH_VARARGS | METH_KEYWORDS,
492 StrokeAttribute_get_attribute_vec3_doc},
493 {"has_attribute_real",
495 METH_VARARGS | METH_KEYWORDS,
496 StrokeAttribute_has_attribute_real_doc},
497 {"has_attribute_vec2",
499 METH_VARARGS | METH_KEYWORDS,
500 StrokeAttribute_has_attribute_vec2_doc},
501 {"has_attribute_vec3",
503 METH_VARARGS | METH_KEYWORDS,
504 StrokeAttribute_has_attribute_vec3_doc},
505 {"set_attribute_real",
507 METH_VARARGS | METH_KEYWORDS,
508 StrokeAttribute_set_attribute_real_doc},
509 {"set_attribute_vec2",
511 METH_VARARGS | METH_KEYWORDS,
512 StrokeAttribute_set_attribute_vec2_doc},
513 {"set_attribute_vec3",
515 METH_VARARGS | METH_KEYWORDS,
516 StrokeAttribute_set_attribute_vec3_doc},
517 {nullptr, nullptr, 0, nullptr},
518};
519
520#ifdef __GNUC__
521# ifdef __clang__
522# pragma clang diagnostic pop
523# else
524# pragma GCC diagnostic pop
525# endif
526#endif
527
528/*----------------------mathutils callbacks ----------------------------*/
529
530/* subtype */
531#define MATHUTILS_SUBTYPE_COLOR 1
532#define MATHUTILS_SUBTYPE_THICKNESS 2
533
535{
536 if (!BPy_StrokeAttribute_Check(bmo->cb_user)) {
537 return -1;
538 }
539 return 0;
540}
541
543{
544 BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
545 switch (subtype) {
547 bmo->data[0] = self->sa->getColorR();
548 bmo->data[1] = self->sa->getColorG();
549 bmo->data[2] = self->sa->getColorB();
550 break;
552 bmo->data[0] = self->sa->getThicknessR();
553 bmo->data[1] = self->sa->getThicknessL();
554 break;
555 default:
556 return -1;
557 }
558 return 0;
559}
560
562{
563 BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
564 switch (subtype) {
566 self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]);
567 break;
569 self->sa->setThickness(bmo->data[0], bmo->data[1]);
570 break;
571 default:
572 return -1;
573 }
574 return 0;
575}
576
578 int subtype,
579 int index)
580{
581 BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
582 switch (subtype) {
584 switch (index) {
585 case 0:
586 bmo->data[0] = self->sa->getColorR();
587 break;
588 case 1:
589 bmo->data[1] = self->sa->getColorG();
590 break;
591 case 2:
592 bmo->data[2] = self->sa->getColorB();
593 break;
594 default:
595 return -1;
596 }
597 break;
599 switch (index) {
600 case 0:
601 bmo->data[0] = self->sa->getThicknessR();
602 break;
603 case 1:
604 bmo->data[1] = self->sa->getThicknessL();
605 break;
606 default:
607 return -1;
608 }
609 break;
610 default:
611 return -1;
612 }
613 return 0;
614}
615
617 int subtype,
618 int index)
619{
620 BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
621 switch (subtype) {
623 float r = (index == 0) ? bmo->data[0] : self->sa->getColorR();
624 float g = (index == 1) ? bmo->data[1] : self->sa->getColorG();
625 float b = (index == 2) ? bmo->data[2] : self->sa->getColorB();
626 self->sa->setColor(r, g, b);
627 break;
628 }
630 float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR();
631 float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL();
632 self->sa->setThickness(tr, tl);
633 break;
634 }
635 default:
636 return -1;
637 }
638 return 0;
639}
640
648
650
655
656/*----------------------StrokeAttribute get/setters ----------------------------*/
657
659 /* Wrap. */
660 StrokeAttribute_alpha_doc,
661 "Alpha component of the stroke color.\n"
662 "\n"
663 ":type: float\n");
664static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void * /*closure*/)
665{
666 return PyFloat_FromDouble(self->sa->getAlpha());
667}
668
670 PyObject *value,
671 void * /*closure*/)
672{
673 float scalar;
674 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
675 /* parsed item not a number */
676 PyErr_SetString(PyExc_TypeError, "value must be a number");
677 return -1;
678 }
679 self->sa->setAlpha(scalar);
680 return 0;
681}
682
684 /* Wrap. */
685 StrokeAttribute_color_doc,
686 "RGB components of the stroke color.\n"
687 "\n"
688 ":type: :class:`mathutils.Color`\n");
689static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void * /*closure*/)
690{
693}
694
696 PyObject *value,
697 void * /*closure*/)
698{
699 float v[3];
700 if (blender::mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1)
701 {
702 return -1;
703 }
704 self->sa->setColor(v[0], v[1], v[2]);
705 return 0;
706}
707
709 /* Wrap. */
710 StrokeAttribute_thickness_doc,
711 "Right and left components of the stroke thickness.\n"
712 "The right (left) component is the thickness on the right (left) of the vertex\n"
713 "when following the stroke.\n"
714 "\n"
715 ":type: :class:`mathutils.Vector`\n");
716static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void * /*closure*/)
717{
720}
721
723 PyObject *value,
724 void * /*closure*/)
725{
726 float v[2];
727 if (blender::mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1)
728 {
729 return -1;
730 }
731 self->sa->setThickness(v[0], v[1]);
732 return 0;
733}
734
736 /* Wrap. */
737 StrokeAttribute_visible_doc,
738 "The visibility flag. True if the StrokeVertex is visible.\n"
739 "\n"
740 ":type: bool\n");
741static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void * /*closure*/)
742{
743 return PyBool_from_bool(self->sa->isVisible());
744}
745
747 PyObject *value,
748 void * /*closure*/)
749{
750 if (!PyBool_Check(value)) {
751 PyErr_SetString(PyExc_TypeError, "value must be boolean");
752 return -1;
753 }
754 self->sa->setVisible(bool_from_PyBool(value));
755 return 0;
756}
757
758static PyGetSetDef BPy_StrokeAttribute_getseters[] = {
759 {"alpha",
762 StrokeAttribute_alpha_doc,
763 nullptr},
764 {"color",
767 StrokeAttribute_color_doc,
768 nullptr},
769 {"thickness",
772 StrokeAttribute_thickness_doc,
773 nullptr},
774 {"visible",
777 StrokeAttribute_visible_doc,
778 nullptr},
779 {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
780};
781
782/*-----------------------BPy_StrokeAttribute type definition ------------------------------*/
783
784PyTypeObject StrokeAttribute_Type = {
785 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
786 /*tp_name*/ "StrokeAttribute",
787 /*tp_basicsize*/ sizeof(BPy_StrokeAttribute),
788 /*tp_itemsize*/ 0,
789 /*tp_dealloc*/ (destructor)StrokeAttribute_dealloc,
790 /*tp_vectorcall_offset*/ 0,
791 /*tp_getattr*/ nullptr,
792 /*tp_setattr*/ nullptr,
793 /*tp_as_async*/ nullptr,
794 /*tp_repr*/ (reprfunc)StrokeAttribute_repr,
795 /*tp_as_number*/ nullptr,
796 /*tp_as_sequence*/ nullptr,
797 /*tp_as_mapping*/ nullptr,
798 /*tp_hash*/ nullptr,
799 /*tp_call*/ nullptr,
800 /*tp_str*/ nullptr,
801 /*tp_getattro*/ nullptr,
802 /*tp_setattro*/ nullptr,
803 /*tp_as_buffer*/ nullptr,
804 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
805 /*tp_doc*/ StrokeAttribute_doc,
806 /*tp_traverse*/ nullptr,
807 /*tp_clear*/ nullptr,
808 /*tp_richcompare*/ nullptr,
809 /*tp_weaklistoffset*/ 0,
810 /*tp_iter*/ nullptr,
811 /*tp_iternext*/ nullptr,
812 /*tp_methods*/ BPy_StrokeAttribute_methods,
813 /*tp_members*/ nullptr,
814 /*tp_getset*/ BPy_StrokeAttribute_getseters,
815 /*tp_base*/ nullptr,
816 /*tp_dict*/ nullptr,
817 /*tp_descr_get*/ nullptr,
818 /*tp_descr_set*/ nullptr,
819 /*tp_dictoffset*/ 0,
820 /*tp_init*/ (initproc)StrokeAttribute_init,
821 /*tp_alloc*/ nullptr,
822 /*tp_new*/ PyType_GenericNew,
823};
824
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)
PyDoc_STRVAR(FalseBP1D___doc__, "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`FalseBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Always returns false.\n" "\n" " :param inter1: The first Interface1D object.\n" " :type inter1: :class:`freestyle.types.Interface1D`\n" " :param inter2: The second Interface1D object.\n" " :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: False.\n" " :rtype: bool\n")
static int StrokeAttribute_alpha_set(BPy_StrokeAttribute *self, PyObject *value, void *)
static int StrokeAttribute_mathutils_set(blender::BaseMathObject *bmo, int subtype)
static blender::Mathutils_Callback StrokeAttribute_mathutils_cb
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_check(blender::BaseMathObject *bmo)
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_set_index(blender::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 PyGetSetDef BPy_StrokeAttribute_getseters[]
static int StrokeAttribute_mathutils_get(blender::BaseMathObject *bmo, int subtype)
static PyObject * StrokeAttribute_repr(BPy_StrokeAttribute *self)
static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *)
static PyObject * StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void *)
static int StrokeAttribute_mathutils_get_index(blender::BaseMathObject *bmo, int subtype, int index)
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 uchar StrokeAttribute_mathutils_cb_index
static void StrokeAttribute_dealloc(BPy_StrokeAttribute *self)
int StrokeAttribute_Init(PyObject *module)
#define BPy_StrokeAttribute_Check(v)
float getColorR() const
Definition Stroke.h:101
void setVisible(bool iVisible)
Definition Stroke.h:250
bool isAttributeAvailableVec3f(const char *iName) const
Definition Stroke.cpp:289
void setThickness(float tr, float tl)
Definition Stroke.h:233
Vec3f getAttributeVec3f(const char *iName) const
Definition Stroke.cpp:246
void setAttributeReal(const char *iName, float att)
Definition Stroke.cpp:301
float getColorG() const
Definition Stroke.h:107
void setAttributeVec3f(const char *iName, const Vec3f &att)
Definition Stroke.cpp:317
float getThicknessR() const
Definition Stroke.h:140
bool isVisible() const
Definition Stroke.h:159
float getAlpha() const
Definition Stroke.h:125
float getColorB() const
Definition Stroke.h:113
void setColor(float r, float g, float b)
Definition Stroke.h:200
float getThicknessL() const
Definition Stroke.h:146
bool isAttributeAvailableVec2f(const char *iName) const
Definition Stroke.cpp:277
void setAlpha(float alpha)
Definition Stroke.h:222
Vec2f getAttributeVec2f(const char *iName) const
Definition Stroke.cpp:227
void setAttributeVec2f(const char *iName, const Vec2f &att)
Definition Stroke.cpp:309
bool isAttributeAvailableReal(const char *iName) const
Definition Stroke.cpp:265
float getAttributeReal(const char *iName) const
Definition Stroke.cpp:208
#define index(i)
unsigned int uchar
VecMat::Vec3< float > Vec3f
Definition Geom.h:28
VecMat::Vec2< float > Vec2f
Definition Geom.h:22
inherits from class Rep
Definition AppCanvas.cpp:20
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int vec_num, uchar cb_type, uchar cb_subtype)
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
Definition mathutils.cc:97
PyObject * PyC_UnicodeFromStdStr(const std::string &str)
PyObject * Color_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
PyObject_HEAD Freestyle::StrokeAttribute * sa