2.5: Fix timeline space redraw properties, these were not RNA wrapped
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 16 Aug 2009 23:37:46 +0000 (23:37 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 16 Aug 2009 23:37:46 +0000 (23:37 +0000)
correct, and were missing update. Also moved this update code to
screen_edit.c, next to the other animation play stuff.

source/blender/editors/include/ED_screen.h
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_time/time_header.c
source/blender/makesrna/intern/rna_space.c

index 0430a8cecac9e844bb173901044dcffdbe7353c9..6cb7593e07d6813b238a43140b15d648e6fef41c 100644 (file)
@@ -95,6 +95,7 @@ void  ED_screen_delete_scene(struct bContext *C, struct Scene *scene);
 void   ED_screen_set_subwinactive(struct wmWindow *win, struct wmEvent *event);
 void   ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
 void   ED_screen_animation_timer(struct bContext *C, int redraws, int sync, int enable);
+void   ED_screen_animation_timer_update(struct bContext *C, int redraws);
 int            ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
 void   ED_screen_full_prevspace(struct bContext *C);
 
index c85193553273fa130104017a34ba3a954e050533..96f5a9f1b6443fe9827138b9bef35c05c54165b8 100644 (file)
@@ -1541,6 +1541,45 @@ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable)
        WM_event_add_notifier(C, NC_SCREEN|ND_ANIMPLAY, screen);
 }
 
+/* helper for screen_animation_play() - only to be used for TimeLine */
+static ARegion *time_top_left_3dwindow(bScreen *screen)
+{
+       ARegion *aret= NULL;
+       ScrArea *sa;
+       int min= 10000;
+       
+       for(sa= screen->areabase.first; sa; sa= sa->next) {
+               if(sa->spacetype==SPACE_VIEW3D) {
+                       ARegion *ar;
+                       for(ar= sa->regionbase.first; ar; ar= ar->next) {
+                               if(ar->regiontype==RGN_TYPE_WINDOW) {
+                                       if(ar->winrct.xmin - ar->winrct.ymin < min) {
+                                               aret= ar;
+                                               min= ar->winrct.xmin - ar->winrct.ymin;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       return aret;
+}
+
+void ED_screen_animation_timer_update(bContext *C, int redraws)
+{
+       bScreen *screen= CTX_wm_screen(C);
+       
+       if(screen && screen->animtimer) {
+               wmTimer *wt= screen->animtimer;
+               ScreenAnimData *sad= wt->customdata;
+               
+               sad->redraws= redraws;
+               sad->ar= NULL;
+               if(redraws & TIME_REGION)
+                       sad->ar= time_top_left_3dwindow(screen);
+       }
+}
+
 unsigned int ED_screen_view3d_layers(bScreen *screen)
 {
        if(screen) {
index 922801b1ae74df8b5722009376e62de546220572..3318101dd991caaa803b9cd0823f163c44ed9f4c 100644 (file)
@@ -2323,30 +2323,6 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot)
 
 /* ****************** anim player, starts or ends timer ***************** */
 
-/* helper for screen_animation_play() - only to be used for TimeLine */
-ARegion *time_top_left_3dwindow(bScreen *screen)
-{
-       ARegion *aret= NULL;
-       ScrArea *sa;
-       int min= 10000;
-       
-       for(sa= screen->areabase.first; sa; sa= sa->next) {
-               if(sa->spacetype==SPACE_VIEW3D) {
-                       ARegion *ar;
-                       for(ar= sa->regionbase.first; ar; ar= ar->next) {
-                               if(ar->regiontype==RGN_TYPE_WINDOW) {
-                                       if(ar->winrct.xmin - ar->winrct.ymin < min) {
-                                               aret= ar;
-                                               min= ar->winrct.xmin - ar->winrct.ymin;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       return aret;
-}
-
 /* toggle operator */
 static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
 {
@@ -2371,12 +2347,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
                        ED_screen_animation_timer(C, stime->redraws, sync, mode);
                        
                        /* update region if TIME_REGION was set, to leftmost 3d window */
-                       if(screen->animtimer && (stime->redraws & TIME_REGION)) {
-                               wmTimer *wt= screen->animtimer;
-                               ScreenAnimData *sad= wt->customdata;
-                               
-                               sad->ar= time_top_left_3dwindow(screen);
-                       }
+                       ED_screen_animation_timer_update(C, stime->redraws);
                }
                else {
                        ED_screen_animation_timer(C, TIME_REGION|TIME_ALL_3D_WIN, sync, mode);
index 47010a9771251dabe297a09df55273f7f10b7dfb..13265166d98bbcc9269589b1e4af1cdd334bdaae 100644 (file)
 
 /* ************************ header time area region *********************** */
 
-/* exported for use in screen_ops.c */
-ARegion *time_top_left_3dwindow(bScreen *screen)
-{
-       ARegion *aret= NULL;
-       ScrArea *sa;
-       int min= 10000;
-       
-       for(sa= screen->areabase.first; sa; sa= sa->next) {
-               if(sa->spacetype==SPACE_VIEW3D) {
-                       ARegion *ar;
-                       for(ar= sa->regionbase.first; ar; ar= ar->next) {
-                               if(ar->regiontype==RGN_TYPE_WINDOW) {
-                                       if(ar->winrct.xmin - ar->winrct.ymin < min) {
-                                               aret= ar;
-                                               min= ar->winrct.xmin - ar->winrct.ymin;
-                                       }
-                               }
-                       }
-               }
-       }
-       return aret;
-}
-
-static void do_time_redrawmenu(bContext *C, void *arg, int event)
-{
-       
-       if(event < 1001) {
-               bScreen *screen= CTX_wm_screen(C);
-               SpaceTime *stime= CTX_wm_space_time(C);
-               
-               stime->redraws ^= event;
-               
-               if(screen->animtimer) {
-                       wmTimer *wt= screen->animtimer;
-                       ScreenAnimData *sad= wt->customdata;
-                       
-                       sad->redraws= stime->redraws;
-                       sad->ar= NULL;
-                       if(stime->redraws & TIME_REGION)
-                               sad->ar= time_top_left_3dwindow(screen);
-               }
-       }
-}
-
-
-static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-       ScrArea *curarea= CTX_wm_area(C);
-       SpaceTime *stime= CTX_wm_space_time(C);
-       uiBlock *block;
-       short yco= 0, menuwidth=120, icon;
-       
-       block= uiBeginBlock(C, ar, "header time_redrawmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_time_redrawmenu, NULL);
-       
-       if(stime->redraws & TIME_REGION) icon= ICON_CHECKBOX_HLT;
-       else icon= ICON_CHECKBOX_DEHLT;
-       uiDefIconTextBut(block, BUTM, 1, icon, "Top-Left 3D Window",     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_REGION, "");
-       
-       if(stime->redraws & TIME_ALL_3D_WIN) icon= ICON_CHECKBOX_HLT;
-       else icon= ICON_CHECKBOX_DEHLT;
-       uiDefIconTextBut(block, BUTM, 1, icon, "All 3D Windows",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_3D_WIN, "");
-       
-       if(stime->redraws & TIME_ALL_ANIM_WIN) icon= ICON_CHECKBOX_HLT;
-       else icon= ICON_CHECKBOX_DEHLT;
-       uiDefIconTextBut(block, BUTM, 1, icon, "Animation Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_ANIM_WIN, "");
-       
-       if(stime->redraws & TIME_ALL_BUTS_WIN) icon= ICON_CHECKBOX_HLT;
-       else icon= ICON_CHECKBOX_DEHLT;
-       uiDefIconTextBut(block, BUTM, 1, icon, "Buttons Windows",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_BUTS_WIN, "");
-       
-       if(stime->redraws & TIME_ALL_IMAGE_WIN) icon= ICON_CHECKBOX_HLT;
-       else icon= ICON_CHECKBOX_DEHLT;
-       uiDefIconTextBut(block, BUTM, 1, icon, "Image Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_IMAGE_WIN, "");
-       
-       /* Add sequencer only redraw*/
-       if(stime->redraws & TIME_SEQ) icon= ICON_CHECKBOX_HLT;
-       else icon= ICON_CHECKBOX_DEHLT;
-       uiDefIconTextBut(block, BUTM, 1, icon, "Sequencer Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_SEQ, "");
-       
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       if(stime->redraws & TIME_CONTINUE_PHYSICS) icon= ICON_CHECKBOX_HLT;
-       else icon= ICON_CHECKBOX_DEHLT;
-       uiDefIconTextBut(block, BUTM, 1, icon, "Continue Physics",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_CONTINUE_PHYSICS, "During playblack, continue physics simulations regardless of the frame number");
-       
-       if(curarea->headertype==HEADERTOP) {
-               uiBlockSetDirection(block, UI_DOWN);
-       }
-       else {
-               uiBlockSetDirection(block, UI_TOP);
-               uiBlockFlipOrder(block);
-       }
-       
-       uiTextBoundsBlock(block, 50);
-       uiEndBlock(C, block);
-       
-       return block;
-}
-
 static void do_time_viewmenu(bContext *C, void *arg, int event)
 {
        ScrArea *curarea= CTX_wm_area(C);
@@ -420,11 +320,6 @@ void time_header_buttons(const bContext *C, ARegion *ar)
                uiDefPulldownBut(block, time_framemenu, sa, 
                                                 "Frame", xco, yco, xmax-3, 20, "");
                xco+= xmax;
-               
-               xmax= GetButStringLength("Playback");
-               uiDefPulldownBut(block, time_redrawmenu, sa, 
-                                                "Playback", xco, yco, xmax-3, 20, "");
-               xco+= xmax;
        }
        
        uiBlockSetEmboss(block, UI_EMBOSS);
index 620816d3de66a1e6a6f706fecfa5268460c0d4ab..ab67af2ab0879980e998a1b431672bba49f7a0d3 100644 (file)
@@ -83,6 +83,7 @@ static EnumPropertyItem dc_all_items[] = {DC_RGB, DC_RGBA, DC_ALPHA, DC_Z, DC_LC
 #include "BKE_context.h"
 
 #include "ED_image.h"
+#include "ED_screen.h"
 
 #include "IMB_imbuf_types.h"
 
@@ -303,6 +304,13 @@ static void rna_View3D_display_background_image_set(PointerRNA *ptr, int value)
        }
 }
 
+/* Space Time */
+static void rna_SpaceTime_redraw_update(bContext *C, PointerRNA *ptr)
+{
+       SpaceTime *st= (SpaceTime*)ptr->data;
+       ED_screen_animation_timer_update(C, st->redraws);
+}
+
 #else
 
 static void rna_def_space(BlenderRNA *brna)
@@ -1116,33 +1124,39 @@ static void rna_def_space_time(BlenderRNA *brna)
        /* Define Anim Playback Areas */
        
        prop= RNA_def_property(srna, "play_top_left", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_REGION);
+       RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_REGION);
        RNA_def_property_ui_text(prop, "Top-Left 3D Window", "");
+       RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update");
        
        prop= RNA_def_property(srna, "play_all_3d", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_3D_WIN);
+       RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_3D_WIN);
        RNA_def_property_ui_text(prop, "All 3D Windows", "");
+       RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update");
        
        prop= RNA_def_property(srna, "play_anim", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_ANIM_WIN);
+       RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_ANIM_WIN);
        RNA_def_property_ui_text(prop, "Animation Windows", "");
+       RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update");
        
        prop= RNA_def_property(srna, "play_buttons", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_BUTS_WIN);
+       RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_BUTS_WIN);
        RNA_def_property_ui_text(prop, "Buttons Windows", "");
+       RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update");
        
        prop= RNA_def_property(srna, "play_image", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_IMAGE_WIN);
+       RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_IMAGE_WIN);
        RNA_def_property_ui_text(prop, "Image Windows", "");
+       RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update");
        
        prop= RNA_def_property(srna, "play_sequencer", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_SEQ);
+       RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_SEQ);
        RNA_def_property_ui_text(prop, "Sequencer Windows", "");
+       RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update");
        
        /* Other options */
        
        prop= RNA_def_property(srna, "continue_physics", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CONTINUE_PHYSICS);
+       RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_CONTINUE_PHYSICS);
        RNA_def_property_ui_text(prop, "Continue Physics", "During playblack, continue physics simulations regardless of the frame number");    
 }