|
Blender V4.3
|
#include <memory>#include "AS_asset_catalog_tree.hh"#include "AS_asset_library.hh"#include "AS_asset_representation.hh"#include "BKE_lib_remap.hh"#include "BKE_main.hh"#include "BKE_preferences.h"#include "BLI_fileops.h"#include "BLI_listbase.h"#include "BLI_path_utils.hh"#include "BLI_string.h"#include "DNA_userdef_types.h"#include "asset_catalog_collection.hh"#include "asset_catalog_definition_file.hh"#include "asset_library_service.hh"#include "utils.hh"Go to the source code of this file.
Namespaces | |
| namespace | blender |
| namespace | blender::asset_system |
| void AS_asset_full_path_explode_from_weak_ref | ( | const AssetWeakReference * | asset_reference, |
| char | r_path_buffer[1090], | ||
| char ** | r_dir, | ||
| char ** | r_group, | ||
| char ** | r_name ) |
Attempt to resolve a full path to an asset based on the currently available (not necessary loaded) asset libraries, and split it into it's directory, ID group and ID name components. The path is not guaranteed to exist on disk. On failure to resolve the reference, return arguments will point to null.
| r_path_buffer | Buffer to hold the result in on success. Will be the full path with null terminators instead of slashes separating the directory, group and name components. Must be at least FILE_MAX_LIBEXTRA long. |
| r_dir | Returns the .blend file path with native slashes on success. Optional (passing null is allowed). For the "Current File" library this will be empty. |
| r_group | Returns the ID group such as "Object", "Material" or "Brush". Optional (passing null is allowed). |
| r_name | Returns the ID name on success. Optional (passing null is allowed). |
Definition at line 104 of file asset_library.cc.
References BLI_assert, BLI_strncpy(), blender::asset_system::AssetLibraryService::get(), and blender::asset_system::AssetLibraryService::resolve_asset_weak_reference_to_exploded_path().
Referenced by blender::bke::asset_edit_id_from_weak_reference(), and blender::ed::sculpt_paint::brush_asset_edit_metadata_exec().
| void AS_asset_libraries_exit | ( | ) |
Force clearing of all asset library data. After calling this, new asset libraries can be loaded just as usual using AS_asset_library_load(), no init or other setup is needed.
Does not need to be called on exit, this is handled internally.
Definition at line 36 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::destroy().
Referenced by wm_file_read_setup_wm_init().
| std::string AS_asset_library_find_suitable_root_path_from_main | ( | const Main * | bmain | ) |
Uses the current location on disk of the file represented by bmain as input to AS_asset_library_find_suitable_root_path_from_path(). Refer to it for a design description.
Definition at line 92 of file asset_library.cc.
References AS_asset_library_find_suitable_root_path_from_path(), and Main::filepath.
Referenced by blender::asset_system::AssetLibraryService::get_asset_library().
| std::string AS_asset_library_find_suitable_root_path_from_path | ( | blender::StringRefNull | input_path | ) |
Try to find an appropriate location for an asset library root from a file or directory path. Does not check if input_path exists.
The design is made to find an appropriate asset library path from a .blend file path, but technically works with any file or directory as input_path. Design is:
| r_library_path | The returned asset library path with a trailing slash, or an empty string if no suitable path is found. Assumed to be a buffer of at least FILE_MAXDIR bytes. |
Definition at line 78 of file asset_library.cc.
References BKE_preferences_asset_library_containing_path(), BLI_path_split_dir_part(), blender::StringRefNull::c_str(), and FILE_MAXDIR.
Referenced by AS_asset_library_find_suitable_root_path_from_main(), and blender::asset_system::AssetCatalogService::find_suitable_cdf_path_for_writing().
| bool AS_asset_library_has_any_unsaved_catalogs | ( | ) |
Return whether any loaded AssetLibrary has unsaved changes to its catalogs.
Definition at line 66 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::get(), and blender::asset_system::AssetLibraryService::has_any_unsaved_catalogs().
Referenced by blender::ed::asset::asset_catalogs_save_poll(), block_create__close_file_dialog(), and wm_file_or_session_data_has_unsaved_changes().
| AssetLibrary * AS_asset_library_load | ( | const char * | name, |
| const char * | library_dirpath ) |
Return the #AssetLibrary rooted at the given directory path.
Will return the same pointer for repeated calls, until another blend file is loaded.
To get the in-memory-only "current file" asset library, pass an empty path.
Definition at line 50 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::get(), blender::asset_system::AssetLibraryService::get_asset_library_current_file(), blender::asset_system::AssetLibraryService::get_asset_library_on_disk_custom(), and lib.
| AssetLibrary * AS_asset_library_load | ( | const Main * | bmain, |
| const AssetLibraryReference & | library_reference ) |
Load the data for an asset library, but not the asset representations themselves (loading these is currently not done in the asset system).
For the "All" asset library (ASSET_LIBRARY_ALL), every other known asset library will be loaded as well. So a call to #AssetLibrary::foreach_loaded() can be expected to iterate over all libraries.
Definition at line 43 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::get(), and blender::asset_system::AssetLibraryService::get_asset_library().
Referenced by blender::ed::sculpt_paint::brush_asset_edit_metadata_exec(), blender::ed::sculpt_paint::brush_asset_save_as_exec(), filelist_readjob_all_asset_library(), filelist_readjob_load_asset_library_data(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), and blender::ed::sculpt_paint::visit_library_catalogs_catalog_for_search().
| void AS_asset_library_remap_ids | ( | const blender::bke::id::IDRemapper & | mappings | ) |
An asset library can include local IDs (IDs in the current file). Their pointers need to be remapped on change (or assets removed as IDs gets removed).
Definition at line 97 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::foreach_loaded_asset_library(), blender::asset_system::AssetLibraryService::get(), and blender::asset_system::AssetLibrary::remap_ids_and_remove_invalid().
Referenced by WM_main_remap_editor_id_reference().
| std::string AS_asset_library_root_path_from_library_ref | ( | const AssetLibraryReference & | library_reference | ) |
Definition at line 72 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::root_path_from_library_ref().
Referenced by blender::ed::sculpt_paint::library_to_library_ref(), and blender::ed::asset::list::AssetList::setup().