From 9df2b6da3a718323dbe9431c5a4b43fc309fa4b9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 10 Dec 2018 11:46:36 +1100 Subject: DNA: add runtime struct to for graph & action editor Move struct members, no functional change --- source/blender/blenloader/intern/readfile.c | 6 +++--- source/blender/blenloader/intern/writefile.c | 6 +++--- source/blender/editors/space_action/space_action.c | 20 ++++++++++---------- source/blender/editors/space_graph/graph_draw.c | 4 ++-- source/blender/editors/space_graph/graph_edit.c | 10 +++++----- source/blender/editors/space_graph/space_graph.c | 19 ++++++++++--------- source/blender/makesdna/DNA_action_types.h | 16 ++++++++++++++-- source/blender/makesdna/DNA_space_types.h | 19 +++++++++++++++---- source/blender/makesrna/intern/rna_space.c | 4 ++-- 9 files changed, 64 insertions(+), 40 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 36221b7c60f..ddbe855d03e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -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->flag |= SIPO_TEMP_NEEDCHANSYNC; + sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC; } else if (sl->spacetype == SPACE_BUTS) { SpaceButs *sbuts = (SpaceButs *)sl; @@ -6890,7 +6890,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc /* force recalc of list of channels, potentially updating the active action * while we're at it (as it can only be updated that way) [#28962] */ - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; } else if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; @@ -7259,7 +7259,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) SpaceIpo *sipo = (SpaceIpo *)sl; sipo->ads = newdataadr(fd, sipo->ads); - BLI_listbase_clear(&sipo->ghostCurves); + BLI_listbase_clear(&sipo->runtime.ghost_curves); } else if (sl->spacetype == SPACE_NLA) { SpaceNla *snla = (SpaceNla *)sl; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 4f48318582a..baec40335b2 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2897,10 +2897,10 @@ static void write_screen(WriteData *wd, bScreen *sc) } else if (sl->spacetype == SPACE_IPO) { SpaceIpo *sipo = (SpaceIpo *)sl; - ListBase tmpGhosts = sipo->ghostCurves; + ListBase tmpGhosts = sipo->runtime.ghost_curves; /* temporarily disable ghost curves when saving */ - sipo->ghostCurves.first = sipo->ghostCurves.last = NULL; + BLI_listbase_clear(&sipo->runtime.ghost_curves); writestruct(wd, DATA, SpaceIpo, 1, sl); if (sipo->ads) { @@ -2908,7 +2908,7 @@ static void write_screen(WriteData *wd, bScreen *sc) } /* reenable ghost curves */ - sipo->ghostCurves = tmpGhosts; + sipo->runtime.ghost_curves = tmpGhosts; } else if (sl->spacetype == SPACE_BUTS) { writestruct(wd, DATA, SpaceButs, 1, sl); diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index a2fe129c819..58c43b386e3 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -170,7 +170,7 @@ static void action_free(SpaceLink *UNUSED(sl)) static void action_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceAction *saction = sa->spacedata.first; - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; } static SpaceLink *action_duplicate(SpaceLink *sl) @@ -413,7 +413,7 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); } else if (wmn->action == NA_SELECTED) { - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); } } @@ -421,7 +421,7 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) case NC_ANIMATION: /* for NLA tweakmode enter/exit, need complete refresh */ if (wmn->data == ND_NLA_ACTCHANGE) { - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); } /* autocolor only really needs to change when channels are added/removed, or previously hidden stuff appears @@ -443,7 +443,7 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_OB_SELECT: - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); break; @@ -456,7 +456,7 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_BONE_ACTIVE: - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); break; case ND_TRANSFORM: @@ -483,7 +483,7 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) case NC_NODE: if (wmn->action == NA_SELECTED) { /* selection changed, so force refresh to flush (needs flag set to do syncing) */ - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); } break; @@ -493,13 +493,13 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); break; case ND_SPACE_CHANGED: - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); break; } break; case NC_WINDOW: - if (saction->flag & SACTION_TEMP_NEEDCHANSYNC) { + if (saction->runtime.flag & SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC) { /* force redraw/refresh after undo/redo - [#28962] */ ED_area_tag_refresh(sa); } @@ -598,14 +598,14 @@ static void action_refresh(const bContext *C, ScrArea *sa) /* update the state of the animchannels in response to changes from the data they represent * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled */ - if (saction->flag & SACTION_TEMP_NEEDCHANSYNC) { + if (saction->runtime.flag & SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC) { ARegion *ar; /* Perform syncing of channel state incl. selection * Active action setting also occurs here (as part of anim channel filtering in anim_filter.c) */ ANIM_sync_animchannels_to_data(C); - saction->flag &= ~SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag &= ~SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; /* Tag everything for redraw * - Regions (such as header) need to be manually tagged for redraw too diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 6823a4343a7..2cbbeda4abf 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -932,8 +932,8 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - /* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */ - for (fcu = sipo->ghostCurves.first; fcu; fcu = fcu->next) { + /* the ghost curves are simply sampled F-Curves stored in sipo->runtime.ghost_curves */ + for (fcu = sipo->runtime.ghost_curves.first; fcu; fcu = fcu->next) { /* set whatever color the curve has set * - this is set by the function which creates these * - draw with a fixed opacity of 2 diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 3086e189a7a..cd00959e7d2 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -344,7 +344,7 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end) int filter; /* free existing ghost curves */ - free_fcurves(&sipo->ghostCurves); + free_fcurves(&sipo->runtime.ghost_curves); /* sanity check */ if (start >= end) { @@ -395,7 +395,7 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end) gcu->color[2] = fcu->color[2] - 0.07f; /* store new ghost curve */ - BLI_addtail(&sipo->ghostCurves, gcu); + BLI_addtail(&sipo->runtime.ghost_curves, gcu); /* restore driver */ fcu->driver = driver; @@ -462,11 +462,11 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)) sipo = (SpaceIpo *)ac.sl; /* if no ghost curves, don't do anything */ - if (BLI_listbase_is_empty(&sipo->ghostCurves)) + if (BLI_listbase_is_empty(&sipo->runtime.ghost_curves)) { return OPERATOR_CANCELLED; - + } /* free ghost curves */ - free_fcurves(&sipo->ghostCurves); + free_fcurves(&sipo->runtime.ghost_curves); /* update this editor only */ ED_area_tag_redraw(CTX_wm_area(C)); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index cfa42cab3e7..fead6efa2b5 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -173,8 +173,9 @@ static void graph_free(SpaceLink *sl) MEM_freeN(si->ads); } - if (si->ghostCurves.first) - free_fcurves(&si->ghostCurves); + if (si->runtime.ghost_curves.first) { + free_fcurves(&si->runtime.ghost_curves); + } } @@ -202,7 +203,7 @@ static SpaceLink *graph_duplicate(SpaceLink *sl) SpaceIpo *sipon = MEM_dupallocN(sl); /* clear or remove stuff from old */ - BLI_duplicatelist(&sipon->ghostCurves, &((SpaceIpo *)sl)->ghostCurves); + BLI_duplicatelist(&sipon->runtime.ghost_curves, &((SpaceIpo *)sl)->runtime.ghost_curves); sipon->ads = MEM_dupallocN(sipon->ads); return (SpaceLink *)sipon; @@ -476,7 +477,7 @@ static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_OB_SELECT: - sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; + sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); break; @@ -489,7 +490,7 @@ static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_BONE_ACTIVE: - sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; + sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); break; case ND_TRANSFORM: @@ -503,7 +504,7 @@ static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) case NC_NODE: if (wmn->action == NA_SELECTED) { /* selection changed, so force refresh to flush (needs flag set to do syncing) */ - sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; + sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); } break; @@ -512,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->flag & SIPO_TEMP_NEEDCHANSYNC) { + if (sipo->runtime.flag & SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC) { /* force redraw/refresh after undo/redo - prevents "black curve" problem */ ED_area_tag_refresh(sa); } @@ -669,9 +670,9 @@ static void graph_refresh(const bContext *C, ScrArea *sa) /* update the state of the animchannels in response to changes from the data they represent * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled */ - if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) { + if (sipo->runtime.flag & SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC) { ANIM_sync_animchannels_to_data(C); - sipo->flag &= ~SIPO_TEMP_NEEDCHANSYNC; + sipo->runtime.flag &= ~SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_redraw(sa); } diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index bcb92cccecd..aa39d53e62b 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -648,6 +648,11 @@ typedef enum eDopeSheet_Flag { +typedef struct SpaceAction_Runtime { + char flag; + char _pad0[7]; +} SpaceAction_Runtime; + /* Action Editor Space. This is defined here instead of in DNA_space_types.h */ typedef struct SpaceAction { struct SpaceLink *next, *prev; @@ -665,6 +670,8 @@ typedef struct SpaceAction { char mode, autosnap; /* mode: editing context; autosnap: automatic keyframe snapping mode */ short flag; /* flag: bitmapped settings; */ float timeslide; /* for Time-Slide transform mode drawing - current frame? */ + + SpaceAction_Runtime runtime; } SpaceAction; /* SpaceAction flag */ @@ -687,14 +694,19 @@ typedef enum eSAction_Flag { SACTION_NODRAWGCOLORS = (1 << 7), /* don't draw current frame number beside frame indicator */ SACTION_NODRAWCFRANUM = (1 << 8), - /* temporary flag to force channel selections to be synced with main */ - SACTION_TEMP_NEEDCHANSYNC = (1 << 9), /* don't perform realtime updates */ SACTION_NOREALTIMEUPDATES = (1 << 10), /* move markers as well as keyframes */ SACTION_MARKERS_MOVE = (1 << 11) } eSAction_Flag; + +/* SpaceAction_Runtime.flag */ +typedef enum eSAction_Runtime_Flag { + /** Temporary flag to force channel selections to be synced with main */ + SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC = (1 << 0), +} eSAction_Runtime_Flag; + /* SpaceAction Mode Settings */ typedef enum eAnimEdit_Context { /* action on the active object */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index e94364e8a65..029f7a6fca9 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -327,6 +327,14 @@ typedef enum eSpaceOutliner_Search_Flags { /** \name Graph Editor * \{ */ +typedef struct SpaceIpo_Runtime { + /** #eGraphEdit_Runtime_Flag */ + char flag; + char _pad[7]; + /** Sampled snapshots of F-Curves used as in-session guides */ + ListBase ghost_curves; +} SpaceIpo_Runtime; + /* 'Graph' Editor (formerly known as the IPO Editor) */ typedef struct SpaceIpo { SpaceLink *next, *prev; @@ -340,8 +348,6 @@ typedef struct SpaceIpo { struct bDopeSheet *ads; /* settings for filtering animation data (NOTE: we use a pointer due to code-linking issues) */ - ListBase ghostCurves; /* sampled snapshots of F-Curves used as in-session guides */ - short mode; /* mode for the Graph editor (eGraphEdit_Mode) */ short autosnap; /* time-transform autosnapping settings for Graph editor (eAnimEdit_AutoSnap in DNA_action_types.h) */ int flag; /* settings for Graph editor (eGraphEdit_Flag) */ @@ -350,6 +356,8 @@ typedef struct SpaceIpo { float cursorVal; /* cursor value (y-value, x-value is current frame) */ int around; /* pivot point for transforms */ int pad; + + SpaceIpo_Runtime runtime; } SpaceIpo; @@ -377,8 +385,6 @@ typedef enum eGraphEdit_Flag { SIPO_NODRAWCURSOR = (1 << 8), /* only show handles of selected keyframes */ SIPO_SELVHANDLESONLY = (1 << 9), - /* temporary flag to force channel selections to be synced with main */ - SIPO_TEMP_NEEDCHANSYNC = (1 << 10), /* don't perform realtime updates */ SIPO_NOREALTIMEUPDATES = (1 << 11), /* don't draw curves with AA ("beauty-draw") for performance */ @@ -398,6 +404,11 @@ typedef enum eGraphEdit_Mode { SIPO_MODE_DRIVERS = 1, } 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), +} eGraphEdit_Runtime_Flag; + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 987f94c5238..469acc783c3 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1385,7 +1385,7 @@ static void rna_SpaceDopeSheetEditor_mode_update(Main *UNUSED(bmain), Scene *sce } /* recalculate extents of channel list */ - saction->flag |= SACTION_TEMP_NEEDCHANSYNC; + saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; } /* Space Graph Editor */ @@ -1403,7 +1403,7 @@ static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene static bool rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr) { SpaceIpo *sipo = (SpaceIpo *)(ptr->data); - return (BLI_listbase_is_empty(&sipo->ghostCurves) == false); + return (BLI_listbase_is_empty(&sipo->runtime.ghost_curves) == false); } static void rna_SpaceConsole_rect_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -- cgit v1.2.3