Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-04-02 17:43:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-04-02 17:43:56 +0400
commit70540fca3bfa90d21531c84e42aa7a4f74b52826 (patch)
tree76f2c208a472e2014b4a2bcaabe28c1dee2793f2 /source/blender/blenkernel
parente27fbba217d768701241598ba072b703060da225 (diff)
bugfix [#21230] set-scene animation updates not working
fix for empty scenes with SETLOOPER macro.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_scene.h5
-rw-r--r--source/blender/blenkernel/intern/scene.c23
2 files changed, 25 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 09fb705dd70..090979b33e9 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -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);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index a494d947953..c258f2d47b7 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -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;
+}