119 msel->
len -= len_subtract;
120 if (msel->
len <= 0) {
146 for (
int i = 0; i < msel->
len; i++) {
147 if (msel->
items[i] == gz) {
148 for (
int j = i; j < (msel->
len - 1); j++) {
166 gzmap->
type = gzmap_type;
196 gzgroup = gzgroup_next) {
197 gzgroup_next = gzgroup->next;
215 memset(gzmap, 0x0,
sizeof(*gzmap));
232 if (gzgroup->type == gzgt) {
282 bool (*poll)(
const wmGizmo *,
void *),
292 if (((flag_exclude == 0) || ((gz->flag & flag_exclude) == 0)) &&
293 (!poll || poll(gz,
data))) {
335 if (gzgroup->hide.delay_refresh_for_tweak) {
420 if (gzgroup->hide.any != 0) {
425 if (gzgroup->type->draw_prepare) {
426 gzgroup->type->draw_prepare(
C, gzgroup);
452 bool is_depth_prev =
false;
455 for (
LinkData *link = draw_gizmos->
first, *link_next; link; link = link_next) {
457 link_next = link->
next;
467 if (is_depth == is_depth_prev) {
477 is_depth_prev = is_depth;
515 const int visible_gizmos_len,
516 bool *r_use_select_bias)
521 bool is_depth_prev =
false;
522 bool is_depth_skip_prev =
false;
524 for (
int select_id = 0; select_id < visible_gizmos_len; select_id++) {
525 wmGizmo *gz = visible_gizmos[select_id];
531 if (is_depth == is_depth_prev) {
541 is_depth_prev = is_depth;
544 if (is_depth_skip == is_depth_skip_prev) {
549 is_depth_skip_prev = is_depth_skip;
553 *r_use_select_bias =
true;
564 if (is_depth_skip_prev) {
570 const int visible_gizmos_len,
590 bool use_select_bias =
false;
610 if (use_select_bias && (hits > 1)) {
611 float co_direction[3];
612 float co_screen[3] = {co[0], co[1], 0.0f};
616 const int viewport[4] = {0, 0, region->
winx, region->
winy};
617 float co_3d_origin[3];
627 float dot_best = FLT_MAX;
629 for (
int i = 0; i < hits; i++, buf_iter += 4) {
631 wmGizmo *gz = visible_gizmos[buf_iter[3] >> 8];
640 const float dot_test =
dot_v3v3(co_3d, co_direction) - select_bias;
641 if (dot_best > dot_test) {
643 hit_found = buf_iter[3];
650 return hit_near ? hit_near[3] : -1;
659 const int visible_gizmos_len,
663 int visible_gizmos_len_trim = visible_gizmos_len;
674 for (
int select_id = 0; select_id < visible_gizmos_len; select_id++) {
675 wmGizmo *gz = visible_gizmos[select_id];
682 visible_gizmos_len_trim = select_id;
695 const int hotspot_radii[] = {
700 for (
int i = 0; i <
ARRAY_SIZE(hotspot_radii); i++) {
702 visible_gizmos, visible_gizmos_len_trim,
C, co, hotspot_radii[i]);
709 const int select_id = hit >> 8;
710 const int select_part = hit & 0xff;
712 *r_part = select_part;
713 result = visible_gizmos[select_id];
734 for (
int i = 0; i <
ARRAY_SIZE(do_step); i++) {
765 wm, gzgroup, event_modifier, &visible_3d_gizmos);
769 wm, gzgroup,
C, event_modifier, event->
mval, r_part))) {
777 if (visible_3d_gizmos.count) {
781 C, event->
mval, visible_3d_gizmos.data, visible_3d_gizmos.count, r_part);
812 const bool modal_running = (handler->
op !=
NULL);
831 if (modal_fn !=
NULL) {
832 int retval = modal_fn(
C, gz, event, 0);
869 for (
int i = 0; i < msel->
len; i++) {
900 bool changed =
false;
925 bool changed =
false;
965 printf(
"internal error: modal gizmo-map handler has invalid area\n");
970 for (region =
area->regionbase.first; region; region = region->
next) {
1014 if (init_last_cursor) {
1020 if (init_last_cursor) {
1069 const int retval = gz->
type->
invoke(
C, gz, event);
1088 if (gzop && gzop->
type) {
1165 if (gzgroup->type->message_subscribe !=
NULL) {
1166 gzgroup->type->message_subscribe(
C, gzgroup, mbus);
1180 double *
UNUSED(pass_delay),
1181 bool *r_exit_on_event)
1184 *r_exit_on_event =
false;
1191 *r_exit_on_event =
true;
1208 if (gzmap_type->spaceid == gzmap_params->
spaceid &&
1209 gzmap_type->regionid == gzmap_params->
regionid) {
1236 gzmap_type = gzmap_type_next) {
1237 gzmap_type_next = gzmap_type->next;
1238 for (
wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first, *gzgt_next; gzgt_ref;
1239 gzgt_ref = gzgt_next) {
1240 gzgt_next = gzgt_ref->next;
1313 gzgt_ref = gzgt_ref_next) {
1314 gzgt_ref_next = gzgt_ref->next;
1329 if (gzmap_type->type_update_flag & type_update_all) {
1330 gzmap_type->type_update_flag &= ~type_update_all;
1360 gzgroup = gzgroup_next) {
1361 gzgroup_next = gzgroup->next;
1362 if (gzgroup->tag_remove) {
1390 ListBase *regionbase = (sl ==
area->spacedata.first) ? &
area->regionbase : &sl->regionbase;
1393 if ((gzmap !=
NULL) && (gzmap->
is_init ==
false)) {
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
void CTX_wm_region_set(bContext *C, struct ARegion *region)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct bScreen * CTX_wm_screen(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
void CTX_wm_area_set(bContext *C, struct ScrArea *area)
struct wmWindow * CTX_wm_window(const bContext *C)
#define BLI_assert_unreachable()
#define BLI_buffer_declare_static(type_, name_, flag_, static_count_)
#define BLI_buffer_free(name_)
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghash_len(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)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
#define GHASH_ITER_INDEX(gh_iter_, ghash_, i_)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
struct LinkData * BLI_genericNodeN(void *data)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float int_as_float(int i)
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 UNUSED_VARS_NDEBUG(...)
struct Depsgraph Depsgraph
void ED_region_tag_redraw_editor_overlays(struct ARegion *region)
void ED_view3d_draw_setup_view(const struct wmWindowManager *wm, struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene *scene, struct ARegion *region, struct View3D *v3d, const float viewmat[4][4], const float winmat[4][4], const struct rcti *rect)
void ED_view3d_win_to_vector(const struct ARegion *region, const float mval[2], float out[3])
void view3d_operator_needs_opengl(const struct bContext *C)
void GPU_matrix_unproject_with_precalc(const struct GPUMatrixUnproject_Precalc *unproj_precalc, const float win[3], float r_world[3])
bool GPU_matrix_unproject_precalc(struct GPUMatrixUnproject_Precalc *unproj_precalc, const float model[4][4], const float proj[4][4], const int view[4])
@ GPU_SELECT_NEAREST_SECOND_PASS
@ GPU_SELECT_NEAREST_FIRST_PASS
unsigned int GPU_select_end(void)
const uint * GPU_select_buffer_near(const uint *buffer, int hits)
void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, const struct rcti *input, char mode, int oldhits)
void GPU_line_smooth(bool enable)
void GPU_depth_mask(bool depth)
void GPU_depth_test(eGPUDepthTest test)
void GPU_polygon_smooth(bool enable)
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
struct ARegion * UI_tooltip_create_from_gizmo(struct bContext *C, struct wmGizmo *gz)
@ WM_GIZMOMAP_DRAWSTEP_3D
@ WM_GIZMOMAP_DRAWSTEP_2D
@ 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_DEPTH_3D
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL
@ WM_GIZMOGROUPTYPE_SELECT
@ WM_GIZMO_STATE_HIGHLIGHT
#define WM_GIZMOMAP_DRAWSTEP_MAX
const Depsgraph * depsgraph
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
struct wmGizmoMap * gizmo_map
struct wmGizmoMap * gizmo_map
struct wmEventHandler_Op::@1171 context
enum eWM_EventHandlerType type
wmGizmoGroupFnInvokePrepare invoke_prepare
eWM_GizmoFlagGroupTypeFlag flag
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
union wmGizmoGroup::@1150 hide
struct wmGizmoGroupType * type
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
char update_flag[WM_GIZMOMAP_DRAWSTEP_MAX]
struct wmGizmoMapType * type
struct wmGizmoMap::@1146 gzmap_context
Gizmo map runtime context.
struct wmGizmo * highlight
struct wmGizmoMapSelectState select
struct wmOperatorType * type
wmGizmoFnTestSelect test_select
wmGizmoFnCursorGet cursor_get
wmGizmoFnDrawSelect draw_select
struct wmGizmoGroup * parent_gzgroup
wmGizmoFnModal custom_modal
const struct wmGizmoType * type
struct wmOperatorType * type
void WM_cursor_set(wmWindow *win, int curs)
void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4])
void WM_cursor_grab_disable(wmWindow *win, const int mouse_ungrab_xy[2])
int WM_event_modifier_flag(const wmEvent *event)
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)
bool WM_gizmo_context_check_drawstep(const struct bContext *C, eWM_GizmoFlagMapDrawStep step)
int WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop)
void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
struct wmGizmoOpElem * WM_gizmo_operator_get(wmGizmo *gz, int part_index)
bool WM_gizmo_select_set(wmGizmoMap *gzmap, wmGizmo *gz, bool select)
int wm_gizmo_is_visible(wmGizmo *gz)
int(* wmGizmoFnModal)(struct bContext *, struct wmGizmo *, const struct wmEvent *, eWM_GizmoFlagTweak)
void WM_gizmo_group_refresh(const bContext *C, wmGizmoGroup *gzgroup)
void WM_gizmomaptype_group_init_runtime_keymap(const Main *bmain, wmGizmoGroupType *gzgt)
wmGizmoGroup * wm_gizmogroup_new_from_type(wmGizmoMap *gzmap, 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)
void WM_gizmogroup_ensure_init(const bContext *C, wmGizmoGroup *gzgroup)
wmKeyMap * wm_gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf)
bool wm_gizmogroup_is_visible_in_drawstep(const wmGizmoGroup *gzgroup, const eWM_GizmoFlagMapDrawStep drawstep)
void WM_gizmomaptype_group_free(wmGizmoGroupTypeRef *gzgt_ref)
void wm_gizmogroup_intersectable_gizmos_to_list(wmWindowManager *wm, const wmGizmoGroup *gzgroup, const int event_modifier, BLI_Buffer *visible_gizmos)
wmGizmo * wm_gizmogroup_find_intersected_gizmo(wmWindowManager *wm, const wmGizmoGroup *gzgroup, bContext *C, const int event_modifier, const int mval[2], int *r_part)
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)
void wm_gizmogroup_free(bContext *C, wmGizmoGroup *gzgroup)
wmGizmoGroupType * WM_gizmogrouptype_find(const char *idname, bool quiet)
@ WM_GIZMO_IS_VISIBLE_DRAW
@ WM_GIZMO_IS_VISIBLE_UPDATE
wmGizmoMapType * WM_gizmomaptype_find(const struct wmGizmoMapType_Params *gzmap_params)
static wmGizmo * gizmo_find_intersected_3d(bContext *C, const int co[2], wmGizmo **visible_gizmos, const int visible_gizmos_len, int *r_part)
void wm_gizmomap_modal_set(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event, bool enable)
eWM_GizmoFlagMapDrawStep WM_gizmomap_drawstep_from_gizmo_group(const wmGizmoGroup *gzgroup)
wmGizmoMapType * WM_gizmomaptype_ensure(const struct wmGizmoMapType_Params *gzmap_params)
static void wm_gizmomap_select_array_ensure_len_alloc(wmGizmoMap *gzmap, int len)
bool WM_gizmomap_is_any_selected(const wmGizmoMap *gzmap)
wmGizmo * wm_gizmomap_highlight_get(wmGizmoMap *gzmap)
void wm_gizmomaptypes_free(void)
void wm_gizmomaps_handled_modal_update(bContext *C, wmEvent *event, wmEventHandler_Op *handler)
@ GIZMOMAP_IS_PREPARE_DRAW
@ GIZMOMAP_IS_REFRESH_CALLBACK
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)
void WM_reinit_gizmomap_all(Main *bmain)
struct ARegion * WM_gizmomap_tooltip_init(struct bContext *C, struct ARegion *region, int *UNUSED(r_pass), double *UNUSED(pass_delay), bool *r_exit_on_event)
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_minmax(const wmGizmoMap *gzmap, bool UNUSED(use_hidden), bool use_select, float r_min[3], float r_max[3])
bool WM_gizmomap_tag_delay_refresh_for_tweak_check(wmGizmoMap *gzmap)
void wm_gizmomap_select_array_remove(wmGizmoMap *gzmap, wmGizmo *gz)
ListBase * wm_gizmomap_groups_get(wmGizmoMap *gzmap)
void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos)
static ListBase gizmomaptypes
void WM_gizmoconfig_update_tag_group_type_remove(wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
wmGizmoGroup * WM_gizmomap_group_find_ptr(struct wmGizmoMap *gzmap, const struct wmGizmoGroupType *gzgt)
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_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)
BLI_INLINE bool gizmo_selectable_poll(const wmGizmo *gz, void *UNUSED(data))
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)
wmGizmoGroup * WM_gizmomap_group_find(struct wmGizmoMap *gzmap, const char *idname)
void WM_gizmoconfig_update_tag_group_remove(wmGizmoMap *gzmap)
static wmGizmoMap * wm_gizmomap_new_from_type_ex(struct wmGizmoMapType *gzmap_type, wmGizmoMap *gzmap)
wmGizmo * wm_gizmomap_highlight_find(wmGizmoMap *gzmap, bContext *C, const wmEvent *event, int *r_part)
void wm_gizmos_keymap(wmKeyConfig *keyconf)
void WM_gizmoconfig_update(struct Main *bmain)
eWM_GizmoFlagGroupTypeGlobalFlag
@ WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE
@ WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT
@ WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE
const ListBase * WM_gizmomap_group_list(wmGizmoMap *gzmap)
wmGizmo * wm_gizmomap_modal_get(wmGizmoMap *gzmap)
void wm_gizmomap_select_array_push_back(wmGizmoMap *gzmap, wmGizmo *gz)
void wm_gizmomap_select_array_shrink(wmGizmoMap *gzmap, int len_subtract)
bool wm_gizmomap_deselect_all(wmGizmoMap *gzmap)
void WM_gizmomap_message_subscribe(const bContext *C, wmGizmoMap *gzmap, ARegion *region, struct wmMsgBus *mbus)
void wm_gizmomap_handler_context_gizmo(bContext *UNUSED(C), wmEventHandler_Gizmo *UNUSED(handler))
static GHash * WM_gizmomap_gizmo_hash_new(const bContext *C, wmGizmoMap *gzmap, bool(*poll)(const wmGizmo *, void *), void *data, const eWM_GizmoFlag flag_exclude)
static void gizmomap_prepare_drawing(wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos, const eWM_GizmoFlagMapDrawStep drawstep)
wmGizmo ** wm_gizmomap_selected_get(wmGizmoMap *gzmap, int *r_selected_len)
wmGizmoMap * WM_gizmomap_new_from_type(const struct wmGizmoMapType_Params *gzmap_params)
void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, ARegion *region)
void WM_cursor_warp(wmWindow *win, int x, int y)