Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / render / render_shading.c
index 0878636d0faad0c4765edefce07bb9a6ac1cdb16..e031e9a641c201e7b69b5b7491fd84bf29b67ade 100644 (file)
@@ -54,6 +54,7 @@
 #include "BKE_font.h"
 #include "BKE_global.h"
 #include "BKE_image.h"
 #include "BKE_font.h"
 #include "BKE_global.h"
 #include "BKE_image.h"
+#include "BKE_layer.h"
 #include "BKE_library.h"
 #include "BKE_linestyle.h"
 #include "BKE_main.h"
 #include "BKE_library.h"
 #include "BKE_linestyle.h"
 #include "BKE_main.h"
@@ -626,11 +627,12 @@ static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
 
 {
        Scene *scene = CTX_data_scene(C);
 
-       BKE_scene_add_render_layer(scene, NULL);
-       scene->r.actlay = BLI_listbase_count(&scene->r.layers) - 1;
+       BKE_scene_layer_add(scene, NULL);
+       scene->active_layer = BLI_listbase_count(&scene->render_layers) - 1;
 
        DAG_id_tag_update(&scene->id, 0);
 
        DAG_id_tag_update(&scene->id, 0);
-       WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
+       DAG_relations_tag_update(CTX_data_main(C));
+       WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
        
        return OPERATOR_FINISHED;
 }
        
        return OPERATOR_FINISHED;
 }
@@ -652,12 +654,14 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot)
 static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
 static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *rl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *sl = BKE_scene_layer_context_active(scene);
 
 
-       if (!BKE_scene_remove_render_layer(CTX_data_main(C), scene, rl))
+       if (!BKE_scene_layer_remove(CTX_data_main(C), scene, sl)) {
                return OPERATOR_CANCELLED;
                return OPERATOR_CANCELLED;
+       }
 
        DAG_id_tag_update(&scene->id, 0);
 
        DAG_id_tag_update(&scene->id, 0);
+       DAG_relations_tag_update(CTX_data_main(C));
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
        
        return OPERATOR_FINISHED;
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
        
        return OPERATOR_FINISHED;