Blender  V2.59
gpencil_ops.c
Go to the documentation of this file.
00001 /*
00002  * $Id: gpencil_ops.c 35242 2011-02-27 20:29:51Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
00021  * This is a new part of Blender
00022  *
00023  * Contributor(s): Joshua Leung
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #include <stdlib.h>
00034 #include <stddef.h>
00035 #include <stdio.h>
00036 
00037 #include "BLO_sys_types.h"
00038 
00039 #include "BLI_blenlib.h"
00040 
00041 #include "WM_api.h"
00042 #include "WM_types.h"
00043 
00044 #include "RNA_access.h"
00045 
00046 #include "ED_gpencil.h"
00047 
00048 #include "gpencil_intern.h"
00049 
00050 /* ****************************************** */
00051 /* Generic Editing Keymap */
00052 
00053 void ED_keymap_gpencil(wmKeyConfig *keyconf)
00054 {
00055         wmKeyMap *keymap= WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
00056         wmKeyMapItem *kmi;
00057         
00058         /* Draw */
00059                 /* draw */
00060         WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, 0, DKEY);
00061                 /* draw - straight lines */
00062         kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL, DKEY);
00063                 RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_DRAW_STRAIGHT);
00064                 /* erase */
00065         kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", RIGHTMOUSE, KM_PRESS, 0, DKEY);
00066                 RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_ERASER);
00067 }
00068 
00069 /* ****************************************** */
00070 
00071 void ED_operatortypes_gpencil (void)
00072 {
00073         /* Drawing ----------------------- */
00074         
00075         WM_operatortype_append(GPENCIL_OT_draw);
00076         
00077         /* Editing (Buttons) ------------ */
00078         
00079         WM_operatortype_append(GPENCIL_OT_data_add);
00080         WM_operatortype_append(GPENCIL_OT_data_unlink);
00081         
00082         WM_operatortype_append(GPENCIL_OT_layer_add);
00083         
00084         WM_operatortype_append(GPENCIL_OT_active_frame_delete);
00085         
00086         WM_operatortype_append(GPENCIL_OT_convert);
00087         
00088         /* Editing (Time) --------------- */
00089 }
00090 
00091 /* ****************************************** */