Blender V4.3
DNA_asset_types.h File Reference
#include "DNA_defs.h"
#include "DNA_listBase.h"
#include "DNA_uuid_types.h"

Go to the source code of this file.

Classes

struct  AssetTag
 User defined tag. Currently only used by assets, could be used more often at some point. Maybe add a custom icon and color to these in future? More...
 
struct  AssetMetaData
 The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data), the data-block becomes an asset. More...
 
struct  AssetLibraryReference
 
struct  AssetWeakReference
 
struct  AssetHandle
 
struct  AssetCatalogPathLink
 

Typedefs

typedef struct AssetTag AssetTag
 User defined tag. Currently only used by assets, could be used more often at some point. Maybe add a custom icon and color to these in future?
 
typedef struct AssetMetaData AssetMetaData
 The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data), the data-block becomes an asset.
 
typedef enum eAssetLibraryType eAssetLibraryType
 
typedef enum eAssetImportMethod eAssetImportMethod
 
typedef enum eAssetLibrary_Flag eAssetLibrary_Flag
 
typedef struct AssetLibraryReference AssetLibraryReference
 
typedef struct AssetWeakReference AssetWeakReference
 
typedef struct AssetHandle AssetHandle
 

Enumerations

enum  eAssetLibraryType { ASSET_LIBRARY_LOCAL = 1 , ASSET_LIBRARY_ALL = 2 , ASSET_LIBRARY_ESSENTIALS = 3 , ASSET_LIBRARY_CUSTOM = 100 }
 
enum  eAssetImportMethod { ASSET_IMPORT_LINK = 0 , ASSET_IMPORT_APPEND = 1 , ASSET_IMPORT_APPEND_REUSE = 2 }
 
enum  eAssetLibrary_Flag { ASSET_LIBRARY_RELATIVE_PATH = (1 << 0) }
 

Typedef Documentation

◆ AssetHandle

typedef struct AssetHandle AssetHandle

To be replaced by #AssetRepresentation!

Not part of the core design, we should try to get rid of it. Only needed to wrap FileDirEntry into a type with PropertyGroup as base, so we can have an RNA collection of AssetHandle's to pass to the UI.

Warning
Never store this! When using blender::ed::asset::list::iterate(), only access it within the iterator function. The contained file data can be freed since the file cache has a maximum number of items.

◆ AssetLibraryReference

typedef struct AssetLibraryReference AssetLibraryReference

Information to identify an asset library. May be either one of the predefined types (current 'Main', builtin library, project library), or a custom type as defined in the Preferences.

If the type is set to ASSET_LIBRARY_CUSTOM, custom_library_index must be set to identify the custom library. Otherwise it is not used.

◆ AssetMetaData

AssetMetaData::AssetMetaData

The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data), the data-block becomes an asset.

Note
This struct must be readable without having to read anything but blocks from the ID it is attached to! That way, asset information of a file can be read, without reading anything more than that from the file. So pointers to other IDs or ID data are strictly forbidden.

Definition at line 49 of file asset.cc.

◆ AssetTag

typedef struct AssetTag AssetTag

User defined tag. Currently only used by assets, could be used more often at some point. Maybe add a custom icon and color to these in future?

◆ AssetWeakReference

AssetWeakReference::AssetWeakReference

Information to refer to an asset (may be stored in files) on a "best effort" basis. It should work well enough for many common cases, but can break. For example when the location of the asset changes, the available asset libraries in the Preferences change, an asset library is renamed, or when a file storing this is opened on a different system (with different Preferences).

It has two main components:

  • A reference to the asset library: The eAssetLibraryType and if that is not enough to identify the library, a library name (typically given by the user, but may change).
  • An identifier for the asset within the library: A relative path currently, which can break if the asset is moved. Could also be a unique key for a database for example.
Note
Needs freeing through the destructor, so either use a smart pointer or #MEM_delete() for explicit freeing.

Definition at line 28 of file asset_weak_reference.cc.

◆ eAssetImportMethod

◆ eAssetLibrary_Flag

◆ eAssetLibraryType

Enumeration Type Documentation

◆ eAssetImportMethod

Enumerator
ASSET_IMPORT_LINK 

Regular data-block linking.

ASSET_IMPORT_APPEND 

Regular data-block appending (basically linking + "Make Local").

ASSET_IMPORT_APPEND_REUSE 

Append data-block with the BLO_LIBLINK_APPEND_LOCAL_ID_REUSE flag enabled. Some typically heavy data dependencies (e.g. the image data-blocks of a material, the mesh of an object) may be reused from an earlier append.

Definition at line 112 of file DNA_asset_types.h.

◆ eAssetLibrary_Flag

Enumerator
ASSET_LIBRARY_RELATIVE_PATH 

Definition at line 123 of file DNA_asset_types.h.

◆ eAssetLibraryType

Enumerator
ASSET_LIBRARY_LOCAL 

Display assets from the current session (current "Main").

ASSET_LIBRARY_ALL 
ASSET_LIBRARY_ESSENTIALS 

Display assets bundled with Blender by default.

ASSET_LIBRARY_CUSTOM 

Display assets from custom asset libraries, as defined in the preferences (bUserAssetLibrary). The name will be taken from #FileSelectParams.asset_library_ref.idname then. In RNA, we add the index of the custom library to this to identify it by index. So keep this last!

Definition at line 97 of file DNA_asset_types.h.