Merge branch 'blender2.7'
[blender.git] / source / blender / editors / render / render_shading.c
index 587d2d91029f0f575e9a95edea593ba130b93ad7..53fc82e3482f12e8d8a069f4cba47ed367244d5a 100644 (file)
@@ -718,6 +718,12 @@ void SCENE_OT_view_layer_add(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
 }
 
+static bool view_layer_remove_poll(bContext *C)
+{
+       Scene *scene = CTX_data_scene(C);
+       return (scene->view_layers.first != scene->view_layers.last);
+}
+
 static int view_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Main *bmain = CTX_data_main(C);
@@ -742,6 +748,7 @@ void SCENE_OT_view_layer_remove(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = view_layer_remove_exec;
+       ot->poll = view_layer_remove_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
@@ -1782,6 +1789,7 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
 
        paste_matcopybuf(CTX_data_main(C), ma);
 
+       DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
        WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
 
        return OPERATOR_FINISHED;