Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-01-28 20:31:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-28 20:31:11 +0300
commit6f4a26c9e0e078f3d801f425de70853ea4ee7536 (patch)
treed308b5afee3b6b30ac082a78009e2d9ff14e1e04 /source/blender/editors/render/render_shading.c
parent883518d78295c05e93af3a2866e0f2eafae5fb15 (diff)
material copy/paste
not enough room for the buttons so adding a menu, icon is ugly probably needs a new icon?.
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r--source/blender/editors/render/render_shading.c59
1 files changed, 59 insertions, 0 deletions
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;
+}