Source/Architecture/Asset System/Back End

Asset System Back End


Important Types

An asset library reference is a handle to uniquely identify an asset library. That may be either one of the builtin libraries (Current File, Current Project, ...) or a custom asset library as defined in the user's Preferences.
It references an asset library through two values:
  • eAssetLibraryType type: Identifies the builtin library, or that a custom library is referenced (ASSET_LIBRARY_CUSTOM).
  • int custom_library_index: If a custom library is referenced, this is set to the index of the custom library in the U.asset_libraries list. Should be -1 otherwise, for easy debugging.
By referencing custom libraries by index, it's ensured that the library reference stays valid even if the library is renamed. Downside is that asset libraries can't easily be reordered. And a bit of care has to be taken when storing references: After removing/adding custom libraries in the Preferences, the library referred to by the index may be a different one or may not exist anymore.