119 msel->
len -= len_subtract;
120 if (msel->
len <= 0) {
148 for (
int i = 0;
i < msel->
len;
i++) {
149 if (msel->
items[
i] == gz) {
150 for (
int j =
i; j < (msel->
len - 1); j++) {
167 gzmap->
type = gzmap_type;
195 gzgroup = gzgroup_next)
197 gzgroup_next = gzgroup->next;
214 memset(gzmap, 0x0,
sizeof(*gzmap));
230 if (gzgroup->type == gzgt) {
253 const wmGizmoMap *gzmap,
bool ,
bool use_select,
float r_min[3],
float r_max[3])
279 bool (*poll)(
const wmGizmo *,
void *),
289 if (((flag_exclude == 0) || ((gz->flag & flag_exclude) == 0)) && (!poll || poll(gz,
data)))
337 if (gzgroup->hide.delay_refresh_for_tweak) {
422 if (gzgroup->hide.any != 0) {
427 if (gzgroup->type->draw_prepare) {
428 gzgroup->type->draw_prepare(
C, gzgroup);
454 bool is_depth_prev =
false;
461 link_next = link->
next;
471 if (is_depth == is_depth_prev) {
481 is_depth_prev = is_depth;
519 const int visible_gizmos_len,
520 bool *r_use_select_bias)
527 const bool use_intel_gpu_workaround =
true;
532 bool is_depth_prev =
false;
533 bool is_depth_skip_prev =
false;
535 for (
int select_id = 0; select_id < visible_gizmos_len; select_id++) {
536 wmGizmo *gz = visible_gizmos[select_id];
542 if (is_depth == is_depth_prev) {
552 is_depth_prev = is_depth;
555 if (is_depth_skip == is_depth_skip_prev) {
560 is_depth_skip_prev = is_depth_skip;
564 *r_use_select_bias =
true;
574 if (is_depth_prev || use_intel_gpu_workaround) {
577 if (is_depth_skip_prev) {
583 const int visible_gizmos_len,
603 bool use_select_bias =
false;
624 if (use_select_bias && (hits > 1)) {
625 float co_direction[3];
626 float co_screen[3] = {
float(co[0]),
float(co[1]), 0.0f};
630 const int viewport[4] = {0, 0, region->
winx, region->
winy};
631 float co_3d_origin[3];
640 wmGizmo *gz = visible_gizmos[hit_result.id >> 8];
642 co_screen[2] =
float(
double(hit_result.depth) /
double(
UINT_MAX));
649 const float dot_test =
dot_v3v3(co_3d, co_direction) - select_bias;
650 if (dot_best > dot_test) {
652 hit_found = hit_result.id;
659 return hit_near ? hit_near->
id : -1;
668 const int visible_gizmos_len,
672 int visible_gizmos_len_trim = visible_gizmos_len;
683 for (
int select_id = 0; select_id < visible_gizmos_len; select_id++) {
684 wmGizmo *gz = visible_gizmos[select_id];
691 visible_gizmos_len_trim = select_id;
711 if (viewport ==
nullptr) {
733 const int hotspot_radii[] = {
742 visible_gizmos, visible_gizmos_len_trim,
C, co, hotspot_radii[
i]);
752 const int select_id = hit >> 8;
753 const int select_part = hit & 0xff;
755 *r_part = select_part;
756 result = visible_gizmos[select_id];
812 wm, gzgroup, event->
modifier, &visible_3d_gizmos);
816 wm, gzgroup,
C, event->
modifier, mval, r_part)))
825 if (!visible_3d_gizmos.
is_empty()) {
829 C, mval, visible_3d_gizmos.
data(), visible_3d_gizmos.
size(), r_part);
859 const bool modal_running = (handler->
op !=
nullptr);
876 if (gz && gzop && (gzop->
type !=
nullptr) && (gzop->
type == handler->
op->
type)) {
878 if (modal_fn !=
nullptr) {
909 if (msel->
items ==
nullptr || msel->
len == 0) {
913 for (
int i = 0;
i < msel->
len;
i++) {
944 bool changed =
false;
963 bool changed =
false;
996 if (area ==
nullptr) {
1048 if (init_last_cursor) {
1054 if (init_last_cursor) {
1088 bool do_refresh =
false;
1126 if (gzop && gzop->
type) {
1184 if (step_iter ==
step) {
1187 if ((gzmap->
update_flag[
i] & update_flag) == update_flag) {
1235 if (gzgroup->type->message_subscribe !=
nullptr) {
1236 gzgroup->type->message_subscribe(
C, gzgroup, mbus);
1251 *r_exit_on_event =
false;
1258 *r_exit_on_event =
true;
1275 if (gzmap_type->spaceid == gzmap_params->
spaceid &&
1276 gzmap_type->regionid == gzmap_params->
regionid)
1306 gzmap_type = gzmap_type_next)
1308 gzmap_type_next = gzmap_type->next;
1313 gzgt_ref = gzgt_next)
1315 gzgt_next = gzgt_ref->next;
1388 gzgt_ref = gzgt_ref_next)
1390 gzgt_ref_next = gzgt_ref->next;
1405 if (gzmap_type->type_update_flag & type_update_all) {
1426 screen =
static_cast<bScreen *
>(screen->id.next))
1430 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
1433 wmGizmoMap *gzmap = region->runtime->gizmo_map;
1440 gzgroup = gzgroup_next)
1442 gzgroup_next = gzgroup->next;
1443 if (gzgroup->tag_remove) {
1474 screen =
static_cast<bScreen *
>(screen->id.next))
1478 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
1480 wmGizmoMap *gzmap = region->runtime->gizmo_map;
1481 if ((gzmap !=
nullptr) && (gzmap->
is_init ==
false)) {
bScreen * CTX_wm_screen(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
void CTX_wm_area_set(bContext *C, ScrArea *area)
void CTX_wm_region_set(bContext *C, ARegion *region)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
#define GHASH_ITER_INDEX(gh_iter_, ghash_, i_)
LinkData * BLI_genericNodeN(void *data)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void BLI_rcti_init_pt_radius(struct rcti *rect, const int xy[2], int size)
#define ENUM_OPERATORS(_type, _max)
#define UNUSED_VARS_NDEBUG(...)
#define OPERATOR_RETVAL_CHECK(ret)
void ED_region_tag_redraw_editor_overlays(ARegion *region)
void ED_region_tag_redraw(ARegion *region)
void ED_view3d_draw_setup_view(const wmWindowManager *wm, wmWindow *win, Depsgraph *depsgraph, Scene *scene, ARegion *region, View3D *v3d, const float viewmat[4][4], const float winmat[4][4], const rcti *rect)
void view3d_operator_needs_gpu(const bContext *C)
void ED_view3d_win_to_vector(const ARegion *region, const float mval[2], float r_out[3])
#define GPU_ATTACHMENT_TEXTURE(_texture)
void GPU_framebuffer_restore()
#define GPU_ATTACHMENT_NONE
void GPU_framebuffer_free(blender::gpu::FrameBuffer *fb)
#define GPU_framebuffer_ensure_config(_fb,...)
void GPU_framebuffer_bind(blender::gpu::FrameBuffer *fb)
bool GPU_matrix_unproject_3fv(const float win[3], const float model_inverted[4][4], const float proj[4][4], const int view[4], float r_world[3])
const GPUSelectResult * GPU_select_buffer_near(const blender::Span< GPUSelectResult > hit_results)
void GPU_select_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode, int oldhits)
unsigned int GPU_select_end()
@ GPU_SELECT_NEAREST_SECOND_PASS
@ GPU_SELECT_NEAREST_FIRST_PASS
void GPU_line_smooth(bool enable)
void GPU_depth_mask(bool depth)
void GPU_depth_test(GPUDepthTest test)
void GPU_polygon_smooth(bool enable)
blender::gpu::Texture * GPU_viewport_depth_texture(GPUViewport *viewport)
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
ARegion * UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
@ WM_GIZMOMAP_DRAWSTEP_3D
@ WM_GIZMOMAP_DRAWSTEP_2D
eWM_GizmoFlagTweak
Gizmo tweak flag. Bit-flag passed to gizmo while tweaking.
eWM_GizmoFlagMapTypeUpdateFlag
@ WM_GIZMOMAPTYPE_UPDATE_REMOVE
@ WM_GIZMOMAPTYPE_KEYMAP_INIT
@ WM_GIZMOMAPTYPE_UPDATE_INIT
@ WM_GIZMOGROUP_INIT_REFRESH
@ WM_GIZMOGROUP_INIT_SETUP
@ WM_GIZMO_SELECT_BACKGROUND
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE
@ WM_GIZMOGROUPTYPE_DEPTH_3D
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL
@ WM_GIZMOGROUPTYPE_SELECT
@ WM_GIZMO_STATE_HIGHLIGHT
#define WM_GIZMOMAP_DRAWSTEP_MAX
BMesh const char void * data
BPy_StructRNA * depsgraph
Span< T > as_span() const
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
VecBase< float, 2 > float2
ARegionRuntimeHandle * runtime
struct wmGizmoMap * gizmo_map
struct wmEventHandler_Op::@143214277125013224360266000304213254210030120033 context
eWM_EventHandlerType type
wmEventModifierFlag modifier
wmGizmoGroupFnInvokePrepare invoke_prepare
eWM_GizmoFlagGroupTypeFlag flag
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
wmGizmoMapSelectState select
char update_flag[WM_GIZMOMAP_DRAWSTEP_MAX]
bool tag_highlight_pending
struct wmGizmoMap::@114263143030171315362141314326010164050332242157 gzmap_context
Gizmo map runtime context.
wmGizmoFnTestSelect test_select
wmGizmoFnCursorGet cursor_get
wmGizmoFnDrawSelect draw_select
wmGizmoGroup * parent_gzgroup
wmGizmoFnModal custom_modal
struct wmOperatorType * type
void WM_cursor_set(wmWindow *win, int curs)
void WM_cursor_grab_enable(wmWindow *win, const eWM_CursorWrapAxis wrap, const rcti *wrap_region, const bool hide)
void WM_cursor_grab_disable(wmWindow *win, const int mouse_ungrab_xy[2])
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
void WM_event_add_mousemove(wmWindow *win)
bool wm_gizmo_select_set_ex(wmGizmoMap *gzmap, wmGizmo *gz, bool select, bool use_array, bool use_callback)
wmGizmoOpElem * WM_gizmo_operator_get(wmGizmo *gz, int part_index)
bool WM_gizmo_context_check_drawstep(const bContext *C, eWM_GizmoFlagMapDrawStep step)
wmOperatorStatus WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop, const wmEvent *event)
void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
bool WM_gizmo_select_set(wmGizmoMap *gzmap, wmGizmo *gz, bool select)
int wm_gizmo_is_visible(wmGizmo *gz)
wmOperatorStatus(*)(bContext *, wmGizmo *, const wmEvent *, eWM_GizmoFlagTweak) wmGizmoFnModal
void WM_gizmo_group_refresh(const bContext *C, wmGizmoGroup *gzgroup)
void WM_gizmomaptype_group_init_runtime_keymap(const Main *bmain, wmGizmoGroupType *gzgt)
void WM_gizmomaptype_group_init_runtime(const Main *bmain, wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
void wm_gizmogrouptype_setup_keymap(wmGizmoGroupType *gzgt, wmKeyConfig *keyconf)
wmKeyMap * wm_gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf)
void wm_gizmogroup_intersectable_gizmos_to_list(wmWindowManager *wm, const wmGizmoGroup *gzgroup, const int event_modifier, blender::Vector< wmGizmo *, 128 > *r_visible_gizmos)
void WM_gizmogroup_ensure_init(const bContext *C, wmGizmoGroup *gzgroup)
wmGizmoGroup * wm_gizmogroup_new_from_type(wmGizmoMap *gzmap, wmGizmoGroupType *gzgt)
bool wm_gizmogroup_is_visible_in_drawstep(const wmGizmoGroup *gzgroup, const eWM_GizmoFlagMapDrawStep drawstep)
void WM_gizmomaptype_group_free(wmGizmoGroupTypeRef *gzgt_ref)
bool WM_gizmo_group_type_poll(const bContext *C, const wmGizmoGroupType *gzgt)
void WM_gizmomaptype_group_unlink(bContext *C, Main *bmain, wmGizmoMapType *gzmap_type, const wmGizmoGroupType *gzgt)
wmGizmo * wm_gizmogroup_find_intersected_gizmo(wmWindowManager *wm, const wmGizmoGroup *gzgroup, bContext *C, const int event_modifier, const int mval[2], int *r_part)
void wm_gizmogroup_free(bContext *C, wmGizmoGroup *gzgroup)
wmGizmoGroupType * WM_gizmogrouptype_find(const StringRef idname, bool quiet)
@ WM_GIZMO_IS_VISIBLE_DRAW
@ WM_GIZMO_IS_VISIBLE_UPDATE
const ListBase * WM_gizmomap_group_list(wmGizmoMap *gzmap)
ListBase * wm_gizmomap_groups_get(wmGizmoMap *gzmap)
static GHash * WM_gizmomap_gizmo_hash_new(const bContext *C, wmGizmoMap *gzmap, bool(*poll)(const wmGizmo *, void *), void *data, const eWM_GizmoFlag flag_exclude)
void wm_gizmomap_modal_set(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event, bool enable)
wmGizmoGroup * WM_gizmomap_group_find_ptr(wmGizmoMap *gzmap, const wmGizmoGroupType *gzgt)
eWM_GizmoFlagMapDrawStep WM_gizmomap_drawstep_from_gizmo_group(const wmGizmoGroup *gzgroup)
static void wm_gizmomap_select_array_ensure_len_alloc(wmGizmoMap *gzmap, int len)
bool WM_gizmomap_is_any_selected(const wmGizmoMap *gzmap)
bool wm_gizmomap_highlight_handled(wmGizmoMap *gzmap)
void wm_gizmomaps_handled_modal_update(bContext *C, wmEvent *event, wmEventHandler_Op *handler)
bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz, int part)
void WM_gizmomap_tag_refresh_drawstep(wmGizmoMap *gzmap, const eWM_GizmoFlagMapDrawStep drawstep)
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
void wm_gizmomaptypes_free()
@ GIZMOMAP_IS_PREPARE_DRAW
@ GIZMOMAP_IS_REFRESH_CALLBACK
void WM_reinit_gizmomap_all(Main *bmain)
static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos, const int visible_gizmos_len, const bContext *C, const int co[2], const int hotspot)
void WM_gizmoconfig_update_tag_group_type_init(wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
bool WM_gizmomap_tag_delay_refresh_for_tweak_check(wmGizmoMap *gzmap)
wmGizmo * wm_gizmomap_highlight_find(wmGizmoMap *gzmap, bContext *C, const wmEvent *event, int *r_part)
void wm_gizmomap_select_array_remove(wmGizmoMap *gzmap, wmGizmo *gz)
void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
wmGizmo * wm_gizmomap_highlight_get(wmGizmoMap *gzmap)
bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
wmGizmo * WM_gizmomap_get_modal(const wmGizmoMap *gzmap)
static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos)
static ListBase gizmomaptypes
void WM_gizmoconfig_update(Main *bmain)
void WM_gizmoconfig_update_tag_group_type_remove(wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
ARegion * WM_gizmomap_tooltip_init(bContext *C, ARegion *region, int *, double *, bool *r_exit_on_event)
static void wm_gizmomap_free_data(wmGizmoMap *gzmap)
void wm_gizmomap_remove(wmGizmoMap *gzmap)
void WM_gizmomap_draw(wmGizmoMap *gzmap, const bContext *C, const eWM_GizmoFlagMapDrawStep drawstep)
void WM_gizmoconfig_update_tag_reinit_all()
void WM_gizmomap_reinit(wmGizmoMap *gzmap)
static void gizmo_draw_select_3d_loop(const bContext *C, wmGizmo **visible_gizmos, const int visible_gizmos_len, bool *r_use_select_bias)
static bool wm_gizmomap_select_all_intern(bContext *C, wmGizmoMap *gzmap)
wmGizmoMapType * WM_gizmomaptype_find(const wmGizmoMapType_Params *gzmap_params)
void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
static eWM_GizmoFlagGroupTypeGlobalFlag wm_gzmap_type_update_flag
bool WM_gizmomap_cursor_set(const wmGizmoMap *gzmap, wmWindow *win)
static bool gizmo_prepare_drawing(wmGizmoMap *gzmap, wmGizmo *gz, const bContext *C, ListBase *draw_gizmos, const eWM_GizmoFlagMapDrawStep drawstep)
void wm_gizmomap_select_array_clear(wmGizmoMap *gzmap)
void WM_gizmomap_add_handlers(ARegion *region, wmGizmoMap *gzmap)
static wmGizmoMap * wm_gizmomap_new_from_type_ex(wmGizmoMapType *gzmap_type, wmGizmoMap *gzmap)
void WM_gizmoconfig_update_tag_group_remove(wmGizmoMap *gzmap)
void wm_gizmos_keymap(wmKeyConfig *keyconf)
wmGizmo ** wm_gizmomap_selected_get(wmGizmoMap *gzmap, int *r_selected_len)
eWM_GizmoFlagGroupTypeGlobalFlag
@ WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE
@ WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT
@ WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE
@ WM_GIZMOTYPE_GLOBAL_REINIT_ALL
static wmGizmo * gizmo_find_intersected_3d(bContext *C, const int co[2], wmGizmo **visible_gizmos, const int visible_gizmos_len, int *r_part)
bool wm_gizmomap_highlight_pending(const wmGizmoMap *gzmap)
bool WM_gizmomap_minmax(const wmGizmoMap *gzmap, bool, bool use_select, float r_min[3], float r_max[3])
void wm_gizmomap_select_array_push_back(wmGizmoMap *gzmap, wmGizmo *gz)
static bool gizmo_selectable_poll(const wmGizmo *gz, void *)
void wm_gizmomap_select_array_shrink(wmGizmoMap *gzmap, int len_subtract)
bool wm_gizmomap_deselect_all(wmGizmoMap *gzmap)
wmGizmoMapType * WM_gizmomaptype_ensure(const wmGizmoMapType_Params *gzmap_params)
void wm_gizmomap_handler_context_gizmo(bContext *, wmEventHandler_Gizmo *)
void WM_gizmomap_message_subscribe(const bContext *C, wmGizmoMap *gzmap, ARegion *region, wmMsgBus *mbus)
static void gizmomap_prepare_drawing(wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos, const eWM_GizmoFlagMapDrawStep drawstep)
wmGizmoMap * WM_gizmomap_new_from_type(const wmGizmoMapType_Params *gzmap_params)
wmGizmo * wm_gizmomap_modal_get(wmGizmoMap *gzmap)
void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, wmMsgBus *mbus, ARegion *region)
void WM_cursor_warp(wmWindow *win, int x, int y)