[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22543] branches/blender2.5/blender/source /blender: 2.5: Fix timeline space redraw properties, these were not RNA wrapped

Brecht Van Lommel brecht at blender.org
Mon Aug 17 01:37:47 CEST 2009


Revision: 22543
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22543
Author:   blendix
Date:     2009-08-17 01:37:46 +0200 (Mon, 17 Aug 2009)

Log Message:
-----------
2.5: Fix timeline space redraw properties, these were not RNA wrapped
correct, and were missing update. Also moved this update code to
screen_edit.c, next to the other animation play stuff.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
    branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
    branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
    branches/blender2.5/blender/source/blender/editors/space_time/time_header.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_screen.h	2009-08-16 23:06:16 UTC (rev 22542)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_screen.h	2009-08-16 23:37:46 UTC (rev 22543)
@@ -95,6 +95,7 @@
 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);
 

Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c	2009-08-16 23:06:16 UTC (rev 22542)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c	2009-08-16 23:37:46 UTC (rev 22543)
@@ -1541,6 +1541,45 @@
 	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) {

Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c	2009-08-16 23:06:16 UTC (rev 22542)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c	2009-08-16 23:37:46 UTC (rev 22543)
@@ -2323,30 +2323,6 @@
 
 /* ****************** 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 @@
 			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);

Modified: branches/blender2.5/blender/source/blender/editors/space_time/time_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_time/time_header.c	2009-08-16 23:06:16 UTC (rev 22542)
+++ branches/blender2.5/blender/source/blender/editors/space_time/time_header.c	2009-08-16 23:37:46 UTC (rev 22543)
@@ -69,106 +69,6 @@
 
 /* ************************ 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 @@
 		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);

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c	2009-08-16 23:06:16 UTC (rev 22542)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c	2009-08-16 23:37:46 UTC (rev 22543)
@@ -83,6 +83,7 @@
 #include "BKE_context.h"
 
 #include "ED_image.h"
+#include "ED_screen.h"
 
 #include "IMB_imbuf_types.h"
 
@@ -303,6 +304,13 @@
 	}
 }
 
+/* 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 @@
 	/* 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");
 	

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list