Cleanup: rename WM_keymap_find -> WM_keymap_ensure
[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_ensure(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_MT_pie_tool_palette", QKEY, KM_PRESS, 0, DKEY);
103         WM_keymap_add_menu_pie(keymap, "GPENCIL_MT_pie_settings_palette", WKEY, KM_PRESS, 0, DKEY);
104
105         /* Add Blank Frame */
106         /* XXX: BKEY or NKEY? BKEY is easier to reach from DKEY, so we'll use that for now */
107         WM_keymap_add_item(keymap, "GPENCIL_OT_blank_frame_add", BKEY, KM_PRESS, 0, DKEY);
108
109         /* Delete Active Frame - For easier video tutorials/review sessions */
110         /* NOTE: This works even when not in EditMode */
111         WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, KM_PRESS, 0, DKEY);
112 }
113
114 /* ==================== */
115
116 /* Poll callback for stroke editing mode */
117 static bool gp_stroke_editmode_poll(bContext *C)
118 {
119         bGPdata *gpd = CTX_data_gpencil_data(C);
120         return (gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE));
121 }
122
123 /* Stroke Editing Keymap - Only when editmode is enabled */
124 static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
125 {
126         wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Edit Mode", 0, 0);
127         wmKeyMapItem *kmi;
128
129         /* set poll callback - so that this keymap only gets enabled when stroke editmode is enabled */
130         keymap->poll = gp_stroke_editmode_poll;
131
132         /* ----------------------------------------------- */
133
134         /* Exit EditMode */
135         WM_keymap_add_item(keymap, "GPENCIL_OT_editmode_toggle", TABKEY, KM_PRESS, 0, 0);
136
137         /* Pie Menu - For settings/tools easy access */
138         WM_keymap_add_menu_pie(keymap, "GPENCIL_MT_pie_sculpt", EKEY, KM_PRESS, 0, DKEY);
139
140         /* Brush Settings */
141         /* NOTE: We cannot expose these in the standard keymap, as they will interfere with regular hotkeys
142          *       in other modes. However, when we are dealing with Stroke Edit Mode, we know for certain
143          *       that the only data being edited is that of the Grease Pencil strokes
144          */
145
146         /* CTRL + FKEY = Eraser Radius */
147         kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0);
148         RNA_string_set(kmi->ptr, "data_path_primary", "user_preferences.edit.grease_pencil_eraser_radius");
149
150         /* Interpolation */
151         WM_keymap_add_item(keymap, "GPENCIL_OT_interpolate", EKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
152         WM_keymap_add_item(keymap, "GPENCIL_OT_interpolate_sequence", EKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
153
154         /* Sculpting ------------------------------------- */
155
156         /* Brush-Based Editing:
157          *   EKEY + LMB                          = Single stroke, draw immediately
158          *        + Other Modifiers (Ctrl/Shift) = Invert, Smooth, etc.
159          *
160          * For the modal version, use D+E -> Sculpt
161          */
162         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, KM_PRESS, 0, EKEY);
163         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
164
165         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, KM_PRESS, KM_CTRL, EKEY);
166         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
167         /*RNA_boolean_set(kmi->ptr, "use_invert", true);*/
168
169         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, KM_PRESS, KM_SHIFT, EKEY);
170         RNA_boolean_set(kmi->ptr, "wait_for_input", false);
171         /*RNA_boolean_set(kmi->ptr, "use_smooth", true);*/
172
173
174         /* Shift-FKEY = Sculpt Strength */
175         kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
176         RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.gpencil_sculpt.brush.strength");
177
178         /* FKEY = Sculpt Brush Size */
179         kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0);
180         RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.gpencil_sculpt.brush.size");
181
182
183         /* Selection ------------------------------------- */
184         /* select all */
185         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_all", AKEY, KM_PRESS, 0, 0);
186         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
187
188         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
189         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
190
191         /* circle select */
192         WM_keymap_add_item(keymap, "GPENCIL_OT_select_circle", CKEY, KM_PRESS, 0, 0);
193
194         /* border select */
195         WM_keymap_add_item(keymap, "GPENCIL_OT_select_border", BKEY, KM_PRESS, 0, 0);
196
197         /* lasso select */
198         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
199         RNA_boolean_set(kmi->ptr, "deselect", false);
200         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL, 0);
201         RNA_boolean_set(kmi->ptr, "deselect", true);
202
203         /* In the Node Editor, lasso select needs ALT modifier too (as somehow CTRL+LMB drag gets taken for "cut" quite early)
204          * There probably isn't too much harm adding this for other editors too as part of standard GP editing keymap. This hotkey
205          * combo doesn't seem to see much use under standard scenarios?
206          */
207         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_ALT, 0);
208         RNA_boolean_set(kmi->ptr, "deselect", false);
209         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL | KM_ALT, 0);
210         RNA_boolean_set(kmi->ptr, "deselect", true);
211
212         /* normal select */
213         WM_keymap_add_item(keymap, "GPENCIL_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
214
215         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
216         RNA_boolean_set(kmi->ptr, "extend", true);
217         RNA_boolean_set(kmi->ptr, "toggle", true);
218
219         /* whole stroke select */
220         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
221         RNA_boolean_set(kmi->ptr, "entire_strokes", true);
222
223         /* select linked */
224         /* NOTE: While LKEY is redundant, not having it breaks the mode illusion too much */
225         WM_keymap_add_item(keymap, "GPENCIL_OT_select_linked", LKEY, KM_PRESS, 0, 0);
226         WM_keymap_add_item(keymap, "GPENCIL_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
227
228         /* select grouped */
229         WM_keymap_add_item(keymap, "GPENCIL_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
230
231         /* select more/less */
232         WM_keymap_add_item(keymap, "GPENCIL_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
233         WM_keymap_add_item(keymap, "GPENCIL_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
234
235         /* Editing ----------------------------------------- */
236
237         /* duplicate and move selected points */
238         WM_keymap_add_item(keymap, "GPENCIL_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
239
240         /* delete */
241         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_gpencil_delete", XKEY, KM_PRESS, 0, 0);
242         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_gpencil_delete", DELKEY, KM_PRESS, 0, 0);
243
244         WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", XKEY, KM_PRESS, KM_CTRL, 0);
245         WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", DELKEY, KM_PRESS, KM_CTRL, 0);
246
247         WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, KM_PRESS, KM_SHIFT, 0);
248
249         /* menu edit specials */
250         WM_keymap_add_menu(keymap, "GPENCIL_MT_gpencil_edit_specials", WKEY, KM_PRESS, 0, 0);
251
252         /* join strokes */
253         WM_keymap_add_item(keymap, "GPENCIL_OT_stroke_join", JKEY, KM_PRESS, KM_CTRL, 0);
254
255         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_stroke_join", JKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
256         RNA_enum_set(kmi->ptr, "type", GP_STROKE_JOINCOPY);
257
258         /* copy + paste */
259         WM_keymap_add_item(keymap, "GPENCIL_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
260         WM_keymap_add_item(keymap, "GPENCIL_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
261
262 #ifdef __APPLE__
263         WM_keymap_add_item(keymap, "GPENCIL_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
264         WM_keymap_add_item(keymap, "GPENCIL_OT_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
265 #endif
266
267         /* snap */
268         WM_keymap_add_menu(keymap, "GPENCIL_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
269
270
271         /* convert to geometry */
272         WM_keymap_add_item(keymap, "GPENCIL_OT_convert", CKEY, KM_PRESS, KM_ALT, 0);
273
274
275         /* Show/Hide */
276         /* NOTE: These are available only in EditMode now, since they clash with general-purpose hotkeys */
277         WM_keymap_add_item(keymap, "GPENCIL_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
278
279         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_hide", HKEY, KM_PRESS, 0, 0);
280         RNA_boolean_set(kmi->ptr, "unselected", false);
281
282         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
283         RNA_boolean_set(kmi->ptr, "unselected", true);
284
285         WM_keymap_add_item(keymap, "GPENCIL_OT_selection_opacity_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
286
287         /* Isolate Layer */
288         WM_keymap_add_item(keymap, "GPENCIL_OT_layer_isolate", PADASTERKEY, KM_PRESS, 0, 0);
289
290         /* Move to Layer */
291         WM_keymap_add_item(keymap, "GPENCIL_OT_move_to_layer", MKEY, KM_PRESS, 0, 0);
292
293         /* Select drawing brush using index */
294         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", ONEKEY, KM_PRESS, 0, 0);
295         RNA_int_set(kmi->ptr, "index", 0);
296         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", TWOKEY, KM_PRESS, 0, 0);
297         RNA_int_set(kmi->ptr, "index", 1);
298         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", THREEKEY, KM_PRESS, 0, 0);
299         RNA_int_set(kmi->ptr, "index", 2);
300         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", FOURKEY, KM_PRESS, 0, 0);
301         RNA_int_set(kmi->ptr, "index", 3);
302         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", FIVEKEY, KM_PRESS, 0, 0);
303         RNA_int_set(kmi->ptr, "index", 4);
304         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", SIXKEY, KM_PRESS, 0, 0);
305         RNA_int_set(kmi->ptr, "index", 5);
306         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", SEVENKEY, KM_PRESS, 0, 0);
307         RNA_int_set(kmi->ptr, "index", 6);
308         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", EIGHTKEY, KM_PRESS, 0, 0);
309         RNA_int_set(kmi->ptr, "index", 7);
310         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", NINEKEY, KM_PRESS, 0, 0);
311         RNA_int_set(kmi->ptr, "index", 8);
312         kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_select", ZEROKEY, KM_PRESS, 0, 0);
313         RNA_int_set(kmi->ptr, "index", 9);
314
315         /* Transform Tools */
316         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, 0);
317
318         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_S, KM_ANY, 0, 0);
319
320         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_rotate", RKEY, KM_PRESS, 0, 0);
321
322         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_resize", SKEY, KM_PRESS, 0, 0);
323
324         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
325
326         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_bend", WKEY, KM_PRESS, KM_SHIFT, 0);
327
328         WM_keymap_add_item(keymap, "TRANSFORM_OT_tosphere", SKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
329
330         WM_keymap_add_item(keymap, "TRANSFORM_OT_shear", SKEY, KM_PRESS, KM_ALT | KM_CTRL | KM_SHIFT, 0);
331
332         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
333         RNA_enum_set(kmi->ptr, "mode", TFM_GPENCIL_SHRINKFATTEN);
334
335         /* Proportional Editing */
336         ED_keymap_proportional_cycle(keyconf, keymap);
337         ED_keymap_proportional_editmode(keyconf, keymap, true);
338 }
339
340 /* ==================== */
341
342 void ED_keymap_gpencil(wmKeyConfig *keyconf)
343 {
344         ed_keymap_gpencil_general(keyconf);
345         ed_keymap_gpencil_editing(keyconf);
346 }
347
348 /* ****************************************** */
349
350 void ED_operatortypes_gpencil(void)
351 {
352         /* Drawing ----------------------- */
353
354         WM_operatortype_append(GPENCIL_OT_draw);
355
356         /* Editing (Strokes) ------------ */
357
358         WM_operatortype_append(GPENCIL_OT_editmode_toggle);
359         WM_operatortype_append(GPENCIL_OT_selection_opacity_toggle);
360
361         WM_operatortype_append(GPENCIL_OT_select);
362         WM_operatortype_append(GPENCIL_OT_select_all);
363         WM_operatortype_append(GPENCIL_OT_select_circle);
364         WM_operatortype_append(GPENCIL_OT_select_border);
365         WM_operatortype_append(GPENCIL_OT_select_lasso);
366
367         WM_operatortype_append(GPENCIL_OT_select_linked);
368         WM_operatortype_append(GPENCIL_OT_select_grouped);
369         WM_operatortype_append(GPENCIL_OT_select_more);
370         WM_operatortype_append(GPENCIL_OT_select_less);
371         WM_operatortype_append(GPENCIL_OT_select_first);
372         WM_operatortype_append(GPENCIL_OT_select_last);
373
374         WM_operatortype_append(GPENCIL_OT_duplicate);
375         WM_operatortype_append(GPENCIL_OT_delete);
376         WM_operatortype_append(GPENCIL_OT_dissolve);
377         WM_operatortype_append(GPENCIL_OT_copy);
378         WM_operatortype_append(GPENCIL_OT_paste);
379
380         WM_operatortype_append(GPENCIL_OT_move_to_layer);
381         WM_operatortype_append(GPENCIL_OT_layer_change);
382
383         WM_operatortype_append(GPENCIL_OT_snap_to_grid);
384         WM_operatortype_append(GPENCIL_OT_snap_to_cursor);
385         WM_operatortype_append(GPENCIL_OT_snap_cursor_to_selected);
386
387         WM_operatortype_append(GPENCIL_OT_reproject);
388
389         WM_operatortype_append(GPENCIL_OT_brush_paint);
390
391         /* Editing (Buttons) ------------ */
392
393         WM_operatortype_append(GPENCIL_OT_data_add);
394         WM_operatortype_append(GPENCIL_OT_data_unlink);
395
396         WM_operatortype_append(GPENCIL_OT_layer_add);
397         WM_operatortype_append(GPENCIL_OT_layer_remove);
398         WM_operatortype_append(GPENCIL_OT_layer_move);
399         WM_operatortype_append(GPENCIL_OT_layer_duplicate);
400
401         WM_operatortype_append(GPENCIL_OT_hide);
402         WM_operatortype_append(GPENCIL_OT_reveal);
403         WM_operatortype_append(GPENCIL_OT_lock_all);
404         WM_operatortype_append(GPENCIL_OT_unlock_all);
405         WM_operatortype_append(GPENCIL_OT_layer_isolate);
406         WM_operatortype_append(GPENCIL_OT_layer_merge);
407
408         WM_operatortype_append(GPENCIL_OT_blank_frame_add);
409
410         WM_operatortype_append(GPENCIL_OT_active_frame_delete);
411         WM_operatortype_append(GPENCIL_OT_active_frames_delete_all);
412
413         WM_operatortype_append(GPENCIL_OT_convert);
414
415         WM_operatortype_append(GPENCIL_OT_stroke_arrange);
416         WM_operatortype_append(GPENCIL_OT_stroke_change_color);
417         WM_operatortype_append(GPENCIL_OT_stroke_lock_color);
418         WM_operatortype_append(GPENCIL_OT_stroke_apply_thickness);
419         WM_operatortype_append(GPENCIL_OT_stroke_cyclical_set);
420         WM_operatortype_append(GPENCIL_OT_stroke_join);
421         WM_operatortype_append(GPENCIL_OT_stroke_flip);
422         WM_operatortype_append(GPENCIL_OT_stroke_subdivide);
423
424         WM_operatortype_append(GPENCIL_OT_palette_add);
425         WM_operatortype_append(GPENCIL_OT_palette_remove);
426         WM_operatortype_append(GPENCIL_OT_palette_change);
427         WM_operatortype_append(GPENCIL_OT_palette_lock_layer);
428         WM_operatortype_append(GPENCIL_OT_palettecolor_add);
429         WM_operatortype_append(GPENCIL_OT_palettecolor_remove);
430         WM_operatortype_append(GPENCIL_OT_palettecolor_isolate);
431         WM_operatortype_append(GPENCIL_OT_palettecolor_hide);
432         WM_operatortype_append(GPENCIL_OT_palettecolor_reveal);
433         WM_operatortype_append(GPENCIL_OT_palettecolor_lock_all);
434         WM_operatortype_append(GPENCIL_OT_palettecolor_unlock_all);
435         WM_operatortype_append(GPENCIL_OT_palettecolor_move);
436         WM_operatortype_append(GPENCIL_OT_palettecolor_select);
437         WM_operatortype_append(GPENCIL_OT_palettecolor_copy);
438
439         WM_operatortype_append(GPENCIL_OT_brush_add);
440         WM_operatortype_append(GPENCIL_OT_brush_remove);
441         WM_operatortype_append(GPENCIL_OT_brush_change);
442         WM_operatortype_append(GPENCIL_OT_brush_move);
443         WM_operatortype_append(GPENCIL_OT_brush_presets_create);
444         WM_operatortype_append(GPENCIL_OT_brush_copy);
445         WM_operatortype_append(GPENCIL_OT_brush_select);
446
447         /* Editing (Time) --------------- */
448
449         /* Interpolation */
450         WM_operatortype_append(GPENCIL_OT_interpolate);
451         WM_operatortype_append(GPENCIL_OT_interpolate_sequence);
452         WM_operatortype_append(GPENCIL_OT_interpolate_reverse);
453 }
454
455 void ED_operatormacros_gpencil(void)
456 {
457         wmOperatorType *ot;
458         wmOperatorTypeMacro *otmacro;
459
460         /* Duplicate + Move = Interactively place newly duplicated strokes */
461         ot = WM_operatortype_append_macro("GPENCIL_OT_duplicate_move", "Duplicate Strokes",
462                                           "Make copies of the selected Grease Pencil strokes and move them",
463                                           OPTYPE_UNDO | OPTYPE_REGISTER);
464         WM_operatortype_macro_define(ot, "GPENCIL_OT_duplicate");
465         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
466         RNA_boolean_set(otmacro->ptr, "gpencil_strokes", true);
467
468 }
469
470 /* ****************************************** */