diff options
author | Ton Roosendaal <ton@blender.org> | 2006-05-15 16:32:54 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-05-15 16:32:54 +0400 |
commit | 996b594d015573f2aad0223fc913e05705495488 (patch) | |
tree | 92612593d5fb8037ebb9b4b593e0385c7e1ee854 /source/blender/blenkernel/intern/depsgraph.c | |
parent | 4e1d71fd8ddc07bcd4219cf1be9ed11efd70271c (diff) |
Bugfix:
Groups are supposed to play its entire (internal) animation system
properly, also when using a dupli-group, linking the group from other file.
When dependencies in a scene change, the groups didn't get corrected,
causing dupli-group to not playback without lag.
This commit resorts the group objects on each DAG_scene_sort() call.
Diffstat (limited to 'source/blender/blenkernel/intern/depsgraph.c')
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 42898bc8976..60865207bd8 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1332,6 +1332,50 @@ void graph_print_adj_list(void) /* ************************ API *********************** */ +/* groups with objects in this scene need to be put in the right order as well */ +static void scene_sort_groups(Scene *sce) +{ + Base *base; + Group *group; + GroupObject *go; + Object *ob; + + /* test; are group objects all in this scene? */ + for(ob= G.main->object.first; ob; ob= ob->id.next) { + ob->id.flag &= ~LIB_DOIT; + ob->id.newid= NULL; /* newid abuse for GroupObject */ + } + for(base = sce->base.first; base; base= base->next) + base->object->id.flag |= LIB_DOIT; + + for(group= G.main->group.first; group; group= group->id.next) { + for(go= group->gobject.first; go; go= go->next) { + if((go->ob->id.flag & LIB_DOIT)==0) + break; + } + /* this group is entirely in this scene */ + if(go==NULL) { + ListBase listb= {NULL, NULL}; + + for(go= group->gobject.first; go; go= go->next) + go->ob->id.newid= (ID *)go; + + /* in order of sorted bases we reinsert group objects */ + for(base = sce->base.first; base; base= base->next) { + + if(base->object->id.newid) { + go= (GroupObject *)base->object->id.newid; + base->object->id.newid= NULL; + BLI_remlink( &group->gobject, go); + BLI_addtail( &listb, go); + } + } + /* copy the newly sorted listbase */ + group->gobject= listb; + } + } +} + /* sort the base list on dependency order */ void DAG_scene_sort(struct Scene *sce) { @@ -1412,6 +1456,9 @@ void DAG_scene_sort(struct Scene *sce) sce->base = tempbase; queue_delete(nqueue); + /* all groups with objects in this scene gets resorted too */ + scene_sort_groups(sce); + if(G.f & G_DEBUG) { printf("\nordered\n"); for(base = sce->base.first; base; base= base->next) { |