Blender  V3.3
asset_handle.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <string>
8 
9 #include "DNA_space_types.h"
10 
11 #include "BLO_readfile.h"
12 
13 #include "ED_asset_handle.h"
14 #include "ED_asset_list.hh"
15 
16 const char *ED_asset_handle_get_name(const AssetHandle *asset)
17 {
18  return asset->file_data->name;
19 }
20 
22 {
23  return asset->file_data->asset_data;
24 }
25 
27 {
28  return asset->file_data->id;
29 }
30 
32 {
33  return static_cast<ID_Type>(asset->file_data->blentype);
34 }
35 
37 {
38  return asset->file_data->preview_icon_id;
39 }
40 
42  const AssetLibraryReference *asset_library_ref,
43  const AssetHandle *asset,
44  char r_full_lib_path[FILE_MAX_LIBEXTRA])
45 {
46  *r_full_lib_path = '\0';
47 
48  std::string asset_path = ED_assetlist_asset_filepath_get(C, *asset_library_ref, *asset);
49  if (asset_path.empty()) {
50  return;
51  }
52 
53  BLO_library_path_explode(asset_path.c_str(), r_full_lib_path, nullptr, nullptr);
54 }
external readfile function prototypes.
bool BLO_library_path_explode(const char *path, char *r_dir, char **r_group, char **r_name)
Definition: readfile.c:1503
ID_Type
Definition: DNA_ID_enums.h:44
#define FILE_MAX_LIBEXTRA
std::string ED_assetlist_asset_filepath_get(const bContext *C, const AssetLibraryReference &library_reference, const AssetHandle &asset_handle)
Definition: asset_list.cc:472
#define C
Definition: RandGen.cpp:25
void ED_asset_handle_get_full_library_path(const bContext *C, const AssetLibraryReference *asset_library_ref, const AssetHandle *asset, char r_full_lib_path[FILE_MAX_LIBEXTRA])
Definition: asset_handle.cc:41
AssetMetaData * ED_asset_handle_get_metadata(const AssetHandle *asset)
Definition: asset_handle.cc:21
int ED_asset_handle_get_preview_icon_id(const AssetHandle *asset)
Definition: asset_handle.cc:36
const char * ED_asset_handle_get_name(const AssetHandle *asset)
Definition: asset_handle.cc:16
ID * ED_asset_handle_get_local_id(const AssetHandle *asset)
Definition: asset_handle.cc:26
ID_Type ED_asset_handle_get_id_type(const AssetHandle *asset)
Definition: asset_handle.cc:31
const struct FileDirEntry * file_data
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
struct AssetMetaData * asset_data
Definition: DNA_ID.h:368