bugfix [#24455] Scene is left at last rendered frame from rendering an animation
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#define ED_IMAGE_H
|
||||
|
||||
struct SpaceImage;
|
||||
struct Main;
|
||||
struct bContext;
|
||||
struct Image;
|
||||
struct ImageUser;
|
||||
@@ -61,7 +62,7 @@ int ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit);
|
||||
int ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit);
|
||||
|
||||
/* UI level image (texture) updating... render calls own stuff (too) */
|
||||
void ED_image_update_frame(const struct bContext *C);
|
||||
void ED_image_update_frame(const struct Main *mainp, int cfra);
|
||||
|
||||
/* image_render.c, export for screen_ops.c, render operator */
|
||||
void ED_space_image_output(struct bContext *C);
|
||||
|
||||
@@ -109,7 +109,8 @@ struct ScrArea *ED_screen_full_toggle(struct bContext *C, struct wmWindow *win,
|
||||
void ED_screen_new_window(struct bContext *C, struct rcti *position, int type);
|
||||
|
||||
/* anim */
|
||||
void ED_update_for_newframe(const struct bContext *C, int mute);
|
||||
void ED_update_for_newframe(struct Main *bmain, struct Scene *scene, struct bScreen *screen, int mute);
|
||||
|
||||
void ED_refresh_viewport_fps(struct bContext *C);
|
||||
int ED_screen_animation_play(struct bContext *C, int sync, int mode);
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
|
||||
/* Modifying the global scene isn't nice, but we can do it in
|
||||
* this part of the process before a threaded job is created */
|
||||
scene->r.cfra = (int)eval_time;
|
||||
ED_update_for_newframe(C, 1);
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, CTX_wm_screen(C), 1);
|
||||
|
||||
/* now scene data should be current according to animation system, so we fill the channels */
|
||||
|
||||
@@ -910,7 +910,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
|
||||
|
||||
/* reset to original current frame */
|
||||
scene->r.cfra = origFrame;
|
||||
ED_update_for_newframe(C, 1);
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, CTX_wm_screen(C), 1);
|
||||
|
||||
|
||||
/* ---- XXX: No Time animation curve for now, leaving this code here for reference
|
||||
|
||||
@@ -427,7 +427,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
|
||||
RE_BlenderFrame(re, mainp, scene, NULL, lay, scene->r.cfra);
|
||||
|
||||
// no redraw needed, we leave state as we entered it
|
||||
ED_update_for_newframe(C, 1);
|
||||
ED_update_for_newframe(mainp, scene, CTX_wm_screen(C), 1);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
|
||||
|
||||
@@ -578,6 +578,9 @@ static void render_endjob(void *rjv)
|
||||
if(rj->main != G.main)
|
||||
free_main(rj->main);
|
||||
|
||||
/* else the frame will not update for the original value */
|
||||
ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1);
|
||||
|
||||
/* XXX render stability hack */
|
||||
G.rendering = 0;
|
||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||
|
||||
@@ -347,7 +347,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
||||
|
||||
/* update animated image textures for gpu, etc,
|
||||
* call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
|
||||
ED_image_update_frame(C);
|
||||
ED_image_update_frame(bmain, scene->r.cfra);
|
||||
|
||||
/* go to next frame */
|
||||
while(CFRA<oglrender->nfra) {
|
||||
|
||||
@@ -1450,7 +1450,7 @@ void ED_screen_set_scene(bContext *C, Scene *scene)
|
||||
CTX_data_scene_set(C, scene);
|
||||
set_scene_bg(CTX_data_main(C), scene);
|
||||
|
||||
ED_update_for_newframe(C, 1);
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, curscreen, 1);
|
||||
|
||||
/* complete redraw */
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
@@ -1756,20 +1756,17 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
|
||||
}
|
||||
}
|
||||
|
||||
/* results in fully updated anim system */
|
||||
void ED_update_for_newframe(const bContext *C, int UNUSED(mute))
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
bScreen *screen= CTX_wm_screen(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
|
||||
/* results in fully updated anim system
|
||||
* screen can be NULL */
|
||||
void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUSED(mute))
|
||||
{
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
void *camera= scene_camera_switch_find(scene);
|
||||
if(camera && scene->camera != camera) {
|
||||
bScreen *sc;
|
||||
scene->camera= camera;
|
||||
/* are there cameras in the views that are not in the scene? */
|
||||
for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
|
||||
for(sc= bmain->screen.first; sc; sc= sc->id.next) {
|
||||
BKE_screen_view3d_scene_sync(sc);
|
||||
}
|
||||
}
|
||||
@@ -1779,7 +1776,7 @@ void ED_update_for_newframe(const bContext *C, int UNUSED(mute))
|
||||
|
||||
/* update animated image textures for gpu, etc,
|
||||
* call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
|
||||
ED_image_update_frame(C);
|
||||
ED_image_update_frame(bmain, scene->r.cfra);
|
||||
|
||||
/* this function applies the changes too */
|
||||
/* XXX future: do all windows */
|
||||
@@ -1801,7 +1798,7 @@ void ED_update_for_newframe(const bContext *C, int UNUSED(mute))
|
||||
/* update animated texture nodes */
|
||||
{
|
||||
Tex *tex;
|
||||
for(tex= CTX_data_main(C)->tex.first; tex; tex= tex->id.next)
|
||||
for(tex= bmain->tex.first; tex; tex= tex->id.next)
|
||||
if( tex->use_nodes && tex->nodetree ) {
|
||||
ntreeTexTagAnimated( tex->nodetree );
|
||||
}
|
||||
|
||||
@@ -2547,7 +2547,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
|
||||
sound_seek_scene(C);
|
||||
|
||||
/* since we follow drawflags, we can't send notifier but tag regions ourselves */
|
||||
ED_update_for_newframe(C, 1);
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, screen, 1);
|
||||
|
||||
for (sa= screen->areabase.first; sa; sa= sa->next) {
|
||||
ARegion *ar;
|
||||
|
||||
@@ -2098,11 +2098,9 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
|
||||
|
||||
/* goes over all ImageUsers, and sets frame numbers if auto-refresh is set */
|
||||
|
||||
void ED_image_update_frame(const bContext *C)
|
||||
void ED_image_update_frame(const Main *mainp, int cfra)
|
||||
{
|
||||
Main *mainp= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
wmWindowManager *wm;
|
||||
wmWindow *win;
|
||||
Tex *tex;
|
||||
|
||||
@@ -2111,13 +2109,13 @@ void ED_image_update_frame(const bContext *C)
|
||||
if(tex->type==TEX_IMAGE && tex->ima) {
|
||||
if(ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
|
||||
if(tex->iuser.flag & IMA_ANIM_ALWAYS)
|
||||
BKE_image_user_calc_frame(&tex->iuser, scene->r.cfra, 0);
|
||||
BKE_image_user_calc_frame(&tex->iuser, cfra, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* image window, compo node users */
|
||||
if(wm) {
|
||||
for(wm=mainp->wm.first; wm; wm= wm->id.next) { /* only 1 wm */
|
||||
for(win= wm->windows.first; win; win= win->next) {
|
||||
ScrArea *sa;
|
||||
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
||||
@@ -2126,12 +2124,12 @@ void ED_image_update_frame(const bContext *C)
|
||||
BGpic *bgpic;
|
||||
for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
|
||||
if(bgpic->iuser.flag & IMA_ANIM_ALWAYS)
|
||||
BKE_image_user_calc_frame(&bgpic->iuser, scene->r.cfra, 0);
|
||||
BKE_image_user_calc_frame(&bgpic->iuser, cfra, 0);
|
||||
}
|
||||
else if(sa->spacetype==SPACE_IMAGE) {
|
||||
SpaceImage *sima= sa->spacedata.first;
|
||||
if(sima->iuser.flag & IMA_ANIM_ALWAYS)
|
||||
BKE_image_user_calc_frame(&sima->iuser, scene->r.cfra, 0);
|
||||
BKE_image_user_calc_frame(&sima->iuser, cfra, 0);
|
||||
}
|
||||
else if(sa->spacetype==SPACE_NODE) {
|
||||
SpaceNode *snode= sa->spacedata.first;
|
||||
@@ -2143,7 +2141,7 @@ void ED_image_update_frame(const bContext *C)
|
||||
ImageUser *iuser= node->storage;
|
||||
if(ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
|
||||
if(iuser->flag & IMA_ANIM_ALWAYS)
|
||||
BKE_image_user_calc_frame(iuser, scene->r.cfra, 0);
|
||||
BKE_image_user_calc_frame(iuser, cfra, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ void wm_event_do_notifiers(bContext *C)
|
||||
if(!G.rendering) {
|
||||
|
||||
/* depsgraph gets called, might send more notifiers */
|
||||
ED_update_for_newframe(C, 1);
|
||||
ED_update_for_newframe(CTX_data_main(C), win->screen->scene, win->screen, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1636,7 +1636,7 @@ void wm_event_do_handlers(bContext *C)
|
||||
int ncfra = sound_sync_scene(scene) * FPS + 0.5;
|
||||
if(ncfra != scene->r.cfra) {
|
||||
scene->r.cfra = ncfra;
|
||||
ED_update_for_newframe(C, 1);
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user