120 msel->
len -= len_subtract;
121 if (msel->
len <= 0) {
149 for (
int i = 0; i < msel->
len; i++) {
150 if (msel->
items[i] == gz) {
151 for (
int j = i; j < (msel->
len - 1); j++) {
168 gzmap->
type = gzmap_type;
196 gzgroup = gzgroup_next)
198 gzgroup_next = gzgroup->next;
215 memset(gzmap, 0x0,
sizeof(*gzmap));
231 if (gzgroup->type == gzgt) {
254 const wmGizmoMap *gzmap,
bool ,
bool use_select,
float r_min[3],
float r_max[3])
280 bool (*poll)(
const wmGizmo *,
void *),
290 if (((flag_exclude == 0) || ((gz->flag & flag_exclude) == 0)) && (!poll || poll(gz, data)))
333 if (gzgroup->hide.delay_refresh_for_tweak) {
384 gzmap->
update_flag[drawstep] &= ~GIZMOMAP_IS_REFRESH_CALLBACK;
412 gzgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH;
418 if (gzgroup->hide.any != 0) {
423 if (gzgroup->type->draw_prepare) {
424 gzgroup->type->draw_prepare(C, gzgroup);
432 gzmap->
update_flag[drawstep] &= ~GIZMOMAP_IS_PREPARE_DRAW;
450 bool is_depth_prev =
false;
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,
578 View3D *v3d =
static_cast<View3D *
>(area->spacedata.first);
590 bool use_select_bias =
false;
611 if (use_select_bias && (hits > 1)) {
612 float co_direction[3];
613 float co_screen[3] = {
float(co[0]),
float(co[1]), 0.0f};
617 const int viewport[4] = {0, 0, region->winx, region->winy};
618 float co_3d_origin[3];
627 wmGizmo *gz = visible_gizmos[hit_result.id >> 8];
629 co_screen[2] =
float(
double(hit_result.depth) /
double(
UINT_MAX));
636 const float dot_test =
dot_v3v3(co_3d, co_direction) - select_bias;
637 if (dot_best > dot_test) {
639 hit_found = hit_result.id;
646 return hit_near ? hit_near->
id : -1;
655 const int visible_gizmos_len,
659 int visible_gizmos_len_trim = visible_gizmos_len;
670 for (
int select_id = 0; select_id < visible_gizmos_len; select_id++) {
671 wmGizmo *gz = visible_gizmos[select_id];
678 visible_gizmos_len_trim = select_id;
698 if (viewport ==
nullptr) {
702 GPUFrameBuffer *depth_read_fb =
nullptr;
710 const int hotspot_radii[] = {
711 int(3 *
U.pixelsize),
713 int(10 *
U.pixelsize),
715 for (
int i = 0; i <
ARRAY_SIZE(hotspot_radii); i++) {
717 visible_gizmos, visible_gizmos_len_trim, C, co, hotspot_radii[i]);
727 const int select_id = hit >> 8;
728 const int select_part = hit & 0xff;
730 *r_part = select_part;
731 result = visible_gizmos[select_id];
756 for (
int i = 0; i <
ARRAY_SIZE(do_step); i++) {
778 wm, gzgroup, event->
modifier, &visible_3d_gizmos);
782 wm, gzgroup, C, event->
modifier, mval, r_part)))
791 if (visible_3d_gizmos.count) {
796 static_cast<wmGizmo **
>(visible_3d_gizmos.data),
797 visible_3d_gizmos.count,
830 const bool modal_running = (handler->
op !=
nullptr);
847 if (gz && gzop && (gzop->
type !=
nullptr) && (gzop->
type == handler->
op->
type)) {
849 if (modal_fn !=
nullptr) {
879 if (msel->
items ==
nullptr || msel->
len == 0) {
883 for (
int i = 0; i < msel->
len; i++) {
914 bool changed =
false;
933 bool changed =
false;
961 for (area =
static_cast<ScrArea *
>(screen->areabase.first); area; area = area->next) {
966 if (area ==
nullptr) {
969 printf(
"internal error: modal gizmo-map handler has invalid area\n");
974 for (region =
static_cast<ARegion *
>(area->regionbase.first); region; region = region->next)
1019 if (init_last_cursor) {
1025 if (init_last_cursor) {
1059 bool do_refresh =
false;
1073 const int retval = gz->
type->
invoke(C, gz, event);
1095 if (gzop && gzop->
type) {
1103 gz->
state &= ~WM_GIZMO_STATE_MODAL;
1113 gz->
state &= ~WM_GIZMO_STATE_MODAL;
1151 if (step_iter == step) {
1154 if ((gzmap->
update_flag[i] & update_flag) == update_flag) {
1202 if (gzgroup->type->message_subscribe !=
nullptr) {
1203 gzgroup->type->message_subscribe(C, gzgroup, mbus);
1215 bContext *C,
ARegion *region,
int * ,
double * ,
bool *r_exit_on_event)
1218 *r_exit_on_event =
false;
1225 *r_exit_on_event =
true;
1242 if (gzmap_type->spaceid == gzmap_params->
spaceid &&
1243 gzmap_type->regionid == gzmap_params->
regionid)
1274 gzmap_type = gzmap_type_next)
1276 gzmap_type_next = gzmap_type->
next;
1281 gzgt_ref = gzgt_next)
1283 gzgt_next = gzgt_ref->
next;
1351 gzmap_type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
1356 gzgt_ref = gzgt_ref_next)
1358 gzgt_ref_next = gzgt_ref->next;
1360 gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
1373 if (gzmap_type->type_update_flag & type_update_all) {
1378 gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT;
1383 gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_INIT;
1394 screen =
static_cast<bScreen *
>(screen->id.next))
1398 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
1408 gzgroup = gzgroup_next)
1410 gzgroup_next = gzgroup->next;
1411 if (gzgroup->tag_remove) {
1442 screen =
static_cast<bScreen *
>(screen->id.next))
1446 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
1449 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)
#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
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_)
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)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
struct LinkData * BLI_genericNodeN(void *data)
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(...)
void ED_region_tag_redraw_editor_overlays(ARegion *region)
void ED_region_tag_redraw(ARegion *region)
void view3d_operator_needs_opengl(const bContext *C)
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 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_bind(GPUFrameBuffer *framebuffer)
#define GPU_framebuffer_ensure_config(_fb,...)
void GPU_framebuffer_free(GPUFrameBuffer *framebuffer)
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)
@ GPU_SELECT_NEAREST_SECOND_PASS
@ GPU_SELECT_NEAREST_FIRST_PASS
unsigned int GPU_select_end()
void GPU_select_begin(GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode 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)
GPUTexture * 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_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
Span< T > as_span() const
const Depsgraph * depsgraph
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
struct wmGizmoMap * gizmo_map
struct wmGizmoMap * gizmo_map
struct wmEventHandler_Op::@1394 context
eWM_EventHandlerType type
wmGizmoGroupFnInvokePrepare invoke_prepare
eWM_GizmoFlagGroupTypeFlag flag
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
wmGizmoMapSelectState select
struct wmGizmoMap::@1370 gzmap_context
Gizmo map runtime context.
char update_flag[WM_GIZMOMAP_DRAWSTEP_MAX]
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)
int 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)
int(*)(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_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)
void wm_gizmogroup_intersectable_gizmos_to_list(wmWindowManager *wm, const wmGizmoGroup *gzgroup, const int event_modifier, BLI_Buffer *visible_gizmos)
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 char *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)
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)
@ GIZMOMAP_IS_PREPARE_DRAW
@ GIZMOMAP_IS_REFRESH_CALLBACK
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
void wm_gizmomaptypes_free()
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_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)