2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2010-03-21 01:14:04 +00:00
|
|
|
* $Id$
|
2009-01-26 23:18:27 +00:00
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-01-26 23:18:27 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_graph/graph_ops.c
|
|
|
|
* \ingroup spgraph
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "DNA_scene_types.h"
|
2010-12-09 18:31:40 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
#include "BKE_context.h"
|
2009-10-20 12:04:56 +00:00
|
|
|
#include "BKE_sound.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
2011-04-03 10:04:16 +00:00
|
|
|
#include "ED_anim_api.h"
|
2011-06-01 06:26:54 +00:00
|
|
|
#include "ED_markers.h"
|
2009-01-28 06:32:47 +00:00
|
|
|
#include "ED_screen.h"
|
2009-07-08 16:17:47 +00:00
|
|
|
#include "ED_transform.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2009-02-03 12:04:05 +00:00
|
|
|
#include "graph_intern.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* ************************** view-based operators **********************************/
|
|
|
|
// XXX should these really be here?
|
|
|
|
|
|
|
|
/* Set Cursor --------------------------------------------------------------------- */
|
|
|
|
/* The 'cursor' in the Graph Editor consists of two parts:
|
|
|
|
* 1) Current Frame Indicator (as per ANIM_OT_change_frame)
|
|
|
|
* 2) Value Indicator (stored per Graph Editor instance)
|
|
|
|
*/
|
2009-06-22 04:23:06 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* Set the new frame number */
|
|
|
|
static void graphview_cursor_apply(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
Scene *scene= CTX_data_scene(C);
|
|
|
|
SpaceIpo *sipo= CTX_wm_space_graph(C);
|
|
|
|
|
|
|
|
/* adjust the frame
|
|
|
|
* NOTE: sync this part of the code with ANIM_OT_change_frame
|
|
|
|
*/
|
|
|
|
CFRA= RNA_int_get(op->ptr, "frame");
|
2010-06-27 05:39:55 +00:00
|
|
|
SUBFRA=0.f;
|
2010-02-07 23:41:17 +00:00
|
|
|
sound_seek_scene(C);
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* set the cursor value */
|
|
|
|
sipo->cursorVal= RNA_float_get(op->ptr, "value");
|
|
|
|
|
|
|
|
/* send notifiers - notifiers for frame should force an update for both vars ok... */
|
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
|
|
|
}
|
2009-06-22 04:23:06 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* ... */
|
2009-06-22 04:23:06 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* Non-modal callback for running operator without user input */
|
|
|
|
static int graphview_cursor_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
graphview_cursor_apply(C, op);
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ... */
|
|
|
|
|
|
|
|
/* set the operator properties from the initial event */
|
|
|
|
static void graphview_cursor_setprops(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
ARegion *ar= CTX_wm_region(C);
|
|
|
|
float viewx, viewy;
|
2011-05-20 07:40:05 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* abort if not active region (should not really be possible) */
|
|
|
|
if (ar == NULL)
|
|
|
|
return;
|
2011-05-20 07:40:05 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* convert from region coordinates to View2D 'tot' space */
|
2011-05-20 07:40:05 +00:00
|
|
|
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* store the values in the operator properties */
|
|
|
|
/* frame is rounded to the nearest int, since frames are ints */
|
|
|
|
RNA_int_set(op->ptr, "frame", (int)floor(viewx+0.5f));
|
|
|
|
RNA_float_set(op->ptr, "value", viewy);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Modal Operator init */
|
|
|
|
static int graphview_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
/* Change to frame that mouse is over before adding modal handler,
|
|
|
|
* as user could click on a single frame (jump to frame) as well as
|
|
|
|
* click-dragging over a range (modal scrubbing).
|
|
|
|
*/
|
|
|
|
graphview_cursor_setprops(C, op, event);
|
|
|
|
|
|
|
|
/* apply these changes first */
|
|
|
|
graphview_cursor_apply(C, op);
|
|
|
|
|
|
|
|
/* add temp handler */
|
|
|
|
WM_event_add_modal_handler(C, op);
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Modal event handling of cursor changing */
|
|
|
|
static int graphview_cursor_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
/* execute the events */
|
|
|
|
switch (event->type) {
|
|
|
|
case ESCKEY:
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
|
|
|
case MOUSEMOVE:
|
|
|
|
/* set the new values */
|
|
|
|
graphview_cursor_setprops(C, op, event);
|
|
|
|
graphview_cursor_apply(C, op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LEFTMOUSE:
|
|
|
|
case RIGHTMOUSE:
|
|
|
|
/* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init
|
|
|
|
* the modal op) doesn't work for some reason
|
|
|
|
*/
|
|
|
|
if (event->val==KM_RELEASE)
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void GRAPH_OT_cursor_set(wmOperatorType *ot)
|
2009-10-20 12:04:56 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Set Cursor";
|
|
|
|
ot->idname= "GRAPH_OT_cursor_set";
|
|
|
|
ot->description= "Interactively set the current frame number and value cursor";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= graphview_cursor_exec;
|
|
|
|
ot->invoke= graphview_cursor_invoke;
|
|
|
|
ot->modal= graphview_cursor_modal;
|
2011-02-01 23:51:52 +00:00
|
|
|
ot->poll= ED_operator_graphedit_active;
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* flags */
|
2010-07-20 11:54:17 +00:00
|
|
|
ot->flag= OPTYPE_BLOCKING|OPTYPE_UNDO;
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* rna */
|
|
|
|
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
|
|
|
|
RNA_def_float(ot->srna, "value", 0, FLT_MIN, FLT_MAX, "Value", "", -100.0f, 100.0f);
|
|
|
|
}
|
2009-01-28 06:32:47 +00:00
|
|
|
|
|
|
|
/* Toggle Handles ----------------------------------------------------------------- */
|
|
|
|
|
2010-10-15 01:36:14 +00:00
|
|
|
static int view_toggle_handles_exec (bContext *C, wmOperator *UNUSED(op))
|
2009-01-28 06:32:47 +00:00
|
|
|
{
|
2009-07-28 16:33:02 +00:00
|
|
|
SpaceIpo *sipo= CTX_wm_space_graph(C);
|
2009-01-28 06:32:47 +00:00
|
|
|
ARegion *ar= CTX_wm_region(C);
|
|
|
|
|
|
|
|
if (sipo == NULL)
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
/* toggle flag to hide handles */
|
|
|
|
sipo->flag ^= SIPO_NOHANDLES;
|
|
|
|
|
|
|
|
/* request refresh of keys area */
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void GRAPH_OT_view_togglehandles (wmOperatorType *ot)
|
2009-01-28 06:32:47 +00:00
|
|
|
{
|
|
|
|
/* identification */
|
|
|
|
ot->name= "Show/Hide All Handles";
|
2009-06-22 04:23:06 +00:00
|
|
|
ot->idname= "GRAPH_OT_handles_view_toggle";
|
2011-01-20 22:22:16 +00:00
|
|
|
ot->description= "Toggle whether handles are drawn on all keyframes that need them";
|
2009-01-28 06:32:47 +00:00
|
|
|
|
|
|
|
/* callbacks */
|
|
|
|
ot->exec= view_toggle_handles_exec;
|
2011-02-01 23:51:52 +00:00
|
|
|
ot->poll= ED_operator_graphedit_active;
|
2009-01-28 06:32:47 +00:00
|
|
|
}
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
/* ************************** registration - operator types **********************************/
|
|
|
|
|
|
|
|
void graphedit_operatortypes(void)
|
|
|
|
{
|
2009-01-28 06:32:47 +00:00
|
|
|
/* view */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_view_togglehandles);
|
2009-10-20 12:04:56 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_cursor_set);
|
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_previewrange_set);
|
|
|
|
WM_operatortype_append(GRAPH_OT_view_all);
|
2011-03-17 10:02:37 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_view_selected);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_properties);
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_ghost_curves_create);
|
|
|
|
WM_operatortype_append(GRAPH_OT_ghost_curves_clear);
|
2009-04-08 01:07:46 +00:00
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* keyframes */
|
|
|
|
/* selection */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_clickselect);
|
|
|
|
WM_operatortype_append(GRAPH_OT_select_all_toggle);
|
|
|
|
WM_operatortype_append(GRAPH_OT_select_border);
|
|
|
|
WM_operatortype_append(GRAPH_OT_select_column);
|
2010-04-05 11:47:55 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_linked);
|
2010-02-07 11:50:03 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_more);
|
|
|
|
WM_operatortype_append(GRAPH_OT_select_less);
|
2011-02-14 02:50:52 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_leftright);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
/* editing */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_snap);
|
|
|
|
WM_operatortype_append(GRAPH_OT_mirror);
|
|
|
|
WM_operatortype_append(GRAPH_OT_frame_jump);
|
2010-12-14 10:52:38 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_handle_type);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_interpolation_type);
|
|
|
|
WM_operatortype_append(GRAPH_OT_extrapolation_type);
|
|
|
|
WM_operatortype_append(GRAPH_OT_sample);
|
|
|
|
WM_operatortype_append(GRAPH_OT_bake);
|
2010-01-01 05:09:30 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_sound_bake);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_smooth);
|
|
|
|
WM_operatortype_append(GRAPH_OT_clean);
|
2011-03-25 03:58:21 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_euler_filter);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_delete);
|
|
|
|
WM_operatortype_append(GRAPH_OT_duplicate);
|
|
|
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_copy);
|
|
|
|
WM_operatortype_append(GRAPH_OT_paste);
|
|
|
|
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_keyframe_insert);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_click_insert);
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
/* F-Curve Modifiers */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_fmodifier_add);
|
2010-03-18 13:04:46 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_fmodifier_copy);
|
|
|
|
WM_operatortype_append(GRAPH_OT_fmodifier_paste);
|
2009-01-26 23:18:27 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 16:02:42 +00:00
|
|
|
void ED_operatormacros_graph(void)
|
|
|
|
{
|
|
|
|
wmOperatorType *ot;
|
|
|
|
wmOperatorTypeMacro *otmacro;
|
|
|
|
|
|
|
|
ot= WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
|
2011-03-18 23:14:24 +00:00
|
|
|
if (ot) {
|
|
|
|
WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
|
|
|
|
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
|
2011-03-22 12:53:36 +00:00
|
|
|
RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
|
2011-03-18 23:14:24 +00:00
|
|
|
}
|
2011-03-04 16:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* ************************** registration - keymaps **********************************/
|
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
|
2009-01-26 23:18:27 +00:00
|
|
|
{
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyMapItem *kmi;
|
2009-04-12 08:17:46 +00:00
|
|
|
|
2009-01-28 06:32:47 +00:00
|
|
|
/* view */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_handles_view_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
|
2009-10-20 12:04:56 +00:00
|
|
|
/* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons
|
|
|
|
* This keymap is supposed to override ANIM_OT_change_frame, which does the same except it doesn't do y-values
|
|
|
|
*/
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_cursor_set", ACTIONMOUSE, KM_PRESS, 0, 0);
|
|
|
|
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2009-02-20 11:17:33 +00:00
|
|
|
/* graph_select.c - selection tools */
|
2009-01-26 23:18:27 +00:00
|
|
|
/* click-select */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
|
|
|
|
kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
|
2009-04-12 08:17:46 +00:00
|
|
|
RNA_boolean_set(kmi->ptr, "column", 1);
|
2009-06-22 04:23:06 +00:00
|
|
|
kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
|
2009-04-12 08:17:46 +00:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", 1);
|
2009-06-22 04:23:06 +00:00
|
|
|
kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
|
2009-04-12 08:17:46 +00:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", 1);
|
|
|
|
RNA_boolean_set(kmi->ptr, "column", 1);
|
2009-06-22 04:23:06 +00:00
|
|
|
kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
2009-04-12 08:21:22 +00:00
|
|
|
RNA_boolean_set(kmi->ptr, "curves", 1);
|
2009-06-22 04:23:06 +00:00
|
|
|
kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT|KM_SHIFT, 0);
|
2009-04-12 13:19:21 +00:00
|
|
|
RNA_boolean_set(kmi->ptr, "curves", 1);
|
|
|
|
RNA_boolean_set(kmi->ptr, "extend", 1);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2011-02-14 02:50:52 +00:00
|
|
|
/* select left/right */
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
|
|
|
|
kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "extend", 1);
|
|
|
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
|
|
|
|
kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
|
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* deselect all */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "invert", 1);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
/* borderselect */
|
2011-01-13 04:53:55 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, 0, 0);
|
2010-04-05 03:37:28 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "axis_range", 1);
|
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "include_handles", 1);
|
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "axis_range", 1);
|
|
|
|
RNA_boolean_set(kmi->ptr, "include_handles", 1);
|
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* column select */
|
2009-06-22 04:23:06 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_column", KKEY, KM_PRESS, 0, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_KEYS);
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_column", KKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_CFRA);
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_column", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN);
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_column", KKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN);
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2010-02-07 11:50:03 +00:00
|
|
|
/* select more/less */
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
|
|
|
|
|
2010-04-05 11:47:55 +00:00
|
|
|
/* select linked */
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_select_linked", LKEY, KM_PRESS, 0, 0);
|
|
|
|
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2009-02-20 11:17:33 +00:00
|
|
|
/* graph_edit.c */
|
2009-01-26 23:18:27 +00:00
|
|
|
/* snap - current frame to selected keys */
|
2009-06-22 04:23:06 +00:00
|
|
|
// TODO: maybe since this is called jump, we're better to have it on <something>-J?
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_frame_jump", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
/* menu + single-step transform */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_mirror", MKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2010-12-14 10:52:38 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_handle_type", VKEY, KM_PRESS, 0, 0);
|
2010-12-14 10:17:13 +00:00
|
|
|
|
2011-05-25 13:10:07 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_interpolation_type", TKEY, KM_PRESS, 0, 0);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
/* destructive */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_clean", OKEY, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_smooth", OKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_sample", OKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-03-01 11:27:31 +00:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_bake", CKEY, KM_PRESS, KM_ALT, 0);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_delete", XKEY, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_delete", DELKEY, KM_PRESS, 0, 0);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2011-03-04 16:02:42 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-02-20 11:17:33 +00:00
|
|
|
|
2009-02-24 11:18:24 +00:00
|
|
|
/* insertkey */
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0);
|
2010-11-17 12:16:34 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
|
2009-02-24 11:18:24 +00:00
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* copy/paste */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
/* auto-set range */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
|
2011-03-17 10:02:37 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2009-07-02 06:41:10 +00:00
|
|
|
/* F-Modifiers */
|
2009-09-25 12:20:31 +00:00
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPH_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "only_active", 0);
|
2009-03-15 10:39:02 +00:00
|
|
|
|
2009-12-27 01:36:32 +00:00
|
|
|
/* animation module */
|
|
|
|
/* channels list
|
|
|
|
* NOTE: these operators were originally for the channels list, but are added here too for convenience...
|
|
|
|
*/
|
|
|
|
WM_keymap_add_item(keymap, "ANIM_OT_channels_editable_toggle", TABKEY, KM_PRESS, 0, 0);
|
2009-03-15 10:39:02 +00:00
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* transform system */
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
transform_keymap_for_space(keyconf, keymap, SPACE_IPO);
|
2011-06-01 06:26:54 +00:00
|
|
|
|
|
|
|
/* special markers hotkeys for anim editors: see note in definition of this function */
|
|
|
|
ED_marker_keymap_animedit_conflictfree(keymap);
|
2009-01-26 23:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------- */
|
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void graphedit_keymap(wmKeyConfig *keyconf)
|
2009-01-26 23:18:27 +00:00
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2009-02-20 19:11:35 +00:00
|
|
|
/* keymap for all regions */
|
2009-12-24 09:26:06 +00:00
|
|
|
keymap= WM_keymap_find(keyconf, "Graph Editor Generic", SPACE_IPO, 0);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_properties", NKEY, KM_PRESS, 0, 0);
|
2010-12-10 18:48:20 +00:00
|
|
|
/* extrapolation works on channels, not keys */
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-02-20 19:11:35 +00:00
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* channels */
|
|
|
|
/* Channels are not directly handled by the Graph Editor module, but are inherited from the Animation module.
|
|
|
|
* All the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as these
|
2009-01-28 06:32:47 +00:00
|
|
|
* are all used for the Graph Editor too.
|
2009-01-26 23:18:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* keyframes */
|
2009-12-24 09:26:06 +00:00
|
|
|
keymap= WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0);
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
graphedit_keymap_keyframes(keyconf, keymap);
|
2009-01-26 23:18:27 +00:00
|
|
|
}
|
|
|
|
|