Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-09-16 08:04:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-09-16 08:04:44 +0400
commit23626e0149f25f13855735bbb7f65121e0c40ca0 (patch)
tree2688b304463fee3a042496727032f6772d447642 /source/blender/editors/interface/view2d_ops.c
parent43bd8c2b28d06953b64ed6d1e72cead9e42463a0 (diff)
fix [#36444] view3d.viewnumpad operator should not animate
when running viewport operations with exec() rather then invoke(), perform the action immediately rather then using smoothview. makes viewport operations usable from python scripts.
Diffstat (limited to 'source/blender/editors/interface/view2d_ops.c')
-rw-r--r--source/blender/editors/interface/view2d_ops.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 03bd7e4631b..22c20842723 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -1144,6 +1144,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
rctf rect;
rctf cur_new = v2d->cur;
int gesture_mode;
+ const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
/* convert coordinates of rect to 'tot' rect coordinates */
UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmin"), RNA_int_get(op->ptr, "ymin"), &rect.xmin, &rect.ymin);
@@ -1195,7 +1196,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
}
}
- UI_view2d_smooth_view(C, ar, &cur_new);
+ UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx);
return OPERATOR_FINISHED;
}
@@ -1269,7 +1270,7 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
/* will start timer if appropriate */
/* the arguments are the desired situation */
void UI_view2d_smooth_view(bContext *C, ARegion *ar,
- const rctf *cur)
+ const rctf *cur, const int smooth_viewtx)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
@@ -1289,7 +1290,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar,
fac = smooth_view_rect_to_fac(&v2d->cur, cur);
}
- if (U.smooth_viewtx && fac > FLT_EPSILON) {
+ if (smooth_viewtx && fac > FLT_EPSILON) {
int changed = FALSE;
if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == FALSE)
@@ -1300,7 +1301,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar,
if (changed) {
sms.orig_cur = v2d->cur;
- sms.time_allowed = (double)U.smooth_viewtx / 1000.0;
+ sms.time_allowed = (double)smooth_viewtx / 1000.0;
/* scale the time allowed the change in view */
sms.time_allowed *= (double)fac;