GPencil: New interpolate strokes operators
[blender.git] / source / blender / editors / gpencil / gpencil_ops.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
19  * This is a new part of Blender
20  *
21  * Contributor(s): Joshua Leung, Antonio Vazquez
22  *
23  * ***** END GPL LICENSE BLOCK *****
24  */
25
26 /** \file blender/editors/gpencil/gpencil_ops.c
27  *  \ingroup edgpencil
28  */
29
30
31 #include <stdlib.h>
32 #include <stddef.h>
33 #include <stdio.h>
34
35 #include "BLI_sys_types.h"
36
37 #include "BKE_context.h"
38
39 #include "DNA_gpencil_types.h"
40
41 #include "WM_api.h"
42 #include "WM_types.h"
43
44 #include "RNA_access.h"
45
46 #include "ED_gpencil.h"
47 #include "ED_object.h"
48 #include "ED_transform.h"
49
50 #include "gpencil_intern.h"
51
52 /* ****************************************** */
53 /* Grease Pencil Keymaps */
54
55 /* Generic Drawing Keymap */
56 static void ed_keymap_gpencil_general(wmKeyConfig *keyconf)
57 {
58         wmKeyMap *keymap = WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
59         wmKeyMapItem *kmi;
60         
61         /* Draw  --------------------------------------- */
62         /* draw */
63         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, 0, DKEY);
64         RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_DRAW);
65         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
66         
67         /* draw - straight lines */
68         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL, DKEY);
69         RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_DRAW_STRAIGHT);
70         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
71         
72         /* draw - poly lines */
73         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_draw", RIGHTMOUSE, KM_PRESS, KM_CTRL, DKEY);
74         RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_DRAW_POLY);
75         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
76         
77         /* erase */
78         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_draw", RIGHTMOUSE, KM_PRESS, 0, DKEY);
79         RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_ERASER);
80         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
81         
82         /* Tablet Mappings for Drawing ------------------ */
83         /* For now, only support direct drawing using the eraser, as most users using a tablet
84          * may still want to use that as their primary pointing device!
85          */
86 #if 0
87         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_draw", TABLET_STYLUS, KM_PRESS, 0, 0);
88         RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_DRAW);
89         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
90 #endif
91         
92         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_draw", TABLET_ERASER, KM_PRESS, 0, 0);
93         RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_ERASER);
94         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
95         
96         /* Viewport Tools ------------------------------- */
97         
98         /* Enter EditMode */
99         WM_keymap_add_item(keymap, "GPENCIL_OT_editmode_toggle", TABKEY, KM_PRESS, 0, DKEY);
100         
101         /* Pie Menu - For standard tools */
102         WM_keymap_add_menu_pie(keymap, "GPENCIL_PIE_tool_palette", QKEY, KM_PRESS, 0, DKEY);
103         WM_keymap_add_menu_pie(keymap, "GPENCIL_PIE_settings_palette", WKEY, KM_PRESS, 0, DKEY);
104         
105         /* Delete Active Frame - For easier video tutorials/review sessions */
106         /* NOTE: This works even when not in EditMode */
107         WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, KM_PRESS, 0, DKEY);
108 }
109
110 /* ==================== */
111
112 /* Poll callback for stroke editing mode */
113 static int gp_stroke_editmode_poll(bContext *C)
114 {
115         bGPdata *gpd = CTX_data_gpencil_data(C);
116         return (gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE));
117 }
118
119 /* Stroke Editing Keymap - Only when editmode is enabled */
120 static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
121 {
122         wmKeyMap *keymap = WM_keymap_find(keyconf, "Grease Pencil Stroke Edit Mode", 0, 0);
123         wmKeyMapItem *kmi;
124         
125         /* set poll callback - so that this keymap only gets enabled when stroke editmode is enabled */
126         keymap->poll = gp_stroke_editmode_poll;
127         
128         /* ----------------------------------------------- */
129         
130         /* Exit EditMode */
131         WM_keymap_add_item(keymap, "GPENCIL_OT_editmode_toggle", TABKEY, KM_PRESS, 0, 0);
132         
133         /* Pie Menu - For settings/tools easy access */
134         WM_keymap_add_menu_pie(keymap, "GPENCIL_PIE_sculpt", EKEY, KM_PRESS, 0, DKEY);
135         
136         /* Brush Settings */
137         /* NOTE: We cannot expose these in the standard keymap, as they will interfere with regular hotkeys
138          *       in other modes. However, when we are dealing with Stroke Edit Mode, we know for certain
139          *       that the only data being edited is that of the Grease Pencil strokes
140          */
141         
142         /* CTRL + FKEY = Eraser Radius */
143         kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0);
144         RNA_string_set(kmi->ptr, "data_path_primary", "user_preferences.edit.grease_pencil_eraser_radius");
145         
146         /* Interpolation */
147         WM_keymap_add_item(keymap, "GPENCIL_OT_interpolate", EKEY, KM_PRESS, KM_CTRL, 0);
148         WM_keymap_add_item(keymap, "GPENCIL_OT_interpolate_sequence", EKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
149
150         /* Sculpting ------------------------------------- */
151         
152         /* Brush-Based Editing:
153          *   EKEY + LMB                          = Single stroke, draw immediately 
154          *        + Other Modifiers (Ctrl/Shift) = Invert, Smooth, etc.
155          *
156          * For the modal version, use D+E -> Sculpt
157          */
158         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, KM_PRESS, 0, EKEY);
159         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
160         
161         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, KM_PRESS, KM_CTRL, EKEY);
162         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
163         /*RNA_boolean_set(kmi->ptr, "use_invert", true);*/
164         
165         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, KM_PRESS, KM_SHIFT, EKEY);
166         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
167         /*RNA_boolean_set(kmi->ptr, "use_smooth", true);*/
168         
169         
170         /* Shift-FKEY = Sculpt Strength */
171         kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
172         RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.gpencil_sculpt.brush.strength");
173         
174         /* FKEY = Sculpt Brush Size */
175         kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0);
176         RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.gpencil_sculpt.brush.size");
177         
178         
179         /* Selection ------------------------------------- */
180         /* select all */
181         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_all", AKEY, KM_PRESS, 0, 0);
182         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
183         
184         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
185         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
186         
187         /* circle select */
188         WM_keymap_add_item(keymap, "GPENCIL_OT_select_circle", CKEY, KM_PRESS, 0, 0);
189         
190         /* border select */
191         WM_keymap_add_item(keymap, "GPENCIL_OT_select_border", BKEY, KM_PRESS, 0, 0);
192         
193         /* lasso select */
194         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
195         RNA_boolean_set(kmi->ptr, "deselect", false);
196         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL, 0);
197         RNA_boolean_set(kmi->ptr, "deselect", true);
198         
199         /* In the Node Editor, lasso select needs ALT modifier too (as somehow CTRL+LMB drag gets taken for "cut" quite early)
200          * There probably isn't too much harm adding this for other editors too as part of standard GP editing keymap. This hotkey
201          * combo doesn't seem to see much use under standard scenarios?
202          */
203         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_ALT, 0);
204         RNA_boolean_set(kmi->ptr, "deselect", false);
205         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL | KM_ALT, 0);
206         RNA_boolean_set(kmi->ptr, "deselect", true);
207         
208         /* normal select */
209         WM_keymap_add_item(keymap, "GPENCIL_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
210         
211         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
212         RNA_boolean_set(kmi->ptr, "extend", true);
213         RNA_boolean_set(kmi->ptr, "toggle", true);
214         
215         /* whole stroke select */
216         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
217         RNA_boolean_set(kmi->ptr, "entire_strokes", true);
218         
219         /* select linked */
220         /* NOTE: While LKEY is redundant, not having it breaks the mode illusion too much */
221         WM_keymap_add_item(keymap, "GPENCIL_OT_select_linked", LKEY, KM_PRESS, 0, 0);
222         WM_keymap_add_item(keymap, "GPENCIL_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
223         
224         /* select grouped */
225         WM_keymap_add_item(keymap, "GPENCIL_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
226                 
227         /* select more/less */
228         WM_keymap_add_item(keymap, "GPENCIL_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
229         WM_keymap_add_item(keymap, "GPENCIL_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
230         
231         /* Editing ----------------------------------------- */
232         
233         /* duplicate and move selected points */
234         WM_keymap_add_item(keymap, "GPENCIL_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
235         
236         /* delete */
237         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_gpencil_delete", XKEY, KM_PRESS, 0, 0);
238         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_gpencil_delete", DELKEY, KM_PRESS, 0, 0);
239         
240         WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", XKEY, KM_PRESS, KM_CTRL, 0);
241         WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", DELKEY, KM_PRESS, KM_CTRL, 0);
242         
243         WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, KM_PRESS, KM_SHIFT, 0);
244         
245         /* join strokes */
246         WM_keymap_add_item(keymap, "GPENCIL_OT_stroke_join", JKEY, KM_PRESS, KM_CTRL, 0);
247         
248         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_stroke_join", JKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
249         RNA_enum_set(kmi->ptr, "type", GP_STROKE_JOINCOPY);
250         
251         /* copy + paste */
252         WM_keymap_add_item(keymap, "GPENCIL_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
253         WM_keymap_add_item(keymap, "GPENCIL_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
254         
255 #ifdef __APPLE__
256         WM_keymap_add_item(keymap, "GPENCIL_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
257         WM_keymap_add_item(keymap, "GPENCIL_OT_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
258 #endif
259
260         /* snap */
261         WM_keymap_add_menu(keymap, "GPENCIL_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
262         
263         
264         /* convert to geometry */
265         WM_keymap_add_item(keymap, "GPENCIL_OT_convert", CKEY, KM_PRESS, KM_ALT, 0);
266         
267         
268         /* Show/Hide */
269         /* NOTE: These are available only in EditMode now, since they clash with general-purpose hotkeys */
270         WM_keymap_add_item(keymap, "GPENCIL_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
271         
272         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_hide", HKEY, KM_PRESS, 0, 0);
273         RNA_boolean_set(kmi->ptr, "unselected", false);
274         
275         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
276         RNA_boolean_set(kmi->ptr, "unselected", true);
277
278         WM_keymap_add_item(keymap, "GPENCIL_OT_selection_opacity_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
279         
280         /* Isolate Layer */
281         WM_keymap_add_item(keymap, "GPENCIL_OT_layer_isolate", PADASTERKEY, KM_PRESS, 0, 0);
282         
283         /* Move to Layer */
284         WM_keymap_add_item(keymap, "GPENCIL_OT_move_to_layer", MKEY, KM_PRESS, 0, 0);
285
286         /* Select drawing brush using index */
287         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", ONEKEY, KM_PRESS, 0, 0); 
288         RNA_int_set(kmi->ptr, "index", 0);
289         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", TWOKEY, KM_PRESS, 0, 0);
290         RNA_int_set(kmi->ptr, "index", 1);
291         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", THREEKEY, KM_PRESS, 0, 0);
292         RNA_int_set(kmi->ptr, "index", 2);
293         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", FOURKEY, KM_PRESS, 0, 0);
294         RNA_int_set(kmi->ptr, "index", 3);
295         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", FIVEKEY, KM_PRESS, 0, 0);
296         RNA_int_set(kmi->ptr, "index", 4);
297         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", SIXKEY, KM_PRESS, 0, 0);
298         RNA_int_set(kmi->ptr, "index", 5);
299         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", SEVENKEY, KM_PRESS, 0, 0);
300         RNA_int_set(kmi->ptr, "index", 6);
301         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", EIGHTKEY, KM_PRESS, 0, 0);
302         RNA_int_set(kmi->ptr, "index", 7);
303         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", NINEKEY, KM_PRESS, 0, 0);
304         RNA_int_set(kmi->ptr, "index", 8);
305         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", ZEROKEY, KM_PRESS, 0, 0);
306         RNA_int_set(kmi->ptr, "index", 9);
307
308         /* Transform Tools */
309         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, 0);
310         
311         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_S, KM_ANY, 0, 0);
312         
313         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_rotate", RKEY, KM_PRESS, 0, 0);
314         
315         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_resize", SKEY, KM_PRESS, 0, 0);
316         
317         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
318         
319         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_bend", WKEY, KM_PRESS, KM_SHIFT, 0);
320         
321         WM_keymap_add_item(keymap, "TRANSFORM_OT_tosphere", SKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
322         
323         WM_keymap_add_item(keymap, "TRANSFORM_OT_shear", SKEY, KM_PRESS, KM_ALT | KM_CTRL | KM_SHIFT, 0);
324         
325         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
326         RNA_enum_set(kmi->ptr, "mode", TFM_GPENCIL_SHRINKFATTEN);
327         
328         /* Proportional Editing */
329         ED_keymap_proportional_cycle(keyconf, keymap);
330         ED_keymap_proportional_editmode(keyconf, keymap, true);
331 }
332
333 /* ==================== */
334
335 void ED_keymap_gpencil(wmKeyConfig *keyconf)
336 {
337         ed_keymap_gpencil_general(keyconf);
338         ed_keymap_gpencil_editing(keyconf);
339 }
340
341 /* ****************************************** */
342
343 void ED_operatortypes_gpencil(void)
344 {
345         /* Drawing ----------------------- */
346         
347         WM_operatortype_append(GPENCIL_OT_draw);
348         
349         /* Editing (Strokes) ------------ */
350         
351         WM_operatortype_append(GPENCIL_OT_editmode_toggle);
352         WM_operatortype_append(GPENCIL_OT_selection_opacity_toggle);
353
354         WM_operatortype_append(GPENCIL_OT_select);
355         WM_operatortype_append(GPENCIL_OT_select_all);
356         WM_operatortype_append(GPENCIL_OT_select_circle);
357         WM_operatortype_append(GPENCIL_OT_select_border);
358         WM_operatortype_append(GPENCIL_OT_select_lasso);
359         
360         WM_operatortype_append(GPENCIL_OT_select_linked);
361         WM_operatortype_append(GPENCIL_OT_select_grouped);
362         WM_operatortype_append(GPENCIL_OT_select_more);
363         WM_operatortype_append(GPENCIL_OT_select_less);
364         WM_operatortype_append(GPENCIL_OT_select_first);
365         WM_operatortype_append(GPENCIL_OT_select_last);
366         
367         WM_operatortype_append(GPENCIL_OT_duplicate);
368         WM_operatortype_append(GPENCIL_OT_delete);
369         WM_operatortype_append(GPENCIL_OT_dissolve);
370         WM_operatortype_append(GPENCIL_OT_copy);
371         WM_operatortype_append(GPENCIL_OT_paste);
372         
373         WM_operatortype_append(GPENCIL_OT_move_to_layer);
374         WM_operatortype_append(GPENCIL_OT_layer_change);
375         
376         WM_operatortype_append(GPENCIL_OT_snap_to_grid);
377         WM_operatortype_append(GPENCIL_OT_snap_to_cursor);
378         WM_operatortype_append(GPENCIL_OT_snap_cursor_to_selected);
379         
380         WM_operatortype_append(GPENCIL_OT_reproject);
381         
382         WM_operatortype_append(GPENCIL_OT_brush_paint);
383         
384         /* Editing (Buttons) ------------ */
385         
386         WM_operatortype_append(GPENCIL_OT_data_add);
387         WM_operatortype_append(GPENCIL_OT_data_unlink);
388         
389         WM_operatortype_append(GPENCIL_OT_layer_add);
390         WM_operatortype_append(GPENCIL_OT_layer_remove);
391         WM_operatortype_append(GPENCIL_OT_layer_move);
392         WM_operatortype_append(GPENCIL_OT_layer_duplicate);
393         
394         WM_operatortype_append(GPENCIL_OT_hide);
395         WM_operatortype_append(GPENCIL_OT_reveal);
396         WM_operatortype_append(GPENCIL_OT_lock_all);
397         WM_operatortype_append(GPENCIL_OT_unlock_all);
398         WM_operatortype_append(GPENCIL_OT_layer_isolate);
399         WM_operatortype_append(GPENCIL_OT_layer_merge);
400
401         WM_operatortype_append(GPENCIL_OT_active_frame_delete);
402         WM_operatortype_append(GPENCIL_OT_active_frames_delete_all);
403         
404         WM_operatortype_append(GPENCIL_OT_convert);
405
406         WM_operatortype_append(GPENCIL_OT_stroke_arrange);
407         WM_operatortype_append(GPENCIL_OT_stroke_change_color);
408         WM_operatortype_append(GPENCIL_OT_stroke_lock_color);
409         WM_operatortype_append(GPENCIL_OT_stroke_apply_thickness);
410         WM_operatortype_append(GPENCIL_OT_stroke_cyclical_set);
411         WM_operatortype_append(GPENCIL_OT_stroke_join);
412         WM_operatortype_append(GPENCIL_OT_stroke_flip);
413
414         WM_operatortype_append(GPENCIL_OT_palette_add);
415         WM_operatortype_append(GPENCIL_OT_palette_remove);
416         WM_operatortype_append(GPENCIL_OT_palette_change);
417         WM_operatortype_append(GPENCIL_OT_palette_lock_layer);
418         WM_operatortype_append(GPENCIL_OT_palettecolor_add);
419         WM_operatortype_append(GPENCIL_OT_palettecolor_remove);
420         WM_operatortype_append(GPENCIL_OT_palettecolor_isolate);
421         WM_operatortype_append(GPENCIL_OT_palettecolor_hide);
422         WM_operatortype_append(GPENCIL_OT_palettecolor_reveal);
423         WM_operatortype_append(GPENCIL_OT_palettecolor_lock_all);
424         WM_operatortype_append(GPENCIL_OT_palettecolor_unlock_all);
425         WM_operatortype_append(GPENCIL_OT_palettecolor_move);
426         WM_operatortype_append(GPENCIL_OT_palettecolor_select);
427         WM_operatortype_append(GPENCIL_OT_palettecolor_copy);
428
429         WM_operatortype_append(GPENCIL_OT_brush_add);
430         WM_operatortype_append(GPENCIL_OT_brush_remove);
431         WM_operatortype_append(GPENCIL_OT_brush_change);
432         WM_operatortype_append(GPENCIL_OT_brush_move);
433         WM_operatortype_append(GPENCIL_OT_brush_presets_create);
434         WM_operatortype_append(GPENCIL_OT_brush_copy);
435         WM_operatortype_append(GPENCIL_OT_brush_select);
436
437         /* Editing (Time) --------------- */
438         
439         /* Interpolation */
440         WM_operatortype_append(GPENCIL_OT_interpolate);
441         WM_operatortype_append(GPENCIL_OT_interpolate_sequence);
442 }
443
444 void ED_operatormacros_gpencil(void)
445 {
446         wmOperatorType *ot;
447         wmOperatorTypeMacro *otmacro;
448         
449         /* Duplicate + Move = Interactively place newly duplicated strokes */
450         ot = WM_operatortype_append_macro("GPENCIL_OT_duplicate_move", "Duplicate Strokes",
451                                           "Make copies of the selected Grease Pencil strokes and move them",
452                                           OPTYPE_UNDO | OPTYPE_REGISTER);
453         WM_operatortype_macro_define(ot, "GPENCIL_OT_duplicate");
454         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
455         RNA_boolean_set(otmacro->ptr, "gpencil_strokes", true);
456
457 }
458
459 /* ****************************************** */