73 if (
G.moving ==
false) {
118 const bool is_ctrl_pressed = (
event->modifier &
KM_CTRL) != 0;
119 const bool is_shift_pressed = (
event->modifier &
KM_SHIFT) != 0;
121 if (is_ctrl_pressed && !is_shift_pressed) {
124 if (!is_ctrl_pressed && is_shift_pressed) {
141 if (gz_ele->
bases.is_empty() ||
153 int base_index_vert = -1;
154 int base_index_edge = -1;
155 int base_index_face = -1;
174 best.ele = (
BMElem *)efa_test;
175 best.base_index = base_index_face;
182 best.ele = (
BMElem *)eed_test;
183 best.base_index = base_index_edge;
192 float vert_p_co[2], vert_co[3];
195 vert_co, gz_ele->
bases[base_index_vert]->object->object_to_world().ptr(), vert->
co);
199 best.ele = (
BMElem *)eve_test;
200 best.base_index = base_index_vert;
205 best.ele = (
BMElem *)eve_test;
206 best.base_index = base_index_vert;
213 Base *base = gz_ele->
bases[best.base_index];
230 if (best.ele->head.htype ==
BM_VERT) {
233 else if (best.ele->head.htype ==
BM_EDGE) {
236 else if (best.ele->head.htype ==
BM_FACE) {
270 return best.ele ? 0 : -1;
280 if (gz_ele->
psel ==
nullptr) {
291 gz_ele->
psel =
nullptr;
292 gz_ele->
bases.~Vector();
305 gzt->
idname =
"GIZMO_GT_mesh_preselect_elem_3d";
316 RNA_def_int(gzt->
srna,
"object_index", -1, -1, INT_MAX,
"Object Index",
"", -1, INT_MAX);
317 RNA_def_int(gzt->
srna,
"vert_index", -1, -1, INT_MAX,
"Vert Index",
"", -1, INT_MAX);
318 RNA_def_int(gzt->
srna,
"edge_index", -1, -1, INT_MAX,
"Edge Index",
"", -1, INT_MAX);
319 RNA_def_int(gzt->
srna,
"face_index", -1, -1, INT_MAX,
"Face Index",
"", -1, INT_MAX);
372 if (gz_ring->
bases.is_empty() ||
384 &vc, &best.dist,
nullptr,
false,
false,
nullptr, gz_ring->
bases, &base_index);
387 best.ob = gz_ring->
bases[base_index]->object;
389 best.base_index = base_index;
417 vc.
depsgraph, em_eval, scene_eval, ob_eval, storage);
431 return best.eed ? 0 : -1;
441 if (gz_ring->
psel ==
nullptr) {
452 gz_ring->
psel =
nullptr;
453 gz_ring->
bases.~Vector();
466 gzt->
idname =
"GIZMO_GT_mesh_preselect_edgering_3d";
477 RNA_def_int(gzt->
srna,
"object_index", -1, -1, INT_MAX,
"Object Index",
"", -1, INT_MAX);
478 RNA_def_int(gzt->
srna,
"edge_index", -1, -1, INT_MAX,
"Edge Index",
"", -1, INT_MAX);
513 Base *base =
nullptr;
515 if (object_index != -1) {
518 if (object_index < bases.
size()) {
519 base = bases[object_index];
540 if (vert_index != -1) {
543 else if (edge_index != -1) {
546 else if (face_index != -1) {
561 else if (
STREQ(gz->
type->
idname,
"GIZMO_GT_mesh_preselect_edgering_3d")) {
570 const char *prop_ids[] = {
"object_index",
"vert_index",
"edge_index",
"face_index"};
571 for (
int i = 0; i <
ARRAY_SIZE(prop_ids); i++) {
573 if (prop ==
nullptr) {
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
blender::Span< blender::float3 > BKE_editmesh_vert_coords_when_deformed(Depsgraph *depsgraph, BMEditMesh *em, Scene *scene, Object *obedit, blender::Array< blender::float3 > &r_alloc)
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
blender::Vector< Base * > BKE_view_layer_array_from_bases_in_edit_mode(const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
blender::Span< blender::float3 > BKE_mesh_wrapper_vert_coords(const Mesh *mesh)
int BKE_mesh_wrapper_vert_len(const Mesh *mesh)
General operations, lookup, etc. for blender objects.
const Mesh * BKE_object_get_editmesh_eval_cage(const Object *object)
#define BLI_assert_unreachable()
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
ID * DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, blender::Span< Base * > bases, bool use_boundary_vertices, bool use_boundary_edges, int *r_base_index_vert, int *r_base_index_edge, int *r_base_index_face, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
void EDBM_preselect_edgering_destroy(EditMesh_PreSelEdgeRing *psel)
void EDBM_preselect_elem_clear(EditMesh_PreSelElem *psel)
eEditMesh_PreSelPreviewAction EDBM_preselect_action_get(EditMesh_PreSelElem *psel)
@ PRESELECT_ACTION_CREATE
@ PRESELECT_ACTION_DELETE
@ PRESELECT_ACTION_TRANSFORM
void EDBM_preselect_edgering_clear(EditMesh_PreSelEdgeRing *psel)
void EDBM_preselect_elem_draw(EditMesh_PreSelElem *psel, const float matrix[4][4])
BMEdge * EDBM_edge_find_nearest_ex(ViewContext *vc, float *dist_px_manhattan, float *r_dist_center, bool use_select_bias, bool use_cycle, BMEdge **r_eed_zbuf, blender::Span< Base * > bases, uint *r_base_index)
void EDBM_preselect_elem_destroy(EditMesh_PreSelElem *psel)
ViewContext em_setup_viewcontext(bContext *C)
EditMesh_PreSelElem * EDBM_preselect_elem_create()
void EDBM_preselect_edgering_draw(EditMesh_PreSelEdgeRing *psel, const float matrix[4][4])
void EDBM_preselect_elem_update_preview(EditMesh_PreSelElem *psel, ViewContext *vc, BMesh *bm, BMElem *ele, const int mval[2])
EditMesh_PreSelEdgeRing * EDBM_preselect_edgering_create()
void EDBM_preselect_edgering_update_from_edge(EditMesh_PreSelEdgeRing *psel, BMesh *bm, BMEdge *eed_start, int previewlines, blender::Span< blender::float3 > vert_positions)
void EDBM_preselect_action_set(EditMesh_PreSelElem *psel, eEditMesh_PreSelPreviewAction action)
void EDBM_preselect_elem_update_from_single(EditMesh_PreSelElem *psel, BMesh *bm, BMElem *ele, blender::Span< blender::float3 > vert_positions)
void EDBM_preselect_preview_clear(EditMesh_PreSelElem *psel)
void ED_region_tag_redraw_editor_overlays(ARegion *region)
float ED_view3d_select_dist_px()
void ED_view3d_project_v2(const ARegion *region, const float world[3], float r_region_co[2])
Read Guarded memory(de)allocation.
#define BM_elem_index_get(ele)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMEdge * BM_edge_at_index_find(BMesh *bm, const int index)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
BMVert * BM_vert_at_index_find(BMesh *bm, const int index)
BMFace * BM_face_at_index_find(BMesh *bm, const int index)
bool BM_vert_is_boundary(const BMVert *v)
const Depsgraph * depsgraph
draw_view in_light_buf[] float
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
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, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
EditMesh_PreSelEdgeRing * psel
EditMesh_PreSelElem * psel
wmGizmoFnTestSelect test_select
struct wmEvent * eventstate
static void gizmo_preselect_elem_draw(const bContext *C, wmGizmo *gz)
void ED_view3d_gizmo_mesh_preselect_get_active(const bContext *C, const wmGizmo *gz, Base **r_base, BMElem **r_ele)
void ED_gizmotypes_preselect_3d()
static int gizmo_preselect_edgering_invoke(bContext *, wmGizmo *, const wmEvent *)
void ED_view3d_gizmo_mesh_preselect_clear(wmGizmo *gz)
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)
static int gizmo_preselect_elem_invoke(bContext *, wmGizmo *, const wmEvent *)
static int gizmo_preselect_edgering_test_select(bContext *C, wmGizmo *gz, const int mval[2])
static void gizmo_preselect_elem_free(wmGizmo *gz)
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 void gizmo_preselect_edgering_free(wmGizmo *gz)
void WM_gizmotype_append(void(*gtfunc)(wmGizmoType *))