blender/scripts/templates_toml
Campbell Barton fbf13b7378 Extensions: support remote asset-libraries
An extension can define a remote asset library, added to the preferences
when installed. This allows asset libraries to be distributed & updated
using the extensions system, optionally sharing the repository's access
token.

UI:
- Dropping a ZIP file into Blender installs & enables the extension with
  its asset library.
- The preferences group libraries under the repository which defines
  them (collapsible, with a new "extension" icon), showing the access
  token when it's inherited. Their name & URL are read-only,
  uninstall the extension to remove them.
- The asset library menus are grouped by owner
  (user, project & extension).
- "View Details" in the extension menu switches to the asset view and
  selects the library in the preferences.
- "View Extension..." from the asset context menu shows the extension
  from the asset listing, so it's possible to look up the extension
  from any asset.

CLI:
- Building & installing asset-library extensions,
  writing the preferences when a library is registered.
- `server-generate --assetlib-auth-method=FROM_REPOSITORY` sets
  `assetlib_auth_method` in the listing, sharing the repository's access
  token with the asset libraries of its extensions. `PER_LIBRARY` (the
  default) leaves each library to authenticate on its own.
- A new `repo-info` sub-command shows high level repository information,
  including this method.

Python API:
- `asset_libraries.new()` supports remote & extension defined libraries.
- `UserAssetLibrary.extension_id` exposes the defining extension.
- `asset_libraries.active` is the library shown in the preferences.
- `UserAssetLibrary.is_available()` has been added which checks
  the library is both enabled and it's extension repository is enabled
  (if it's from an extension).
- `AssetLibrary.user_library` is exposed to support "View Extensions".

Tests:
- `test_cli`: `repo-info` & the listings authentication method.
- `test_cli_blender`: building, validating & installing asset-library
  extensions.
- `test_blender_asset_auth`: syncing a repository & downloading an
  asset listing which require a token, checking which libraries resolve
  the repository's token under each authentication method.

Details:
- The manifest supports `type = "asset-library"` with
  an `[asset_library]` table defining the `remote_url`,
  optionally `[asset_library.auth]` declaring
  `auth_method = "TOKEN"` & whether a token is `required`.
- Only the `scripts` permission applies to asset libraries.
- Installing adds the library, uninstalling removes it,
  upgrading applies the name & URL from the manifest.
  Enabling & disabling the extension toggles the library's "enabled"
  setting, keeping its entry so it can be enabled again.
- The extensions access token is forwarded when downloading the listing,
  assets & previews.
- Libraries are synchronized on startup,
  following extensions installed or removed by other Blender instances,
  as well as repositories renamed or removed.
- Disabling a repository doesn't change the "enabled"
  setting of its libraries,
  instead their is_available() method returns false,
  they're not available until the repository is enabled again,
  similar to add-ons.

Ref !162621
2026-10-06 15:47:47 +11:00
..
blender_manifest.toml Extensions: support remote asset-libraries 2026-10-06 15:47:47 +11:00