2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-21 08:02:24 +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.
|
2008-12-21 08:02:24 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation, Joshua Leung
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/animation/anim_ops.c
|
|
|
|
* \ingroup edanimation
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2010-08-31 11:31:21 +00:00
|
|
|
#include "BLO_sys_types.h"
|
|
|
|
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2009-10-03 04:21:38 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2008-12-21 08:02:24 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
2011-04-07 15:48:33 +00:00
|
|
|
#include "BKE_global.h"
|
2011-09-05 19:34:27 +00:00
|
|
|
#include "BKE_main.h"
|
2009-10-03 04:21:38 +00:00
|
|
|
#include "BKE_sound.h"
|
2008-12-21 08:02:24 +00:00
|
|
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
#include "ED_anim_api.h"
|
2008-12-21 08:02:24 +00:00
|
|
|
#include "ED_screen.h"
|
|
|
|
|
2009-10-03 04:21:38 +00:00
|
|
|
#include "anim_intern.h"
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
/* ********************** frame change operator ***************************/
|
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* Check if the operator can be run from the current context */
|
|
|
|
static int change_frame_poll(bContext *C)
|
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
ScrArea *curarea = CTX_wm_area(C);
|
2009-10-20 12:04:56 +00:00
|
|
|
|
2011-04-07 15:48:33 +00:00
|
|
|
/* XXX temp? prevent changes during render */
|
2012-08-08 18:37:06 +00:00
|
|
|
if (G.is_rendering) return 0;
|
2011-04-07 15:48:33 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* as long as there is an active area, and it isn't a Graph Editor
|
|
|
|
* (since the Graph Editor has its own version which does extra stuff),
|
|
|
|
* we're fine
|
|
|
|
*/
|
|
|
|
return ((curarea) && (curarea->spacetype != SPACE_IPO));
|
|
|
|
}
|
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
/* Set the new frame number */
|
|
|
|
static void change_frame_apply(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
Main *bmain = CTX_data_main(C);
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2008-12-21 08:02:24 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* set the new frame number */
|
2012-05-08 15:30:00 +00:00
|
|
|
CFRA = RNA_int_get(op->ptr, "frame");
|
2010-02-18 00:29:08 +00:00
|
|
|
FRAMENUMBER_MIN_CLAMP(CFRA);
|
2010-06-27 05:39:55 +00:00
|
|
|
SUBFRA = 0.f;
|
2008-12-21 08:02:24 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* do updates */
|
2011-09-05 19:34:27 +00:00
|
|
|
sound_seek_scene(bmain, scene);
|
2012-05-08 15:30:00 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2008-12-21 08:02:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ---- */
|
|
|
|
|
|
|
|
/* Non-modal callback for running operator without user input */
|
|
|
|
static int change_frame_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
change_frame_apply(C, op);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---- */
|
|
|
|
|
|
|
|
/* Get frame from mouse coordinates */
|
|
|
|
static int frame_from_event(bContext *C, wmEvent *event)
|
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
2008-12-21 08:02:24 +00:00
|
|
|
float viewx;
|
2011-05-20 07:40:05 +00:00
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
/* convert from region coordinates to View2D 'tot' space */
|
2011-05-20 07:40:05 +00:00
|
|
|
UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &viewx, NULL);
|
2008-12-21 08:02:24 +00:00
|
|
|
|
|
|
|
/* round result to nearest int (frames are ints!) */
|
2012-05-08 15:30:00 +00:00
|
|
|
return (int)floor(viewx + 0.5f);
|
2008-12-21 08:02:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Modal Operator init */
|
|
|
|
static int change_frame_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).
|
|
|
|
*/
|
|
|
|
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
|
|
|
|
|
|
|
|
change_frame_apply(C, op);
|
|
|
|
|
|
|
|
/* add temp handler */
|
2009-09-18 12:43:36 +00:00
|
|
|
WM_event_add_modal_handler(C, op);
|
2008-12-21 08:02:24 +00:00
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Modal event handling of frame changing */
|
|
|
|
static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
/* execute the events */
|
|
|
|
switch (event->type) {
|
2009-02-09 03:06:52 +00:00
|
|
|
case ESCKEY:
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
case MOUSEMOVE:
|
|
|
|
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
|
|
|
|
change_frame_apply(C, op);
|
|
|
|
break;
|
2009-02-09 03:06:52 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2012-05-08 15:30:00 +00:00
|
|
|
if (event->val == KM_RELEASE)
|
2008-12-21 08:02:24 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
static void ANIM_OT_change_frame(wmOperatorType *ot)
|
2008-12-21 08:02:24 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Change frame";
|
|
|
|
ot->idname = "ANIM_OT_change_frame";
|
|
|
|
ot->description = "Interactively change the current frame number";
|
2008-12-21 08:02:24 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = change_frame_exec;
|
|
|
|
ot->invoke = change_frame_invoke;
|
|
|
|
ot->modal = change_frame_modal;
|
|
|
|
ot->poll = change_frame_poll;
|
2009-07-11 14:51:13 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-10-15 22:45:47 +00:00
|
|
|
ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO | OPTYPE_GRAB_POINTER;
|
2008-12-21 08:02:24 +00:00
|
|
|
|
|
|
|
/* rna */
|
2009-07-07 06:56:29 +00:00
|
|
|
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
|
2008-12-21 08:02:24 +00:00
|
|
|
}
|
|
|
|
|
2008-12-21 08:45:13 +00:00
|
|
|
/* ****************** set preview range operator ****************************/
|
|
|
|
|
|
|
|
static int previewrange_define_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
ARegion *ar = CTX_wm_region(C);
|
2008-12-21 08:45:13 +00:00
|
|
|
float sfra, efra;
|
2012-08-08 20:38:55 +00:00
|
|
|
rcti rect;
|
2008-12-21 08:45:13 +00:00
|
|
|
|
2008-12-21 11:56:42 +00:00
|
|
|
/* get min/max values from border select rect (already in region coordinates, not screen) */
|
2012-08-08 20:38:55 +00:00
|
|
|
WM_operator_properties_border_to_rcti(op, &rect);
|
2008-12-21 08:45:13 +00:00
|
|
|
|
2008-12-21 11:56:42 +00:00
|
|
|
/* convert min/max values to frames (i.e. region to 'tot' rect) */
|
2012-08-08 20:38:55 +00:00
|
|
|
UI_view2d_region_to_view(&ar->v2d, rect.xmin, 0, &sfra, NULL);
|
|
|
|
UI_view2d_region_to_view(&ar->v2d, rect.xmax, 0, &efra, NULL);
|
2008-12-21 08:45:13 +00:00
|
|
|
|
|
|
|
/* set start/end frames for preview-range
|
|
|
|
* - must clamp within allowable limits
|
|
|
|
* - end must not be before start (though this won't occur most of the time)
|
|
|
|
*/
|
2011-06-08 10:57:24 +00:00
|
|
|
FRAMENUMBER_MIN_CLAMP(sfra);
|
|
|
|
FRAMENUMBER_MIN_CLAMP(efra);
|
2012-05-08 15:30:00 +00:00
|
|
|
if (efra < sfra) efra = sfra;
|
2008-12-21 08:45:13 +00:00
|
|
|
|
2010-01-19 20:30:04 +00:00
|
|
|
scene->r.flag |= SCER_PRV_RANGE;
|
2012-05-08 15:30:00 +00:00
|
|
|
scene->r.psfra = (int)floor(sfra + 0.5f);
|
|
|
|
scene->r.pefra = (int)floor(efra + 0.5f);
|
2008-12-21 08:45:13 +00:00
|
|
|
|
2009-11-17 10:12:35 +00:00
|
|
|
/* send notifiers */
|
2012-05-08 15:30:00 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2009-11-17 10:12:35 +00:00
|
|
|
|
2008-12-21 08:45:13 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
static void ANIM_OT_previewrange_set(wmOperatorType *ot)
|
2008-12-21 08:45:13 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Set Preview Range";
|
|
|
|
ot->idname = "ANIM_OT_previewrange_set";
|
|
|
|
ot->description = "Interactively define frame range used for playback";
|
2008-12-21 08:45:13 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = WM_border_select_invoke;
|
|
|
|
ot->exec = previewrange_define_exec;
|
|
|
|
ot->modal = WM_border_select_modal;
|
|
|
|
ot->cancel = WM_border_select_cancel;
|
2008-12-21 08:45:13 +00:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_animview_active;
|
2008-12-21 08:45:13 +00:00
|
|
|
|
2009-01-31 19:40:40 +00:00
|
|
|
/* flags */
|
2012-05-08 15:30:00 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
2008-12-21 08:45:13 +00:00
|
|
|
/* rna */
|
2012-08-08 20:38:55 +00:00
|
|
|
/* used to define frame range.
|
|
|
|
*
|
|
|
|
* note: border Y values are not used,
|
|
|
|
* but are needed by borderselect gesture operator stuff */
|
|
|
|
WM_operator_properties_border(ot);
|
2008-12-21 08:45:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ****************** clear preview range operator ****************************/
|
|
|
|
|
2010-10-15 01:36:14 +00:00
|
|
|
static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
2008-12-21 08:45:13 +00:00
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
ScrArea *curarea = CTX_wm_area(C);
|
2008-12-21 08:45:13 +00:00
|
|
|
|
|
|
|
/* sanity checks */
|
|
|
|
if (ELEM(NULL, scene, curarea))
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
/* simply clear values */
|
2010-01-19 20:30:04 +00:00
|
|
|
scene->r.flag &= ~SCER_PRV_RANGE;
|
2012-05-08 15:30:00 +00:00
|
|
|
scene->r.psfra = 0;
|
|
|
|
scene->r.pefra = 0;
|
2008-12-21 08:45:13 +00:00
|
|
|
|
|
|
|
ED_area_tag_redraw(curarea);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
|
2008-12-21 08:45:13 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Clear Preview Range";
|
|
|
|
ot->idname = "ANIM_OT_previewrange_clear";
|
|
|
|
ot->description = "Clear Preview Range";
|
2008-12-21 08:45:13 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = previewrange_clear_exec;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_animview_active;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-05-08 15:30:00 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2008-12-21 08:45:13 +00:00
|
|
|
}
|
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
/* ************************** registration **********************************/
|
|
|
|
|
|
|
|
void ED_operatortypes_anim(void)
|
|
|
|
{
|
2009-09-04 07:26:32 +00:00
|
|
|
/* Animation Editors only -------------------------- */
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_change_frame);
|
2008-12-21 08:45:13 +00:00
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_previewrange_set);
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_previewrange_clear);
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
|
2009-09-04 07:26:32 +00:00
|
|
|
/* Entire UI --------------------------------------- */
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_keyframe_insert);
|
|
|
|
WM_operatortype_append(ANIM_OT_keyframe_delete);
|
|
|
|
WM_operatortype_append(ANIM_OT_keyframe_insert_menu);
|
|
|
|
WM_operatortype_append(ANIM_OT_keyframe_delete_v3d);
|
2012-10-04 10:58:03 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_keyframe_clear_v3d);
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_keyframe_insert_button);
|
|
|
|
WM_operatortype_append(ANIM_OT_keyframe_delete_button);
|
2012-07-17 15:16:44 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_keyframe_clear_button);
|
2009-10-03 04:21:38 +00:00
|
|
|
|
2009-02-20 05:42:09 +00:00
|
|
|
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_driver_button_add);
|
|
|
|
WM_operatortype_append(ANIM_OT_driver_button_remove);
|
2009-09-25 04:51:04 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_copy_driver_button);
|
|
|
|
WM_operatortype_append(ANIM_OT_paste_driver_button);
|
2009-10-07 13:22:56 +00:00
|
|
|
|
2009-10-03 04:21:38 +00:00
|
|
|
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(ANIM_OT_keyingset_button_add);
|
|
|
|
WM_operatortype_append(ANIM_OT_keyingset_button_remove);
|
2009-10-03 04:21:38 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(ANIM_OT_keying_set_add);
|
|
|
|
WM_operatortype_append(ANIM_OT_keying_set_remove);
|
|
|
|
WM_operatortype_append(ANIM_OT_keying_set_path_add);
|
|
|
|
WM_operatortype_append(ANIM_OT_keying_set_path_remove);
|
2010-03-25 11:34:18 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(ANIM_OT_keying_set_active_set);
|
2008-12-21 08:02:24 +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 ED_keymap_anim(wmKeyConfig *keyconf)
|
2008-12-21 08:02:24 +00:00
|
|
|
{
|
2012-03-24 02:51:46 +00:00
|
|
|
wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation", 0, 0);
|
2012-01-14 14:17:12 +00:00
|
|
|
wmKeyMapItem *kmi;
|
2008-12-21 08:02:24 +00:00
|
|
|
|
2009-02-09 03:06:52 +00:00
|
|
|
/* frame management */
|
2012-05-08 15:30:00 +00:00
|
|
|
/* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons */
|
2009-08-27 08:46:39 +00:00
|
|
|
WM_keymap_add_item(keymap, "ANIM_OT_change_frame", ACTIONMOUSE, KM_PRESS, 0, 0);
|
2012-01-14 14:17:12 +00:00
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.show_seconds");
|
2008-12-21 08:45:13 +00:00
|
|
|
|
2009-02-09 03:06:52 +00:00
|
|
|
/* preview range */
|
2009-08-27 08:46:39 +00:00
|
|
|
WM_keymap_verify_item(keymap, "ANIM_OT_previewrange_set", PKEY, KM_PRESS, 0, 0);
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_keymap_verify_item(keymap, "ANIM_OT_previewrange_clear", PKEY, KM_PRESS, KM_ALT, 0);
|
2008-12-21 08:02:24 +00:00
|
|
|
}
|