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.
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
#include "UI_interface.h"
|
#include "UI_interface.h"
|
||||||
#include "UI_view2d.h"
|
#include "UI_view2d.h"
|
||||||
|
|
||||||
#include "PIL_time.h" /* USER_ZOOM_CONT */
|
#include "PIL_time.h" /* USER_ZOOM_CONTINUE */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Internal Utilities
|
/** \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
|
/* Check if the 'timer' is initialized, as zooming with the trackpad
|
||||||
* never uses the "Continuous" zoom method, and the 'timer' is not initialized. */
|
* 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 double time = PIL_check_seconds_timer();
|
||||||
const float time_step = (float)(time - vzd->timer_lastdraw);
|
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 */
|
/* add temp handler */
|
||||||
WM_event_add_modal_handler(C, op);
|
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 */
|
/* needs a timer to continue redrawing */
|
||||||
vzd->timer = WM_event_add_timer(CTX_wm_manager(C), window, TIMER, 0.01f);
|
vzd->timer = WM_event_add_timer(CTX_wm_manager(C), window, TIMER, 0.01f);
|
||||||
vzd->timer_lastdraw = PIL_check_seconds_timer();
|
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);
|
dx *= BLI_rctf_size_x(&v2d->cur);
|
||||||
dy *= BLI_rctf_size_y(&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 facx = zoomfac * (event->x - vzd->lastx);
|
||||||
float facy = zoomfac * (event->y - vzd->lasty);
|
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
|
* - Continuous zoom only depends on distance of mouse
|
||||||
* to starting point to determine rate of change.
|
* 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->lastx = event->x;
|
||||||
vzd->lasty = event->y;
|
vzd->lasty = event->y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
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 */
|
/* 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 = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
|
||||||
vpd->timer_lastdraw = PIL_check_seconds_timer();
|
vpd->timer_lastdraw = PIL_check_seconds_timer();
|
||||||
@@ -662,7 +662,7 @@ static void view_zoom_apply(
|
|||||||
delta = -delta;
|
delta = -delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (U.viewzoom == USER_ZOOM_CONT) {
|
if (U.viewzoom == USER_ZOOM_CONTINUE) {
|
||||||
SpaceClip *sclip = CTX_wm_space_clip(C);
|
SpaceClip *sclip = CTX_wm_space_clip(C);
|
||||||
double time = PIL_check_seconds_timer();
|
double time = PIL_check_seconds_timer();
|
||||||
float time_step = (float)(time - vpd->timer_lastdraw);
|
float time_step = (float)(time - vpd->timer_lastdraw);
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve
|
|||||||
UI_view2d_region_to_view(
|
UI_view2d_region_to_view(
|
||||||
®ion->v2d, event->mval[0], event->mval[1], &vpd->location[0], &vpd->location[1]);
|
®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 */
|
/* 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 = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
|
||||||
vpd->timer_lastdraw = PIL_check_seconds_timer();
|
vpd->timer_lastdraw = PIL_check_seconds_timer();
|
||||||
@@ -579,12 +579,10 @@ static void image_zoom_apply(ViewZoomData *vpd,
|
|||||||
delta = -delta;
|
delta = -delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewzoom == USER_ZOOM_CONT) {
|
if (viewzoom == USER_ZOOM_CONTINUE) {
|
||||||
double time = PIL_check_seconds_timer();
|
double time = PIL_check_seconds_timer();
|
||||||
float time_step = (float)(time - vpd->timer_lastdraw);
|
float time_step = (float)(time - vpd->timer_lastdraw);
|
||||||
float zfac;
|
float zfac;
|
||||||
|
|
||||||
/* oldstyle zoom */
|
|
||||||
zfac = 1.0f + ((delta / 20.0f) * time_step);
|
zfac = 1.0f + ((delta / 20.0f) * time_step);
|
||||||
vpd->timer_lastdraw = time;
|
vpd->timer_lastdraw = time;
|
||||||
/* this is the final zoom, but instead make it into a factor */
|
/* this is the final zoom, but instead make it into a factor */
|
||||||
|
|||||||
@@ -2025,7 +2025,7 @@ static float viewzoom_scale_value(const rcti *winrct,
|
|||||||
{
|
{
|
||||||
float zfac;
|
float zfac;
|
||||||
|
|
||||||
if (viewzoom == USER_ZOOM_CONT) {
|
if (viewzoom == USER_ZOOM_CONTINUE) {
|
||||||
double time = PIL_check_seconds_timer();
|
double time = PIL_check_seconds_timer();
|
||||||
float time_step = (float)(time - *r_timer_lastdraw);
|
float time_step = (float)(time - *r_timer_lastdraw);
|
||||||
float fac;
|
float fac;
|
||||||
@@ -2043,7 +2043,6 @@ static float viewzoom_scale_value(const rcti *winrct,
|
|||||||
fac = -fac;
|
fac = -fac;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* oldstyle zoom */
|
|
||||||
zfac = 1.0f + ((fac / 20.0f) * time_step);
|
zfac = 1.0f + ((fac / 20.0f) * time_step);
|
||||||
*r_timer_lastdraw = time;
|
*r_timer_lastdraw = time;
|
||||||
}
|
}
|
||||||
@@ -2405,7 +2404,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (U.viewzoom == USER_ZOOM_CONT) {
|
if (U.viewzoom == USER_ZOOM_CONTINUE) {
|
||||||
/* needs a timer to continue redrawing */
|
/* needs a timer to continue redrawing */
|
||||||
vod->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
|
vod->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
|
||||||
vod->prev.time = PIL_check_seconds_timer();
|
vod->prev.time = PIL_check_seconds_timer();
|
||||||
|
|||||||
@@ -1013,8 +1013,11 @@ typedef enum ePathCompare_Flag {
|
|||||||
|
|
||||||
/** #UserDef.viewzoom */
|
/** #UserDef.viewzoom */
|
||||||
typedef enum eViewZoom_Style {
|
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,
|
USER_ZOOM_SCALE = 1,
|
||||||
|
/** Map horizontal/vertical motion to zoom. */
|
||||||
USER_ZOOM_DOLLY = 2,
|
USER_ZOOM_DOLLY = 2,
|
||||||
} eViewZoom_Style;
|
} eViewZoom_Style;
|
||||||
|
|
||||||
|
|||||||
@@ -5654,7 +5654,7 @@ static void rna_def_userdef_input(BlenderRNA *brna)
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const EnumPropertyItem view_zoom_styles[] = {
|
static const EnumPropertyItem view_zoom_styles[] = {
|
||||||
{USER_ZOOM_CONT,
|
{USER_ZOOM_CONTINUE,
|
||||||
"CONTINUE",
|
"CONTINUE",
|
||||||
0,
|
0,
|
||||||
"Continue",
|
"Continue",
|
||||||
|
|||||||
Reference in New Issue
Block a user