|
Blender V5.0
|
#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_space_types.h"#include "DNA_userdef_types.h"#include "DNA_windowmanager_types.h"#include "asset_catalog_collection.hh"#include "asset_catalog_definition_file.hh"#include "asset_library_service.hh"#include "essentials_library.hh"#include "runtime_library.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[1282], | ||
| 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 108 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::asset::catalogs_save_from_asset_reference().
| 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 40 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::destroy().
Referenced by wm_file_read_setup_wm_init().
| void AS_asset_library_essential_import_method_update | ( | ) |
This is not done as part of AS_asset_library_import_method_ensure_valid because it changes run-time data only and does not need to happen during versioning (also it appears to break tests when run during versioning).
Definition at line 216 of file asset_library.cc.
References AS_asset_library_load(), ASSET_LIBRARY_ESSENTIALS, AssetLibraryReference::custom_library_index, AssetLibraryReference::type, and blender::asset_system::EssentialsAssetLibrary::update_default_import_method().
| 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 96 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(), and blender::asset_system::AssetLibraryService::move_runtime_current_file_into_on_disk_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 82 of file asset_library.cc.
References BKE_preferences_asset_library_containing_path(), BLI_path_split_dir_part(), blender::StringRefNull::c_str(), FILE_MAXDIR, and U.
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 70 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().
| void AS_asset_library_import_method_ensure_valid | ( | Main & | bmain | ) |
Updates the default import method for asset libraries based on #U.experimental.no_data_block_packing.
Definition at line 210 of file asset_library.cc.
References update_import_method_for_asset_browsers(), and update_import_method_for_user_libraries().
| 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 47 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::get(), and blender::asset_system::AssetLibraryService::get_asset_library().
Referenced by AS_asset_library_essential_import_method_update(), blender::ed::sculpt_paint::brush_asset_save_as_exec(), blender::ed::animrig::create_pose_asset_local(), blender::ed::animrig::create_pose_asset_user_library(), filelist_readjob_all_asset_library(), filelist_readjob_asset_library(), filelist_readjob_load_asset_library_data(), and blender::ed::asset::visit_library_catalogs_catalog_for_search().
| AssetLibrary * AS_asset_library_load_from_directory | ( | 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 54 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(), lib, and name.
Referenced by blender::asset_system::tests::TEST_F(), and blender::asset_system::tests::TEST_F().
| 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 101 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 76 of file asset_library.cc.
References blender::asset_system::AssetLibraryService::root_path_from_library_ref().
Referenced by blender::ed::asset::list::AssetList::setup().
|
static |
Definition at line 183 of file asset_library.cc.
References SpaceFile::asset_params, FILE_ASSET_IMPORT_APPEND_REUSE, FILE_ASSET_IMPORT_PACK, FileAssetSelectParams::import_method, LISTBASE_FOREACH, Main::screens, SPACE_FILE, and U.
Referenced by AS_asset_library_import_method_ensure_valid().
|
static |
Definition at line 167 of file asset_library.cc.
References ASSET_IMPORT_APPEND_REUSE, ASSET_IMPORT_PACK, LISTBASE_FOREACH, and U.
Referenced by AS_asset_library_import_method_ensure_valid().