diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-19 19:54:41 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-19 19:54:41 +0300 |
commit | bc63213844e723b0c552da446fb7fa9f9e7ea5f6 (patch) | |
tree | 433519ee3526536032e62226a058f6ec4fd17a1a /source/blender/blenkernel | |
parent | 9b049d89a1bc36534875c67e097415e034d0624d (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/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_context.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/context.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 72 |
5 files changed, 66 insertions, 29 deletions
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 7d6542ada08..160736d4a94 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -45,6 +45,8 @@ struct ReportList; struct Scene; struct ScrArea; struct SpaceLink; +struct View3D; +struct RegionView3D; struct StructRNA; struct ToolSettings; struct Image; @@ -96,6 +98,7 @@ struct bScreen *CTX_wm_screen(const bContext *C); struct ScrArea *CTX_wm_area(const bContext *C); struct SpaceLink *CTX_wm_space_data(const bContext *C); struct View3D *CTX_wm_view3d(const bContext *C); +struct RegionView3D *CTX_wm_region_view3d(const bContext *C); struct ARegion *CTX_wm_region(const bContext *C); void *CTX_wm_region_data(const bContext *C); struct uiBlock *CTX_wm_ui_block(const bContext *C); diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 7604dc8170b..a2e9329a18a 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -105,6 +105,10 @@ typedef struct ARegionType { void (*free)(struct ARegion *); + /* split region, copy data optionally */ + void *(*duplicate)(void *); + + /* register operator types on startup */ void (*operatortypes)(void); /* add own items to keymap */ @@ -127,6 +131,7 @@ typedef struct ARegionType { /* spacetypes */ struct SpaceType *BKE_spacetype_from_id(int spaceid); +struct ARegionType *BKE_regiontype_from_id(struct SpaceType *st, int regionid); const struct ListBase *BKE_spacetypes_list(void); void BKE_spacetype_register(struct SpaceType *st); void BKE_spacetypes_free(void); /* only for quitting blender */ @@ -136,8 +141,8 @@ void BKE_spacedata_freelist(ListBase *lb); void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2); /* area/regions */ -struct ARegion *BKE_area_region_copy(struct ARegion *ar); -void BKE_area_region_free(struct ARegion *ar); +struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar); +void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar); void BKE_screen_area_free(struct ScrArea *sa); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 1fd569e1081..81712acee5c 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -171,6 +171,13 @@ View3D *CTX_wm_view3d(const bContext *C) return NULL; } +RegionView3D *CTX_wm_region_view3d(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D) + if(C->wm.region) + return C->wm.region->regiondata; + return NULL; +} ARegion *CTX_wm_region(const bContext *C) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 8b3f495e495..2718981e398 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -546,11 +546,11 @@ void unlink_object(Scene *scene, Object *ob) if(v3d->camera==ob) { v3d->camera= NULL; - if(v3d->persp==V3D_CAMOB) v3d->persp= V3D_PERSP; + // XXX if(v3d->persp==V3D_CAMOB) v3d->persp= V3D_PERSP; } if(v3d->localvd && v3d->localvd->camera==ob ) { v3d->localvd->camera= NULL; - if(v3d->localvd->persp==V3D_CAMOB) v3d->localvd->persp= V3D_PERSP; + // XXX if(v3d->localvd->persp==V3D_CAMOB) v3d->localvd->persp= V3D_PERSP; } } else if(sl->spacetype==SPACE_OOPS) { diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index fd15c69e775..a596827f470 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -82,6 +82,19 @@ SpaceType *BKE_spacetype_from_id(int spaceid) return NULL; } +ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid) +{ + ARegionType *art; + + for(art= st->regiontypes.first; art; art= art->next) + if(art->regionid==regionid) + return art; + + printf("Error, region type missing in %s\n", st->name); + return st->regiontypes.first; +} + + const ListBase *BKE_spacetypes_list() { return &spacetypes; @@ -113,9 +126,9 @@ void BKE_spacedata_freelist(ListBase *lb) SpaceType *st= BKE_spacetype_from_id(sl->spacetype); /* free regions for pushed spaces */ - for(ar=sl->regionbase.first; ar; ar=ar->next) { - BKE_area_region_free(ar); - } + for(ar=sl->regionbase.first; ar; ar=ar->next) + BKE_area_region_free(st, ar); + BLI_freelistN(&sl->regionbase); if(st && st->free) @@ -125,19 +138,26 @@ void BKE_spacedata_freelist(ListBase *lb) BLI_freelistN(lb); } -ARegion *BKE_area_region_copy(ARegion *ar) +ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar) { ARegion *newar= MEM_dupallocN(ar); Panel *pa, *newpa, *patab; + newar->prev= newar->next= NULL; newar->handlers.first= newar->handlers.last= NULL; newar->uiblocks.first= newar->uiblocks.last= NULL; newar->swinid= 0; - /* XXX regiondata callback */ - if(ar->regiondata) - newar->regiondata= MEM_dupallocN(ar->regiondata); + /* use optional regiondata callback */ + if(ar->regiondata) { + ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype); + if(art && art->duplicate) + newar->regiondata= art->duplicate(ar->regiondata); + else + newar->regiondata= MEM_dupallocN(ar->regiondata); + } + newar->panels.first= newar->panels.last= NULL; BLI_duplicatelist(&newar->panels, &ar->panels); @@ -160,7 +180,7 @@ ARegion *BKE_area_region_copy(ARegion *ar) /* from lb2 to lb1, lb1 is supposed to be free'd */ -static void region_copylist(ListBase *lb1, ListBase *lb2) +static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2) { ARegion *ar; @@ -168,7 +188,7 @@ static void region_copylist(ListBase *lb1, ListBase *lb2) lb1->first= lb1->last= NULL; for(ar= lb2->first; ar; ar= ar->next) { - ARegion *arnew= BKE_area_region_copy(ar); + ARegion *arnew= BKE_area_region_copy(st, ar); BLI_addtail(lb1, arnew); } } @@ -189,18 +209,21 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2) BLI_addtail(lb1, slnew); - region_copylist(&slnew->regionbase, &sl->regionbase); + region_copylist(st, &slnew->regionbase, &sl->regionbase); } } } /* not region itself */ -void BKE_area_region_free(ARegion *ar) +void BKE_area_region_free(SpaceType *st, ARegion *ar) { + if(st) { + ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype); + + if(art && art->free) + art->free(ar); + } if(ar) { - if(ar->type && ar->type->free) - ar->type->free(ar); - BLI_freelistN(&ar->panels); } } @@ -208,16 +231,16 @@ void BKE_area_region_free(ARegion *ar) /* not area itself */ void BKE_screen_area_free(ScrArea *sa) { - ARegion *ar, *arn; + SpaceType *st= BKE_spacetype_from_id(sa->spacetype); + ARegion *ar; - for(ar=sa->regionbase.first; ar; ar=arn) { - arn= ar->next; - BKE_area_region_free(ar); - } + for(ar=sa->regionbase.first; ar; ar=ar->next) + BKE_area_region_free(st, ar); + BLI_freelistN(&sa->regionbase); + BKE_spacedata_freelist(&sa->spacedata); - BLI_freelistN(&sa->regionbase); BLI_freelistN(&sa->actionzones); #ifndef DISABLE_PYTHON @@ -229,12 +252,11 @@ void BKE_screen_area_free(ScrArea *sa) void free_screen(bScreen *sc) { ScrArea *sa, *san; - ARegion *ar, *arn; + ARegion *ar; - for(ar=sc->regionbase.first; ar; ar=arn) { - arn= ar->next; - BKE_area_region_free(ar); - } + for(ar=sc->regionbase.first; ar; ar=ar->next) + BKE_area_region_free(NULL, ar); + BLI_freelistN(&sc->regionbase); for(sa= sc->areabase.first; sa; sa= san) { |