Fix T53544: Undo in pose mode selects all fcurves
authorCampbell Barton <ideasman42@gmail.com>
Mon, 10 Dec 2018 01:30:41 +0000 (12:30 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 10 Dec 2018 01:30:41 +0000 (12:30 +1100)
source/blender/blenloader/intern/readfile.c
source/blender/editors/space_graph/space_graph.c
source/blender/makesdna/DNA_space_types.h

index ddbe855d03e59b7aa8e2243686fa8028bee68ee6..8d89620cdecfc73858894af931100ac90e73db4f 100644 (file)
@@ -6859,7 +6859,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                        /* force recalc of list of channels (i.e. includes calculating F-Curve colors)
                                         * thus preventing the "black curves" problem post-undo
                                         */
-                                       sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC;
+                                       sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR;
                                }
                                else if (sl->spacetype == SPACE_BUTS) {
                                        SpaceButs *sbuts = (SpaceButs *)sl;
index fead6efa2b54ad7e26d3dcad66e974007d2b9a68..3b476ff3645ebb9d8c135e9a8049f417b36e7d3c 100644 (file)
@@ -513,7 +513,7 @@ static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
                                ED_area_tag_redraw(sa);
                        break;
                case NC_WINDOW:
-                       if (sipo->runtime.flag & SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC) {
+                       if (sipo->runtime.flag & (SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC | SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR)) {
                                /* force redraw/refresh after undo/redo - prevents "black curve" problem */
                                ED_area_tag_refresh(sa);
                        }
@@ -676,6 +676,15 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
                ED_area_tag_redraw(sa);
        }
 
+       /* We could check 'SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR', but color is recalculated anyway. */
+       if (sipo->runtime.flag & SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR) {
+               sipo->runtime.flag &= ~SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR;
+#if 0  /* Done below. */
+               graph_refresh_fcurve_colors(C);
+#endif
+               ED_area_tag_redraw(sa);
+       }
+
        /* init/adjust F-Curve colors */
        graph_refresh_fcurve_colors(C);
 }
index 029f7a6fca93532448c40e9e550710b6397669ae..d85b962673508a5ea2a16739b7ef55631a8d8d6f 100644 (file)
@@ -407,6 +407,8 @@ typedef enum eGraphEdit_Mode {
 typedef enum eGraphEdit_Runtime_Flag {
        /** Temporary flag to force channel selections to be synced with main. */
        SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC        = (1 << 0),
+       /** Temporary flag to force fcurves to recalculate colors. */
+       SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR  = (1 << 1),
 } eGraphEdit_Runtime_Flag;
 
 /** \} */