2.5 filebrowser
* Fix for space init when loading with pupmenu (without operator) - parameters now get reset * experimental: made new director operator jump directly into renaming
This commit is contained in:
@@ -705,7 +705,9 @@ int file_directory_new_exec(bContext *C, wmOperator *unused)
|
||||
BLI_join_dirfile(tmpstr, tmpstr, tmpdir);
|
||||
}
|
||||
BLI_recurdir_fileops(tmpstr);
|
||||
if (!BLI_exists(tmpstr)) {
|
||||
if (BLI_exists(tmpstr)) {
|
||||
BLI_strncpy(sfile->params->renamefile, tmpdir, FILE_MAXFILE);
|
||||
} else {
|
||||
filelist_free(sfile->files);
|
||||
filelist_parent(sfile->files);
|
||||
BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), FILE_MAX);
|
||||
|
||||
@@ -154,8 +154,9 @@ short ED_fileselect_set_params(SpaceFile *sfile)
|
||||
if (params->filter != 0)
|
||||
params->flag |= FILE_FILTER;
|
||||
|
||||
params->flag |= FILE_HIDE_DOT;
|
||||
|
||||
if (params->type == FILE_LOADLIB) {
|
||||
params->flag |= FILE_HIDE_DOT;
|
||||
params->flag |= RNA_boolean_get(op->ptr, "link") ? FILE_LINK : 0;
|
||||
params->flag |= RNA_boolean_get(op->ptr, "autoselect") ? FILE_AUTOSELECT : 0;
|
||||
params->flag |= RNA_boolean_get(op->ptr, "active_layer") ? FILE_ACTIVELAY : 0;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_arithb.h"
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_storage_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
@@ -154,6 +155,9 @@ static void file_free(SpaceLink *sl)
|
||||
/* spacetype; init callback, area size changes, screen set, etc */
|
||||
static void file_init(struct wmWindowManager *wm, ScrArea *sa)
|
||||
{
|
||||
SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
|
||||
MEM_freeN(sfile->params);
|
||||
sfile->params = 0;
|
||||
printf("file_init\n");
|
||||
}
|
||||
|
||||
@@ -203,7 +207,17 @@ static void file_refresh(const bContext *C, ScrArea *sa)
|
||||
filelist_readdir(sfile->files);
|
||||
}
|
||||
if(params->sort!=FILE_SORT_NONE) filelist_sort(sfile->files, params->sort);
|
||||
|
||||
|
||||
if (params->renamefile[0] != '\0') {
|
||||
int idx = filelist_find(sfile->files, params->renamefile);
|
||||
if (idx >= 0) {
|
||||
struct direntry *file= filelist_file(sfile->files, idx);
|
||||
if (file) {
|
||||
file->flags |= EDITING;
|
||||
}
|
||||
}
|
||||
params->renamefile[0] = '\0';
|
||||
}
|
||||
if (sfile->layout) sfile->layout->dirty= 1;
|
||||
|
||||
}
|
||||
|
||||
@@ -153,6 +153,7 @@ typedef struct FileSelectParams {
|
||||
char title[24]; /* title, also used for the text of the execute button */
|
||||
char dir[240]; /* directory */
|
||||
char file[80]; /* file */
|
||||
char renamefile[80];
|
||||
|
||||
short type; /* XXXXX for now store type here, should be moved to the operator */
|
||||
short flag; /* settings for filter, hiding dots files,... */
|
||||
|
||||
Reference in New Issue
Block a user