Set Scenes and Physics

- objects in a set scene now are evaluated with the frame from the current scene.
- pointcache now loops over all set scene objects.
This commit is contained in:
Campbell Barton
2010-04-02 14:57:12 +00:00
parent 70540fca3b
commit d4340289a6
2 changed files with 16 additions and 13 deletions

View File

@@ -560,7 +560,7 @@ static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, flo
static int ptcache_totpoint_cloth(void *cloth_v, int cfra)
{
ClothModifierData *clmd= cloth_v;
return clmd->clothObject->numverts;
return clmd->clothObject ? clmd->clothObject->numverts : 0;
}
/* Creating ID's */
@@ -2327,12 +2327,13 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old
/* Baking */
static int count_quick_cache(Scene *scene, int *quick_step)
{
Base *base = scene->base.first;
Base *base;
PTCacheID *pid;
ListBase pidlist;
int autocache_count= 0;
Scene *sce; /* for macro only */
for(base = scene->base.first; base; base = base->next) {
for(SETLOOPER(scene, base)) {
if(base->object) {
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
@@ -2401,6 +2402,7 @@ static void *ptcache_make_cache_thread(void *ptr) {
void BKE_ptcache_make_cache(PTCacheBaker* baker)
{
Scene *scene = baker->scene;
Scene *sce; /* SETLOOPER macro only */
Base *base;
ListBase pidlist;
PTCacheID *pid = baker->pid;
@@ -2465,7 +2467,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
cache->flag &= ~PTCACHE_BAKED;
}
}
else for(base=scene->base.first; base; base= base->next) {
for(SETLOOPER(scene, base)) {
/* cache/bake everything in the scene */
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
@@ -2548,7 +2550,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
BKE_ptcache_write_cache(pid, 0);
}
}
else for(base=scene->base.first; base; base= base->next) {
else for(SETLOOPER(scene, base)) {
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
for(pid=pidlist.first; pid; pid=pid->next) {

View File

@@ -891,10 +891,12 @@ float frame_to_float (Scene *scene, int cfra) /* see also bsystem_time in objec
return ctime;
}
static void scene_update_newframe(Scene *scene, unsigned int lay)
static void scene_update_newframe(Scene *scene, int cfra, unsigned int lay)
{
Base *base;
Object *ob;
int cfra_back= scene->r.cfra;
scene->r.cfra= cfra;
for(base= scene->base.first; base; base= base->next) {
ob= base->object;
@@ -910,6 +912,8 @@ static void scene_update_newframe(Scene *scene, unsigned int lay)
// base->lay= ob->lay;
//}
}
scene->r.cfra= cfra_back;
}
/* this is called in main loop, doing tagged updates before redraw */
@@ -956,10 +960,6 @@ void scene_update_tagged(Scene *scene)
/* XXX - this is called far to often, should be made apart of the depgraph */
BKE_ptcache_quick_cache_all(scene);
sce= scene;
while((sce= sce->set))
BKE_ptcache_quick_cache_all(sce);
/* in the future this should handle updates for all datablocks, not
only objects and scenes. - brecht */
}
@@ -994,10 +994,11 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay)
/* sets first, we allow per definition current scene to have dependencies on sets */
for(sce_iter= sce->set; sce_iter; sce_iter= sce_iter->set)
scene_update_newframe(sce_iter, lay);
for(sce_iter= sce->set; sce_iter; sce_iter= sce_iter->set) {
scene_update_newframe(sce_iter, sce->r.cfra, lay);
}
scene_update_newframe(sce, lay);
scene_update_newframe(sce, sce->r.cfra, lay);
}
/* return default layer, also used to patch old files */