Blender V4.3
meshtools.cc File Reference
#include <algorithm>
#include "MEM_guardedalloc.h"
#include "BLI_math_matrix.h"
#include "BLI_virtual_array.hh"
#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 "BKE_attribute.hh"
#include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_material.h"
#include "BKE_mesh.hh"
#include "BKE_mesh_iterators.hh"
#include "BKE_mesh_runtime.hh"
#include "BKE_multires.hh"
#include "BKE_object.hh"
#include "BKE_object_deform.h"
#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_view3d.hh"
#include "WM_api.hh"
#include "WM_types.hh"

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], float3 **vert_positions_pp, blender::int2 **medge_pp, int **corner_verts_pp, int **corner_edges_pp, int *all_face_offsets, CustomData *vert_data, CustomData *edge_data, CustomData *ldata, CustomData *face_data, int totvert, int totedge, int totloop, int faces_num, 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 (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 *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)
 
intmesh_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)
 
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)
 
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 *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.

Function Documentation

◆ ED_mesh_active_dvert_get_em()

◆ ED_mesh_active_dvert_get_ob()

◆ ED_mesh_active_dvert_get_only()

◆ ED_mesh_join_objects_exec()

int ED_mesh_join_objects_exec ( bContext * C,
wmOperator * op )

Definition at line 318 of file meshtools.cc.

References b, blender::ed::object::base_free_and_unlink(), 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_geometry(), BKE_mesh_from_object(), BKE_object_apply_mat4_ex(), BKE_object_defgroup_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, CD_CONSTRUCT, CD_PROP_FLOAT3, CD_PROP_INT32, CD_PROP_INT32_2D, CD_SET_DEFAULT, CTX_data_active_object(), CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), CustomData_add_layer_named(), CustomData_reset(), KeyBlock::data, Object::data, DEG_id_tag_update(), DEG_relations_tag_update(), depsgraph, ELEM, Key::id, Object::id, ID_RECALC_GEOMETRY, ID_RECALC_SELECT, ID_RECALC_TRANSFORM, id_us_min(), id_us_plus(), blender::implicit_sharing::info_for_mem_free(), invert_m4_m4_safe_ortho(), join_mesh_single(), KEY_RELATIVE, LIB_ID_FREE_NO_UI_USER, LIKELY, LISTBASE_FOREACH, LISTBASE_FOREACH_INDEX, Object::mat, Object::matbits, MAXMAT, MEM_callocN, MEM_freeN(), MEM_malloc_arrayN, MEM_mallocN, MEM_SAFE_FREE, mesh, 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, OPERATOR_CANCELLED, OPERATOR_FINISHED, Object::parent, Object::parentinv, KeyBlock::relative, wmOperator::reports, RPT_WARNING, Object::totcol, KeyBlock::totelem, Key::totkey, Key::type, Object::type, Mesh::vertex_group_names, Mesh::verts_num, and WM_event_add_notifier().

Referenced by blender::ed::object::object_join_exec().

◆ ED_mesh_mirror_get_vert()

int ED_mesh_mirror_get_vert ( Object * ob,
int index )

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

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

◆ ED_mesh_pick_face()

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

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 )
static

◆ ED_mesh_pick_vert()

◆ ed_mesh_pick_vert__mapFunc()

static 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] )

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

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

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

Definition at line 878 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()

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 ( 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 * mesh_eval,
Mesh ** r_mesh_mirror,
BMEditMesh ** r_em_mirror )

Definition at line 825 of file meshtools.cc.

References Object::data, and mesh.

Referenced by ED_mesh_mirror_topo_table_begin(), and ed_mesh_mirror_topo_table_update().

◆ mirror_facecmp()

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

Definition at line 1094 of file meshtools.cc.

References b, and mirror_facerotation().

Referenced by mesh_get_x_mirror_faces().

◆ mirror_facehash()

static uint mirror_facehash ( const void * ptr)
static

Definition at line 1046 of file meshtools.cc.

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

Referenced by mesh_get_x_mirror_faces().

◆ mirror_facerotation()

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

Definition at line 1063 of file meshtools.cc.

References b.

Referenced by mesh_get_x_mirror_faces(), and mirror_facecmp().

Variable Documentation

◆ mesh_topo_store