[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22925] branches/blender2.5/blender/source /blender: Open recent list was arseabout, only adding files on save, rather then open.

Campbell Barton ideasman42 at gmail.com
Tue Sep 1 02:52:04 CEST 2009


Revision: 22925
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22925
Author:   campbellbarton
Date:     2009-09-01 02:52:03 +0200 (Tue, 01 Sep 2009)

Log Message:
-----------
Open recent list was arseabout, only adding files on save, rather then open.

This is problematic for a few reasons...
* I'd often save a blendfile only so it would appier in the open recent menu.
* Saving files (when you dont need to) makes access times less useful.
* binary diff's in SVN dont give any useful info. Sometimes I wasnt sure if I actually edited or saves for fast re-opening.
* Testing 2.4x files with animation data in 2.5 can loose info.
* Its not logical and other apps dont work this way.

Also made the recent file list in the file browser display the most recent item first (like the open recent menu).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c

Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c	2009-09-01 00:33:39 UTC (rev 22924)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c	2009-09-01 00:52:03 UTC (rev 22925)
@@ -63,7 +63,7 @@
 	WM_operator_properties_free(&ptr);
 }
 
-static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory category, short *nr, int icon, int allow_delete)
+static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory category, short *nr, int icon, int allow_delete, int reverse)
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	uiBlock *block;
@@ -71,7 +71,7 @@
 	uiLayout *box, *col;
 	struct FSMenu* fsmenu = fsmenu_get();
 	char *curdir= (sfile->params)? sfile->params->dir: "";
-	int i, nentries = fsmenu_get_nentries(fsmenu, category);
+	int i, i_iter, nentries = fsmenu_get_nentries(fsmenu, category);
 
 	/* reset each time */
 	*nr= -1;
@@ -86,12 +86,16 @@
 	box= uiLayoutBox(pa->layout);
 	col= uiLayoutColumn(box, 1);
 
-	for (i=0; i< nentries;++i) {
+	for (i_iter=0; i_iter< nentries;++i_iter) {
 		char dir[FILE_MAX];
 		char temp[FILE_MAX];
 		uiLayout* layout = uiLayoutRow(col, 0);
-		char *entry = fsmenu_get_entry(fsmenu, category, i);
+		char *entry;
 
+		i= reverse ? nentries-(i_iter+1) : i_iter;
+		
+		entry = fsmenu_get_entry(fsmenu, category, i);
+		
 		/* set this list item as active if we have a match */
 		if(strcmp(curdir, entry) == 0)
 			*nr= i;
@@ -124,7 +128,7 @@
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
 	if(sfile)
-		file_panel_category(C, pa, FS_CATEGORY_SYSTEM, &sfile->systemnr, ICON_DISK_DRIVE, 0);
+		file_panel_category(C, pa, FS_CATEGORY_SYSTEM, &sfile->systemnr, ICON_DISK_DRIVE, 0, 0);
 }
 
 static void file_panel_bookmarks(const bContext *C, Panel *pa)
@@ -137,7 +141,7 @@
 		uiItemO(row, "Add", ICON_ZOOMIN, "file.add_bookmark");
 		uiItemL(row, NULL, 0);
 
-		file_panel_category(C, pa, FS_CATEGORY_BOOKMARKS, &sfile->bookmarknr, ICON_BOOKMARKS, 1);
+		file_panel_category(C, pa, FS_CATEGORY_BOOKMARKS, &sfile->bookmarknr, ICON_BOOKMARKS, 1, 0);
 	}
 }
 
@@ -146,7 +150,7 @@
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
 	if(sfile)
-		file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0);
+		file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0, 1);
 }
 
 

Modified: branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c
===================================================================
--- branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c	2009-09-01 00:33:39 UTC (rev 22924)
+++ branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c	2009-09-01 00:52:03 UTC (rev 22925)
@@ -96,6 +96,7 @@
 #include "wm.h"
 #include "wm_window.h"
 
+static void writeBlog(void);
 
 /* To be able to read files without windows closing, opening, moving 
    we try to prepare for worst case:
@@ -256,7 +257,10 @@
 
 		if(retval==2) wm_init_userdef();	// in case a userdef is read from regular .blend
 		
-		if (retval!=0) G.relbase_valid = 1;
+		if (retval!=0) {
+			G.relbase_valid = 1;
+			writeBlog();
+		}
 
 // XXX		undo_editmode_clear();
 		BKE_reset_undo();





More information about the Bf-blender-cvs mailing list