UI: Region polling support #105088

Merged
Julian Eisel merged 39 commits from JulianEisel/blender:temp-region-poll into main 2023-04-05 15:30:46 +02:00
10 changed files with 17 additions and 15 deletions
Showing only changes of commit e8575bfd4a - Show all commits

View File

@ -109,7 +109,6 @@ class AssetLibrary {
/** Remove an asset from the library that was added using #add_external_asset() or
* #add_local_id_asset(). Can usually be expected to be constant time complexity (worst case may
* differ).
*
* \note This is save to call if \a asset is freed (dangling reference), will not perform any
* change then.
* \return True on success, false if the asset couldn't be found inside the library (also the

View File

@ -257,7 +257,6 @@ StringRefNull AssetLibrary::root_path() const
return *root_path_;
}
/* TODO get rid of this. */
Vector<AssetLibraryReference> all_valid_asset_library_refs()
{
Vector<AssetLibraryReference> result;

View File

@ -31,8 +31,6 @@ class AssetStorage {
* faster lookups. Not possible until each asset is only represented once in the storage. */
StorageT local_id_assets_;
friend class AssetLibrary;
public:
/** See #AssetLibrary::add_external_asset(). */
AssetRepresentation &add_external_asset(AssetIdentifier &&identifier,

View File

@ -19,6 +19,8 @@ struct Main;
void ED_asset_catalogs_save_from_main_path(struct AssetLibrary *library, const struct Main *bmain);
/** Saving catalog edits when the file is saved is a global option shared for each asset library,
* and as such ignores the per asset library #ED_asset_catalogs_read_only(). */
void ED_asset_catalogs_set_save_catalogs_when_file_is_saved(bool should_save);
bool ED_asset_catalogs_get_save_catalogs_when_file_is_saved(void);

View File

@ -22,6 +22,10 @@
struct AssetLibrary;
/**
* Returns if the catalogs of \a library are allowed to be editable, or if the UI should forbid
* edits.
*/
[[nodiscard]] bool ED_asset_catalogs_read_only(const AssetLibrary &library);
blender::asset_system::AssetCatalog *ED_asset_catalog_add(

View File

@ -29,10 +29,13 @@ AssetLibraryReference ED_asset_library_reference_from_enum_value(int value);
* Since this is meant for UI display, skips non-displayable libraries, that is, libraries with an
* empty name or path.
*
* \param include_local_library: Whether to include the "Current File" library or not.
* \param include_generated: Whether to include libraries that are generated and thus cannot be
* written to. Setting this to false means only custom libraries will be
* included, since they are stored on disk with a single root directory,
* thus have a well defined location that can be written to.
*/
const struct EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf(
bool include_local_library);
bool include_generated);
#ifdef __cplusplus
}

View File

@ -70,14 +70,13 @@ AssetLibraryReference ED_asset_library_reference_from_enum_value(int value)
return library;
}
const EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf(
const bool include_local_library)
const EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf(const bool include_generated)
{
EnumPropertyItem *item = nullptr;
int totitem = 0;
if (include_local_library) {
const EnumPropertyItem predefined_items[] = {
if (include_generated) {
const EnumPropertyItem generated_items[] = {
{ASSET_LIBRARY_ALL,
"ALL",
ICON_NONE,
@ -91,8 +90,9 @@ const EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf(
{0, nullptr, 0, nullptr, nullptr},
};
/* Add predefined items. */
RNA_enum_items_add(&item, &totitem, predefined_items);
/* Add predefined libraries that are generated and not simple directories that can be written
* to. */
RNA_enum_items_add(&item, &totitem, generated_items);
}
/* Add separator if needed. */

View File

@ -555,7 +555,6 @@ static void file_draw_preview(const SpaceFile *sfile,
/* path is no more static, cannot give it directly to but... */
else if (sfile->browse_mode == FILE_BROWSE_MODE_ASSETS &&
(file->typeflag & FILE_TYPE_ASSET) != 0) {
/* TODO enable drag & drop support, get path from asset representation. */
char blend_path[FILE_MAX_LIBEXTRA];
if (BLO_library_path_explode(path, blend_path, NULL, NULL)) {

View File

@ -1643,7 +1643,6 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry
BLI_thread_queue_push(cache->previews_done, preview);
}
else {
/* XXX */
if (entry->redirection_path) {
BLI_strncpy(preview->filepath, entry->redirection_path, FILE_MAXDIR);
}

View File

@ -995,7 +995,6 @@ enum eFileDetails {
/** File selector types. */
typedef enum eFileSelectType {
FILE_SELECT_TYPE_UNSET = 0,
FILE_LOADLIB = 1,
FILE_MAIN = 2,
/** Load assets from #Main. */