44#define BPy_BMLoopUV_Check(v) (Py_TYPE(v) == &BPy_BMLoopUV_Type)
64 "Loops UV (as a 2D Vector).\n"
66 ":type: :class:`mathutils.Vector`");
85 bpy_bmloopuv_pin_uv_doc,
91 bpy_bmloopuv_select_doc,
97 bpy_bmloopuv_select_edge_doc,
98 "UV edge select state.\n"
105 return self->pin ? PyBool_FromLong(*
self->pin) :
nullptr;
120 PyErr_SetString(PyExc_RuntimeError,
121 "active uv layer has no associated pin layer. This is a bug!");
130 return self->vert_select ? PyBool_FromLong(*
self->vert_select) :
nullptr;
136 if (
self->vert_select) {
140 PyErr_SetString(PyExc_RuntimeError,
141 "active uv layer has no associated vertex selection layer. This is a bug!");
150 return self->edge_select ? PyBool_FromLong(*
self->edge_select) :
nullptr;
156 if (
self->edge_select) {
160 PyErr_SetString(PyExc_RuntimeError,
161 "active uv layer has no associated edge selection layer. This is a bug!");
173 bpy_bmloopuv_pin_uv_doc,
178 bpy_bmloopuv_select_doc,
183 bpy_bmloopuv_select_edge_doc,
186 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
209 PyErr_Format(PyExc_TypeError,
"expected BMLoopUV, not a %.200s", Py_TYPE(value)->tp_name);
245 return (PyObject *)
self;
253#define BPy_BMVertSkin_Check(v) (Py_TYPE(v) == &BPy_BMVertSkin_Type)
262 bpy_bmvertskin_radius_doc,
263 "Vert skin radii (as a 2D Vector).\n"
265 ":type: :class:`mathutils.Vector`");
284 bpy_bmvertskin_flag__use_root_doc,
285 "Use as root vertex. Setting this flag does not clear other roots in the same mesh island.\n"
290 bpy_bmvertskin_flag__use_loose_doc,
291 "Use loose vertex.\n"
298 return PyBool_FromLong(
self->data->flag &
flag);
310 self->data->flag &= ~flag;
323 bpy_bmvertskin_radius_doc,
328 bpy_bmvertskin_flag__use_root_doc,
333 bpy_bmvertskin_flag__use_loose_doc,
336 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
359 PyErr_Format(PyExc_TypeError,
"expected BMVertSkin, not a %.200s", Py_TYPE(value)->tp_name);
370 self->data = mvertskin;
371 return (PyObject *)
self;
383#define MLOOPCOL_FROM_CAPSULE(color_capsule) \
384 ((MLoopCol *)PyCapsule_GetPointer(color_capsule, nullptr))
429 const float f = bmo->data[index];
436 bmo->data[index] = f;
467 PyObject *color_capsule;
468 color_capsule = PyCapsule_New(mloopcol,
nullptr,
nullptr);
472#undef MLOOPCOL_FROM_CAPSULE
503#define BPy_BMDeformVert_Check(v) (Py_TYPE(v) == &BPy_BMDeformVert_Type)
520 if (PyIndex_Check(key)) {
522 i = PyNumber_AsSsize_t(key, PyExc_IndexError);
523 if (i == -1 && PyErr_Occurred()) {
530 PyErr_SetString(PyExc_KeyError,
531 "BMDeformVert[key] = x: "
536 return PyFloat_FromDouble(dw->
weight);
540 PyExc_TypeError,
"BMDeformVert keys must be integers, not %.200s", Py_TYPE(key)->tp_name);
546 if (PyIndex_Check(key)) {
549 i = PyNumber_AsSsize_t(key, PyExc_IndexError);
550 if (i == -1 && PyErr_Occurred()) {
557 PyErr_SetString(PyExc_KeyError,
558 "BMDeformVert[key] = x: "
559 "weight keys can't be negative");
564 const float f = PyFloat_AsDouble(value);
565 if (f == -1 && PyErr_Occurred()) {
566 PyErr_SetString(PyExc_TypeError,
567 "BMDeformVert[key] = x: "
568 "assigned value not a number");
579 PyErr_SetString(PyExc_KeyError,
580 "del BMDeformVert[key]: "
590 PyExc_TypeError,
"BMDeformVert keys must be integers, not %.200s", Py_TYPE(key)->tp_name);
596 const int key = PyLong_AsSsize_t(value);
598 if (key == -1 && PyErr_Occurred()) {
599 PyErr_SetString(PyExc_TypeError,
"BMDeformVert.__contains__: expected an int");
633 bpy_bmdeformvert_keys_doc,
634 ".. method:: keys()\n"
636 " Return the group indices used by this vertex\n"
637 " (matching Python's dict.keys() functionality).\n"
639 " :return: the deform group this vertex uses\n"
640 " :rtype: list[int]\n");
647 ret = PyList_New(
self->data->totweight);
648 for (i = 0; i <
self->data->totweight; i++, dw++) {
649 PyList_SET_ITEM(
ret, i, PyLong_FromLong(dw->
def_nr));
657 bpy_bmdeformvert_values_doc,
658 ".. method:: values()\n"
660 " Return the weights of the deform vertex\n"
661 " (matching Python's dict.values() functionality).\n"
663 " :return: The weights that influence this vertex\n"
664 " :rtype: list[float]\n");
671 ret = PyList_New(
self->data->totweight);
672 for (i = 0; i <
self->data->totweight; i++, dw++) {
673 PyList_SET_ITEM(
ret, i, PyFloat_FromDouble(dw->
weight));
681 bpy_bmdeformvert_items_doc,
682 ".. method:: items()\n"
684 " Return (group, weight) pairs for this vertex\n"
685 " (matching Python's dict.items() functionality).\n"
687 " :return: (key, value) pairs for each deform weight of this vertex.\n"
688 " :rtype: list[tuple[int, float]]\n");
696 ret = PyList_New(
self->data->totweight);
697 for (i = 0; i <
self->data->totweight; i++, dw++) {
698 item = PyTuple_New(2);
700 PyList_SET_ITEM(
ret, i, item);
708 bpy_bmdeformvert_get_doc,
709 ".. method:: get(key, default=None)\n"
711 " Returns the deform weight matching the key or default\n"
712 " when not found (matches Python's dictionary function of the same name).\n"
714 " :arg key: The key associated with deform weight.\n"
716 " :arg default: Optional argument for the value to return if\n"
717 " *key* is not found.\n"
718 " :type default: Any\n");
722 PyObject *def = Py_None;
724 if (!PyArg_ParseTuple(args,
"i|O:get", &key, &def)) {
731 return PyFloat_FromDouble(dw->
weight);
734 return Py_NewRef(def);
739 bpy_bmdeformvert_clear_doc,
740 ".. method:: clear()\n"
742 " Clears all weights.\n");
750#if (defined(__GNUC__) && !defined(__clang__))
751# pragma GCC diagnostic push
752# pragma GCC diagnostic ignored "-Wcast-function-type"
762 {
nullptr,
nullptr, 0,
nullptr},
765#if (defined(__GNUC__) && !defined(__clang__))
766# pragma GCC diagnostic pop
792 PyErr_Format(PyExc_TypeError,
"expected BMDeformVert, not a %.200s", Py_TYPE(value)->tp_name);
797 if (
LIKELY(dvert != dvert_src)) {
807 return (PyObject *)
self;
CustomData interface, see also DNA_customdata_types.h.
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])
void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
MINLINE void copy_v2_v2(float r[2], const float a[2])
#define POINTER_AS_INT(i)
#define BM_ELEM_CD_GET_FLOAT_P(ele, offset)
#define BM_ELEM_CD_SET_BOOL(ele, offset, f)
#define BM_ELEM_CD_GET_BOOL_P(ele, offset)
ATTR_WARN_UNUSED_RESULT BMesh * bm
static PyObject * bpy_bmdeformvert_items(BPy_BMDeformVert *self)
static int bpy_bmloopuv_uv_set(BPy_BMLoopUV *self, PyObject *value, void *)
static PySequenceMethods bpy_bmdeformvert_as_sequence
static int mathutils_bmloopcol_set(BaseMathObject *bmo, int)
int BPy_BMVertSkin_AssignPyObject(MVertSkin *mvertskin, PyObject *value)
static PyObject * bpy_bmdeformvert_clear(BPy_BMDeformVert *self)
static void bm_init_types_bmloopuv()
static PyObject * bpy_bmloopuv_pin_uv_get(BPy_BMLoopUV *self, void *)
static int bpy_bmvertskin_flag_set(BPy_BMVertSkin *self, PyObject *value, void *flag_p)
static PyObject * bpy_bmdeformvert_subscript(BPy_BMDeformVert *self, PyObject *key)
static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[4])
static PyObject * bpy_bmvertskin_flag_get(BPy_BMVertSkin *self, void *flag_p)
static PyObject * bpy_bmloopuv_select_edge_get(BPy_BMLoopUV *self, void *)
static PyMethodDef bpy_bmdeformvert_methods[]
static PyObject * bpy_bmloopuv_select_get(BPy_BMLoopUV *self, void *)
PyObject * BPy_BMDeformVert_CreatePyObject(MDeformVert *dvert)
static int bpy_bmloopuv_pin_uv_set(BPy_BMLoopUV *self, PyObject *value, void *)
static PyObject * bpy_bmdeformvert_keys(BPy_BMDeformVert *self)
#define MLOOPCOL_FROM_CAPSULE(color_capsule)
static PyObject * bpy_bmdeformvert_get(BPy_BMDeformVert *self, PyObject *args)
int BPy_BMDeformVert_AssignPyObject(MDeformVert *dvert, PyObject *value)
static void bm_init_types_bmdvert()
void BPy_BM_init_types_meshdata()
PyObject * BPy_BMLoopColor_CreatePyObject(MLoopCol *mloopcol)
static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int)
static int mathutils_bmloopcol_set_index(BaseMathObject *bmo, int subtype, int index)
static Mathutils_Callback mathutils_bmloopcol_cb
static int bpy_bmloopuv_select_set(BPy_BMLoopUV *self, PyObject *value, void *)
static PyObject * bpy_bmvertskin_radius_get(BPy_BMVertSkin *self, void *)
static PyGetSetDef bpy_bmloopuv_getseters[]
static void bm_init_types_bmvertskin()
static int mathutils_bmloopcol_get(BaseMathObject *bmo, int)
PyObject * BPy_BMLoopUV_CreatePyObject(BMesh *bm, BMLoop *loop, int layer)
static PyObject * bpy_bmloopuv_uv_get(BPy_BMLoopUV *self, void *)
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
PyDoc_STRVAR(bpy_bmloopuv_uv_doc, "Loops UV (as a 2D Vector).\n" "\n" ":type: :class:`mathutils.Vector`")
static PyGetSetDef bpy_bmvertskin_getseters[]
static PyObject * bpy_bmdeformvert_values(BPy_BMDeformVert *self)
#define BPy_BMVertSkin_Check(v)
static int bpy_bmvertskin_radius_set(BPy_BMVertSkin *self, PyObject *value, void *)
static void mloopcol_from_float(MLoopCol *mloopcol, const float col[4])
#define BPy_BMDeformVert_Check(v)
int BPy_BMLoopColor_AssignPyObject(MLoopCol *mloopcol, PyObject *value)
static uchar mathutils_bmloopcol_cb_index
static void bm_init_types_bmloopcol()
int BPy_BMLoopUV_AssignPyObject(BMesh *bm, BMLoop *loop, PyObject *value)
static int bpy_bmloopuv_select_edge_set(BPy_BMLoopUV *self, PyObject *value, void *)
static Py_ssize_t bpy_bmdeformvert_len(BPy_BMDeformVert *self)
PyTypeObject BPy_BMLoopUV_Type
static int mathutils_bmloopcol_check(BaseMathObject *)
PyObject * BPy_BMVertSkin_CreatePyObject(MVertSkin *mvertskin)
#define BPy_BMLoopUV_Check(v)
static PyMappingMethods bpy_bmdeformvert_as_mapping
static PyTypeObject BPy_BMVertSkin_Type
BMUVOffsets BM_uv_map_get_offsets_from_layer(const BMesh *bm, const int layer)
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm)
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int vec_num, uchar cb_type, uchar cb_subtype)
PyObject * Vector_CreatePyObject_wrap(float *vec, const int vec_num, PyTypeObject *base_type)
int PyC_Long_AsBool(PyObject *value)
#define PyTuple_SET_ITEMS(op_arg,...)
PyObject_VAR_HEAD float * uv
PyObject_VAR_HEAD MVertSkin * data