|
Blender V4.5
|
#include <AS_asset_representation.hh>
Inherits blender::NonCopyable, and blender::NonMovable.
Public Member Functions | |
| AssetRepresentation (StringRef relative_asset_path, StringRef name, int id_type, std::unique_ptr< AssetMetaData > metadata, AssetLibrary &owner_asset_library) | |
| AssetRepresentation (StringRef relative_asset_path, ID &id, AssetLibrary &owner_asset_library) | |
| ~AssetRepresentation () | |
| AssetWeakReference | make_weak_reference () const |
| void | ensure_previewable () |
| PreviewImage * | get_preview () const |
| StringRefNull | get_name () const |
| ID_Type | get_id_type () const |
| AssetMetaData & | get_metadata () const |
| StringRefNull | library_relative_identifier () const |
| std::string | full_path () const |
| std::string | full_library_path () const |
| std::optional< eAssetImportMethod > | get_import_method () const |
| bool | may_override_import_method () const |
| bool | get_use_relative_path () const |
| ID * | local_id () const |
| bool | is_local_id () const |
| AssetLibrary & | owner_asset_library () const |
Friends | |
| class | AssetLibrary |
Definition at line 35 of file AS_asset_representation.hh.
| blender::asset_system::AssetRepresentation::AssetRepresentation | ( | StringRef | relative_asset_path, |
| StringRef | name, | ||
| int | id_type, | ||
| std::unique_ptr< AssetMetaData > | metadata, | ||
| AssetLibrary & | owner_asset_library ) |
Constructs an asset representation for an external ID. The asset will not be editable.
Definition at line 27 of file asset_representation.cc.
References AssetLibrary, AssetRepresentation(), nullptr, and owner_asset_library().
Referenced by AssetRepresentation().
| blender::asset_system::AssetRepresentation::AssetRepresentation | ( | StringRef | relative_asset_path, |
| ID & | id, | ||
| AssetLibrary & | owner_asset_library ) |
Constructs an asset representation for an ID stored in the current file. This makes the asset local and fully editable.
Definition at line 38 of file asset_representation.cc.
References AssetLibrary, and owner_asset_library().
| blender::asset_system::AssetRepresentation::~AssetRepresentation | ( | ) |
Definition at line 50 of file asset_representation.cc.
References BKE_previewimg_cached_release(), and full_path().
| void blender::asset_system::AssetRepresentation::ensure_previewable | ( | ) |
Makes sure the asset ready to load a preview, if necessary.
For local IDs it calls BKE_previewimg_id_ensure(). For others, this sets loading information to the preview but doesn't actually load it. To load it, attach its #PreviewImageRuntime::icon_id to a UI button (UI loads it asynchronously then) or call BKE_previewimg_ensure() (not asynchronous).
Definition at line 64 of file asset_representation.cc.
References BKE_icon_preview_ensure(), BKE_previewimg_cached_thumbnail_read(), BKE_previewimg_id_ensure(), full_path(), local_id(), and THB_SOURCE_BLEND.
| std::string blender::asset_system::AssetRepresentation::full_library_path | ( | ) | const |
Definition at line 131 of file asset_representation.cc.
References BKE_blendfile_library_path_explode(), and full_path().
Referenced by WM_drag_asset_id_import().
| std::string blender::asset_system::AssetRepresentation::full_path | ( | ) | const |
Definition at line 121 of file asset_representation.cc.
References BLI_path_join, and FILE_MAX.
Referenced by ensure_previewable(), full_library_path(), and ~AssetRepresentation().
| ID_Type blender::asset_system::AssetRepresentation::get_id_type | ( | ) | const |
Definition at line 100 of file asset_representation.cc.
References GS, and local_id().
Referenced by view3d_drop_id_in_main_region_poll_get_id_type(), WM_drag_asset_id_import(), WM_drag_free_imported_drag_ID(), and WM_drag_get_asset_data().
| std::optional< eAssetImportMethod > blender::asset_system::AssetRepresentation::get_import_method | ( | ) | const |
Get the import method to use for this asset. A different one may be used if may_override_import_method() returns true, otherwise, the returned value must be used. If there is no import method predefined for this asset no value is returned.
Definition at line 143 of file asset_representation.cc.
| AssetMetaData & blender::asset_system::AssetRepresentation::get_metadata | ( | ) | const |
Definition at line 108 of file asset_representation.cc.
References local_id().
Referenced by compare_asset_catalog(), blender::ed::space_node::node_group_drop_poll(), view3d_geometry_nodes_drop_poll(), and WM_drag_get_asset_meta_data().
| StringRefNull blender::asset_system::AssetRepresentation::get_name | ( | ) | const |
Definition at line 92 of file asset_representation.cc.
References local_id().
Referenced by WM_drag_asset_id_import(), and WM_drag_get_item_name().
| PreviewImage * blender::asset_system::AssetRepresentation::get_preview | ( | ) | const |
Get the preview of this asset.
This will only return a preview for local ID assets or after ensure_previewable() was called.
Definition at line 83 of file asset_representation.cc.
References BKE_previewimg_id_get(), and local_id().
| bool blender::asset_system::AssetRepresentation::get_use_relative_path | ( | ) | const |
Definition at line 156 of file asset_representation.cc.
Referenced by WM_drag_asset_id_import().
| bool blender::asset_system::AssetRepresentation::is_local_id | ( | ) | const |
Returns if this asset is stored inside this current file, and as such fully editable.
Definition at line 166 of file asset_representation.cc.
Referenced by local_id(), blender::asset_system::AssetLibrary::remap_ids_and_remove_invalid(), and blender::ed::asset::AssetClearHelper::reportResults().
| StringRefNull blender::asset_system::AssetRepresentation::library_relative_identifier | ( | ) | const |
Definition at line 116 of file asset_representation.cc.
| ID * blender::asset_system::AssetRepresentation::local_id | ( | ) | const |
If this asset is stored inside this current file (is_local_id() is true), this returns the ID's pointer, otherwise null.
Definition at line 161 of file asset_representation.cc.
References is_local_id().
Referenced by ensure_previewable(), get_id_type(), get_metadata(), get_name(), get_preview(), and WM_drag_add_asset_list_item().
| AssetWeakReference blender::asset_system::AssetRepresentation::make_weak_reference | ( | ) | const |
Create a weak reference for this asset that can be written to files, but can break under a number of conditions. A weak reference can only be created if an asset representation is owned by an asset library.
Definition at line 59 of file asset_representation.cc.
Referenced by blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), and blender::asset_system::tests::TEST_F().
| bool blender::asset_system::AssetRepresentation::may_override_import_method | ( | ) | const |
Returns if this asset may be imported with an import method other than the one returned by get_import_method(). Also returns true if there is no predefined import method (when get_import_method() returns no value).
Definition at line 148 of file asset_representation.cc.
| AssetLibrary & blender::asset_system::AssetRepresentation::owner_asset_library | ( | ) | const |
Definition at line 171 of file asset_representation.cc.
References AssetLibrary.
Referenced by AssetLibrary, AssetRepresentation(), AssetRepresentation(), and compare_asset_catalog().
|
friend |
Definition at line 52 of file AS_asset_representation.hh.
References AssetLibrary, and owner_asset_library().
Referenced by AssetLibrary, AssetRepresentation(), AssetRepresentation(), and owner_asset_library().