Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2021-05-03 00:03:00 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2021-11-24 15:58:32 +0300
commit5d59b38605d61b2aeabfa1cb572b5a0d9158424b (patch)
tree82b0a19eb0e5dd7290ae81c10427082576d8dfb5 /source/blender/editors/space_action/space_action.c
parent057cb7e5e77bcf932882292a774156b5d8c90ab4 (diff)
Animation: allow manually setting the intended playback range for actions.
Some operations, e.g. adding a new action strip to NLA, require knowing the active frame range of an action. However, currently it can only be deduced by scanning the keyframes of the curves within it. This is not ideal if e.g. curves are staggered for overlap. As suggested by Nathan Vegdahl in comments to T54724, this patch adds Action properties that allow manually specifying its active frame range. The settings are exposed via a panel in the Dopesheet and Action Editor. When enabled, the range is highlighted in the background using a striped fill to distinguish it from the solid filled regular playback range. When set, the frame range is used when adding or updating NLA tracks, and by add-ons using `Action.frame_range`, e.g. FBX exporter. Differential Revision: https://developer.blender.org/D11803
Diffstat (limited to 'source/blender/editors/space_action/space_action.c')
-rw-r--r--source/blender/editors/space_action/space_action.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 738eeb21e2e..ebb28f3a208 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -25,6 +25,7 @@
#include <string.h>
#include "DNA_action_types.h"
+#include "DNA_anim_types.h"
#include "DNA_collection_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -35,6 +36,7 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
+#include "BKE_nla.h"
#include "BKE_screen.h"
#include "RNA_access.h"
@@ -204,6 +206,13 @@ static void action_main_region_draw(const bContext *C, ARegion *region)
/* start and end frame */
ANIM_draw_framerange(scene, v2d);
+ /* Draw the manually set intended playback frame range highlight in the Action editor. */
+ if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && saction->action) {
+ AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
+
+ ANIM_draw_action_framerange(adt, saction->action, v2d, -FLT_MAX, FLT_MAX);
+ }
+
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
draw_channel_strips(&ac, saction, region);