rna support for passing dynamic sized arrays to rna functions
[blender.git] / source / blender / editors / gpencil / gpencil_ops.c
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
21  * This is a new part of Blender
22  *
23  * Contributor(s): Joshua Leung
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 #include <stdlib.h>
29 #include <stddef.h>
30 #include <stdio.h>
31
32 #include "BLO_sys_types.h"
33
34 #include "BLI_blenlib.h"
35
36 #include "WM_api.h"
37 #include "WM_types.h"
38
39 #include "RNA_access.h"
40
41 #include "gpencil_intern.h"
42
43 /* ****************************************** */
44 /* Generic Editing Keymap */
45
46 void ED_keymap_gpencil(wmKeyConfig *keyconf)
47 {
48         wmKeyMap *keymap= WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
49         wmKeyMapItem *kmi;
50         
51         /* Draw */
52                 /* draw */
53         WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, 0, DKEY);
54                 /* draw - straight lines */
55         kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL, DKEY);
56                 RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_DRAW_STRAIGHT);
57                 /* erase */
58         kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", RIGHTMOUSE, KM_PRESS, 0, DKEY);
59                 RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_ERASER);
60 }
61
62 /* ****************************************** */
63
64 void ED_operatortypes_gpencil (void)
65 {
66         /* Drawing ----------------------- */
67         
68         WM_operatortype_append(GPENCIL_OT_draw);
69         
70         /* Editing (Buttons) ------------ */
71         
72         WM_operatortype_append(GPENCIL_OT_data_add);
73         WM_operatortype_append(GPENCIL_OT_data_unlink);
74         
75         WM_operatortype_append(GPENCIL_OT_layer_add);
76         
77         WM_operatortype_append(GPENCIL_OT_active_frame_delete);
78         
79         WM_operatortype_append(GPENCIL_OT_convert);
80         
81         /* Editing (Time) --------------- */
82 }
83
84 /* ****************************************** */