[Bf-blender-cvs] [a6490ba4e88] asset-browser: Address review comments
Julian Eisel
noreply at git.blender.org
Thu Dec 10 20:30:50 CET 2020
Commit: a6490ba4e882abbfa075f52faae14e3de91b0d8d
Author: Julian Eisel
Date: Thu Dec 10 18:29:40 2020 +0100
Branches: asset-browser
https://developer.blender.org/rBa6490ba4e882abbfa075f52faae14e3de91b0d8d
Address review comments
===================================================================
M source/blender/editors/space_file/filelist.c
M source/blender/editors/space_file/filesel.c
M source/blender/makesdna/DNA_space_types.h
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 9a51864967e..6e604b273e4 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1050,7 +1050,7 @@ static bool filelist_compare_asset_libraries(const FileSelectAssetLibraryUID *li
return false;
}
if (library_a->type == FILE_ASSET_LIBRARY_CUSTOM) {
- return STREQ(library_a->idname, library_b->idname);
+ return STREQ(library_a->custom_library_identifier, library_b->custom_library_identifier);
}
return true;
@@ -2029,7 +2029,7 @@ int filelist_file_findpath(struct FileList *filelist, const char *filename)
{
int fidx = -1;
- if (filelist->filelist.nbr_entries_filtered < FILEDIR_NBR_ENTRIES_UNSET) {
+ if (filelist->filelist.nbr_entries_filtered == FILEDIR_NBR_ENTRIES_UNSET) {
return fidx;
}
@@ -2057,7 +2057,7 @@ ID *filelist_file_get_id(const FileDirEntry *file)
FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const int uuid[4])
{
- if (filelist->filelist.nbr_entries_filtered < FILEDIR_NBR_ENTRIES_UNSET) {
+ if (filelist->filelist.nbr_entries_filtered == FILEDIR_NBR_ENTRIES_UNSET) {
return NULL;
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 7644fc92f51..2c66bd39e0a 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -375,6 +375,9 @@ FileSelectParams *ED_fileselect_ensure_active_params(SpaceFile *sfile)
}
return &sfile->asset_params->base_params;
}
+
+ BLI_assert(!"Invalid browse mode set in file space.");
+ return NULL;
}
/**
@@ -393,6 +396,9 @@ FileSelectParams *ED_fileselect_get_active_params(const SpaceFile *sfile)
case FILE_BROWSE_MODE_ASSETS:
return (FileSelectParams *)sfile->asset_params;
}
+
+ BLI_assert(!"Invalid browse mode set in file space.");
+ return NULL;
}
FileSelectParams *ED_fileselect_get_file_params(const SpaceFile *sfile)
@@ -413,7 +419,8 @@ static void fileselect_refresh_asset_params(FileAssetSelectParams *asset_params)
/* Ensure valid repo, or fall-back to local one. */
if (library->type == FILE_ASSET_LIBRARY_CUSTOM) {
- user_library = BKE_preferences_asset_library_find_from_name(&U, library->idname);
+ user_library = BKE_preferences_asset_library_find_from_name(
+ &U, library->custom_library_identifier);
if (!user_library) {
library->type = FILE_ASSET_LIBRARY_LOCAL;
}
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 4ac2203247f..5513054b559 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -678,7 +678,7 @@ typedef struct FileSelectAssetLibraryUID {
* If showing a custom asset library (#FILE_ASSET_LIBRARY_CUSTOM), this name has to be set to
* define which. Can be empty otherwise.
*/
- char idname[64]; /* MAX_NAME */
+ char custom_library_identifier[64]; /* MAX_NAME */
} FileSelectAssetLibraryUID;
/* Config and Input for File Selector */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index dca6740eacc..5e7d6131e2a 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2486,7 +2486,7 @@ static int rna_FileSelectParams_asset_library_get(PointerRNA *ptr)
/* Note that the path isn't checked for validity here. If an invalid library path is used, the
* Asset Browser can give a nice hint on what's wrong. */
const bUserAssetLibrary *user_library = BKE_preferences_asset_library_find_from_name(
- &U, params->asset_library.idname);
+ &U, params->asset_library.custom_library_identifier);
const int index = BKE_preferences_asset_library_get_index(&U, user_library);
if (index > -1) {
return FILE_ASSET_LIBRARY_CUSTOM + index;
@@ -2503,7 +2503,7 @@ static void rna_FileSelectParams_asset_library_set(PointerRNA *ptr, int value)
/* Simple case: Predefined repo, just set the value. */
if (value < FILE_ASSET_LIBRARY_CUSTOM) {
params->asset_library.type = value;
- params->asset_library.idname[0] = '\0';
+ params->asset_library.custom_library_identifier[0] = '\0';
BLI_assert(ELEM(value, FILE_ASSET_LIBRARY_LOCAL));
return;
}
@@ -2515,8 +2515,9 @@ static void rna_FileSelectParams_asset_library_set(PointerRNA *ptr, int value)
* Asset Browser can give a nice hint on what's wrong. */
const bool is_valid = (user_library->name[0] && user_library->path[0]);
if (user_library && is_valid) {
- BLI_strncpy(
- params->asset_library.idname, user_library->name, sizeof(params->asset_library.idname));
+ BLI_strncpy(params->asset_library.custom_library_identifier,
+ user_library->name,
+ sizeof(params->asset_library.custom_library_identifier));
params->asset_library.type = FILE_ASSET_LIBRARY_CUSTOM;
}
}
More information about the Bf-blender-cvs
mailing list