62 if (
G.moving ==
false) {
108 const bool is_ctrl_pressed = (
event->modifier &
KM_CTRL) != 0;
109 const bool is_shift_pressed = (
event->modifier &
KM_SHIFT) != 0;
111 if (is_ctrl_pressed && !is_shift_pressed) {
114 if (!is_ctrl_pressed && is_shift_pressed) {
143 int base_index_vert = -1;
144 int base_index_edge = -1;
145 int base_index_face = -1;
164 best.ele = (
BMElem *)efa_test;
165 best.base_index = base_index_face;
172 best.ele = (
BMElem *)eed_test;
173 best.base_index = base_index_edge;
182 float vert_p_co[2], vert_co[3];
188 best.ele = (
BMElem *)eve_test;
189 best.base_index = base_index_vert;
193 best.ele = (
BMElem *)eve_test;
194 best.base_index = base_index_vert;
201 Base *base = gz_ele->
bases[best.base_index];
218 if (best.ele->head.htype ==
BM_VERT) {
221 else if (best.ele->head.htype ==
BM_EDGE) {
224 else if (best.ele->head.htype ==
BM_FACE) {
288 gzt->
idname =
"GIZMO_GT_mesh_preselect_elem_3d";
299 RNA_def_int(gzt->
srna,
"object_index", -1, -1, INT_MAX,
"Object Index",
"", -1, INT_MAX);
300 RNA_def_int(gzt->
srna,
"vert_index", -1, -1, INT_MAX,
"Vert Index",
"", -1, INT_MAX);
301 RNA_def_int(gzt->
srna,
"edge_index", -1, -1, INT_MAX,
"Edge Index",
"", -1, INT_MAX);
302 RNA_def_int(gzt->
srna,
"face_index", -1, -1, INT_MAX,
"Face Index",
"", -1, INT_MAX);
374 best.base_index = base_index;
400 bool is_alloc =
false;
402 vc.
depsgraph, em_eval, scene_eval, ob_eval,
NULL, &is_alloc);
450 gzt->
idname =
"GIZMO_GT_mesh_preselect_edgering_3d";
461 RNA_def_int(gzt->
srna,
"object_index", -1, -1, INT_MAX,
"Object Index",
"", -1, INT_MAX);
462 RNA_def_int(gzt->
srna,
"edge_index", -1, -1, INT_MAX,
"Edge Index",
"", -1, INT_MAX);
502 if (object_index < bases_len) {
503 base = bases[object_index];
525 if (vert_index != -1) {
528 else if (edge_index != -1) {
531 else if (face_index != -1) {
546 else if (
STREQ(gz->
type->
idname,
"GIZMO_GT_mesh_preselect_edgering_3d")) {
555 const char *prop_ids[] = {
"object_index",
"vert_index",
"edge_index",
"face_index"};
556 for (
int i = 0; i <
ARRAY_SIZE(prop_ids); i++) {
typedef float(TangentPoint)[2]
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
const float(* BKE_editmesh_vert_coords_when_deformed(struct Depsgraph *depsgraph, struct BMEditMesh *em, struct Scene *scene, struct Object *obedit, int *r_vert_len, bool *r_is_alloc))[3]
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
#define BKE_view_layer_array_from_bases_in_edit_mode(view_layer, v3d, r_len)
#define BLI_assert_unreachable()
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
struct Depsgraph Depsgraph
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
void EDBM_preselect_elem_update_preview(struct EditMesh_PreSelElem *psel, struct ViewContext *vc, struct BMesh *bm, struct BMElem *ele, const int mval[2])
void EDBM_preselect_elem_destroy(struct EditMesh_PreSelElem *psel)
bool EDBM_unified_findnearest_from_raycast(struct ViewContext *vc, struct Base **bases, uint bases_len, bool use_boundary_vertices, bool use_boundary_edges, int *r_base_index_vert, int *r_base_index_edge, int *r_base_index_face, struct BMVert **r_eve, struct BMEdge **r_eed, struct BMFace **r_efa)
void EDBM_preselect_elem_draw(struct EditMesh_PreSelElem *psel, const float matrix[4][4])
void EDBM_preselect_edgering_destroy(struct EditMesh_PreSelEdgeRing *psel)
@ PRESELECT_ACTION_CREATE
@ PRESELECT_ACTION_DELETE
@ PRESELECT_ACTION_TRANSFORM
void EDBM_preselect_edgering_clear(struct EditMesh_PreSelEdgeRing *psel)
void EDBM_preselect_action_set(struct EditMesh_PreSelElem *psel, eEditMesh_PreSelPreviewAction action)
eEditMesh_PreSelPreviewAction EDBM_preselect_action_get(struct EditMesh_PreSelElem *psel)
void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc)
struct BMEdge * EDBM_edge_find_nearest_ex(struct ViewContext *vc, float *dist_px_manhattan, float *r_dist_center, bool use_select_bias, bool use_cycle, struct BMEdge **r_eed_zbuf, struct Base **bases, uint bases_len, uint *r_base_index)
void EDBM_preselect_elem_clear(struct EditMesh_PreSelElem *psel)
struct EditMesh_PreSelEdgeRing * EDBM_preselect_edgering_create(void)
void EDBM_preselect_elem_update_from_single(struct EditMesh_PreSelElem *psel, struct BMesh *bm, struct BMElem *ele, const float(*coords)[3])
void EDBM_preselect_preview_clear(struct EditMesh_PreSelElem *psel)
void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const float matrix[4][4])
struct EditMesh_PreSelElem * EDBM_preselect_elem_create(void)
void EDBM_preselect_edgering_update_from_edge(struct EditMesh_PreSelEdgeRing *psel, struct BMesh *bm, struct BMEdge *eed_start, int previewlines, const float(*coords)[3])
void ED_region_tag_redraw_editor_overlays(struct ARegion *region)
void ED_view3d_project_v2(const struct ARegion *region, const float world[3], float r_region_co[2])
float ED_view3d_select_dist_px(void)
Read Guarded memory(de)allocation.
#define BM_elem_index_get(ele)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMFace * BM_face_at_index_find(BMesh *bm, const int index)
BMEdge * BM_edge_at_index_find(BMesh *bm, const int index)
BMVert * BM_vert_at_index_find(BMesh *bm, const int index)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
bool BM_vert_is_boundary(const BMVert *v)
const Depsgraph * depsgraph
void(* MEM_freeN)(void *vmemh)
SymEdge< T > * prev(const SymEdge< T > *se)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
const float(* vertexCos)[3]
struct EditMesh_PreSelEdgeRing * psel
struct EditMesh_PreSelElem * psel
struct EditMeshData * edit_data
struct Depsgraph * depsgraph
wmGizmoFnTestSelect test_select
const struct wmGizmoType * type
struct wmEvent * eventstate
static void gizmo_preselect_elem_draw(const bContext *C, wmGizmo *gz)
void ED_view3d_gizmo_mesh_preselect_clear(wmGizmo *gz)
static int gizmo_preselect_elem_invoke(bContext *UNUSED(C), wmGizmo *UNUSED(gz), const wmEvent *UNUSED(event))
static void GIZMO_GT_mesh_preselect_elem_3d(wmGizmoType *gzt)
static bool gizmo_preselect_poll_for_draw(const bContext *C, wmGizmo *gz)
static void gizmo_preselect_elem_setup(wmGizmo *gz)
static void gizmo_preselect_edgering_draw(const bContext *C, wmGizmo *gz)
static void gizmo_preselect_edgering_setup(wmGizmo *gz)
void ED_gizmotypes_preselect_3d(void)
static int gizmo_preselect_edgering_test_select(bContext *C, wmGizmo *gz, const int mval[2])
struct MeshElemGizmo3D MeshElemGizmo3D
static void gizmo_preselect_elem_free(wmGizmo *gz)
struct MeshEdgeRingGizmo3D MeshEdgeRingGizmo3D
void ED_view3d_gizmo_mesh_preselect_get_active(bContext *C, wmGizmo *gz, Base **r_base, BMElem **r_ele)
static void GIZMO_GT_mesh_preselect_edgering_3d(wmGizmoType *gzt)
static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int mval[2])
static int gizmo_preselect_edgering_invoke(bContext *UNUSED(C), wmGizmo *UNUSED(gz), const wmEvent *UNUSED(event))
static void gizmo_preselect_edgering_free(wmGizmo *gz)
void WM_gizmotype_append(void(*gtfunc)(struct wmGizmoType *))