2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2008-12-20 08:24: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-20 08:24:24 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Joshua Leung
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-21 07:25:24 +00:00
|
|
|
/** \file ED_anim_api.h
|
|
|
|
* \ingroup editors
|
|
|
|
*/
|
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
#ifndef ED_ANIM_API_H
|
|
|
|
#define ED_ANIM_API_H
|
|
|
|
|
|
|
|
struct ID;
|
|
|
|
struct ListBase;
|
2009-07-28 06:50:30 +00:00
|
|
|
struct AnimData;
|
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
struct bContext;
|
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
|
|
|
struct wmKeyConfig;
|
2010-11-17 12:02:36 +00:00
|
|
|
struct ReportList;
|
2008-12-23 11:02:39 +00:00
|
|
|
struct ScrArea;
|
2011-06-21 01:41:39 +00:00
|
|
|
struct SpaceLink;
|
2008-12-23 11:02:39 +00:00
|
|
|
struct ARegion;
|
2008-12-20 08:24:24 +00:00
|
|
|
struct View2D;
|
2009-07-28 06:50:30 +00:00
|
|
|
|
|
|
|
struct Scene;
|
2008-12-22 08:13:25 +00:00
|
|
|
struct Object;
|
2009-07-28 06:50:30 +00:00
|
|
|
|
2009-09-27 06:14:42 +00:00
|
|
|
struct bDopeSheet;
|
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
struct bActionGroup;
|
2009-01-20 11:07:42 +00:00
|
|
|
struct FCurve;
|
2009-07-02 06:41:10 +00:00
|
|
|
struct FModifier;
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2009-08-16 23:06:16 +00:00
|
|
|
struct uiBlock;
|
2009-09-27 06:14:42 +00:00
|
|
|
struct uiLayout;
|
2009-08-16 23:06:16 +00:00
|
|
|
|
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
2011-08-03 01:22:31 +00:00
|
|
|
struct PointerRNA;
|
|
|
|
struct PropertyRNA;
|
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
/* ************************************************ */
|
|
|
|
/* ANIMATION CHANNEL FILTERING */
|
2009-01-02 00:56:48 +00:00
|
|
|
/* anim_filter.c */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* --------------- Context --------------------- */
|
|
|
|
|
|
|
|
/* This struct defines a structure used for animation-specific
|
|
|
|
* 'context' information
|
|
|
|
*/
|
|
|
|
typedef struct bAnimContext {
|
|
|
|
void *data; /* data to be filtered for use in animation editor */
|
|
|
|
short datatype; /* type of data eAnimCont_Types */
|
|
|
|
|
|
|
|
short mode; /* editor->mode */
|
|
|
|
short spacetype; /* sa->spacetype */
|
|
|
|
short regiontype; /* active region -> type (channels or main) */
|
2011-06-21 01:41:39 +00:00
|
|
|
struct ScrArea *sa; /* editor host */
|
|
|
|
struct SpaceLink *sl; /* editor data */
|
2008-12-23 11:02:39 +00:00
|
|
|
struct ARegion *ar; /* region within editor */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
struct bDopeSheet *ads; /* dopesheet data for editor (or which is being used) */
|
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
struct Scene *scene; /* active scene */
|
|
|
|
struct Object *obact; /* active object */
|
2009-05-09 02:37:12 +00:00
|
|
|
ListBase *markers; /* active set of markers */
|
2010-11-17 12:02:36 +00:00
|
|
|
|
|
|
|
struct ReportList *reports; /* pointer to current reports list */
|
2008-12-22 08:13:25 +00:00
|
|
|
} bAnimContext;
|
|
|
|
|
|
|
|
/* Main Data container types */
|
|
|
|
typedef enum eAnimCont_Types {
|
|
|
|
ANIMCONT_NONE = 0, /* invalid or no data */
|
|
|
|
ANIMCONT_ACTION, /* action (bAction) */
|
|
|
|
ANIMCONT_SHAPEKEY, /* shapekey (Key) */
|
|
|
|
ANIMCONT_GPENCIL, /* grease pencil (screen) */
|
|
|
|
ANIMCONT_DOPESHEET, /* dopesheet (bDopesheet) */
|
2009-05-25 13:07:54 +00:00
|
|
|
ANIMCONT_FCURVES, /* animation F-Curves (bDopesheet) */
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
ANIMCONT_DRIVERS, /* drivers (bDopesheet) */
|
2011-06-30 13:56:47 +00:00
|
|
|
ANIMCONT_NLA, /* nla (bDopesheet) */
|
|
|
|
ANIMCONT_CHANNEL /* animation channel (bAnimListElem) */
|
2008-12-22 08:13:25 +00:00
|
|
|
} eAnimCont_Types;
|
|
|
|
|
|
|
|
/* --------------- Channels -------------------- */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
|
|
|
/* This struct defines a structure used for quick and uniform access for
|
|
|
|
* channels of animation data
|
|
|
|
*/
|
|
|
|
typedef struct bAnimListElem {
|
|
|
|
struct bAnimListElem *next, *prev;
|
|
|
|
|
2009-07-28 06:50:30 +00:00
|
|
|
void *data; /* source data this elem represents */
|
|
|
|
int type; /* one of the ANIMTYPE_* values */
|
|
|
|
int flag; /* copy of elem's flags for quick access */
|
2009-10-16 12:08:47 +00:00
|
|
|
int index; /* for un-named data, the index of the data in it's collection */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2009-07-28 06:50:30 +00:00
|
|
|
short datatype; /* type of motion data to expect */
|
2010-07-05 03:55:28 +00:00
|
|
|
void *key_data; /* motion data - mostly F-Curves, but can be other types too */
|
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2009-07-28 06:50:30 +00:00
|
|
|
struct ID *id; /* ID block that channel is attached to */
|
|
|
|
struct AnimData *adt; /* source of the animation data attached to ID block (for convenience) */
|
2008-12-20 08:24:24 +00:00
|
|
|
} bAnimListElem;
|
|
|
|
|
|
|
|
|
2009-08-11 11:52:23 +00:00
|
|
|
/* Some types for easier type-testing
|
2011-10-17 06:39:13 +00:00
|
|
|
* NOTE: need to keep the order of these synchronized with the channels define code
|
2009-08-11 11:52:23 +00:00
|
|
|
* which is used for drawing and handling channel lists for
|
|
|
|
*/
|
2008-12-20 08:24:24 +00:00
|
|
|
typedef enum eAnim_ChannelType {
|
|
|
|
ANIMTYPE_NONE= 0,
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
ANIMTYPE_ANIMDATA,
|
2008-12-20 08:24:24 +00:00
|
|
|
ANIMTYPE_SPECIALDATA,
|
|
|
|
|
2009-10-13 11:21:02 +00:00
|
|
|
ANIMTYPE_SUMMARY,
|
|
|
|
|
2009-02-13 06:33:07 +00:00
|
|
|
ANIMTYPE_SCENE,
|
2008-12-20 08:24:24 +00:00
|
|
|
ANIMTYPE_OBJECT,
|
|
|
|
ANIMTYPE_GROUP,
|
2009-01-20 11:07:42 +00:00
|
|
|
ANIMTYPE_FCURVE,
|
2008-12-20 08:24:24 +00:00
|
|
|
|
|
|
|
ANIMTYPE_FILLACTD,
|
2009-01-30 08:10:31 +00:00
|
|
|
ANIMTYPE_FILLDRIVERS,
|
2008-12-20 08:24:24 +00:00
|
|
|
|
|
|
|
ANIMTYPE_DSMAT,
|
|
|
|
ANIMTYPE_DSLAM,
|
|
|
|
ANIMTYPE_DSCAM,
|
|
|
|
ANIMTYPE_DSCUR,
|
|
|
|
ANIMTYPE_DSSKEY,
|
2009-02-13 06:33:07 +00:00
|
|
|
ANIMTYPE_DSWOR,
|
2009-11-11 05:03:49 +00:00
|
|
|
ANIMTYPE_DSNTREE,
|
2009-07-24 19:36:08 +00:00
|
|
|
ANIMTYPE_DSPART,
|
2009-08-03 13:09:23 +00:00
|
|
|
ANIMTYPE_DSMBALL,
|
2009-09-21 06:43:20 +00:00
|
|
|
ANIMTYPE_DSARM,
|
2009-12-28 00:52:31 +00:00
|
|
|
ANIMTYPE_DSMESH,
|
2010-02-17 10:21:07 +00:00
|
|
|
ANIMTYPE_DSTEX,
|
2011-01-05 00:37:21 +00:00
|
|
|
ANIMTYPE_DSLAT,
|
2011-08-01 11:44:20 +00:00
|
|
|
ANIMTYPE_DSSPK,
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2009-10-16 12:08:47 +00:00
|
|
|
ANIMTYPE_SHAPEKEY,
|
2008-12-20 08:24:24 +00:00
|
|
|
|
|
|
|
ANIMTYPE_GPDATABLOCK,
|
|
|
|
ANIMTYPE_GPLAYER,
|
2009-05-25 13:07:54 +00:00
|
|
|
|
|
|
|
ANIMTYPE_NLATRACK,
|
2009-05-29 12:26:47 +00:00
|
|
|
ANIMTYPE_NLAACTION,
|
2009-08-11 11:52:23 +00:00
|
|
|
|
|
|
|
/* always as last item, the total number of channel types... */
|
2010-12-03 01:52:28 +00:00
|
|
|
ANIMTYPE_NUM_TYPES
|
2008-12-20 08:24:24 +00:00
|
|
|
} eAnim_ChannelType;
|
|
|
|
|
|
|
|
/* types of keyframe data in bAnimListElem */
|
|
|
|
typedef enum eAnim_KeyType {
|
|
|
|
ALE_NONE = 0, /* no keyframe data */
|
2009-01-20 11:07:42 +00:00
|
|
|
ALE_FCURVE, /* F-Curve */
|
2008-12-20 08:24:24 +00:00
|
|
|
ALE_GPFRAME, /* Grease Pencil Frames */
|
2009-05-25 13:07:54 +00:00
|
|
|
ALE_NLASTRIP, /* NLA Strips */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2009-10-13 11:21:02 +00:00
|
|
|
ALE_ALL, /* All channels summary */
|
2009-02-13 06:33:07 +00:00
|
|
|
ALE_SCE, /* Scene summary */
|
2008-12-20 08:24:24 +00:00
|
|
|
ALE_OB, /* Object summary */
|
|
|
|
ALE_ACT, /* Action summary */
|
2010-12-03 01:52:28 +00:00
|
|
|
ALE_GROUP /* Action Group summary */
|
2008-12-20 08:24:24 +00:00
|
|
|
} eAnim_KeyType;
|
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* ----------------- Filtering -------------------- */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
/* filtering flags - under what circumstances should a channel be returned */
|
|
|
|
typedef enum eAnimFilter_Flags {
|
|
|
|
/* data which channel represents is fits the dopesheet filters (i.e. scene visibility criteria) */
|
|
|
|
// XXX: it's hard to think of any examples where this *ISN'T* the case... perhaps becomes implicit?
|
|
|
|
ANIMFILTER_DATA_VISIBLE = (1<<0),
|
|
|
|
/* channel is visible within the channel-list hierarchy (i.e. F-Curves within Groups in ActEdit) */
|
|
|
|
ANIMFILTER_LIST_VISIBLE = (1<<1),
|
|
|
|
/* channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */
|
|
|
|
ANIMFILTER_CURVE_VISIBLE = (1<<2),
|
|
|
|
|
|
|
|
/* include summary channels and "expanders" (for drawing/mouse-selection in channel list) */
|
|
|
|
ANIMFILTER_LIST_CHANNELS = (1<<3),
|
|
|
|
|
|
|
|
/* for its type, channel should be "active" one */
|
|
|
|
ANIMFILTER_ACTIVE = (1<<4),
|
|
|
|
/* channel is a child of the active group (* Actions speciality) */
|
|
|
|
ANIMFILTER_ACTGROUPED = (1<<5),
|
|
|
|
|
|
|
|
/* channel must be selected/not-selected, but both must not be set together */
|
|
|
|
ANIMFILTER_SEL = (1<<6),
|
|
|
|
ANIMFILTER_UNSEL = (1<<7),
|
|
|
|
|
|
|
|
/* editability status - must be editable to be included */
|
|
|
|
ANIMFILTER_FOREDIT = (1<<8),
|
|
|
|
/* only selected animchannels should be considerable as editable - mainly for Graph Editor's option for keys on select curves only */
|
|
|
|
ANIMFILTER_SELEDIT = (1<<9),
|
|
|
|
|
|
|
|
/* flags used to enforce certain data types */
|
|
|
|
// NOTE: the ones for curves and NLA tracks were redundant and have been removed for now...
|
|
|
|
ANIMFILTER_ANIMDATA = (1<<10),
|
|
|
|
|
|
|
|
/* duplicate entries for animation data attached to multi-user blocks must not occur */
|
2011-06-26 14:50:19 +00:00
|
|
|
ANIMFILTER_NODUPLIS = (1<<11),
|
|
|
|
|
|
|
|
/* for checking if we should keep some collapsed channel around (internal use only!) */
|
|
|
|
ANIMFILTER_TMP_PEEK = (1<<30)
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
} eAnimFilter_Flags;
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2008-12-21 04:11:19 +00:00
|
|
|
/* ---------- Flag Checking Macros ------------ */
|
2009-01-20 11:07:42 +00:00
|
|
|
// xxx check on all of these flags again...
|
2008-12-21 04:11:19 +00:00
|
|
|
|
|
|
|
/* Dopesheet only */
|
2009-02-13 06:33:07 +00:00
|
|
|
/* 'Scene' channels */
|
|
|
|
#define SEL_SCEC(sce) ((sce->flag & SCE_DS_SELECTED))
|
|
|
|
#define EXPANDED_SCEC(sce) ((sce->flag & SCE_DS_COLLAPSED)==0)
|
|
|
|
/* 'Sub-Scene' channels (flags stored in Data block) */
|
|
|
|
#define FILTER_WOR_SCED(wo) ((wo->flag & WO_DS_EXPAND))
|
2008-12-21 04:11:19 +00:00
|
|
|
/* 'Object' channels */
|
|
|
|
#define SEL_OBJC(base) ((base->flag & SELECT))
|
|
|
|
#define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED)==0)
|
|
|
|
/* 'Sub-object' channels (flags stored in Data block) */
|
2009-10-16 12:08:47 +00:00
|
|
|
#define FILTER_SKE_OBJD(key) ((key->flag & KEY_DS_EXPAND))
|
2008-12-21 04:11:19 +00:00
|
|
|
#define FILTER_MAT_OBJD(ma) ((ma->flag & MA_DS_EXPAND))
|
|
|
|
#define FILTER_LAM_OBJD(la) ((la->flag & LA_DS_EXPAND))
|
|
|
|
#define FILTER_CAM_OBJD(ca) ((ca->flag & CAM_DS_EXPAND))
|
|
|
|
#define FILTER_CUR_OBJD(cu) ((cu->flag & CU_DS_EXPAND))
|
2009-07-24 19:36:08 +00:00
|
|
|
#define FILTER_PART_OBJD(part) ((part->flag & PART_DS_EXPAND))
|
2009-08-03 13:09:23 +00:00
|
|
|
#define FILTER_MBALL_OBJD(mb) ((mb->flag2 & MB_DS_EXPAND))
|
2009-09-21 06:43:20 +00:00
|
|
|
#define FILTER_ARM_OBJD(arm) ((arm->flag & ARM_DS_EXPAND))
|
2009-12-28 00:52:31 +00:00
|
|
|
#define FILTER_MESH_OBJD(me) ((me->flag & ME_DS_EXPAND))
|
2011-01-05 00:37:21 +00:00
|
|
|
#define FILTER_LATTICE_OBJD(lt) ((lt->flag & LT_DS_EXPAND))
|
2011-08-01 11:44:20 +00:00
|
|
|
#define FILTER_SPK_OBJD(spk) ((spk->flag & SPK_DS_EXPAND))
|
2011-06-27 03:54:33 +00:00
|
|
|
/* Variable use expanders */
|
|
|
|
#define FILTER_NTREE_DATA(ntree) ((ntree->flag & NTREE_DS_EXPAND))
|
|
|
|
#define FILTER_TEX_DATA(tex) ((tex->flag & TEX_DS_EXPAND))
|
2011-01-05 00:37:21 +00:00
|
|
|
|
2008-12-21 04:11:19 +00:00
|
|
|
/* 'Sub-object/Action' channels (flags stored in Action) */
|
2009-01-20 11:07:42 +00:00
|
|
|
#define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED))
|
2009-01-28 00:50:56 +00:00
|
|
|
#define EXPANDED_ACTC(actc) ((actc->flag & ACT_COLLAPSED)==0)
|
2010-02-17 10:21:07 +00:00
|
|
|
/* 'Sub-AnimData' channels */
|
2009-01-30 08:10:31 +00:00
|
|
|
#define EXPANDED_DRVD(adt) ((adt->flag & ADT_DRIVERS_COLLAPSED)==0)
|
2011-06-27 03:54:33 +00:00
|
|
|
|
2008-12-21 04:11:19 +00:00
|
|
|
|
|
|
|
/* Actions (also used for Dopesheet) */
|
|
|
|
/* Action Channel Group */
|
|
|
|
#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0)
|
2011-04-24 10:51:45 +00:00
|
|
|
#define EXPANDED_AGRP(ac, agrp) \
|
2011-06-30 13:56:47 +00:00
|
|
|
( ((!(ac) || ((ac)->spacetype != SPACE_IPO)) && (agrp->flag & AGRP_EXPANDED)) || \
|
|
|
|
(( (ac) && ((ac)->spacetype == SPACE_IPO)) && (agrp->flag & AGRP_EXPANDED_G)) )
|
2008-12-21 04:11:19 +00:00
|
|
|
#define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
|
2009-01-20 11:07:42 +00:00
|
|
|
/* F-Curve Channels */
|
|
|
|
#define EDITABLE_FCU(fcu) ((fcu->flag & FCURVE_PROTECTED)==0)
|
2011-07-12 03:59:06 +00:00
|
|
|
#define SEL_FCU(fcu) (fcu->flag & FCURVE_SELECTED)
|
2008-12-21 04:11:19 +00:00
|
|
|
|
2009-10-16 12:08:47 +00:00
|
|
|
/* ShapeKey mode only */
|
|
|
|
#define EDITABLE_SHAPEKEY(kb) ((kb->flag & KEYBLOCK_LOCKED)==0)
|
|
|
|
#define SEL_SHAPEKEY(kb) (kb->flag & KEYBLOCK_SEL)
|
|
|
|
|
2008-12-21 04:11:19 +00:00
|
|
|
/* Grease Pencil only */
|
|
|
|
/* Grease Pencil datablock settings */
|
|
|
|
#define EXPANDED_GPD(gpd) (gpd->flag & GP_DATA_EXPAND)
|
|
|
|
/* Grease Pencil Layer settings */
|
|
|
|
#define EDITABLE_GPL(gpl) ((gpl->flag & GP_LAYER_LOCKED)==0)
|
2011-07-07 11:29:36 +00:00
|
|
|
#define SEL_GPL(gpl) (gpl->flag & GP_LAYER_SELECT)
|
2008-12-21 04:11:19 +00:00
|
|
|
|
2009-05-25 13:07:54 +00:00
|
|
|
/* NLA only */
|
|
|
|
#define SEL_NLT(nlt) (nlt->flag & NLATRACK_SELECTED)
|
|
|
|
#define EDITABLE_NLT(nlt) ((nlt->flag & NLATRACK_PROTECTED)==0)
|
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* -------------- Channel Defines -------------- */
|
|
|
|
|
|
|
|
/* channel heights */
|
2009-01-01 00:18:23 +00:00
|
|
|
#define ACHANNEL_FIRST -16
|
2008-12-22 08:13:25 +00:00
|
|
|
#define ACHANNEL_HEIGHT 16
|
|
|
|
#define ACHANNEL_HEIGHT_HALF 8
|
|
|
|
#define ACHANNEL_SKIP 2
|
|
|
|
#define ACHANNEL_STEP (ACHANNEL_HEIGHT + ACHANNEL_SKIP)
|
2009-01-01 01:47:36 +00:00
|
|
|
|
|
|
|
/* channel widths */
|
2008-12-22 09:43:54 +00:00
|
|
|
#define ACHANNEL_NAMEWIDTH 200
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2009-01-01 01:47:36 +00:00
|
|
|
/* channel toggle-buttons */
|
|
|
|
#define ACHANNEL_BUTTON_WIDTH 16
|
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
|
|
|
|
/* -------------- NLA Channel Defines -------------- */
|
|
|
|
|
|
|
|
/* NLA channel heights */
|
2011-07-06 01:34:10 +00:00
|
|
|
// XXX: NLACHANNEL_FIRST isn't used?
|
|
|
|
#define NLACHANNEL_FIRST -16
|
|
|
|
#define NLACHANNEL_HEIGHT(snla) ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? 16 : 24)
|
|
|
|
#define NLACHANNEL_HEIGHT_HALF(snla) ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? 8 : 12)
|
|
|
|
#define NLACHANNEL_SKIP 2
|
|
|
|
#define NLACHANNEL_STEP(snla) (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP)
|
2009-07-07 05:41:59 +00:00
|
|
|
|
|
|
|
/* channel widths */
|
|
|
|
#define NLACHANNEL_NAMEWIDTH 200
|
|
|
|
|
|
|
|
/* channel toggle-buttons */
|
|
|
|
#define NLACHANNEL_BUTTON_WIDTH 16
|
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
/* ---------------- API -------------------- */
|
|
|
|
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
/* Obtain list of filtered Animation channels to operate on.
|
|
|
|
* Returns the number of channels in the list
|
|
|
|
*/
|
2011-06-21 04:01:51 +00:00
|
|
|
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype);
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
|
|
|
|
/* Obtain current anim-data context from Blender Context info.
|
|
|
|
* Returns whether the operation was successful.
|
2008-12-22 08:13:25 +00:00
|
|
|
*/
|
|
|
|
short ANIM_animdata_get_context(const struct bContext *C, bAnimContext *ac);
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2008-12-30 00:28:11 +00:00
|
|
|
/* Obtain current anim-data context (from Animation Editor) given
|
|
|
|
* that Blender Context info has already been set.
|
|
|
|
* Returns whether the operation was successful.
|
|
|
|
*/
|
|
|
|
short ANIM_animdata_context_getdata(bAnimContext *ac);
|
|
|
|
|
2009-01-01 00:18:23 +00:00
|
|
|
/* ************************************************ */
|
|
|
|
/* ANIMATION CHANNELS LIST */
|
2009-08-11 11:52:23 +00:00
|
|
|
/* anim_channels_*.c */
|
2009-01-05 00:38:17 +00:00
|
|
|
|
2009-08-11 11:52:23 +00:00
|
|
|
/* ------------------------ Drawing TypeInfo -------------------------- */
|
2009-01-02 00:56:48 +00:00
|
|
|
|
|
|
|
/* flag-setting behaviour */
|
2009-08-11 11:52:23 +00:00
|
|
|
typedef enum eAnimChannels_SetFlag {
|
2010-02-09 21:22:24 +00:00
|
|
|
ACHANNEL_SETFLAG_CLEAR = 0, /* turn off */
|
|
|
|
ACHANNEL_SETFLAG_ADD, /* turn on */
|
|
|
|
ACHANNEL_SETFLAG_INVERT, /* on->off, off->on */
|
2010-12-03 01:52:28 +00:00
|
|
|
ACHANNEL_SETFLAG_TOGGLE /* some on -> all off // all on */
|
2009-01-02 00:56:48 +00:00
|
|
|
} eAnimChannels_SetFlag;
|
2009-01-01 00:18:23 +00:00
|
|
|
|
2009-11-25 11:05:11 +00:00
|
|
|
/* types of settings for AnimChannels */
|
2009-08-11 11:52:23 +00:00
|
|
|
typedef enum eAnimChannel_Settings {
|
2010-11-08 00:09:31 +00:00
|
|
|
ACHANNEL_SETTING_SELECT = 0,
|
2009-08-11 11:52:23 +00:00
|
|
|
ACHANNEL_SETTING_PROTECT, // warning: for drawing UI's, need to check if this is off (maybe inverse this later)
|
|
|
|
ACHANNEL_SETTING_MUTE,
|
|
|
|
ACHANNEL_SETTING_EXPAND,
|
|
|
|
ACHANNEL_SETTING_VISIBLE, /* only for Graph Editor */
|
2010-12-03 01:52:28 +00:00
|
|
|
ACHANNEL_SETTING_SOLO /* only for NLA Tracks */
|
2009-08-11 11:52:23 +00:00
|
|
|
} eAnimChannel_Settings;
|
|
|
|
|
|
|
|
|
|
|
|
/* Drawing, mouse handling, and flag setting behaviour... */
|
|
|
|
typedef struct bAnimChannelType {
|
2010-02-09 09:23:29 +00:00
|
|
|
/* type data */
|
|
|
|
/* name of the channel type, for debugging */
|
2010-12-03 17:05:21 +00:00
|
|
|
const char *channel_type_name;
|
2010-02-09 09:23:29 +00:00
|
|
|
|
2009-08-11 11:52:23 +00:00
|
|
|
/* drawing */
|
2010-01-08 11:14:30 +00:00
|
|
|
/* get RGB color that is used to draw the majority of the backdrop */
|
|
|
|
void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float *color);
|
2009-08-11 11:52:23 +00:00
|
|
|
/* draw backdrop strip for channel */
|
|
|
|
void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
|
|
|
|
/* get depth of indention (relative to the depth channel is nested at) */
|
|
|
|
short (*get_indent_level)(bAnimContext *ac, bAnimListElem *ale);
|
|
|
|
/* get offset in pixels for the start of the channel (in addition to the indent depth) */
|
|
|
|
short (*get_offset)(bAnimContext *ac, bAnimListElem *ale);
|
|
|
|
|
|
|
|
/* get name (for channel lists) */
|
|
|
|
void (*name)(bAnimListElem *ale, char *name);
|
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
2011-08-03 01:22:31 +00:00
|
|
|
/* get RNA property+pointer for editing the name */
|
|
|
|
short (*name_prop)(bAnimListElem *ale, struct PointerRNA *ptr, struct PropertyRNA **prop);
|
2009-08-11 11:52:23 +00:00
|
|
|
/* get icon (for channel lists) */
|
|
|
|
int (*icon)(bAnimListElem *ale);
|
|
|
|
|
|
|
|
/* settings */
|
|
|
|
/* check if the given setting is valid in the current context */
|
|
|
|
short (*has_setting)(bAnimContext *ac, bAnimListElem *ale, int setting);
|
|
|
|
/* get the flag used for this setting */
|
2010-01-23 03:04:37 +00:00
|
|
|
int (*setting_flag)(bAnimContext *ac, int setting, short *neg);
|
2009-08-11 11:52:23 +00:00
|
|
|
/* get the pointer to int/short where data is stored,
|
|
|
|
* with type being sizeof(ptr_data) which should be fine for runtime use...
|
|
|
|
* - assume that setting has been checked to be valid for current context
|
|
|
|
*/
|
|
|
|
void *(*setting_ptr)(bAnimListElem *ale, int setting, short *type);
|
|
|
|
} bAnimChannelType;
|
|
|
|
|
|
|
|
/* ------------------------ Drawing API -------------------------- */
|
|
|
|
|
|
|
|
/* Get typeinfo for the given channel */
|
|
|
|
bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale);
|
|
|
|
|
2010-02-09 11:59:02 +00:00
|
|
|
/* Print debugging info about a given channel */
|
|
|
|
void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level);
|
|
|
|
|
2009-08-11 11:52:23 +00:00
|
|
|
/* Draw the given channel */
|
|
|
|
void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
|
2009-08-16 02:21:43 +00:00
|
|
|
/* Draw the widgets for the given channel */
|
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
2011-08-03 01:22:31 +00:00
|
|
|
void ANIM_channel_draw_widgets(struct bContext *C, bAnimContext *ac, bAnimListElem *ale, struct uiBlock *block, float yminc, float ymaxc, size_t channel_index);
|
2009-08-11 11:52:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------------------ Editing API -------------------------- */
|
|
|
|
|
|
|
|
/* Check if some setting for a channel is enabled
|
|
|
|
* Returns: 1 = On, 0 = Off, -1 = Invalid
|
|
|
|
*
|
|
|
|
* - setting: eAnimChannel_Settings
|
|
|
|
*/
|
|
|
|
short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting);
|
|
|
|
|
|
|
|
/* Change value of some setting for a channel
|
|
|
|
* - setting: eAnimChannel_Settings
|
|
|
|
* - mode: eAnimChannels_SetFlag
|
|
|
|
*/
|
|
|
|
void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, short mode);
|
|
|
|
|
|
|
|
|
2009-11-30 11:10:03 +00:00
|
|
|
/* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting
|
|
|
|
* - anim_data: list of the all the anim channels that can be chosen
|
|
|
|
* -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too,
|
2011-09-25 12:31:21 +00:00
|
|
|
* then the channels under closed expanders get ignored...
|
2009-11-30 11:10:03 +00:00
|
|
|
* - ale_setting: the anim channel (not in the anim_data list directly, though occuring there)
|
|
|
|
* with the new state of the setting that we want flushed up/down the hierarchy
|
2010-01-10 11:09:30 +00:00
|
|
|
* - setting: type of setting to set
|
|
|
|
* - on: whether the visibility setting has been enabled or disabled
|
2009-11-30 11:10:03 +00:00
|
|
|
*/
|
2010-01-10 11:09:30 +00:00
|
|
|
void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on);
|
2009-11-30 11:10:03 +00:00
|
|
|
|
|
|
|
|
2009-08-11 11:52:23 +00:00
|
|
|
/* Deselect all animation channels */
|
2010-01-23 03:04:37 +00:00
|
|
|
void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, short test, short sel);
|
2009-08-11 11:52:23 +00:00
|
|
|
|
|
|
|
/* Set the 'active' channel of type channel_type, in the given action */
|
|
|
|
void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type);
|
|
|
|
|
2009-12-04 03:51:52 +00:00
|
|
|
|
|
|
|
/* Delete the F-Curve from the given AnimData block (if possible), as appropriate according to animation context */
|
|
|
|
void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, struct FCurve *fcu);
|
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
/* ************************************************ */
|
|
|
|
/* DRAWING API */
|
2009-01-02 00:56:48 +00:00
|
|
|
/* anim_draw.c */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2010-01-30 04:43:36 +00:00
|
|
|
/* Get string representing the given frame number as an appropriately represented frame or timecode */
|
|
|
|
void ANIM_timecode_string_from_frame(char *str, struct Scene *scene, int power, short timecodes, float cfra);
|
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
/* ---------- Current Frame Drawing ---------------- */
|
|
|
|
|
|
|
|
/* flags for Current Frame Drawing */
|
|
|
|
enum {
|
|
|
|
/* plain time indicator with no special indicators */
|
|
|
|
DRAWCFRA_PLAIN = 0,
|
|
|
|
/* draw box indicating current frame number */
|
|
|
|
DRAWCFRA_SHOW_NUMBOX = (1<<0),
|
|
|
|
/* time indication in seconds or frames */
|
|
|
|
DRAWCFRA_UNIT_SECONDS = (1<<1),
|
2011-07-12 12:13:23 +00:00
|
|
|
/* draw indicator extra wide (for timeline) */
|
2011-11-06 05:46:45 +00:00
|
|
|
DRAWCFRA_WIDE = (1<<2)
|
2008-12-20 08:24:24 +00:00
|
|
|
} eAnimEditDraw_CurrentFrame;
|
|
|
|
|
|
|
|
/* main call to draw current-frame indicator in an Animation Editor */
|
2008-12-22 10:15:02 +00:00
|
|
|
void ANIM_draw_cfra(const struct bContext *C, struct View2D *v2d, short flag);
|
2008-12-20 08:24:24 +00:00
|
|
|
|
|
|
|
/* ------------- Preview Range Drawing -------------- */
|
|
|
|
|
|
|
|
/* main call to draw preview range curtains */
|
2008-12-22 10:15:02 +00:00
|
|
|
void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d);
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2009-07-02 04:47:36 +00:00
|
|
|
/* ************************************************* */
|
|
|
|
/* F-MODIFIER TOOLS */
|
|
|
|
|
2010-03-18 13:04:46 +00:00
|
|
|
/* ------------- UI Panel Drawing -------------- */
|
|
|
|
|
2009-07-02 04:47:36 +00:00
|
|
|
/* draw a given F-Modifier for some layout/UI-Block */
|
2009-12-24 14:01:22 +00:00
|
|
|
void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
|
2009-07-02 04:47:36 +00:00
|
|
|
|
2010-03-18 13:04:46 +00:00
|
|
|
/* ------------- Copy/Paste Buffer -------------- */
|
|
|
|
|
|
|
|
|
|
|
|
/* free the copy/paste buffer */
|
|
|
|
void free_fmodifiers_copybuf(void);
|
|
|
|
|
|
|
|
/* copy the given F-Modifiers to the buffer, returning whether anything was copied or not
|
|
|
|
* assuming that the buffer has been cleared already with free_fmodifiers_copybuf()
|
|
|
|
* - active: only copy the active modifier
|
|
|
|
*/
|
|
|
|
short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active);
|
|
|
|
|
|
|
|
/* 'Paste' the F-Modifier(s) from the buffer to the specified list
|
|
|
|
* - replace: free all the existing modifiers to leave only the pasted ones
|
|
|
|
*/
|
|
|
|
short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace);
|
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* ************************************************* */
|
|
|
|
/* ASSORTED TOOLS */
|
|
|
|
|
2009-01-25 04:02:31 +00:00
|
|
|
/* ------------ Animation F-Curves <-> Icons/Names Mapping ------------ */
|
2009-01-02 00:56:48 +00:00
|
|
|
/* anim_ipo_utils.c */
|
2008-12-22 10:15:02 +00:00
|
|
|
|
2009-11-08 06:43:08 +00:00
|
|
|
/* Get icon + name for channel-list displays for F-Curve */
|
|
|
|
int getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu);
|
2009-01-25 04:02:31 +00:00
|
|
|
|
2009-08-14 11:09:19 +00:00
|
|
|
/* Automatically determine a color for the nth F-Curve */
|
2009-12-20 05:09:55 +00:00
|
|
|
void getcolor_fcurve_rainbow(int cur, int tot, float *out);
|
2008-12-22 10:15:02 +00:00
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* ----------------- NLA-Mapping ----------------------- */
|
2009-01-02 00:56:48 +00:00
|
|
|
/* anim_draw.c */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
/* Obtain the AnimData block providing NLA-scaling for the given channel if applicable */
|
|
|
|
struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale);
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
/* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */
|
2010-01-15 10:34:39 +00:00
|
|
|
void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys);
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2009-07-24 06:51:33 +00:00
|
|
|
/* ..... */
|
|
|
|
|
|
|
|
/* Perform auto-blending/extend refreshes after some operations */
|
|
|
|
// NOTE: defined in space_nla/nla_edit.c, not in animation/
|
|
|
|
void ED_nla_postop_refresh(bAnimContext *ac);
|
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* ------------- Unit Conversion Mappings ------------- */
|
|
|
|
/* anim_draw.c */
|
|
|
|
|
2010-01-26 09:25:32 +00:00
|
|
|
/* flags for conversion mapping */
|
|
|
|
typedef enum eAnimUnitConv_Flags {
|
|
|
|
/* restore to original internal values */
|
|
|
|
ANIM_UNITCONV_RESTORE = (1<<0),
|
|
|
|
/* ignore handles (i.e. only touch main keyframes) */
|
|
|
|
ANIM_UNITCONV_ONLYKEYS = (1<<1),
|
|
|
|
/* only touch selected BezTriples */
|
|
|
|
ANIM_UNITCONV_ONLYSEL = (1<<2),
|
|
|
|
/* only touch selected vertices */
|
2010-12-03 01:52:28 +00:00
|
|
|
ANIM_UNITCONV_SELVERTS = (1<<3)
|
2010-01-26 09:25:32 +00:00
|
|
|
} eAnimUnitConv_Flags;
|
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* Get unit conversion factor for given ID + F-Curve */
|
|
|
|
float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FCurve *fcu, short restore);
|
|
|
|
|
|
|
|
/* Apply/Unapply units conversions to keyframes */
|
2010-01-26 09:25:32 +00:00
|
|
|
void ANIM_unit_mapping_apply_fcurve(struct Scene *scene, struct ID *id, struct FCurve *fcu, short flag);
|
2010-01-26 03:16:14 +00:00
|
|
|
|
2009-05-31 11:14:50 +00:00
|
|
|
/* ------------- Utility macros ----------------------- */
|
2009-01-02 00:56:48 +00:00
|
|
|
|
2009-09-04 02:44:56 +00:00
|
|
|
/* provide access to Keyframe Type info in BezTriple
|
|
|
|
* NOTE: this is so that we can change it from being stored in 'hide'
|
|
|
|
*/
|
|
|
|
#define BEZKEYTYPE(bezt) ((bezt)->hide)
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2009-05-31 11:14:50 +00:00
|
|
|
/* set/clear/toggle macro
|
|
|
|
* - channel - channel with a 'flag' member that we're setting
|
2010-02-09 21:22:24 +00:00
|
|
|
* - smode - 0=clear, 1=set, 2=invert
|
2009-05-31 11:14:50 +00:00
|
|
|
* - sflag - bitflag to set
|
|
|
|
*/
|
|
|
|
#define ACHANNEL_SET_FLAG(channel, smode, sflag) \
|
|
|
|
{ \
|
2010-02-09 21:22:24 +00:00
|
|
|
if (smode == ACHANNEL_SETFLAG_INVERT) (channel)->flag ^= (sflag); \
|
2009-05-31 11:14:50 +00:00
|
|
|
else if (smode == ACHANNEL_SETFLAG_ADD) (channel)->flag |= (sflag); \
|
|
|
|
else (channel)->flag &= ~(sflag); \
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set/clear/toggle macro, where the flag is negative
|
|
|
|
* - channel - channel with a 'flag' member that we're setting
|
2010-02-09 21:22:24 +00:00
|
|
|
* - smode - 0=clear, 1=set, 2=invert
|
2009-05-31 11:14:50 +00:00
|
|
|
* - sflag - bitflag to set
|
|
|
|
*/
|
|
|
|
#define ACHANNEL_SET_FLAG_NEG(channel, smode, sflag) \
|
|
|
|
{ \
|
2010-02-09 21:22:24 +00:00
|
|
|
if (smode == ACHANNEL_SETFLAG_INVERT) (channel)->flag ^= (sflag); \
|
2009-05-31 11:14:50 +00:00
|
|
|
else if (smode == ACHANNEL_SETFLAG_ADD) (channel)->flag &= ~(sflag); \
|
|
|
|
else (channel)->flag |= (sflag); \
|
|
|
|
}
|
|
|
|
|
2008-12-23 19:47:33 +00:00
|
|
|
|
|
|
|
/* --------- anim_deps.c, animation updates -------- */
|
|
|
|
|
2009-12-08 18:28:09 +00:00
|
|
|
void ANIM_id_update(struct Scene *scene, struct ID *id);
|
|
|
|
void ANIM_list_elem_update(struct Scene *scene, bAnimListElem *ale);
|
|
|
|
|
2009-12-21 09:52:43 +00:00
|
|
|
/* data -> channels syncing */
|
|
|
|
void ANIM_sync_animchannels_to_data(const struct bContext *C);
|
2009-01-05 09:54:39 +00:00
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
/* ************************************************* */
|
2008-12-21 08:02:24 +00:00
|
|
|
/* OPERATORS */
|
2009-01-01 00:18:23 +00:00
|
|
|
|
|
|
|
/* generic animation channels */
|
|
|
|
void ED_operatortypes_animchannels(void);
|
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_animchannels(struct wmKeyConfig *keyconf);
|
2008-12-21 08:02:24 +00:00
|
|
|
|
2009-01-01 00:18:23 +00:00
|
|
|
/* generic time editing */
|
2008-12-21 08:02:24 +00:00
|
|
|
void ED_operatortypes_anim(void);
|
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(struct wmKeyConfig *keyconf);
|
2011-03-04 16:02:42 +00:00
|
|
|
|
|
|
|
/* space_graph */
|
|
|
|
void ED_operatormacros_graph(void);
|
2011-03-05 14:03:29 +00:00
|
|
|
/* space_action */
|
|
|
|
void ED_operatormacros_action(void);
|
2008-12-21 08:02:24 +00:00
|
|
|
|
|
|
|
/* ************************************************ */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
|
|
|
#endif /* ED_ANIM_API_H */
|
|
|
|
|