Commit: 51bb1cef3974a87a82c8d437ffebd7e087889fd6
Author: Bastien Montagne
Date: Sat Apr 4 15:06:23 2015 +0200
Branches: asset-experiments
https://developer.blender.org/rB51bb1cef3974a87a82c8d437ffebd7e087889fd6
FileBrowser: add dummy accessor to entries from their uuid.
Needed for assets branch, to be rework seriously later of course.
===================================================================
M source/blender/editors/space_file/filelist.c
M source/blender/editors/space_file/filelist.h
===================================================================
diff --git a/source/blender/editors/space_file/filelist.c
b/source/blender/editors/space_file/filelist.c
index 01804fa..0410e3d 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1418,6 +1418,26 @@ int filelist_file_findpath(struct FileList *filelist,
const char *filename)
return -1;
}
+FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const char
uuid[ASSET_UUID_LENGTH])
+{
+ int fidx;
+
+ if (filelist->filelist.nbr_entries_filtered < 0) {
+ return NULL;
+ }
+
+ /* XXX TODO Cache could probably use a ghash on uuids too? Not really
urgent though. */
+
+ for (fidx = 0; fidx < filelist->filelist.nbr_entries_filtered; fidx++) {
+ FileDirEntry *entry = filelist->filelist_intern.filtered[fidx];
+ if (memcmp(entry->uuid, uuid, sizeof(entry->uuid)) == 0) {
+ return entry;
+ }
+ }
+
+ return NULL;
+}
+
/* Helper, low-level, it assumes cursor + size <= FILELIST_ENTRYCACHESIZE */
static bool filelist_file_cache_block_do(struct FileList *filelist, const int
start_index, const int size, int cursor)
{
diff --git a/source/blender/editors/space_file/filelist.h
b/source/blender/editors/space_file/filelist.h
index 7f19a8c..e76616b 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -92,6 +92,7 @@ int filelist_empty(struct FileList *filelist);
int filelist_numfiles(struct FileList *filelist);
FileDirEntry * filelist_file(struct FileList *filelist, int index);
int filelist_file_findpath(struct FileList *filelist, const
char *file);
+FileDirEntry * filelist_entry_find_uuid(struct FileList *filelist, const
char uuid[ASSET_UUID_LENGTH]);
bool filelist_file_cache_block(struct FileList *filelist, const
int index);
bool filelist_force_reset(struct FileList *filelist);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs