BKE_scene_ layer/collection API touch ups
authorDalai Felinto <dfelinto@gmail.com>
Tue, 22 Nov 2016 14:20:56 +0000 (15:20 +0100)
committerDalai Felinto <dfelinto@gmail.com>
Tue, 22 Nov 2016 16:27:22 +0000 (17:27 +0100)
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/intern/scene.c

index 23eadf6ac848c55ab92c2d955dc6f26022784fad..5abc9e0fed1f6f1e9bdf976b0f9c2608f0a4e863 100644 (file)
@@ -129,7 +129,7 @@ void BKE_scene_update_for_newframe_ex(struct EvaluationContext *eval_ctx, struct
 struct SceneLayer *BKE_scene_add_layer(struct Scene *sce, const char *name);
 bool BKE_scene_remove_layer(struct Main *main, struct Scene *scene, struct SceneLayer *sl);
 struct LayerCollection *BKE_scene_add_collection(struct SceneLayer *sl, const char *name);
-bool BKE_scene_remove_collection(struct Main *main, struct SceneLayer *sl, struct LayerCollection *lc);
+bool BKE_scene_remove_collection(struct SceneLayer *sl, struct LayerCollection *lc);
 
 struct SceneRenderLayer *BKE_scene_add_render_layer(struct Scene *sce, const char *name);
 bool BKE_scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl);
index 8a02d4e6a0ad7723adc6110043b37dc44a1bf8a8..bdea85ef7440e4a968785f9190b402f9b0cf0417 100644 (file)
@@ -2047,7 +2047,7 @@ LayerCollection *BKE_scene_add_collection(SceneLayer *sl, const char *name)
 }
 
 
-bool BKE_scene_remove_collection(Main *bmain, SceneLayer *sl, LayerCollection *lc)
+bool BKE_scene_remove_collection(SceneLayer *sl, LayerCollection *lc)
 {
        const int act = BLI_findindex(&sl->collections, lc);
        if (act == -1) {
@@ -2118,6 +2118,20 @@ bool BKE_scene_remove_layer(Main *bmain, Scene *scene, SceneLayer *sl)
        /* TODO only change active_layer if necessary */
        scene->active_layer = 0;
 
+       for (Scene *sce = bmain->scene.first; sce; sce = sce->id.next) {
+               if (sce->nodetree) {
+                       bNode *node;
+                       for (node = sce->nodetree->nodes.first; node; node = node->next) {
+                               if (node->type == CMP_NODE_R_LAYERS && (Scene *)node->id == scene) {
+                                       if (node->custom1 == act)
+                                               node->custom1 = 0;
+                                       else if (node->custom1 > act)
+                                               node->custom1--;
+                               }
+                       }
+               }
+       }
+
        return true;
 }