bugfix [#21230] set-scene animation updates not working

fix for empty scenes with SETLOOPER macro.
This commit is contained in:
Campbell Barton 2010-04-02 13:43:56 +00:00
parent e27fbba217
commit 70540fca3b
3 changed files with 26 additions and 4 deletions

@ -47,9 +47,8 @@ struct Main;
#define SCE_COPY_LINK_DATA 2
#define SCE_COPY_FULL 3
/* note; doesn't work when scene is empty */
#define SETLOOPER(s, b) sce= s, b= (Base*)sce->base.first; b; b= (Base*)(b->next?b->next:sce->set?(sce=sce->set)->base.first:NULL)
#define SETLOOPER(s, b) sce= s, b= _setlooper_base_step(&sce, NULL); b; b= _setlooper_base_step(&sce, b)
struct Base *_setlooper_base_step(struct Scene **sce, struct Base *base);
void free_avicodecdata(struct AviCodecData *acd);
void free_qtcodecdata(struct QuicktimeCodecData *acd);

@ -1051,3 +1051,26 @@ float get_render_aosss_error(RenderData *r, float error)
return error;
}
/* helper function for the SETLOOPER macro */
Base *_setlooper_base_step(Scene **sce, Base *base)
{
if(base && base->next) {
/* common case, step to the next */
return base->next;
}
else if(base==NULL && (*sce)->base.first) {
/* first time looping, return the scenes first base */
return (Base *)(*sce)->base.first;
}
else {
/* reached the end, get the next base in the set */
while((*sce= (*sce)->set)) {
base= (Base *)(*sce)->base.first;
if(base) {
return base;
}
}
}
return NULL;
}

@ -88,7 +88,6 @@
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BL_ModifierDeformer.h"
#include "BL_ShapeDeformer.h"
#include "BL_SkinDeformer.h"
@ -138,6 +137,7 @@
#include "BLI_math.h"
extern "C" {
#include "BKE_scene.h"
#include "BKE_customdata.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_DerivedMesh.h"