[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19061] branches/blender2.5/blender/source /blender: 2.5

Ton Roosendaal ton at blender.org
Fri Feb 20 20:11:35 CET 2009


Revision: 19061
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19061
Author:   ton
Date:     2009-02-20 20:11:35 +0100 (Fri, 20 Feb 2009)

Log Message:
-----------
2.5

Graph Editor: added region for buttons (properties), so we can
check drivers again! Works like view3d, press NKEY. No buttons
there yet though... no time anymore today, it'll require some
RNA magic probably.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/screen/area.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_intern.h
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_ops.c
    branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_screen_types.h

Modified: branches/blender2.5/blender/source/blender/editors/screen/area.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/area.c	2009-02-20 18:36:27 UTC (rev 19060)
+++ branches/blender2.5/blender/source/blender/editors/screen/area.c	2009-02-20 19:11:35 UTC (rev 19061)
@@ -325,18 +325,27 @@
 
 static void region_rect_recursive(ARegion *ar, rcti *remainder, int quad)
 {
+	rcti *remainder_prev= remainder;
 	int prefsizex, prefsizey;
+	int alignment;
 	
 	if(ar==NULL)
 		return;
 	
 	BLI_init_rcti(&ar->winrct, 0, 0, 0, 0);
 	
+	/* for test; allow split of previously defined region */
+	if(ar->alignment & RGN_SPLIT_PREV)
+		if(ar->prev)
+			remainder= &ar->prev->winrct;
+	
+	alignment = ar->alignment & ~RGN_SPLIT_PREV;
+	
 	/* clear state flags first */
 	ar->flag &= ~RGN_FLAG_TOO_SMALL;
 	/* user errors */
-	if(ar->next==NULL && ar->alignment!=RGN_ALIGN_QSPLIT)
-		ar->alignment= RGN_ALIGN_NONE;
+	if(ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
+		alignment= RGN_ALIGN_NONE;
 	
 	prefsizex= ar->type->minsizex;
 	prefsizey= ar->type->minsizey;
@@ -344,17 +353,17 @@
 	/* hidden is user flag */
 	if(ar->flag & RGN_FLAG_HIDDEN);
 	/* XXX floating area region, not handled yet here */
-	else if(ar->alignment == RGN_ALIGN_FLOAT);
+	else if(alignment == RGN_ALIGN_FLOAT);
 	/* remainder is too small for any usage */
 	else if( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
 		ar->flag |= RGN_FLAG_TOO_SMALL;
 	}
-	else if(ar->alignment==RGN_ALIGN_NONE) {
+	else if(alignment==RGN_ALIGN_NONE) {
 		/* typically last region */
 		ar->winrct= *remainder;
 		BLI_init_rcti(remainder, 0, 0, 0, 0);
 	}
-	else if(ar->alignment==RGN_ALIGN_TOP || ar->alignment==RGN_ALIGN_BOTTOM) {
+	else if(alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
 		
 		if( rct_fits(remainder, 'v', prefsizey) < 0 ) {
 			ar->flag |= RGN_FLAG_TOO_SMALL;
@@ -367,7 +376,7 @@
 			
 			ar->winrct= *remainder;
 			
-			if(ar->alignment==RGN_ALIGN_TOP) {
+			if(alignment==RGN_ALIGN_TOP) {
 				ar->winrct.ymin= ar->winrct.ymax - prefsizey + 1;
 				remainder->ymax= ar->winrct.ymin - 1;
 			}
@@ -377,7 +386,7 @@
 			}
 		}
 	}
-	else if( ELEM4(ar->alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
+	else if( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
 		
 		if( rct_fits(remainder, 'h', prefsizex) < 0 ) {
 			ar->flag |= RGN_FLAG_TOO_SMALL;
@@ -390,23 +399,23 @@
 			
 			ar->winrct= *remainder;
 			
-			if(ELEM(ar->alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
+			if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
 				ar->winrct.xmin= ar->winrct.xmax - prefsizex + 1;
-				if(ar->alignment==RGN_ALIGN_RIGHT)
+				if(alignment==RGN_ALIGN_RIGHT)
 					remainder->xmax= ar->winrct.xmin - 1;
 			}
 			else {
 				ar->winrct.xmax= ar->winrct.xmin + prefsizex - 1;
-				if(ar->alignment==RGN_ALIGN_LEFT)
+				if(alignment==RGN_ALIGN_LEFT)
 					remainder->xmin= ar->winrct.xmax + 1;
 			}
 		}
 	}
-	else if(ar->alignment==RGN_ALIGN_VSPLIT || ar->alignment==RGN_ALIGN_HSPLIT) {
+	else if(alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
 		/* percentage subdiv*/
 		ar->winrct= *remainder;
 		
-		if(ar->alignment==RGN_ALIGN_HSPLIT) {
+		if(alignment==RGN_ALIGN_HSPLIT) {
 			if( rct_fits(remainder, 'h', prefsizex) > 4) {
 				ar->winrct.xmax= (remainder->xmin+remainder->xmax)/2;
 				remainder->xmin= ar->winrct.xmax+1;
@@ -425,7 +434,7 @@
 			}
 		}
 	}
-	else if(ar->alignment==RGN_ALIGN_QSPLIT) {
+	else if(alignment==RGN_ALIGN_QSPLIT) {
 		ar->winrct= *remainder;
 		
 		/* test if there's still 4 regions left */
@@ -473,6 +482,14 @@
 	ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
 	ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
 	
+	/* restore test exception */
+	if(ar->alignment & RGN_SPLIT_PREV) {
+		if(ar->prev) {
+			remainder= remainder_prev;
+			ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
+			ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
+		}
+	}
 	region_rect_recursive(ar->next, remainder, quad);
 }
 

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_intern.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_intern.h	2009-02-20 18:36:27 UTC (rev 19060)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_intern.h	2009-02-20 19:11:35 UTC (rev 19061)
@@ -25,28 +25,33 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef ED_IPO_INTERN_H
-#define ED_IPO_INTERN_H
+#ifndef ED_GRAPH_INTERN_H
+#define ED_GRAPH_INTERN_H
 
 struct bContext;
 struct wmWindowManager;
 struct bAnimContext;
 struct SpaceIpo;
+struct ScrArea;
 struct ARegion;
 
 /* internal exports only */
 
 /* ***************************************** */
+/* space_graph.c */
+struct ARegion *graph_has_buttons_region(struct ScrArea *sa);
+
+/* ***************************************** */
 /* ipo_draw.c */
 void graph_draw_channel_names(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
 void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
 
 /* ***************************************** */
-/* ipo_header.c */
+/* graph_header.c */
 void graph_header_buttons(const bContext *C, struct ARegion *ar);
 
 /* ***************************************** */
-/* ipo_select.c */
+/* graph_select.c */
 
 void GRAPHEDIT_OT_keyframes_deselectall(struct wmOperatorType *ot);
 void GRAPHEDIT_OT_keyframes_borderselect(struct wmOperatorType *ot);
@@ -70,7 +75,7 @@
 } eGraphKeys_ColumnSelect_Mode;
 
 /* ***************************************** */
-/* ipo_edit.c */
+/* graph_edit.c */
 
 void GRAPHEDIT_OT_set_previewrange(struct wmOperatorType *ot);
 void GRAPHEDIT_OT_view_all(struct wmOperatorType *ot);
@@ -114,10 +119,15 @@
 } eGraphKeys_Mirror_Mode;
 
 /* ***************************************** */
-/* ipo_ops.c */
+/* graph_buttons.c */
+void GRAPHEDIT_OT_properties(struct wmOperatorType *ot);
+void graph_region_buttons(const struct bContext *C, struct ARegion *ar);
+
+/* ***************************************** */
+/* graph_ops.c */
 void graphedit_keymap(struct wmWindowManager *wm);
 void graphedit_operatortypes(void);
 
 
-#endif /* ED_IPO_INTERN_H */
+#endif /* ED_GRAPH_INTERN_H */
 

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_ops.c	2009-02-20 18:36:27 UTC (rev 19060)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_ops.c	2009-02-20 19:11:35 UTC (rev 19061)
@@ -99,6 +99,7 @@
 	WM_operatortype_append(GRAPHEDIT_OT_view_togglehandles);
 	WM_operatortype_append(GRAPHEDIT_OT_set_previewrange);
 	WM_operatortype_append(GRAPHEDIT_OT_view_all);
+	WM_operatortype_append(GRAPHEDIT_OT_properties);
 	
 	/* keyframes */
 		/* selection */
@@ -199,6 +200,10 @@
 {
 	ListBase *keymap;
 	
+	/* keymap for all regions */
+	keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+	WM_keymap_add_item(keymap, "GRAPHEDIT_OT_properties", NKEY, KM_PRESS, 0, 0);
+
 	/* channels */
 	/* Channels are not directly handled by the Graph Editor module, but are inherited from the Animation module. 
 	 * All the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as these

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c	2009-02-20 18:36:27 UTC (rev 19060)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c	2009-02-20 19:11:35 UTC (rev 19061)
@@ -61,6 +61,36 @@
 
 #include "graph_intern.h"	// own include
 
+/* ******************** manage regions ********************* */
+
+ARegion *graph_has_buttons_region(ScrArea *sa)
+{
+	ARegion *ar, *arnew;
+	
+	for(ar= sa->regionbase.first; ar; ar= ar->next)
+		if(ar->regiontype==RGN_TYPE_UI)
+			return ar;
+	
+	/* add subdiv level; after channel */
+	for(ar= sa->regionbase.first; ar; ar= ar->next)
+		if(ar->regiontype==RGN_TYPE_CHANNELS)
+			break;
+	
+	/* is error! */
+	if(ar==NULL) return NULL;
+	
+	arnew= MEM_callocN(sizeof(ARegion), "buttons for view3d");
+	
+	BLI_insertlinkafter(&sa->regionbase, ar, arnew);
+	arnew->regiontype= RGN_TYPE_UI;
+	arnew->alignment= RGN_ALIGN_TOP|RGN_SPLIT_PREV;
+	
+	arnew->flag = RGN_FLAG_HIDDEN;
+	
+	return arnew;
+}
+
+
 /* ******************** default callbacks for ipo space ***************** */
 
 static SpaceLink *graph_new(const bContext *C)
@@ -94,6 +124,14 @@
 	
 	ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
 	
+	/* ui buttons */
+	ar= MEM_callocN(sizeof(ARegion), "main area for graphedit");
+	
+	BLI_addtail(&sipo->regionbase, ar);
+	ar->regiontype= RGN_TYPE_UI;
+	ar->alignment= RGN_ALIGN_TOP|RGN_SPLIT_PREV;
+	ar->flag = RGN_FLAG_HIDDEN;
+	
 	/* main area */
 	ar= MEM_callocN(sizeof(ARegion), "main area for graphedit");
 	
@@ -166,6 +204,8 @@
 	/* own keymap */
 	keymap= WM_keymap_listbase(wm, "GraphEdit Keys", SPACE_IPO, 0);	/* XXX weak? */
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+	keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
 static void graph_main_area_draw(const bContext *C, ARegion *ar)
@@ -229,6 +269,8 @@
 	/* own keymap */
 	keymap= WM_keymap_listbase(wm, "Animation_Channels", 0, 0);	/* XXX weak? */
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+	keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
 static void graph_channel_area_draw(const bContext *C, ARegion *ar)
@@ -288,6 +330,37 @@
 	UI_view2d_view_restore(C);
 }
 
+/* add handlers, stuff you only do once or on area/region changes */
+static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar)
+{
+	ListBase *keymap;
+	
+	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST_UI, ar->winx, ar->winy);
+
+	keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+}
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list