diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-04-19 19:44:57 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-04-20 19:54:41 +0300 |
commit | 729dab4e6616d5a9cb5d05d02c687115bac47bba (patch) | |
tree | 3065f1a1a09e82bcd451990d4db8fb1b5f6a4eb0 /source/blender/editors/space_sequencer/space_sequencer.c | |
parent | af6a6627984372b850aac3f3135946ee5c6cb33e (diff) |
Fix: Toggling preview range from timeline button didn't update animation editors
Most of these were missing the message bus stuff that now handles the update flushing.
Diffstat (limited to 'source/blender/editors/space_sequencer/space_sequencer.c')
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index da16ac5acaa..27eb3c56f95 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -53,6 +53,9 @@ #include "WM_api.h" #include "WM_types.h" +#include "WM_message.h" + +#include "RNA_access.h" #include "UI_interface.h" #include "UI_resources.h" @@ -533,6 +536,46 @@ static void sequencer_main_region_listener( } } +static void sequencer_main_region_message_subscribe( + const struct bContext *UNUSED(C), + struct WorkSpace *UNUSED(workspace), struct Scene *scene, + struct bScreen *screen, struct ScrArea *sa, struct ARegion *ar, + struct wmMsgBus *mbus) +{ + PointerRNA ptr; + RNA_pointer_create(&screen->id, &RNA_SpaceTimeline, sa->spacedata.first, &ptr); + + wmMsgSubscribeValue msg_sub_value_region_tag_redraw = { + .owner = ar, + .user_data = ar, + .notify = ED_region_do_msg_notify_tag_redraw, + }; + + /* Timeline depends on scene properties. */ + { + bool use_preview = (scene->r.flag & SCER_PRV_RANGE); + extern PropertyRNA rna_Scene_frame_start; + extern PropertyRNA rna_Scene_frame_end; + extern PropertyRNA rna_Scene_frame_preview_start; + extern PropertyRNA rna_Scene_frame_preview_end; + extern PropertyRNA rna_Scene_use_preview_range; + extern PropertyRNA rna_Scene_frame_current; + const PropertyRNA *props[] = { + use_preview ? &rna_Scene_frame_preview_start : &rna_Scene_frame_start, + use_preview ? &rna_Scene_frame_preview_end : &rna_Scene_frame_end, + &rna_Scene_use_preview_range, + &rna_Scene_frame_current, + }; + + PointerRNA idptr; + RNA_id_pointer_create(&scene->id, &idptr); + + for (int i = 0; i < ARRAY_SIZE(props); i++) { + WM_msg_subscribe_rna(mbus, &idptr, props[i], &msg_sub_value_region_tag_redraw, __func__); + } + } +} + /* *********************** header region ************************ */ /* add handlers, stuff you only do once or on area/region changes */ static void sequencer_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) @@ -743,6 +786,7 @@ void ED_spacetype_sequencer(void) art->init = sequencer_main_region_init; art->draw = sequencer_main_region_draw; art->listener = sequencer_main_region_listener; + art->message_subscribe = sequencer_main_region_message_subscribe; art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_MARKERS | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION; BLI_addhead(&st->regiontypes, art); |