[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59768] branches/soc-2013-ui_replay/source /blender: The operator redo panel is in its old place again.

Vincent Akkermans vincent at ack-err.net
Tue Sep 3 13:41:18 CEST 2013


Revision: 59768
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59768
Author:   ack-err
Date:     2013-09-03 11:41:18 +0000 (Tue, 03 Sep 2013)
Log Message:
-----------
The operator redo panel is in its old place again. The size of it's region is automatically adjusted.

Modified Paths:
--------------
    branches/soc-2013-ui_replay/source/blender/blenloader/intern/readfile.c
    branches/soc-2013-ui_replay/source/blender/editors/screen/area.c
    branches/soc-2013-ui_replay/source/blender/editors/space_view3d/space_view3d.c

Modified: branches/soc-2013-ui_replay/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/blenloader/intern/readfile.c	2013-09-03 11:37:47 UTC (rev 59767)
+++ branches/soc-2013-ui_replay/source/blender/blenloader/intern/readfile.c	2013-09-03 11:41:18 UTC (rev 59768)
@@ -9560,72 +9560,6 @@
 		}
 	}
 	
-	/* Remove the tool properties region from the space and clip toolbars.
-	 N.B. not at all sure that this is where these regions are supposed to be removed.
-	 */
-	
-	if (MAIN_VERSION_OLDER(main, 268, 3)) {
-		bScreen *sc;
-		
-		for (sc = main->screen.first; sc; sc = sc->id.next) {
-			ScrArea *sa;
-			for (sa = sc->areabase.first; sa; sa = sa->next) {
-				SpaceLink *sl;
-				ARegion *ar;
-				
-				for (ar = sa->regionbase.first; ar; ar = ar->next) {
-					if (ar->regiontype == RGN_TYPE_TOOL_PROPS) {
-						BLI_remlink(&sa->regionbase, ar);
-						BKE_area_region_free(NULL, ar);
-						MEM_freeN(ar);
-					}
-				}
-				
-				for (sl = sa->spacedata.first; sl; sl = sl->next) {
-					for (ar = sl->regionbase.first; ar; ar = ar->next) {
-						if (ar->regiontype == RGN_TYPE_TOOL_PROPS) {
-							BLI_remlink(&sl->regionbase, ar);
-							BKE_area_region_free(NULL, ar);
-							MEM_freeN(ar);
-						}
-					}
-				}
-			}
-		}
-		
-		for (sc = main->screen.first; sc; sc = sc->id.next) {
-			ScrArea *sa;
-			for (sa = sc->areabase.first; sa; sa = sa->next) {
-				SpaceLink *sl;
-				ARegion *ar;
-				ARegion *wr;
-				
-				// TODO: also add other spacetypes that should have tool props
-				if (sa->spacetype == SPACE_VIEW3D) {
-				
-					wr = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-					
-					ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
-					ar->alignment = RGN_ALIGN_FLOAT;
-					ar->regiontype = RGN_TYPE_TOOL_PROPS;
-					BLI_insertlinkafter(&sa->regionbase, wr, ar);
-				}
-				
-				for (sl = sa->spacedata.first; sl; sl = sl->next) {
-					if (sl->spacetype == SPACE_VIEW3D) {
-						
-						wr = BKE_spacelink_find_region_type(sl, RGN_TYPE_WINDOW);
-						
-						ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
-						ar->alignment = RGN_ALIGN_FLOAT;
-						ar->regiontype = RGN_TYPE_TOOL_PROPS;
-						BLI_insertlinkafter(&sl->regionbase, wr, ar);
-					}
-				}
-			}
-		}
-	}
-	
 	// TODO: what is the right version here?
 	if (MAIN_VERSION_OLDER(main, 268, 3)) {
 		bScreen *sc;

Modified: branches/soc-2013-ui_replay/source/blender/editors/screen/area.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/screen/area.c	2013-09-03 11:37:47 UTC (rev 59767)
+++ branches/soc-2013-ui_replay/source/blender/editors/screen/area.c	2013-09-03 11:41:18 UTC (rev 59768)
@@ -959,50 +959,14 @@
 	if (ar->regiontype == RGN_TYPE_HEADER || ar->regiontype == RGN_TYPE_MENU_BAR) {
 		prefsizey = ED_area_headersize();
 	}
-//	else if (ar->regiontype == RGN_TYPE_MENU_BAR) {
-//		/* quantize sizey to once or twice the headysize */
-//		int headersize = ED_area_headersize();
-//		if (ar->sizey > 0 && ar->sizey <= headersize)
-//			prefsizey = headersize;
-//		else if (ar->sizey > headersize)
-//			prefsizey = 2 * headersize;
-//	}
 	else if (ar->regiontype == RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
 		prefsizey = UI_UNIT_Y * 2 + (UI_UNIT_Y / 2);
 	}
 	else {
 		prefsizey = UI_DPI_FAC * (ar->sizey > 1 ? ar->sizey + 0.5f : ar->type->prefsizey);
 	}
-
-
-	if (alignment == RGN_ALIGN_FLOAT && ar->regiontype == RGN_TYPE_TOOL_PROPS) {
-		/* special case for floating tool properties regions */
-		Panel *pa = NULL;
-		ARegion *mw = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-		
-		for (pa = ar->panels.first; pa; pa = pa->next) {
-			// TODO: is there a better way to test for the identity of a panel type?
-			if (pa->type && strcmp(pa->type->idname, "VIEW3D_PT_last_operator") == 0) {
-				break;
-			}
-		}
-
-		ar->winrct.xmax = mw->winrct.xmax;
-		ar->winrct.xmin = mw->winrct.xmax - (ar->type ? ar->type->prefsizex : 160);
-		ar->winrct.ymin = mw->winrct.ymin;
-		
-		if (pa && !uiPanelClosed(pa)) {
-			// TODO: This is the previous panel size...
-			ar->winrct.ymax = ar->winrct.ymin + pa->sizey + 26;
-		}
-		else {
-			ar->winrct.ymax = ar->winrct.ymin + 26;
-		}
-		
-		if (!BLI_rcti_inside_rcti(&mw->winrct, &ar->winrct))
-			ar->flag |= RGN_FLAG_TOO_SMALL;
-	}
-	else if (ar->flag & RGN_FLAG_HIDDEN) {
+	
+	if (ar->flag & RGN_FLAG_HIDDEN) {
 		/* hidden is user flag */
 	}
 	else if (rct_fits(remainder, 'v', 1) < 0 || rct_fits(remainder, 'h', 1) < 0) {
@@ -1016,6 +980,19 @@
 	}
 	else if (alignment == RGN_ALIGN_TOP || alignment == RGN_ALIGN_BOTTOM) {
 		
+		if (ar->regiontype == RGN_TYPE_TOOL_PROPS) {
+			
+			Panel *pa = NULL;
+			for (pa = ar->panels.first; pa; pa = pa->next) {
+				// TODO: is there a better way to test for the identity of a panel type?
+				if (pa->type && strcmp(pa->type->idname, "VIEW3D_PT_last_operator") == 0) {
+					break;
+				}
+			}
+			
+			prefsizey = ((pa && !uiPanelClosed(pa)) ? pa->sizey : 0) + 26;
+		}
+		
 		if (rct_fits(remainder, 'v', prefsizey) < 0) {
 			ar->flag |= RGN_FLAG_TOO_SMALL;
 		}

Modified: branches/soc-2013-ui_replay/source/blender/editors/space_view3d/space_view3d.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/space_view3d/space_view3d.c	2013-09-03 11:37:47 UTC (rev 59767)
+++ branches/soc-2013-ui_replay/source/blender/editors/space_view3d/space_view3d.c	2013-09-03 11:41:18 UTC (rev 59768)
@@ -58,6 +58,7 @@
 #include "GPU_material.h"
 
 #include "BIF_gl.h"
+#include "BIF_glutil.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -310,6 +311,13 @@
 	ar->regiontype = RGN_TYPE_TOOLS;
 	ar->alignment = RGN_ALIGN_LEFT;
 	
+	/* tool props, floating and therefore last! */
+	ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
+	
+	BLI_addtail(&v3d->regionbase, ar);
+	ar->regiontype = RGN_TYPE_TOOL_PROPS;
+	ar->alignment = RGN_SPLIT_PREV | RGN_ALIGN_BOTTOM;
+	
 	/* object properties sidebar right */
 	ar = MEM_callocN(sizeof(ARegion), "buttons for view3d");
 	
@@ -331,13 +339,6 @@
 	rv3d->view = RV3D_VIEW_PERSPORTHO;
 	rv3d->dist = 10.0;
 	
-	/* tool props, floating and therefore last! */
-	ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
-	
-	BLI_addtail(&v3d->regionbase, ar);
-	ar->regiontype = RGN_TYPE_TOOL_PROPS;
-	ar->alignment = RGN_ALIGN_FLOAT;
-
 	return (SpaceLink *)v3d;
 }
 
@@ -1182,7 +1183,6 @@
 	return sum;
 }
 
-
 static void view3d_props_area_draw(const bContext *C, ARegion *ar)
 {
 	/* If in laying out and redrawing the panels this area contains we find that the
@@ -1190,8 +1190,16 @@
 	 * is automatically adapted. If  */
 	int total_panel_height = view3d_props_sum_panel_heights(ar);
 	
+	/* firstly, draw a clear divider */
 	ED_region_panels(C, ar, 1, CTX_data_mode_string(C), -1);
 	
+	glEnable(GL_BLEND);
+	
+	glColor4ub(0, 0, 0, 200);
+	fdrawline(0, BLI_rcti_size_y(&ar->winrct)+1, BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct)+1);
+	glColor4ub(255, 255, 255, 30);
+	fdrawline(0, BLI_rcti_size_y(&ar->winrct), BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct));
+	
 	if (total_panel_height != view3d_props_sum_panel_heights(ar)) {
 		ED_area_tag_redraw(CTX_wm_area(C));
 		CTX_wm_screen(C)->do_refresh = TRUE;




More information about the Bf-blender-cvs mailing list