diff options
-rw-r--r-- | source/blender/blenkernel/BKE_depsgraph.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 65 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 4 |
7 files changed, 48 insertions, 39 deletions
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index e612d00f936..91954131b71 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -104,11 +104,11 @@ void draw_all_deps(void); void DAG_scene_sort(struct Main *bmain, struct Scene *sce); /* flag all objects that need recalc because they're animated */ -void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay); +void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay, const short do_time); /* flushes all recalc flags in objects down the dependency tree */ -void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned int lay, int time); +void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned int lay, const short do_time); /* tag objects for update on file load */ -void DAG_on_load_update(struct Main *bmain); +void DAG_on_load_update(struct Main *bmain, const short do_time); /* when setting manual RECALC flags, call this afterwards */ void DAG_ids_flush_update(struct Main *bmain, int time); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index b479bd5ef28..c372855b3eb 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -296,7 +296,7 @@ static void motionpaths_calc_update_scene(Scene *scene) Base *base, *last=NULL; /* only stuff that moves or needs display still */ - DAG_scene_update_flags(G.main, scene, scene->lay); + DAG_scene_update_flags(G.main, scene, scene->lay, TRUE); /* find the last object with the tag * - all those afterwards are assumed to not be relevant for our calculations diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 6ceb75f2f83..b782d3a92a9 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -467,8 +467,10 @@ static int read_undosave(bContext *C, UndoElem *uel) strcpy(G.main->name, mainstr); /* restore */ G.fileflags= fileflags; - if(success) - DAG_on_load_update(G.main); + if(success) { + /* important not to update time here, else non keyed tranforms are lost */ + DAG_on_load_update(G.main, FALSE); + } return success; } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 6a97fa21aa5..2ac3946cb98 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1923,7 +1923,7 @@ static void dag_scene_flush_layers(Scene *sce, int lay) } /* flushes all recalc flags in objects down the dependency tree */ -void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, int time) +void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const short time) { DagNode *firstnode; DagAdjList *itA; @@ -2132,50 +2132,57 @@ static void dag_object_time_update_flags(Object *ob) } } /* flag all objects that need recalc, for changes in time for example */ -void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay) +/* do_time: make this optional because undo resets objects to their animated locations without this */ +void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const short do_time) { Base *base; Object *ob; Group *group; GroupObject *go; Scene *sce; - + /* set ob flags where animated systems are */ for(SETLOOPER(scene, base)) { ob= base->object; - - /* now if DagNode were part of base, the node->lay could be checked... */ - /* we do all now, since the scene_flush checks layers and clears recalc flags even */ - dag_object_time_update_flags(ob); - + + if(do_time) { + /* now if DagNode were part of base, the node->lay could be checked... */ + /* we do all now, since the scene_flush checks layers and clears recalc flags even */ + dag_object_time_update_flags(ob); + } + /* handled in next loop */ - if(ob->dup_group) + if(ob->dup_group) ob->dup_group->id.flag |= LIB_DOIT; - } - - /* we do groups each once */ - for(group= bmain->group.first; group; group= group->id.next) { - if(group->id.flag & LIB_DOIT) { - for(go= group->gobject.first; go; go= go->next) { - dag_object_time_update_flags(go->ob); + } + + if(do_time) { + /* we do groups each once */ + for(group= bmain->group.first; group; group= group->id.next) { + if(group->id.flag & LIB_DOIT) { + for(go= group->gobject.first; go; go= go->next) { + dag_object_time_update_flags(go->ob); + } } } } - + for(sce= scene; sce; sce= sce->set) DAG_scene_flush_update(bmain, sce, lay, 1); - /* test: set time flag, to disable baked systems to update */ - for(SETLOOPER(scene, base)) { - ob= base->object; - if(ob->recalc) - ob->recalc |= OB_RECALC_TIME; + if(do_time) { + /* test: set time flag, to disable baked systems to update */ + for(SETLOOPER(scene, base)) { + ob= base->object; + if(ob->recalc) + ob->recalc |= OB_RECALC_TIME; + } + + /* hrmf... an exception to look at once, for invisible camera object we do it over */ + if(scene->camera) + dag_object_time_update_flags(scene->camera); } - - /* hrmf... an exception to look at once, for invisible camera object we do it over */ - if(scene->camera) - dag_object_time_update_flags(scene->camera); - + /* and store the info in groupobject */ for(group= bmain->group.first; group; group= group->id.next) { if(group->id.flag & LIB_DOIT) { @@ -2231,7 +2238,7 @@ void DAG_ids_flush_update(Main *bmain, int time) DAG_scene_flush_update(bmain, sce, lay, time); } -void DAG_on_load_update(Main *bmain) +void DAG_on_load_update(Main *bmain, const short do_time) { Scene *scene, *sce; Base *base; @@ -2277,7 +2284,7 @@ void DAG_on_load_update(Main *bmain) } /* now tag update flags, to ensure deformers get calculated on redraw */ - DAG_scene_update_flags(bmain, scene, lay); + DAG_scene_update_flags(bmain, scene, lay, do_time); } } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9bbadbacb37..58b7f95f9c8 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1010,7 +1010,7 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) /* Following 2 functions are recursive * so dont call within 'scene_update_tagged_recursive' */ - DAG_scene_update_flags(bmain, sce, lay); // only stuff that moves or needs display still + DAG_scene_update_flags(bmain, sce, lay, TRUE); // only stuff that moves or needs display still /* All 'standard' (i.e. without any dependencies) animation is handled here, * with an 'local' to 'macro' order of evaluation. This should ensure that diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 5c3a34801a3..213b48931b9 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -201,7 +201,7 @@ static int layers_exec(bContext *C, wmOperator *op) if(v3d->scenelock) handle_view3d_lock(C); /* new layers might need unflushed events events */ - DAG_scene_update_flags(bmain, scene, v3d->lay); /* tags all that moves and flushes */ + DAG_scene_update_flags(bmain, scene, v3d->lay, FALSE); /* tags all that moves and flushes */ ED_area_tag_redraw(sa); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index b21d58c1053..006f96502c6 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -315,7 +315,7 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports) CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); ED_editors_init(C); - DAG_on_load_update(CTX_data_main(C)); + DAG_on_load_update(CTX_data_main(C), TRUE); #ifdef WITH_PYTHON /* run any texts that were loaded in and flagged as modules */ @@ -408,7 +408,7 @@ int WM_read_homefile(bContext *C, wmOperator *op) BKE_write_undo(C, "original"); /* save current state */ ED_editors_init(C); - DAG_on_load_update(CTX_data_main(C)); + DAG_on_load_update(CTX_data_main(C), TRUE); #ifdef WITH_PYTHON if(CTX_py_init_get(C)) { |