Blender  V2.93
BPy_StrokeAttribute.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "BPy_StrokeAttribute.h"
22 
23 #include "BPy_Convert.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 using namespace Freestyle;
30 
32 
33 //-------------------MODULE INITIALIZATION--------------------------------
35 {
36  if (module == nullptr) {
37  return -1;
38  }
39 
40  if (PyType_Ready(&StrokeAttribute_Type) < 0) {
41  return -1;
42  }
43  Py_INCREF(&StrokeAttribute_Type);
44  PyModule_AddObject(module, "StrokeAttribute", (PyObject *)&StrokeAttribute_Type);
45 
47  return 0;
48 }
49 
50 //------------------------INSTANCE METHODS ----------------------------------
51 
52 PyDoc_STRVAR(StrokeAttribute_doc,
53  "Class to define a set of attributes associated with a :class:`StrokeVertex`.\n"
54  "The attribute set stores the color, alpha and thickness values for a Stroke\n"
55  "Vertex.\n"
56  "\n"
57  ".. method:: __init__()\n"
58  " __init__(brother)\n"
59  " __init__(red, green, blue, alpha, thickness_right, thickness_left)\n"
60  " __init__(attribute1, attribute2, t)\n"
61  "\n"
62  " Creates a :class:`StrokeAttribute` object using either a default constructor,\n"
63  " copy constructor, overloaded constructor, or and interpolation constructor\n"
64  " to interpolate between two :class:`StrokeAttribute` objects.\n"
65  "\n"
66  " :arg brother: A StrokeAttribute object to be used as a copy constructor.\n"
67  " :type brother: :class:`StrokeAttribute`\n"
68  " :arg red: Red component of a stroke color.\n"
69  " :type red: float\n"
70  " :arg green: Green component of a stroke color.\n"
71  " :type green: float\n"
72  " :arg blue: Blue component of a stroke color.\n"
73  " :type blue: float\n"
74  " :arg alpha: Alpha component of a stroke color.\n"
75  " :type alpha: float\n"
76  " :arg thickness_right: Stroke thickness on the right.\n"
77  " :type thickness_right: float\n"
78  " :arg thickness_left: Stroke thickness on the left.\n"
79  " :type thickness_left: float\n"
80  " :arg attribute1: The first StrokeAttribute object.\n"
81  " :type attribute1: :class:`StrokeAttribute`\n"
82  " :arg attribute2: The second StrokeAttribute object.\n"
83  " :type attribute2: :class:`StrokeAttribute`\n"
84  " :arg t: The interpolation parameter (0 <= t <= 1).\n"
85  " :type t: float\n");
86 
87 static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
88 {
89  static const char *kwlist_1[] = {"brother", nullptr};
90  static const char *kwlist_2[] = {"attribute1", "attribute2", "t", nullptr};
91  static const char *kwlist_3[] = {
92  "red", "green", "blue", "alpha", "thickness_right", "thickness_left", nullptr};
93  PyObject *obj1 = nullptr, *obj2 = nullptr;
94  float red, green, blue, alpha, thickness_right, thickness_left, t;
95 
96  if (PyArg_ParseTupleAndKeywords(
97  args, kwds, "|O!", (char **)kwlist_1, &StrokeAttribute_Type, &obj1)) {
98  if (!obj1) {
99  self->sa = new StrokeAttribute();
100  }
101  else {
102  self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa));
103  }
104  }
105  else if ((void)PyErr_Clear(),
106  PyArg_ParseTupleAndKeywords(args,
107  kwds,
108  "O!O!f",
109  (char **)kwlist_2,
111  &obj1,
113  &obj2,
114  &t)) {
115  self->sa = new StrokeAttribute(
116  *(((BPy_StrokeAttribute *)obj1)->sa), *(((BPy_StrokeAttribute *)obj2)->sa), t);
117  }
118  else if ((void)PyErr_Clear(),
119  PyArg_ParseTupleAndKeywords(args,
120  kwds,
121  "ffffff",
122  (char **)kwlist_3,
123  &red,
124  &green,
125  &blue,
126  &alpha,
127  &thickness_right,
128  &thickness_left)) {
129  self->sa = new StrokeAttribute(red, green, blue, alpha, thickness_right, thickness_left);
130  }
131  else {
132  PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
133  return -1;
134  }
135  self->borrowed = false;
136  return 0;
137 }
138 
140 {
141  if (self->sa && !self->borrowed) {
142  delete self->sa;
143  }
144  Py_TYPE(self)->tp_free((PyObject *)self);
145 }
146 
148 {
149  stringstream repr("StrokeAttribute:");
150  repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG()
151  << " b: " << self->sa->getColorB() << " a: " << self->sa->getAlpha()
152  << " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL();
153 
154  return PyUnicode_FromString(repr.str().c_str());
155 }
156 
157 PyDoc_STRVAR(StrokeAttribute_get_attribute_real_doc,
158  ".. method:: get_attribute_real(name)\n"
159  "\n"
160  " Returns an attribute of float type.\n"
161  "\n"
162  " :arg name: The name of the attribute.\n"
163  " :type name: str\n"
164  " :return: The attribute value.\n"
165  " :rtype: float\n");
166 
168  PyObject *args,
169  PyObject *kwds)
170 {
171  static const char *kwlist[] = {"name", nullptr};
172  char *attr;
173 
174  if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
175  return nullptr;
176  }
177  double a = self->sa->getAttributeReal(attr);
178  return PyFloat_FromDouble(a);
179 }
180 
181 PyDoc_STRVAR(StrokeAttribute_get_attribute_vec2_doc,
182  ".. method:: get_attribute_vec2(name)\n"
183  "\n"
184  " Returns an attribute of two-dimensional vector type.\n"
185  "\n"
186  " :arg name: The name of the attribute.\n"
187  " :type name: str\n"
188  " :return: The attribute value.\n"
189  " :rtype: :class:`mathutils.Vector`\n");
190 
192  PyObject *args,
193  PyObject *kwds)
194 {
195  static const char *kwlist[] = {"name", nullptr};
196  char *attr;
197 
198  if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
199  return nullptr;
200  }
201  Vec2f a = self->sa->getAttributeVec2f(attr);
202  return Vector_from_Vec2f(a);
203 }
204 
205 PyDoc_STRVAR(StrokeAttribute_get_attribute_vec3_doc,
206  ".. method:: get_attribute_vec3(name)\n"
207  "\n"
208  " Returns an attribute of three-dimensional vector type.\n"
209  "\n"
210  " :arg name: The name of the attribute.\n"
211  " :type name: str\n"
212  " :return: The attribute value.\n"
213  " :rtype: :class:`mathutils.Vector`\n");
214 
216  PyObject *args,
217  PyObject *kwds)
218 {
219  static const char *kwlist[] = {"name", nullptr};
220  char *attr;
221 
222  if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
223  return nullptr;
224  }
225  Vec3f a = self->sa->getAttributeVec3f(attr);
226  return Vector_from_Vec3f(a);
227 }
228 
229 PyDoc_STRVAR(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 
252 PyDoc_STRVAR(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 
276 PyDoc_STRVAR(StrokeAttribute_has_attribute_vec3_doc,
277  ".. method:: has_attribute_vec3(name)\n"
278  "\n"
279  " Checks whether the attribute name of three-dimensional vector\n"
280  " type is available.\n"
281  "\n"
282  " :arg name: The name of the attribute.\n"
283  " :type name: str\n"
284  " :return: True if the attribute is available.\n"
285  " :rtype: bool\n");
286 
288  PyObject *args,
289  PyObject *kwds)
290 {
291  static const char *kwlist[] = {"name", nullptr};
292  char *attr;
293 
294  if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
295  return nullptr;
296  }
297  return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr));
298 }
299 
300 PyDoc_STRVAR(StrokeAttribute_set_attribute_real_doc,
301  ".. method:: set_attribute_real(name, value)\n"
302  "\n"
303  " Adds a user-defined attribute of float type. If there is no\n"
304  " attribute of the given name, it is added. Otherwise, the new value\n"
305  " replaces the old one.\n"
306  "\n"
307  " :arg name: The name of the attribute.\n"
308  " :type name: str\n"
309  " :arg value: The attribute value.\n"
310  " :type value: float\n");
311 
313  PyObject *args,
314  PyObject *kwds)
315 {
316  static const char *kwlist[] = {"name", "value", nullptr};
317  char *s = nullptr;
318  double d = 0;
319 
320  if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) {
321  return nullptr;
322  }
323  self->sa->setAttributeReal(s, d);
324  Py_RETURN_NONE;
325 }
326 
327 PyDoc_STRVAR(StrokeAttribute_set_attribute_vec2_doc,
328  ".. method:: set_attribute_vec2(name, value)\n"
329  "\n"
330  " Adds a user-defined attribute of two-dimensional vector type. If\n"
331  " there is no attribute of the given name, it is added. Otherwise,\n"
332  " the new value replaces the old one.\n"
333  "\n"
334  " :arg name: The name of the attribute.\n"
335  " :type name: str\n"
336  " :arg value: The attribute value.\n"
337  " :type value: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n");
338 
340  PyObject *args,
341  PyObject *kwds)
342 {
343  static const char *kwlist[] = {"name", "value", nullptr};
344  char *s;
345  PyObject *obj = nullptr;
346  Vec2f vec;
347 
348  if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
349  return nullptr;
350  }
351  if (!Vec2f_ptr_from_PyObject(obj, vec)) {
352  PyErr_SetString(PyExc_TypeError,
353  "argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
354  return nullptr;
355  }
356  self->sa->setAttributeVec2f(s, vec);
357  Py_RETURN_NONE;
358 }
359 
360 PyDoc_STRVAR(StrokeAttribute_set_attribute_vec3_doc,
361  ".. method:: set_attribute_vec3(name, value)\n"
362  "\n"
363  " Adds a user-defined attribute of three-dimensional vector type.\n"
364  " If there is no attribute of the given name, it is added.\n"
365  " Otherwise, the new value replaces the old one.\n"
366  "\n"
367  " :arg name: The name of the attribute.\n"
368  " :type name: str\n"
369  " :arg value: The attribute value.\n"
370  " :type value: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n");
371 
373  PyObject *args,
374  PyObject *kwds)
375 {
376  static const char *kwlist[] = {"name", "value", nullptr};
377  char *s;
378  PyObject *obj = nullptr;
379  Vec3f vec;
380 
381  if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
382  return nullptr;
383  }
384  if (!Vec3f_ptr_from_PyObject(obj, vec)) {
385  PyErr_SetString(PyExc_TypeError,
386  "argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
387  return nullptr;
388  }
389  self->sa->setAttributeVec3f(s, vec);
390  Py_RETURN_NONE;
391 }
392 
393 static PyMethodDef BPy_StrokeAttribute_methods[] = {
394  {"get_attribute_real",
396  METH_VARARGS | METH_KEYWORDS,
397  StrokeAttribute_get_attribute_real_doc},
398  {"get_attribute_vec2",
400  METH_VARARGS | METH_KEYWORDS,
401  StrokeAttribute_get_attribute_vec2_doc},
402  {"get_attribute_vec3",
404  METH_VARARGS | METH_KEYWORDS,
405  StrokeAttribute_get_attribute_vec3_doc},
406  {"has_attribute_real",
408  METH_VARARGS | METH_KEYWORDS,
409  StrokeAttribute_has_attribute_real_doc},
410  {"has_attribute_vec2",
412  METH_VARARGS | METH_KEYWORDS,
413  StrokeAttribute_has_attribute_vec2_doc},
414  {"has_attribute_vec3",
416  METH_VARARGS | METH_KEYWORDS,
417  StrokeAttribute_has_attribute_vec3_doc},
418  {"set_attribute_real",
420  METH_VARARGS | METH_KEYWORDS,
421  StrokeAttribute_set_attribute_real_doc},
422  {"set_attribute_vec2",
424  METH_VARARGS | METH_KEYWORDS,
425  StrokeAttribute_set_attribute_vec2_doc},
426  {"set_attribute_vec3",
428  METH_VARARGS | METH_KEYWORDS,
429  StrokeAttribute_set_attribute_vec3_doc},
430  {nullptr, nullptr, 0, nullptr},
431 };
432 
433 /*----------------------mathutils callbacks ----------------------------*/
434 
435 /* subtype */
436 #define MATHUTILS_SUBTYPE_COLOR 1
437 #define MATHUTILS_SUBTYPE_THICKNESS 2
438 
440 {
441  if (!BPy_StrokeAttribute_Check(bmo->cb_user)) {
442  return -1;
443  }
444  return 0;
445 }
446 
447 static int StrokeAttribute_mathutils_get(BaseMathObject *bmo, int subtype)
448 {
449  BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
450  switch (subtype) {
452  bmo->data[0] = self->sa->getColorR();
453  bmo->data[1] = self->sa->getColorG();
454  bmo->data[2] = self->sa->getColorB();
455  break;
457  bmo->data[0] = self->sa->getThicknessR();
458  bmo->data[1] = self->sa->getThicknessL();
459  break;
460  default:
461  return -1;
462  }
463  return 0;
464 }
465 
466 static int StrokeAttribute_mathutils_set(BaseMathObject *bmo, int subtype)
467 {
468  BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
469  switch (subtype) {
471  self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]);
472  break;
474  self->sa->setThickness(bmo->data[0], bmo->data[1]);
475  break;
476  default:
477  return -1;
478  }
479  return 0;
480 }
481 
482 static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
483 {
484  BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
485  switch (subtype) {
487  switch (index) {
488  case 0:
489  bmo->data[0] = self->sa->getColorR();
490  break;
491  case 1:
492  bmo->data[1] = self->sa->getColorG();
493  break;
494  case 2:
495  bmo->data[2] = self->sa->getColorB();
496  break;
497  default:
498  return -1;
499  }
500  break;
502  switch (index) {
503  case 0:
504  bmo->data[0] = self->sa->getThicknessR();
505  break;
506  case 1:
507  bmo->data[1] = self->sa->getThicknessL();
508  break;
509  default:
510  return -1;
511  }
512  break;
513  default:
514  return -1;
515  }
516  return 0;
517 }
518 
519 static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
520 {
521  BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
522  switch (subtype) {
524  float r = (index == 0) ? bmo->data[0] : self->sa->getColorR();
525  float g = (index == 1) ? bmo->data[1] : self->sa->getColorG();
526  float b = (index == 2) ? bmo->data[2] : self->sa->getColorB();
527  self->sa->setColor(r, g, b);
528  } break;
530  float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR();
531  float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL();
532  self->sa->setThickness(tr, tl);
533  } break;
534  default:
535  return -1;
536  }
537  return 0;
538 }
539 
546 };
547 
548 static unsigned char StrokeAttribute_mathutils_cb_index = -1;
549 
551 {
553 }
554 
555 /*----------------------StrokeAttribute get/setters ----------------------------*/
556 
557 PyDoc_STRVAR(StrokeAttribute_alpha_doc,
558  "Alpha component of the stroke color.\n"
559  "\n"
560  ":type: float");
561 
562 static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void *UNUSED(closure))
563 {
564  return PyFloat_FromDouble(self->sa->getAlpha());
565 }
566 
568  PyObject *value,
569  void *UNUSED(closure))
570 {
571  float scalar;
572  if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
573  /* parsed item not a number */
574  PyErr_SetString(PyExc_TypeError, "value must be a number");
575  return -1;
576  }
577  self->sa->setAlpha(scalar);
578  return 0;
579 }
580 
581 PyDoc_STRVAR(StrokeAttribute_color_doc,
582  "RGB components of the stroke color.\n"
583  "\n"
584  ":type: :class:`mathutils.Color`");
585 
586 static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUSED(closure))
587 {
590 }
591 
593  PyObject *value,
594  void *UNUSED(closure))
595 {
596  float v[3];
597  if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) {
598  return -1;
599  }
600  self->sa->setColor(v[0], v[1], v[2]);
601  return 0;
602 }
603 
604 PyDoc_STRVAR(StrokeAttribute_thickness_doc,
605  "Right and left components of the stroke thickness.\n"
606  "The right (left) component is the thickness on the right (left) of the vertex\n"
607  "when following the stroke.\n"
608  "\n"
609  ":type: :class:`mathutils.Vector`");
610 
611 static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *UNUSED(closure))
612 {
615 }
616 
618  PyObject *value,
619  void *UNUSED(closure))
620 {
621  float v[2];
622  if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) {
623  return -1;
624  }
625  self->sa->setThickness(v[0], v[1]);
626  return 0;
627 }
628 
629 PyDoc_STRVAR(StrokeAttribute_visible_doc,
630  "The visibility flag. True if the StrokeVertex is visible.\n"
631  "\n"
632  ":type: bool");
633 
634 static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void *UNUSED(closure))
635 {
636  return PyBool_from_bool(self->sa->isVisible());
637 }
638 
640  PyObject *value,
641  void *UNUSED(closure))
642 {
643  if (!PyBool_Check(value)) {
644  PyErr_SetString(PyExc_TypeError, "value must be boolean");
645  return -1;
646  }
647  self->sa->setVisible(bool_from_PyBool(value));
648  return 0;
649 }
650 
651 static PyGetSetDef BPy_StrokeAttribute_getseters[] = {
652  {"alpha",
655  StrokeAttribute_alpha_doc,
656  nullptr},
657  {"color",
660  StrokeAttribute_color_doc,
661  nullptr},
662  {"thickness",
665  StrokeAttribute_thickness_doc,
666  nullptr},
667  {"visible",
670  StrokeAttribute_visible_doc,
671  nullptr},
672  {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
673 };
674 
675 /*-----------------------BPy_StrokeAttribute type definition ------------------------------*/
676 
677 PyTypeObject StrokeAttribute_Type = {
678  PyVarObject_HEAD_INIT(nullptr, 0) "StrokeAttribute", /* tp_name */
679  sizeof(BPy_StrokeAttribute), /* tp_basicsize */
680  0, /* tp_itemsize */
681  (destructor)StrokeAttribute_dealloc, /* tp_dealloc */
682  0, /* tp_vectorcall_offset */
683  nullptr, /* tp_getattr */
684  nullptr, /* tp_setattr */
685  nullptr, /* tp_reserved */
686  (reprfunc)StrokeAttribute_repr, /* tp_repr */
687  nullptr, /* tp_as_number */
688  nullptr, /* tp_as_sequence */
689  nullptr, /* tp_as_mapping */
690  nullptr, /* tp_hash */
691  nullptr, /* tp_call */
692  nullptr, /* tp_str */
693  nullptr, /* tp_getattro */
694  nullptr, /* tp_setattro */
695  nullptr, /* tp_as_buffer */
696  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
697  StrokeAttribute_doc, /* tp_doc */
698  nullptr, /* tp_traverse */
699  nullptr, /* tp_clear */
700  nullptr, /* tp_richcompare */
701  0, /* tp_weaklistoffset */
702  nullptr, /* tp_iter */
703  nullptr, /* tp_iternext */
704  BPy_StrokeAttribute_methods, /* tp_methods */
705  nullptr, /* tp_members */
706  BPy_StrokeAttribute_getseters, /* tp_getset */
707  nullptr, /* tp_base */
708  nullptr, /* tp_dict */
709  nullptr, /* tp_descr_get */
710  nullptr, /* tp_descr_set */
711  0, /* tp_dictoffset */
712  (initproc)StrokeAttribute_init, /* tp_init */
713  nullptr, /* tp_alloc */
714  PyType_GenericNew, /* tp_new */
715 };
716 
718 
719 #ifdef __cplusplus
720 }
721 #endif
#define UNUSED(x)
PyObject * Vector_from_Vec3f(Vec3f &vec)
Definition: BPy_Convert.cpp:86
PyObject * PyBool_from_bool(bool b)
Definition: BPy_Convert.cpp:73
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_Vec2f(Vec2f &vec)
Definition: BPy_Convert.cpp:78
static int StrokeAttribute_color_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure))
static unsigned char StrokeAttribute_mathutils_cb_index
static PyObject * StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUSED(closure))
static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static int StrokeAttribute_mathutils_set(BaseMathObject *bmo, int subtype)
static PyObject * StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void *UNUSED(closure))
static PyObject * StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static int StrokeAttribute_visible_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure))
PyTypeObject StrokeAttribute_Type
static int StrokeAttribute_alpha_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure))
static PyObject * StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
#define MATHUTILS_SUBTYPE_THICKNESS
static PyObject * StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeAttribute_repr(BPy_StrokeAttribute *self)
static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
void StrokeAttribute_mathutils_register_callback()
static PyMethodDef BPy_StrokeAttribute_methods[]
static Mathutils_Callback StrokeAttribute_mathutils_cb
static PyGetSetDef BPy_StrokeAttribute_getseters[]
static PyObject * StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *UNUSED(closure))
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_has_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static int StrokeAttribute_mathutils_check(BaseMathObject *bmo)
static int StrokeAttribute_mathutils_get(BaseMathObject *bmo, int subtype)
#define MATHUTILS_SUBTYPE_COLOR
static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure))
static PyObject * StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void *UNUSED(closure))
static void StrokeAttribute_dealloc(BPy_StrokeAttribute *self)
static PyObject * StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
int StrokeAttribute_Init(PyObject *module)
#define BPy_StrokeAttribute_Check(v)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte blue
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble green
static struct PyModuleDef module
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject * self
Definition: bpy_driver.c:185
static CCL_NAMESPACE_BEGIN const double alpha
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
Definition: mathutils.c:584
int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
Definition: mathutils.c:118
PyObject * Color_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int size, uchar cb_type, uchar cb_subtype)
inherits from class Rep
Definition: AppCanvas.cpp:32
static unsigned a[3]
Definition: RandGen.cpp:92