forked from bartvdbraak/blender
Fix for [#30495] Framerate goes crazy after changing Sync mode from "Frame Dropping" to "no Sync" while playing anim
This commit is contained in:
parent
53b7078343
commit
727f586a0d
@ -41,6 +41,7 @@ typedef struct ScreenAnimData {
|
|||||||
short flag; /* flags for playback */
|
short flag; /* flags for playback */
|
||||||
int sfra; /* frame that playback was started from */
|
int sfra; /* frame that playback was started from */
|
||||||
int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
|
int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
|
||||||
|
double last_duration; /* used for frame dropping */
|
||||||
} ScreenAnimData;
|
} ScreenAnimData;
|
||||||
|
|
||||||
/* for animplayer */
|
/* for animplayer */
|
||||||
|
@ -2915,13 +2915,12 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (sync) {
|
if (sync) {
|
||||||
int step = floor(wt->duration * FPS);
|
int step = floor((wt->duration - sad->last_duration) * FPS);
|
||||||
/* skip frames */
|
/* skip frames */
|
||||||
if (sad->flag & ANIMPLAY_FLAG_REVERSE)
|
if (sad->flag & ANIMPLAY_FLAG_REVERSE)
|
||||||
scene->r.cfra -= step;
|
scene->r.cfra -= step;
|
||||||
else
|
else
|
||||||
scene->r.cfra += step;
|
scene->r.cfra += step;
|
||||||
wt->duration -= ((double)step)/FPS;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* one frame +/- */
|
/* one frame +/- */
|
||||||
@ -2932,6 +2931,8 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sad->last_duration = wt->duration;
|
||||||
|
|
||||||
/* reset 'jumped' flag before checking if we need to jump... */
|
/* reset 'jumped' flag before checking if we need to jump... */
|
||||||
sad->flag &= ~ANIMPLAY_FLAG_JUMPED;
|
sad->flag &= ~ANIMPLAY_FLAG_JUMPED;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user