diff options
Diffstat (limited to 'source/blender/windowmanager/gizmo')
5 files changed, 68 insertions, 64 deletions
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h index 7b07546f668..44c1804aa4d 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h @@ -234,7 +234,7 @@ void WM_gizmo_do_msg_notify_tag_refresh(struct bContext *C, struct wmMsgSubscribeValue *msg_val); void WM_gizmo_target_property_subscribe_all(struct wmGizmo *gz, struct wmMsgBus *mbus, - struct ARegion *ar); + struct ARegion *region); void WM_gizmo_target_property_anim_autokey(struct bContext *C, const struct wmGizmo *gz, @@ -295,12 +295,12 @@ bool WM_gizmomap_tag_delay_refresh_for_tweak_check(struct wmGizmoMap *gzmap); void WM_gizmomap_draw(struct wmGizmoMap *gzmap, const struct bContext *C, const eWM_GizmoFlagMapDrawStep drawstep); -void WM_gizmomap_add_handlers(struct ARegion *ar, struct wmGizmoMap *gzmap); +void WM_gizmomap_add_handlers(struct ARegion *region, struct wmGizmoMap *gzmap); bool WM_gizmomap_select_all(struct bContext *C, struct wmGizmoMap *gzmap, const int action); bool WM_gizmomap_cursor_set(const struct wmGizmoMap *gzmap, struct wmWindow *win); void WM_gizmomap_message_subscribe(struct bContext *C, struct wmGizmoMap *gzmap, - struct ARegion *ar, + struct ARegion *region, struct wmMsgBus *mbus); bool WM_gizmomap_is_any_selected(const struct wmGizmoMap *gzmap); bool WM_gizmomap_minmax(const struct wmGizmoMap *gzmap, @@ -309,8 +309,11 @@ bool WM_gizmomap_minmax(const struct wmGizmoMap *gzmap, float r_min[3], float r_max[3]); -struct ARegion *WM_gizmomap_tooltip_init( - struct bContext *C, struct ARegion *ar, int *pass, double *pass_delay, bool *r_exit_on_event); +struct ARegion *WM_gizmomap_tooltip_init(struct bContext *C, + struct ARegion *region, + int *pass, + double *pass_delay, + bool *r_exit_on_event); /* -------------------------------------------------------------------- */ /* wmGizmoMapType */ @@ -334,7 +337,7 @@ void WM_gizmomaptype_group_init_runtime(const struct Main *bmain, struct wmGizmoGroupType *gzgt); wmGizmoGroup *WM_gizmomaptype_group_init_runtime_with_region(struct wmGizmoMapType *gzmap_type, struct wmGizmoGroupType *gzgt, - struct ARegion *ar); + struct ARegion *region); void WM_gizmomaptype_group_unlink(struct bContext *C, struct Main *bmain, struct wmGizmoMapType *gzmap_type, diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index 5ef77090ea0..f2cd847fe75 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -301,8 +301,8 @@ void WM_gizmo_group_remove_by_tool(bContext *C, for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) { for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { if (sa->runtime.tool == tref) { - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - wmGizmoMap *gzmap = ar->gizmo_map; + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + wmGizmoMap *gzmap = region->gizmo_map; if (gzmap && gzmap->type == gzmap_type) { wmGizmoGroup *gzgroup, *gzgroup_next; for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup_next) { @@ -310,7 +310,7 @@ void WM_gizmo_group_remove_by_tool(bContext *C, if (gzgroup->type == gzgt) { BLI_assert(gzgroup->parent_gzmap == gzmap); wm_gizmogroup_free(C, gzgroup); - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); } } } @@ -356,8 +356,8 @@ bool wm_gizmogroup_is_any_selected(const wmGizmoGroup *gzgroup) static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - ARegion *ar = CTX_wm_region(C); - wmGizmoMap *gzmap = ar->gizmo_map; + ARegion *region = CTX_wm_region(C); + wmGizmoMap *gzmap = region->gizmo_map; wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select; wmGizmo *highlight = gzmap->gzmap_context.highlight; @@ -391,7 +391,7 @@ static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE } if (redraw) { - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); } return OPERATOR_FINISHED; @@ -583,8 +583,8 @@ static int gizmo_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event) static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); - wmGizmoMap *gzmap = ar->gizmo_map; + ARegion *region = CTX_wm_region(C); + wmGizmoMap *gzmap = region->gizmo_map; wmGizmo *gz = gzmap->gzmap_context.highlight; /* Needed for single click actions which don't enter modal state. */ @@ -909,10 +909,10 @@ void WM_gizmomaptype_group_init_runtime(const Main *bmain, for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; - for (ARegion *ar = lb->first; ar; ar = ar->next) { - wmGizmoMap *gzmap = ar->gizmo_map; + for (ARegion *region = lb->first; region; region = region->next) { + wmGizmoMap *gzmap = region->gizmo_map; if (gzmap && gzmap->type == gzmap_type) { - WM_gizmomaptype_group_init_runtime_with_region(gzmap_type, gzgt, ar); + WM_gizmomaptype_group_init_runtime_with_region(gzmap_type, gzgt, region); } } } @@ -922,9 +922,9 @@ void WM_gizmomaptype_group_init_runtime(const Main *bmain, wmGizmoGroup *WM_gizmomaptype_group_init_runtime_with_region(wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt, - ARegion *ar) + ARegion *region) { - wmGizmoMap *gzmap = ar->gizmo_map; + wmGizmoMap *gzmap = region->gizmo_map; BLI_assert(gzmap && gzmap->type == gzmap_type); UNUSED_VARS_NDEBUG(gzmap_type); @@ -941,7 +941,7 @@ wmGizmoGroup *WM_gizmomaptype_group_init_runtime_with_region(wmGizmoMapType *gzm wm_gizmomap_highlight_set(gzmap, NULL, NULL, 0); - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); return gzgroup; } @@ -964,8 +964,8 @@ void WM_gizmomaptype_group_unlink(bContext *C, for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; - for (ARegion *ar = lb->first; ar; ar = ar->next) { - wmGizmoMap *gzmap = ar->gizmo_map; + for (ARegion *region = lb->first; region; region = region->next) { + wmGizmoMap *gzmap = region->gizmo_map; if (gzmap && gzmap->type == gzmap_type) { wmGizmoGroup *gzgroup, *gzgroup_next; for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup_next) { @@ -973,7 +973,7 @@ void WM_gizmomaptype_group_unlink(bContext *C, if (gzgroup->type == gzgt) { BLI_assert(gzgroup->parent_gzmap == gzmap); wm_gizmogroup_free(C, gzgroup); - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); } } } @@ -1131,8 +1131,8 @@ void WM_gizmo_group_unlink_delayed_ptr_from_space(wmGizmoGroupType *gzgt, wmGizmoMapType *gzmap_type, ScrArea *sa) { - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - wmGizmoMap *gzmap = ar->gizmo_map; + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + wmGizmoMap *gzmap = region->gizmo_map; if (gzmap && gzmap->type == gzmap_type) { for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) { if (gzgroup->type == gzgt) { @@ -1172,10 +1172,10 @@ void WM_gizmo_group_refresh(const bContext *C, wmGizmoGroup *gzgroup) wmGizmo *gz = wm_gizmomap_highlight_get(gzmap); if (!gz || gz->parent_gzgroup != gzgroup) { wmWindow *win = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); - BLI_assert(ar->gizmo_map == gzmap); + ARegion *region = CTX_wm_region(C); + BLI_assert(region->gizmo_map == gzmap); /* Check if the tweak event originated from this region. */ - if ((win->tweak != NULL) && BLI_rcti_compare(&ar->winrct, &win->tweak->winrct)) { + if ((win->tweak != NULL) && BLI_rcti_compare(®ion->winrct, &win->tweak->winrct)) { /* We need to run refresh again. */ gzgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH; WM_gizmomap_tag_refresh_drawstep(gzmap, WM_gizmomap_drawstep_from_gizmo_group(gzgroup)); diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c index 1bf60c212c8..28690fec2d8 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c @@ -577,7 +577,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos, const int hotspot) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); View3D *v3d = sa->spacedata.first; Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); rcti rect; @@ -588,7 +588,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos, BLI_rcti_init_pt_radius(&rect, co, hotspot); ED_view3d_draw_setup_view( - CTX_wm_window(C), depsgraph, CTX_data_scene(C), ar, v3d, NULL, NULL, &rect); + CTX_wm_window(C), depsgraph, CTX_data_scene(C), region, v3d, NULL, NULL, &rect); bool use_select_bias = false; @@ -608,15 +608,15 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos, } ED_view3d_draw_setup_view( - CTX_wm_window(C), depsgraph, CTX_data_scene(C), ar, v3d, NULL, NULL, NULL); + CTX_wm_window(C), depsgraph, CTX_data_scene(C), region, v3d, NULL, NULL, NULL); if (use_select_bias && (hits > 1)) { float co_direction[3]; float co_screen[3] = {co[0], co[1], 0.0f}; - ED_view3d_win_to_vector(ar, (float[2]){UNPACK2(co)}, co_direction); + ED_view3d_win_to_vector(region, (float[2]){UNPACK2(co)}, co_direction); - RegionView3D *rv3d = ar->regiondata; - const int viewport[4] = {0, 0, ar->winx, ar->winy}; + RegionView3D *rv3d = region->regiondata; + const int viewport[4] = {0, 0, region->winx, region->winy}; float co_3d_origin[3]; /* Avoid multiple calculations. */ @@ -802,9 +802,9 @@ wmGizmo *wm_gizmomap_highlight_find(wmGizmoMap *gzmap, return gz; } -void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *gzmap) +void WM_gizmomap_add_handlers(ARegion *region, wmGizmoMap *gzmap) { - LISTBASE_FOREACH (wmEventHandler *, handler_base, &ar->handlers) { + LISTBASE_FOREACH (wmEventHandler *, handler_base, ®ion->handlers) { if (handler_base->type == WM_HANDLER_TYPE_GIZMO) { wmEventHandler_Gizmo *handler = (wmEventHandler_Gizmo *)handler_base; if (handler->gizmo_map == gzmap) { @@ -815,9 +815,9 @@ void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *gzmap) wmEventHandler_Gizmo *handler = MEM_callocN(sizeof(*handler), __func__); handler->head.type = WM_HANDLER_TYPE_GIZMO; - BLI_assert(gzmap == ar->gizmo_map); + BLI_assert(gzmap == region->gizmo_map); handler->gizmo_map = gzmap; - BLI_addtail(&ar->handlers, handler); + BLI_addtail(®ion->handlers, handler); } void wm_gizmomaps_handled_modal_update(bContext *C, wmEvent *event, wmEventHandler_Op *handler) @@ -978,16 +978,16 @@ void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler) printf("internal error: modal gizmo-map handler has invalid area\n"); } else { - ARegion *ar; + ARegion *region; CTX_wm_area_set(C, sa); - for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar == handler->context.region) { + for (region = sa->regionbase.first; region; region = region->next) { + if (region == handler->context.region) { break; } } /* XXX no warning print here, after full-area and back regions are remade */ - if (ar) { - CTX_wm_region_set(C, ar); + if (region) { + CTX_wm_region_set(C, region); } } } @@ -1046,8 +1046,8 @@ bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz /* tag the region for redraw */ if (C) { - ARegion *ar = CTX_wm_region(C); - ED_region_tag_redraw_editor_overlays(ar); + ARegion *region = CTX_wm_region(C); + ED_region_tag_redraw_editor_overlays(region); } return true; @@ -1161,7 +1161,7 @@ ListBase *wm_gizmomap_groups_get(wmGizmoMap *gzmap) void WM_gizmomap_message_subscribe(bContext *C, wmGizmoMap *gzmap, - ARegion *ar, + ARegion *region, struct wmMsgBus *mbus) { for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) { @@ -1173,7 +1173,7 @@ void WM_gizmomap_message_subscribe(bContext *C, if (gz->flag & WM_GIZMO_HIDDEN) { continue; } - WM_gizmo_target_property_subscribe_all(gz, mbus, ar); + WM_gizmo_target_property_subscribe_all(gz, mbus, region); } if (gzgroup->type->message_subscribe != NULL) { gzgroup->type->message_subscribe(C, gzgroup, mbus); @@ -1189,12 +1189,12 @@ void WM_gizmomap_message_subscribe(bContext *C, * \{ */ struct ARegion *WM_gizmomap_tooltip_init(struct bContext *C, - struct ARegion *ar, + struct ARegion *region, int *UNUSED(r_pass), double *UNUSED(pass_delay), bool *r_exit_on_event) { - wmGizmoMap *gzmap = ar->gizmo_map; + wmGizmoMap *gzmap = region->gizmo_map; *r_exit_on_event = false; if (gzmap) { wmGizmo *gz = gzmap->gzmap_context.highlight; @@ -1375,8 +1375,8 @@ void WM_gizmoconfig_update(struct Main *bmain) for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; - for (ARegion *ar = regionbase->first; ar; ar = ar->next) { - wmGizmoMap *gzmap = ar->gizmo_map; + for (ARegion *region = regionbase->first; region; region = region->next) { + wmGizmoMap *gzmap = region->gizmo_map; if (gzmap != NULL && gzmap->tag_remove_group) { gzmap->tag_remove_group = false; @@ -1385,7 +1385,7 @@ void WM_gizmoconfig_update(struct Main *bmain) gzgroup_next = gzgroup->next; if (gzgroup->tag_remove) { wm_gizmogroup_free(NULL, gzgroup); - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); } } } @@ -1412,8 +1412,8 @@ void WM_reinit_gizmomap_all(Main *bmain) for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; - for (ARegion *ar = regionbase->first; ar; ar = ar->next) { - wmGizmoMap *gzmap = ar->gizmo_map; + for (ARegion *region = regionbase->first; region; region = region->next) { + wmGizmoMap *gzmap = region->gizmo_map; if ((gzmap != NULL) && (gzmap->is_init == false)) { WM_gizmomap_reinit(gzmap); } diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c index 87e23c0f03e..469d24c109d 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c @@ -315,11 +315,12 @@ void WM_gizmo_do_msg_notify_tag_refresh(bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) { - ARegion *ar = msg_val->owner; + ARegion *region = msg_val->owner; wmGizmoMap *gzmap = msg_val->user_data; - ED_region_tag_redraw(ar); /* Could possibly avoid a full redraw and only tag for editor overlays - redraw in some cases, see ED_region_tag_redraw_editor_overlays(). */ + ED_region_tag_redraw( + region); /* Could possibly avoid a full redraw and only tag for editor overlays + redraw in some cases, see ED_region_tag_redraw_editor_overlays(). */ WM_gizmomap_tag_refresh(gzmap); } @@ -327,7 +328,7 @@ void WM_gizmo_do_msg_notify_tag_refresh(bContext *UNUSED(C), * Runs on the "prepare draw" pass, * drawing the region clears. */ -void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, ARegion *ar) +void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, ARegion *region) { if (gz->type->target_property_defs_len) { wmGizmoProperty *gz_prop_array = WM_gizmo_target_property_array(gz); @@ -339,8 +340,8 @@ void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, &gz_prop->ptr, gz_prop->prop, &(const wmMsgSubscribeValue){ - .owner = ar, - .user_data = ar, + .owner = region, + .user_data = region, .notify = ED_region_do_msg_notify_tag_redraw, }, __func__); @@ -348,7 +349,7 @@ void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, &gz_prop->ptr, gz_prop->prop, &(const wmMsgSubscribeValue){ - .owner = ar, + .owner = region, .user_data = gz->parent_gzgroup->parent_gzmap, .notify = WM_gizmo_do_msg_notify_tag_refresh, }, diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c index 87d475a4da1..812dd8edd3c 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c @@ -138,8 +138,8 @@ static void gizmotype_unlink(bContext *C, Main *bmain, wmGizmoType *gzt) for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; - for (ARegion *ar = lb->first; ar; ar = ar->next) { - wmGizmoMap *gzmap = ar->gizmo_map; + for (ARegion *region = lb->first; region; region = region->next) { + wmGizmoMap *gzmap = region->gizmo_map; if (gzmap) { wmGizmoGroup *gzgroup; for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) { @@ -148,7 +148,7 @@ static void gizmotype_unlink(bContext *C, Main *bmain, wmGizmoType *gzt) BLI_assert(gzgroup->parent_gzmap == gzmap); if (gz->type == gzt) { WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, gz, C); - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); } } } |