forked from bartvdbraak/blender
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.
This commit is contained in:
parent
eb1bb9dfd6
commit
d03e768761
@ -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 */
|
||||
|
||||
|
@ -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,8 +2481,29 @@ void DAG_ids_clear_recalc(Main *bmain, Scene *scene)
|
||||
bool have_updated_objects = false;
|
||||
|
||||
if (DAG_id_type_tagged(bmain, ID_OB)) {
|
||||
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; node = node->next) {
|
||||
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) {
|
||||
@ -2492,6 +2513,9 @@ void DAG_ids_clear_recalc(Main *bmain, Scene *scene)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BLI_freelistN(&listbase);
|
||||
}
|
||||
#else
|
||||
(void) scene; /* Unused. */
|
||||
#endif
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user