diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-01-17 16:51:31 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-01-17 16:57:49 +0400 |
commit | d03e7687613ff288e027198ac58df59cd9f1677e (patch) | |
tree | 2fe78cad78d12d5a55ebba2dad8dc349633b99c3 /source/blender/blenkernel | |
parent | eb1bb9dfd64848fc6948f22f5b04ccf8607eb984 (diff) |
Fix T38260: Missing object update with two visible scenes
It was an issue with early object update check which was
screwing up for second scene because of first one reset
ID recalc flags.
From the comment in the code about this:
We need to check all visible scenes, otherwise resetting
OB_ID changed flag will only work fine for first scene of
multiple visible and all the rest will skip update.
This could also lead to wrong behavior scene update handlers
because of missing ID datablock changed flags.
This is a bit of a bummer to allocate list here, but likely
it wouldn't become too much bad because it only happens when
objects were actually changed.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_depsgraph.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 40 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 4 |
3 files changed, 35 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index bfd01545f86..df7e9561c46 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -128,7 +128,7 @@ int DAG_id_type_tagged(struct Main *bmain, short idtype); void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned int lay, const short do_time); void DAG_ids_flush_tagged(struct Main *bmain); void DAG_ids_check_recalc(struct Main *bmain, struct Scene *scene, int time); -void DAG_ids_clear_recalc(struct Main *bmain, struct Scene *scene); +void DAG_ids_clear_recalc(struct Main *bmain); /* Armature: sorts the bones according to dependencies between them */ diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 0f6be44a1ee..80deb354d09 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2471,7 +2471,7 @@ void DAG_ids_check_recalc(Main *bmain, Scene *scene, int time) #define POST_UPDATE_HANDLER_WORKAROUND -void DAG_ids_clear_recalc(Main *bmain, Scene *scene) +void DAG_ids_clear_recalc(Main *bmain) { ListBase *lbarray[MAX_LIBARRAY]; bNodeTree *ntree; @@ -2481,16 +2481,40 @@ void DAG_ids_clear_recalc(Main *bmain, Scene *scene) bool have_updated_objects = false; if (DAG_id_type_tagged(bmain, ID_OB)) { - DagNode *node; - for (node = scene->theDag->DagNode.first; node; node = node->next) { - if (node->type == ID_OB) { - Object *object = (Object *) node->ob; - if (object->recalc & OB_RECALC_ALL) { - have_updated_objects = true; - break; + ListBase listbase; + DagSceneLayer *dsl; + + /* We need to check all visible scenes, otherwise resetting + * OB_ID changed flag will only work fine for first scene of + * multiple visible and all the rest will skip update. + * + * This could also lead to wrong behavior scene update handlers + * because of missing ID datablock changed flags. + * + * This is a bit of a bummer to allocate list here, but likely + * it wouldn't become too much bad because it only happens when + * objects were actually changed. + */ + dag_current_scene_layers(bmain, &listbase); + + for (dsl = listbase.first; dsl; dsl = dsl->next) { + Scene *scene = dsl->scene; + DagNode *node; + for (node = scene->theDag->DagNode.first; + node != NULL && have_updated_objects == false; + node = node->next) + { + if (node->type == ID_OB) { + Object *object = (Object *) node->ob; + if (object->recalc & OB_RECALC_ALL) { + have_updated_objects = true; + break; + } } } } + + BLI_freelistN(&listbase); } #else (void) scene; /* Unused. */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index da8700d316a..65d1863873c 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1563,7 +1563,7 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc DAG_ids_check_recalc(bmain, scene, FALSE); /* clear recalc flags */ - DAG_ids_clear_recalc(bmain, scene); + DAG_ids_clear_recalc(bmain); } /* applies changes right away, does all sets too */ @@ -1639,7 +1639,7 @@ void BKE_scene_update_for_newframe(EvaluationContext *eval_ctx, Main *bmain, Sce DAG_ids_check_recalc(bmain, sce, TRUE); /* clear recalc flags */ - DAG_ids_clear_recalc(bmain, sce); + DAG_ids_clear_recalc(bmain); #ifdef DETAILED_ANALYSIS_OUTPUT fprintf(stderr, "frame update start_time %f duration %f\n", start_time, PIL_check_seconds_timer() - start_time); |