--- tags: Assets, Asset Browser, Python --- # Asset Browser from Python API point of view This document is **not exhaustive**, and just serves as a scratch pad where I can jot down things. ## Missing Python API functionality This is what I (Sybren) found missing, but what I'd like to have available for making the Pose Library prototype: - Getting active asset in Asset Browser (currently only works for 'current file' assets, i.e. when the asset is an already-loaded datablock), i.e. enough information to: - know what the type of the asset is (so currently the ID type), and - to load the datablock itself. - Getting information from all available assets (for example to get all tags). - A way to refresh the Asset Browser (for example after creating a new asset). - Setting active asset in Asset Browser (for example after creating a new asset). - Getting list of selected assets (for example for mass-rename or mass-tagging). - Callback when active asset changes. This is necessary to enable "follow mode". - Callback when asset is double-clicked. ## Caching: Appending vs. Linking Action datablock with pose must be loaded into memory, in order to apply the pose. There are multiple ways in which a datablock can be loaded: - **Linking:** - Pros: - Most natural approach. - Keeps link with original asset file, so reloading is possible. - Reloading operator already available. - Cons: - Pollutes the blend file namespace. - Link will be saved with the blend file. This is permanent (until cleaned up) and will produce errors when the original pose library is no longer available. - Needs reloading of links when pose library changes. - **Appending:** - Pros: - No link to original asset file, so will not cause errors when asset file is no longer available. - Cons: - Pollutes the blend file namespace and expands the blend file. - Unable to reload. Either approach can be used in a *temporary* fashion, like such: 1. Link or Append the datablock 2. Apply the pose 3. Remove the datablock 4. In case of linking: remove the library link The last two steps can be avoided by using a **non-main datablock** (i.e. a datablock that will not be part of the blend file itself) for the asset.