Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-07-02 16:30:00 +0300
committerJulian Eisel <julian@blender.org>2021-07-02 16:42:22 +0300
commit88c855174d4516df3afb524064ac1fd3bedc6780 (patch)
treef28978fcf398f1fed704c2185dcadae21a3169d7
parent5a693ce9e396f04d88140d8e015fcace7eddc6c2 (diff)
Cleanup: Remove unused/unneeded code from old Asset Engine design
This code was written for the File Browser together with the Asset Engine design, that is not part of the Asset Browser/System design anymore. Updated comments accordingly. `FileDirEntryRevision` was actually used, but I removed it and moved the used members to the parent `FileDirEntry`, since there is no concept of revisions currently. There should be no functional changes.
-rw-r--r--source/blender/editors/space_file/file_draw.c31
-rw-r--r--source/blender/editors/space_file/filelist.c42
-rw-r--r--source/blender/makesdna/DNA_space_types.h103
3 files changed, 31 insertions, 145 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 29cac294eaf..edef50c15a1 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -727,40 +727,45 @@ static void draw_columnheader_columns(const FileSelectParams *params,
/**
* Updates the stat string stored in file->entry if necessary.
*/
-static const char *filelist_get_details_column_string(FileAttributeColumnType column,
- const FileDirEntry *file,
- const bool small_size,
- const bool update_stat_strings)
+static const char *filelist_get_details_column_string(
+ FileAttributeColumnType column,
+ /* Generated string will be cached in the file, so non-const. */
+ FileDirEntry *file,
+ const bool small_size,
+ const bool update_stat_strings)
{
switch (column) {
case COLUMN_DATETIME:
if (!(file->typeflag & FILE_TYPE_BLENDERLIB) && !FILENAME_IS_CURRPAR(file->relpath)) {
- if ((file->entry->datetime_str[0] == '\0') || update_stat_strings) {
+ if ((file->draw_data.datetime_str[0] == '\0') || update_stat_strings) {
char date[FILELIST_DIRENTRY_DATE_LEN], time[FILELIST_DIRENTRY_TIME_LEN];
bool is_today, is_yesterday;
BLI_filelist_entry_datetime_to_string(
- NULL, file->entry->time, small_size, time, date, &is_today, &is_yesterday);
+ NULL, file->time, small_size, time, date, &is_today, &is_yesterday);
if (is_today || is_yesterday) {
BLI_strncpy(date, is_today ? N_("Today") : N_("Yesterday"), sizeof(date));
}
- BLI_snprintf(
- file->entry->datetime_str, sizeof(file->entry->datetime_str), "%s %s", date, time);
+ BLI_snprintf(file->draw_data.datetime_str,
+ sizeof(file->draw_data.datetime_str),
+ "%s %s",
+ date,
+ time);
}
- return file->entry->datetime_str;
+ return file->draw_data.datetime_str;
}
break;
case COLUMN_SIZE:
if ((file->typeflag & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) ||
!(file->typeflag & (FILE_TYPE_DIR | FILE_TYPE_BLENDERLIB))) {
- if ((file->entry->size_str[0] == '\0') || update_stat_strings) {
+ if ((file->draw_data.size_str[0] == '\0') || update_stat_strings) {
BLI_filelist_entry_size_to_string(
- NULL, file->entry->size, small_size, file->entry->size_str);
+ NULL, file->size, small_size, file->draw_data.size_str);
}
- return file->entry->size_str;
+ return file->draw_data.size_str;
}
break;
default:
@@ -772,7 +777,7 @@ static const char *filelist_get_details_column_string(FileAttributeColumnType co
static void draw_details_columns(const FileSelectParams *params,
const FileLayout *layout,
- const FileDirEntry *file,
+ FileDirEntry *file,
const int pos_x,
const int pos_y,
const uchar text_col[4])
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index a847d60ba52..b81605d6379 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1382,40 +1382,6 @@ static void filelist_entry_clear(FileDirEntry *entry)
BKE_icon_delete(entry->preview_icon_id);
entry->preview_icon_id = 0;
}
- /* For now, consider FileDirEntryRevision::poin as not owned here,
- * so no need to do anything about it */
-
- if (!BLI_listbase_is_empty(&entry->variants)) {
- FileDirEntryVariant *var;
-
- for (var = entry->variants.first; var; var = var->next) {
- if (var->name) {
- MEM_freeN(var->name);
- }
- if (var->description) {
- MEM_freeN(var->description);
- }
-
- if (!BLI_listbase_is_empty(&var->revisions)) {
- FileDirEntryRevision *rev;
-
- for (rev = var->revisions.first; rev; rev = rev->next) {
- if (rev->comment) {
- MEM_freeN(rev->comment);
- }
- }
-
- BLI_freelistN(&var->revisions);
- }
- }
-
- /* TODO: tags! */
-
- BLI_freelistN(&entry->variants);
- }
- else if (entry->entry) {
- MEM_freeN(entry->entry);
- }
}
static void filelist_entry_free(FileDirEntry *entry)
@@ -1954,16 +1920,12 @@ static FileDirEntry *filelist_file_create_entry(FileList *filelist, const int in
FileListInternEntry *entry = filelist->filelist_intern.filtered[index];
FileListEntryCache *cache = &filelist->filelist_cache;
FileDirEntry *ret;
- FileDirEntryRevision *rev;
ret = MEM_callocN(sizeof(*ret), __func__);
- rev = MEM_callocN(sizeof(*rev), __func__);
-
- rev->size = (uint64_t)entry->st.st_size;
- rev->time = (int64_t)entry->st.st_mtime;
+ ret->size = (uint64_t)entry->st.st_size;
+ ret->time = (int64_t)entry->st.st_mtime;
- ret->entry = rev;
ret->relpath = BLI_strdup(entry->relpath);
if (entry->free_name) {
ret->name = BLI_strdup(entry->name);
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 5151f35c43d..5ee96497bd5 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1043,68 +1043,6 @@ typedef enum eDirEntry_SelectFlag {
/* ***** Related to file browser, but never saved in DNA, only here to help with RNA. ***** */
-/**
- * About Unique identifier.
- *
- * Stored in a CustomProps once imported.
- * Each engine is free to use it as it likes - it will be the only thing passed to it by blender to
- * identify asset/variant/version (concatenating the three into a single 48 bytes one).
- * Assumed to be 128bits, handled as four integers due to lack of real bytes proptype in RNA :|.
- */
-#define ASSET_UUID_LENGTH 16
-
-/* Used to communicate with asset engines outside of 'import' context. */
-#
-#
-typedef struct AssetUUID {
- int uuid_asset[4];
- int uuid_variant[4];
- int uuid_revision[4];
-} AssetUUID;
-
-#
-#
-typedef struct AssetUUIDList {
- AssetUUID *uuids;
- int nbr_uuids;
- char _pad[4];
-} AssetUUIDList;
-
-/* Container for a revision, only relevant in asset context. */
-#
-#
-typedef struct FileDirEntryRevision {
- struct FileDirEntryRevision *next, *prev;
-
- char *comment;
- void *_pad;
-
- int uuid[4];
-
- uint64_t size;
- int64_t time;
- /* Temp caching of UI-generated strings... */
- char size_str[16];
- char datetime_str[16 + 8];
-} FileDirEntryRevision;
-
-/* Container for a variant, only relevant in asset context.
- * In case there are no variants, a single one shall exist, with NULL name/description. */
-#
-#
-typedef struct FileDirEntryVariant {
- struct FileDirEntryVariant *next, *prev;
-
- int uuid[4];
- char *name;
- char *description;
-
- ListBase revisions;
- int nbr_revisions;
- int act_revision;
-} FileDirEntryVariant;
-
-/* Container for mere direntry, with additional asset-related data. */
#
#
typedef struct FileDirEntry {
@@ -1116,9 +1054,14 @@ typedef struct FileDirEntry {
char *name;
char *description;
- /* Either point to active variant/revision if available, or own entry
- * (in mere filebrowser case). */
- FileDirEntryRevision *entry;
+ uint64_t size;
+ int64_t time;
+
+ struct {
+ /* Temp caching of UI-generated strings. */
+ char size_str[16];
+ char datetime_str[16 + 8];
+ } draw_data;
/** #eFileSel_File_Types. */
int typeflag;
@@ -1141,32 +1084,16 @@ typedef struct FileDirEntry {
/* The icon_id for the preview image. */
int preview_icon_id;
- /* Tags are for info only, most of filtering is done in asset engine. */
- char **tags;
- int nbr_tags;
-
- short status;
short flags;
/* eFileAttributes defined in BLI_fileops.h */
int attributes;
-
- ListBase variants;
- int nbr_variants;
- int act_variant;
} FileDirEntry;
/**
- * Array of direntries.
- *
- * This struct is used in various, different contexts.
- *
- * In Filebrowser UI, it stores the total number of available entries, the number of visible
- * (filtered) entries, and a subset of those in 'entries' ListBase, from idx_start (included)
- * to idx_end (excluded).
+ * Array of directory entries.
*
- * In AssetEngine context (i.e. outside of 'browsing' context), entries contain all needed data,
- * there is no filtering, so nbr_entries_filtered, entry_idx_start and entry_idx_end
- * should all be set to -1.
+ * Stores the total number of available entries, the number of visible (filtered) entries, and a
+ * subset of those in 'entries' ListBase, from idx_start (included) to idx_end (excluded).
*/
#
#
@@ -1180,14 +1107,6 @@ typedef struct FileDirEntryArr {
char root[1024];
} FileDirEntryArr;
-#if 0 /* UNUSED */
-/* FileDirEntry.status */
-enum {
- ASSET_STATUS_LOCAL = 1 << 0, /* If active uuid is available locally/immediately. */
- ASSET_STATUS_LATEST = 1 << 1, /* If active uuid is latest available version. */
-};
-#endif
-
/* FileDirEntry.flags */
enum {
FILE_ENTRY_INVALID_PREVIEW = 1 << 0, /* The preview for this entry could not be generated. */