Make playback invoked form animation editors more usable
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 3 Jun 2016 09:46:57 +0000 (11:46 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 3 Jun 2016 09:46:57 +0000 (11:46 +0200)
This covers the following workflow. Animator will disable Update All 3D views
in order to get quick playback in a particular 3D editor. However, it also
handy to see playback in all editors and image editors to see comparison of
animation and reference footage.

So the idea here is to refresh reasonable editors when playback is invoked
from animation editors.

Commit to make Hjalti happy.

source/blender/editors/include/ED_screen_types.h
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c

index effecf43839c05c0567cf61b66bd408af0398bed..1c41b14a8744818dcd9e9e72d911bd2a8ffe9a84 100644 (file)
@@ -42,6 +42,7 @@ typedef struct ScreenAnimData {
        int sfra;               /* frame that playback was started from */
        int nextfra;            /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
        double last_duration;   /* used for frame dropping */
+       bool from_anim_edit;    /* playback was invoked from animation editor */
 } ScreenAnimData;
 
 /* for animplayer */
index 23c6aa37a83f20fcd6d8c9c1f50ba14afba95748..a459f982ada31fed1202b79a178798079a592485 100644 (file)
@@ -2070,7 +2070,10 @@ void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync,
                sad->refresh = refresh;
                sad->flag |= (enable < 0) ? ANIMPLAY_FLAG_REVERSE : 0;
                sad->flag |= (sync == 0) ? ANIMPLAY_FLAG_NO_SYNC : (sync == 1) ? ANIMPLAY_FLAG_SYNC : 0;
-               
+
+               ScrArea *sa = CTX_wm_area(C);
+               sad->from_anim_edit = (ELEM(sa->spacetype, SPACE_IPO, SPACE_ACTION, SPACE_NLA, SPACE_TIME));
+
                screen->animtimer->customdata = sad;
                
        }
index 4111f67553a2e77fccb3da79a8c84a196340e179..f340f716ccbe33a240e877e28ffa00d760581b2a 100644 (file)
@@ -3355,24 +3355,24 @@ static int match_area_with_refresh(int spacetype, int refresh)
        return 0;
 }
 
-static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
+static int match_region_with_redraws(int spacetype, int regiontype, int redraws, bool from_anim_edit)
 {
        if (regiontype == RGN_TYPE_WINDOW) {
                
                switch (spacetype) {
                        case SPACE_VIEW3D:
-                               if (redraws & TIME_ALL_3D_WIN)
+                               if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit)
                                        return 1;
                                break;
                        case SPACE_IPO:
                        case SPACE_ACTION:
                        case SPACE_NLA:
-                               if (redraws & TIME_ALL_ANIM_WIN)
+                               if ((redraws & TIME_ALL_ANIM_WIN) || from_anim_edit)
                                        return 1;
                                break;
                        case SPACE_TIME:
                                /* if only 1 window or 3d windows, we do timeline too */
-                               if (redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN))
+                               if ((redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) || from_anim_edit)
                                        return 1;
                                break;
                        case SPACE_BUTS:
@@ -3380,7 +3380,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
                                        return 1;
                                break;
                        case SPACE_SEQ:
-                               if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN))
+                               if ((redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) || from_anim_edit)
                                        return 1;
                                break;
                        case SPACE_NODE:
@@ -3388,11 +3388,11 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
                                        return 1;
                                break;
                        case SPACE_IMAGE:
-                               if (redraws & TIME_ALL_IMAGE_WIN)
+                               if ((redraws & TIME_ALL_IMAGE_WIN) || from_anim_edit)
                                        return 1;
                                break;
                        case SPACE_CLIP:
-                               if (redraws & TIME_CLIPS)
+                               if ((redraws & TIME_CLIPS) || from_anim_edit)
                                        return 1;
                                break;
                                
@@ -3572,7 +3572,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
                                        if (ar == sad->ar) {
                                                redraw = true;
                                        }
-                                       else if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws)) {
+                                       else if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws, sad->from_anim_edit)) {
                                                redraw = true;
                                        }