diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-02-15 16:04:11 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-02-15 16:40:56 +0300 |
commit | c694aedcadc5f566d9b8c54c330d1b0aea468008 (patch) | |
tree | 16bfb1ac1c50da24bc36e6ba0c900ceef2a7a30f /source | |
parent | 310593def13f08282534a4820bdbddae4741a297 (diff) |
Update SETLOOPER to account for layers
The idea is to iterator over the active layer of the current scene and
then over the active layer of the set scenes.
In the future, once we get workspace we will get the initial renderlayer
from context, while the background sets will still use their active
renderlayer.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 27 |
2 files changed, 23 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 181d4b12703..bed643c2133 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -63,7 +63,7 @@ struct Main; _base; \ _base = _setlooper_base_step(&_sce_iter, _base) -struct BaseLegacy *_setlooper_base_step(struct Scene **sce_iter, struct BaseLegacy *base); +struct Base *_setlooper_base_step(struct Scene **sce_iter, 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 dc81dac134b..3a7428b1b50 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1688,21 +1688,38 @@ float get_render_aosss_error(const RenderData *r, float error) return error; } -/* helper function for the SETLOOPER macro */ -BaseLegacy *_setlooper_base_step(Scene **sce_iter, BaseLegacy *base) +/** + * Helper function for the SETLOOPER macro + * + * It iterates over the bases of the active layer and then the bases + * of the active layer of the background (set) scenes recursively. + */ +Base *_setlooper_base_step(Scene **sce_iter, Base *base) { if (base && base->next) { /* common case, step to the next */ return base->next; } - else if (base == NULL && (*sce_iter)->base.first) { + else if (base == NULL) { /* first time looping, return the scenes first base */ - return (BaseLegacy *)(*sce_iter)->base.first; + + /* for the first loop we should get the layer from context */ + TODO_LAYER_CONTEXT; + SceneLayer *sl = BKE_scene_layer_active((*sce_iter)); + + if (sl->object_bases.first) { + return (Base *)sl->object_bases.first; + } + /* no base on this scene layer */ + goto next_set; } else { +next_set: /* reached the end, get the next base in the set */ while ((*sce_iter = (*sce_iter)->set)) { - base = (BaseLegacy *)(*sce_iter)->base.first; + SceneLayer *sl = BKE_scene_layer_active((*sce_iter)); + base = (Base *)sl->object_bases.first; + if (base) { return base; } |