[Bf-blender-cvs] [25caef24a8b] asset-engine: Merge branch 'master' into asset-engine
Bastien Montagne
noreply at git.blender.org
Fri Aug 30 09:56:21 CEST 2019
Commit: 25caef24a8b0e2915f544e10c824445e4d69c3e6
Author: Bastien Montagne
Date: Fri Aug 30 09:55:59 2019 +0200
Branches: asset-engine
https://developer.blender.org/rB25caef24a8b0e2915f544e10c824445e4d69c3e6
Merge branch 'master' into asset-engine
Conflicts:
source/blender/blenkernel/BKE_library.h
source/blender/blenloader/intern/versioning_280.c
source/blender/makesdna/DNA_ID.h
===================================================================
===================================================================
diff --cc source/blender/blenkernel/BKE_library.h
index b6c5d46f60a,c8d85cd0c87..8461f0630c8
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@@ -46,12 -46,8 +46,11 @@@ extern "C"
* except in some specific cases requiring advanced (and potentially dangerous) handling.
*/
+struct AssetEngineType;
+struct AssetUUID;
+struct BlendThumbnail;
struct GHash;
struct ID;
- struct ImBuf;
struct Library;
struct ListBase;
struct Main;
diff --cc source/blender/blenkernel/intern/library_remap.c
index 66641715c0c,61f506a8a6c..b94afdf98da
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@@ -757,13 -756,9 +756,13 @@@ void BKE_libblock_free_data(ID *id, con
}
if (id->override_library) {
- BKE_override_library_free(&id->override_library);
+ BKE_override_library_free(&id->override_library, do_id_user);
}
+ if (id->uuid) {
+ MEM_freeN(id->uuid);
+ }
+
/* XXX TODO remove animdata handling from each type's freeing func,
* and do it here, like for copy! */
}
diff --cc source/blender/blenloader/intern/versioning_280.c
index 78f37ad5a36,a66b9336632..1dbd296906e
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -3694,36 -3693,17 +3694,47 @@@ void blo_do_versions_280(FileData *fd,
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 281, 4)) {
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN (bmain, id) {
+ bNodeTree *ntree = ntreeFromID(id);
+ if (ntree) {
+ ntree->id.flag |= LIB_PRIVATE_DATA;
+ }
+ }
+ FOREACH_MAIN_ID_END;
+ }
+
+ if (1 ||
+ !DNA_struct_find(fd->filesdna,
+ "AssetUUID")) { /* struct_find will have to wait, not working for now... */
+ /* Move non-op filebrowsers to 'library browsing' type/mode. */
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_FILE) {
+ SpaceFile *sfile = (SpaceFile *)sl;
+ if (sfile->params != NULL) {
+ sfile->params->type = FILE_LOADLIB;
+ sfile->params->filter = FILE_TYPE_FOLDER | FILE_TYPE_BLENDERLIB;
+ /* For now, always init filterid to 'all true' */
+ sfile->params->filter_id = FILTER_ID_AC | FILTER_ID_AR | FILTER_ID_BR |
+ FILTER_ID_CA | FILTER_ID_CU | FILTER_ID_GD |
+ FILTER_ID_GR | FILTER_ID_IM | FILTER_ID_LA |
+ FILTER_ID_LS | FILTER_ID_LT | FILTER_ID_MA |
+ FILTER_ID_MB | FILTER_ID_MC | FILTER_ID_ME |
+ FILTER_ID_MSK | FILTER_ID_NT | FILTER_ID_OB |
+ FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC |
+ FILTER_ID_SCE | FILTER_ID_SPK | FILTER_ID_SO |
+ FILTER_ID_TE | FILTER_ID_TXT | FILTER_ID_VF |
+ FILTER_ID_WO | FILTER_ID_CF;
+ }
+ }
+ }
+ }
+ }
+ }
+
{
/* Versioning code until next subversion bump goes here. */
}
diff --cc source/blender/editors/space_file/filelist.c
index 0d7d328ad9e,f7dda1defe8..c5e88f7ce28
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@@ -787,93 -828,6 +787,94 @@@ void filelist_setfilter_options(FileLis
}
}
+void filelist_sort_filter(struct FileList *filelist, FileSelectParams *params)
+{
+ if (filelist->ae) {
+ if (filelist->ae->type->sort_filter) {
+ const bool need_sorting = filelist_need_sorting(filelist);
+ const bool need_filtering = filelist_need_filtering(filelist);
+ const bool changed = filelist->ae->type->sort_filter(
+ filelist->ae, need_sorting, need_filtering, params, &filelist->filelist);
- // printf("%s: changed: %d (%d - %d)\n", __func__, changed, need_sorting, need_filtering);
++ // printf("%s: changed: %d (%d - %d)\n", __func__, changed, need_sorting,
++ // need_filtering);
+ if (changed) {
+ filelist_cache_clear(
+ &filelist->filelist_cache, filelist->filelist_cache.size, filelist->ae);
+ }
+ }
+ }
+ else {
+ if (filelist_need_sorting(filelist)) {
+ switch (filelist->sort) {
+ case FILE_SORT_ALPHA:
+ BLI_listbase_sort_r(&filelist->filelist_intern.entries, compare_name, NULL);
+ break;
+ case FILE_SORT_TIME:
+ BLI_listbase_sort_r(&filelist->filelist_intern.entries, compare_date, NULL);
+ break;
+ case FILE_SORT_SIZE:
+ BLI_listbase_sort_r(&filelist->filelist_intern.entries, compare_size, NULL);
+ break;
+ case FILE_SORT_EXTENSION:
+ BLI_listbase_sort_r(&filelist->filelist_intern.entries, compare_extension, NULL);
+ break;
+ case FILE_SORT_NONE: /* Should never reach this point! */
+ default:
+ BLI_assert(0);
+ }
+
+ filelist_filter_clear(filelist);
+ }
+
+ if (filelist_need_filtering(filelist)) {
+ int num_filtered = 0;
+ const int num_files = filelist->filelist.nbr_entries;
+ FileListInternEntry **filtered_tmp, *file;
+
+ if (filelist->filelist.nbr_entries == 0) {
+ return;
+ }
+
+ filelist->filter_data.flags &= ~FLF_HIDE_LIB_DIR;
+ if (filelist->max_recursion) {
+ /* Never show lib ID 'categories' directories when we are in 'flat' mode, unless
+ * root path is a blend file. */
+ char dir[FILE_MAXDIR];
+ if (!filelist_islibrary(filelist, dir, NULL)) {
+ filelist->filter_data.flags |= FLF_HIDE_LIB_DIR;
+ }
+ }
+
+ filtered_tmp = MEM_mallocN(sizeof(*filtered_tmp) * (size_t)num_files, __func__);
+
+ /* Filter remap & count how many files are left after filter in a single loop. */
+ for (file = filelist->filelist_intern.entries.first; file; file = file->next) {
+ if (filelist->filterf(file, filelist->filelist.root, &filelist->filter_data)) {
+ filtered_tmp[num_filtered++] = file;
+ }
+ }
+
+ if (filelist->filelist_intern.filtered) {
+ MEM_freeN(filelist->filelist_intern.filtered);
+ }
+ filelist->filelist_intern.filtered = MEM_mallocN(
+ sizeof(*filelist->filelist_intern.filtered) * (size_t)num_filtered, __func__);
+ memcpy(filelist->filelist_intern.filtered,
+ filtered_tmp,
+ sizeof(*filelist->filelist_intern.filtered) * (size_t)num_filtered);
+ filelist->filelist.nbr_entries_filtered = num_filtered;
+ // printf("Filetered: %d over %d entries\n", num_filtered, filelist->filelist.nbr_entries);
+
+ filelist_cache_clear(&filelist->filelist_cache, filelist->filelist_cache.size, filelist->ae);
+
+ MEM_freeN(filtered_tmp);
+ }
+ }
+
+ filelist_need_sorting_clear(filelist);
+ filelist_need_filtering_clear(filelist);
+}
+
/* ********** Icon/image helpers ********** */
void filelist_init_icons(void)
@@@ -1350,44 -1276,24 +1351,45 @@@ static void filelist_cache_previews_pus
BLI_assert(cache->flags & FLC_PREVIEWS_ACTIVE);
- if (!entry->image && !(entry->flags & FILE_ENTRY_INVALID_PREVIEW) &&
- (entry->typeflag & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_FTFONT |
- FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP | FILE_TYPE_BLENDERLIB))) {
- FileListEntryPreview *preview = MEM_mallocN(sizeof(*preview), __func__);
- BLI_join_dirfile(
- preview->path, sizeof(preview->path), filelist->filelist.root, entry->relpath);
- preview->index = index;
- preview->flags = entry->typeflag;
- preview->img = NULL;
- // printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path, preview->img);
+ if (do_preview && !entry->image && !(entry->flags & FILE_ENTRY_INVALID_PREVIEW)) {
+ if (filelist->ae) {
+ /* TODO Really have to find better way to handle this than realloc... */
+ AssetUUIDList *uuids = &cache->ae_preview_uuids;
- filelist_cache_preview_ensure_running(cache);
- BLI_task_pool_push_ex(cache->previews_pool,
- filelist_cache_preview_runf,
- preview,
- true,
- filelist_cache_preview_freef,
- TASK_PRIORITY_LOW);
+ if (uuids->uuids) {
+ BLI_assert(uuids->nbr_uuids != 0);
+ uuids->uuids = MEM_recallocN(uuids->uuids, ++uuids->nbr_uuids * sizeof(*uuids->uuids));
+ }
+ else {
+ BLI_assert(uuids->nbr_uuids == 0);
+ uuids->uuids = MEM_callocN(++uuids->nbr_uuids * sizeof(*uuids->uuids), __func__);
+ }
+ memcpy(uuids->uuids[uuids->nbr_uuids - 1].uuid_repository,
+ entry->uuid_repository,
+ sizeof(uuids->uuids[uuids->nbr_uuids - 1].uuid_repository));
+ memcpy(uuids->uuids[uuids->nbr_uuids - 1].uuid_asset,
+ entry->uuid,
+ sizeof(uuids->uuids[uuids->nbr_uuids - 1].uuid_asset));
+ /* No real need to call ae->type->previews_get() here, update callback will do so anyway. */
+ }
+ else {
+ FileListEntryPreview *preview = MEM_mallocN(sizeof(*preview), __func__);
+ BLI_join_dirfile(
+ preview->path, sizeof(preview->path), filelist->filelist.root, entry->relpath);
+ preview->index = index;
+ preview->flags = entry->typeflag;
+ preview->img = NULL;
- // printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path, preview->img);
++ // printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path,
++ // preview->img);
+
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list