Dopesheet: enable Show Keyframes and Interpolation by default.
authorAlexander Gavrilov <angavrilov@gmail.com>
Sun, 14 Apr 2019 13:34:06 +0000 (16:34 +0300)
committerAlexander Gavrilov <angavrilov@gmail.com>
Sun, 14 Apr 2019 13:34:06 +0000 (16:34 +0300)
Make the option enabled by default, and enable it in old files,
unless Show Extremes is enabled.

However, suppress it for the Timeline, because its View menu
doesn't include the option.

Reviewers: billreynish, brecht

Differential Revision: https://developer.blender.org/D4678

source/blender/blenkernel/BKE_blender_version.h
source/blender/blenloader/intern/versioning_280.c
source/blender/editors/space_action/action_draw.c
source/blender/editors/space_action/space_action.c

index 7af65e2..7d9fa2d 100644 (file)
@@ -27,7 +27,7 @@
  * \note Use #STRINGIFY() rather than defining with quotes.
  */
 #define BLENDER_VERSION         280
-#define BLENDER_SUBVERSION      56
+#define BLENDER_SUBVERSION      57
 /** Several breakages with 280, e.g. collections vs layers. */
 #define BLENDER_MINVERSION      280
 #define BLENDER_MINSUBVERSION   0
index 952c364..ce2345b 100644 (file)
@@ -3096,6 +3096,22 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
                }
        }
 
+       if (!MAIN_VERSION_ATLEAST(bmain, 280, 57)) {
+               /* Enable Show Interpolation in dopesheet by default. */
+               for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+                       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+                                       if (sl->spacetype == SPACE_ACTION) {
+                                               SpaceAction *saction = (SpaceAction *)sl;
+                                               if ((saction->flag & SACTION_SHOW_EXTREMES) == 0) {
+                                                       saction->flag |= SACTION_SHOW_INTERPOLATION;
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
        {
                /* Versioning code until next subversion bump goes here. */
        }
index 8cfb77e..5cda728 100644 (file)
@@ -348,6 +348,12 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
         */
        y = (float)(-ACHANNEL_HEIGHT(ac));
 
+       int action_flag = saction->flag;
+
+       if (saction->mode == SACTCONT_TIMELINE) {
+               action_flag &= ~(SACTION_SHOW_INTERPOLATION | SACTION_SHOW_EXTREMES);
+       }
+
        for (ale = anim_data.first; ale; ale = ale->next) {
                const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
                const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF(ac));
@@ -363,28 +369,28 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
                                /* draw 'keyframes' for each specific datatype */
                                switch (ale->datatype) {
                                        case ALE_ALL:
-                                               draw_summary_channel(v2d, ale->data, y, ac->yscale_fac, saction->flag);
+                                               draw_summary_channel(v2d, ale->data, y, ac->yscale_fac, action_flag);
                                                break;
                                        case ALE_SCE:
-                                               draw_scene_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, saction->flag);
+                                               draw_scene_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, action_flag);
                                                break;
                                        case ALE_OB:
-                                               draw_object_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, saction->flag);
+                                               draw_object_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, action_flag);
                                                break;
                                        case ALE_ACT:
-                                               draw_action_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, saction->flag);
+                                               draw_action_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, action_flag);
                                                break;
                                        case ALE_GROUP:
-                                               draw_agroup_channel(v2d, adt, ale->data, y, ac->yscale_fac, saction->flag);
+                                               draw_agroup_channel(v2d, adt, ale->data, y, ac->yscale_fac, action_flag);
                                                break;
                                        case ALE_FCURVE:
-                                               draw_fcurve_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, saction->flag);
+                                               draw_fcurve_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, action_flag);
                                                break;
                                        case ALE_GPFRAME:
-                                               draw_gpl_channel(v2d, ads, ale->data, y, ac->yscale_fac, saction->flag);
+                                               draw_gpl_channel(v2d, ads, ale->data, y, ac->yscale_fac, action_flag);
                                                break;
                                        case ALE_MASKLAY:
-                                               draw_masklay_channel(v2d, ads, ale->data, y, ac->yscale_fac, saction->flag);
+                                               draw_masklay_channel(v2d, ads, ale->data, y, ac->yscale_fac, action_flag);
                                                break;
                                }
                        }
index 3dffa6a..f255055 100644 (file)
@@ -95,6 +95,7 @@ static SpaceLink *action_new(const ScrArea *sa, const Scene *scene)
        saction->autosnap = SACTSNAP_FRAME;
        saction->mode = SACTCONT_DOPESHEET;
        saction->mode_prev = SACTCONT_DOPESHEET;
+       saction->flag = SACTION_SHOW_INTERPOLATION;
 
        saction->ads.filterflag |= ADS_FILTER_SUMMARY;