2011-02-23 10:52:22 +00:00
|
|
|
/*
|
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"
|
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
#include "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2014-01-15 13:00:03 +11:00
|
|
|
#include "BLI_math_base.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
#include "BKE_context.h"
|
2012-12-06 05:48:51 +00:00
|
|
|
#include "BKE_global.h"
|
2011-09-05 19:34:27 +00:00
|
|
|
#include "BKE_main.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
|
|
|
|
2012-12-06 05:48:51 +00:00
|
|
|
static int graphview_cursor_poll(bContext *C)
|
|
|
|
{
|
|
|
|
/* prevent changes during render */
|
|
|
|
if (G.is_rendering)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return ED_operator_graphedit_active(C);
|
|
|
|
}
|
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* Set the new frame number */
|
|
|
|
static void graphview_cursor_apply(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
Main *bmain = CTX_data_main(C);
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
SpaceIpo *sipo = CTX_wm_space_graph(C);
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* adjust the frame
|
|
|
|
* NOTE: sync this part of the code with ANIM_OT_change_frame
|
|
|
|
*/
|
2012-05-08 20:18:33 +00:00
|
|
|
CFRA = RNA_int_get(op->ptr, "frame");
|
2015-05-20 20:01:33 +10:00
|
|
|
FRAMENUMBER_MIN_CLAMP(CFRA);
|
2012-05-08 20:18:33 +00:00
|
|
|
SUBFRA = 0.f;
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_sound_seek_scene(bmain, scene);
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* set the cursor value */
|
2012-05-08 20:18:33 +00:00
|
|
|
sipo->cursorVal = RNA_float_get(op->ptr, "value");
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* send notifiers - notifiers for frame should force an update for both vars ok... */
|
2012-05-08 20:18:33 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2009-10-20 12:04:56 +00:00
|
|
|
}
|
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 */
|
2013-03-13 09:03:46 +00:00
|
|
|
static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-10-20 12:04:56 +00:00
|
|
|
{
|
2014-05-08 17:43:11 +12:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-08 20:18:33 +00:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
2009-10-20 12:04:56 +00:00
|
|
|
float viewx, viewy;
|
2014-05-08 17:43:11 +12:00
|
|
|
int frame;
|
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* abort if not active region (should not really be possible) */
|
|
|
|
if (ar == NULL)
|
|
|
|
return;
|
2014-05-08 17:43:11 +12: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
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* frame is rounded to the nearest int, since frames are ints */
|
2014-05-08 17:43:11 +12:00
|
|
|
frame = iroundf(viewx);
|
|
|
|
|
|
|
|
if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) {
|
|
|
|
CLAMP(frame, PSFRA, PEFRA);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* store the values in the operator properties */
|
|
|
|
RNA_int_set(op->ptr, "frame", frame);
|
2009-10-20 12:04:56 +00:00
|
|
|
RNA_float_set(op->ptr, "value", viewy);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Modal Operator init */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int graphview_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-10-20 12:04:56 +00:00
|
|
|
{
|
2015-07-29 12:52:03 +02:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2009-10-20 12:04:56 +00:00
|
|
|
/* 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);
|
|
|
|
|
2015-07-29 12:52:03 +02:00
|
|
|
if (win->screen)
|
|
|
|
win->screen->scrubbing = true;
|
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* add temp handler */
|
|
|
|
WM_event_add_modal_handler(C, op);
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Modal event handling of cursor changing */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int graphview_cursor_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-10-20 12:04:56 +00:00
|
|
|
{
|
2015-07-29 12:52:03 +02:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2009-10-20 12:04:56 +00:00
|
|
|
/* execute the events */
|
|
|
|
switch (event->type) {
|
|
|
|
case ESCKEY:
|
2015-07-29 12:52:03 +02:00
|
|
|
if (win->screen)
|
|
|
|
win->screen->scrubbing = false;
|
2009-10-20 12:04:56 +00:00
|
|
|
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:
|
2014-09-07 14:45:05 +02:00
|
|
|
case MIDDLEMOUSE:
|
2009-10-20 12:04:56 +00:00
|
|
|
/* 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
|
|
|
|
*/
|
2015-07-29 12:52:03 +02:00
|
|
|
if (event->val == KM_RELEASE) {
|
|
|
|
if (win->screen)
|
|
|
|
win->screen->scrubbing = false;
|
2009-10-20 12:04:56 +00:00
|
|
|
return OPERATOR_FINISHED;
|
2015-07-29 12:52:03 +02:00
|
|
|
}
|
2009-10-20 12:04:56 +00:00
|
|
|
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 */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Set Cursor";
|
|
|
|
ot->idname = "GRAPH_OT_cursor_set";
|
|
|
|
ot->description = "Interactively set the current frame number and value cursor";
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = graphview_cursor_exec;
|
|
|
|
ot->invoke = graphview_cursor_invoke;
|
|
|
|
ot->modal = graphview_cursor_modal;
|
2012-12-06 05:48:51 +00:00
|
|
|
ot->poll = graphview_cursor_poll;
|
2009-10-20 12:04:56 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-05-08 20:18:33 +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);
|
2012-08-07 19:49:38 +00:00
|
|
|
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Value", "", -100.0f, 100.0f);
|
2009-10-20 12:04:56 +00:00
|
|
|
}
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2014-11-19 14:35:00 +01:00
|
|
|
/* Hide/Reveal ------------------------------------------------------------ */
|
2014-11-20 02:24:42 +13:00
|
|
|
|
2014-11-20 03:07:09 +13:00
|
|
|
static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
|
2014-11-20 02:24:42 +13:00
|
|
|
{
|
|
|
|
bAnimContext ac;
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
ListBase all_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
|
|
|
int filter;
|
2014-11-20 03:07:09 +13:00
|
|
|
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
|
2014-11-20 02:24:42 +13:00
|
|
|
|
|
|
|
/* get editor data */
|
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
/* get list of all channels that selection may need to be flushed to
|
|
|
|
* - hierarchy must not affect what we have access to here...
|
|
|
|
*/
|
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
|
|
|
|
ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
/* filter data
|
2014-11-20 03:07:09 +13:00
|
|
|
* - of the remaining visible curves, we want to hide the ones that are
|
|
|
|
* selected/unselected (depending on "unselected" prop)
|
2014-11-20 02:24:42 +13:00
|
|
|
*/
|
2014-11-20 03:07:09 +13:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
|
|
|
|
if (unselected)
|
|
|
|
filter |= ANIMFILTER_UNSEL;
|
|
|
|
else
|
|
|
|
filter |= ANIMFILTER_SEL;
|
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
|
|
|
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
|
|
|
|
/* TODO: find out why this is the case, and fix that */
|
|
|
|
if (ale->type == ANIMTYPE_OBJECT)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* change the hide setting, and unselect it... */
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_CLEAR);
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_CLEAR);
|
|
|
|
|
|
|
|
/* now, also flush selection status up/down as appropriate */
|
2014-11-20 18:11:12 +01:00
|
|
|
ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_CLEAR);
|
2014-11-20 02:24:42 +13:00
|
|
|
}
|
2014-11-20 18:11:12 +01:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* cleanup */
|
|
|
|
ANIM_animdata_freelist(&anim_data);
|
|
|
|
BLI_freelistN(&all_data);
|
|
|
|
|
2014-11-20 18:11:12 +01:00
|
|
|
/* unhide selected */
|
|
|
|
if (unselected) {
|
|
|
|
/* turn off requirement for visible */
|
|
|
|
filter = ANIMFILTER_SEL | ANIMFILTER_NODUPLIS | ANIMFILTER_LIST_CHANNELS;
|
|
|
|
|
|
|
|
/* flushing has been done */
|
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
|
|
|
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
|
|
|
|
/* TODO: find out why this is the case, and fix that */
|
|
|
|
if (ale->type == ANIMTYPE_OBJECT)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* change the hide setting, and unselect it... */
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_ADD);
|
|
|
|
|
|
|
|
/* now, also flush selection status up/down as appropriate */
|
|
|
|
ANIM_flush_setting_anim_channels(&ac, &anim_data, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
|
|
|
|
}
|
|
|
|
ANIM_animdata_freelist(&anim_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* send notifier that things have changed */
|
|
|
|
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void GRAPH_OT_hide(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name = "Hide Curves";
|
|
|
|
ot->idname = "GRAPH_OT_hide";
|
|
|
|
ot->description = "Hide selected curves from Graph Editor view";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec = graphview_curves_hide_exec;
|
|
|
|
ot->poll = ED_operator_graphedit_active;
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2014-11-20 03:07:09 +13:00
|
|
|
|
|
|
|
/* props */
|
|
|
|
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected curves");
|
2014-11-20 02:24:42 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ........ */
|
|
|
|
|
2014-11-19 14:35:00 +01:00
|
|
|
static int graphview_curves_reveal_exec(bContext *C, wmOperator *UNUSED(op))
|
2014-11-20 02:24:42 +13:00
|
|
|
{
|
|
|
|
bAnimContext ac;
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
ListBase all_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
|
|
|
int filter;
|
|
|
|
|
|
|
|
/* get editor data */
|
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
/* get list of all channels that selection may need to be flushed to
|
|
|
|
* - hierarchy must not affect what we have access to here...
|
|
|
|
*/
|
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
|
|
|
|
ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
/* filter data
|
|
|
|
* - just go through all visible channels, ensuring that everything is set to be curve-visible
|
|
|
|
*/
|
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
|
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
|
|
|
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
|
|
|
|
/* TODO: find out why this is the case, and fix that */
|
|
|
|
if (ale->type == ANIMTYPE_OBJECT)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* select if it is not visible */
|
|
|
|
if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE) == 0)
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_ADD);
|
|
|
|
|
|
|
|
/* change the visibility setting */
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
|
|
|
|
|
|
|
|
/* now, also flush selection status up/down as appropriate */
|
|
|
|
ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
ANIM_animdata_freelist(&anim_data);
|
|
|
|
BLI_freelistN(&all_data);
|
|
|
|
|
|
|
|
/* send notifier that things have changed */
|
|
|
|
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2014-11-19 14:35:00 +01:00
|
|
|
static void GRAPH_OT_reveal(wmOperatorType *ot)
|
2014-11-20 02:24:42 +13:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2014-11-19 14:35:00 +01:00
|
|
|
ot->name = "Reveal Curves";
|
|
|
|
ot->idname = "GRAPH_OT_reveal";
|
2014-11-20 02:24:42 +13:00
|
|
|
ot->description = "Make previously hidden curves visible again in Graph Editor view";
|
|
|
|
|
|
|
|
/* api callbacks */
|
2014-11-19 14:35:00 +01:00
|
|
|
ot->exec = graphview_curves_reveal_exec;
|
2014-11-20 02:24:42 +13:00
|
|
|
ot->poll = ED_operator_graphedit_active;
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
|
|
|
}
|
|
|
|
|
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-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);
|
2015-04-13 14:30:17 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_view_frame);
|
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
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
WM_operatortype_append(GRAPH_OT_hide);
|
2014-11-19 14:35:00 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_reveal);
|
2014-11-20 02:24:42 +13:00
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* keyframes */
|
2012-05-08 20:18:33 +00:00
|
|
|
/* 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);
|
2014-03-09 16:20:04 +11:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_lasso);
|
2014-12-09 16:53:50 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_circle);
|
2009-06-22 04:23:06 +00:00
|
|
|
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
|
|
|
|
2012-05-08 20:18:33 +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);
|
2014-03-22 02:50:24 +13:00
|
|
|
WM_operatortype_append(GRAPH_OT_easing_type);
|
2009-06-22 04:23:06 +00:00
|
|
|
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;
|
|
|
|
|
2012-05-05 19:26:53 +00:00
|
|
|
ot = WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate",
|
|
|
|
"Make a copy of all selected keyframes and move them",
|
2012-05-08 20:18:33 +00:00
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
2013-10-26 08:01:33 +00:00
|
|
|
WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
|
|
|
|
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
|
|
|
|
RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
|
2015-04-09 12:48:49 +02:00
|
|
|
RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
|
2011-03-04 16:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* ************************** registration - keymaps **********************************/
|
|
|
|
|
2012-05-08 20:18:33 +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 */
|
2012-01-14 16:26:08 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.show_handles");
|
|
|
|
|
2012-05-08 20:18:33 +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
|
|
|
|
*/
|
2009-10-20 12:04:56 +00:00
|
|
|
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 */
|
2013-10-22 09:59:54 +00:00
|
|
|
/* click-select: keyframe (replace) */
|
2012-01-14 22:59:51 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "curves", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "column", false);
|
2013-10-22 09:59:54 +00:00
|
|
|
/* click-select: all keyframes on same frame (replace) */
|
2012-03-24 02:51:46 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "curves", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "column", true);
|
2013-10-22 09:59:54 +00:00
|
|
|
/* click-select: keyframe (add) */
|
2012-03-24 02:51:46 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", true);
|
|
|
|
RNA_boolean_set(kmi->ptr, "curves", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "column", false);
|
2013-10-22 09:59:54 +00:00
|
|
|
/* click-select: all keyframes on same frame (add) */
|
2012-05-08 20:18:33 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT | KM_SHIFT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", true);
|
|
|
|
RNA_boolean_set(kmi->ptr, "curves", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "column", true);
|
2013-10-22 09:59:54 +00:00
|
|
|
/* click-select: all keyframes in same curve (replace) */
|
2012-05-08 20:18:33 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "curves", true);
|
|
|
|
RNA_boolean_set(kmi->ptr, "column", false);
|
2013-10-22 09:59:54 +00:00
|
|
|
/* click-select: all keyframes in same curve (add) */
|
2012-05-08 20:18:33 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT | KM_SHIFT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", true);
|
|
|
|
RNA_boolean_set(kmi->ptr, "curves", true);
|
|
|
|
RNA_boolean_set(kmi->ptr, "column", false);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2013-10-22 09:59:54 +00:00
|
|
|
/* click-select left/right */
|
2012-01-15 13:51:32 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", false);
|
2012-05-08 20:18:33 +00:00
|
|
|
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
|
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", true);
|
2012-05-08 20:18:33 +00:00
|
|
|
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
|
2011-02-14 02:50:52 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", false);
|
2012-05-08 20:18:33 +00:00
|
|
|
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
|
2012-03-24 02:51:46 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", false);
|
2012-05-08 20:18:33 +00:00
|
|
|
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
|
2011-02-14 02:50:52 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* deselect all */
|
2012-01-14 22:59:51 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "invert", false);
|
2012-01-14 22:59:51 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "invert", true);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* borderselect */
|
2012-01-14 22:59:51 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, 0, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "axis_range", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "include_handles", false);
|
2010-04-05 03:37:28 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_ALT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "axis_range", true);
|
|
|
|
RNA_boolean_set(kmi->ptr, "include_handles", false);
|
2010-04-05 03:37:28 +00:00
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_CTRL, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "axis_range", false);
|
|
|
|
RNA_boolean_set(kmi->ptr, "include_handles", true);
|
2012-05-08 20:18:33 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "axis_range", true);
|
|
|
|
RNA_boolean_set(kmi->ptr, "include_handles", true);
|
2014-03-09 16:20:04 +11:00
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "deselect", false);
|
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "deselect", true);
|
|
|
|
|
2014-12-09 16:53:50 +01:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_select_circle", CKEY, KM_PRESS, 0, 0);
|
|
|
|
|
2012-05-08 20:18:33 +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
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* select more/less */
|
2010-02-07 11:50:03 +00:00
|
|
|
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);
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* select linked */
|
2010-04-05 11:47:55 +00:00
|
|
|
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 */
|
2012-10-15 03:52:27 +00:00
|
|
|
/* jump to selected keyframes */
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_frame_jump", GKEY, KM_PRESS, KM_CTRL, 0);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2012-05-08 20:18:33 +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);
|
2014-03-22 02:50:24 +13:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_easing_type", EKEY, KM_PRESS, KM_CTRL, 0);
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* destructive */
|
2009-06-22 04:23:06 +00:00
|
|
|
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
|
|
|
|
2015-04-10 11:52:54 +02:00
|
|
|
WM_keymap_add_menu(keymap, "GRAPH_MT_delete", XKEY, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_menu(keymap, "GRAPH_MT_delete", DELKEY, KM_PRESS, 0, 0);
|
|
|
|
|
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
|
|
|
|
2012-05-08 20:18:33 +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);
|
2015-04-07 14:08:30 +02:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
|
2009-02-24 11:18:24 +00:00
|
|
|
|
2012-05-08 20:18:33 +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);
|
2015-01-07 22:25:33 +01:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_paste", VKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "flipped", true);
|
2013-05-11 01:12:29 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
|
2013-05-10 13:47:28 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
|
2015-01-07 22:25:33 +01:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_paste", VKEY, KM_PRESS, KM_OSKEY | KM_SHIFT, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "flipped", true);
|
2013-05-11 01:12:29 +00:00
|
|
|
#endif
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* auto-set range */
|
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
|
2014-02-18 11:55:53 +11:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_view_all", NDOF_BUTTON_FIT, 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);
|
2015-04-13 14:30:17 +02:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_view_frame", PAD0, KM_PRESS, 0, 0);
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* F-Modifiers */
|
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "only_active", false);
|
2009-03-15 10:39:02 +00:00
|
|
|
|
2009-12-27 01:36:32 +00:00
|
|
|
/* animation module */
|
2012-05-08 20:18:33 +00:00
|
|
|
/* channels list
|
|
|
|
* NOTE: these operators were originally for the channels list, but are added here too for convenience...
|
|
|
|
*/
|
2009-12-27 01:36:32 +00:00
|
|
|
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
|
|
|
|
2015-04-09 18:29:58 +02:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0);
|
2015-04-10 13:41:57 +10:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_fcurve");
|
2015-03-27 15:23:39 +01:00
|
|
|
|
2014-11-21 01:43:56 +13:00
|
|
|
/* pivot point settings */
|
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
|
|
|
RNA_string_set(kmi->ptr, "value", "BOUNDING_BOX_CENTER");
|
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
|
|
|
RNA_string_set(kmi->ptr, "value", "CURSOR");
|
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
|
|
|
RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_ORIGINS");
|
2014-12-09 16:53:50 +01:00
|
|
|
|
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;
|
2014-11-20 03:07:09 +13:00
|
|
|
wmKeyMapItem *kmi;
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2009-02-20 19:11:35 +00:00
|
|
|
/* keymap for all regions */
|
2012-03-24 02:51:46 +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);
|
2014-06-24 17:52:40 +12:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* extrapolation works on channels, not keys */
|
2010-12-10 18:48:20 +00:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
|
2014-06-24 17:52:40 +12:00
|
|
|
|
|
|
|
/* find (i.e. a shortcut for setting the name filter) */
|
|
|
|
WM_keymap_add_item(keymap, "ANIM_OT_channels_find", FKEY, KM_PRESS, KM_CTRL, 0);
|
2014-11-20 02:24:42 +13:00
|
|
|
|
2014-11-19 14:35:00 +01:00
|
|
|
/* hide/reveal selected curves */
|
2014-11-20 03:07:09 +13:00
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_hide", HKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "unselected", false);
|
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "unselected", true);
|
|
|
|
|
2014-11-20 02:46:45 +13:00
|
|
|
WM_keymap_add_item(keymap, "GRAPH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
|
2014-11-20 02:24:42 +13: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 */
|
2012-03-24 02:51:46 +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
|
|
|
}
|
|
|
|
|