Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/filelist.cc
| Show All 13 Lines | |||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||
| #ifndef WIN32 | #ifndef WIN32 | ||||
| # include <unistd.h> | # include <unistd.h> | ||||
| #else | #else | ||||
| # include <direct.h> | # include <direct.h> | ||||
| # include <io.h> | # include <io.h> | ||||
| #endif | #endif | ||||
| #include "AS_asset_library.h" | |||||
| #include "AS_asset_library.hh" | |||||
| #include "AS_asset_representation.hh" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLF_api.h" | #include "BLF_api.h" | ||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_fileops.h" | #include "BLI_fileops.h" | ||||
| #include "BLI_fileops_types.h" | #include "BLI_fileops_types.h" | ||||
| #include "BLI_fnmatch.h" | #include "BLI_fnmatch.h" | ||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BLI_linklist.h" | #include "BLI_linklist.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_stack.h" | #include "BLI_stack.h" | ||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLI_task.h" | #include "BLI_task.h" | ||||
| #include "BLI_threads.h" | #include "BLI_threads.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_uuid.h" | #include "BLI_uuid.h" | ||||
| #ifdef WIN32 | #ifdef WIN32 | ||||
| # include "BLI_winstuff.h" | # include "BLI_winstuff.h" | ||||
| #endif | #endif | ||||
| #include "BKE_asset.h" | #include "BKE_asset.h" | ||||
| #include "BKE_asset_library.h" | |||||
| #include "BKE_asset_library.hh" | |||||
| #include "BKE_asset_representation.hh" | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_icons.h" | #include "BKE_icons.h" | ||||
| #include "BKE_idtype.h" | #include "BKE_idtype.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_main_idmap.h" | #include "BKE_main_idmap.h" | ||||
| #include "BKE_preferences.h" | #include "BKE_preferences.h" | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | struct { | ||||
| ID *id; | ID *id; | ||||
| /* For the few file types that have the preview already in memory. For others, there's delayed | /* For the few file types that have the preview already in memory. For others, there's delayed | ||||
| * preview reading from disk. Non-owning pointer. */ | * preview reading from disk. Non-owning pointer. */ | ||||
| PreviewImage *preview_image; | PreviewImage *preview_image; | ||||
| } local_data; | } local_data; | ||||
| /* References an asset in the asset library storage. */ | /* References an asset in the asset library storage. */ | ||||
| bke::AssetRepresentation *asset; /* Non-owning. */ | asset_system::AssetRepresentation *asset; /* Non-owning. */ | ||||
| /* See #FILE_ENTRY_BLENDERLIB_NO_PREVIEW. */ | /* See #FILE_ENTRY_BLENDERLIB_NO_PREVIEW. */ | ||||
| bool blenderlib_has_no_preview; | bool blenderlib_has_no_preview; | ||||
| /** Defined in BLI_fileops.h */ | /** Defined in BLI_fileops.h */ | ||||
| eFileAttributes attributes; | eFileAttributes attributes; | ||||
| BLI_stat_t st; | BLI_stat_t st; | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
| struct FileListReadJob; | struct FileListReadJob; | ||||
| struct FileList { | struct FileList { | ||||
| FileDirEntryArr filelist; | FileDirEntryArr filelist; | ||||
| eFileSelectType type; | eFileSelectType type; | ||||
| /* The library this list was created for. Stored here so we know when to re-read. */ | /* The library this list was created for. Stored here so we know when to re-read. */ | ||||
| AssetLibraryReference *asset_library_ref; | AssetLibraryReference *asset_library_ref; | ||||
| bke::AssetLibrary *asset_library; /* Non-owning. */ | asset_system::AssetLibrary *asset_library; /* Non-owning. */ | ||||
| short flags; | short flags; | ||||
| short sort; | short sort; | ||||
| FileListFilter filter_data; | FileListFilter filter_data; | ||||
| /** | /** | ||||
| ▲ Show 20 Lines • Show All 3,442 Lines • ▼ Show 20 Lines | static void filelist_readjob_load_asset_library_data(FileListReadJob *job_params, bool *do_update) | ||||
| } | } | ||||
| if (tmp_filelist->asset_library != nullptr) { | if (tmp_filelist->asset_library != nullptr) { | ||||
| /* Asset library already loaded. */ | /* Asset library already loaded. */ | ||||
| return; | return; | ||||
| } | } | ||||
| /* Load asset catalogs, into the temp filelist for thread-safety. | /* Load asset catalogs, into the temp filelist for thread-safety. | ||||
| * #filelist_readjob_endjob() will move it into the real filelist. */ | * #filelist_readjob_endjob() will move it into the real filelist. */ | ||||
| tmp_filelist->asset_library = BKE_asset_library_load(job_params->current_main, | tmp_filelist->asset_library = AS_asset_library_load(job_params->current_main, | ||||
| *job_params->filelist->asset_library_ref); | *job_params->filelist->asset_library_ref); | ||||
| *do_update = true; | *do_update = true; | ||||
| } | } | ||||
| static void filelist_readjob_main_assets_add_items(FileListReadJob *job_params, | static void filelist_readjob_main_assets_add_items(FileListReadJob *job_params, | ||||
| bool * /*stop*/, | bool * /*stop*/, | ||||
| bool *do_update, | bool *do_update, | ||||
| float * /*progress*/) | float * /*progress*/) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 312 Lines • Show Last 20 Lines | |||||