Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "DNA_mesh_types.h"
#include "DNA_view3d_types.h"
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_global.h"
#include "BKE_layer.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "bmesh.h"
#include "ED_gizmo_library.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
Go to the source code of this file.
Classes | |
struct | MeshElemGizmo3D |
struct | MeshEdgeRingGizmo3D |
Functions | |
Shared Internal API | |
static bool | gizmo_preselect_poll_for_draw (const bContext *C, wmGizmo *gz) |
Gizmo API | |
void | ED_gizmotypes_preselect_3d (void) |
Gizmo Accessors | |
This avoids each user of the gizmo needing to write their own lookups to access the information from this gizmo. | |
void | ED_view3d_gizmo_mesh_preselect_get_active (bContext *C, wmGizmo *gz, Base **r_base, BMElem **r_ele) |
void | ED_view3d_gizmo_mesh_preselect_clear (wmGizmo *gz) |
Mesh Element (Vert/Edge/Face) Pre-Select Gizmo API | |
typedef struct MeshElemGizmo3D | MeshElemGizmo3D |
static void | gizmo_preselect_elem_draw (const bContext *C, wmGizmo *gz) |
static int | gizmo_preselect_elem_test_select (bContext *C, wmGizmo *gz, const int mval[2]) |
static void | gizmo_preselect_elem_setup (wmGizmo *gz) |
static void | gizmo_preselect_elem_free (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) |
Mesh Edge-Ring Pre-Select Gizmo API | |
typedef struct MeshEdgeRingGizmo3D | MeshEdgeRingGizmo3D |
static void | gizmo_preselect_edgering_draw (const bContext *C, wmGizmo *gz) |
static int | gizmo_preselect_edgering_test_select (bContext *C, wmGizmo *gz, const int mval[2]) |
static void | gizmo_preselect_edgering_setup (wmGizmo *gz) |
static void | gizmo_preselect_edgering_free (wmGizmo *gz) |
static int | gizmo_preselect_edgering_invoke (bContext *UNUSED(C), wmGizmo *UNUSED(gz), const wmEvent *UNUSED(event)) |
static void | GIZMO_GT_mesh_preselect_edgering_3d (wmGizmoType *gzt) |
typedef struct MeshEdgeRingGizmo3D MeshEdgeRingGizmo3D |
typedef struct MeshElemGizmo3D MeshElemGizmo3D |
Definition at line 471 of file view3d_gizmo_preselect_type.c.
References GIZMO_GT_mesh_preselect_edgering_3d(), GIZMO_GT_mesh_preselect_elem_3d(), and WM_gizmotype_append().
Referenced by ED_spacetypes_init().
Definition at line 537 of file view3d_gizmo_preselect_type.c.
References ARRAY_SIZE, MeshElemGizmo3D::base_index, MeshEdgeRingGizmo3D::base_index, BLI_assert_unreachable, MeshElemGizmo3D::edge_index, MeshEdgeRingGizmo3D::edge_index, MeshElemGizmo3D::face_index, wmGizmoType::idname, NULL, wmGizmo::ptr, RNA_property_int_set(), RNA_struct_find_property(), STREQ, wmGizmo::type, and MeshElemGizmo3D::vert_index.
Referenced by gizmo_preselect_poll_for_draw().
void ED_view3d_gizmo_mesh_preselect_get_active | ( | bContext * | C, |
wmGizmo * | gz, | ||
Base ** | r_base, | ||
BMElem ** | r_ele | ||
) |
Definition at line 486 of file view3d_gizmo_preselect_type.c.
References BKE_editmesh_from_object(), BKE_view_layer_array_from_bases_in_edit_mode, BMEditMesh::bm, bm, BM_edge_at_index_find(), BM_face_at_index_find(), BM_vert_at_index_find(), C, CTX_data_view_layer(), CTX_wm_view3d(), MEM_freeN, NULL, Base::object, wmGizmo::ptr, RNA_int_get(), RNA_property_int_get(), and RNA_struct_find_property().
Referenced by edbm_preselect_or_active().
|
static |
Definition at line 447 of file view3d_gizmo_preselect_type.c.
References wmGizmoType::draw, wmGizmoType::free, gizmo_preselect_edgering_draw(), gizmo_preselect_edgering_free(), gizmo_preselect_edgering_invoke(), gizmo_preselect_edgering_setup(), gizmo_preselect_edgering_test_select(), wmGizmoType::idname, wmGizmoType::invoke, RNA_def_int(), wmGizmoType::setup, wmGizmoType::srna, wmGizmoType::struct_size, and wmGizmoType::test_select.
Referenced by ED_gizmotypes_preselect_3d().
|
static |
Definition at line 285 of file view3d_gizmo_preselect_type.c.
References wmGizmoType::draw, wmGizmoType::free, gizmo_preselect_elem_draw(), gizmo_preselect_elem_free(), gizmo_preselect_elem_invoke(), gizmo_preselect_elem_setup(), gizmo_preselect_elem_test_select(), wmGizmoType::idname, wmGizmoType::invoke, RNA_def_int(), wmGizmoType::setup, wmGizmoType::srna, wmGizmoType::struct_size, and wmGizmoType::test_select.
Referenced by ED_gizmotypes_preselect_3d().
Definition at line 320 of file view3d_gizmo_preselect_type.c.
References MeshEdgeRingGizmo3D::base_index, MeshEdgeRingGizmo3D::bases, C, EDBM_preselect_edgering_draw(), gizmo_preselect_poll_for_draw(), Base::object, Object::obmat, and MeshEdgeRingGizmo3D::psel.
Referenced by GIZMO_GT_mesh_preselect_edgering_3d().
Definition at line 432 of file view3d_gizmo_preselect_type.c.
References MeshEdgeRingGizmo3D::bases, EDBM_preselect_edgering_destroy(), MEM_SAFE_FREE, NULL, and MeshEdgeRingGizmo3D::psel.
Referenced by GIZMO_GT_mesh_preselect_edgering_3d().
|
static |
Definition at line 440 of file view3d_gizmo_preselect_type.c.
References OPERATOR_PASS_THROUGH.
Referenced by GIZMO_GT_mesh_preselect_edgering_3d().
Definition at line 423 of file view3d_gizmo_preselect_type.c.
References MeshEdgeRingGizmo3D::base_index, EDBM_preselect_edgering_create(), NULL, and MeshEdgeRingGizmo3D::psel.
Referenced by GIZMO_GT_mesh_preselect_edgering_3d().
|
static |
Definition at line 333 of file view3d_gizmo_preselect_type.c.
References ViewLayer::basact, MeshEdgeRingGizmo3D::base_index, MeshEdgeRingGizmo3D::bases, MeshEdgeRingGizmo3D::bases_len, BKE_editmesh_from_object(), BKE_editmesh_vert_coords_when_deformed(), BKE_view_layer_array_from_bases_in_edit_mode, BMEditMesh::bm, bm, BM_EDGE, BM_elem_index_get, BM_mesh_elem_index_ensure(), C, copy_v2_v2_int(), CTX_data_view_layer(), CTX_wm_region(), CTX_wm_view3d(), DEG_get_evaluated_id(), DEG_get_evaluated_object(), ViewContext::depsgraph, ED_region_tag_redraw_editor_overlays(), ED_view3d_select_dist_px(), EDBM_edge_find_nearest_ex(), EDBM_preselect_edgering_clear(), EDBM_preselect_edgering_update_from_edge(), MeshEdgeRingGizmo3D::edge_index, em_setup_viewcontext(), float(), Scene::id, MEM_freeN, MEM_SAFE_FREE, ViewContext::mval, NULL, Base::object, blender::meshintersect::prev(), MeshEdgeRingGizmo3D::psel, wmGizmo::ptr, RNA_int_set(), and ViewContext::scene.
Referenced by GIZMO_GT_mesh_preselect_edgering_3d().
Definition at line 89 of file view3d_gizmo_preselect_type.c.
References MeshElemGizmo3D::base_index, MeshElemGizmo3D::bases, C, EDBM_preselect_elem_draw(), gizmo_preselect_poll_for_draw(), Base::object, Object::obmat, and MeshElemGizmo3D::psel.
Referenced by GIZMO_GT_mesh_preselect_elem_3d().
Definition at line 270 of file view3d_gizmo_preselect_type.c.
References MeshElemGizmo3D::bases, EDBM_preselect_elem_destroy(), MEM_SAFE_FREE, NULL, and MeshElemGizmo3D::psel.
Referenced by GIZMO_GT_mesh_preselect_elem_3d().
|
static |
Definition at line 278 of file view3d_gizmo_preselect_type.c.
References OPERATOR_PASS_THROUGH.
Referenced by GIZMO_GT_mesh_preselect_elem_3d().
Definition at line 261 of file view3d_gizmo_preselect_type.c.
References MeshElemGizmo3D::base_index, EDBM_preselect_elem_create(), NULL, and MeshElemGizmo3D::psel.
Referenced by GIZMO_GT_mesh_preselect_elem_3d().
|
static |
Definition at line 102 of file view3d_gizmo_preselect_type.c.
References ViewLayer::basact, MeshElemGizmo3D::base_index, MeshElemGizmo3D::bases, MeshElemGizmo3D::bases_len, BKE_editmesh_from_object(), BKE_view_layer_array_from_bases_in_edit_mode, BLI_assert, BMEditMesh::bm, bm, BM_EDGE, BM_elem_index_get, BM_FACE, BM_mesh_elem_index_ensure(), BM_VERT, BM_vert_is_boundary(), C, BMVert::co, copy_v2_v2_int(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_view_layer(), CTX_wm_region(), CTX_wm_view3d(), CTX_wm_window(), Object::data, DEG_get_evaluated_id(), depsgraph, ED_region_tag_redraw_editor_overlays(), ED_view3d_project_v2(), ED_view3d_select_dist_px(), EDBM_preselect_action_get(), EDBM_preselect_action_set(), EDBM_preselect_elem_clear(), EDBM_preselect_elem_update_from_single(), EDBM_preselect_elem_update_preview(), EDBM_preselect_preview_clear(), EDBM_unified_findnearest_from_raycast(), MeshElemGizmo3D::edge_index, Mesh_Runtime::edit_data, em_setup_viewcontext(), wmWindow::eventstate, MeshElemGizmo3D::face_index, float(), KM_CTRL, KM_SHIFT, len, len_v2v2(), MEM_SAFE_FREE, mul_v3_m4v3(), ViewContext::mval, NULL, Base::object, Object::obmat, PRESELECT_ACTION_CREATE, PRESELECT_ACTION_DELETE, PRESELECT_ACTION_TRANSFORM, MeshElemGizmo3D::psel, wmGizmo::ptr, ViewContext::region, RNA_int_set(), Mesh::runtime, UNPACK2, MeshElemGizmo3D::vert_index, and EditMeshData::vertexCos.
Referenced by GIZMO_GT_mesh_preselect_elem_3d().
Check if drawing should be performed, clear the pre-selection in the case it's disabled. Without this, the gizmo would be visible while transforming. See T92954.
NOTE(@campbellbarton): This is a workaround for the gizmo system, since typically poll would be used for this purpose. The problem with using poll is once the gizmo is visible again is there is a visible flicker showing the previous location before cursor motion causes the pre selection to be updated. While this is only a glitch, it's distracting. The gizmo system it's self could support this use case by tracking which gizmos draw and ensure gizmos always run wmGizmoType.test_select before drawing, however pre-selection is already outside the scope of what gizmos are meant to be used for, so keep this workaround localized to this gizmo type unless this seems worth supporting for more typical use-cases.
Longer term it may be better to use wmPaintCursor instead of gizmos (as snapping preview does).
Definition at line 60 of file view3d_gizmo_preselect_type.c.
References C, CTX_wm_region_view3d(), ED_view3d_gizmo_mesh_preselect_clear(), G, RegionView3D::rflag, and RV3D_NAVIGATING.
Referenced by gizmo_preselect_edgering_draw(), and gizmo_preselect_elem_draw().