Blender
V3.3
|
#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 BMVert * | editbmesh_get_x_mirror_vert_spatial (Object *ob, BMEditMesh *em, const float co[3]) |
static BMVert * | editbmesh_get_x_mirror_vert_topo (Object *ob, BMEditMesh *em, BMVert *eve, int index) |
BMVert * | editbmesh_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) |
MDeformVert * | ED_mesh_active_dvert_get_em (Object *ob, BMVert **r_eve) |
MDeformVert * | ED_mesh_active_dvert_get_ob (Object *ob, int *r_index) |
MDeformVert * | ED_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) |
meshtools.c: no editmode (violated already :), mirror & join), tools operating on meshes
Definition in file meshtools.cc.
MDeformVert* ED_mesh_active_dvert_get_em | ( | Object * | ob, |
BMVert ** | r_eve | ||
) |
Definition at line 1432 of file meshtools.cc.
References BLI_listbase_is_empty(), BMEditMesh::bm, bm, BM_ELEM_CD_GET_VOID_P, BM_mesh_active_vert_get(), CD_MDEFORMVERT, CustomData_get_offset(), Object::data, Mesh::edit_mesh, Object::mode, OB_MESH, OB_MODE_EDIT, Object::type, BMesh::vdata, and Mesh::vertex_group_names.
Referenced by ED_mesh_active_dvert_get_only(), ED_vgroup_vert_active_mirror(), vgroup_copy_active_to_sel(), vgroup_copy_active_to_sel_single(), and vgroup_normalize_active_vertex().
MDeformVert* ED_mesh_active_dvert_get_ob | ( | Object * | ob, |
int * | r_index | ||
) |
Definition at line 1459 of file meshtools.cc.
References BKE_mesh_mselect_active_get(), Object::data, Mesh::dvert, and ME_VSEL.
Referenced by ED_mesh_active_dvert_get_only(), ED_vgroup_vert_active_mirror(), vgroup_copy_active_to_sel(), vgroup_copy_active_to_sel_single(), and vgroup_normalize_active_vertex().
MDeformVert* ED_mesh_active_dvert_get_only | ( | Object * | ob | ) |
Definition at line 1472 of file meshtools.cc.
References ED_mesh_active_dvert_get_em(), ED_mesh_active_dvert_get_ob(), Object::mode, OB_MESH, OB_MODE_EDIT, and Object::type.
Referenced by vgroup_remove_weight(), view3d_panel_vgroup(), and view3d_panel_vgroup_poll().
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().
int ED_mesh_mirror_get_vert | ( | struct Object * | ob, |
int | index | ||
) |
Wrapper for object-mode/edit-mode.
call BM_mesh_elem_table_ensure first for edit-mesh.
Definition at line 986 of file meshtools.cc.
References BMEditMesh::bm, BM_elem_index_get, BM_vert_at_index(), BMVert::co, Object::data, Mesh::edit_mesh, editbmesh_get_x_mirror_vert(), Mesh::editflag, ME_EDIT_MIRROR_TOPO, and mesh_get_x_mirror_vert().
Referenced by ED_vgroup_parray_mirror_assign(), and ED_vgroup_parray_mirror_sync().
Mode is 's' start, or 'e' end, or 'u' use if end, ob can be NULL.
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().
Definition at line 872 of file meshtools.cc.
References ED_mesh_mirrtopo_free(), and mesh_topo_store.
Definition at line 879 of file meshtools.cc.
References ED_mesh_mirror_topo_table_begin(), ED_mesh_mirrtopo_recalc_check(), mesh_mirror_topo_table_get_meshes(), and mesh_topo_store.
Referenced by editbmesh_get_x_mirror_vert_topo(), and mesh_get_x_mirror_vert_topo().
bool ED_mesh_pick_face | ( | struct bContext * | C, |
struct Object * | ob, | ||
const int | mval[2], | ||
uint | dist_px, | ||
uint * | r_index | ||
) |
Face selection in object mode, currently only weight-paint and vertex-paint use this.
Definition at line 1179 of file meshtools.cc.
References BLI_assert, C, CTX_data_ensure_evaluated_depsgraph(), Object::data, depsgraph, ViewContext::depsgraph, DRW_select_buffer_find_nearest_to_point(), DRW_select_buffer_sample_point(), ED_view3d_select_id_validate(), ED_view3d_viewcontext_init(), GS, Mesh::id, ID_ME, ID::name, ViewContext::region, Mesh::totpoly, and ViewContext::v3d.
Referenced by ED_mesh_pick_face_vert(), paintface_mouse_select(), paintface_select_linked(), weight_paint_sample_enum_itemf(), and weight_sample_invoke().
bool ED_mesh_pick_face_vert | ( | struct bContext * | C, |
struct Object * | ob, | ||
const int | mval[2], | ||
uint | dist_px, | ||
uint * | r_index | ||
) |
Use when the back buffer stores face index values. but we want a vert. This gets the face then finds the closest vertex to mval.
Definition at line 1241 of file meshtools.cc.
References BLI_assert, C, CD_MASK_BAREMESH_ORIGINDEX, CD_ORIGINDEX, CTX_data_ensure_evaluated_depsgraph(), CTX_wm_region(), CustomData_get_layer(), Object::data, DEG_get_evaluated_object(), DEG_get_evaluated_scene(), depsgraph, ED_mesh_pick_face(), ed_mesh_pick_face_vert__mpoly_find(), float(), GS, Mesh::id, ID_ME, mesh_get_eval_final(), Mesh::mloop, Mesh::mpoly, Mesh::mvert, ID::name, ORIGINDEX_NONE, Mesh::pdata, Mesh::totpoly, Mesh::totvert, and Mesh::vdata.
Referenced by weight_sample_invoke().
|
static |
Definition at line 1214 of file meshtools.cc.
References MVert::co, ED_view3d_project_float_object(), len_manhattan_v2v2(), MPoly::loopstart, MPoly::totloop, MLoop::v, V3D_PROJ_RET_OK, and V3D_PROJ_TEST_NOP.
Referenced by ED_mesh_pick_face_vert().
bool ED_mesh_pick_vert | ( | bContext * | C, |
Object * | ob, | ||
const int | mval[2], | ||
uint | dist_px, | ||
bool | use_zbuf, | ||
uint * | r_index | ||
) |
Definition at line 1359 of file meshtools.cc.
References BKE_mesh_foreach_mapped_vert(), BLI_assert, C, CD_MASK_BAREMESH, CTX_data_ensure_evaluated_depsgraph(), data, Object::data, DEG_get_evaluated_object(), DEG_get_evaluated_scene(), depsgraph, ViewContext::depsgraph, DRW_select_buffer_find_nearest_to_point(), DRW_select_buffer_sample_point(), ed_mesh_pick_vert__mapFunc(), ED_view3d_init_mats_rv3d(), ED_view3d_select_id_validate(), ED_view3d_viewcontext_init(), float(), GS, Mesh::id, ID_ME, MESH_FOREACH_NOP, mesh_get_eval_final(), Mesh::mvert, ID::name, ViewContext::region, ARegion::regiondata, Mesh::totvert, and ViewContext::v3d.
Referenced by ed_wpaint_vertex_select_pick(), weight_paint_sample_enum_itemf(), and weight_sample_invoke().
|
static |
Definition at line 1340 of file meshtools.cc.
References data, ED_view3d_project_float_object(), len, len_manhattan_v2v2(), ME_HIDE, V3D_PROJ_RET_OK, and V3D_PROJ_TEST_CLIP_DEFAULT.
Referenced by ED_mesh_pick_vert().
int ED_mesh_shapes_join_objects_exec | ( | bContext * | C, |
wmOperator * | op | ||
) |
Definition at line 747 of file meshtools.cc.
References BKE_key_add(), BKE_keyblock_add(), BKE_keyblock_convert_from_mesh(), BKE_mesh_runtime_eval_to_meshkey(), BKE_report(), C, CD_MASK_BAREMESH, CTX_data_active_object(), CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), Object::data, DEG_get_evaluated_object(), DEG_get_evaluated_scene(), DEG_id_tag_update(), depsgraph, Scene::id, ID_RECALC_SELECT, if(), Mesh::key, KEY_RELATIVE, mesh_get_eval_deform(), NC_SCENE, ND_OB_ACTIVE, OB_MESH, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::reports, RPT_WARNING, scene, Mesh::totvert, and WM_event_add_notifier().
Referenced by join_shapes_exec().
void EDBM_mesh_elem_index_ensure_multi | ( | Object ** | objects, |
const uint | objects_len, | ||
const char | htype | ||
) |
Definition at line 1516 of file meshtools.cc.
References BKE_editmesh_from_object(), BMEditMesh::bm, bm, BM_mesh_elem_index_ensure_ex(), and elem_offset().
Referenced by construct_param_handle_multi().
void EDBM_mesh_stats_multi | ( | Object ** | objects, |
const uint | objects_len, | ||
int | totelem[3], | ||
int | totelem_sel[3] | ||
) |
Definition at line 1483 of file meshtools.cc.
References BKE_editmesh_from_object(), BMEditMesh::bm, bm, BMesh::totedge, BMesh::totedgesel, BMesh::totface, BMesh::totfacesel, BMesh::totvert, and BMesh::totvertsel.
Referenced by edbm_delete_loose_exec(), and edbm_tris_convert_to_quads_exec().
BMVert* editbmesh_get_x_mirror_vert | ( | Object * | ob, |
BMEditMesh * | em, | ||
BMVert * | eve, | ||
const float | co[3], | ||
int | index, | ||
const bool | use_topology | ||
) |
Definition at line 977 of file meshtools.cc.
References editbmesh_get_x_mirror_vert_spatial(), and editbmesh_get_x_mirror_vert_topo().
Referenced by ED_mesh_defvert_mirror_update_em(), and ED_mesh_mirror_get_vert().
|
static |
Definition at line 924 of file meshtools.cc.
References BMEditMesh::bm, BM_vert_at_index(), ED_mesh_mirror_spatial_table_lookup(), and CCL_NAMESPACE_BEGIN::isfinite().
Referenced by editbmesh_get_x_mirror_vert().
|
static |
Definition at line 945 of file meshtools.cc.
References BMEditMesh::bm, BM_ITER_MESH, BM_VERTS_OF_MESH, ed_mesh_mirror_topo_table_update(), MirrTopoStore_t::index_lookup, mesh_topo_store, BMesh::totvert, and v.
Referenced by editbmesh_get_x_mirror_vert().
|
static |
Definition at line 62 of file meshtools.cc.
References Freestyle::a, usdtokens::b(), BKE_keyblock_find_name(), BKE_object_defgroup_index_map_apply(), BKE_object_defgroup_index_map_create(), BKE_object_facemap_index_map_apply(), BKE_object_facemap_index_map_create(), BKE_object_material_get(), BLI_assert, Key::block, CD_DEFAULT, CD_FACEMAP, Mesh::cd_flag, CD_MASK_MESH, CD_MDEFORMVERT, MVert::co, copy_v3_v3(), KDL::cos(), CustomData_copy_data_named(), CustomData_get(), CustomData_merge(), KeyBlock::data, Object::data, depsgraph, MLoop::e, ED_object_iter_other(), ED_object_multires_update_totlevels_cb(), Mesh::edata, CustomData_MeshMasks::emask, float(), get_multires_modifier(), Mesh::key, Mesh::ldata, LISTBASE_FOREACH, CustomData_MeshMasks::lmask, MPoly::loopstart, MPoly::mat_nr, MEM_freeN, mul_m4_m4m4(), mul_m4_v3(), multiresModifier_prepare_join(), Object::obmat, Mesh::pdata, CustomData_MeshMasks::pmask, scene, Object::totcol, Mesh::totedge, Mesh::totloop, MultiresModifierData::totlvl, Mesh::totpoly, Mesh::totvert, MLoop::v, MEdge::v1, MEdge::v2, Mesh::vdata, and CustomData_MeshMasks::vmask.
Referenced by ED_mesh_join_objects_exec().
int* mesh_get_x_mirror_faces | ( | struct Object * | ob, |
struct BMEditMesh * | em, | ||
struct Mesh * | me_eval | ||
) |
This is a Mesh-based copy of mesh_get_x_mirror_faces().
Definition at line 1115 of file meshtools.cc.
References Freestyle::a, BLI_assert, BLI_ghash_free(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_new_ex(), Object::data, ED_mesh_mirror_spatial_table_begin(), ED_mesh_mirror_spatial_table_end(), Mesh::editflag, if(), ME_EDIT_MIRROR_TOPO, MEM_callocN, MEM_freeN, mesh_get_x_mirror_vert(), Mesh::mface, mirror_facecmp(), mirror_facehash(), mirror_facerotation(), Mesh::mvert, SWAP, Mesh::totface, Mesh::totvert, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by PE_mirror_x().
int mesh_get_x_mirror_vert | ( | struct Object * | ob, |
struct Mesh * | me_eval, | ||
int | index, | ||
bool | use_topology | ||
) |
Retrieves mirrored cache vert, or NULL if there isn't one.
Definition at line 916 of file meshtools.cc.
References mesh_get_x_mirror_vert_spatial(), and mesh_get_x_mirror_vert_topo().
Referenced by do_weight_paint_vertex_multi(), do_weight_paint_vertex_single(), ED_mesh_defvert_mirror_update_ob(), ED_mesh_mirror_get_vert(), ED_vgroup_mirror(), envelope_bone_weighting(), heat_bone_weighting(), mesh_get_x_mirror_faces(), object_shape_key_mirror(), and weight_paint_set().
Definition at line 893 of file meshtools.cc.
References MVert::co, Object::data, ED_mesh_mirror_spatial_table_lookup(), and Mesh::mvert.
Referenced by mesh_get_x_mirror_vert().
Definition at line 907 of file meshtools.cc.
References ed_mesh_mirror_topo_table_update(), MirrTopoStore_t::index_lookup, mesh, and mesh_topo_store.
Referenced by mesh_get_x_mirror_vert().
Definition at line 286 of file meshtools.cc.
References blender::math::abs(), CD_SCULPT_FACE_SETS, CustomData_get_layer(), max_ii(), mesh, Mesh::pdata, and Mesh::totpoly.
Referenced by ED_mesh_join_objects_exec().
BLI_INLINE void mesh_mirror_topo_table_get_meshes | ( | Object * | ob, |
Mesh * | me_eval, | ||
Mesh ** | r_me_mirror, | ||
BMEditMesh ** | r_em_mirror | ||
) |
Definition at line 840 of file meshtools.cc.
References Object::data, and Mesh::edit_mesh.
Referenced by ED_mesh_mirror_topo_table_begin(), and ed_mesh_mirror_topo_table_update().
Definition at line 1110 of file meshtools.cc.
References Freestyle::a, usdtokens::b(), and mirror_facerotation().
Referenced by mesh_get_x_mirror_faces().
Definition at line 1079 of file meshtools.cc.
References Freestyle::a, and usdtokens::b().
Referenced by mesh_get_x_mirror_faces(), and mirror_facecmp().
|
static |
Definition at line 838 of file meshtools.cc.
Referenced by ED_mesh_mirror_topo_table_begin(), ED_mesh_mirror_topo_table_end(), ed_mesh_mirror_topo_table_update(), ED_mesh_mirrtopo_free(), ED_mesh_mirrtopo_init(), ED_mesh_mirrtopo_recalc_check(), EDBM_verts_mirror_cache_begin_ex(), editbmesh_get_x_mirror_vert_topo(), and mesh_get_x_mirror_vert_topo().