Blender  V3.3
editmesh_select_similar.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_bitmap.h"
#include "BLI_kdtree.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLT_translation.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_layer.h"
#include "BKE_material.h"
#include "BKE_report.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "mesh_intern.h"

Go to the source code of this file.

Functions

Select Similar Vert
static int similar_vert_select_exec (bContext *C, wmOperator *op)
 
Select Similar Operator
static int edbm_select_similar_exec (bContext *C, wmOperator *op)
 
static const EnumPropertyItemselect_similar_type_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
 
static bool edbm_select_similar_poll_property (const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop)
 
void MESH_OT_select_similar (wmOperatorType *ot)
 

Select Similar Face

enum  { SIMFACE_DATA_NONE = 0 , SIMFACE_DATA_TRUE = (1 << 0) , SIMFACE_DATA_FALSE = (1 << 1) , SIMFACE_DATA_ALL = (SIMFACE_DATA_TRUE | SIMFACE_DATA_FALSE) }
 
static bool face_data_value_set (BMFace *face, const int hflag, int *r_value)
 
static void face_to_plane (const Object *ob, BMFace *face, float r_plane[4])
 
static int similar_face_select_exec (bContext *C, wmOperator *op)
 

Select Similar Edge

enum  { SIMEDGE_DATA_NONE = 0 , SIMEDGE_DATA_TRUE = (1 << 0) , SIMEDGE_DATA_FALSE = (1 << 1) , SIMEDGE_DATA_ALL = (SIMEDGE_DATA_TRUE | SIMEDGE_DATA_FALSE) }
 
static void edge_pos_direction_worldspace_get (Object *ob, BMEdge *edge, float *r_dir)
 
static float edge_length_squared_worldspace_get (Object *ob, BMEdge *edge)
 
static bool edge_data_value_set (BMEdge *edge, const int hflag, int *r_value)
 
static int similar_edge_select_exec (bContext *C, wmOperator *op)
 

Select Similar (Vert/Edge/Face) Operator - common

static const EnumPropertyItem prop_similar_compare_types []
 
static const EnumPropertyItem prop_similar_types []
 
static int mesh_select_similar_compare_int (const int delta, const int compare)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SIMFACE_DATA_NONE 
SIMFACE_DATA_TRUE 
SIMFACE_DATA_FALSE 
SIMFACE_DATA_ALL 

Definition at line 107 of file editmesh_select_similar.c.

◆ anonymous enum

anonymous enum
Enumerator
SIMEDGE_DATA_NONE 
SIMEDGE_DATA_TRUE 
SIMEDGE_DATA_FALSE 
SIMEDGE_DATA_ALL 

Definition at line 594 of file editmesh_select_similar.c.

Function Documentation

◆ edbm_select_similar_exec()

static int edbm_select_similar_exec ( bContext C,
wmOperator op 
)
static

◆ edbm_select_similar_poll_property()

static bool edbm_select_similar_poll_property ( const bContext UNUSEDC,
wmOperator op,
const PropertyRNA prop 
)
static

◆ edge_data_value_set()

static bool edge_data_value_set ( BMEdge edge,
const int  hflag,
int *  r_value 
)
static

Return true if we still don't know the final value for this edge data. In other words, if we need to keep iterating over the objects or we can just go ahead and select all the objects.

Definition at line 606 of file editmesh_select_similar.c.

References BM_elem_flag_test, SIMEDGE_DATA_ALL, SIMEDGE_DATA_FALSE, and SIMEDGE_DATA_TRUE.

Referenced by similar_edge_select_exec().

◆ edge_length_squared_worldspace_get()

static float edge_length_squared_worldspace_get ( Object ob,
BMEdge edge 
)
static

Definition at line 584 of file editmesh_select_similar.c.

References len_squared_v3v3(), mul_v3_mat3_m4v3(), Object::obmat, v1, and v2.

Referenced by similar_edge_select_exec().

◆ edge_pos_direction_worldspace_get()

static void edge_pos_direction_worldspace_get ( Object ob,
BMEdge edge,
float r_dir 
)
static

NOTE: This is not normal, but the edge direction itself and always in a positive quadrant (tries z, y then x). Therefore we need to use the entire object transformation matrix.

Definition at line 555 of file editmesh_select_similar.c.

References copy_v3_v3(), fabs(), mul_m4_v3(), mul_v3_fl(), normalize_v3(), Object::obmat, sub_v3_v3v3(), v1, and v2.

Referenced by similar_edge_select_exec().

◆ face_data_value_set()

static bool face_data_value_set ( BMFace face,
const int  hflag,
int *  r_value 
)
static

Return true if we still don't know the final value for this edge data. In other words, if we need to keep iterating over the objects or we can just go ahead and select all the objects.

Definition at line 119 of file editmesh_select_similar.c.

References BM_elem_flag_test, SIMFACE_DATA_ALL, SIMFACE_DATA_FALSE, and SIMFACE_DATA_TRUE.

Referenced by similar_face_select_exec().

◆ face_to_plane()

static void face_to_plane ( const Object ob,
BMFace face,
float  r_plane[4] 
)
static

◆ MESH_OT_select_similar()

void MESH_OT_select_similar ( wmOperatorType ot)

◆ mesh_select_similar_compare_int()

static int mesh_select_similar_compare_int ( const int  delta,
const int  compare 
)
static

◆ select_similar_type_itemf()

static const EnumPropertyItem* select_similar_type_itemf ( bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
bool r_free 
)
static

◆ similar_edge_select_exec()

static int similar_edge_select_exec ( bContext C,
wmOperator op 
)
static

Definition at line 621 of file editmesh_select_similar.c.

References angle(), angle_normalized_v3v3(), BKE_editmesh_from_object(), BKE_report(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BLI_assert, BLI_gset_add(), BLI_gset_free(), BLI_gset_ptr_new(), BLI_gsetIterator_getKey(), BMEditMesh::bm, bm, BM_edge_calc_face_angle_with_imat3(), BM_edge_face_count(), BM_edge_face_count_at_most(), BM_edge_select_set(), BM_EDGES_OF_MESH, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_ELEM_SEAM, BM_ELEM_SELECT, BM_ELEM_SMOOTH, BM_ITER_MESH, C, CD_BWEIGHT, CD_CREASE, CD_FREESTYLE_EDGE, copy_m3_m4(), CTX_data_view_layer(), CTX_wm_view3d(), CustomData_bmesh_get(), CustomData_has_layer(), Object::data, ED_select_similar_compare_float_tree(), BMesh::edata, EDBM_selectmode_flush(), EDBM_update(), edge_data_value_set(), edge_length_squared_worldspace_get(), edge_pos_direction_worldspace_get(), ELEM, FreestyleEdge::flag, float(), FREESTYLE_EDGE_MARK, GSET_ITER, invert_m3_m3(), blender::math::length(), M_PI, MEM_freeN, mesh_select_similar_compare_int(), NULL, Object::obmat, OPERATOR_CANCELLED, OPERATOR_FINISHED, POINTER_AS_INT, POINTER_FROM_INT, wmOperator::ptr, wmOperator::reports, RNA_enum_get(), RNA_float_get(), RPT_ERROR, select(), SIM_CMP_EQ, SIMEDGE_BEVEL, SIMEDGE_CREASE, SIMEDGE_DATA_ALL, SIMEDGE_DATA_FALSE, SIMEDGE_DATA_NONE, SIMEDGE_DATA_TRUE, SIMEDGE_DIR, SIMEDGE_FACE, SIMEDGE_FACE_ANGLE, SIMEDGE_FREESTYLE, SIMEDGE_LENGTH, SIMEDGE_SEAM, SIMEDGE_SHARP, BMesh::totedgesel, and type.

Referenced by edbm_select_similar_exec().

◆ similar_face_select_exec()

static int similar_face_select_exec ( bContext C,
wmOperator op 
)
static

Definition at line 148 of file editmesh_select_similar.c.

References angle_normalized_v3v3(), angle_v3v3(), blender::compositor::area(), BKE_editmesh_from_object(), BKE_object_material_array_p(), BKE_report(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BLI_assert, BLI_gset_add(), BLI_gset_free(), BLI_gset_ptr_new(), BLI_gsetIterator_getKey(), BMEditMesh::bm, bm, BM_ELEM_CD_GET_VOID_P, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_ELEM_SELECT, BM_ELEM_SMOOTH, BM_face_calc_area_with_mat3(), BM_face_calc_perimeter_with_mat3(), BM_face_select_set(), BM_FACES_OF_MESH, BM_ITER_MESH, C, CD_FACEMAP, CD_FREESTYLE_FACE, copy_m3_m4(), copy_v3_v3(), CTX_data_view_layer(), CTX_wm_view3d(), CustomData_bmesh_get(), CustomData_get_offset(), CustomData_has_layer(), BMHeader::data, Object::data, ED_select_similar_compare_float_tree(), EDBM_selectmode_flush(), EDBM_update(), ELEM, fabsf, face_data_value_set(), face_to_plane(), FreestyleFace::flag, float(), FREESTYLE_FACE_MARK, GSET_ITER, BMFace::head, Object::imat, invert_m4_m4(), BMFace::len, M_PI, BMFace::mat_nr, material, MEM_callocN, MEM_freeN, mesh_select_similar_compare_int(), mul_transposed_mat3_m4_v3(), BMFace::no, normal, normalize_v3(), NULL, Object::obmat, OPERATOR_CANCELLED, OPERATOR_FINISHED, BMesh::pdata, POINTER_AS_INT, POINTER_FROM_INT, wmOperator::ptr, wmOperator::reports, RNA_enum_get(), RNA_float_get(), RPT_ERROR, select(), SIMFACE_AREA, SIMFACE_COPLANAR, SIMFACE_DATA_ALL, SIMFACE_DATA_FALSE, SIMFACE_DATA_NONE, SIMFACE_DATA_TRUE, SIMFACE_FACEMAP, SIMFACE_FREESTYLE, SIMFACE_MATERIAL, SIMFACE_NORMAL, SIMFACE_PERIMETER, SIMFACE_SIDES, SIMFACE_SMOOTH, Object::totcol, BMesh::totfacesel, and type.

Referenced by edbm_select_similar_exec().

◆ similar_vert_select_exec()

static int similar_vert_select_exec ( bContext C,
wmOperator op 
)
static

Definition at line 971 of file editmesh_select_similar.c.

References angle_normalized_v3v3(), BKE_editmesh_from_object(), BKE_object_defgroup_count(), BKE_object_defgroup_list(), BKE_report(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, BLI_findstringindex(), BLI_gset_add(), BLI_gset_free(), BLI_gset_len(), BLI_gset_ptr_new(), BLI_gset_str_new(), BLI_gsetIterator_getKey(), BLI_listbase_count(), BMEditMesh::bm, bm, BM_ELEM_CD_GET_VOID_P, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_ELEM_SELECT, BM_ITER_MESH, BM_vert_edge_count(), BM_vert_face_count(), BM_vert_select_set(), BM_VERTS_OF_MESH, C, CD_CREASE, CD_MDEFORMVERT, copy_v3_v3(), CTX_data_view_layer(), CTX_wm_view3d(), CustomData_bmesh_get(), CustomData_get_offset(), CustomData_has_layer(), BMHeader::data, Object::data, MDeformWeight::def_nr, MDeformVert::dw, ED_select_similar_compare_float_tree(), EDBM_selectmode_flush(), EDBM_update(), float(), GSET_ITER, BMVert::head, Object::imat, invert_m4_m4(), LIKELY, LISTBASE_FOREACH, M_PI, MEM_freeN, mesh_select_similar_compare_int(), mul_transposed_mat3_m4_v3(), BMVert::no, normal, normalize_v3(), NULL, Object::obmat, OPERATOR_CANCELLED, OPERATOR_FINISHED, POINTER_AS_INT, POINTER_FROM_INT, wmOperator::ptr, wmOperator::reports, RNA_enum_get(), RNA_float_get(), RPT_ERROR, RPT_INFO, select(), SIMVERT_CREASE, SIMVERT_EDGE, SIMVERT_FACE, SIMVERT_NORMAL, SIMVERT_VGROUP, BMesh::totvertsel, MDeformVert::totweight, type, BMesh::vdata, and MDeformWeight::weight.

Referenced by edbm_select_similar_exec().

Variable Documentation

◆ prop_similar_compare_types

const EnumPropertyItem prop_similar_compare_types[]
static
Initial value:
= {
{SIM_CMP_EQ, "EQUAL", 0, "Equal", ""},
{SIM_CMP_GT, "GREATER", 0, "Greater", ""},
{SIM_CMP_LT, "LESS", 0, "Less", ""},
{0, NULL, 0, NULL, NULL},
}
@ SIM_CMP_LT
@ SIM_CMP_GT
@ SIM_CMP_EQ

Definition at line 44 of file editmesh_select_similar.c.

Referenced by MESH_OT_select_similar().

◆ prop_similar_types

const EnumPropertyItem prop_similar_types[]
static

Definition at line 52 of file editmesh_select_similar.c.

Referenced by MESH_OT_select_similar(), and select_similar_type_itemf().