diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-03-09 12:17:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-03-09 12:17:45 +0300 |
commit | b7a73f9e5b74062d4498a5061281c0d0af9fb026 (patch) | |
tree | 1175ff8ca1cff5bd90d5449d7014b4f32c454780 /source/blender/editors/render/render_shading.c | |
parent | 6a4b39ed2ce9e44139e91a4daab9ccf6caff0375 (diff) |
mtex buffer copy & paste back for materials.
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r-- | source/blender/editors/render/render_shading.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 21e3b55ba0f..7eeff31141b 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -820,3 +820,59 @@ void MATERIAL_OT_paste(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } + +static int copy_material_mtex_exec(bContext *C, wmOperator *op) +{ + Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; + + if(ma==NULL) + return OPERATOR_CANCELLED; + + copy_mat_mtex_copybuf(&ma->id); + + WM_event_add_notifier(C, NC_MATERIAL, ma); + + return OPERATOR_FINISHED; +} + +void MATERIAL_OT_mtex_copy(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Copy Material Texture Settings"; + ot->idname= "MATERIAL_OT_mtex_copy"; + ot->description="Copy the material texture settings and nodes"; + + /* api callbacks */ + ot->exec= copy_material_mtex_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int paste_material_mtex_exec(bContext *C, wmOperator *op) +{ + Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; + + if(ma==NULL) + return OPERATOR_CANCELLED; + + paste_mat_mtex_copybuf(&ma->id); + + WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, ma); + + return OPERATOR_FINISHED; +} + +void MATERIAL_OT_mtex_paste(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Paste Material Texture Settings"; + ot->idname= "MATERIAL_OT_mtex_paste"; + ot->description="Copy the material texture settings and nodes"; + + /* api callbacks */ + ot->exec= paste_material_mtex_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} |