typing in non-existant dirs now goes back to the previous dir. (also for bookmarks and when changing dir's in other places)
This commit is contained in:
parent
384a1b5a5c
commit
734d50e8df
@ -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):
|
||||
|
@ -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]); }
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user