svn merge ^/trunk/blender -r42009:42053
[blender.git] / source / blender / editors / render / render_shading.c
index 73264dd..ba73bbd 100644 (file)
@@ -519,7 +519,7 @@ static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene= CTX_data_scene(C);
 
-       scene_add_render_layer(scene);
+       scene_add_render_layer(scene, NULL);
        scene->r.actlay= BLI_countlist(&scene->r.layers) - 1;
 
        WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
@@ -543,32 +543,11 @@ 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), *sce;
-       SceneRenderLayer *rl;
-       int act= scene->r.actlay;
+       Scene *scene = CTX_data_scene(C);
+       SceneRenderLayer *rl = BLI_findlink(&scene->r.layers, scene->r.actlay);
 
-       if(BLI_countlist(&scene->r.layers) <= 1)
+       if(!scene_remove_render_layer(CTX_data_main(C), scene, rl))
                return OPERATOR_CANCELLED;
-       
-       rl= BLI_findlink(&scene->r.layers, scene->r.actlay);
-       BLI_remlink(&scene->r.layers, rl);
-       MEM_freeN(rl);
-
-       scene->r.actlay= 0;
-
-       for(sce = CTX_data_main(C)->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--;
-                               }
-                       }
-               }
-       }
 
        WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
        
@@ -679,7 +658,7 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
 
 /********************** environment map operators *********************/
 
-static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, int imtype)
+static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, const char imtype)
 {
        float layout[12];
        if ( RNA_struct_find_property(op->ptr, "layout") )
@@ -701,7 +680,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op)
        Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
        Scene *scene = CTX_data_scene(C);
        //int imtype = RNA_enum_get(op->ptr, "file_type");
-       int imtype = scene->r.imtype;
+       char imtype = scene->r.im_format.imtype;
        char path[FILE_MAX];
        
        RNA_string_get(op->ptr, "filepath", path);
@@ -728,7 +707,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
        if(RNA_property_is_set(op->ptr, "filepath"))
                return envmap_save_exec(C, op);
 
-       //RNA_enum_set(op->ptr, "file_type", scene->r.imtype);
+       //RNA_enum_set(op->ptr, "file_type", scene->r.im_format.imtype);
        RNA_string_set(op->ptr, "filepath", G.main->name);
        WM_event_add_fileselect(C, op);