diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-02-05 09:04:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-02-05 09:04:14 +0300 |
commit | 38420f19b6ebfac05955dac61200ce686fcd16e5 (patch) | |
tree | fb2d1bd5ae78a0947b006da3b57de2c36df827cf | |
parent | f2bf5acd5824673e4a7d641c833ec6940e6b5bea (diff) |
Cleanup: rename USER_ZOOM_{CONT->CONTINUE} improve comments
USER_ZOOM_CONT only had comments saying this was 'oldstyle',
remove these comments, add brief explanations of the zoom style
in the enum.
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 2 |
6 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 6c5e672c6bf..e234ab5dcdc 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -46,7 +46,7 @@ #include "UI_interface.h" #include "UI_view2d.h" -#include "PIL_time.h" /* USER_ZOOM_CONT */ +#include "PIL_time.h" /* USER_ZOOM_CONTINUE */ /* -------------------------------------------------------------------- */ /** \name Internal Utilities @@ -1108,7 +1108,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) /* Check if the 'timer' is initialized, as zooming with the trackpad * never uses the "Continuous" zoom method, and the 'timer' is not initialized. */ - if ((U.viewzoom == USER_ZOOM_CONT) && vzd->timer) { /* XXX store this setting as RNA prop? */ + if ((U.viewzoom == USER_ZOOM_CONTINUE) && vzd->timer) { /* XXX store this setting as RNA prop? */ const double time = PIL_check_seconds_timer(); const float time_step = (float)(time - vzd->timer_lastdraw); @@ -1304,7 +1304,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even /* add temp handler */ WM_event_add_modal_handler(C, op); - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vzd->timer = WM_event_add_timer(CTX_wm_manager(C), window, TIMER, 0.01f); vzd->timer_lastdraw = PIL_check_seconds_timer(); @@ -1363,7 +1363,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event dx *= BLI_rctf_size_x(&v2d->cur); dy *= BLI_rctf_size_y(&v2d->cur); } - else { /* USER_ZOOM_CONT or USER_ZOOM_DOLLY */ + else { /* USER_ZOOM_CONTINUE or USER_ZOOM_DOLLY */ float facx = zoomfac * (event->x - vzd->lastx); float facy = zoomfac * (event->y - vzd->lasty); @@ -1410,7 +1410,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event * - Continuous zoom only depends on distance of mouse * to starting point to determine rate of change. */ - if (U.viewzoom != USER_ZOOM_CONT) { /* XXX store this setting as RNA prop? */ + if (U.viewzoom != USER_ZOOM_CONTINUE) { /* XXX store this setting as RNA prop? */ vzd->lastx = event->x; vzd->lasty = event->y; } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index ea2dd0cb7aa..38a05eef6e3 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -569,7 +569,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event) WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vpd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); vpd->timer_lastdraw = PIL_check_seconds_timer(); @@ -662,7 +662,7 @@ static void view_zoom_apply( delta = -delta; } - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { SpaceClip *sclip = CTX_wm_space_clip(C); double time = PIL_check_seconds_timer(); float time_step = (float)(time - vpd->timer_lastdraw); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 30614a5bf88..9b8bf3c2fee 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -467,7 +467,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve UI_view2d_region_to_view( ®ion->v2d, event->mval[0], event->mval[1], &vpd->location[0], &vpd->location[1]); - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vpd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); vpd->timer_lastdraw = PIL_check_seconds_timer(); @@ -579,12 +579,10 @@ static void image_zoom_apply(ViewZoomData *vpd, delta = -delta; } - if (viewzoom == USER_ZOOM_CONT) { + if (viewzoom == USER_ZOOM_CONTINUE) { double time = PIL_check_seconds_timer(); float time_step = (float)(time - vpd->timer_lastdraw); float zfac; - - /* oldstyle zoom */ zfac = 1.0f + ((delta / 20.0f) * time_step); vpd->timer_lastdraw = time; /* this is the final zoom, but instead make it into a factor */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index aba4eb1eefe..fb527fa429f 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2025,7 +2025,7 @@ static float viewzoom_scale_value(const rcti *winrct, { float zfac; - if (viewzoom == USER_ZOOM_CONT) { + if (viewzoom == USER_ZOOM_CONTINUE) { double time = PIL_check_seconds_timer(); float time_step = (float)(time - *r_timer_lastdraw); float fac; @@ -2043,7 +2043,6 @@ static float viewzoom_scale_value(const rcti *winrct, fac = -fac; } - /* oldstyle zoom */ zfac = 1.0f + ((fac / 20.0f) * time_step); *r_timer_lastdraw = time; } @@ -2405,7 +2404,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vod->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); vod->prev.time = PIL_check_seconds_timer(); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 790f3423eef..0e31ec3494e 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1013,8 +1013,11 @@ typedef enum ePathCompare_Flag { /** #UserDef.viewzoom */ typedef enum eViewZoom_Style { - USER_ZOOM_CONT = 0, + /** Update zoom continuously with a timer while dragging the cursor. */ + USER_ZOOM_CONTINUE = 0, + /** Map changes in distance from the view center to zoom. */ USER_ZOOM_SCALE = 1, + /** Map horizontal/vertical motion to zoom. */ USER_ZOOM_DOLLY = 2, } eViewZoom_Style; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 2803d6c295f..269a242f074 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -5654,7 +5654,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) }; static const EnumPropertyItem view_zoom_styles[] = { - {USER_ZOOM_CONT, + {USER_ZOOM_CONTINUE, "CONTINUE", 0, "Continue", |