diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py index 3873dc11d96..8d2eb811fe8 100644 --- a/release/scripts/ui/space_time.py +++ b/release/scripts/ui/space_time.py @@ -168,16 +168,16 @@ class TIME_MT_playback(bpy.types.Menu): def draw(self, context): layout = self.layout - st = context.space_data + screen = context.screen scene = context.scene - layout.prop(st, "use_play_top_left_3d_editor") - layout.prop(st, "use_play_3d_editors") - layout.prop(st, "use_play_animation_editors") - layout.prop(st, "use_play_properties_editors") - layout.prop(st, "use_play_image_editors") - layout.prop(st, "use_play_sequence_editors") - layout.prop(st, "use_play_node_editors") + layout.prop(screen, "use_play_top_left_3d_editor") + layout.prop(screen, "use_play_3d_editors") + layout.prop(screen, "use_play_animation_editors") + layout.prop(screen, "use_play_properties_editors") + layout.prop(screen, "use_play_image_editors") + layout.prop(screen, "use_play_sequence_editors") + layout.prop(screen, "use_play_node_editors") layout.separator() diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b56ab4a8e00..069d85f9bda 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11249,13 +11249,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - - /* put compatibility code here until next subversion bump */ - { - /* Fix for sample line scope initializing with no height */ + if (main->versionfile < 256) { bScreen *sc; ScrArea *sa; + Key *key; + + /* Fix for sample line scope initializing with no height */ for(sc= main->screen.first; sc; sc= sc->id.next) { sa= sc->areabase.first; while(sa) { @@ -11270,10 +11270,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sa= sa->next; } } - } - - { - Key *key; /* old files could have been saved with slidermin = slidermax = 0.0, but the UI in * 2.4x would never reveal this to users as a dummy value always ended up getting used @@ -11288,6 +11284,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + + /* put compatibility code here until next subversion bump */ + + { + bScreen *sc; + + /* redraws flag in SpaceTime has been moved to Screen level */ + for (sc = main->screen.first; sc; sc= sc->id.next) { + if (sc->redraws_flag == 0) { + /* just initialise to default? */ + // XXX: we could also have iterated through areas, and taken them from the first timeline available... + sc->redraws_flag = TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN; + } + } + } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 2963062cdd6..6d36daa854c 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -2467,7 +2467,7 @@ static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim /* dopesheet summary * - only for drawing and/or selecting keyframes in channels, but not for real editing - * - only useful for DopeSheet Editor, where the summary is useful + * - only useful for DopeSheet/Action/etc. editors where it is actually useful */ // TODO: we should really check if some other prohibited filters are also active, but that can be for later if ((filter_mode & ANIMFILTER_CHANNELS) && (ads->filterflag & ADS_FILTER_SUMMARY)) { @@ -2568,7 +2568,8 @@ int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode switch (datatype) { case ANIMCONT_ACTION: /* 'Action Editor' */ { - bDopeSheet *ads = ((ac->sa) && (ac->sa->spacetype==SPACE_ACTION)) ? &((SpaceAction*)ac->sa->spacedata.first)->ads : NULL; + SpaceAction *saction = (SpaceAction *)ac->sa->spacedata.first; + bDopeSheet *ads = (saction)? &saction->ads : NULL; /* the check for the DopeSheet summary is included here since the summary works here too */ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 9a11dfaa342..65ccadacf3c 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -418,6 +418,7 @@ bScreen *ED_screen_add(wmWindow *win, Scene *scene, const char *name) sc= alloc_libblock(&G.main->screen, ID_SCR, name); sc->scene= scene; sc->do_refresh= 1; + sc->redraws_flag= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN; sc->winid= win->winid; sv1= screen_addvert(sc, 0, 0); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 1c203b2dd1f..5a1ba01c4e3 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2696,36 +2696,18 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) } else { ScrArea *sa= CTX_wm_area(C); - int refresh= SPACE_TIME; + int refresh= SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */ if (mode == 1) // XXX only play audio forwards!? sound_play_scene(scene); - /* timeline gets special treatment since it has it's own menu for determining redraws */ - if ((sa) && (sa->spacetype == SPACE_TIME)) { - SpaceTime *stime= (SpaceTime *)sa->spacedata.first; + ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode); + + if (screen->animtimer) { + wmTimer *wt= screen->animtimer; + ScreenAnimData *sad= wt->customdata; - ED_screen_animation_timer(C, stime->redraws, refresh, sync, mode); - - /* update region if TIME_REGION was set, to leftmost 3d window */ - ED_screen_animation_timer_update(screen, stime->redraws, refresh); - } - else { - int redraws = TIME_REGION|TIME_ALL_3D_WIN; - - /* XXX - would like a better way to deal with this situation - Campbell */ - if ((!sa) || (sa->spacetype == SPACE_SEQ)) { - redraws |= TIME_SEQ; - } - - ED_screen_animation_timer(C, redraws, refresh, sync, mode); - - if(screen->animtimer) { - wmTimer *wt= screen->animtimer; - ScreenAnimData *sad= wt->customdata; - - sad->ar= CTX_wm_region(C); - } + sad->ar= CTX_wm_region(C); } } @@ -2763,7 +2745,7 @@ static int screen_animation_cancel_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *screen= CTX_wm_screen(C); - if(screen->animtimer) { + if (screen->animtimer) { ScreenAnimData *sad= screen->animtimer->customdata; Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 8a692a60777..f05cb860d6f 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -569,7 +569,7 @@ static SpaceLink *time_new(const bContext *C) stime= MEM_callocN(sizeof(SpaceTime), "inittime"); stime->spacetype= SPACE_TIME; - stime->redraws= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN; + stime->redraws= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN; // XXX: depreceated stime->flag |= TIME_DRAWFRAMES; /* header */ diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 606c69e693e..52d8b2e8dd9 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -54,6 +54,9 @@ typedef struct bScreen { struct Scene *scene; struct Scene *newscene; /* temporary when switching */ + int redraws_flag; /* user-setting for which editors get redrawn during anim playback (used to be time->redraws) */ + int pad1; + short full; /* temp screen for image render display or fileselect */ short temp; /* temp screen in a temp window, don't save (like user prefs) */ short winid; /* winid from WM, starts with 1 */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index e2b61020868..49a4df043fb 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -372,7 +372,7 @@ typedef struct SpaceTime { ListBase caches; int cache_display, pad; - int flag, redraws; + int flag, redraws; /* redraws is deprecated... moved to screen */ } SpaceTime; @@ -863,7 +863,7 @@ enum { /* only keyframes from active/selected channels get shown */ #define TIME_ONLYACTSEL 4 -/* time->redraws */ +/* time->redraws (now screen->redraws_flag) */ #define TIME_REGION 1 #define TIME_ALL_3D_WIN 2 #define TIME_ALL_ANIM_WIN 4 diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index f3f8db6fb39..02eadbcdaad 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -46,12 +46,12 @@ EnumPropertyItem region_type_items[] = { #include "ED_screen.h" -#ifdef RNA_RUNTIME - - #include "WM_api.h" #include "WM_types.h" +#ifdef RNA_RUNTIME + + static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value) { bScreen *sc= (bScreen*)ptr->data; @@ -74,6 +74,15 @@ static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr) } } +static void rna_Screen_redraw_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bScreen *screen= (bScreen*)ptr->data; + + /* the settings for this are currently only available from a menu in the TimeLine, hence refresh=SPACE_TIME */ + ED_screen_animation_timer_update(screen, screen->redraws_flag, SPACE_TIME); +} + + static int rna_Screen_is_animation_playing_get(PointerRNA *ptr) { bScreen *sc= (bScreen*)ptr->data; @@ -189,6 +198,7 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Screen", "Screen datablock, defining the layout of areas in a window"); RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN); + /* pointers */ prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL); RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL, NULL); @@ -196,11 +206,13 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_Screen_scene_update"); + /* collections */ prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL); RNA_def_property_struct_type(prop, "Area"); RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into"); - + + /* readonly status indicators */ prop= RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL); @@ -210,6 +222,42 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL); RNA_def_property_ui_text(prop, "Fullscreen", "An area is maximised, filling this screen"); + + /* Define Anim Playback Areas */ + prop= RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION); + RNA_def_property_ui_text(prop, "Top-Left 3D Editor", ""); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update"); + + prop= RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN); + RNA_def_property_ui_text(prop, "All 3D View Editors", ""); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update"); + + prop= RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN); + RNA_def_property_ui_text(prop, "Animation Editors", ""); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update"); + + prop= RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN); + RNA_def_property_ui_text(prop, "Property Editors", ""); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update"); + + prop= RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN); + RNA_def_property_ui_text(prop, "Image Editors", ""); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update"); + + prop= RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ); + RNA_def_property_ui_text(prop, "Sequencer Editors", ""); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update"); + + prop= RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES); + RNA_def_property_ui_text(prop, "Node Editors", ""); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update"); } void RNA_def_screen(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index a085b52af46..45622f500df 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -630,16 +630,6 @@ static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *m *max= ci->len; } -/* Space Time */ - -static void rna_SpaceTime_redraw_update(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - SpaceTime *st= (SpaceTime*)ptr->data; - bScreen *screen= (bScreen*)ptr->id.data; - - ED_screen_animation_timer_update(screen, st->redraws, SPACE_TIME); -} - /* Space Dopesheet */ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA value) @@ -1933,43 +1923,7 @@ static void rna_def_space_time(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceTime"); RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data"); - /* Define Anim Playback Areas */ - prop= RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_REGION); - RNA_def_property_ui_text(prop, "Top-Left 3D Editor", ""); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_SpaceTime_redraw_update"); - - prop= RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_3D_WIN); - RNA_def_property_ui_text(prop, "All 3D View Editors", ""); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_SpaceTime_redraw_update"); - - prop= RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_ANIM_WIN); - RNA_def_property_ui_text(prop, "Animation Editors", ""); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_SpaceTime_redraw_update"); - - prop= RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_BUTS_WIN); - RNA_def_property_ui_text(prop, "Property Editors", ""); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_SpaceTime_redraw_update"); - - prop= RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_IMAGE_WIN); - RNA_def_property_ui_text(prop, "Image Editors", ""); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_SpaceTime_redraw_update"); - - prop= RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_SEQ); - RNA_def_property_ui_text(prop, "Sequencer Editors", ""); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_SpaceTime_redraw_update"); - - prop= RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_NODES); - RNA_def_property_ui_text(prop, "Node Editors", ""); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_SpaceTime_redraw_update"); - - /* Other options */ + /* view settings */ prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL); RNA_def_property_ui_text(prop, "Only Selected channels", "Show keyframes for active Object and/or its selected channels only");