diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-06 20:54:17 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-06 20:54:17 +0300 |
commit | af647654566968841785b7804b5b10d7128f6d0a (patch) | |
tree | 9197aa8a358072ec0b758ef2fb546dfefa47e98c | |
parent | b67d08c3c77d704e4aba687165974b09ffaaf420 (diff) |
Todo items:
- Toobar views were reset on hide/unhide. Now they keep the view
and zoom level.
- Added operator to delete all unused 'space data', this to make
clean startup.blend files, remove unused editors, and to be
able to test starting defaults for editors.
No hotkey, use search for "Clean-up space-data"
-rw-r--r-- | source/blender/editors/screen/area.c | 1 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 39 |
2 files changed, 39 insertions, 1 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index c482ba4a9e8..328cfb1254c 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -959,7 +959,6 @@ void ED_region_toggle_hidden(bContext *C, ARegion *ar) ScrArea *sa= CTX_wm_area(C); ar->flag ^= RGN_FLAG_HIDDEN; - ar->v2d.flag &= ~V2D_IS_INITIALISED; /* XXX should become hide/unhide api? */ if(ar->flag & RGN_FLAG_HIDDEN) WM_event_remove_handlers(C, &ar->handlers); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 6f6b13a3309..8a515f81411 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2094,6 +2094,44 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) RNA_def_int(ot->srna, "max_y", -100, INT_MIN, INT_MAX, "Y 2", "", INT_MIN, INT_MAX); } + +static int spacedata_cleanup(bContext *C, wmOperator *op) +{ + Main *bmain= CTX_data_main(C); + bScreen *screen; + ScrArea *sa; + int tot= 0; + + for(screen= bmain->screen.first; screen; screen= screen->id.next) { + for(sa= screen->areabase.first; sa; sa= sa->next) { + if(sa->spacedata.first != sa->spacedata.last) { + SpaceLink *sl= sa->spacedata.first; + + BLI_remlink(&sa->spacedata, sl); + tot+= BLI_countlist(&sa->spacedata); + BKE_spacedata_freelist(&sa->spacedata); + BLI_addtail(&sa->spacedata, sl); + } + } + } + BKE_reportf(op->reports, RPT_INFO, "Removed amount of editors: %d", tot); + + return OPERATOR_FINISHED; +} + +static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Clean-up space-data"; + ot->description= "Remove unused settings for invisible editors"; + ot->idname= "SCREEN_OT_spacedata_cleanup"; + + /* api callbacks */ + ot->exec= spacedata_cleanup; + ot->poll= WM_operator_winactive; + +} + /* ************** repeat last operator ***************************** */ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) @@ -3030,6 +3068,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_screen_set); WM_operatortype_append(SCREEN_OT_screen_full_area); WM_operatortype_append(SCREEN_OT_back_to_previous); + WM_operatortype_append(SCREEN_OT_spacedata_cleanup); WM_operatortype_append(SCREEN_OT_screenshot); WM_operatortype_append(SCREEN_OT_screencast); WM_operatortype_append(SCREEN_OT_userpref_show); |