47#define BPy_BMLoopUV_Check(v) (Py_TYPE(v) == &BPy_BMLoopUV_Type)
68 "Loop UV (as a 2D Vector).\n"
70 ":type: :class:`mathutils.Vector`\n");
89 if (self->
pin ==
nullptr) {
90 PyErr_SetString(PyExc_RuntimeError,
91 "active uv layer has no associated pin layer. This is a bug!");
99 bpy_bmloopuv_pin_uv_doc,
110 return PyBool_FromLong(*self->
pin);
138 bpy_bmloopuv_pin_uv_doc,
140 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
163 PyErr_Format(PyExc_TypeError,
"expected BMLoopUV, not a %.200s", Py_TYPE(value)->tp_name);
187 return reinterpret_cast<PyObject *
>(self);
201#define BPy_BMVertSkin_Check(v) (Py_TYPE(v) == &BPy_BMVertSkin_Type)
214 bpy_bmvertskin_radius_doc,
215 "Vert skin radii (as a 2D Vector).\n"
217 ":type: :class:`mathutils.Vector`\n");
236 if (flag ==
nullptr) {
237 PyErr_SetString(PyExc_RuntimeError,
"skin layer has no associated root/loose layer.");
245 bpy_bmvertskin_flag__use_root_doc,
246 "Use as root vertex. Setting this flag does not clear other roots in the same mesh island.\n"
254 return PyBool_FromLong(*self->
root);
263 if (tmp_val == -1) [[unlikely]] {
266 *self->
root = tmp_val;
272 bpy_bmvertskin_flag__use_loose_doc,
273 "Use loose vertex.\n"
281 return PyBool_FromLong(*self->
loose);
290 if (tmp_val == -1) [[unlikely]] {
293 *self->
loose = tmp_val;
302 bpy_bmvertskin_radius_doc,
307 bpy_bmvertskin_flag__use_root_doc,
312 bpy_bmvertskin_flag__use_loose_doc,
315 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
338 PyErr_Format(PyExc_TypeError,
"expected BMVertSkin, not a %.200s", Py_TYPE(value)->tp_name);
351 if (cd_root_offset != -1) {
358 if (cd_loose_offset != -1) {
378 self->
root = cd_root_offset != -1 ?
381 self->
loose = cd_loose_offset != -1 ?
385 return reinterpret_cast<PyObject *
>(self);
397#define MLOOPCOL_FROM_CAPSULE(color_capsule) \
398 ((MLoopCol *)PyCapsule_GetPointer(color_capsule, nullptr))
443 const float f = bmo->data[
index];
450 bmo->data[
index] = f;
481 PyObject *color_capsule = PyCapsule_New(mloopcol,
nullptr,
nullptr);
483 Py_DECREF(color_capsule);
487#undef MLOOPCOL_FROM_CAPSULE
518#define BPy_BMDeformVert_Check(v) (Py_TYPE(v) == &BPy_BMDeformVert_Type)
535 if (PyIndex_Check(key)) {
537 i = PyNumber_AsSsize_t(key, PyExc_IndexError);
538 if (i == -1 && PyErr_Occurred()) {
545 PyErr_SetString(PyExc_KeyError,
546 "BMDeformVert[key] = x: "
551 return PyFloat_FromDouble(dw->
weight);
555 PyExc_TypeError,
"BMDeformVert keys must be integers, not %.200s", Py_TYPE(key)->tp_name);
561 if (PyIndex_Check(key)) {
564 i = PyNumber_AsSsize_t(key, PyExc_IndexError);
565 if (i == -1 && PyErr_Occurred()) {
572 PyErr_SetString(PyExc_KeyError,
573 "BMDeformVert[key] = x: "
574 "weight keys cannot be negative");
578 const float f = PyFloat_AsDouble(value);
579 if (f == -1 && PyErr_Occurred()) {
580 PyErr_SetString(PyExc_TypeError,
581 "BMDeformVert[key] = x: "
582 "assigned value not a number");
594 PyErr_SetString(PyExc_KeyError,
595 "del BMDeformVert[key]: "
606 PyExc_TypeError,
"BMDeformVert keys must be integers, not %.200s", Py_TYPE(key)->tp_name);
612 const int key = PyLong_AsSsize_t(value);
614 if (key == -1 && PyErr_Occurred()) {
615 PyErr_SetString(PyExc_TypeError,
"BMDeformVert.__contains__: expected an int");
649 bpy_bmdeformvert_keys_doc,
650 ".. method:: keys()\n"
652 " Return the group indices used by this vertex\n"
653 " (matching Python's dict.keys() functionality).\n"
655 " :return: The deform group indices this vertex uses.\n"
656 " :rtype: list[int]\n");
665 PyList_SET_ITEM(
ret, i, PyLong_FromLong(dw->
def_nr));
673 bpy_bmdeformvert_values_doc,
674 ".. method:: values()\n"
676 " Return the weights of the deform vertex\n"
677 " (matching Python's dict.values() functionality).\n"
679 " :return: The weights that influence this vertex\n"
680 " :rtype: list[float]\n");
689 PyList_SET_ITEM(
ret, i, PyFloat_FromDouble(dw->
weight));
697 bpy_bmdeformvert_items_doc,
698 ".. method:: items()\n"
700 " Return (group, weight) pairs for this vertex\n"
701 " (matching Python's dict.items() functionality).\n"
703 " :return: (key, value) pairs for each deform weight of this vertex.\n"
704 " :rtype: list[tuple[int, float]]\n");
714 item = PyTuple_New(2);
716 PyList_SET_ITEM(
ret, i, item);
724 bpy_bmdeformvert_get_doc,
725 ".. method:: get(key, default=None)\n"
727 " Returns the deform weight matching the key or default\n"
728 " when not found (matches Python's dictionary function of the same name).\n"
730 " :param key: The vertex group index.\n"
732 " :param default: Optional argument for the value to return if\n"
733 " *key* is not found.\n"
734 " :type default: Any\n"
735 " :return: The deform weight or the default when not found.\n"
736 " :rtype: float | Any\n");
740 PyObject *def = Py_None;
742 if (!PyArg_ParseTuple(args,
756 return PyFloat_FromDouble(dw->
weight);
759 return Py_NewRef(def);
764 bpy_bmdeformvert_clear_doc,
765 ".. method:: clear()\n"
767 " Clears all weights.\n");
777# pragma clang diagnostic push
778# pragma clang diagnostic ignored "-Wcast-function-type"
780# pragma GCC diagnostic push
781# pragma GCC diagnostic ignored "-Wcast-function-type"
789 bpy_bmdeformvert_keys_doc},
793 bpy_bmdeformvert_values_doc},
797 bpy_bmdeformvert_items_doc},
801 bpy_bmdeformvert_get_doc},
806 bpy_bmdeformvert_clear_doc},
807 {
nullptr,
nullptr, 0,
nullptr},
812# pragma clang diagnostic pop
814# pragma GCC diagnostic pop
841 PyErr_Format(PyExc_TypeError,
"expected BMDeformVert, not a %.200s", Py_TYPE(value)->tp_name);
846 if (dvert != dvert_src) [[likely]] {
856 return reinterpret_cast<PyObject *
>(self);
CustomData interface, see also DNA_customdata_types.h.
#define BM_ELEM_CD_GET_FLOAT_P(ele, offset)
#define BM_ELEM_CD_SET_BOOL(ele, offset, f)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_ELEM_CD_GET_BOOL_P(ele, offset)
#define MLOOPCOL_FROM_CAPSULE(color_capsule)
#define BPy_BMVertSkin_Check(v)
#define BPy_BMDeformVert_Check(v)
#define BPy_BMLoopUV_Check(v)
PyTypeObject BPy_BMLoopUV_Type
static PyMethodDef bpy_bmdeformvert_methods[]
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static PyObject * bpy_bmdeformvert_items(BPy_BMDeformVert *self)
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
static PyObject * bpy_bmdeformvert_clear(BPy_BMDeformVert *self)
static int mathutils_bmloopcol_set_index(BaseMathObject *bmo, int subtype, int index)
static Py_ssize_t bpy_bmdeformvert_len(BPy_BMDeformVert *self)
static int bpy_bmvertskin_use_loose_set(BPy_BMVertSkin *self, PyObject *value, void *)
PyObject * BPy_BMDeformVert_CreatePyObject(MDeformVert *dvert)
MINLINE void copy_v2_v2(float r[2], const float a[2])
static void bm_init_types_bmdvert()
static int mathutils_bmloopcol_set(BaseMathObject *bmo, int)
static PyObject * bpy_bmdeformvert_keys(BPy_BMDeformVert *self)
PyObject * Vector_CreatePyObject_wrap(float *vec, const int vec_num, PyTypeObject *base_type)
PyDoc_STRVAR(bpy_bm_new_doc, ".. function:: new(*, use_operators=True)\n" "\n" " :param use_operators: Support calling operators in :mod:`bmesh.ops` (uses some " "extra memory per vert/edge/face).\n" " :type use_operators: bool\n" " :return: Return a new, empty BMesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n")
static void bm_init_types_bmvertskin()
static bool bpy_bmloopuv_pin_uv_ok_or_error(const BPy_BMLoopUV *self)
PyObject * BPy_BMLoopColor_CreatePyObject(MLoopCol *mloopcol)
void BKE_defvert_clear(MDeformVert *dvert)
PyObject * BPy_BMVertSkin_CreatePyObject(BMesh *bm, BMVert *vert)
static bool bpy_bmvertskin_flag_ok_or_error(const bool *flag)
static int bpy_bmdeformvert_contains(BPy_BMDeformVert *self, PyObject *value)
static PyObject * bpy_bmloopuv_uv_get(BPy_BMLoopUV *self, void *)
VecBase< float, 2 > float2
static void bm_init_types_bmloopcol()
static PyMappingMethods bpy_bmdeformvert_as_mapping
static PyObject * bpy_bmvertskin_use_loose_get(BPy_BMVertSkin *self, void *)
BMesh const char void * data
int BPy_BMLoopUV_AssignPyObject(BMesh *bm, BMLoop *loop, PyObject *value)
static PyObject * bpy_bmdeformvert_values(BPy_BMDeformVert *self)
static uchar mathutils_bmloopcol_cb_index
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, StringRef name)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int vec_num, uchar cb_type, uchar cb_subtype)
static int bpy_bmloopuv_pin_uv_set(BPy_BMLoopUV *self, PyObject *value, void *)
static void mloopcol_from_float(MLoopCol *mloopcol, const float col[4])
static PyGetSetDef bpy_bmvertskin_getseters[]
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
MDeformWeight * BKE_defvert_ensure_index(MDeformVert *dv, int defgroup)
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
static PyObject * bpy_bmvertskin_use_root_get(BPy_BMVertSkin *self, void *)
PyTypeObject BPy_BMVertSkin_Type
static Mathutils_Callback mathutils_bmloopcol_cb
static void bm_init_types_bmloopuv()
static int bpy_bmvertskin_use_root_set(BPy_BMVertSkin *self, PyObject *value, void *)
static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[4])
BMUVOffsets BM_uv_map_offsets_from_layer(const BMesh *bm, const int layer)
static int bpy_bmvertskin_radius_set(BPy_BMVertSkin *self, PyObject *value, void *)
int PyC_Long_AsBool(PyObject *value)
static PyObject * bpy_bmvertskin_radius_get(BPy_BMVertSkin *self, void *)
static int mathutils_bmloopcol_check(BaseMathObject *)
int BPy_BMLoopColor_AssignPyObject(MLoopCol *mloopcol, PyObject *value)
static int bpy_bmdeformvert_ass_subscript(BPy_BMDeformVert *self, PyObject *key, PyObject *value)
static PyGetSetDef bpy_bmloopuv_getseters[]
static PySequenceMethods bpy_bmdeformvert_as_sequence
void BKE_defvert_copy(MDeformVert *dvert_dst, const MDeformVert *dvert_src)
PyTypeObject BPy_BMDeformVert_Type
PyObject * BPy_BMLoopUV_CreatePyObject(BMesh *bm, BMLoop *loop, int layer)
static int bpy_bmloopuv_uv_set(BPy_BMLoopUV *self, PyObject *value, void *)
int BPy_BMDeformVert_AssignPyObject(MDeformVert *dvert, PyObject *value)
static PyObject * bpy_bmdeformvert_subscript(BPy_BMDeformVert *self, PyObject *key)
static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int)
static PyObject * bpy_bmdeformvert_get(BPy_BMDeformVert *self, PyObject *args)
static PyObject * bpy_bmloopuv_pin_uv_get(BPy_BMLoopUV *self, void *)
BMUVOffsets BM_uv_map_offsets_get(const BMesh *bm)
int BPy_BMVertSkin_AssignPyObject(BMesh *bm, BMVert *vert, PyObject *value)
void BKE_defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
void BPy_BM_init_types_meshdata()
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
MDeformWeight * BKE_defvert_find_index(const MDeformVert *dv, int defgroup)
static int mathutils_bmloopcol_get(BaseMathObject *bmo, int)
MINLINE float clamp_f(float value, float min, float max)
#define PyTuple_SET_ITEMS(op_arg,...)
PyObject_HEAD float2 * radius