diff options
author | Julian Eisel <julian@blender.org> | 2020-12-08 15:47:37 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-12-08 16:39:31 +0300 |
commit | 95b3c4c966f9baeb6f73b84568b7f03287e1a350 (patch) | |
tree | 2784106b67cc09bacb8b09865c03ebf337b98baa /source/blender/editors/space_file/filelist.c | |
parent | 2a4fe88c13a1cb5bd79787e17eeaafec01c4d294 (diff) |
File Browser: Refactor access to the selection parameters struct
* Avoid direct access to `SpaceFile.params`, use a getter instead. This matters
because once the asset-browser changes are in, there will be an alternative
selection parameter object. The getter can return the correct one.
* Rename the function to ensure the parameters. The old name
`ED_fileselect_get_params()` wasn't a mere getter, it would create the
parameters if necessary. Now we have an actual getter, so better be clear.
* In some instances, I replaced the old "get" function with the new mere
getter. So the ensure logic is called less often. However, in these cases we
should be able to assume the selection parameters were created already as
part of the editor creation routine.
The term "active" in the new function names may seem a bit odd in the current
context, but that is a preparation for the Asset Browser merge as well. Like
said, there will be two file selection parameter objects in the space.
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index b6d016aca7c..58887ae745b 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -149,6 +149,7 @@ const char *folderlist_peeklastdir(ListBase *folderlist) int folderlist_clear_next(struct SpaceFile *sfile) { + const FileSelectParams *params = ED_fileselect_get_active_params(sfile); struct FolderList *folder; /* if there is no folder_next there is nothing we can clear */ @@ -159,7 +160,7 @@ int folderlist_clear_next(struct SpaceFile *sfile) /* if previous_folder, next_folder or refresh_folder operators are executed * it doesn't clear folder_next */ folder = sfile->folders_prev->last; - if ((!folder) || (BLI_path_cmp(folder->foldername, sfile->params->dir) == 0)) { + if ((!folder) || (BLI_path_cmp(folder->foldername, params->dir) == 0)) { return 0; } |