Blender V5.3
bmesh_py_types_meshdata.cc File Reference

Go to the source code of this file.

Classes

struct  blender::BPy_BMLoopUV
struct  blender::BPy_BMVertSkin
struct  blender::BPy_BMDeformVert

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define BPy_BMLoopUV_Check(v)
#define BPy_BMVertSkin_Check(v)
#define MLOOPCOL_FROM_CAPSULE(color_capsule)
#define BPy_BMDeformVert_Check(v)

Functions

 blender::PyDoc_STRVAR (bpy_bmloopuv_uv_doc, "Loop UV (as a 2D Vector).\n" "\n" ":type: :class:`mathutils.Vector`\n")
static PyObject * blender::bpy_bmloopuv_uv_get (BPy_BMLoopUV *self, void *)
static int blender::bpy_bmloopuv_uv_set (BPy_BMLoopUV *self, PyObject *value, void *)
static bool blender::bpy_bmloopuv_pin_uv_ok_or_error (const BPy_BMLoopUV *self)
 blender::PyDoc_STRVAR (bpy_bmloopuv_pin_uv_doc, "UV pin state.\n" "\n" ":type: bool\n")
static PyObject * blender::bpy_bmloopuv_pin_uv_get (BPy_BMLoopUV *self, void *)
static int blender::bpy_bmloopuv_pin_uv_set (BPy_BMLoopUV *self, PyObject *value, void *)
static void blender::bm_init_types_bmloopuv ()
int blender::BPy_BMLoopUV_AssignPyObject (BMesh *bm, BMLoop *loop, PyObject *value)
PyObject * blender::BPy_BMLoopUV_CreatePyObject (BMesh *bm, BMLoop *loop, int layer)
 blender::PyDoc_STRVAR (bpy_bmvertskin_radius_doc, "Vert skin radii (as a 2D Vector).\n" "\n" ":type: :class:`mathutils.Vector`\n")
static PyObject * blender::bpy_bmvertskin_radius_get (BPy_BMVertSkin *self, void *)
static int blender::bpy_bmvertskin_radius_set (BPy_BMVertSkin *self, PyObject *value, void *)
static bool blender::bpy_bmvertskin_flag_ok_or_error (const bool *flag)
 blender::PyDoc_STRVAR (bpy_bmvertskin_flag__use_root_doc, "Use as root vertex. Setting this flag does not clear other roots in the same mesh island.\n" "\n" ":type: bool\n")
static PyObject * blender::bpy_bmvertskin_use_root_get (BPy_BMVertSkin *self, void *)
static int blender::bpy_bmvertskin_use_root_set (BPy_BMVertSkin *self, PyObject *value, void *)
 blender::PyDoc_STRVAR (bpy_bmvertskin_flag__use_loose_doc, "Use loose vertex.\n" "\n" ":type: bool\n")
static PyObject * blender::bpy_bmvertskin_use_loose_get (BPy_BMVertSkin *self, void *)
static int blender::bpy_bmvertskin_use_loose_set (BPy_BMVertSkin *self, PyObject *value, void *)
static void blender::bm_init_types_bmvertskin ()
int blender::BPy_BMVertSkin_AssignPyObject (BMesh *bm, BMVert *vert, PyObject *value)
PyObject * blender::BPy_BMVertSkin_CreatePyObject (BMesh *bm, BMVert *vert)
static void blender::mloopcol_to_float (const MLoopCol *mloopcol, float r_col[4])
static void blender::mloopcol_from_float (MLoopCol *mloopcol, const float col[4])
static int blender::mathutils_bmloopcol_check (BaseMathObject *)
static int blender::mathutils_bmloopcol_get (BaseMathObject *bmo, int)
static int blender::mathutils_bmloopcol_set (BaseMathObject *bmo, int)
static int blender::mathutils_bmloopcol_get_index (BaseMathObject *bmo, int subtype, int)
static int blender::mathutils_bmloopcol_set_index (BaseMathObject *bmo, int subtype, int index)
static void blender::bm_init_types_bmloopcol ()
int blender::BPy_BMLoopColor_AssignPyObject (MLoopCol *mloopcol, PyObject *value)
PyObject * blender::BPy_BMLoopColor_CreatePyObject (MLoopCol *mloopcol)
static Py_ssize_t blender::bpy_bmdeformvert_len (BPy_BMDeformVert *self)
static PyObject * blender::bpy_bmdeformvert_subscript (BPy_BMDeformVert *self, PyObject *key)
static int blender::bpy_bmdeformvert_ass_subscript (BPy_BMDeformVert *self, PyObject *key, PyObject *value)
static int blender::bpy_bmdeformvert_contains (BPy_BMDeformVert *self, PyObject *value)
 blender::PyDoc_STRVAR (bpy_bmdeformvert_keys_doc, ".. method:: keys()\n" "\n" " Return the group indices used by this vertex\n" " (matching Python's dict.keys() functionality).\n" "\n" " :return: The deform group indices this vertex uses.\n" " :rtype: list[int]\n")
static PyObject * blender::bpy_bmdeformvert_keys (BPy_BMDeformVert *self)
 blender::PyDoc_STRVAR (bpy_bmdeformvert_values_doc, ".. method:: values()\n" "\n" " Return the weights of the deform vertex\n" " (matching Python's dict.values() functionality).\n" "\n" " :return: The weights that influence this vertex\n" " :rtype: list[float]\n")
static PyObject * blender::bpy_bmdeformvert_values (BPy_BMDeformVert *self)
 blender::PyDoc_STRVAR (bpy_bmdeformvert_items_doc, ".. method:: items()\n" "\n" " Return (group, weight) pairs for this vertex\n" " (matching Python's dict.items() functionality).\n" "\n" " :return: (key, value) pairs for each deform weight of this vertex.\n" " :rtype: list[tuple[int, float]]\n")
static PyObject * blender::bpy_bmdeformvert_items (BPy_BMDeformVert *self)
 blender::PyDoc_STRVAR (bpy_bmdeformvert_get_doc, ".. method:: get(key, default=None)\n" "\n" " Returns the deform weight matching the key or default\n" " when not found (matches Python's dictionary function of the same name).\n" "\n" " :param key: The vertex group index.\n" " :type key: int\n" " :param default: Optional argument for the value to return if\n" " *key* is not found.\n" " :type default: Any\n" " :return: The deform weight or the default when not found.\n" " :rtype: float | Any\n")
static PyObject * blender::bpy_bmdeformvert_get (BPy_BMDeformVert *self, PyObject *args)
 blender::PyDoc_STRVAR (bpy_bmdeformvert_clear_doc, ".. method:: clear()\n" "\n" " Clears all weights.\n")
static PyObject * blender::bpy_bmdeformvert_clear (BPy_BMDeformVert *self)
static void blender::bm_init_types_bmdvert ()
int blender::BPy_BMDeformVert_AssignPyObject (MDeformVert *dvert, PyObject *value)
PyObject * blender::BPy_BMDeformVert_CreatePyObject (MDeformVert *dvert)
void blender::BPy_BM_init_types_meshdata ()

Variables

static PyGetSetDef blender::bpy_bmloopuv_getseters []
PyTypeObject blender::BPy_BMLoopUV_Type
static PyGetSetDef blender::bpy_bmvertskin_getseters []
PyTypeObject blender::BPy_BMVertSkin_Type
static uchar blender::mathutils_bmloopcol_cb_index = -1
static Mathutils_Callback blender::mathutils_bmloopcol_cb
static PySequenceMethods blender::bpy_bmdeformvert_as_sequence
static PyMappingMethods blender::bpy_bmdeformvert_as_mapping
static PyMethodDef blender::bpy_bmdeformvert_methods []
PyTypeObject blender::BPy_BMDeformVert_Type

Detailed Description

This file defines custom-data types which can't be accessed as primitive Python types such as #MDeformVert. It also exposed UV map data in a way compatible with the (deprecated) #MLoopUV type. MLoopUV used to be a struct containing both the UV information and various selection flags. This has since been split up into a float2 attribute and three boolean attributes for the selection/pin states. For backwards compatibility, the original #MLoopUV is emulated in the python API. This comes at a performance penalty however, and the plan is to provide direct access to the boolean layers for faster access. Eventually (probably in 4.0) #BPy_BMLoopUV should be removed on the Python side as well.

Definition in file bmesh_py_types_meshdata.cc.

Macro Definition Documentation

◆ BPy_BMDeformVert_Check

#define BPy_BMDeformVert_Check ( v)
Value:
(Py_TYPE(v) == &BPy_BMDeformVert_Type)

This is python type wraps a deform vert as a python dictionary, hiding the #MDeformWeight on access, since the mapping is very close, eg:

weight = BKE_defvert_find_weight(dv, group_nr);
BKE_defvert_remove_group(dv, dw)
weight = dv[group_nr]
del dv[group_nr]
Note
There is nothing BMesh specific here, its only that BMesh is the only part of blender that uses a hand written API like this. This type could eventually be used to access lattice weights.
Many of Blender-API's dictionary-like-wrappers act like ordered dictionaries, This is intentionally not ordered, the weights can be in any order and it won't matter, the order should not be used in the API in any meaningful way (as with a python dict) only expose as mapping, not a sequence.

Definition at line 518 of file bmesh_py_types_meshdata.cc.

Referenced by blender::BPy_BMDeformVert_AssignPyObject().

◆ BPy_BMLoopUV_Check

#define BPy_BMLoopUV_Check ( v)
Value:
(Py_TYPE(v) == &BPy_BMLoopUV_Type)

Definition at line 47 of file bmesh_py_types_meshdata.cc.

Referenced by blender::BPy_BMLoopUV_AssignPyObject().

◆ BPy_BMVertSkin_Check

#define BPy_BMVertSkin_Check ( v)
Value:
(Py_TYPE(v) == &BPy_BMVertSkin_Type)

Definition at line 201 of file bmesh_py_types_meshdata.cc.

Referenced by blender::BPy_BMVertSkin_AssignPyObject().

◆ MLOOPCOL_FROM_CAPSULE

#define MLOOPCOL_FROM_CAPSULE ( color_capsule)
Value:
((MLoopCol *)PyCapsule_GetPointer(color_capsule, nullptr))

Definition at line 397 of file bmesh_py_types_meshdata.cc.

Referenced by blender::mathutils_bmloopcol_get(), and blender::mathutils_bmloopcol_set().