115 MEM_SAFE_DELETE(msel->
items);
123 msel->
len -= len_subtract;
124 if (msel->
len <= 0) {
152 for (
int i = 0; i < msel->
len; i++) {
153 if (msel->
items[i] == gz) {
154 for (
int j = i; j < (msel->
len - 1); j++) {
171 gzmap->
type = gzmap_type;
198 gzgroup = gzgroup_next)
200 gzgroup_next = gzgroup->next;
217 memset(gzmap, 0x0,
sizeof(*gzmap));
233 if (gzgroup.
type == gzgt) {
256 const wmGizmoMap *gzmap,
bool ,
bool use_select,
float r_min[3],
float r_max[3])
282 bool (*poll)(
const wmGizmo *,
void *),
292 if (((flag_exclude == 0) || ((gz.
flag & flag_exclude) == 0)) && (!poll || poll(&gz,
data)))
340 if (gzgroup.
hide.delay_refresh_for_tweak) {
350 ListBaseT<LinkData> *draw_gizmos,
378 ListBaseT<LinkData> *draw_gizmos,
381 if (!gzmap || gzmap->
groups.is_empty()) {
425 if (gzgroup.
hide.any != 0) {
452 ListBaseT<LinkData> *draw_gizmos)
455 if ((gzmap ==
nullptr) || gzmap->
groups.is_empty()) {
463 bool is_depth_prev =
false;
466 for (
LinkData &link : draw_gizmos->items_mutable()) {
476 if (is_depth == is_depth_prev) {
486 is_depth_prev = is_depth;
515 ListBaseT<LinkData> draw_gizmos = {
nullptr};
524 const int visible_gizmos_len,
525 bool *r_use_select_bias)
532 const bool use_intel_gpu_workaround =
true;
537 bool is_depth_prev =
false;
538 bool is_depth_skip_prev =
false;
540 for (
int select_id = 0; select_id < visible_gizmos_len; select_id++) {
541 wmGizmo *gz = visible_gizmos[select_id];
547 if (is_depth == is_depth_prev) {
557 is_depth_prev = is_depth;
560 if (is_depth_skip == is_depth_skip_prev) {
565 is_depth_skip_prev = is_depth_skip;
569 *r_use_select_bias =
true;
579 if (is_depth_prev || use_intel_gpu_workaround) {
582 if (is_depth_skip_prev) {
588 const int visible_gizmos_len,
608 bool use_select_bias =
false;
629 if (use_select_bias && (hits > 1)) {
630 float co_direction[3];
631 float co_screen[3] = {
float(co[0]),
float(co[1]), 0.0f};
635 const int viewport[4] = {0, 0, region->
winx, region->
winy};
636 float co_3d_origin[3];
645 wmGizmo *gz = visible_gizmos[hit_result.id >> 8];
647 co_screen[2] =
float(
double(hit_result.depth) /
double(
UINT_MAX));
654 select_bias *=
scale;
657 const float dot_test =
dot_v3v3(co_3d, co_direction) - select_bias;
658 if (dot_best > dot_test) {
660 hit_found = hit_result.id;
667 return hit_near ? hit_near->
id : -1;
676 const int visible_gizmos_len,
680 int visible_gizmos_len_trim = visible_gizmos_len;
691 for (
int select_id = 0; select_id < visible_gizmos_len; select_id++) {
692 wmGizmo *gz = visible_gizmos[select_id];
699 visible_gizmos_len_trim = select_id;
719 if (viewport ==
nullptr) {
741 const int hotspot_radii[] = {
748 for (
int i = 0; i <
ARRAY_SIZE(hotspot_radii); i++) {
750 visible_gizmos, visible_gizmos_len_trim,
C, co, hotspot_radii[i]);
760 const int select_id = hit >> 8;
761 const int select_part = hit & 0xff;
763 *r_part = select_part;
764 result = visible_gizmos[select_id];
798 for (
int i = 0; i <
ARRAY_SIZE(do_step); i++) {
820 wm, &gzgroup, event->
modifier, &visible_3d_gizmos);
833 if (!visible_3d_gizmos.
is_empty()) {
837 C, mval, visible_3d_gizmos.
data(), visible_3d_gizmos.
size(), r_part);
867 const bool modal_running = (handler->
op !=
nullptr);
870 if (!handler->
context.region || !handler->
context.region->runtime->gizmo_map) {
884 if (gz && gzop && (gzop->
type !=
nullptr) && (gzop->
type == handler->
op->
type)) {
886 if (modal_fn !=
nullptr) {
917 if (msel->
items ==
nullptr || msel->
len == 0) {
921 for (
int i = 0; i < msel->
len; i++) {
950 bool changed =
false;
967 bool changed =
false;
995 for (area = screen->
areabase.first(); area; area = area->
next) {
996 if (area == handler->
context.area) {
1000 if (area ==
nullptr) {
1007 for (region = area->
regionbase.first(); region; region = region->
next) {
1008 if (region == handler->
context.region) {
1039 const bool init_last_cursor = !(gzmap->
gzmap_context.highlight &&
1051 if (init_last_cursor) {
1057 if (init_last_cursor) {
1091 bool do_refresh =
false;
1129 if (gzop && gzop->
type) {
1187 if (step_iter ==
step) {
1190 if ((gzmap->
update_flag[i] & update_flag) == update_flag) {
1254 *r_exit_on_event =
false;
1261 *r_exit_on_event =
true;
1278 if (gzmap_type.spaceid == gzmap_params->
spaceid &&
1279 gzmap_type.regionid == gzmap_params->
regionid)
1307 gzmap_type = gzmap_type_next)
1309 gzmap_type_next = gzmap_type->next;
1310 for (
wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first(), *gzgt_next; gzgt_ref;
1311 gzgt_ref = gzgt_next)
1313 gzgt_next = gzgt_ref->next;
1316 MEM_delete(gzmap_type);
1384 gzgt_ref = gzgt_ref_next)
1386 gzgt_ref_next = gzgt_ref->next;
1401 if (gzmap_type.type_update_flag & type_update_all) {
1422 screen =
static_cast<bScreen *
>(screen->id.next))
1424 for (
ScrArea &area : screen->areabase) {
1428 for (
ARegion ®ion : *regionbase) {
1429 wmGizmoMap *gzmap = region.runtime->gizmo_map;
1434 gzgroup = gzgroup_next)
1436 gzgroup_next = gzgroup->next;
1437 if (gzgroup->tag_remove) {
1468 screen =
static_cast<bScreen *
>(screen->id.next))
1470 for (
ScrArea &area : screen->areabase) {
1474 for (
ARegion ®ion : *regionbase) {
1475 wmGizmoMap *gzmap = region.runtime->gizmo_map;
1476 if ((gzmap !=
nullptr) && (gzmap->
is_init ==
false)) {
#define ENUM_OPERATORS(_enum_type)
#define OPERATOR_RETVAL_CHECK(ret)
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
#define GPU_framebuffer_ensure_config(_fb,...)
Read Blender memory allocation and freeing.
#define WM_GIZMOMAP_DRAWSTEP_MAX
#define BLI_assert_unreachable()
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
#define MEM_realloc_uninitialized(vmemh, len)
Span< T > as_span() const
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
float3x3 scale(float3x3 mat, float2 scale)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
ARegion * tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
bool wm_gizmomap_highlight_pending(const wmGizmoMap *gzmap)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static bool wm_gizmomap_select_all_intern(bContext *C, wmGizmoMap *gzmap)
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)
ListBaseT< wmGizmoGroup > * wm_gizmomap_groups_get(wmGizmoMap *gzmap)
ScrArea * CTX_wm_area(const bContext *C)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
static Set< wmGizmo * > WM_gizmomap_gizmo_hash_new(const bContext *C, wmGizmoMap *gzmap, bool(*poll)(const wmGizmo *, void *), void *data, const eWM_GizmoFlag flag_exclude)
void WM_gizmomaptype_group_init_runtime_keymap(const Main *bmain, wmGizmoGroupType *gzgt)
const ListBaseT< wmGizmoGroup > * WM_gizmomap_group_list(wmGizmoMap *gzmap)
static eWM_GizmoFlagGroupTypeGlobalFlag wm_gzmap_type_update_flag
void wm_gizmomap_select_array_remove(wmGizmoMap *gzmap, wmGizmo *gz)
void WM_gizmoconfig_update_tag_group_remove(wmGizmoMap *gzmap)
void GPU_framebuffer_restore()
wmGizmo * WM_gizmomap_get_modal(const wmGizmoMap *gzmap)
void GPU_polygon_smooth(bool enable)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
void GPU_framebuffer_free(gpu::FrameBuffer *fb)
wmGizmo ** wm_gizmomap_selected_get(wmGizmoMap *gzmap, int *r_selected_len)
@ GPU_SELECT_NEAREST_SECOND_PASS
@ GPU_SELECT_NEAREST_FIRST_PASS
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
wmOperatorStatus WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop, const wmEvent *event)
void GPU_line_smooth(bool enable)
void WM_gizmomap_message_subscribe(const bContext *C, wmGizmoMap *gzmap, ARegion *region, wmMsgBus *mbus)
static void gizmomap_prepare_drawing(wmGizmoMap *gzmap, const bContext *C, ListBaseT< LinkData > *draw_gizmos, const eWM_GizmoFlagMapDrawStep drawstep)
static ListBaseT< wmGizmoMapType > gizmomaptypes
void GPU_depth_mask(bool depth)
wmKeyMap * wm_gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf)
bool wm_gizmomap_deselect_all(wmGizmoMap *gzmap)
wmWindow * CTX_wm_window(const bContext *C)
void view3d_operator_needs_gpu(const bContext *C)
bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
void wm_gizmos_keymap(wmKeyConfig *keyconf)
void WM_gizmomap_add_handlers(ARegion *region, wmGizmoMap *gzmap)
wmGizmoGroupType * WM_gizmogrouptype_find(const StringRef idname, bool quiet)
void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
void WM_tooltip_clear(bContext *C, wmWindow *win)
void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
void ED_region_tag_redraw_editor_overlays(ARegion *region)
void ED_region_tag_redraw(ARegion *region)
bool WM_gizmomap_tag_delay_refresh_for_tweak_check(wmGizmoMap *gzmap)
unsigned int GPU_select_end()
void WM_gizmo_group_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBaseT< LinkData > *draw_gizmos)
wmGizmoGroup * wm_gizmogroup_new_from_type(wmGizmoMap *gzmap, wmGizmoGroupType *gzgt)
void WM_reinit_gizmomap_all(Main *bmain)
bool wm_gizmomap_highlight_handled(wmGizmoMap *gzmap)
static bool gizmo_prepare_drawing(wmGizmoMap *gzmap, wmGizmo *gz, const bContext *C, ListBaseT< LinkData > *draw_gizmos, const eWM_GizmoFlagMapDrawStep drawstep)
static void wm_gizmomap_select_array_ensure_len_alloc(wmGizmoMap *gzmap, int len)
bool wm_gizmo_select_set_ex(wmGizmoMap *gzmap, wmGizmo *gz, bool select, bool use_array, bool use_callback)
static bool gizmo_selectable_poll(const wmGizmo *gz, void *)
bool WM_gizmomap_minmax(const wmGizmoMap *gzmap, bool, bool use_select, float r_min[3], float r_max[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
void wm_gizmomap_select_array_push_back(wmGizmoMap *gzmap, wmGizmo *gz)
wmGizmo * wm_gizmomap_highlight_find(wmGizmoMap *gzmap, bContext *C, const wmEvent *event, int *r_part)
void WM_gizmomaptype_group_init_runtime(const Main *bmain, wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
VecBase< float, 2 > float2
void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, wmMsgBus *mbus, ARegion *region)
void wm_gizmogroup_intersectable_gizmos_to_list(wmWindowManager *wm, wmGizmoGroup *gzgroup, const int event_modifier, Vector< wmGizmo *, 128 > *r_visible_gizmos)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
eWM_GizmoFlagGroupTypeGlobalFlag
@ WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE
@ WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE
@ WM_GIZMOTYPE_GLOBAL_REINIT_ALL
@ WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT
void wm_gizmogrouptype_setup_keymap(wmGizmoGroupType *gzgt, wmKeyConfig *keyconf)
void WM_cursor_grab_enable(wmWindow *win, const eWM_CursorWrapAxis wrap, const rcti *wrap_region, const bool hide)
eWM_GizmoFlagTweak
Gizmo tweak flag. Bit-flag passed to gizmo while tweaking.
void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
BMesh const char void * data
int wm_gizmo_is_visible(wmGizmo *gz)
void WM_gizmomaptype_group_free(wmGizmoGroupTypeRef *gzgt_ref)
wmWindowManager * CTX_wm_manager(const bContext *C)
bool WM_gizmo_context_check_drawstep(const bContext *C, eWM_GizmoFlagMapDrawStep step)
void WM_gizmoconfig_update_tag_group_type_init(wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
void ED_view3d_win_to_vector(const ARegion *region, const float mval[2], float r_out[3])
void WM_gizmoconfig_update(Main *bmain)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
wmGizmoGroup * WM_gizmomap_group_find_ptr(wmGizmoMap *gzmap, const wmGizmoGroupType *gzgt)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz, int part)
void WM_gizmogroup_ensure_init(const bContext *C, wmGizmoGroup *gzgroup)
LinkData * BLI_genericNodeN(void *data)
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)
void WM_gizmomap_tag_refresh_drawstep(wmGizmoMap *gzmap, const eWM_GizmoFlagMapDrawStep drawstep)
void WM_cursor_grab_disable(wmWindow *win, const int mouse_ungrab_xy[2])
bool WM_gizmomap_cursor_set(const wmGizmoMap *gzmap, wmWindow *win)
eWM_GizmoFlagMapTypeUpdateFlag
@ WM_GIZMOMAPTYPE_KEYMAP_INIT
@ WM_GIZMOMAPTYPE_UPDATE_INIT
@ WM_GIZMOMAPTYPE_UPDATE_REMOVE
eWM_GizmoFlagMapDrawStep WM_gizmomap_drawstep_from_gizmo_group(const wmGizmoGroup *gzgroup)
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
wmGizmo * wm_gizmomap_modal_get(wmGizmoMap *gzmap)
void wm_gizmomap_remove(wmGizmoMap *gzmap)
void wm_gizmomaptypes_free()
bool wm_gizmogroup_is_visible_in_drawstep(const wmGizmoGroup *gzgroup, const eWM_GizmoFlagMapDrawStep drawstep)
void wm_gizmomap_select_array_shrink(wmGizmoMap *gzmap, int len_subtract)
@ WM_GIZMOGROUP_INIT_REFRESH
@ WM_GIZMOGROUP_INIT_SETUP
static wmGizmoMap * wm_gizmomap_new_from_type_ex(wmGizmoMapType *gzmap_type, wmGizmoMap *gzmap)
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL
@ WM_GIZMOGROUPTYPE_DEPTH_3D
@ WM_GIZMOGROUPTYPE_SELECT
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE
@ WM_GIZMO_SELECT_BACKGROUND
void wm_gizmomap_handler_context_gizmo(bContext *, wmEventHandler_Gizmo *)
static void wm_gizmomap_free_data(wmGizmoMap *gzmap)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
@ WM_GIZMO_STATE_HIGHLIGHT
const GPUSelectResult * GPU_select_buffer_near(const Span< GPUSelectResult > hit_results)
bool WM_gizmo_select_set(wmGizmoMap *gzmap, wmGizmo *gz, bool select)
gpu::Texture * GPU_viewport_depth_texture(GPUViewport *viewport)
void WM_gizmomap_reinit(wmGizmoMap *gzmap)
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])
wmGizmoMap * WM_gizmomap_new_from_type(const wmGizmoMapType_Params *gzmap_params)
void GPU_select_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode, int oldhits)
void WM_gizmomap_draw(wmGizmoMap *gzmap, const bContext *C, const eWM_GizmoFlagMapDrawStep drawstep)
@ GIZMOMAP_IS_REFRESH_CALLBACK
@ GIZMOMAP_IS_PREPARE_DRAW
wmGizmoMapType * WM_gizmomaptype_find(const wmGizmoMapType_Params *gzmap_params)
wmGizmoMapType * WM_gizmomaptype_ensure(const wmGizmoMapType_Params *gzmap_params)
void WM_gizmomaptype_group_unlink(bContext *C, Main *bmain, wmGizmoMapType *gzmap_type, const wmGizmoGroupType *gzgt)
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
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_gizmo_group_type_poll(const bContext *C, const wmGizmoGroupType *gzgt)
Scene * CTX_data_scene(const bContext *C)
bScreen * CTX_wm_screen(const bContext *C)
void CTX_wm_region_set(bContext *C, ARegion *region)
void WM_cursor_set(wmWindow *win, int curs)
void wm_gizmomap_select_array_clear(wmGizmoMap *gzmap)
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)
ARegion * WM_gizmomap_tooltip_init(bContext *C, ARegion *region, int *, double *, bool *r_exit_on_event)
wmOperatorStatus(*)(bContext *, wmGizmo *, const wmEvent *, eWM_GizmoFlagTweak) wmGizmoFnModal
void wm_gizmomaps_handled_modal_update(bContext *C, wmEvent *event, wmEventHandler_Op *handler)
wmGizmoOpElem * WM_gizmo_operator_get(wmGizmo *gz, int part_index)
wmGizmo * wm_gizmomap_highlight_get(wmGizmoMap *gzmap)
void WM_event_add_mousemove(wmWindow *win)
void WM_gizmoconfig_update_tag_reinit_all()
void WM_cursor_warp(wmWindow *win, int x, int y)
void wm_gizmomap_modal_set(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event, bool enable)
@ WM_GIZMO_IS_VISIBLE_UPDATE
@ WM_GIZMO_IS_VISIBLE_DRAW
void BLI_rcti_init_pt_radius(struct rcti *rect, const int xy[2], int size)
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
void GPU_depth_test(GPUDepthTest test)
static void gizmo_draw_select_3d_loop(const bContext *C, wmGizmo **visible_gizmos, const int visible_gizmos_len, bool *r_use_select_bias)
void WM_gizmoconfig_update_tag_group_type_remove(wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
ARegion * CTX_wm_region(const bContext *C)
bool WM_gizmomap_is_any_selected(const wmGizmoMap *gzmap)
@ WM_GIZMOMAP_DRAWSTEP_3D
@ WM_GIZMOMAP_DRAWSTEP_2D
void CTX_wm_area_set(bContext *C, ScrArea *area)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bke::ARegionRuntime * runtime
ListBaseT< bScreen > screens
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
ListBaseT< ARegion > regionbase
ListBaseT< struct ScrArea > areabase
ListBaseT< wmEventHandler > handlers
struct wmGizmoMap * gizmo_map
struct blender::wmEventHandler_Op::@170112141227310273104305047374063031143165303304 context
eWM_EventHandlerType type
wmEventModifierFlag modifier
wmGizmoGroupFnMsgBusSubscribe message_subscribe
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
wmGizmoGroupFnDrawBackground draw_background
wmGizmoGroupFnInvokePrepare invoke_prepare
wmGizmoGroupFnDrawPrepare draw_prepare
eWM_GizmoFlagGroupTypeFlag flag
eWM_GizmoFlagGroupInitFlag init_flag
ListBaseT< wmGizmo > gizmos
union blender::wmGizmoGroup::@230200225053276264314243222225366004150335145357 hide
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
ListBaseT< wmGizmoGroupTypeRef > grouptype_refs
struct blender::wmGizmoMap::@077047172235271304035100110332311133341144335100 gzmap_context
bool tag_highlight_pending
ListBaseT< wmGizmoGroup > groups
char update_flag[WM_GIZMOMAP_DRAWSTEP_MAX]
wmGizmoFnDrawSelect draw_select
wmGizmoFnCursorGet cursor_get
wmGizmoFnTestSelect test_select
wmGizmoGroup * parent_gzgroup
wmGizmoFnModal custom_modal
struct wmOperatorType * type