UI: Remember ID-Filter in-between File Browser calls

This adds the ID-Filters visible on append/link to the settings the file
browser remembers, potentially storing them in the Preferences.

Artists in the studio here requested this. They typically have to set up
the same or similar settings every time, so this saves them from that.
This commit is contained in:
Julian Eisel
2019-10-16 12:04:56 +02:00
parent a3f7ae1b96
commit b546263642
5 changed files with 10 additions and 8 deletions

View File

@@ -213,6 +213,7 @@ const UserDef U_default = {
.sort_type = FILE_SORT_ALPHA,
.details_flags = FILE_DETAILS_SIZE | FILE_DETAILS_DATETIME,
.flag = FILE_HIDE_DOT,
.filter_id = FILTER_ID_ALL,
.temp_win_sizex = 1020,
.temp_win_sizey = 600,

View File

@@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 282
#define BLENDER_SUBVERSION 0
#define BLENDER_SUBVERSION 1
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@@ -637,6 +637,10 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
}
}
if (!USER_VERSION_ATLEAST(282, 1)) {
userdef->file_space_data.filter_id = U_default.file_space_data.filter_id;
}
/**
* Include next version bump.
*/

View File

@@ -103,10 +103,9 @@ short ED_fileselect_set_params(SpaceFile *sfile)
sizeof(sfile->params->dir),
sizeof(sfile->params->file));
sfile->params->filter_glob[0] = '\0';
/* set the default thumbnails size */
sfile->params->thumbnail_size = U_default.file_space_data.thumbnail_size;
/* Show size column by default. */
sfile->params->details_flags = U_default.file_space_data.details_flags;
sfile->params->filter_id = U_default.file_space_data.filter_id;
}
params = sfile->params;
@@ -246,9 +245,6 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
}
/* For now, always init filterid to 'all true' */
params->filter_id = FILTER_ID_ALL;
if (U.uiflag & USER_HIDE_DOT) {
params->flag |= FILE_HIDE_DOT;
}
@@ -348,6 +344,7 @@ void ED_fileselect_set_params_from_userdef(SpaceFile *sfile)
}
sfile->params->thumbnail_size = sfile_udata->thumbnail_size;
sfile->params->details_flags = sfile_udata->details_flags;
sfile->params->filter_id = sfile_udata->filter_id;
/* Combine flags we take from params with the flags we take from userdef. */
sfile->params->flag = (sfile->params->flag & ~PARAMS_FLAGS_REMEMBERED) |
@@ -371,6 +368,7 @@ void ED_fileselect_params_to_userdef(SpaceFile *sfile, int temp_win_size[2])
sfile_udata_new->sort_type = sfile->params->sort;
sfile_udata_new->details_flags = sfile->params->details_flags;
sfile_udata_new->flag = sfile->params->flag & PARAMS_FLAGS_REMEMBERED;
sfile_udata_new->filter_id = sfile->params->filter_id;
if (temp_win_size) {
sfile_udata_new->temp_win_sizex = temp_win_size[0];

View File

@@ -588,8 +588,7 @@ typedef struct UserDef_FileSpaceData {
int sort_type; /* FileSelectParams.sort */
int details_flags; /* FileSelectParams.details_flags */
int flag; /* FileSelectParams.flag */
char _pad[4];
int filter_id; /* FileSelectParams.filter_id */
/** Info used when creating the file browser in a temporary window. */
int temp_win_sizex;