From 6f4a26c9e0e078f3d801f425de70853ea4ee7536 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 28 Jan 2010 17:31:11 +0000 Subject: material copy/paste not enough room for the buttons so adding a menu, icon is ugly probably needs a new icon?. --- source/blender/editors/render/render_shading.c | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 4be35a4a2c4..413d9889b5d 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -758,3 +758,62 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", ""); } + + + +/* material copy/paste */ +static int copy_material_exec(bContext *C, wmOperator *op) +{ + Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; + + if(ma==NULL) + return; + + copy_matcopybuf(ma); + + WM_event_add_notifier(C, NC_MATERIAL, ma); + + return OPERATOR_FINISHED; +} + +void MATERIAL_OT_copy(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Copy Material"; + ot->idname= "MATERIAL_OT_copy"; + ot->description="Copy the material settings and nodes."; + + /* api callbacks */ + ot->exec= copy_material_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int paste_material_exec(bContext *C, wmOperator *op) +{ + Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; + + if(ma==NULL) + return; + + paste_matcopybuf(ma); + + WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, ma); + + return OPERATOR_FINISHED; +} + +void MATERIAL_OT_paste(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Paste Material"; + ot->idname= "MATERIAL_OT_paste"; + ot->description="Copy the material settings and nodes."; + + /* api callbacks */ + ot->exec= paste_material_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} -- cgit v1.2.3