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) 2008 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * 00022 * Contributor(s): Blender Foundation 00023 * 00024 * ***** END GPL LICENSE BLOCK ***** 00025 */ 00026 00032 #include <stdlib.h> 00033 #include <math.h> 00034 00035 00036 #include "DNA_space_types.h" 00037 00038 #include "BLI_blenlib.h" 00039 #include "BLI_utildefines.h" 00040 00041 #include "ED_anim_api.h" 00042 #include "ED_markers.h" 00043 #include "ED_transform.h" 00044 00045 #include "action_intern.h" 00046 00047 #include "RNA_access.h" 00048 00049 #include "WM_api.h" 00050 #include "WM_types.h" 00051 00052 /* ************************** registration - operator types **********************************/ 00053 00054 void action_operatortypes(void) 00055 { 00056 /* keyframes */ 00057 /* selection */ 00058 WM_operatortype_append(ACTION_OT_clickselect); 00059 WM_operatortype_append(ACTION_OT_select_all_toggle); 00060 WM_operatortype_append(ACTION_OT_select_border); 00061 WM_operatortype_append(ACTION_OT_select_column); 00062 WM_operatortype_append(ACTION_OT_select_linked); 00063 WM_operatortype_append(ACTION_OT_select_more); 00064 WM_operatortype_append(ACTION_OT_select_less); 00065 WM_operatortype_append(ACTION_OT_select_leftright); 00066 00067 /* editing */ 00068 WM_operatortype_append(ACTION_OT_snap); 00069 WM_operatortype_append(ACTION_OT_mirror); 00070 WM_operatortype_append(ACTION_OT_frame_jump); 00071 WM_operatortype_append(ACTION_OT_handle_type); 00072 WM_operatortype_append(ACTION_OT_interpolation_type); 00073 WM_operatortype_append(ACTION_OT_extrapolation_type); 00074 WM_operatortype_append(ACTION_OT_keyframe_type); 00075 WM_operatortype_append(ACTION_OT_sample); 00076 WM_operatortype_append(ACTION_OT_clean); 00077 WM_operatortype_append(ACTION_OT_delete); 00078 WM_operatortype_append(ACTION_OT_duplicate); 00079 WM_operatortype_append(ACTION_OT_keyframe_insert); 00080 WM_operatortype_append(ACTION_OT_copy); 00081 WM_operatortype_append(ACTION_OT_paste); 00082 WM_operatortype_append(ACTION_OT_new); 00083 00084 WM_operatortype_append(ACTION_OT_previewrange_set); 00085 WM_operatortype_append(ACTION_OT_view_all); 00086 WM_operatortype_append(ACTION_OT_view_selected); 00087 00088 WM_operatortype_append(ACTION_OT_markers_make_local); 00089 } 00090 00091 void ED_operatormacros_action(void) 00092 { 00093 wmOperatorType *ot; 00094 wmOperatorTypeMacro *otmacro; 00095 00096 ot= WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); 00097 if (ot) { 00098 ot->description= "Make a copy of all selected keyframes and move them"; 00099 WM_operatortype_macro_define(ot, "ACTION_OT_duplicate"); 00100 otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); 00101 RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); 00102 } 00103 00104 } 00105 00106 /* ************************** registration - keymaps **********************************/ 00107 00108 static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap) 00109 { 00110 wmKeyMapItem *kmi; 00111 00112 /* action_select.c - selection tools */ 00113 /* click-select */ 00114 kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0); 00115 RNA_boolean_set(kmi->ptr, "extend", FALSE); 00116 RNA_boolean_set(kmi->ptr, "column", FALSE); 00117 kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0); 00118 RNA_boolean_set(kmi->ptr, "extend", FALSE); 00119 RNA_boolean_set(kmi->ptr, "column", TRUE); 00120 kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); 00121 RNA_boolean_set(kmi->ptr, "extend", TRUE); 00122 RNA_boolean_set(kmi->ptr, "column", FALSE); 00123 kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0); 00124 RNA_boolean_set(kmi->ptr, "extend", TRUE); 00125 RNA_boolean_set(kmi->ptr, "column", TRUE); 00126 00127 /* select left/right */ 00128 kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); 00129 RNA_boolean_set(kmi->ptr, "extend", FALSE); 00130 RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST); 00131 kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0); 00132 RNA_boolean_set(kmi->ptr, "extend", TRUE); 00133 RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST); 00134 00135 kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0); 00136 RNA_boolean_set(kmi->ptr, "extend", FALSE); 00137 RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_LEFT); 00138 kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0); 00139 RNA_boolean_set(kmi->ptr, "extend", FALSE); 00140 RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_RIGHT); 00141 00142 /* deselect all */ 00143 kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); 00144 RNA_boolean_set(kmi->ptr, "invert", FALSE); 00145 kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0); 00146 RNA_boolean_set(kmi->ptr, "invert", TRUE); 00147 00148 /* borderselect */ 00149 kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_border", BKEY, KM_PRESS, 0, 0); 00150 RNA_boolean_set(kmi->ptr, "axis_range", FALSE); 00151 kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_border", BKEY, KM_PRESS, KM_ALT, 0); 00152 RNA_boolean_set(kmi->ptr, "axis_range", TRUE); 00153 00154 /* column select */ 00155 RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, 0, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_KEYS); 00156 RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_CFRA); 00157 RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_MARKERS_COLUMN); 00158 RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_MARKERS_BETWEEN); 00159 00160 /* select more/less */ 00161 WM_keymap_add_item(keymap, "ACTION_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); 00162 WM_keymap_add_item(keymap, "ACTION_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); 00163 00164 /* select linekd */ 00165 WM_keymap_add_item(keymap, "ACTION_OT_select_linked", LKEY, KM_PRESS, 0, 0); 00166 00167 00168 /* action_edit.c */ 00169 /* snap - current frame to selected keys */ 00170 // TODO: maybe since this is called jump, we're better to have it on <something>-J? 00171 WM_keymap_add_item(keymap, "ACTION_OT_frame_jump", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); 00172 00173 /* menu + single-step transform */ 00174 WM_keymap_add_item(keymap, "ACTION_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0); 00175 WM_keymap_add_item(keymap, "ACTION_OT_mirror", MKEY, KM_PRESS, KM_SHIFT, 0); 00176 00177 /* menu + set setting */ 00178 WM_keymap_add_item(keymap, "ACTION_OT_handle_type", VKEY, KM_PRESS, 0, 0); 00179 WM_keymap_add_item(keymap, "ACTION_OT_interpolation_type", TKEY, KM_PRESS, 0, 0); 00180 WM_keymap_add_item(keymap, "ACTION_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0); 00181 WM_keymap_add_item(keymap, "ACTION_OT_keyframe_type", RKEY, KM_PRESS, 0, 0); 00182 00183 /* destructive */ 00184 WM_keymap_add_item(keymap, "ACTION_OT_clean", OKEY, KM_PRESS, 0, 0); 00185 WM_keymap_add_item(keymap, "ACTION_OT_sample", OKEY, KM_PRESS, KM_SHIFT, 0); 00186 00187 WM_keymap_add_item(keymap, "ACTION_OT_delete", XKEY, KM_PRESS, 0, 0); 00188 WM_keymap_add_item(keymap, "ACTION_OT_delete", DELKEY, KM_PRESS, 0, 0); 00189 00190 WM_keymap_add_item(keymap, "ACTION_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); 00191 WM_keymap_add_item(keymap, "ACTION_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0); 00192 00193 /* copy/paste */ 00194 WM_keymap_add_item(keymap, "ACTION_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0); 00195 WM_keymap_add_item(keymap, "ACTION_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0); 00196 00197 /* auto-set range */ 00198 WM_keymap_add_item(keymap, "ACTION_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); 00199 WM_keymap_add_item(keymap, "ACTION_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); 00200 WM_keymap_add_item(keymap, "ACTION_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0); 00201 00202 /* animation module */ 00203 /* channels list 00204 * NOTE: these operators were originally for the channels list, but are added here too for convenience... 00205 */ 00206 WM_keymap_add_item(keymap, "ANIM_OT_channels_editable_toggle", TABKEY, KM_PRESS, 0, 0); 00207 00208 /* transform system */ 00209 transform_keymap_for_space(keyconf, keymap, SPACE_ACTION); 00210 00211 /* special markers hotkeys for anim editors: see note in definition of this function */ 00212 ED_marker_keymap_animedit_conflictfree(keymap); 00213 } 00214 00215 /* --------------- */ 00216 00217 void action_keymap(wmKeyConfig *keyconf) 00218 { 00219 wmKeyMap *keymap; 00220 00221 /* channels */ 00222 /* Channels are not directly handled by the Action Editor module, but are inherited from the Animation module. 00223 * All the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as these 00224 * are all used for the Graph-Editor too. 00225 */ 00226 00227 /* keyframes */ 00228 keymap= WM_keymap_find(keyconf, "Dopesheet", SPACE_ACTION, 0); 00229 action_keymap_keyframes(keyconf, keymap); 00230 } 00231