|
Blender V5.0
|
#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 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) |
| 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) |
| 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) |
| 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) |
meshtools.cc: no editmode (violated already :), mirror & join), tools operating on meshes
Definition in file meshtools.cc.
| using blender::float3 |
Definition at line 619 of file BLI_math_vector_types.hh.
| using blender::int2 |
Definition at line 601 of file BLI_math_vector_types.hh.
|
static |
Definition at line 73 of file meshtools.cc.
References blender::StringRef::drop_suffix(), and blender::StringRefBase::endswith().
Referenced by ED_mesh_shapes_join_objects_exec().
| MDeformVert * ED_mesh_active_dvert_get_em | ( | Object * | ob, |
| BMVert ** | r_eve ) |
Definition at line 852 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, Mesh::runtime, Object::type, and Mesh::vertex_group_names.
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 879 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 893 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_mirror_get_vert | ( | Object * | ob, |
| int | index ) |
Wrapper for object-mode/edit-mode.
call BM_mesh_elem_table_ensure first for edit-mesh.
Definition at line 372 of file meshtools.cc.
References BM_elem_index_get, BM_vert_at_index(), BMVert::co, Object::data, editbmesh_get_x_mirror_vert(), Mesh::editflag, ME_EDIT_MIRROR_TOPO, mesh_get_x_mirror_vert(), and Mesh::runtime.
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 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().
| void ED_mesh_mirror_topo_table_end | ( | Object * | ob | ) |
Definition at line 258 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 265 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_edge | ( | bContext * | C, |
| Object * | ob, | ||
| const int | mval[2], | ||
| uint | dist_px, | ||
| uint * | r_index ) |
Used for paint face loop selection which needs to get closest edge even though in face select mode. Changes the select_buffer context to edge selection for this.
Definition at line 701 of file meshtools.cc.
References BKE_view_layer_base_find(), BLI_assert, C, CTX_data_ensure_evaluated_depsgraph(), Object::data, depsgraph, ViewContext::depsgraph, DRW_select_buffer_context_create(), DRW_select_buffer_find_nearest_to_point(), DRW_select_buffer_sample_point(), ED_view3d_select_id_validate(), ED_view3d_viewcontext_init(), Mesh::edges_num, GS, Mesh::id, ID_ME, ID::name, ViewContext::obact, ORIGINDEX_NONE, ViewContext::region, SCE_SELECT_EDGE, ViewContext::v3d, and ViewContext::view_layer.
Referenced by paintface_select_loop().
| 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 567 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(), Mesh::faces_num, GS, Mesh::id, ID_ME, ID::name, ViewContext::region, and ViewContext::v3d.
Referenced by ED_mesh_pick_face_vert(), paintface_mouse_select(), paintface_select_linked(), 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 627 of file meshtools.cc.
References BKE_object_get_evaluated_mesh(), BLI_assert, C, CD_ORIGINDEX, CTX_data_ensure_evaluated_depsgraph(), CTX_wm_region(), CustomData_get_layer(), blender::Span< T >::data(), Object::data, DEG_get_evaluated(), depsgraph, ED_mesh_pick_face(), ed_mesh_pick_face_vert__mpoly_find(), Mesh::face_data, faces, float, FLT_MAX, GS, i, Mesh::id, ID_ME, ID::name, ORIGINDEX_NONE, and Mesh::vert_data.
Referenced by weight_sample_invoke().
|
static |
Definition at line 601 of file meshtools.cc.
References ED_view3d_project_float_object(), len_manhattan_v2v2(), blender::IndexRange::size(), 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 780 of file meshtools.cc.
References Geometry::attributes, BKE_mesh_foreach_mapped_vert(), BKE_object_get_evaluated_mesh(), BLI_assert, C, CTX_data_ensure_evaluated_depsgraph(), data, Object::data, DEG_get_evaluated(), 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, Mesh::id, ID_ME, blender::bke::AttributeAccessor::lookup(), MESH_FOREACH_NOP, ID::name, blender::bke::Point, ViewContext::region, ARegion::regiondata, ViewContext::v3d, and Mesh::verts_num.
Referenced by ed_wpaint_vertex_select_pick(), paintvert_select_linked_pick(), weight_sample_group_invoke(), and weight_sample_invoke().
|
static |
Definition at line 760 of file meshtools.cc.
References data, 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().
| wmOperatorStatus ED_mesh_shapes_join_objects_exec | ( | bContext * | C, |
| const bool | ensure_keys_exist, | ||
| const bool | mirror, | ||
| ReportList * | reports ) |
Definition at line 88 of file meshtools.cc.
References Vector< T, InlineBufferCapacity, Allocator >::append(), b, BKE_id_name(), BKE_key_add(), BKE_keyblock_add(), BKE_keyblock_convert_from_mesh(), BKE_keyblock_find_name(), BKE_keyblock_update_from_mesh(), BKE_object_get_evaluated_mesh(), BKE_report(), BKE_reportf(), C, create_mirrored_name(), CTX_data_active_object(), CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), Object::data, DEG_get_evaluated(), DEG_id_tag_update(), DEG_relations_tag_update(), depsgraph, ED_mesh_report_mirror_ex(), Mesh::id, ID_RECALC_GEOMETRY, Vector< T, InlineBufferCapacity, Allocator >::is_empty(), Mesh::key, KEY_RELATIVE, name, NC_GEOM, ND_DATA, OB_MESH, OPERATOR_CANCELLED, OPERATOR_FINISHED, RPT_ERROR, RPT_INFO, RPT_WARNING, SCE_SELECT_VERTEX, blender::ed::object::shape_key_mirror(), Key::type, Mesh::verts_num, and WM_main_add_notifier().
Referenced by blender::ed::object::join_shapes_exec(), and blender::ed::object::update_all_shape_keys_exec().
Definition at line 933 of file meshtools.cc.
References BKE_editmesh_from_object(), bm, BMEditMesh::bm, and BM_mesh_elem_index_ensure_ex().
Definition at line 904 of file meshtools.cc.
References BKE_editmesh_from_object(), bm, and BMEditMesh::bm.
| 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 363 of file meshtools.cc.
References editbmesh_get_x_mirror_vert_spatial(), and editbmesh_get_x_mirror_vert_topo().
Referenced by ED_mesh_mirror_get_vert(), and blender::ed::object::mesh_defvert_mirror_update_em().
|
static |
Definition at line 310 of file meshtools.cc.
References BMEditMesh::bm, BM_vert_at_index(), ED_mesh_mirror_spatial_table_lookup(), and i.
Referenced by editbmesh_get_x_mirror_vert().
|
static |
Definition at line 331 of file meshtools.cc.
References BMEditMesh::bm, BM_ITER_MESH, BM_VERTS_OF_MESH, ed_mesh_mirror_topo_table_update(), mesh_topo_store, BMesh::totvert, and v.
Referenced by editbmesh_get_x_mirror_vert().
| 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 500 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(), Mesh::editflag, i, blender::Span< T >::index_range(), ME_EDIT_MIRROR_TOPO, MEM_calloc_arrayN(), MEM_freeN(), 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 302 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_mirror_get_vert(), envelope_bone_weighting(), heat_bone_weighting(), blender::ed::object::mesh_defvert_mirror_update_ob(), mesh_get_x_mirror_faces(), blender::ed::object::shape_key_mirror(), blender::ed::object::vgroup_mirror(), and weight_paint_set().
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().
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().
| 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 226 of file meshtools.cc.
References BLI_INLINE, Object::data, and Mesh::runtime.
Referenced by ED_mesh_mirror_topo_table_begin(), and ed_mesh_mirror_topo_table_update().
| void MESH_OT_reorder_vertices_spatial | ( | wmOperatorType * | ot | ) |
Definition at line 987 of file meshtools.cc.
References mesh_reorder_vertices_spatial_exec(), mesh_reorder_vertices_spatial_poll(), OPTYPE_REGISTER, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_mesh().
|
static |
Definition at line 942 of file meshtools.cc.
References BKE_report(), C, blender::ed::object::context_active_object(), CTX_data_scene(), Object::data, DEG_id_tag_update(), Mesh::faces_num, Mesh::flag, blender::ed::sculpt_paint::undo::geometry_begin(), blender::ed::sculpt_paint::undo::geometry_end(), Object::id, ID_RECALC_GEOMETRY, ME_SCULPT_DYNAMIC_TOPOLOGY, blender::bke::mesh_apply_spatial_organization(), Object::mode, NC_OBJECT, ND_MODIFIER, OB_MODE_SCULPT, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::reports, RPT_INFO, Mesh::verts_num, and WM_event_add_notifier().
Referenced by MESH_OT_reorder_vertices_spatial().
|
static |
Definition at line 977 of file meshtools.cc.
References C, blender::ed::object::context_active_object(), OB_MESH, and Object::type.
Referenced by MESH_OT_reorder_vertices_spatial().
|
static |
Definition at line 495 of file meshtools.cc.
References b, and mirror_facerotation().
Referenced by mesh_get_x_mirror_faces().
|
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().
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().
|
static |
Definition at line 224 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().