Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2009-01-19 19:54:41 +0300
committerTon Roosendaal <ton@blender.org>2009-01-19 19:54:41 +0300
commitbc63213844e723b0c552da446fb7fa9f9e7ea5f6 (patch)
tree433519ee3526536032e62226a058f6ec4fd17a1a /source/blender/editors/screen/area.c
parent9b049d89a1bc36534875c67e097415e034d0624d (diff)
2.5
View3D has been split now in a local part (RegionView3D) and a per-area part (old View3D). Currently local is: - view transform - camera zoom/offset - gpencil (todo) - custom clipping planes Rest is in Area still, like active camera, draw type, layers, localview, custom centers, around-settings, transform widget, gridlines, and so on (mostly stuff as available in header). To see it work; also added new feature for region split, press SHIFT+ALT+CTRL+S for four-split. The idea is to make a preset 4-split, configured to stick to top/right/front views for three views. Another cool idea to explore is to then box-clip all drawing based on these 3 views. Note about the code: - currently view3d still stores some depricated settings, to convert from older files. Not all settings are copied over though, like custom clip planes or the 'lock view to object'. - since some view3d ops are now on area level, the operators for it should keep track of that. Bugfix in transform: quat initialize in operator-invoke missed one zero. Als brought back GE to compile for missing Ipos and channels.
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c63
1 files changed, 55 insertions, 8 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index d6235384e6e..4acbe360ab4 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -298,7 +298,7 @@ static int rct_fits(rcti *rect, char dir, int size)
}
}
-static void region_rect_recursive(ARegion *ar, rcti *remainder)
+static void region_rect_recursive(ARegion *ar, rcti *remainder, int quad)
{
int prefsizex, prefsizey;
@@ -307,7 +307,8 @@ static void region_rect_recursive(ARegion *ar, rcti *remainder)
/* clear state flags first */
ar->flag &= ~RGN_FLAG_TOO_SMALL;
- if(ar->next==NULL)
+ /* user errors */
+ if(ar->next==NULL && ar->alignment!=RGN_ALIGN_QSPLIT)
ar->alignment= RGN_ALIGN_NONE;
prefsizex= ar->type->minsizex;
@@ -372,7 +373,7 @@ static void region_rect_recursive(ARegion *ar, rcti *remainder)
}
}
}
- else {
+ else if(ar->alignment==RGN_ALIGN_VSPLIT || ar->alignment==RGN_ALIGN_HSPLIT) {
/* percentage subdiv*/
ar->winrct= *remainder;
@@ -395,11 +396,55 @@ static void region_rect_recursive(ARegion *ar, rcti *remainder)
}
}
}
+ else if(ar->alignment==RGN_ALIGN_QSPLIT) {
+ ar->winrct= *remainder;
+
+ /* test if there's still 4 regions left */
+ if(quad==0) {
+ ARegion *artest= ar->next;
+ int count= 1;
+
+ while(artest) {
+ artest->alignment= RGN_ALIGN_QSPLIT;
+ artest= artest->next;
+ count++;
+ }
+
+ if(count!=4) {
+ /* let's stop adding regions */
+ BLI_init_rcti(remainder, 0, 0, 0, 0);
+ printf("region quadsplit failed\n");
+ }
+ else quad= 1;
+ }
+ if(quad) {
+ if(quad==1) { /* left bottom */
+ ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
+ ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
+ }
+ else if(quad==2) { /* left top */
+ ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
+ ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
+ }
+ else if(quad==3) { /* right bottom */
+ ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
+ ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
+ }
+ else { /* right top */
+ ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
+ ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
+ BLI_init_rcti(remainder, 0, 0, 0, 0);
+ }
+
+ quad++;
+ }
+ }
+
/* for speedup */
ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
- region_rect_recursive(ar->next, remainder);
+ region_rect_recursive(ar->next, remainder, quad);
}
static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
@@ -508,14 +553,14 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
}
for(ar= sa->regionbase.first; ar; ar= ar->next)
- ar->type= ED_regiontype_from_id(sa->type, ar->regiontype);
+ ar->type= BKE_regiontype_from_id(sa->type, ar->regiontype);
/* area sizes */
area_calc_totrct(sa, win->sizex, win->sizey);
/* region rect sizes */
rect= sa->totrct;
- region_rect_recursive(sa->regionbase.first, &rect);
+ region_rect_recursive(sa->regionbase.first, &rect, 0);
/* default area handlers */
ed_default_handlers(wm, &sa->handlers, sa->type->keymapflag);
@@ -569,11 +614,13 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
BKE_spacedata_copylist(&sa1->spacedata, &sa2->spacedata);
}
- /* regions... XXX */
+ /* regions */
+ for(ar= sa1->regionbase.first; ar; ar= ar->next)
+ BKE_area_region_free(sa1->type, ar);
BLI_freelistN(&sa1->regionbase);
for(ar= sa2->regionbase.first; ar; ar= ar->next) {
- ARegion *newar= BKE_area_region_copy(ar);
+ ARegion *newar= BKE_area_region_copy(sa2->type, ar);
BLI_addtail(&sa1->regionbase, newar);
}