diff options
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index c2e094fc161..27e19ca1fc3 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2260,25 +2260,28 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) BLI_dlrbTree_linkedlist_sync(&keys); /* find matching keyframe in the right direction */ - do { - if (next) - ak = (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra); - else - ak = (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra); - - if (ak) { - if (CFRA != (int)ak->cfra) { - /* this changes the frame, so set the frame and we're done */ - CFRA = (int)ak->cfra; - done = true; + if (next) + ak = (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra); + else + ak = (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra); + + while ((ak != NULL) && (done == false)) { + if (CFRA != (int)ak->cfra) { + /* this changes the frame, so set the frame and we're done */ + CFRA = (int)ak->cfra; + done = true; + } + else { + /* take another step... */ + if (next) { + ak = ak->next; } else { - /* make this the new starting point for the search */ - cfra = ak->cfra; + ak = ak->prev; } } - } while ((ak != NULL) && (done == false)); - + } + /* free temp stuff */ BLI_dlrbTree_free(&keys); @@ -3756,7 +3759,7 @@ static int screen_animation_cancel_exec(bContext *C, wmOperator *op) bScreen *screen = ED_screen_animation_playing(CTX_wm_manager(C)); if (screen) { - if (RNA_boolean_get(op->ptr, "restore_frame")) { + if (RNA_boolean_get(op->ptr, "restore_frame") && screen->animtimer) { ScreenAnimData *sad = screen->animtimer->customdata; Scene *scene = CTX_data_scene(C); @@ -3883,22 +3886,11 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot) static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - wmWindow *win = CTX_wm_window(C); - rcti rect; - int sizex, sizey; - - sizex = 800 * UI_DPI_WINDOW_FAC; - sizey = 480 * UI_DPI_WINDOW_FAC; - - /* some magic to calculate postition */ - /* pixelsize: mouse coords are in U.pixelsize units :/ */ - rect.xmin = (event->x / U.pixelsize) + win->posx - sizex / 2; - rect.ymin = (event->y / U.pixelsize) + win->posy - sizey / 2; - rect.xmax = rect.xmin + sizex; - rect.ymax = rect.ymin + sizey; + int sizex = 800 * UI_DPI_FAC; + int sizey = 480 * UI_DPI_FAC; /* changes context! */ - if (WM_window_open_temp(C, &rect, WM_WINDOW_USERPREFS) != NULL) { + if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_USERPREFS) != NULL) { return OPERATOR_FINISHED; } else { |