|
Blender V4.3
|
#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 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 (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) |
| 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) |
| 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 (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) |
meshtools.cc: 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 1408 of file meshtools.cc.
References BLI_listbase_is_empty(), bm, BM_ELEM_CD_GET_VOID_P, BM_mesh_active_vert_get(), CD_MDEFORMVERT, CustomData_get_offset(), Object::data, Object::mode, OB_MESH, OB_MODE_EDIT, Object::type, and BMesh::vdata.
Referenced by ED_mesh_active_dvert_get_only(), blender::ed::object::vgroup_copy_active_to_sel(), blender::ed::object::vgroup_copy_active_to_sel_single(), blender::ed::object::vgroup_normalize_active_vertex(), and blender::ed::object::vgroup_vert_active_mirror().
| MDeformVert * ED_mesh_active_dvert_get_ob | ( | Object * | ob, |
| int * | r_index ) |
Definition at line 1435 of file meshtools.cc.
References BKE_mesh_mselect_active_get(), Object::data, and ME_VSEL.
Referenced by ED_mesh_active_dvert_get_only(), blender::ed::object::vgroup_copy_active_to_sel(), blender::ed::object::vgroup_copy_active_to_sel_single(), blender::ed::object::vgroup_normalize_active_vertex(), and blender::ed::object::vgroup_vert_active_mirror().
| MDeformVert * ED_mesh_active_dvert_get_only | ( | Object * | ob | ) |
Definition at line 1449 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 update_active_vertex_weight(), blender::ed::object::vgroup_remove_weight(), view3d_panel_vgroup(), and view3d_panel_vgroup_poll().
| 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().
Wrapper for object-mode/edit-mode.
call BM_mesh_elem_table_ensure first for edit-mesh.
Definition at line 971 of file meshtools.cc.
References BM_elem_index_get, BM_vert_at_index(), BMVert::co, Object::data, editbmesh_get_x_mirror_vert(), ME_EDIT_MIRROR_TOPO, and mesh_get_x_mirror_vert().
Referenced by blender::ed::object::vgroup_parray_mirror_assign(), and blender::ed::object::vgroup_parray_mirror_sync().
Mode is 's' start, or 'e' end, or 'u' use if end, ob can be NULL.
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().
| void ED_mesh_mirror_topo_table_end | ( | Object * | ob | ) |
Definition at line 857 of file meshtools.cc.
References ED_mesh_mirrtopo_free(), and mesh_topo_store.
Referenced by ED_editors_exit(), EDBM_mesh_free_data(), blender::ed::object::editmode_load_free_ex(), and blender::ed::sculpt_paint::vwpaint::mode_exit_generic().
Definition at line 864 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 | ( | bContext * | C, |
| 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 1166 of file meshtools.cc.
References BLI_assert, 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, ID_ME, ViewContext::region, and ViewContext::v3d.
Referenced by ED_mesh_pick_face_vert(), paintface_mouse_select(), paintface_select_linked(), paintface_select_loop(), weight_sample_group_invoke(), and weight_sample_invoke().
| bool ED_mesh_pick_face_vert | ( | bContext * | C, |
| 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 1226 of file meshtools.cc.
References BKE_object_get_evaluated_mesh(), BLI_assert, CD_ORIGINDEX, CTX_data_ensure_evaluated_depsgraph(), CTX_wm_region(), CustomData_get_layer(), blender::Span< T >::data(), Object::data, DEG_get_evaluated_object(), depsgraph, ED_mesh_pick_face(), ed_mesh_pick_face_vert__mpoly_find(), Mesh::face_data, float, FLT_MAX, GS, ID_ME, ORIGINDEX_NONE, and Mesh::vert_data.
Referenced by weight_sample_invoke().
|
static |
Definition at line 1200 of file meshtools.cc.
References ED_view3d_project_float_object(), len_manhattan_v2v2(), 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 1336 of file meshtools.cc.
References BKE_mesh_foreach_mapped_vert(), BKE_object_get_evaluated_mesh(), BLI_assert, CTX_data_ensure_evaluated_depsgraph(), Object::data, DEG_get_evaluated_object(), 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, FLT_MAX, GS, ID_ME, blender::bke::AttributeAccessor::lookup(), MESH_FOREACH_NOP, ViewContext::region, and ViewContext::v3d.
Referenced by ed_wpaint_vertex_select_pick(), paintvert_select_linked_pick(), weight_sample_group_invoke(), and weight_sample_invoke().
|
static |
Definition at line 1316 of file meshtools.cc.
References ED_view3d_project_float_object(), len, len_manhattan_v2v2(), 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 731 of file meshtools.cc.
References BKE_key_add(), BKE_keyblock_add(), BKE_keyblock_convert_from_mesh(), BKE_report(), 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, Key::id, ID_RECALC_SELECT, KEY_RELATIVE, blender::bke::mesh_eval_to_meshkey(), blender::bke::mesh_get_eval_deform(), ID::name, NC_SCENE, ND_OB_ACTIVE, OB_MESH, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::reports, RPT_WARNING, Key::type, Mesh::verts_num, and WM_event_add_notifier().
Referenced by blender::ed::object::join_shapes_exec().
Definition at line 1489 of file meshtools.cc.
References BKE_editmesh_from_object(), bm, BMEditMesh::bm, and BM_mesh_elem_index_ensure_ex().
Definition at line 1460 of file meshtools.cc.
References BKE_editmesh_from_object(), bm, BMEditMesh::bm, BMesh::totedge, BMesh::totedgesel, BMesh::totface, BMesh::totfacesel, BMesh::totvert, and BMesh::totvertsel.
| 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 962 of file meshtools.cc.
References editbmesh_get_x_mirror_vert_spatial(), and editbmesh_get_x_mirror_vert_topo().
Referenced by blender::ed::object::ED_mesh_defvert_mirror_update_em(), and ED_mesh_mirror_get_vert().
|
static |
Definition at line 909 of file meshtools.cc.
References BMEditMesh::bm, BM_vert_at_index(), and ED_mesh_mirror_spatial_table_lookup().
Referenced by editbmesh_get_x_mirror_vert().
|
static |
Definition at line 930 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 70 of file meshtools.cc.
References b, BKE_keyblock_find_name(), BKE_object_defgroup_index_map_apply(), BKE_object_defgroup_index_map_create(), BKE_object_material_get(), BLI_assert, Key::block, CD_MASK_MESH, CD_MDEFORMVERT, CD_PROP_INT32, CD_SET_DEFAULT, copy_v3_v3(), cos(), CustomData_add_layer_named(), CustomData_copy_data_named(), CustomData_get_for_write(), CustomData_get_layer(), CustomData_get_layer_named_for_write(), CustomData_merge_layout(), KeyBlock::data, Object::data, depsgraph, CustomData_MeshMasks::emask, float, get_multires_modifier(), blender::ed::object::iter_other(), LISTBASE_FOREACH, CustomData_MeshMasks::lmask, MEM_freeN(), mul_m4_m4m4(), mul_m4_v3(), blender::ed::object::multires_update_totlevels(), multiresModifier_prepare_join(), CustomData_MeshMasks::pmask, Object::totcol, MultiresModifierData::totlvl, and CustomData_MeshMasks::vmask.
Referenced by ED_mesh_join_objects_exec().
| int * mesh_get_x_mirror_faces | ( | Object * | ob, |
| BMEditMesh * | em, | ||
| Mesh * | mesh_eval ) |
This is a Mesh-based copy of mesh_get_x_mirror_faces().
Definition at line 1099 of file meshtools.cc.
References BLI_assert, BLI_ghash_free(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_new_ex(), CD_MFACE, CustomData_get_layer(), Object::data, ED_mesh_mirror_spatial_table_begin(), ED_mesh_mirror_spatial_table_end(), blender::Span< T >::index_range(), ME_EDIT_MIRROR_TOPO, MEM_callocN, MEM_freeN(), mesh, mesh_get_x_mirror_vert(), mirror_facecmp(), mirror_facehash(), mirror_facerotation(), Mesh::totface_legacy, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and Mesh::verts_num.
Referenced by PE_mirror_x().
Retrieves mirrored cache vert, or NULL if there isn't one.
Definition at line 901 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(), blender::ed::object::ED_mesh_defvert_mirror_update_ob(), ED_mesh_mirror_get_vert(), envelope_bone_weighting(), heat_bone_weighting(), mesh_get_x_mirror_faces(), blender::ed::object::object_shape_key_mirror(), blender::ed::object::vgroup_mirror(), and weight_paint_set().
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().
Definition at line 892 of file meshtools.cc.
References ed_mesh_mirror_topo_table_update(), MirrTopoStore_t::index_lookup, and mesh_topo_store.
Referenced by mesh_get_x_mirror_vert().
Definition at line 295 of file meshtools.cc.
References blender::bke::SpanAttributeWriter< T >::finish(), max_ii(), and blender::bke::SpanAttributeWriter< T >::span.
Referenced by ED_mesh_join_objects_exec().
| 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().
|
static |
Definition at line 1094 of file meshtools.cc.
References b, and mirror_facerotation().
Referenced by mesh_get_x_mirror_faces().
|
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().
Definition at line 1063 of file meshtools.cc.
References b.
Referenced by mesh_get_x_mirror_faces(), and mirror_facecmp().
|
static |
Definition at line 823 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().