[Bf-blender-cvs] [0b62328] GPencil_EditStrokes: GPencil Stroke Duplicate operator is now a macro which combines the copy and move into a single step

Joshua Leung noreply at git.blender.org
Sun Sep 28 17:27:06 CEST 2014


Commit: 0b62328bb5080277803c264ece60a6360273ea47
Author: Joshua Leung
Date:   Mon Sep 29 03:58:42 2014 +1300
Branches: GPencil_EditStrokes
https://developer.blender.org/rB0b62328bb5080277803c264ece60a6360273ea47

GPencil Stroke Duplicate operator is now a macro which combines the copy and move into a single step

===================================================================

M	source/blender/editors/gpencil/gpencil_ops.c
M	source/blender/editors/include/ED_gpencil.h
M	source/blender/editors/space_api/spacetypes.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 938e2e3..719c462 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -84,8 +84,7 @@ void ED_keymap_gpencil(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "GPENCIL_OT_select_circle", CKEY, KM_PRESS, 0, DKEY);
 	
 	/* Editing ----------------------------------------- */
-	// XXX: need to use move + copy here...
-	WM_keymap_add_item(keymap, "GPENCIL_OT_strokes_copy", EKEY, KM_PRESS, 0, DKEY);
+	WM_keymap_add_item(keymap, "GPENCIL_OT_strokes_duplicate", EKEY, KM_PRESS, 0, DKEY);
 	
 	kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, DKEY);
 	RNA_boolean_set(kmi->ptr, "gpencil_strokes", true);
@@ -126,4 +125,17 @@ void ED_operatortypes_gpencil(void)
 	/* Editing (Time) --------------- */
 }
 
+void ED_operatormacros_gpencil(void)
+{
+	wmOperatorType *ot;
+	wmOperatorTypeMacro *otmacro;
+
+	ot = WM_operatortype_append_macro("GPENCIL_OT_strokes_duplicate", "Duplicate Strokes",
+	                                  "Make copies of the selected Grease Pencil strokes and move them",
+	                                  OPTYPE_UNDO | OPTYPE_REGISTER);
+	WM_operatortype_macro_define(ot, "GPENCIL_OT_strokes_copy");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	RNA_enum_set(otmacro->ptr, "gpencil_strokes", true);
+}
+
 /* ****************************************** */
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 05fb76b..f538a89 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -72,7 +72,9 @@ struct bGPdata  *ED_gpencil_data_get_active_v3d(struct Scene *scene, struct View
 /* ----------- Grease Pencil Operators ----------------- */
 
 void ED_keymap_gpencil(struct wmKeyConfig *keyconf);
+
 void ED_operatortypes_gpencil(void);
+void ED_operatormacros_gpencil(void);
 
 /* ------------ Grease-Pencil Drawing API ------------------ */
 /* drawgpencil.c */
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index c8431d5..e9ba4be 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -155,6 +155,7 @@ void ED_spacemacros_init(void)
 	ED_operatormacros_mask();
 	ED_operatormacros_sequencer();
 	ED_operatormacros_paint();
+	ED_operatormacros_gpencil();
 
 	/* register dropboxes (can use macros) */
 	spacetypes = BKE_spacetypes_list();




More information about the Bf-blender-cvs mailing list