typing in non-existant dirs now goes back to the previous dir. (also for bookmarks...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 15 Oct 2009 11:11:52 +0000 (11:11 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 15 Oct 2009 11:11:52 +0000 (11:11 +0000)
release/scripts/ui/space_view3d.py
source/blender/blenkernel/intern/pointcache.c
source/blender/editors/space_file/file_intern.h
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/space_file.c

index 490c9065d94c6946163095a28505ec80c9da0f83..dfc491522f597bd458bdae2517b41bf86c05ef8c 100644 (file)
@@ -172,8 +172,8 @@ class VIEW3D_MT_select_object(bpy.types.Menu):
                layout.itemO("object.select_random", text="Random")
                layout.itemO("object.select_mirror", text="Mirror")
                layout.itemO("object.select_by_layer", text="Select All by Layer")
-               layout.item_enumO("object.select_by_type", "type", "", text="Select All by Type...")
-               layout.itemO("object.select_grouped", text="Select Grouped...")
+               layout.item_menu_enumO("object.select_by_type", "type", "", text="Select All by Type...")
+               layout.item_menu_enumO("object.select_grouped", "type", text="Select Grouped...")
                layout.itemO("object.select_pattern", text="Select Pattern...")
 
 class VIEW3D_MT_select_pose(bpy.types.Menu):
index fa0d5cba604bd9bfa54f9708da5db135fcc93ee7..68f0e33a98f19cfb0c5162645b651a21f205d08d 100644 (file)
@@ -84,9 +84,6 @@
   #include "BLI_winstuff.h"
 #endif
 
-static void ptcache_data_to(void **data, int type, int index, void *to);
-static void ptcache_data_from(void **data, int type, void *from);
-
 #define PTCACHE_DATA_FROM(data, type, from)            if(data[type]) { memcpy(data[type], from, ptcache_data_size[type]); }
 #define PTCACHE_DATA_TO(data, type, index, to) if(data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); }
 
index a99594e95750484d8a1adf7ad6c4aa0bcd467aa6..d07ffd4b964af63b1ce99a290eb34d6260dfb3f7 100644 (file)
@@ -88,7 +88,7 @@ int file_hilight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my
 /* filesel.c */
 float file_string_width(const char* str);
 float file_font_pointsize();
-void file_change_dir(struct SpaceFile *sfile);
+void file_change_dir(struct SpaceFile *sfile, int checkdir);
 int file_select_match(struct SpaceFile *sfile, const char *pattern);
 void autocomplete_directory(struct bContext *C, char *str, void *arg_v);
 
index c0be1ffb6375d70a3efc34626ed1bf1c934bfc13..a49b0a072af6027e49d0bba7faf976b46e353206 100644 (file)
@@ -177,7 +177,7 @@ static FileSelect file_select(SpaceFile* sfile, ARegion* ar, const rcti* rect, s
                                        BLI_add_slash(params->dir);
                                }
 
-                               file_change_dir(sfile);
+                               file_change_dir(sfile, 0);
                                retval = FILE_SELECT_DIR;
                        }
                }
@@ -343,7 +343,7 @@ static int bookmark_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                RNA_string_get(op->ptr, "dir", entry);
                BLI_strncpy(params->dir, entry, sizeof(params->dir));
                BLI_cleanup_dir(G.sce, params->dir);
-               file_change_dir(sfile);                         
+               file_change_dir(sfile, 1);
 
                WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        }
@@ -645,7 +645,7 @@ int file_parent_exec(bContext *C, wmOperator *unused)
                if (BLI_has_parent(sfile->params->dir)) {
                        BLI_parent_dir(sfile->params->dir);
                        BLI_cleanup_dir(G.sce, sfile->params->dir);
-                       file_change_dir(sfile);
+                       file_change_dir(sfile, 0);
                        WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
                }
        }               
@@ -672,7 +672,7 @@ int file_refresh_exec(bContext *C, wmOperator *unused)
 {
        SpaceFile *sfile= CTX_wm_space_file(C);
        
-       file_change_dir(sfile);
+       file_change_dir(sfile, 1);
 
        WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
 
@@ -704,7 +704,7 @@ int file_previous_exec(bContext *C, wmOperator *unused)
                folderlist_popdir(sfile->folders_prev, sfile->params->dir);
                folderlist_pushdir(sfile->folders_next, sfile->params->dir);
 
-               file_change_dir(sfile);
+               file_change_dir(sfile, 1);
        }
        WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
 
@@ -736,7 +736,7 @@ int file_next_exec(bContext *C, wmOperator *unused)
                // update folder_prev so we can check for it in folderlist_clear_next()
                folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
 
-               file_change_dir(sfile);
+               file_change_dir(sfile, 1);
        }               
        WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
 
@@ -795,6 +795,8 @@ int file_directory_exec(bContext *C, wmOperator *unused)
        SpaceFile *sfile= CTX_wm_space_file(C);
        
        if(sfile->params) {
+               char prev_dir[sizeof(sfile->params->dir)];
+               BLI_strncpy(prev_dir, filelist_dir(sfile->files), sizeof(prev_dir));
 
                if ( sfile->params->dir[0] == '~' ) {
                        if (sfile->params->dir[1] == '\0') {
@@ -817,7 +819,8 @@ int file_directory_exec(bContext *C, wmOperator *unused)
 #endif
                BLI_cleanup_dir(G.sce, sfile->params->dir);
                BLI_add_slash(sfile->params->dir);
-               file_change_dir(sfile);
+               file_change_dir(sfile, 1);
+
                WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        }               
        
index 9f5d889c7b94c7c194ef7a2c2cc0bd687b207c4c..89678bffd018983281e0371cd7fb51be5e6a9000 100644 (file)
@@ -384,9 +384,15 @@ FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar
        return sfile->layout;
 }
 
-void file_change_dir(struct SpaceFile *sfile)
+void file_change_dir(struct SpaceFile *sfile, int checkdir)
 {
-       if (sfile->params) { 
+       if (sfile->params) {
+
+               if(checkdir && S_ISDIR(BLI_exists(sfile->params->dir)) == 0) {
+                       BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
+                       /* could return but just refresh the current dir */
+               }
+
                filelist_setdir(sfile->files, sfile->params->dir);
 
                if(folderlist_clear_next(sfile))
index 4d3376e0e1f2d865133624c3e515b5adfc8db0e6..91d917acfe7738ef795a2fb0df2417592b7beb97 100644 (file)
@@ -180,7 +180,7 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
 
        if(sfileo->params) {
                sfilen->params= MEM_dupallocN(sfileo->params);
-               file_change_dir(sfilen);
+               file_change_dir(sfilen, 0);
        }
        if (sfileo->layout) {
                sfilen->layout= MEM_dupallocN(sfileo->layout);
@@ -197,7 +197,7 @@ static void file_refresh(const bContext *C, ScrArea *sa)
                sfile->folders_prev = folderlist_new();
        if (!sfile->files) {
                sfile->files = filelist_new(params->type);
-               file_change_dir(sfile);
+               file_change_dir(sfile, 0);
                params->active_file = -1; // added this so it opens nicer (ton)
        }
        filelist_hidedot(sfile->files, params->flag & FILE_HIDE_DOT);