69 if (
G.moving ==
false) {
114 const bool is_ctrl_pressed = (
event->modifier &
KM_CTRL) != 0;
115 const bool is_shift_pressed = (
event->modifier &
KM_SHIFT) != 0;
117 if (is_ctrl_pressed && !is_shift_pressed) {
120 if (!is_ctrl_pressed && is_shift_pressed) {
138 if (gz_ele->
bases.is_empty() ||
150 int base_index_vert = -1;
151 int base_index_edge = -1;
152 int base_index_face = -1;
171 best.ele =
reinterpret_cast<BMElem *
>(efa_test);
172 best.base_index = base_index_face;
179 best.ele =
reinterpret_cast<BMElem *
>(eed_test);
180 best.base_index = base_index_edge;
189 float vert_p_co[2], vert_co[3];
192 vert_co, gz_ele->
bases[base_index_vert]->object->object_to_world().ptr(), vert->co);
196 best.ele =
reinterpret_cast<BMElem *
>(eve_test);
197 best.base_index = base_index_vert;
202 best.ele =
reinterpret_cast<BMElem *
>(eve_test);
203 best.base_index = base_index_vert;
210 Base *base = gz_ele->
bases[best.base_index];
227 if (best.ele->head.htype ==
BM_VERT) {
230 else if (best.ele->head.htype ==
BM_EDGE) {
233 else if (best.ele->head.htype ==
BM_FACE) {
267 return best.ele ? 0 : -1;
277 if (gz_ele->
psel ==
nullptr) {
288 gz_ele->
psel =
nullptr;
289 gz_ele->
bases.~Vector();
302 gzt->
idname =
"GIZMO_GT_mesh_preselect_elem_3d";
348 const int default_cuts = 1;
351 if (tref ==
nullptr) {
356 if (ot_slide ==
nullptr) {
397 if (gz_ring->
bases.is_empty() ||
401 *bmain, scene, view_layer, v3d);
410 &vc, &best.dist,
nullptr,
false,
false,
nullptr, gz_ring->
bases, &base_index);
413 best.ob = gz_ring->
bases[base_index]->object;
415 best.base_index = base_index;
445 gz_ring->
psel,
bm, best.eed, preview_cuts, vert_positions);
458 return best.eed ? 0 : -1;
468 if (gz_ring->
psel ==
nullptr) {
479 gz_ring->
psel =
nullptr;
480 gz_ring->
bases.~Vector();
493 gzt->
idname =
"GIZMO_GT_mesh_preselect_edgering_3d";
541 Base *base =
nullptr;
543 if (object_index != -1) {
546 if (object_index < bases.
size()) {
547 base = bases[object_index];
567 if (vert_index != -1) {
570 else if (edge_index != -1) {
573 else if (face_index != -1) {
588 else if (
STREQ(gz->
type->
idname,
"GIZMO_GT_mesh_preselect_edgering_3d")) {
597 const char *prop_ids[] = {
"object_index",
"vert_index",
"edge_index",
"face_index"};
598 for (
int i = 0; i <
ARRAY_SIZE(prop_ids); i++) {
600 if (prop ==
nullptr) {
General operations, lookup, etc. for blender objects.
#define BLI_assert_unreachable()
#define BM_elem_index_get(ele)
#define storage(slot, qualifiers)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
const Mesh * BKE_object_get_editmesh_eval_cage(const Object *object)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
BMFace * BM_face_at_index_find(BMesh *bm, const int index)
EditMesh_PreSelEdgeRing * EDBM_preselect_edgering_create()
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
static void gizmo_preselect_edgering_setup(wmGizmo *gz)
static void gizmo_preselect_elem_draw(const bContext *C, wmGizmo *gz)
static void GIZMO_GT_mesh_preselect_edgering_3d(wmGizmoType *gzt)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void ED_view3d_gizmo_mesh_preselect_get_active(const bContext *C, const wmGizmo *gz, Base **r_base, BMElem **r_ele)
BMesh * BKE_editmesh_bmesh_get_for_write(Mesh *mesh)
static void gizmo_preselect_edgering_draw(const bContext *C, wmGizmo *gz)
Span< float3 > BKE_editmesh_vert_coords_when_deformed(Depsgraph *depsgraph, Scene *scene, Object *obedit, Array< float3 > &r_alloc)
EditMesh_PreSelElem * EDBM_preselect_elem_create()
void WM_gizmotype_append(void(*gtfunc)(wmGizmoType *))
@ PRESELECT_ACTION_CREATE
@ PRESELECT_ACTION_TRANSFORM
@ PRESELECT_ACTION_DELETE
void ED_gizmotypes_preselect_3d()
void EDBM_preselect_elem_update_from_single(EditMesh_PreSelElem *psel, BMesh *bm, BMElem *ele, Span< float3 > vert_positions)
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
static void gizmo_preselect_elem_free(wmGizmo *gz)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
static void gizmo_preselect_edgering_free(wmGizmo *gz)
static void gizmo_preselect_elem_setup(wmGizmo *gz)
static wmOperatorStatus gizmo_preselect_elem_invoke(bContext *, wmGizmo *, const wmEvent *)
int RNA_int_get(PointerRNA *ptr, const char *name)
wmWindow * CTX_wm_window(const bContext *C)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
void ED_view3d_project_v2(const ARegion *region, const float world[3], float r_region_co[2])
void ED_region_tag_redraw_editor_overlays(ARegion *region)
bool BM_vert_is_boundary(const BMVert *v)
void EDBM_preselect_edgering_update_from_edge(EditMesh_PreSelEdgeRing *psel, BMesh *bm, BMEdge *eed_start, int previewlines, Span< float3 > vert_positions)
ViewLayer * CTX_data_view_layer(const bContext *C)
static bool gizmo_preselect_poll_for_draw(const bContext *C, wmGizmo *gz)
void EDBM_preselect_elem_destroy(EditMesh_PreSelElem *psel)
BMVert * BM_vert_at_index_find(BMesh *bm, const int index)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
void EDBM_preselect_edgering_clear(EditMesh_PreSelEdgeRing *psel)
static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int mval[2])
BMEdge * BM_edge_at_index_find(BMesh *bm, const int index)
static void GIZMO_GT_mesh_preselect_elem_3d(wmGizmoType *gzt)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void EDBM_preselect_elem_draw(EditMesh_PreSelElem *psel, const float matrix[4][4])
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
eEditMesh_PreSelPreviewAction EDBM_preselect_action_get(EditMesh_PreSelElem *psel)
static int loopcut_tool_preview_cuts_from_toolsettings(const bContext *C)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
static int gizmo_preselect_edgering_test_select(bContext *C, wmGizmo *gz, const int mval[2])
RegionView3D * CTX_wm_region_view3d(const bContext *C)
int BKE_mesh_wrapper_vert_len(const Mesh *mesh)
void EDBM_preselect_action_set(EditMesh_PreSelElem *psel, eEditMesh_PreSelPreviewAction action)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
ViewContext em_setup_viewcontext(bContext *C)
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)
void EDBM_preselect_elem_update_preview(EditMesh_PreSelElem *psel, ViewContext *vc, BMesh *bm, BMElem *ele, const int mval[2])
void EDBM_preselect_elem_clear(EditMesh_PreSelElem *psel)
Main * CTX_data_main(const bContext *C)
bToolRef * WM_toolsystem_ref_from_context(const bContext *C)
void EDBM_preselect_edgering_destroy(EditMesh_PreSelEdgeRing *psel)
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
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, Span< Base * > bases, uint *r_base_index)
Span< float3 > BKE_mesh_wrapper_vert_coords(const Mesh *mesh)
Scene * CTX_data_scene(const bContext *C)
void EDBM_preselect_edgering_draw(EditMesh_PreSelEdgeRing *psel, const float matrix[4][4])
float ED_view3d_select_dist_px()
Vector< Base * > BKE_view_layer_array_from_bases_in_edit_mode(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
void EDBM_preselect_preview_clear(EditMesh_PreSelElem *psel)
bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, 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)
static wmOperatorStatus gizmo_preselect_edgering_invoke(bContext *, wmGizmo *, const wmEvent *)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
void ED_view3d_gizmo_mesh_preselect_clear(wmGizmo *gz)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
EditMesh_PreSelEdgeRing * psel
EditMesh_PreSelElem * psel
wmGizmoFnTestSelect test_select
bke::WindowRuntime * runtime