Blender  V3.3
Classes | Functions
meshtools.cc File Reference
#include "MEM_guardedalloc.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "DNA_workspace_types.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_key.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
#include "BKE_multires.h"
#include "BKE_object.h"
#include "BKE_object_deform.h"
#include "BKE_object_facemap.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
#include "DRW_select_buffer.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_view3d.h"
#include "WM_api.h"
#include "WM_types.h"

Go to the source code of this file.

Classes

struct  VertPickData
 

Functions

static void join_mesh_single (Depsgraph *depsgraph, Main *bmain, Scene *scene, Object *ob_dst, Object *ob_src, const float imat[4][4], MVert **mvert_pp, MEdge **medge_pp, MLoop **mloop_pp, MPoly **mpoly_pp, CustomData *vdata, CustomData *edata, CustomData *ldata, CustomData *pdata, int totvert, int totedge, int totloop, int totpoly, Key *key, Key *nkey, Material **matar, int *matmap, int totcol, int *vertofs, int *edgeofs, int *loopofs, int *polyofs)
 
static void mesh_join_offset_face_sets_ID (const Mesh *mesh, int *face_set_offset)
 
int ED_mesh_join_objects_exec (bContext *C, wmOperator *op)
 
static int mesh_get_x_mirror_vert_spatial (Object *ob, Mesh *me_eval, int index)
 
static int mesh_get_x_mirror_vert_topo (Object *ob, Mesh *mesh, int index)
 
int mesh_get_x_mirror_vert (Object *ob, Mesh *me_eval, int index, const bool use_topology)
 
static BMVerteditbmesh_get_x_mirror_vert_spatial (Object *ob, BMEditMesh *em, const float co[3])
 
static BMVerteditbmesh_get_x_mirror_vert_topo (Object *ob, BMEditMesh *em, BMVert *eve, int index)
 
BMVerteditbmesh_get_x_mirror_vert (Object *ob, BMEditMesh *em, BMVert *eve, const float co[3], int index, const bool use_topology)
 
int ED_mesh_mirror_get_vert (Object *ob, int index)
 
static uint mirror_facehash (const void *ptr)
 
static int mirror_facerotation (MFace *a, MFace *b)
 
static bool mirror_facecmp (const void *a, const void *b)
 
int * mesh_get_x_mirror_faces (Object *ob, BMEditMesh *em, Mesh *me_eval)
 
bool ED_mesh_pick_face (bContext *C, Object *ob, const int mval[2], uint dist_px, uint *r_index)
 
static void ed_mesh_pick_face_vert__mpoly_find (ARegion *region, const float mval[2], const MPoly *mp, const MVert *mvert, const MLoop *mloop, float *r_len_best, int *r_v_idx_best)
 
bool ED_mesh_pick_face_vert (bContext *C, Object *ob, const int mval[2], uint dist_px, uint *r_index)
 
static void ed_mesh_pick_vert__mapFunc (void *userData, int index, const float co[3], const float UNUSED(no[3]))
 
bool ED_mesh_pick_vert (bContext *C, Object *ob, const int mval[2], uint dist_px, bool use_zbuf, uint *r_index)
 
MDeformVertED_mesh_active_dvert_get_em (Object *ob, BMVert **r_eve)
 
MDeformVertED_mesh_active_dvert_get_ob (Object *ob, int *r_index)
 
MDeformVertED_mesh_active_dvert_get_only (Object *ob)
 
void EDBM_mesh_stats_multi (Object **objects, const uint objects_len, int totelem[3], int totelem_sel[3])
 
void EDBM_mesh_elem_index_ensure_multi (Object **objects, const uint objects_len, const char htype)
 
Join as Shapes

Append selected meshes vertex locations as shapes of the active mesh.

int ED_mesh_shapes_join_objects_exec (bContext *C, wmOperator *op)
 

Mesh Topology Mirror API

static MirrTopoStore_t mesh_topo_store = {nullptr, -1, -1, false}
 
BLI_INLINE void mesh_mirror_topo_table_get_meshes (Object *ob, Mesh *me_eval, Mesh **r_me_mirror, BMEditMesh **r_em_mirror)
 
void ED_mesh_mirror_topo_table_begin (Object *ob, Mesh *me_eval)
 
void ED_mesh_mirror_topo_table_end (Object *UNUSED(ob))
 
static bool ed_mesh_mirror_topo_table_update (Object *ob, Mesh *me_eval)
 

Detailed Description

meshtools.c: no editmode (violated already :), mirror & join), tools operating on meshes

Definition in file meshtools.cc.

Function Documentation

◆ ED_mesh_active_dvert_get_em()

MDeformVert* ED_mesh_active_dvert_get_em ( Object ob,
BMVert **  r_eve 
)

◆ ED_mesh_active_dvert_get_ob()

MDeformVert* ED_mesh_active_dvert_get_ob ( Object ob,
int *  r_index 
)

◆ ED_mesh_active_dvert_get_only()

MDeformVert* ED_mesh_active_dvert_get_only ( Object ob)

◆ ED_mesh_join_objects_exec()

int ED_mesh_join_objects_exec ( bContext C,
wmOperator op 
)

Definition at line 314 of file meshtools.cc.

References Freestyle::a, Object::actfmap, usdtokens::b(), BKE_id_copy(), BKE_id_free_ex(), BKE_key_add(), BKE_key_sort(), BKE_keyblock_add(), BKE_keyblock_copy_settings(), BKE_keyblock_find_name(), BKE_mesh_clear_derived_normals(), BKE_mesh_from_object(), BKE_mesh_normals_tag_dirty(), BKE_mesh_runtime_clear_geometry(), BKE_mesh_tessface_clear(), BKE_mesh_update_customdata_pointers(), BKE_object_apply_mat4_ex(), BKE_object_defgroup_find_name(), BKE_object_facemap_find_name(), BKE_object_free_derived_caches(), BKE_object_material_get(), BKE_objects_materials_test_all(), BKE_report(), BKE_reportf(), BLI_addtail(), BLI_assert, BLI_findindex(), BLI_listbase_is_empty(), Key::block, C, CD_CALLOC, CD_MEDGE, CD_MLOOP, CD_MPOLY, CD_MVERT, CTX_data_active_object(), CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), CustomData_add_layer(), CustomData_free(), CustomData_reset(), KeyBlock::data, Object::data, DEG_id_tag_update(), DEG_relations_tag_update(), depsgraph, ED_object_base_free_and_unlink(), Mesh::edata, ELEM, ListBase::first, Object::fmaps, Key::id, Object::id, Scene::id, ID_RECALC_GEOMETRY, ID_RECALC_SELECT, ID_RECALC_TRANSFORM, id_us_min(), id_us_plus(), if(), invert_m4_m4_safe_ortho(), join_mesh_single(), Mesh::key, KEY_RELATIVE, Mesh::ldata, LIB_ID_FREE_NO_UI_USER, LIKELY, LISTBASE_FOREACH, LISTBASE_FOREACH_INDEX, Mesh::mat, Object::mat, Object::matbits, MAXMAT, MEM_callocN, MEM_freeN, MEM_mallocN, MEM_SAFE_FREE, mesh_join_offset_face_sets_ID(), MESH_MAX_VERTS, Object::mode, Node::name, NC_SCENE, ND_LAYER_CONTENT, ND_OB_ACTIVE, OB_MESH, OB_MODE_EDIT, Object::obmat, OPERATOR_CANCELLED, OPERATOR_FINISHED, Object::parent, Object::parentinv, Mesh::pdata, KeyBlock::relative, wmOperator::reports, RPT_WARNING, scene, Mesh::totcol, Object::totcol, Mesh::totedge, KeyBlock::totelem, Key::totkey, Mesh::totloop, Mesh::totpoly, Mesh::totvert, Key::type, Object::type, Mesh::vdata, Mesh::vertex_group_active_index, Mesh::vertex_group_names, and WM_event_add_notifier().

Referenced by object_join_exec().

◆ ED_mesh_mirror_get_vert()

int ED_mesh_mirror_get_vert ( struct Object ob,
int  index 
)

◆ ED_mesh_mirror_topo_table_begin()

void ED_mesh_mirror_topo_table_begin ( struct Object ob,
struct Mesh me_eval 
)

Mode is 's' start, or 'e' end, or 'u' use if end, ob can be NULL.

Note
This is supposed return -1 on error, which callers are currently checking for, but is not used so far.

Definition at line 863 of file meshtools.cc.

References ED_mesh_mirrtopo_init(), mesh_mirror_topo_table_get_meshes(), and mesh_topo_store.

Referenced by ed_mesh_mirror_topo_table_update().

◆ ED_mesh_mirror_topo_table_end()

void ED_mesh_mirror_topo_table_end ( Object UNUSEDob)

Definition at line 872 of file meshtools.cc.

References ED_mesh_mirrtopo_free(), and mesh_topo_store.

◆ ed_mesh_mirror_topo_table_update()

static bool ed_mesh_mirror_topo_table_update ( Object ob,
Mesh me_eval 
)
static

◆ ED_mesh_pick_face()

bool ED_mesh_pick_face ( struct bContext C,
struct Object ob,
const int  mval[2],
uint  dist_px,
uint r_index 
)

◆ ED_mesh_pick_face_vert()

bool ED_mesh_pick_face_vert ( struct bContext C,
struct Object ob,
const int  mval[2],
uint  dist_px,
uint r_index 
)

◆ ed_mesh_pick_face_vert__mpoly_find()

static void ed_mesh_pick_face_vert__mpoly_find ( ARegion region,
const float  mval[2],
const MPoly mp,
const MVert mvert,
const MLoop mloop,
float r_len_best,
int *  r_v_idx_best 
)
static

◆ ED_mesh_pick_vert()

bool ED_mesh_pick_vert ( bContext C,
Object ob,
const int  mval[2],
uint  dist_px,
bool  use_zbuf,
uint r_index 
)

◆ ed_mesh_pick_vert__mapFunc()

static void ed_mesh_pick_vert__mapFunc ( void userData,
int  index,
const float  co[3],
const float   UNUSEDno[3] 
)
static

◆ ED_mesh_shapes_join_objects_exec()

int ED_mesh_shapes_join_objects_exec ( bContext C,
wmOperator op 
)

◆ EDBM_mesh_elem_index_ensure_multi()

void EDBM_mesh_elem_index_ensure_multi ( Object **  objects,
const uint  objects_len,
const char  htype 
)

◆ EDBM_mesh_stats_multi()

void EDBM_mesh_stats_multi ( Object **  objects,
const uint  objects_len,
int  totelem[3],
int  totelem_sel[3] 
)

◆ editbmesh_get_x_mirror_vert()

BMVert* editbmesh_get_x_mirror_vert ( Object ob,
BMEditMesh em,
BMVert eve,
const float  co[3],
int  index,
const bool  use_topology 
)

◆ editbmesh_get_x_mirror_vert_spatial()

static BMVert* editbmesh_get_x_mirror_vert_spatial ( Object ob,
BMEditMesh em,
const float  co[3] 
)
static

◆ editbmesh_get_x_mirror_vert_topo()

static BMVert* editbmesh_get_x_mirror_vert_topo ( Object ob,
BMEditMesh em,
BMVert eve,
int  index 
)
static

◆ join_mesh_single()

static void join_mesh_single ( Depsgraph depsgraph,
Main bmain,
Scene scene,
Object ob_dst,
Object ob_src,
const float  imat[4][4],
MVert **  mvert_pp,
MEdge **  medge_pp,
MLoop **  mloop_pp,
MPoly **  mpoly_pp,
CustomData vdata,
CustomData edata,
CustomData ldata,
CustomData pdata,
int  totvert,
int  totedge,
int  totloop,
int  totpoly,
Key key,
Key nkey,
Material **  matar,
int *  matmap,
int  totcol,
int *  vertofs,
int *  edgeofs,
int *  loopofs,
int *  polyofs 
)
static

◆ mesh_get_x_mirror_faces()

int* mesh_get_x_mirror_faces ( struct Object ob,
struct BMEditMesh em,
struct Mesh me_eval 
)

◆ mesh_get_x_mirror_vert()

int mesh_get_x_mirror_vert ( struct Object ob,
struct Mesh me_eval,
int  index,
bool  use_topology 
)

◆ mesh_get_x_mirror_vert_spatial()

static int mesh_get_x_mirror_vert_spatial ( Object ob,
Mesh me_eval,
int  index 
)
static

◆ mesh_get_x_mirror_vert_topo()

static int mesh_get_x_mirror_vert_topo ( Object ob,
Mesh mesh,
int  index 
)
static

◆ mesh_join_offset_face_sets_ID()

static void mesh_join_offset_face_sets_ID ( const Mesh mesh,
int *  face_set_offset 
)
static

◆ mesh_mirror_topo_table_get_meshes()

BLI_INLINE void mesh_mirror_topo_table_get_meshes ( Object ob,
Mesh me_eval,
Mesh **  r_me_mirror,
BMEditMesh **  r_em_mirror 
)

◆ mirror_facecmp()

static bool mirror_facecmp ( const void a,
const void b 
)
static

Definition at line 1110 of file meshtools.cc.

References Freestyle::a, usdtokens::b(), and mirror_facerotation().

Referenced by mesh_get_x_mirror_faces().

◆ mirror_facehash()

static uint mirror_facehash ( const void ptr)
static

Definition at line 1062 of file meshtools.cc.

References MAX3, MAX4, MIN3, MIN4, ptr, v1, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.

Referenced by mesh_get_x_mirror_faces().

◆ mirror_facerotation()

static int mirror_facerotation ( MFace a,
MFace b 
)
static

Definition at line 1079 of file meshtools.cc.

References Freestyle::a, and usdtokens::b().

Referenced by mesh_get_x_mirror_faces(), and mirror_facecmp().

Variable Documentation

◆ mesh_topo_store

MirrTopoStore_t mesh_topo_store = {nullptr, -1, -1, false}
static