Blender V5.0
meshtools.cc File Reference
#include <algorithm>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_vector.hh"
#include "BLI_virtual_array.hh"
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "BKE_attribute.hh"
#include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_editmesh.hh"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_material.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_iterators.hh"
#include "BKE_mesh_runtime.hh"
#include "BKE_multires.hh"
#include "BKE_object.hh"
#include "BKE_paint.hh"
#include "BKE_paint_bvh.hh"
#include "BKE_report.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"
#include "DEG_depsgraph_query.hh"
#include "DRW_select_buffer.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_sculpt.hh"
#include "ED_view3d.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "mesh_intern.hh"

Go to the source code of this file.

Classes

struct  VertPickData

Typedefs

using float3
using int2

Functions

static int mesh_get_x_mirror_vert_spatial (Object *ob, Mesh *mesh_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 *mesh_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 (const MFace *a, const MFace *b)
static bool mirror_facecmp (const void *a, const void *b)
int * mesh_get_x_mirror_faces (Object *ob, BMEditMesh *em, Mesh *mesh_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 blender::IndexRange face, const Span< float3 > vert_positions, const int *corner_verts, 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)
bool ED_mesh_pick_edge (bContext *C, Object *ob, const int mval[2], uint dist_px, uint *r_index)
static void ed_mesh_pick_vert__mapFunc (void *user_data, int index, const float co[3], const float[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 (const Span< Object * > objects, int totelem[3], int totelem_sel[3])
void EDBM_mesh_elem_index_ensure_multi (const Span< Object * > objects, const char htype)
static wmOperatorStatus mesh_reorder_vertices_spatial_exec (bContext *C, wmOperator *op)
static bool mesh_reorder_vertices_spatial_poll (bContext *C)
void MESH_OT_reorder_vertices_spatial (wmOperatorType *ot)
Join as Shapes

Add vertex positions of selected meshes as shape keys to the active mesh.

static std::string create_mirrored_name (const blender::StringRefNull object_name, const bool mirror)
wmOperatorStatus ED_mesh_shapes_join_objects_exec (bContext *C, const bool ensure_keys_exist, const bool mirror, ReportList *reports)

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 *mesh_eval, Mesh **r_mesh_mirror, BMEditMesh **r_em_mirror)
void ED_mesh_mirror_topo_table_begin (Object *ob, Mesh *mesh_eval)
void ED_mesh_mirror_topo_table_end (Object *)
static bool ed_mesh_mirror_topo_table_update (Object *ob, Mesh *mesh_eval)

Detailed Description

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

Definition in file meshtools.cc.

Typedef Documentation

◆ float3

Definition at line 619 of file BLI_math_vector_types.hh.

◆ int2

Definition at line 601 of file BLI_math_vector_types.hh.

Function Documentation

◆ create_mirrored_name()

std::string create_mirrored_name ( const blender::StringRefNull object_name,
const bool mirror )
static

◆ ED_mesh_active_dvert_get_em()

◆ ED_mesh_active_dvert_get_ob()

◆ ED_mesh_active_dvert_get_only()

◆ ED_mesh_mirror_get_vert()

◆ ED_mesh_mirror_topo_table_begin()

void ED_mesh_mirror_topo_table_begin ( Object * ob,
Mesh * mesh_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 249 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()

◆ ed_mesh_mirror_topo_table_update()

bool ed_mesh_mirror_topo_table_update ( Object * ob,
Mesh * mesh_eval )
static

◆ ED_mesh_pick_edge()

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

◆ ED_mesh_pick_face()

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

◆ ED_mesh_pick_face_vert()

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

◆ ed_mesh_pick_face_vert__mpoly_find()

void ed_mesh_pick_face_vert__mpoly_find ( ARegion * region,
const float mval[2],
const blender::IndexRange face,
const Span< float3 > vert_positions,
const int * corner_verts,
float * r_len_best,
int * r_v_idx_best )
static

◆ ED_mesh_pick_vert()

◆ ed_mesh_pick_vert__mapFunc()

void ed_mesh_pick_vert__mapFunc ( void * user_data,
int index,
const float co[3],
const float [3] )
static

◆ ED_mesh_shapes_join_objects_exec()

◆ EDBM_mesh_elem_index_ensure_multi()

void EDBM_mesh_elem_index_ensure_multi ( const Span< Object * > objects,
const char htype )

◆ EDBM_mesh_stats_multi()

void EDBM_mesh_stats_multi ( const Span< Object * > objects,
int totelem[3],
int totelem_sel[3] )

Definition at line 904 of file meshtools.cc.

References BKE_editmesh_from_object(), bm, and BMEditMesh::bm.

◆ 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()

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

◆ editbmesh_get_x_mirror_vert_topo()

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

◆ mesh_get_x_mirror_faces()

◆ mesh_get_x_mirror_vert()

int mesh_get_x_mirror_vert ( Object * ob,
Mesh * mesh_eval,
int index,
bool use_topology )

◆ mesh_get_x_mirror_vert_spatial()

int mesh_get_x_mirror_vert_spatial ( Object * ob,
Mesh * mesh_eval,
int index )
static

Definition at line 279 of file meshtools.cc.

References Object::data, and ED_mesh_mirror_spatial_table_lookup().

Referenced by mesh_get_x_mirror_vert().

◆ mesh_get_x_mirror_vert_topo()

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

Definition at line 293 of file meshtools.cc.

References ed_mesh_mirror_topo_table_update(), and mesh_topo_store.

Referenced by mesh_get_x_mirror_vert().

◆ mesh_mirror_topo_table_get_meshes()

BLI_INLINE void mesh_mirror_topo_table_get_meshes ( Object * ob,
Mesh * mesh_eval,
Mesh ** r_mesh_mirror,
BMEditMesh ** r_em_mirror )

◆ MESH_OT_reorder_vertices_spatial()

void MESH_OT_reorder_vertices_spatial ( wmOperatorType * ot)

◆ mesh_reorder_vertices_spatial_exec()

◆ mesh_reorder_vertices_spatial_poll()

bool mesh_reorder_vertices_spatial_poll ( bContext * C)
static

◆ mirror_facecmp()

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

Definition at line 495 of file meshtools.cc.

References b, and mirror_facerotation().

Referenced by mesh_get_x_mirror_faces().

◆ mirror_facehash()

uint mirror_facehash ( const void * ptr)
static

Definition at line 447 of file meshtools.cc.

References ptr, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.

Referenced by mesh_get_x_mirror_faces().

◆ mirror_facerotation()

int mirror_facerotation ( const MFace * a,
const MFace * b )
static

Definition at line 464 of file meshtools.cc.

References b, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.

Referenced by mesh_get_x_mirror_faces(), and mirror_facecmp().

Variable Documentation

◆ mesh_topo_store