diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-16 22:26:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-16 22:26:54 +0300 |
commit | eecfc0fbb2892875d29879ebcb82289941ac4b1d (patch) | |
tree | fd808e8ab50a0a7dac62d09a8c5105b0d6d3096b /source/blender/blenkernel | |
parent | fef0549ea5f09d5d83066b9c5cc232f8f0b0568a (diff) |
bugfix [#25208] randomize transform doesn't work on objects with keyframes
Surprising this wasnt noticed in a much more obvious case:
- Key Location, Move, Rotate, Undo-Rotate >> Resets to keyed location as well.
This was happening because DAG_on_load_update() was called on read_undosave(), flagging 'ob->adt->recalc |= ADT_RECALC_ANIM;'
Fix by adding an option to DAG_on_load_update(), not to recalculate time flags.
Diffstat (limited to 'source/blender/blenkernel')
-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 |
5 files changed, 45 insertions, 36 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 |