Todo items:
authorTon Roosendaal <ton@blender.org>
Thu, 6 Jan 2011 17:54:17 +0000 (17:54 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 6 Jan 2011 17:54:17 +0000 (17:54 +0000)
- 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"

source/blender/editors/screen/area.c
source/blender/editors/screen/screen_ops.c

index c482ba4a9e81a81f60efbb08bd2cf07e83b7a725..328cfb1254c93ff95dc02f50527b159c5e08af3e 100644 (file)
@@ -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);
index 6f6b13a3309b8ae8cc7d8d13ac190c3d6f3c399f..8a515f814114d81865053bbd88591c8c76f1fdeb 100644 (file)
@@ -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);