diff options
author | Julian Eisel <julian@blender.org> | 2021-07-21 21:17:34 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-07-21 21:41:29 +0300 |
commit | 64bb49fa4e3c8bd7e02fd6e5252e40f089d787de (patch) | |
tree | 67c1855bd624ae605ec08ba1295ed2a3b4c2d487 /source/blender/editors/include/ED_asset.h | |
parent | 178086d5810a0de9e1d95c7fbd6c443cd53af40d (diff) |
Cleanup: Move reorganize asset files
I'm trying to move away from general files with lots of things in them,
and instead have many small & focused files. I find that easier to
work with since everything has clear responsibilities, even if there is
some minor overhead in managing all these files.
I also try to differentiate more clearly between public and internal
files. So source files and internal headers are in a `intern/`
sub-directory, public functions are in a number of headers one level
higher.
For convenience and to make this compatible with our existing general
headers in `editors/include`, I made the `ED_asset.h` there include all
these public headers.
This is of course a bit of an experiment, let's see how it works in
practice.
Also corrected the name of `ED_asset_can_make_single_from_context()`.
Diffstat (limited to 'source/blender/editors/include/ED_asset.h')
-rw-r--r-- | source/blender/editors/include/ED_asset.h | 81 |
1 files changed, 13 insertions, 68 deletions
diff --git a/source/blender/editors/include/ED_asset.h b/source/blender/editors/include/ED_asset.h index 40cc7f4194f..42faf716560 100644 --- a/source/blender/editors/include/ED_asset.h +++ b/source/blender/editors/include/ED_asset.h @@ -16,70 +16,19 @@ /** \file * \ingroup editors + * + * The public API for assets is defined in dedicated headers. This is a utility file that just + * includes all of these. */ #pragma once -#include "DNA_ID_enums.h" - #ifdef __cplusplus extern "C" { #endif -struct AssetFilterSettings; -struct AssetLibraryReference; -struct Main; -struct ReportList; -struct bContext; -struct wmNotifier; - -typedef struct AssetTempIDConsumer AssetTempIDConsumer; - -bool ED_asset_mark_id(const struct bContext *C, struct ID *id); -bool ED_asset_clear_id(struct ID *id); - -bool ED_asset_can_make_single_from_context(const struct bContext *C); - -int ED_asset_library_reference_to_enum_value(const struct AssetLibraryReference *library); -struct AssetLibraryReference ED_asset_library_reference_from_enum_value(int value); -const struct EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf(void); - -const char *ED_asset_handle_get_name(const AssetHandle *asset); -AssetMetaData *ED_asset_handle_get_metadata(const AssetHandle *asset); -struct ID *ED_asset_handle_get_local_id(const AssetHandle *asset); -ID_Type ED_asset_handle_get_id_type(const AssetHandle *asset); -int ED_asset_handle_get_preview_icon_id(const AssetHandle *asset); -void ED_asset_handle_get_full_library_path(const struct bContext *C, - const AssetLibraryReference *asset_library, - const AssetHandle *asset, - char r_full_lib_path[]); - -AssetTempIDConsumer *ED_asset_temp_id_consumer_create(const AssetHandle *handle); -void ED_asset_temp_id_consumer_free(AssetTempIDConsumer **consumer); -struct ID *ED_asset_temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer, - const struct bContext *C, - const AssetLibraryReference *asset_library, - ID_Type id_type, - struct Main *bmain, - struct ReportList *reports); - -void ED_assetlist_storage_fetch(const struct AssetLibraryReference *library_reference, - const struct AssetFilterSettings *filter_settings, - const struct bContext *C); -void ED_assetlist_ensure_previews_job(const struct AssetLibraryReference *library_reference, - struct bContext *C); -void ED_assetlist_clear(const struct AssetLibraryReference *library_reference, struct bContext *C); -bool ED_assetlist_storage_has_list_for_library(const AssetLibraryReference *library_reference); -void ED_assetlist_storage_tag_main_data_dirty(void); -void ED_assetlist_storage_id_remap(struct ID *id_old, struct ID *id_new); -void ED_assetlist_storage_exit(void); - -struct ImBuf *ED_assetlist_asset_image_get(const AssetHandle *asset_handle); -const char *ED_assetlist_library_path(const struct AssetLibraryReference *library_reference); - -bool ED_assetlist_listen(const struct AssetLibraryReference *library_reference, - const struct wmNotifier *notifier); -int ED_assetlist_size(const struct AssetLibraryReference *library_reference); +/* Barely anything here. Just general editor level functions. Actual asset level code is in + * dedicated headers. */ void ED_operatortypes_asset(void); @@ -87,17 +36,13 @@ void ED_operatortypes_asset(void); } #endif -/* TODO move to C++ asset-list header? */ -#ifdef __cplusplus +#include "../asset/ED_asset_handle.h" +#include "../asset/ED_asset_library.h" +#include "../asset/ED_asset_list.h" +#include "../asset/ED_asset_mark_clear.h" +#include "../asset/ED_asset_temp_id_consumer.h" -# include <string> - -std::string ED_assetlist_asset_filepath_get(const bContext *C, - const AssetLibraryReference &library_reference, - const AssetHandle &asset_handle); - -# include "BLI_function_ref.hh" -/* Can return false to stop iterating. */ -using AssetListIterFn = blender::FunctionRef<bool(FileDirEntry &)>; -void ED_assetlist_iterate(const AssetLibraryReference *library_reference, AssetListIterFn fn); +/* C++ only headers. */ +#ifdef __cplusplus +# include "../asset/ED_asset_list.hh" #endif |