Blender  V2.93
bmesh_py_types_meshdata.c
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  * The Original Code is Copyright (C) 2012 Blender Foundation.
17  * All rights reserved.
18  */
19 
27 #include <Python.h>
28 
29 #include "../mathutils/mathutils.h"
30 
31 #include "DNA_meshdata_types.h"
32 #include "DNA_object_types.h"
33 
34 #include "BLI_math_base.h"
35 #include "BLI_math_vector.h"
36 #include "BLI_utildefines.h"
37 
38 #include "BKE_deform.h"
39 
41 
42 #include "../generic/py_capi_utils.h"
43 #include "../generic/python_utildefines.h"
44 
45 /* Mesh Loop UV
46  * ************ */
47 
48 #define BPy_BMLoopUV_Check(v) (Py_TYPE(v) == &BPy_BMLoopUV_Type)
49 
50 typedef struct BPy_BMLoopUV {
51  PyObject_VAR_HEAD
54 
55 PyDoc_STRVAR(bpy_bmloopuv_uv_doc,
56  "Loops UV (as a 2D Vector).\n\n:type: :class:`mathutils.Vector`");
57 static PyObject *bpy_bmloopuv_uv_get(BPy_BMLoopUV *self, void *UNUSED(closure))
58 {
59  return Vector_CreatePyObject_wrap(self->data->uv, 2, NULL);
60 }
61 
62 static int bpy_bmloopuv_uv_set(BPy_BMLoopUV *self, PyObject *value, void *UNUSED(closure))
63 {
64  float tvec[2];
65  if (mathutils_array_parse(tvec, 2, 2, value, "BMLoopUV.uv") != -1) {
66  copy_v2_v2(self->data->uv, tvec);
67  return 0;
68  }
69 
70  return -1;
71 }
72 
73 PyDoc_STRVAR(bpy_bmloopuv_flag__pin_uv_doc, "UV pin state.\n\n:type: boolean");
74 PyDoc_STRVAR(bpy_bmloopuv_flag__select_doc, "UV select state.\n\n:type: boolean");
75 
76 static PyObject *bpy_bmloopuv_flag_get(BPy_BMLoopUV *self, void *flag_p)
77 {
78  const int flag = POINTER_AS_INT(flag_p);
79  return PyBool_FromLong(self->data->flag & flag);
80 }
81 
82 static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag_p)
83 {
84  const int flag = POINTER_AS_INT(flag_p);
85 
86  switch (PyC_Long_AsBool(value)) {
87  case true:
88  self->data->flag |= flag;
89  return 0;
90  case false:
91  self->data->flag &= ~flag;
92  return 0;
93  default:
94  /* error is set */
95  return -1;
96  }
97 }
98 
99 static PyGetSetDef bpy_bmloopuv_getseters[] = {
100  /* attributes match rna_def_mloopuv */
101  {"uv", (getter)bpy_bmloopuv_uv_get, (setter)bpy_bmloopuv_uv_set, bpy_bmloopuv_uv_doc, NULL},
102  {"pin_uv",
103  (getter)bpy_bmloopuv_flag_get,
104  (setter)bpy_bmloopuv_flag_set,
105  bpy_bmloopuv_flag__pin_uv_doc,
106  (void *)MLOOPUV_PINNED},
107  {"select",
108  (getter)bpy_bmloopuv_flag_get,
109  (setter)bpy_bmloopuv_flag_set,
110  bpy_bmloopuv_flag__select_doc,
111  (void *)MLOOPUV_VERTSEL},
112 
113  {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
114 };
115 
116 PyTypeObject BPy_BMLoopUV_Type; /* bm.loops.layers.uv.active */
117 
118 static void bm_init_types_bmloopuv(void)
119 {
120  BPy_BMLoopUV_Type.tp_basicsize = sizeof(BPy_BMLoopUV);
121 
122  BPy_BMLoopUV_Type.tp_name = "BMLoopUV";
123 
124  BPy_BMLoopUV_Type.tp_doc = NULL; /* todo */
125 
127 
128  BPy_BMLoopUV_Type.tp_flags = Py_TPFLAGS_DEFAULT;
129 
130  PyType_Ready(&BPy_BMLoopUV_Type);
131 }
132 
133 int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *mloopuv, PyObject *value)
134 {
135  if (UNLIKELY(!BPy_BMLoopUV_Check(value))) {
136  PyErr_Format(PyExc_TypeError, "expected BMLoopUV, not a %.200s", Py_TYPE(value)->tp_name);
137  return -1;
138  }
139 
140  *((MLoopUV *)mloopuv) = *(((BPy_BMLoopUV *)value)->data);
141  return 0;
142 }
143 
144 PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *mloopuv)
145 {
146  BPy_BMLoopUV *self = PyObject_New(BPy_BMLoopUV, &BPy_BMLoopUV_Type);
147  self->data = mloopuv;
148  return (PyObject *)self;
149 }
150 
151 /* --- End Mesh Loop UV --- */
152 
153 /* Mesh Vert Skin
154  * ************ */
155 
156 #define BPy_BMVertSkin_Check(v) (Py_TYPE(v) == &BPy_BMVertSkin_Type)
157 
158 typedef struct BPy_BMVertSkin {
159  PyObject_VAR_HEAD
162 
163 PyDoc_STRVAR(bpy_bmvertskin_radius_doc,
164  "Vert skin radii (as a 2D Vector).\n\n:type: :class:`mathutils.Vector`");
165 static PyObject *bpy_bmvertskin_radius_get(BPy_BMVertSkin *self, void *UNUSED(closure))
166 {
167  return Vector_CreatePyObject_wrap(self->data->radius, 2, NULL);
168 }
169 
170 static int bpy_bmvertskin_radius_set(BPy_BMVertSkin *self, PyObject *value, void *UNUSED(closure))
171 {
172  float tvec[2];
173  if (mathutils_array_parse(tvec, 2, 2, value, "BMVertSkin.radius") != -1) {
174  copy_v2_v2(self->data->radius, tvec);
175  return 0;
176  }
177 
178  return -1;
179 }
180 
181 PyDoc_STRVAR(bpy_bmvertskin_flag__use_root_doc,
182  "Use as root vertex. Setting this flag does not clear other roots in the same mesh "
183  "island.\n\n:type: boolean");
184 PyDoc_STRVAR(bpy_bmvertskin_flag__use_loose_doc, "Use loose vertex.\n\n:type: boolean");
185 
186 static PyObject *bpy_bmvertskin_flag_get(BPy_BMVertSkin *self, void *flag_p)
187 {
188  const int flag = POINTER_AS_INT(flag_p);
189  return PyBool_FromLong(self->data->flag & flag);
190 }
191 
192 static int bpy_bmvertskin_flag_set(BPy_BMVertSkin *self, PyObject *value, void *flag_p)
193 {
194  const int flag = POINTER_AS_INT(flag_p);
195 
196  switch (PyC_Long_AsBool(value)) {
197  case true:
198  self->data->flag |= flag;
199  return 0;
200  case false:
201  self->data->flag &= ~flag;
202  return 0;
203  default:
204  /* error is set */
205  return -1;
206  }
207 }
208 
209 static PyGetSetDef bpy_bmvertskin_getseters[] = {
210  /* attributes match rna_mesh_gen */
211  {"radius",
214  bpy_bmvertskin_radius_doc,
215  NULL},
216  {"use_root",
217  (getter)bpy_bmvertskin_flag_get,
218  (setter)bpy_bmvertskin_flag_set,
219  bpy_bmvertskin_flag__use_root_doc,
220  (void *)MVERT_SKIN_ROOT},
221  {"use_loose",
222  (getter)bpy_bmvertskin_flag_get,
223  (setter)bpy_bmvertskin_flag_set,
224  bpy_bmvertskin_flag__use_loose_doc,
225  (void *)MVERT_SKIN_LOOSE},
226 
227  {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
228 };
229 
230 static PyTypeObject BPy_BMVertSkin_Type; /* bm.loops.layers.skin.active */
231 
232 static void bm_init_types_bmvertskin(void)
233 {
234  BPy_BMVertSkin_Type.tp_basicsize = sizeof(BPy_BMVertSkin);
235 
236  BPy_BMVertSkin_Type.tp_name = "BMVertSkin";
237 
238  BPy_BMVertSkin_Type.tp_doc = NULL; /* todo */
239 
241 
242  BPy_BMVertSkin_Type.tp_flags = Py_TPFLAGS_DEFAULT;
243 
244  PyType_Ready(&BPy_BMVertSkin_Type);
245 }
246 
247 int BPy_BMVertSkin_AssignPyObject(struct MVertSkin *mvertskin, PyObject *value)
248 {
249  if (UNLIKELY(!BPy_BMVertSkin_Check(value))) {
250  PyErr_Format(PyExc_TypeError, "expected BMVertSkin, not a %.200s", Py_TYPE(value)->tp_name);
251  return -1;
252  }
253 
254  *((MVertSkin *)mvertskin) = *(((BPy_BMVertSkin *)value)->data);
255  return 0;
256 }
257 
258 PyObject *BPy_BMVertSkin_CreatePyObject(struct MVertSkin *mvertskin)
259 {
260  BPy_BMVertSkin *self = PyObject_New(BPy_BMVertSkin, &BPy_BMVertSkin_Type);
261  self->data = mvertskin;
262  return (PyObject *)self;
263 }
264 
265 /* --- End Mesh Vert Skin --- */
266 
267 /* Mesh Loop Color
268  * *************** */
269 
270 /* This simply provides a color wrapper for
271  * color which uses mathutils callbacks for mathutils.Color
272  */
273 
274 #define MLOOPCOL_FROM_CAPSULE(color_capsule) \
275  ((MLoopCol *)PyCapsule_GetPointer(color_capsule, NULL))
276 
277 static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[4])
278 {
279  rgba_uchar_to_float(r_col, (const uchar *)&mloopcol->r);
280 }
281 
282 static void mloopcol_from_float(MLoopCol *mloopcol, const float col[4])
283 {
284  rgba_float_to_uchar((uchar *)&mloopcol->r, col);
285 }
286 
288 
290 {
291  /* always ok */
292  return 0;
293 }
294 
295 static int mathutils_bmloopcol_get(BaseMathObject *bmo, int UNUSED(subtype))
296 {
297  MLoopCol *mloopcol = MLOOPCOL_FROM_CAPSULE(bmo->cb_user);
298  mloopcol_to_float(mloopcol, bmo->data);
299  return 0;
300 }
301 
302 static int mathutils_bmloopcol_set(BaseMathObject *bmo, int UNUSED(subtype))
303 {
304  MLoopCol *mloopcol = MLOOPCOL_FROM_CAPSULE(bmo->cb_user);
305  mloopcol_from_float(mloopcol, bmo->data);
306  return 0;
307 }
308 
309 static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int UNUSED(index))
310 {
311  /* lazy, avoid repeteing the case statement */
312  if (mathutils_bmloopcol_get(bmo, subtype) == -1) {
313  return -1;
314  }
315  return 0;
316 }
317 
318 static int mathutils_bmloopcol_set_index(BaseMathObject *bmo, int subtype, int index)
319 {
320  const float f = bmo->data[index];
321 
322  /* lazy, avoid repeteing the case statement */
323  if (mathutils_bmloopcol_get(bmo, subtype) == -1) {
324  return -1;
325  }
326 
327  bmo->data[index] = f;
328  return mathutils_bmloopcol_set(bmo, subtype);
329 }
330 
337 };
338 
339 static void bm_init_types_bmloopcol(void)
340 {
341  /* pass */
343 }
344 
345 int BPy_BMLoopColor_AssignPyObject(struct MLoopCol *mloopcol, PyObject *value)
346 {
347  float tvec[4];
348  if (mathutils_array_parse(tvec, 4, 4, value, "BMLoopCol") != -1) {
349  mloopcol_from_float(mloopcol, tvec);
350  return 0;
351  }
352 
353  return -1;
354 }
355 
356 PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *mloopcol)
357 {
358  PyObject *color_capsule;
359  color_capsule = PyCapsule_New(mloopcol, NULL, NULL);
360  return Vector_CreatePyObject_cb(color_capsule, 4, mathutils_bmloopcol_cb_index, 0);
361 }
362 
363 #undef MLOOPCOL_FROM_CAPSULE
364 
365 /* --- End Mesh Loop Color --- */
366 
367 /* Mesh Deform Vert
368  * **************** */
369 
394 #define BPy_BMDeformVert_Check(v) (Py_TYPE(v) == &BPy_BMDeformVert_Type)
395 
396 typedef struct BPy_BMDeformVert {
397  PyObject_VAR_HEAD
400 
401 /* Mapping Protocols
402  * ================= */
403 
405 {
406  return self->data->totweight;
407 }
408 
409 static PyObject *bpy_bmdeformvert_subscript(BPy_BMDeformVert *self, PyObject *key)
410 {
411  if (PyIndex_Check(key)) {
412  int i;
413  i = PyNumber_AsSsize_t(key, PyExc_IndexError);
414  if (i == -1 && PyErr_Occurred()) {
415  return NULL;
416  }
417 
418  MDeformWeight *dw = BKE_defvert_find_index(self->data, i);
419 
420  if (dw == NULL) {
421  PyErr_SetString(PyExc_KeyError,
422  "BMDeformVert[key] = x: "
423  "key not found");
424  return NULL;
425  }
426 
427  return PyFloat_FromDouble(dw->weight);
428  }
429 
430  PyErr_Format(
431  PyExc_TypeError, "BMDeformVert keys must be integers, not %.200s", Py_TYPE(key)->tp_name);
432  return NULL;
433 }
434 
435 static int bpy_bmdeformvert_ass_subscript(BPy_BMDeformVert *self, PyObject *key, PyObject *value)
436 {
437  if (PyIndex_Check(key)) {
438  int i;
439 
440  i = PyNumber_AsSsize_t(key, PyExc_IndexError);
441  if (i == -1 && PyErr_Occurred()) {
442  return -1;
443  }
444 
445  if (value) {
446  /* dvert[group_index] = 0.5 */
447  if (i < 0) {
448  PyErr_SetString(PyExc_KeyError,
449  "BMDeformVert[key] = x: "
450  "weight keys can't be negative");
451  return -1;
452  }
453 
455  const float f = PyFloat_AsDouble(value);
456  if (f == -1 && PyErr_Occurred()) { // parsed key not a number
457  PyErr_SetString(PyExc_TypeError,
458  "BMDeformVert[key] = x: "
459  "assigned value not a number");
460  return -1;
461  }
462 
463  dw->weight = clamp_f(f, 0.0f, 1.0f);
464  }
465  else {
466  /* del dvert[group_index] */
467  MDeformWeight *dw = BKE_defvert_find_index(self->data, i);
468 
469  if (dw == NULL) {
470  PyErr_SetString(PyExc_KeyError,
471  "del BMDeformVert[key]: "
472  "key not found");
473  }
474  BKE_defvert_remove_group(self->data, dw);
475  }
476 
477  return 0;
478  }
479 
480  PyErr_Format(
481  PyExc_TypeError, "BMDeformVert keys must be integers, not %.200s", Py_TYPE(key)->tp_name);
482  return -1;
483 }
484 
485 static int bpy_bmdeformvert_contains(BPy_BMDeformVert *self, PyObject *value)
486 {
487  const int key = PyLong_AsSsize_t(value);
488 
489  if (key == -1 && PyErr_Occurred()) {
490  PyErr_SetString(PyExc_TypeError, "BMDeformVert.__contains__: expected an int");
491  return -1;
492  }
493 
494  return (BKE_defvert_find_index(self->data, key) != NULL) ? 1 : 0;
495 }
496 
497 /* only defined for __contains__ */
498 static PySequenceMethods bpy_bmdeformvert_as_sequence = {
499  (lenfunc)bpy_bmdeformvert_len, /* sq_length */
500  NULL, /* sq_concat */
501  NULL, /* sq_repeat */
502 
503  /* Note: if this is set #PySequence_Check() returns True,
504  * but in this case we don't want to be treated as a seq. */
505  NULL, /* sq_item */
506 
507  NULL, /* sq_slice */
508  NULL, /* sq_ass_item */
509  NULL, /* *was* sq_ass_slice */
510  (objobjproc)bpy_bmdeformvert_contains, /* sq_contains */
511  (binaryfunc)NULL, /* sq_inplace_concat */
512  (ssizeargfunc)NULL, /* sq_inplace_repeat */
513 };
514 
515 static PyMappingMethods bpy_bmdeformvert_as_mapping = {
516  (lenfunc)bpy_bmdeformvert_len,
517  (binaryfunc)bpy_bmdeformvert_subscript,
518  (objobjargproc)bpy_bmdeformvert_ass_subscript,
519 };
520 
521 /* Methods
522  * ======= */
523 
524 PyDoc_STRVAR(bpy_bmdeformvert_keys_doc,
525  ".. method:: keys()\n"
526  "\n"
527  " Return the group indices used by this vertex\n"
528  " (matching pythons dict.keys() functionality).\n"
529  "\n"
530  " :return: the deform group this vertex uses\n"
531  " :rtype: list of ints\n");
533 {
534  PyObject *ret;
535  int i;
536  MDeformWeight *dw = self->data->dw;
537 
538  ret = PyList_New(self->data->totweight);
539  for (i = 0; i < self->data->totweight; i++, dw++) {
540  PyList_SET_ITEM(ret, i, PyLong_FromLong(dw->def_nr));
541  }
542 
543  return ret;
544 }
545 
546 PyDoc_STRVAR(bpy_bmdeformvert_values_doc,
547  ".. method:: values()\n"
548  "\n"
549  " Return the weights of the deform vertex\n"
550  " (matching pythons dict.values() functionality).\n"
551  "\n"
552  " :return: The weights that influence this vertex\n"
553  " :rtype: list of floats\n");
555 {
556  PyObject *ret;
557  int i;
558  MDeformWeight *dw = self->data->dw;
559 
560  ret = PyList_New(self->data->totweight);
561  for (i = 0; i < self->data->totweight; i++, dw++) {
562  PyList_SET_ITEM(ret, i, PyFloat_FromDouble(dw->weight));
563  }
564 
565  return ret;
566 }
567 
568 PyDoc_STRVAR(bpy_bmdeformvert_items_doc,
569  ".. method:: items()\n"
570  "\n"
571  " Return (group, weight) pairs for this vertex\n"
572  " (matching pythons dict.items() functionality).\n"
573  "\n"
574  " :return: (key, value) pairs for each deform weight of this vertex.\n"
575  " :rtype: list of tuples\n");
577 {
578  PyObject *ret;
579  PyObject *item;
580  int i;
581  MDeformWeight *dw = self->data->dw;
582 
583  ret = PyList_New(self->data->totweight);
584  for (i = 0; i < self->data->totweight; i++, dw++) {
585  item = PyTuple_New(2);
586  PyTuple_SET_ITEMS(item, PyLong_FromLong(dw->def_nr), PyFloat_FromDouble(dw->weight));
587  PyList_SET_ITEM(ret, i, item);
588  }
589 
590  return ret;
591 }
592 
593 PyDoc_STRVAR(bpy_bmdeformvert_get_doc,
594  ".. method:: get(key, default=None)\n"
595  "\n"
596  " Returns the deform weight matching the key or default\n"
597  " when not found (matches pythons dictionary function of the same name).\n"
598  "\n"
599  " :arg key: The key associated with deform weight.\n"
600  " :type key: int\n"
601  " :arg default: Optional argument for the value to return if\n"
602  " *key* is not found.\n"
603  " :type default: Undefined\n");
604 static PyObject *bpy_bmdeformvert_get(BPy_BMDeformVert *self, PyObject *args)
605 {
606  int key;
607  PyObject *def = Py_None;
608 
609  if (!PyArg_ParseTuple(args, "i|O:get", &key, &def)) {
610  return NULL;
611  }
612 
613  MDeformWeight *dw = BKE_defvert_find_index(self->data, key);
614 
615  if (dw) {
616  return PyFloat_FromDouble(dw->weight);
617  }
618 
619  return Py_INCREF_RET(def);
620 }
621 
622 PyDoc_STRVAR(bpy_bmdeformvert_clear_doc,
623  ".. method:: clear()\n"
624  "\n"
625  " Clears all weights.\n");
627 {
628  BKE_defvert_clear(self->data);
629 
630  Py_RETURN_NONE;
631 }
632 
633 static struct PyMethodDef bpy_bmdeformvert_methods[] = {
634  {"keys", (PyCFunction)bpy_bmdeformvert_keys, METH_NOARGS, bpy_bmdeformvert_keys_doc},
635  {"values", (PyCFunction)bpy_bmdeformvert_values, METH_NOARGS, bpy_bmdeformvert_values_doc},
636  {"items", (PyCFunction)bpy_bmdeformvert_items, METH_NOARGS, bpy_bmdeformvert_items_doc},
637  {"get", (PyCFunction)bpy_bmdeformvert_get, METH_VARARGS, bpy_bmdeformvert_get_doc},
638  /* BMESH_TODO pop, popitem, update */
639  {"clear", (PyCFunction)bpy_bmdeformvert_clear, METH_NOARGS, bpy_bmdeformvert_clear_doc},
640  {NULL, NULL, 0, NULL},
641 };
642 
643 PyTypeObject BPy_BMDeformVert_Type; /* bm.loops.layers.uv.active */
644 
645 static void bm_init_types_bmdvert(void)
646 {
647  BPy_BMDeformVert_Type.tp_basicsize = sizeof(BPy_BMDeformVert);
648 
649  BPy_BMDeformVert_Type.tp_name = "BMDeformVert";
650 
651  BPy_BMDeformVert_Type.tp_doc = NULL; /* todo */
652 
655 
657 
658  BPy_BMDeformVert_Type.tp_flags = Py_TPFLAGS_DEFAULT;
659 
660  PyType_Ready(&BPy_BMDeformVert_Type);
661 }
662 
663 int BPy_BMDeformVert_AssignPyObject(struct MDeformVert *dvert, PyObject *value)
664 {
665  if (UNLIKELY(!BPy_BMDeformVert_Check(value))) {
666  PyErr_Format(PyExc_TypeError, "expected BMDeformVert, not a %.200s", Py_TYPE(value)->tp_name);
667  return -1;
668  }
669 
670  MDeformVert *dvert_src = ((BPy_BMDeformVert *)value)->data;
671  if (LIKELY(dvert != dvert_src)) {
672  BKE_defvert_copy(dvert, dvert_src);
673  }
674  return 0;
675 }
676 
678 {
680  self->data = dvert;
681  return (PyObject *)self;
682 }
683 
684 /* --- End Mesh Deform Vert --- */
685 
686 /* call to init all types */
688 {
693 }
support for deformation groups and hooks.
struct MDeformWeight * BKE_defvert_ensure_index(struct MDeformVert *dv, const int defgroup)
Definition: deform.c:688
struct MDeformWeight * BKE_defvert_find_index(const struct MDeformVert *dv, const int defgroup)
void BKE_defvert_remove_group(struct MDeformVert *dvert, struct MDeformWeight *dw)
Definition: deform.c:754
void BKE_defvert_copy(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src)
void BKE_defvert_clear(struct MDeformVert *dvert)
Definition: deform.c:785
MINLINE float clamp_f(float value, float min, float max)
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
Definition: math_color.c:414
void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
Definition: math_color.c:427
MINLINE void copy_v2_v2(float r[2], const float a[2])
unsigned char uchar
Definition: BLI_sys_types.h:86
#define UNUSED(x)
#define POINTER_AS_INT(i)
#define UNLIKELY(x)
#define LIKELY(x)
@ MLOOPUV_PINNED
@ MLOOPUV_VERTSEL
@ MVERT_SKIN_LOOSE
@ MVERT_SKIN_ROOT
Object is a sort of wrapper for general info.
static PySequenceMethods bpy_bmdeformvert_as_sequence
static PyObject * bpy_bmvertskin_radius_get(BPy_BMVertSkin *self, void *UNUSED(closure))
static int bpy_bmloopuv_uv_set(BPy_BMLoopUV *self, PyObject *value, void *UNUSED(closure))
int BPy_BMLoopColor_AssignPyObject(struct MLoopCol *mloopcol, PyObject *value)
static void bm_init_types_bmdvert(void)
static void bm_init_types_bmloopuv(void)
static int mathutils_bmloopcol_get(BaseMathObject *bmo, int UNUSED(subtype))
PyObject * BPy_BMLoopColor_CreatePyObject(struct MLoopCol *mloopcol)
struct BPy_BMDeformVert BPy_BMDeformVert
static int bpy_bmvertskin_flag_set(BPy_BMVertSkin *self, PyObject *value, void *flag_p)
static void bm_init_types_bmloopcol(void)
int BPy_BMDeformVert_AssignPyObject(struct MDeformVert *dvert, PyObject *value)
static int bpy_bmdeformvert_len(BPy_BMDeformVert *self)
static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[4])
int BPy_BMVertSkin_AssignPyObject(struct MVertSkin *mvertskin, PyObject *value)
static int mathutils_bmloopcol_check(BaseMathObject *UNUSED(bmo))
static PyObject * bpy_bmdeformvert_values(BPy_BMDeformVert *self)
#define MLOOPCOL_FROM_CAPSULE(color_capsule)
void BPy_BM_init_types_meshdata(void)
struct BPy_BMLoopUV BPy_BMLoopUV
static int bpy_bmvertskin_radius_set(BPy_BMVertSkin *self, PyObject *value, void *UNUSED(closure))
static PyObject * bpy_bmloopuv_flag_get(BPy_BMLoopUV *self, void *flag_p)
PyObject * BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert)
static int mathutils_bmloopcol_set_index(BaseMathObject *bmo, int subtype, int index)
static Mathutils_Callback mathutils_bmloopcol_cb
static PyObject * bpy_bmloopuv_uv_get(BPy_BMLoopUV *self, void *UNUSED(closure))
static PyGetSetDef bpy_bmloopuv_getseters[]
struct BPy_BMVertSkin BPy_BMVertSkin
static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag_p)
static PyObject * bpy_bmdeformvert_clear(BPy_BMDeformVert *self)
int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *mloopuv, PyObject *value)
static PyObject * bpy_bmdeformvert_subscript(BPy_BMDeformVert *self, PyObject *key)
static int bpy_bmdeformvert_contains(BPy_BMDeformVert *self, PyObject *value)
static int bpy_bmdeformvert_ass_subscript(BPy_BMDeformVert *self, PyObject *key, PyObject *value)
PyTypeObject BPy_BMDeformVert_Type
static void bm_init_types_bmvertskin(void)
static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int UNUSED(index))
PyObject * BPy_BMLoopUV_CreatePyObject(struct MLoopUV *mloopuv)
static PyGetSetDef bpy_bmvertskin_getseters[]
#define BPy_BMVertSkin_Check(v)
static PyObject * bpy_bmdeformvert_items(BPy_BMDeformVert *self)
static void mloopcol_from_float(MLoopCol *mloopcol, const float col[4])
#define BPy_BMDeformVert_Check(v)
static uchar mathutils_bmloopcol_cb_index
static int mathutils_bmloopcol_set(BaseMathObject *bmo, int UNUSED(subtype))
static PyObject * bpy_bmvertskin_flag_get(BPy_BMVertSkin *self, void *flag_p)
PyTypeObject BPy_BMLoopUV_Type
static PyObject * bpy_bmdeformvert_keys(BPy_BMDeformVert *self)
#define BPy_BMLoopUV_Check(v)
static struct PyMethodDef bpy_bmdeformvert_methods[]
static PyObject * bpy_bmdeformvert_get(BPy_BMDeformVert *self, PyObject *args)
static PyMappingMethods bpy_bmdeformvert_as_mapping
PyObject * BPy_BMVertSkin_CreatePyObject(struct MVertSkin *mvertskin)
PyDoc_STRVAR(bpy_bmloopuv_uv_doc, "Loops UV (as a 2D Vector).\n\n:type: :class:`mathutils.Vector`")
static PyTypeObject BPy_BMVertSkin_Type
PyObject * self
Definition: bpy_driver.c:185
uint col
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 * Vector_CreatePyObject_cb(PyObject *cb_user, int size, uchar cb_type, uchar cb_subtype)
PyObject * Vector_CreatePyObject_wrap(float *vec, const int size, PyTypeObject *base_type)
int PyC_Long_AsBool(PyObject *value)
#define PyTuple_SET_ITEMS(op_arg,...)
return ret
PyObject_VAR_HEAD MDeformVert * data
PyObject_VAR_HEAD MLoopUV * data
PyObject_VAR_HEAD MVertSkin * data
unsigned int def_nr
unsigned char r