2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2008 Blender Foundation. All rights reserved. */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup editors
|
2011-02-21 07:25:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2020-03-02 15:09:10 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct AnimData;
|
2019-08-15 01:34:58 +10:00
|
|
|
struct Depsgraph;
|
2008-12-20 08:24:24 +00:00
|
|
|
struct ID;
|
|
|
|
|
struct ListBase;
|
2009-07-28 06:50:30 +00:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ARegion;
|
2021-02-19 10:11:35 -06:00
|
|
|
struct ARegionType;
|
2021-07-16 11:48:54 +10:00
|
|
|
struct FModifier;
|
2018-06-07 12:47:00 +02:00
|
|
|
struct Main;
|
2021-02-19 10:11:35 -06:00
|
|
|
struct NlaStrip;
|
|
|
|
|
struct PanelType;
|
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-20 08:24:24 +00:00
|
|
|
struct View2D;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
|
|
|
|
struct wmKeyConfig;
|
2009-07-28 06:50:30 +00:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
struct Object;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Scene;
|
2009-07-28 06:50:30 +00:00
|
|
|
|
2009-09-27 06:14:42 +00:00
|
|
|
struct bDopeSheet;
|
|
|
|
|
|
2009-01-20 11:07:42 +00:00
|
|
|
struct FCurve;
|
2009-07-02 06:41:10 +00:00
|
|
|
struct FModifier;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bAction;
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2009-08-16 23:06:16 +00:00
|
|
|
struct uiBlock;
|
|
|
|
|
|
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
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Context
|
|
|
|
|
* \{ */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/**
|
|
|
|
|
* This struct defines a structure used for animation-specific
|
|
|
|
|
* 'context' information.
|
2008-12-22 08:13:25 +00:00
|
|
|
*/
|
|
|
|
|
typedef struct bAnimContext {
|
2019-01-15 23:24:20 +11:00
|
|
|
/** data to be filtered for use in animation editor */
|
|
|
|
|
void *data;
|
|
|
|
|
/** type of data eAnimCont_Types */
|
|
|
|
|
short datatype;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** editor->mode */
|
|
|
|
|
short mode;
|
2020-04-03 13:25:03 +02:00
|
|
|
/** area->spacetype */
|
2019-01-15 23:24:20 +11:00
|
|
|
short spacetype;
|
|
|
|
|
/** active region -> type (channels or main) */
|
|
|
|
|
short regiontype;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** editor host */
|
2020-04-03 13:25:03 +02:00
|
|
|
struct ScrArea *area;
|
2019-01-15 23:24:20 +11:00
|
|
|
/** editor data */
|
|
|
|
|
struct SpaceLink *sl;
|
|
|
|
|
/** region within editor */
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** dopesheet data for editor (or which is being used) */
|
|
|
|
|
struct bDopeSheet *ads;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** Current Main */
|
|
|
|
|
struct Main *bmain;
|
|
|
|
|
/** active scene */
|
|
|
|
|
struct Scene *scene;
|
|
|
|
|
/** active scene layer */
|
|
|
|
|
struct ViewLayer *view_layer;
|
T77086 Animation: Passing Dependency Graph to Drivers
Custom driver functions need access to the dependency graph that is
triggering the evaluation of the driver. This patch passes the
dependency graph pointer through all the animation-related calls.
Instead of passing the evaluation time to functions, the code now passes
an `AnimationEvalContext` pointer:
```
typedef struct AnimationEvalContext {
struct Depsgraph *const depsgraph;
const float eval_time;
} AnimationEvalContext;
```
These structs are read-only, meaning that the code cannot change the
evaluation time. Note that the `depsgraph` pointer itself is const, but
it points to a non-const depsgraph.
FCurves and Drivers can be evaluated at a different time than the
current scene time, for example when evaluating NLA strips. This means
that, even though the current time is stored in the dependency graph, we
need an explicit evaluation time.
There are two functions that allow creation of `AnimationEvalContext`
objects:
- `BKE_animsys_eval_context_construct(Depsgraph *depsgraph, float
eval_time)`, which creates a new context object from scratch, and
- `BKE_animsys_eval_context_construct_at(AnimationEvalContext
*anim_eval_context, float eval_time)`, which can be used to create a
`AnimationEvalContext` with the same depsgraph, but at a different
time. This makes it possible to later add fields without changing any
of the code that just want to change the eval time.
This also provides a fix for T75553, although it does require a change
to the custom driver function. The driver should call
`custom_function(depsgraph)`, and the function should use that depsgraph
instead of information from `bpy.context`.
Reviewed By: brecht, sergey
Differential Revision: https://developer.blender.org/D8047
2020-07-17 17:38:09 +02:00
|
|
|
/** active dependency graph */
|
|
|
|
|
struct Depsgraph *depsgraph;
|
2019-01-15 23:24:20 +11:00
|
|
|
/** active object */
|
|
|
|
|
struct Object *obact;
|
|
|
|
|
/** active set of markers */
|
|
|
|
|
ListBase *markers;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** pointer to current reports list */
|
|
|
|
|
struct ReportList *reports;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** Scale factor for height of channels (i.e. based on the size of keyframes). */
|
|
|
|
|
float yscale_fac;
|
2008-12-22 08:13:25 +00:00
|
|
|
} bAnimContext;
|
|
|
|
|
|
|
|
|
|
/* Main Data container types */
|
|
|
|
|
typedef enum eAnimCont_Types {
|
2012-06-08 06:11:24 +00:00
|
|
|
ANIMCONT_NONE = 0, /* invalid or no data */
|
|
|
|
|
ANIMCONT_ACTION = 1, /* action (bAction) */
|
|
|
|
|
ANIMCONT_SHAPEKEY = 2, /* shapekey (Key) */
|
|
|
|
|
ANIMCONT_GPENCIL = 3, /* grease pencil (screen) */
|
|
|
|
|
ANIMCONT_DOPESHEET = 4, /* dopesheet (bDopesheet) */
|
|
|
|
|
ANIMCONT_FCURVES = 5, /* animation F-Curves (bDopesheet) */
|
|
|
|
|
ANIMCONT_DRIVERS = 6, /* drivers (bDopesheet) */
|
|
|
|
|
ANIMCONT_NLA = 7, /* nla (bDopesheet) */
|
2012-06-08 14:31:38 +00:00
|
|
|
ANIMCONT_CHANNEL = 8, /* animation channel (bAnimListElem) */
|
2018-04-19 14:41:20 +02:00
|
|
|
ANIMCONT_MASK = 9, /* mask dopesheet */
|
|
|
|
|
ANIMCONT_TIMELINE = 10, /* "timeline" editor (bDopeSheet) */
|
2008-12-22 08:13:25 +00:00
|
|
|
} eAnimCont_Types;
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Channels
|
|
|
|
|
* \{ */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/**
|
|
|
|
|
* This struct defines a structure used for quick and uniform access for
|
|
|
|
|
* channels of animation data.
|
2008-12-20 08:24:24 +00:00
|
|
|
*/
|
|
|
|
|
typedef struct bAnimListElem {
|
|
|
|
|
struct bAnimListElem *next, *prev;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** source data this elem represents */
|
|
|
|
|
void *data;
|
|
|
|
|
/** (eAnim_ChannelType) one of the ANIMTYPE_* values */
|
|
|
|
|
int type;
|
|
|
|
|
/** copy of elem's flags for quick access */
|
|
|
|
|
int flag;
|
|
|
|
|
/** for un-named data, the index of the data in its collection */
|
|
|
|
|
int index;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** (eAnim_Update_Flags) tag the element for updating */
|
|
|
|
|
char update;
|
|
|
|
|
/** tag the included data. Temporary always */
|
|
|
|
|
char tag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** (eAnim_KeyType) type of motion data to expect */
|
|
|
|
|
short datatype;
|
|
|
|
|
/** motion data - mostly F-Curves, but can be other types too */
|
|
|
|
|
void *key_data;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/**
|
|
|
|
|
* \note
|
|
|
|
|
* id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree)
|
|
|
|
|
* from which evaluation of the RNA-paths takes place. It's used to figure out how deep
|
|
|
|
|
* channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property
|
|
|
|
|
* lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used
|
|
|
|
|
* bAction or something similar, none of this would be possible: although it's trivial
|
|
|
|
|
* to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from
|
|
|
|
|
* (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited),
|
|
|
|
|
* it's impossible to go the other way (i.e. one action may be used in multiple places).
|
2017-09-11 23:42:31 +12:00
|
|
|
*/
|
2019-01-15 23:24:20 +11:00
|
|
|
/** ID block that channel is attached to */
|
|
|
|
|
struct ID *id;
|
|
|
|
|
/** source of the animation data attached to ID block (for convenience) */
|
|
|
|
|
struct AnimData *adt;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/**
|
|
|
|
|
* For list element which corresponds to a f-curve, this is an ID which
|
2019-01-10 15:50:15 +01:00
|
|
|
* owns the f-curve.
|
|
|
|
|
*
|
|
|
|
|
* For example, if the f-curve is coming from Action, this id will be set to
|
|
|
|
|
* action's ID. But if this is a f-curve which is a driver, then the owner
|
|
|
|
|
* is set to, for example, object.
|
|
|
|
|
*
|
2021-07-03 23:08:40 +10:00
|
|
|
* NOTE: this is different from id above. The id above will be set to
|
|
|
|
|
* an object if the f-curve is coming from action associated with that object.
|
|
|
|
|
*/
|
2019-01-10 15:50:15 +01:00
|
|
|
struct ID *fcurve_owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/**
|
|
|
|
|
* for per-element F-Curves
|
|
|
|
|
* (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */
|
|
|
|
|
void *owner;
|
2008-12-20 08:24:24 +00:00
|
|
|
} bAnimListElem;
|
|
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/**
|
|
|
|
|
* Some types for easier type-testing
|
|
|
|
|
*
|
|
|
|
|
* \note need to keep the order of these synchronized with the channels define code
|
|
|
|
|
* which is used for drawing and handling channel lists for.
|
2009-08-11 11:52:23 +00:00
|
|
|
*/
|
2008-12-20 08:24:24 +00:00
|
|
|
typedef enum eAnim_ChannelType {
|
2012-05-12 20:39:39 +00:00
|
|
|
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,
|
2020-02-20 10:21:23 +11:00
|
|
|
ANIMTYPE_SPECIALDATA__UNUSED,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-13 11:21:02 +00:00
|
|
|
ANIMTYPE_SUMMARY,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-03-22 02:46:51 +13:00
|
|
|
ANIMTYPE_NLACONTROLS,
|
2015-03-22 21:41:45 +13:00
|
|
|
ANIMTYPE_NLACURVE,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
ANIMTYPE_FILLACTD,
|
2009-01-30 08:10:31 +00:00
|
|
|
ANIMTYPE_FILLDRIVERS,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
ANIMTYPE_DSMAT,
|
|
|
|
|
ANIMTYPE_DSLAM,
|
|
|
|
|
ANIMTYPE_DSCAM,
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
ANIMTYPE_DSCACHEFILE,
|
2008-12-20 08:24:24 +00:00
|
|
|
ANIMTYPE_DSCUR,
|
|
|
|
|
ANIMTYPE_DSSKEY,
|
2009-02-13 06:33:07 +00:00
|
|
|
ANIMTYPE_DSWOR,
|
2009-11-11 05:03:49 +00:00
|
|
|
ANIMTYPE_DSNTREE,
|
2017-01-17 20:01:59 +01: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,
|
2010-09-21 22:23:10 +00:00
|
|
|
ANIMTYPE_DSLINESTYLE,
|
2011-08-01 11:44:20 +00:00
|
|
|
ANIMTYPE_DSSPK,
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
ANIMTYPE_DSGPENCIL,
|
2016-10-14 17:22:57 +02:00
|
|
|
ANIMTYPE_DSMCLIP,
|
2020-03-17 14:41:48 +01:00
|
|
|
ANIMTYPE_DSHAIR,
|
|
|
|
|
ANIMTYPE_DSPOINTCLOUD,
|
|
|
|
|
ANIMTYPE_DSVOLUME,
|
2020-04-20 10:37:38 +02:00
|
|
|
ANIMTYPE_DSSIMULATION,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-16 12:08:47 +00:00
|
|
|
ANIMTYPE_SHAPEKEY,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-20 08:24:24 +00:00
|
|
|
ANIMTYPE_GPDATABLOCK,
|
|
|
|
|
ANIMTYPE_GPLAYER,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-08 14:31:38 +00:00
|
|
|
ANIMTYPE_MASKDATABLOCK,
|
|
|
|
|
ANIMTYPE_MASKLAYER,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-05-25 13:07:54 +00:00
|
|
|
ANIMTYPE_NLATRACK,
|
2009-05-29 12:26:47 +00:00
|
|
|
ANIMTYPE_NLAACTION,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
ANIMTYPE_PALETTE,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
/* always as last item, the total number of channel types... */
|
2019-04-16 16:40:47 +02:00
|
|
|
ANIMTYPE_NUM_TYPES,
|
2008-12-20 08:24:24 +00:00
|
|
|
} eAnim_ChannelType;
|
|
|
|
|
|
|
|
|
|
/* types of keyframe data in bAnimListElem */
|
|
|
|
|
typedef enum eAnim_KeyType {
|
2012-05-12 20:39:39 +00:00
|
|
|
ALE_NONE = 0, /* no keyframe data */
|
|
|
|
|
ALE_FCURVE, /* F-Curve */
|
|
|
|
|
ALE_GPFRAME, /* Grease Pencil Frames */
|
2012-06-26 10:14:50 +00:00
|
|
|
ALE_MASKLAY, /* Mask */
|
2012-05-12 20:39:39 +00:00
|
|
|
ALE_NLASTRIP, /* NLA Strips */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
ALE_ALL, /* All channels summary */
|
|
|
|
|
ALE_SCE, /* Scene summary */
|
|
|
|
|
ALE_OB, /* Object summary */
|
|
|
|
|
ALE_ACT, /* Action summary */
|
2019-04-16 16:40:47 +02:00
|
|
|
ALE_GROUP, /* Action Group summary */
|
2008-12-20 08:24:24 +00:00
|
|
|
} eAnim_KeyType;
|
|
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/**
|
|
|
|
|
* Flags for specifying the types of updates (i.e. recalculation/refreshing) that
|
2014-05-22 15:45:27 +12:00
|
|
|
* needs to be performed to the data contained in a channel following editing.
|
|
|
|
|
* For use with ANIM_animdata_update()
|
|
|
|
|
*/
|
|
|
|
|
typedef enum eAnim_Update_Flags {
|
|
|
|
|
ANIM_UPDATE_DEPS = (1 << 0), /* referenced data and dependencies get refreshed */
|
|
|
|
|
ANIM_UPDATE_ORDER = (1 << 1), /* keyframes need to be sorted */
|
|
|
|
|
ANIM_UPDATE_HANDLES = (1 << 2), /* recalculate handles */
|
|
|
|
|
} eAnim_Update_Flags;
|
|
|
|
|
|
|
|
|
|
/* used for most tools which change keyframes (flushed by ANIM_animdata_update) */
|
|
|
|
|
#define ANIM_UPDATE_DEFAULT (ANIM_UPDATE_DEPS | ANIM_UPDATE_ORDER | ANIM_UPDATE_HANDLES)
|
|
|
|
|
#define ANIM_UPDATE_DEFAULT_NOHANDLES (ANIM_UPDATE_DEFAULT & ~ANIM_UPDATE_HANDLES)
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name 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 */
|
2008-12-20 08:24:24 +00:00
|
|
|
typedef enum eAnimFilter_Flags {
|
2020-06-27 14:34:16 +10:00
|
|
|
/**
|
|
|
|
|
* Data which channel represents is fits the dope-sheet filters
|
|
|
|
|
* (i.e. scene visibility criteria).
|
|
|
|
|
*
|
|
|
|
|
* XXX: it's hard to think of any examples where this *ISN'T* the case...
|
2021-07-27 14:02:22 +08:00
|
|
|
* perhaps becomes implicit?
|
2020-06-27 14:34:16 +10:00
|
|
|
*/
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_DATA_VISIBLE = (1 << 0),
|
2019-01-15 23:24:20 +11:00
|
|
|
/** channel is visible within the channel-list hierarchy
|
|
|
|
|
* (i.e. F-Curves within Groups in ActEdit) */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_LIST_VISIBLE = (1 << 1),
|
2019-01-15 23:24:20 +11:00
|
|
|
/** channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_CURVE_VISIBLE = (1 << 2),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** include summary channels and "expanders" (for drawing/mouse-selection in channel list) */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_LIST_CHANNELS = (1 << 3),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** for its type, channel should be "active" one */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_ACTIVE = (1 << 4),
|
2020-06-27 14:34:16 +10:00
|
|
|
/** channel is a child of the active group (* Actions specialty) */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_ACTGROUPED = (1 << 5),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** channel must be selected/not-selected, but both must not be set together */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_SEL = (1 << 6),
|
|
|
|
|
ANIMFILTER_UNSEL = (1 << 7),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** editability status - must be editable to be included */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_FOREDIT = (1 << 8),
|
2019-01-15 23:24:20 +11:00
|
|
|
/** only selected animchannels should be considerable as editable - mainly
|
|
|
|
|
* for Graph Editor's option for keys on select curves only */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_SELEDIT = (1 << 9),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-27 14:34:16 +10:00
|
|
|
/**
|
|
|
|
|
* Flags used to enforce certain data types.
|
|
|
|
|
*
|
|
|
|
|
* \note The ones for curves and NLA tracks were redundant and have been removed for now.
|
2019-01-15 23:24:20 +11:00
|
|
|
*/
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_ANIMDATA = (1 << 10),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** duplicate entries for animation data attached to multi-user blocks must not occur */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIMFILTER_NODUPLIS = (1 << 11),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** for checking if we should keep some collapsed channel around (internal use only!) */
|
2013-12-26 18:46:54 +06:00
|
|
|
ANIMFILTER_TMP_PEEK = (1 << 30),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-27 14:34:16 +10:00
|
|
|
/** Ignore ONLYSEL flag from #bDopeSheet.filterflag (internal use only!) */
|
2019-01-15 23:57:49 +11:00
|
|
|
ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31),
|
2008-12-20 08:24:24 +00:00
|
|
|
} eAnimFilter_Flags;
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name 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 */
|
2012-05-12 20:39:39 +00:00
|
|
|
/* 'Scene' channels */
|
2013-08-17 04:48:34 +00:00
|
|
|
#define SEL_SCEC(sce) (CHECK_TYPE_INLINE(sce, Scene *), ((sce->flag & SCE_DS_SELECTED)))
|
|
|
|
|
#define EXPANDED_SCEC(sce) (CHECK_TYPE_INLINE(sce, Scene *), ((sce->flag & SCE_DS_COLLAPSED) == 0))
|
2012-05-12 20:39:39 +00:00
|
|
|
/* 'Sub-Scene' channels (flags stored in Data block) */
|
2013-08-17 04:48:34 +00:00
|
|
|
#define FILTER_WOR_SCED(wo) (CHECK_TYPE_INLINE(wo, World *), (wo->flag & WO_DS_EXPAND))
|
2013-03-23 03:00:37 +00:00
|
|
|
#define FILTER_LS_SCED(linestyle) ((linestyle->flag & LS_DS_EXPAND))
|
2012-05-12 20:39:39 +00:00
|
|
|
/* 'Object' channels */
|
2013-08-17 04:48:34 +00:00
|
|
|
#define SEL_OBJC(base) (CHECK_TYPE_INLINE(base, Base *), ((base->flag & SELECT)))
|
|
|
|
|
#define EXPANDED_OBJC(ob) \
|
2020-04-05 13:53:24 +10:00
|
|
|
(CHECK_TYPE_INLINE(ob, Object *), (((ob)->nlaflag & OB_ADS_COLLAPSED) == 0))
|
2012-05-12 20:39:39 +00:00
|
|
|
/* 'Sub-object' channels (flags stored in Data block) */
|
2013-08-17 04:48:34 +00:00
|
|
|
#define FILTER_SKE_OBJD(key) (CHECK_TYPE_INLINE(key, Key *), ((key->flag & KEY_DS_EXPAND)))
|
|
|
|
|
#define FILTER_MAT_OBJD(ma) (CHECK_TYPE_INLINE(ma, Material *), ((ma->flag & MA_DS_EXPAND)))
|
2019-02-27 10:46:48 +11:00
|
|
|
#define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Light *), ((la->flag & LA_DS_EXPAND)))
|
2013-08-17 04:48:34 +00:00
|
|
|
#define FILTER_CAM_OBJD(ca) (CHECK_TYPE_INLINE(ca, Camera *), ((ca->flag & CAM_DS_EXPAND)))
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
#define FILTER_CACHEFILE_OBJD(cf) \
|
2020-04-05 13:53:24 +10:00
|
|
|
(CHECK_TYPE_INLINE(cf, CacheFile *), (((cf)->flag & CACHEFILE_DS_EXPAND)))
|
2013-08-17 04:48:34 +00:00
|
|
|
#define FILTER_CUR_OBJD(cu) (CHECK_TYPE_INLINE(cu, Curve *), ((cu->flag & CU_DS_EXPAND)))
|
2016-12-28 17:30:58 +01:00
|
|
|
#define FILTER_PART_OBJD(part) \
|
2020-04-05 13:53:24 +10:00
|
|
|
(CHECK_TYPE_INLINE(part, ParticleSettings *), (((part)->flag & PART_DS_EXPAND)))
|
2013-08-17 04:48:34 +00:00
|
|
|
#define FILTER_MBALL_OBJD(mb) (CHECK_TYPE_INLINE(mb, MetaBall *), ((mb->flag2 & MB_DS_EXPAND)))
|
|
|
|
|
#define FILTER_ARM_OBJD(arm) (CHECK_TYPE_INLINE(arm, bArmature *), ((arm->flag & ARM_DS_EXPAND)))
|
|
|
|
|
#define FILTER_MESH_OBJD(me) (CHECK_TYPE_INLINE(me, Mesh *), ((me->flag & ME_DS_EXPAND)))
|
|
|
|
|
#define FILTER_LATTICE_OBJD(lt) (CHECK_TYPE_INLINE(lt, Lattice *), ((lt->flag & LT_DS_EXPAND)))
|
|
|
|
|
#define FILTER_SPK_OBJD(spk) (CHECK_TYPE_INLINE(spk, Speaker *), ((spk->flag & SPK_DS_EXPAND)))
|
Curves: Rename "Hair" types, variables, and functions to "Curves"
Based on discussions from T95355 and T94193, the plan is to use
the name "Curves" to describe the data-block container for multiple
curves. Eventually this will replace the existing "Curve" data-block.
However, it will be a while before the curve data-block can be replaced
so in order to distinguish the two curve types in the UI, "Hair Curves"
will be used, but eventually changed back to "Curves".
This patch renames "hair-related" files, functions, types, and variable
names to this convention. A deep rename is preferred to keep code
consistent and to avoid any "hair" terminology from leaking, since the
new data-block is meant for all curve types, not just hair use cases.
The downside of this naming is that the difference between "Curve"
and "Curves" has become important. That was considered during
design discussons and deemed acceptable, especially given the
non-permanent nature of the somewhat common conflict.
Some points of interest:
- All DNA compatibility is lost, just like rBf59767ff9729.
- I renamed `ID_HA` to `ID_CV` so there is no complete mismatch.
- `hair_curves` is used where necessary to distinguish from the
existing "curves" plural.
- I didn't rename any of the cycles/rendering code function names,
since that is also used by the old hair particle system.
Differential Revision: https://developer.blender.org/D14007
2022-02-07 11:55:54 -06:00
|
|
|
#define FILTER_CURVES_OBJD(ha) (CHECK_TYPE_INLINE(ha, Curves *), ((ha->flag & HA_DS_EXPAND)))
|
2020-03-17 14:41:48 +01:00
|
|
|
#define FILTER_POINTS_OBJD(pt) (CHECK_TYPE_INLINE(pt, PointCloud *), ((pt->flag & PT_DS_EXPAND)))
|
|
|
|
|
#define FILTER_VOLUME_OBJD(vo) (CHECK_TYPE_INLINE(vo, Volume *), ((vo->flag & VO_DS_EXPAND)))
|
2020-04-20 10:37:38 +02:00
|
|
|
#define FILTER_SIMULATION_OBJD(sim) \
|
|
|
|
|
(CHECK_TYPE_INLINE(sim, Simulation *), ((sim->flag & SIM_DS_EXPAND)))
|
2012-05-12 20:39:39 +00:00
|
|
|
/* Variable use expanders */
|
2013-08-17 04:48:34 +00:00
|
|
|
#define FILTER_NTREE_DATA(ntree) \
|
2020-04-05 13:53:24 +10:00
|
|
|
(CHECK_TYPE_INLINE(ntree, bNodeTree *), (((ntree)->flag & NTREE_DS_EXPAND)))
|
2013-08-17 04:48:34 +00:00
|
|
|
#define FILTER_TEX_DATA(tex) (CHECK_TYPE_INLINE(tex, Tex *), ((tex->flag & TEX_DS_EXPAND)))
|
2011-01-05 00:37:21 +00:00
|
|
|
|
2012-05-12 20:39:39 +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))
|
2012-05-12 20:39:39 +00:00
|
|
|
#define EXPANDED_ACTC(actc) ((actc->flag & ACT_COLLAPSED) == 0)
|
|
|
|
|
/* 'Sub-AnimData' channels */
|
|
|
|
|
#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) */
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Action Channel Group. */
|
2020-04-05 13:53:24 +10:00
|
|
|
#define EDITABLE_AGRP(agrp) (((agrp)->flag & AGRP_PROTECTED) == 0)
|
2011-04-24 10:51:45 +00:00
|
|
|
#define EXPANDED_AGRP(ac, agrp) \
|
2020-04-05 13:53:24 +10:00
|
|
|
(((!(ac) || ((ac)->spacetype != SPACE_GRAPH)) && ((agrp)->flag & AGRP_EXPANDED)) || \
|
|
|
|
|
(((ac) && ((ac)->spacetype == SPACE_GRAPH)) && ((agrp)->flag & AGRP_EXPANDED_G)))
|
|
|
|
|
#define SEL_AGRP(agrp) (((agrp)->flag & AGRP_SELECTED) || ((agrp)->flag & AGRP_ACTIVE))
|
2022-03-09 16:29:22 +11:00
|
|
|
/** F-Curve Channels. */
|
2012-05-12 20:39:39 +00:00
|
|
|
#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
|
|
|
|
2013-05-09 10:03:38 +00:00
|
|
|
/* ShapeKey mode only */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define EDITABLE_SHAPEKEY(kb) ((kb->flag & KEYBLOCK_LOCKED) == 0)
|
2009-10-16 12:08:47 +00:00
|
|
|
#define SEL_SHAPEKEY(kb) (kb->flag & KEYBLOCK_SEL)
|
|
|
|
|
|
2008-12-21 04:11:19 +00:00
|
|
|
/* Grease Pencil only */
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Grease Pencil data-block settings. */
|
2018-06-04 09:31:30 +02:00
|
|
|
#define EXPANDED_GPD(gpd) (gpd->flag & GP_DATA_EXPAND)
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Grease Pencil Layer settings. */
|
2012-05-12 20:39:39 +00:00
|
|
|
#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
|
|
|
|
2012-06-08 14:31:38 +00:00
|
|
|
/* Mask Only */
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Grease Pencil data-block settings. */
|
2012-06-08 14:31:38 +00:00
|
|
|
#define EXPANDED_MASK(mask) (mask->flag & MASK_ANIMF_EXPAND)
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Grease Pencil Layer settings. */
|
2012-06-08 14:31:38 +00:00
|
|
|
#define EDITABLE_MASK(masklay) ((masklay->flag & MASK_LAYERFLAG_LOCKED) == 0)
|
|
|
|
|
#define SEL_MASKLAY(masklay) (masklay->flag & SELECT)
|
|
|
|
|
|
2009-05-25 13:07:54 +00:00
|
|
|
/* NLA only */
|
|
|
|
|
#define SEL_NLT(nlt) (nlt->flag & NLATRACK_SELECTED)
|
2012-05-12 20:39:39 +00:00
|
|
|
#define EDITABLE_NLT(nlt) ((nlt->flag & NLATRACK_PROTECTED) == 0)
|
2009-05-25 13:07:54 +00:00
|
|
|
|
2016-10-14 17:22:57 +02:00
|
|
|
/* Movie clip only */
|
|
|
|
|
#define EXPANDED_MCLIP(clip) (clip->flag & MCLIP_DATA_EXPAND)
|
2013-03-16 05:09:32 +00:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* Palette only */
|
|
|
|
|
#define EXPANDED_PALETTE(palette) (palette->flag & PALETTE_DATA_EXPAND)
|
|
|
|
|
|
2013-03-16 05:09:32 +00:00
|
|
|
/* AnimData - NLA mostly... */
|
|
|
|
|
#define SEL_ANIMDATA(adt) (adt->flag & ADT_UI_SELECTED)
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Channel Defines
|
|
|
|
|
* \{ */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Channel heights. */
|
2019-05-07 15:09:14 +02:00
|
|
|
#define ACHANNEL_FIRST_TOP(ac) \
|
2020-03-06 16:56:42 +01:00
|
|
|
(UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - ACHANNEL_SKIP)
|
2016-07-03 03:42:28 +12:00
|
|
|
#define ACHANNEL_HEIGHT(ac) (0.8f * (ac)->yscale_fac * U.widget_unit)
|
|
|
|
|
#define ACHANNEL_SKIP (0.1f * U.widget_unit)
|
|
|
|
|
#define ACHANNEL_STEP(ac) (ACHANNEL_HEIGHT(ac) + ACHANNEL_SKIP)
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Additional offset to give some room at the end. */
|
2019-05-03 13:00:18 +02:00
|
|
|
#define ACHANNEL_TOT_HEIGHT(ac, item_amount) \
|
|
|
|
|
(-ACHANNEL_FIRST_TOP(ac) + ACHANNEL_STEP(ac) * (item_amount + 1))
|
2009-01-01 01:47:36 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Channel widths. */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
#define ACHANNEL_NAMEWIDTH (10 * U.widget_unit)
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Channel toggle-buttons. */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
#define ACHANNEL_BUTTON_WIDTH (0.8f * U.widget_unit)
|
2009-07-07 05:41:59 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name NLA Channel Defines
|
|
|
|
|
* \{ */
|
2009-07-07 05:41:59 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** NLA channel heights */
|
2019-05-07 15:09:14 +02:00
|
|
|
#define NLACHANNEL_FIRST_TOP(ac) \
|
2020-03-06 16:56:42 +01:00
|
|
|
(UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - NLACHANNEL_SKIP)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
#define NLACHANNEL_HEIGHT(snla) \
|
2020-04-05 13:53:24 +10:00
|
|
|
(((snla) && ((snla)->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : \
|
|
|
|
|
(1.2f * U.widget_unit))
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
#define NLACHANNEL_SKIP (0.1f * U.widget_unit)
|
2011-07-06 01:34:10 +00:00
|
|
|
#define NLACHANNEL_STEP(snla) (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP)
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Additional offset to give some room at the end. */
|
2019-05-07 15:09:14 +02:00
|
|
|
#define NLACHANNEL_TOT_HEIGHT(ac, item_amount) \
|
|
|
|
|
(-NLACHANNEL_FIRST_TOP(ac) + NLACHANNEL_STEP(((SpaceNla *)(ac)->sl)) * (item_amount + 1))
|
2009-07-07 05:41:59 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Channel widths */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
#define NLACHANNEL_NAMEWIDTH (10 * U.widget_unit)
|
2009-07-07 05:41:59 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Channel toggle-buttons */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
#define NLACHANNEL_BUTTON_WIDTH (0.8f * U.widget_unit)
|
2009-07-07 05:41:59 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Public API
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This function filters the active data source to leave only animation channels suitable for
|
|
|
|
|
* usage by the caller. It will return the length of the list
|
|
|
|
|
*
|
|
|
|
|
* \param anim_data: Is a pointer to a #ListBase,
|
|
|
|
|
* to which the filtered animation channels will be placed for use.
|
|
|
|
|
* \param filter_mode: how should the data be filtered - bit-mapping accessed flags.
|
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
|
|
|
*/
|
2014-05-22 15:46:51 +12:00
|
|
|
size_t ANIM_animdata_filter(bAnimContext *ac,
|
|
|
|
|
ListBase *anim_data,
|
|
|
|
|
eAnimFilter_Flags filter_mode,
|
|
|
|
|
void *data,
|
|
|
|
|
eAnimCont_Types 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
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Obtain current anim-data context from Blender Context info
|
|
|
|
|
* - AnimContext to write to is provided as pointer to var on stack so that we don't have
|
|
|
|
|
* allocation/freeing costs (which are not that avoidable with channels).
|
|
|
|
|
* - Clears data and sets the information from Blender Context which is useful
|
|
|
|
|
* \return whether the operation was successful.
|
2008-12-22 08:13:25 +00:00
|
|
|
*/
|
2014-01-28 14:41:33 +13:00
|
|
|
bool ANIM_animdata_get_context(const struct bContext *C, bAnimContext *ac);
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Obtain current anim-data context,
|
|
|
|
|
* given that context info from Blender context has already been set:
|
|
|
|
|
* - AnimContext to write to is provided as pointer to var on stack so that we don't have
|
|
|
|
|
* allocation/freeing costs (which are not that avoidable with channels).
|
|
|
|
|
* \return whether the operation was successful.
|
2008-12-30 00:28:11 +00:00
|
|
|
*/
|
2014-01-28 14:41:33 +13:00
|
|
|
bool ANIM_animdata_context_getdata(bAnimContext *ac);
|
2008-12-30 00:28:11 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Acts on bAnimListElem eAnim_Update_Flags.
|
|
|
|
|
*/
|
2014-05-19 00:24:45 +10:00
|
|
|
void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data);
|
|
|
|
|
|
|
|
|
|
void ANIM_animdata_freelist(ListBase *anim_data);
|
|
|
|
|
|
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
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Drawing TypeInfo
|
|
|
|
|
* \{ */
|
2009-01-02 00:56:48 +00:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Role or level of anim-channel in the hierarchy. */
|
2014-05-09 15:46:21 +12:00
|
|
|
typedef enum eAnimChannel_Role {
|
2019-01-15 23:24:20 +11:00
|
|
|
/** datablock expander - a "composite" channel type */
|
|
|
|
|
ACHANNEL_ROLE_EXPANDER = -1,
|
|
|
|
|
/** special purposes - not generally for hierarchy processing */
|
2020-02-20 10:21:23 +11:00
|
|
|
/* ACHANNEL_ROLE_SPECIAL = 0, */ /* UNUSED */
|
2019-01-15 23:24:20 +11:00
|
|
|
/** data channel - a channel representing one of the actual building blocks of channels */
|
2019-01-15 23:57:49 +11:00
|
|
|
ACHANNEL_ROLE_CHANNEL = 1,
|
2014-05-09 15:46:21 +12:00
|
|
|
} eAnimChannel_Role;
|
|
|
|
|
|
2012-03-01 12:20:18 +00:00
|
|
|
/* flag-setting behavior */
|
2009-08-11 11:52:23 +00:00
|
|
|
typedef enum eAnimChannels_SetFlag {
|
2019-01-15 23:24:20 +11:00
|
|
|
/** turn off */
|
|
|
|
|
ACHANNEL_SETFLAG_CLEAR = 0,
|
|
|
|
|
/** turn on */
|
|
|
|
|
ACHANNEL_SETFLAG_ADD = 1,
|
|
|
|
|
/** on->off, off->on */
|
|
|
|
|
ACHANNEL_SETFLAG_INVERT = 2,
|
|
|
|
|
/** some on -> all off / all on */
|
2019-01-15 23:57:49 +11:00
|
|
|
ACHANNEL_SETFLAG_TOGGLE = 3,
|
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 {
|
2012-06-08 06:11:24 +00:00
|
|
|
ACHANNEL_SETTING_SELECT = 0,
|
2022-05-13 09:24:28 +10:00
|
|
|
/** WARNING: for drawing UI's, need to check if this is off (maybe inverse this later). */
|
2019-01-15 23:24:20 +11:00
|
|
|
ACHANNEL_SETTING_PROTECT = 1,
|
2012-06-08 06:11:24 +00:00
|
|
|
ACHANNEL_SETTING_MUTE = 2,
|
|
|
|
|
ACHANNEL_SETTING_EXPAND = 3,
|
2019-01-15 23:24:20 +11:00
|
|
|
/** only for Graph Editor */
|
|
|
|
|
ACHANNEL_SETTING_VISIBLE = 4,
|
|
|
|
|
/** only for NLA Tracks */
|
|
|
|
|
ACHANNEL_SETTING_SOLO = 5,
|
|
|
|
|
/** only for NLA Actions */
|
|
|
|
|
ACHANNEL_SETTING_PINNED = 6,
|
2016-09-12 15:31:28 +02:00
|
|
|
ACHANNEL_SETTING_MOD_OFF = 7,
|
2019-01-15 23:24:20 +11:00
|
|
|
/** channel is pinned and always visible */
|
|
|
|
|
ACHANNEL_SETTING_ALWAYS_VISIBLE = 8,
|
2009-08-11 11:52:23 +00:00
|
|
|
} eAnimChannel_Settings;
|
|
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Drawing, mouse handling, and flag setting behavior. */
|
2009-08-11 11:52:23 +00:00
|
|
|
typedef struct bAnimChannelType {
|
2014-05-09 15:46:21 +12:00
|
|
|
/* -- Type data -- */
|
2012-05-12 20:39:39 +00:00
|
|
|
/* name of the channel type, for debugging */
|
2010-12-03 17:05:21 +00:00
|
|
|
const char *channel_type_name;
|
2014-05-09 15:46:21 +12:00
|
|
|
/* "level" or role in hierarchy - for finding the active channel */
|
|
|
|
|
eAnimChannel_Role channel_role;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-05-09 15:46:21 +12:00
|
|
|
/* -- Drawing -- */
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Get RGB color that is used to draw the majority of the backdrop. */
|
2012-04-28 08:29:20 +00:00
|
|
|
void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float r_color[3]);
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Draw backdrop strip for channel. */
|
2009-08-11 11:52:23 +00:00
|
|
|
void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
|
2022-03-09 15:02:04 +01:00
|
|
|
/** Get depth of indentation (relative to the depth channel is nested at). */
|
2009-08-11 11:52:23 +00:00
|
|
|
short (*get_indent_level)(bAnimContext *ac, bAnimListElem *ale);
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Get offset in pixels for the start of the channel (in addition to the indent depth). */
|
2009-08-11 11:52:23 +00:00
|
|
|
short (*get_offset)(bAnimContext *ac, bAnimListElem *ale);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Get name (for channel lists). */
|
2009-08-11 11:52:23 +00:00
|
|
|
void (*name)(bAnimListElem *ale, char *name);
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Get RNA property+pointer for editing the name. */
|
2013-11-23 18:44:39 +13:00
|
|
|
bool (*name_prop)(bAnimListElem *ale, struct PointerRNA *ptr, struct PropertyRNA **prop);
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Get icon (for channel lists). */
|
2009-08-11 11:52:23 +00:00
|
|
|
int (*icon)(bAnimListElem *ale);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-05-09 15:46:21 +12:00
|
|
|
/* -- Settings -- */
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Check if the given setting is valid in the current context. */
|
2014-05-04 23:19:40 +12:00
|
|
|
bool (*has_setting)(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting);
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Get the flag used for this setting. */
|
2014-05-04 23:19:40 +12:00
|
|
|
int (*setting_flag)(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg);
|
2022-03-09 16:29:22 +11: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.
|
2012-05-12 20:39:39 +00:00
|
|
|
*/
|
2014-05-04 23:19:40 +12:00
|
|
|
void *(*setting_ptr)(bAnimListElem *ale, eAnimChannel_Settings setting, short *type);
|
2009-08-11 11:52:23 +00:00
|
|
|
} bAnimChannelType;
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Drawing API
|
|
|
|
|
* \{ */
|
2009-08-11 11:52:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Get type info from given channel type.
|
|
|
|
|
*/
|
2015-03-30 21:29:20 +11:00
|
|
|
const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale);
|
2009-08-11 11:52:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Print debug info string for the given channel.
|
|
|
|
|
*/
|
2010-02-09 11:59:02 +00:00
|
|
|
void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Retrieves the Action associated with this animation channel.
|
|
|
|
|
*/
|
2021-07-16 12:36:57 +03:00
|
|
|
bAction *ANIM_channel_action_get(const bAnimListElem *ale);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Draw the given channel.
|
|
|
|
|
*/
|
2015-04-04 01:38:56 +13:00
|
|
|
void ANIM_channel_draw(
|
|
|
|
|
bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Draw UI widgets the given channel.
|
|
|
|
|
*/
|
2019-03-18 17:28:36 +01:00
|
|
|
void ANIM_channel_draw_widgets(const struct bContext *C,
|
|
|
|
|
bAnimContext *ac,
|
|
|
|
|
bAnimListElem *ale,
|
|
|
|
|
struct uiBlock *block,
|
|
|
|
|
rctf *rect,
|
|
|
|
|
size_t channel_index);
|
2009-08-11 11:52:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
2009-08-11 11:52:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Editing API
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if some setting for a channel is enabled
|
|
|
|
|
* Returns: 1 = On, 0 = Off, -1 = Invalid.
|
2009-08-11 11:52:23 +00:00
|
|
|
*/
|
2014-06-24 21:59:52 +12:00
|
|
|
short ANIM_channel_setting_get(bAnimContext *ac,
|
|
|
|
|
bAnimListElem *ale,
|
|
|
|
|
eAnimChannel_Settings setting);
|
2009-08-11 11:52:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Change value of some setting for a channel.
|
2009-08-11 11:52:23 +00:00
|
|
|
*/
|
2014-06-24 21:59:52 +12:00
|
|
|
void ANIM_channel_setting_set(bAnimContext *ac,
|
|
|
|
|
bAnimListElem *ale,
|
|
|
|
|
eAnimChannel_Settings setting,
|
|
|
|
|
eAnimChannels_SetFlag mode);
|
2009-08-11 11:52:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting
|
2018-11-14 12:53:15 +11:00
|
|
|
* - anim_data: list of the all the anim channels that can be chosen
|
|
|
|
|
* -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too,
|
|
|
|
|
* then the channels under closed expanders get ignored...
|
|
|
|
|
* - ale_setting: the anim channel (not in the anim_data list directly, though occurring there)
|
|
|
|
|
* with the new state of the setting that we want flushed up/down the hierarchy
|
|
|
|
|
* - setting: type of setting to set
|
|
|
|
|
* - on: whether the visibility setting has been enabled or disabled
|
2009-11-30 11:10:03 +00:00
|
|
|
*/
|
2014-06-24 21:59:52 +12:00
|
|
|
void ANIM_flush_setting_anim_channels(bAnimContext *ac,
|
|
|
|
|
ListBase *anim_data,
|
|
|
|
|
bAnimListElem *ale_setting,
|
|
|
|
|
eAnimChannel_Settings setting,
|
|
|
|
|
eAnimChannels_SetFlag mode);
|
2009-11-30 11:10:03 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Set selection state of all animation channels in the context.
|
|
|
|
|
*/
|
Cleanup: Animation, simplify channel selection code
Split up `ANIM_deselect_anim_channels()` into
`ANIM_anim_channels_select_set()` and
`ANIM_anim_channels_select_toggle()`.
`ANIM_anim_channels_select_set()` is equivalent to the old
`ANIM_deselect_anim_channels(..., false, ACHANNEL_SETFLAG_xxx)`.
`ANIM_anim_channels_select_toggle()` is equivalent to the old
`ANIM_deselect_anim_channels(..., true, ACHANNEL_SETFLAG_ADD)`.
`ANIM_deselect_anim_channels(..., true, ACHANNEL_SETFLAG_CLEAR)` was
also called once. The `true` parameter suggested the "toggle" behaviour
was intended, but the `ACHANNEL_SETFLAG_CLEAR` argument prevented any
toggling. This is now replaced with `ANIM_anim_channels_select_set(ac,
ACHANNEL_SETFLAG_CLEAR)` to make this explicit.
No functional changes, just a cleanup in order to better understand how
the selection works.
2020-10-13 14:43:19 +02:00
|
|
|
void ANIM_anim_channels_select_set(bAnimContext *ac, eAnimChannels_SetFlag sel);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Toggle selection state of all animation channels in the context.
|
|
|
|
|
*/
|
Cleanup: Animation, simplify channel selection code
Split up `ANIM_deselect_anim_channels()` into
`ANIM_anim_channels_select_set()` and
`ANIM_anim_channels_select_toggle()`.
`ANIM_anim_channels_select_set()` is equivalent to the old
`ANIM_deselect_anim_channels(..., false, ACHANNEL_SETFLAG_xxx)`.
`ANIM_anim_channels_select_toggle()` is equivalent to the old
`ANIM_deselect_anim_channels(..., true, ACHANNEL_SETFLAG_ADD)`.
`ANIM_deselect_anim_channels(..., true, ACHANNEL_SETFLAG_CLEAR)` was
also called once. The `true` parameter suggested the "toggle" behaviour
was intended, but the `ACHANNEL_SETFLAG_CLEAR` argument prevented any
toggling. This is now replaced with `ANIM_anim_channels_select_set(ac,
ACHANNEL_SETFLAG_CLEAR)` to make this explicit.
No functional changes, just a cleanup in order to better understand how
the selection works.
2020-10-13 14:43:19 +02:00
|
|
|
void ANIM_anim_channels_select_toggle(bAnimContext *ac);
|
2009-08-11 11:52:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Set the given animation-channel as the active one for the active context.
|
|
|
|
|
*/
|
2014-06-24 21:59:52 +12:00
|
|
|
void ANIM_set_active_channel(bAnimContext *ac,
|
|
|
|
|
void *data,
|
|
|
|
|
eAnimCont_Types datatype,
|
|
|
|
|
eAnimFilter_Flags filter,
|
|
|
|
|
void *channel_data,
|
|
|
|
|
eAnim_ChannelType channel_type);
|
2009-12-04 03:51:52 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Delete the F-Curve from the given AnimData block (if possible),
|
|
|
|
|
* as appropriate according to animation context.
|
|
|
|
|
*/
|
2009-12-04 03:51:52 +00:00
|
|
|
void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, struct FCurve *fcu);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Unlink the action from animdata if it's empty.
|
|
|
|
|
*
|
|
|
|
|
* If the action has no F-Curves, unlink it from AnimData if it did not
|
|
|
|
|
* come from a NLA Strip being tweaked.
|
|
|
|
|
*/
|
2019-05-02 14:51:43 +03:00
|
|
|
bool ANIM_remove_empty_action_from_animdata(struct AnimData *adt);
|
|
|
|
|
|
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
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Current Frame Drawing
|
|
|
|
|
*
|
|
|
|
|
* Main call to draw current-frame indicator in an Animation Editor.
|
|
|
|
|
* \{ */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
|
|
|
|
/* flags for Current Frame Drawing */
|
2020-06-23 07:59:34 +02:00
|
|
|
typedef enum eAnimEditDraw_CurrentFrame {
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Plain time indicator with no special indicators. */
|
2020-02-20 10:21:23 +11:00
|
|
|
/* DRAWCFRA_PLAIN = 0, */ /* UNUSED */
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Time indication in seconds or frames. */
|
2018-04-24 19:18:22 +02:00
|
|
|
DRAWCFRA_UNIT_SECONDS = (1 << 0),
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Draw indicator extra wide (for timeline). */
|
2019-01-15 23:57:49 +11:00
|
|
|
DRAWCFRA_WIDE = (1 << 1),
|
2020-06-23 07:59:34 +02:00
|
|
|
} eAnimEditDraw_CurrentFrame;
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* General call for drawing current frame indicator in 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
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Preview Range Drawing
|
|
|
|
|
*
|
|
|
|
|
* Main call to draw preview range curtains.
|
|
|
|
|
* \{ */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Draw preview range 'curtains' for highlighting where the animation data is.
|
|
|
|
|
*/
|
2013-05-18 10:24:38 +00:00
|
|
|
void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d, int end_frame_width);
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Frame Range Drawing
|
|
|
|
|
*
|
|
|
|
|
* Main call to draw normal frame range indicators.
|
|
|
|
|
* \{ */
|
2018-04-19 18:03:15 +02:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Draw frame range guides (for scene frame range) in background.
|
|
|
|
|
*
|
|
|
|
|
* TODO: Should we still show these when preview range is enabled?
|
|
|
|
|
*/
|
2018-04-19 18:03:15 +02:00
|
|
|
void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Draw manually set intended playback frame range guides for the action in the background.
|
|
|
|
|
* Allows specifying a subset of the Y range of the view.
|
|
|
|
|
*/
|
2021-05-03 00:03:00 +03:00
|
|
|
void ANIM_draw_action_framerange(
|
|
|
|
|
struct AnimData *adt, struct bAction *action, struct View2D *v2d, float ymin, float ymax);
|
|
|
|
|
|
2009-07-02 04:47:36 +00:00
|
|
|
/* ************************************************* */
|
|
|
|
|
/* F-MODIFIER TOOLS */
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name UI Panel Drawing
|
|
|
|
|
* \{ */
|
2010-03-18 13:04:46 +00:00
|
|
|
|
2021-08-31 11:46:46 +10:00
|
|
|
bool ANIM_nla_context_track_ptr(const struct bContext *C, struct PointerRNA *r_ptr);
|
|
|
|
|
bool ANIM_nla_context_strip_ptr(const struct bContext *C, struct PointerRNA *r_ptr);
|
|
|
|
|
|
|
|
|
|
struct NlaTrack *ANIM_nla_context_track(const struct bContext *C);
|
2021-02-19 10:11:35 -06:00
|
|
|
struct NlaStrip *ANIM_nla_context_strip(const struct bContext *C);
|
|
|
|
|
struct FCurve *ANIM_graph_context_fcurve(const struct bContext *C);
|
|
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Needed for abstraction between the graph editor and the NLA editor. */
|
2021-02-19 10:11:35 -06:00
|
|
|
typedef bool (*PanelTypePollFn)(const struct bContext *C, struct PanelType *pt);
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Avoid including `UI_interface.h` here. */
|
2021-02-19 10:11:35 -06:00
|
|
|
typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Checks if the panels match the active strip / curve, rebuilds them if they don't.
|
|
|
|
|
*/
|
2021-02-19 10:11:35 -06:00
|
|
|
void ANIM_fmodifier_panels(const struct bContext *C,
|
|
|
|
|
struct ID *owner_id,
|
|
|
|
|
struct ListBase *fmodifiers,
|
|
|
|
|
uiListPanelIDFromDataFunc panel_id_fn);
|
|
|
|
|
|
|
|
|
|
void ANIM_modifier_panels_register_graph_and_NLA(struct ARegionType *region_type,
|
|
|
|
|
const char *modifier_panel_prefix,
|
|
|
|
|
PanelTypePollFn poll_function);
|
|
|
|
|
void ANIM_modifier_panels_register_graph_only(struct ARegionType *region_type,
|
|
|
|
|
const char *modifier_panel_prefix,
|
|
|
|
|
PanelTypePollFn poll_function);
|
2009-07-02 04:47:36 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Copy/Paste Buffer
|
|
|
|
|
* \{ */
|
2010-03-18 13:04:46 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Free the copy/paste buffer.
|
|
|
|
|
*/
|
2016-04-03 01:18:23 +13:00
|
|
|
void ANIM_fmodifiers_copybuf_free(void);
|
2010-03-18 13:04:46 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Copy the given F-Modifiers to the buffer, returning whether anything was copied or not
|
|
|
|
|
* assuming that the buffer has been cleared already with #ANIM_fmodifiers_copybuf_free()
|
|
|
|
|
* \param active: Only copy the active modifier.
|
2010-03-18 13:04:46 +00:00
|
|
|
*/
|
2014-04-11 11:25:41 +10:00
|
|
|
bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active);
|
2010-03-18 13:04:46 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* 'Paste' the F-Modifier(s) from the buffer to the specified list
|
|
|
|
|
* \param replace: Free all the existing modifiers to leave only the pasted ones.
|
2010-03-18 13:04:46 +00:00
|
|
|
*/
|
2017-10-17 19:39:10 +03:00
|
|
|
bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, struct FCurve *curve);
|
2010-03-18 13:04:46 +00:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* ************************************************* */
|
|
|
|
|
/* ASSORTED TOOLS */
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name 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
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Get icon + name for channel-list displays for F-Curve.
|
|
|
|
|
*
|
|
|
|
|
* Write into "name" buffer, the name of the property
|
|
|
|
|
* (retrieved using RNA from the curve's settings),
|
|
|
|
|
* and return the icon used for the struct that this property refers to
|
|
|
|
|
*
|
|
|
|
|
* \warning name buffer we're writing to cannot exceed 256 chars
|
|
|
|
|
* (check anim_channels_defines.c for details).
|
|
|
|
|
*/
|
2009-11-08 06:43:08 +00:00
|
|
|
int getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu);
|
2009-01-25 04:02:31 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Automatically determine a color for the nth F-Curve.
|
|
|
|
|
*/
|
2012-05-26 11:01:01 +00:00
|
|
|
void getcolor_fcurve_rainbow(int cur, int tot, float out[3]);
|
2008-12-22 10:15:02 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name NLA Drawing
|
|
|
|
|
*
|
|
|
|
|
* \note Technically, this is not in the animation module (it's in space_nla)
|
2020-07-10 16:04:09 +10:00
|
|
|
* but these are sometimes needed by various animation API's.
|
2021-12-09 00:55:11 +11:00
|
|
|
* \{ */
|
2014-05-05 02:57:36 +12:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Get color to use for NLA Action channel's background.
|
|
|
|
|
* \note color returned includes fine-tuned alpha!
|
|
|
|
|
*/
|
2014-05-05 02:57:36 +12:00
|
|
|
void nla_action_get_color(struct AnimData *adt, struct bAction *act, float color[4]);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name NLA-Mapping
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2009-01-02 00:56:48 +00:00
|
|
|
/* anim_draw.c */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Obtain the AnimData block providing NLA-mapping for the given channel (if applicable).
|
|
|
|
|
*
|
|
|
|
|
* TODO: do not supply return this if the animdata tells us that there is no mapping to perform.
|
|
|
|
|
*/
|
2009-06-23 13:25:31 +00:00
|
|
|
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
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve
|
|
|
|
|
* \param restore: Whether to map points back to non-mapped time.
|
|
|
|
|
* \param only_keys: Whether to only adjust the location of the center point of beztriples.
|
|
|
|
|
*/
|
2014-04-11 11:25:41 +10:00
|
|
|
void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt,
|
|
|
|
|
struct FCurve *fcu,
|
|
|
|
|
bool restore,
|
|
|
|
|
bool only_keys);
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2009-07-24 06:51:33 +00:00
|
|
|
/* ..... */
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Perform validation & auto-blending/extend refreshes after some operations
|
|
|
|
|
* \note defined in space_nla/nla_edit.c, not in animation/
|
|
|
|
|
*/
|
2009-07-24 06:51:33 +00:00
|
|
|
void ED_nla_postop_refresh(bAnimContext *ac);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Unit Conversion Mappings
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* anim_draw.c */
|
|
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Flags for conversion mapping. */
|
2010-01-26 09:25:32 +00:00
|
|
|
typedef enum eAnimUnitConv_Flags {
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Restore to original internal values. */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIM_UNITCONV_RESTORE = (1 << 0),
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Ignore handles (i.e. only touch main keyframes). */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIM_UNITCONV_ONLYKEYS = (1 << 1),
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Only touch selected BezTriples. */
|
2012-05-12 20:39:39 +00:00
|
|
|
ANIM_UNITCONV_ONLYSEL = (1 << 2),
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Only touch selected vertices. */
|
2013-02-18 16:35:13 +00:00
|
|
|
ANIM_UNITCONV_SELVERTS = (1 << 3),
|
2020-02-20 10:21:23 +11:00
|
|
|
/* ANIM_UNITCONV_SKIPKNOTS = (1 << 4), */ /* UNUSED */
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Scale FCurve i a way it fits to -1..1 space. */
|
2013-10-29 18:10:52 +00:00
|
|
|
ANIM_UNITCONV_NORMALIZE = (1 << 5),
|
2022-03-09 16:29:22 +11:00
|
|
|
/**
|
|
|
|
|
* Only when normalization is used: use scale factor from previous run,
|
2013-10-29 18:10:52 +00:00
|
|
|
* prevents curves from jumping all over the place when tweaking them.
|
|
|
|
|
*/
|
|
|
|
|
ANIM_UNITCONV_NORMALIZE_FREEZE = (1 << 6),
|
2010-01-26 09:25:32 +00:00
|
|
|
} eAnimUnitConv_Flags;
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Get flags used for normalization in ANIM_unit_mapping_get_factor.
|
|
|
|
|
*/
|
2013-10-29 18:10:52 +00:00
|
|
|
short ANIM_get_normalization_flags(bAnimContext *ac);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Get unit conversion factor for given ID + F-Curve.
|
|
|
|
|
*/
|
2015-04-13 15:57:46 +02:00
|
|
|
float ANIM_unit_mapping_get_factor(
|
|
|
|
|
struct Scene *scene, struct ID *id, struct FCurve *fcu, short flag, float *r_offset);
|
2010-01-26 03:16:14 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
2009-01-02 00:56:48 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Utility macros
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provide access to Keyframe Type info in #BezTriple.
|
2009-09-04 02:44:56 +00:00
|
|
|
* 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
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/**
|
|
|
|
|
* Set/Clear/Toggle macro.
|
|
|
|
|
* \param channel: Channel with a 'flag' member that we're setting.
|
|
|
|
|
* \param smode: 0=clear, 1=set, 2=invert.
|
|
|
|
|
* \param sflag: bit-flag to set.
|
2009-05-31 11:14:50 +00:00
|
|
|
*/
|
|
|
|
|
#define ACHANNEL_SET_FLAG(channel, smode, sflag) \
|
|
|
|
|
{ \
|
2019-05-31 23:21:16 +10:00
|
|
|
if (smode == ACHANNEL_SETFLAG_INVERT) { \
|
2012-05-12 20:39:39 +00:00
|
|
|
(channel)->flag ^= (sflag); \
|
2019-05-31 23:21:16 +10:00
|
|
|
} \
|
|
|
|
|
else if (smode == ACHANNEL_SETFLAG_ADD) { \
|
2012-05-12 20:39:39 +00:00
|
|
|
(channel)->flag |= (sflag); \
|
2019-05-31 23:21:16 +10:00
|
|
|
} \
|
|
|
|
|
else { \
|
2012-05-12 20:39:39 +00:00
|
|
|
(channel)->flag &= ~(sflag); \
|
2019-05-31 23:21:16 +10:00
|
|
|
} \
|
2019-04-02 17:54:04 +11:00
|
|
|
} \
|
|
|
|
|
((void)0)
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/**
|
|
|
|
|
* Set/Clear/Toggle macro, where the flag is negative.
|
|
|
|
|
* \param channel: channel with a 'flag' member that we're setting.
|
|
|
|
|
* \param smode: 0=clear, 1=set, 2=invert.
|
|
|
|
|
* \param sflag: Bit-flag to set.
|
2009-05-31 11:14:50 +00:00
|
|
|
*/
|
|
|
|
|
#define ACHANNEL_SET_FLAG_NEG(channel, smode, sflag) \
|
|
|
|
|
{ \
|
2019-05-31 23:21:16 +10:00
|
|
|
if (smode == ACHANNEL_SETFLAG_INVERT) { \
|
2012-05-12 20:39:39 +00:00
|
|
|
(channel)->flag ^= (sflag); \
|
2019-05-31 23:21:16 +10:00
|
|
|
} \
|
|
|
|
|
else if (smode == ACHANNEL_SETFLAG_ADD) { \
|
2012-05-12 20:39:39 +00:00
|
|
|
(channel)->flag &= ~(sflag); \
|
2019-05-31 23:21:16 +10:00
|
|
|
} \
|
|
|
|
|
else { \
|
2012-05-12 20:39:39 +00:00
|
|
|
(channel)->flag |= (sflag); \
|
2019-05-31 23:21:16 +10:00
|
|
|
} \
|
2019-04-02 17:54:04 +11:00
|
|
|
} \
|
|
|
|
|
((void)0)
|
2008-12-23 19:47:33 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
2008-12-23 19:47:33 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/* anim_deps.c */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Animation Updates
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tags the given ID block for refreshes (if applicable) due to Animation Editor editing.
|
|
|
|
|
*/
|
2018-11-12 16:17:57 +03:00
|
|
|
void ANIM_id_update(struct Main *bmain, struct ID *id);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Tags the given anim list element for refreshes (if applicable) due to Animation Editor editing.
|
|
|
|
|
*/
|
2018-06-07 12:47:00 +02:00
|
|
|
void ANIM_list_elem_update(struct Main *bmain, struct Scene *scene, bAnimListElem *ale);
|
2009-12-08 18:28:09 +00:00
|
|
|
|
2009-12-21 09:52:43 +00:00
|
|
|
/* data -> channels syncing */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Main call to be exported to animation editors.
|
|
|
|
|
*/
|
2009-12-21 09:52:43 +00:00
|
|
|
void ANIM_sync_animchannels_to_data(const struct bContext *C);
|
2009-01-05 09:54:39 +00:00
|
|
|
|
2015-05-13 20:30:53 +02:00
|
|
|
void ANIM_center_frame(struct bContext *C, int smooth_viewtx);
|
2018-06-21 16:57:59 +12:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Operators
|
|
|
|
|
* \{ */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
/* generic animation channels */
|
2009-01-01 00:18:23 +00:00
|
|
|
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
|
|
|
|
2012-05-12 20:39:39 +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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
/* space_graph */
|
2011-03-04 16:02:42 +00:00
|
|
|
void ED_operatormacros_graph(void);
|
2012-05-12 20:39:39 +00:00
|
|
|
/* space_action */
|
2011-03-05 14:03:29 +00:00
|
|
|
void ED_operatormacros_action(void);
|
2008-12-21 08:02:24 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Animation Editor Exports
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2015-04-04 11:36:46 +13:00
|
|
|
/* XXX: Should we be doing these here, or at all? */
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Action Editor - Action Management.
|
|
|
|
|
* Helper function to find the active AnimData block from the Action Editor context.
|
|
|
|
|
*/
|
2021-05-03 00:03:00 +03:00
|
|
|
struct AnimData *ED_actedit_animdata_from_context(const struct bContext *C,
|
|
|
|
|
struct ID **r_adt_id_owner);
|
2018-06-04 09:31:30 +02:00
|
|
|
void ED_animedit_unlink_action(struct bContext *C,
|
|
|
|
|
struct ID *id,
|
2015-08-26 02:13:17 +12:00
|
|
|
struct AnimData *adt,
|
|
|
|
|
struct bAction *act,
|
|
|
|
|
struct ReportList *reports,
|
|
|
|
|
bool force_delete);
|
2018-06-21 16:57:59 +12:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Set up UI configuration for Drivers Editor
|
|
|
|
|
* (drivers editor window) and RNA (mode switching).
|
|
|
|
|
* \note Currently called from window-manager.
|
|
|
|
|
*/
|
2020-04-03 13:25:03 +02:00
|
|
|
void ED_drivers_editor_init(struct bContext *C, struct ScrArea *area);
|
2018-06-21 16:57:59 +12:00
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
/* ************************************************ */
|
2008-12-20 08:24:24 +00:00
|
|
|
|
2019-09-20 12:48:28 +02:00
|
|
|
typedef enum eAnimvizCalcRange {
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Update motion paths at the current frame only. */
|
2019-09-20 12:48:28 +02:00
|
|
|
ANIMVIZ_CALC_RANGE_CURRENT_FRAME,
|
|
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Try to limit updates to a close neighborhood of the current frame. */
|
2019-09-20 12:48:28 +02:00
|
|
|
ANIMVIZ_CALC_RANGE_CHANGED,
|
|
|
|
|
|
2022-03-09 16:29:22 +11:00
|
|
|
/** Update an entire range of the motion paths. */
|
2019-09-20 12:48:28 +02:00
|
|
|
ANIMVIZ_CALC_RANGE_FULL,
|
|
|
|
|
} eAnimvizCalcRange;
|
|
|
|
|
|
2019-09-20 17:38:32 +02:00
|
|
|
struct Depsgraph *animviz_depsgraph_build(struct Main *bmain,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct ViewLayer *view_layer,
|
|
|
|
|
struct ListBase *targets);
|
|
|
|
|
|
2019-04-16 07:27:37 +02:00
|
|
|
void animviz_calc_motionpaths(struct Depsgraph *depsgraph,
|
|
|
|
|
struct Main *bmain,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
ListBase *targets,
|
2019-09-20 12:48:28 +02:00
|
|
|
eAnimvizCalcRange range,
|
|
|
|
|
bool restore);
|
2019-04-16 07:27:37 +02:00
|
|
|
|
2022-04-26 12:29:22 +02:00
|
|
|
/**
|
2022-04-28 14:03:49 +10:00
|
|
|
* Update motion path computation range (in `ob.avs` or `armature.avs`) from user choice in
|
|
|
|
|
* `ob.avs.path_range` or `arm.avs.path_range`, depending on active user mode.
|
2022-04-26 12:29:22 +02:00
|
|
|
*
|
2022-04-28 14:03:49 +10:00
|
|
|
* \param ob: Object to compute range for (must be provided)
|
|
|
|
|
* \param scene: Used when scene range is chosen.
|
2022-04-26 12:29:22 +02:00
|
|
|
*/
|
|
|
|
|
void animviz_motionpath_compute_range(struct Object *ob, struct Scene *scene);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Get list of motion paths to be baked for the given object.
|
|
|
|
|
* - assumes the given list is ready to be used.
|
|
|
|
|
*/
|
2019-04-16 07:27:37 +02:00
|
|
|
void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
2020-03-02 15:09:10 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|