Blender  V3.3
Macros | Functions
mesh_data.cc File Reference
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
#include "BLI_array.hh"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_attribute.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_editmesh.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_prototypes.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_paint.h"
#include "ED_screen.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
#include "mesh_intern.h"

Go to the source code of this file.

Macros

#define GET_CD_DATA(me, data)   ((me)->edit_mesh ? &(me)->edit_mesh->bm->data : &(me)->data)
 

Functions

static CustomDatamesh_customdata_get_type (Mesh *me, const char htype, int *r_tot)
 
static void delete_customdata_layer (Mesh *me, CustomDataLayer *layer)
 
static void mesh_uv_reset_array (float **fuv, const int len)
 
static void mesh_uv_reset_bmface (BMFace *f, const int cd_loop_uv_offset)
 
static void mesh_uv_reset_mface (MPoly *mp, MLoopUV *mloopuv)
 
void ED_mesh_uv_loop_reset_ex (Mesh *me, const int layernum)
 
void ED_mesh_uv_loop_reset (bContext *C, Mesh *me)
 
int ED_mesh_uv_add (Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports)
 
void ED_mesh_uv_ensure (Mesh *me, const char *name)
 
bool ED_mesh_uv_remove_index (Mesh *me, const int n)
 
bool ED_mesh_uv_remove_active (Mesh *me)
 
bool ED_mesh_uv_remove_named (Mesh *me, const char *name)
 
int ED_mesh_color_add (Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *UNUSED(reports))
 
bool ED_mesh_color_ensure (Mesh *me, const char *name)
 
bool ED_mesh_color_remove_index (Mesh *me, const int n)
 
bool ED_mesh_color_remove_active (Mesh *me)
 
bool ED_mesh_color_remove_named (Mesh *me, const char *name)
 
static bool layers_poll (bContext *C)
 
static bool sculpt_vertex_color_remove_poll (bContext *C)
 
int ED_mesh_sculpt_color_add (Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *UNUSED(reports))
 
bool ED_mesh_sculpt_color_ensure (Mesh *me, const char *name)
 
bool ED_mesh_sculpt_color_remove_index (Mesh *me, const int n)
 
bool ED_mesh_sculpt_color_remove_active (Mesh *me)
 
bool ED_mesh_sculpt_color_remove_named (Mesh *me, const char *name)
 
static bool uv_texture_remove_poll (bContext *C)
 
static int mesh_uv_texture_add_exec (bContext *C, wmOperator *op)
 
void MESH_OT_uv_texture_add (wmOperatorType *ot)
 
static int mesh_uv_texture_remove_exec (bContext *C, wmOperator *UNUSED(op))
 
void MESH_OT_uv_texture_remove (wmOperatorType *ot)
 
static bool vertex_color_remove_poll (bContext *C)
 
static int mesh_vertex_color_add_exec (bContext *C, wmOperator *op)
 
void MESH_OT_vertex_color_add (wmOperatorType *ot)
 
static int mesh_vertex_color_remove_exec (bContext *C, wmOperator *UNUSED(op))
 
void MESH_OT_vertex_color_remove (wmOperatorType *ot)
 
static int mesh_sculpt_vertex_color_add_exec (bContext *C, wmOperator *op)
 
void MESH_OT_sculpt_vertex_color_add (wmOperatorType *ot)
 
static int mesh_sculpt_vertex_color_remove_exec (bContext *C, wmOperator *UNUSED(op))
 
void MESH_OT_sculpt_vertex_color_remove (wmOperatorType *ot)
 
static int mesh_customdata_clear_exec__internal (bContext *C, char htype, int type)
 
static bool mesh_customdata_mask_clear_poll (bContext *C)
 
static int mesh_customdata_mask_clear_exec (bContext *C, wmOperator *UNUSED(op))
 
void MESH_OT_customdata_mask_clear (wmOperatorType *ot)
 
static int mesh_customdata_skin_state (bContext *C)
 
static bool mesh_customdata_skin_add_poll (bContext *C)
 
static int mesh_customdata_skin_add_exec (bContext *C, wmOperator *UNUSED(op))
 
void MESH_OT_customdata_skin_add (wmOperatorType *ot)
 
static bool mesh_customdata_skin_clear_poll (bContext *C)
 
static int mesh_customdata_skin_clear_exec (bContext *C, wmOperator *UNUSED(op))
 
void MESH_OT_customdata_skin_clear (wmOperatorType *ot)
 
static int mesh_customdata_custom_splitnormals_add_exec (bContext *C, wmOperator *UNUSED(op))
 
void MESH_OT_customdata_custom_splitnormals_add (wmOperatorType *ot)
 
static int mesh_customdata_custom_splitnormals_clear_exec (bContext *C, wmOperator *UNUSED(op))
 
void MESH_OT_customdata_custom_splitnormals_clear (wmOperatorType *ot)
 
void ED_mesh_update (Mesh *mesh, bContext *C, bool calc_edges, bool calc_edges_loose)
 
static void mesh_add_verts (Mesh *mesh, int len)
 
static void mesh_add_edges (Mesh *mesh, int len)
 
static void mesh_add_loops (Mesh *mesh, int len)
 
static void mesh_add_polys (Mesh *mesh, int len)
 
void ED_mesh_report_mirror_ex (wmOperator *op, int totmirr, int totfail, char selectmode)
 
void ED_mesh_report_mirror (wmOperator *op, int totmirr, int totfail)
 
MeshED_mesh_context (bContext *C)
 
Add Geometry
void ED_mesh_verts_add (Mesh *mesh, ReportList *reports, int count)
 
void ED_mesh_edges_add (Mesh *mesh, ReportList *reports, int count)
 
void ED_mesh_loops_add (Mesh *mesh, ReportList *reports, int count)
 
void ED_mesh_polys_add (Mesh *mesh, ReportList *reports, int count)
 
Remove Geometry
static void mesh_remove_verts (Mesh *mesh, int len)
 
static void mesh_remove_edges (Mesh *mesh, int len)
 
static void mesh_remove_loops (Mesh *mesh, int len)
 
static void mesh_remove_polys (Mesh *mesh, int len)
 
void ED_mesh_verts_remove (Mesh *mesh, ReportList *reports, int count)
 
void ED_mesh_edges_remove (Mesh *mesh, ReportList *reports, int count)
 
void ED_mesh_loops_remove (Mesh *mesh, ReportList *reports, int count)
 
void ED_mesh_polys_remove (Mesh *mesh, ReportList *reports, int count)
 
void ED_mesh_geometry_clear (Mesh *mesh)
 

Macro Definition Documentation

◆ GET_CD_DATA

#define GET_CD_DATA (   me,
  data 
)    ((me)->edit_mesh ? &(me)->edit_mesh->bm->data : &(me)->data)

Definition at line 106 of file mesh_data.cc.

Function Documentation

◆ delete_customdata_layer()

static void delete_customdata_layer ( Mesh me,
CustomDataLayer layer 
)
static

◆ ED_mesh_color_add()

int ED_mesh_color_add ( Mesh me,
const char *  name,
const bool  active_set,
const bool  do_init,
ReportList UNUSEDreports 
)

◆ ED_mesh_color_ensure()

bool ED_mesh_color_ensure ( Mesh me,
const char *  name 
)

◆ ED_mesh_color_remove_active()

bool ED_mesh_color_remove_active ( Mesh me)

◆ ED_mesh_color_remove_index()

bool ED_mesh_color_remove_index ( Mesh me,
const int  n 
)

◆ ED_mesh_color_remove_named()

bool ED_mesh_color_remove_named ( Mesh me,
const char *  name 
)

◆ ED_mesh_context()

Mesh* ED_mesh_context ( struct bContext C)

Returns the pinned mesh, the mesh from the pinned object, or the mesh from the active object.

Definition at line 1406 of file mesh_data.cc.

References C, CTX_data_pointer_get_type(), data, Object::data, PointerRNA::data, ED_object_active_context(), GS, ID_ME, if(), and mesh.

Referenced by ED_operator_editable_mesh(), mesh_customdata_clear_exec__internal(), mesh_customdata_custom_splitnormals_add_exec(), and mesh_customdata_custom_splitnormals_clear_exec().

◆ ED_mesh_edges_add()

void ED_mesh_edges_add ( Mesh mesh,
ReportList reports,
int  count 
)

Definition at line 1239 of file mesh_data.cc.

References BKE_report(), count, Mesh::edit_mesh, mesh, mesh_add_edges(), and RPT_ERROR.

◆ ED_mesh_edges_remove()

void ED_mesh_edges_remove ( Mesh mesh,
ReportList reports,
int  count 
)

◆ ED_mesh_geometry_clear()

void ED_mesh_geometry_clear ( Mesh mesh)

◆ ED_mesh_loops_add()

void ED_mesh_loops_add ( Mesh mesh,
ReportList reports,
int  count 
)

Definition at line 1248 of file mesh_data.cc.

References BKE_report(), count, Mesh::edit_mesh, mesh, mesh_add_loops(), and RPT_ERROR.

◆ ED_mesh_loops_remove()

void ED_mesh_loops_remove ( Mesh mesh,
ReportList reports,
int  count 
)

◆ ED_mesh_polys_add()

void ED_mesh_polys_add ( Mesh mesh,
ReportList reports,
int  count 
)

Definition at line 1257 of file mesh_data.cc.

References BKE_report(), count, Mesh::edit_mesh, mesh, mesh_add_polys(), and RPT_ERROR.

◆ ED_mesh_polys_remove()

void ED_mesh_polys_remove ( Mesh mesh,
ReportList reports,
int  count 
)

◆ ED_mesh_report_mirror()

void ED_mesh_report_mirror ( wmOperator op,
int  totmirr,
int  totfail 
)

Definition at line 1401 of file mesh_data.cc.

References ED_mesh_report_mirror_ex(), and SCE_SELECT_VERTEX.

Referenced by shape_key_mirror_exec(), and vertex_group_mirror_exec().

◆ ED_mesh_report_mirror_ex()

void ED_mesh_report_mirror_ex ( wmOperator op,
int  totmirr,
int  totfail,
char  selectmode 
)

◆ ED_mesh_sculpt_color_add()

int ED_mesh_sculpt_color_add ( Mesh me,
const char *  name,
const bool  active_set,
const bool  do_init,
ReportList UNUSEDreports 
)

◆ ED_mesh_sculpt_color_ensure()

bool ED_mesh_sculpt_color_ensure ( Mesh me,
const char *  name 
)

◆ ED_mesh_sculpt_color_remove_active()

bool ED_mesh_sculpt_color_remove_active ( Mesh me)

◆ ED_mesh_sculpt_color_remove_index()

bool ED_mesh_sculpt_color_remove_index ( Mesh me,
const int  n 
)

◆ ED_mesh_sculpt_color_remove_named()

bool ED_mesh_sculpt_color_remove_named ( Mesh me,
const char *  name 
)

◆ ED_mesh_update()

void ED_mesh_update ( Mesh mesh,
bContext C,
bool  calc_edges,
bool  calc_edges_loose 
)

◆ ED_mesh_uv_add()

int ED_mesh_uv_add ( Mesh me,
const char *  name,
const bool  active_set,
const bool  do_init,
ReportList reports 
)

◆ ED_mesh_uv_ensure()

void ED_mesh_uv_ensure ( Mesh me,
const char *  name 
)

◆ ED_mesh_uv_loop_reset()

void ED_mesh_uv_loop_reset ( bContext C,
Mesh me 
)

◆ ED_mesh_uv_loop_reset_ex()

void ED_mesh_uv_loop_reset_ex ( struct Mesh me,
int  layernum 
)

◆ ED_mesh_uv_remove_active()

bool ED_mesh_uv_remove_active ( Mesh me)

◆ ED_mesh_uv_remove_index()

bool ED_mesh_uv_remove_index ( Mesh me,
const int  n 
)

◆ ED_mesh_uv_remove_named()

bool ED_mesh_uv_remove_named ( Mesh me,
const char *  name 
)

◆ ED_mesh_verts_add()

void ED_mesh_verts_add ( Mesh mesh,
ReportList reports,
int  count 
)

Definition at line 1230 of file mesh_data.cc.

References BKE_report(), count, Mesh::edit_mesh, mesh, mesh_add_verts(), and RPT_ERROR.

◆ ED_mesh_verts_remove()

void ED_mesh_verts_remove ( Mesh mesh,
ReportList reports,
int  count 
)

◆ layers_poll()

static bool layers_poll ( bContext C)
static

◆ mesh_add_edges()

static void mesh_add_edges ( Mesh mesh,
int  len 
)
static

◆ mesh_add_loops()

static void mesh_add_loops ( Mesh mesh,
int  len 
)
static

◆ mesh_add_polys()

static void mesh_add_polys ( Mesh mesh,
int  len 
)
static

◆ mesh_add_verts()

static void mesh_add_verts ( Mesh mesh,
int  len 
)
static

◆ mesh_customdata_clear_exec__internal()

static int mesh_customdata_clear_exec__internal ( bContext C,
char  htype,
int  type 
)
static

◆ mesh_customdata_custom_splitnormals_add_exec()

static int mesh_customdata_custom_splitnormals_add_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mesh_customdata_custom_splitnormals_clear_exec()

static int mesh_customdata_custom_splitnormals_clear_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mesh_customdata_get_type()

static CustomData* mesh_customdata_get_type ( Mesh me,
const char  htype,
int *  r_tot 
)
static

◆ mesh_customdata_mask_clear_exec()

static int mesh_customdata_mask_clear_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mesh_customdata_mask_clear_poll()

static bool mesh_customdata_mask_clear_poll ( bContext C)
static

◆ mesh_customdata_skin_add_exec()

static int mesh_customdata_skin_add_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mesh_customdata_skin_add_poll()

static bool mesh_customdata_skin_add_poll ( bContext C)
static

Definition at line 927 of file mesh_data.cc.

References C, and mesh_customdata_skin_state().

Referenced by MESH_OT_customdata_skin_add().

◆ mesh_customdata_skin_clear_exec()

static int mesh_customdata_skin_clear_exec ( bContext C,
wmOperator UNUSEDop 
)
static

Definition at line 965 of file mesh_data.cc.

References BM_VERT, C, CD_MVERT_SKIN, and mesh_customdata_clear_exec__internal().

Referenced by MESH_OT_customdata_skin_clear().

◆ mesh_customdata_skin_clear_poll()

static bool mesh_customdata_skin_clear_poll ( bContext C)
static

Definition at line 960 of file mesh_data.cc.

References C, and mesh_customdata_skin_state().

Referenced by MESH_OT_customdata_skin_clear().

◆ mesh_customdata_skin_state()

static int mesh_customdata_skin_state ( bContext C)
static

Clear Skin

Returns
-1 invalid state, 0 no skin, 1 has skin.

Definition at line 913 of file mesh_data.cc.

References C, CD_MVERT_SKIN, CustomData_has_layer(), data, Object::data, ED_object_context(), GET_CD_DATA, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY, OB_MESH, and Object::type.

Referenced by mesh_customdata_skin_add_poll(), and mesh_customdata_skin_clear_poll().

◆ MESH_OT_customdata_custom_splitnormals_add()

void MESH_OT_customdata_custom_splitnormals_add ( wmOperatorType ot)

◆ MESH_OT_customdata_custom_splitnormals_clear()

void MESH_OT_customdata_custom_splitnormals_clear ( wmOperatorType ot)

◆ MESH_OT_customdata_mask_clear()

void MESH_OT_customdata_mask_clear ( wmOperatorType ot)

◆ MESH_OT_customdata_skin_add()

void MESH_OT_customdata_skin_add ( wmOperatorType ot)

◆ MESH_OT_customdata_skin_clear()

void MESH_OT_customdata_skin_clear ( wmOperatorType ot)

◆ MESH_OT_sculpt_vertex_color_add()

void MESH_OT_sculpt_vertex_color_add ( wmOperatorType ot)

◆ MESH_OT_sculpt_vertex_color_remove()

void MESH_OT_sculpt_vertex_color_remove ( wmOperatorType ot)

◆ MESH_OT_uv_texture_add()

void MESH_OT_uv_texture_add ( wmOperatorType ot)

◆ MESH_OT_uv_texture_remove()

void MESH_OT_uv_texture_remove ( wmOperatorType ot)

◆ MESH_OT_vertex_color_add()

void MESH_OT_vertex_color_add ( wmOperatorType ot)

◆ MESH_OT_vertex_color_remove()

void MESH_OT_vertex_color_remove ( wmOperatorType ot)

◆ mesh_remove_edges()

static void mesh_remove_edges ( Mesh mesh,
int  len 
)
static

Definition at line 1282 of file mesh_data.cc.

References CustomData_free_elem(), Mesh::edata, len, mesh, and Mesh::totedge.

Referenced by ED_mesh_edges_remove(), and ED_mesh_geometry_clear().

◆ mesh_remove_loops()

static void mesh_remove_loops ( Mesh mesh,
int  len 
)
static

Definition at line 1292 of file mesh_data.cc.

References CustomData_free_elem(), Mesh::ldata, len, mesh, and Mesh::totloop.

Referenced by ED_mesh_geometry_clear(), and ED_mesh_loops_remove().

◆ mesh_remove_polys()

static void mesh_remove_polys ( Mesh mesh,
int  len 
)
static

Definition at line 1302 of file mesh_data.cc.

References CustomData_free_elem(), len, mesh, Mesh::pdata, and Mesh::totpoly.

Referenced by ED_mesh_geometry_clear(), and ED_mesh_polys_remove().

◆ mesh_remove_verts()

static void mesh_remove_verts ( Mesh mesh,
int  len 
)
static

Definition at line 1272 of file mesh_data.cc.

References CustomData_free_elem(), len, mesh, Mesh::totvert, and Mesh::vdata.

Referenced by ED_mesh_geometry_clear(), and ED_mesh_verts_remove().

◆ mesh_sculpt_vertex_color_add_exec()

static int mesh_sculpt_vertex_color_add_exec ( bContext C,
wmOperator op 
)
static

◆ mesh_sculpt_vertex_color_remove_exec()

static int mesh_sculpt_vertex_color_remove_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mesh_uv_reset_array()

static void mesh_uv_reset_array ( float **  fuv,
const int  len 
)
static

Definition at line 135 of file mesh_data.cc.

References cosf, float(), len, M_PI, and sinf.

Referenced by mesh_uv_reset_bmface(), and mesh_uv_reset_mface().

◆ mesh_uv_reset_bmface()

static void mesh_uv_reset_bmface ( BMFace f,
const int  cd_loop_uv_offset 
)
static

◆ mesh_uv_reset_mface()

static void mesh_uv_reset_mface ( MPoly mp,
MLoopUV mloopuv 
)
static

◆ mesh_uv_texture_add_exec()

static int mesh_uv_texture_add_exec ( bContext C,
wmOperator op 
)
static

◆ mesh_uv_texture_remove_exec()

static int mesh_uv_texture_remove_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mesh_vertex_color_add_exec()

static int mesh_vertex_color_add_exec ( bContext C,
wmOperator op 
)
static

◆ mesh_vertex_color_remove_exec()

static int mesh_vertex_color_remove_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ sculpt_vertex_color_remove_poll()

static bool sculpt_vertex_color_remove_poll ( bContext C)
static

◆ uv_texture_remove_poll()

static bool uv_texture_remove_poll ( bContext C)
static

◆ vertex_color_remove_poll()

static bool vertex_color_remove_poll ( bContext C)
static