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