Assets: add min/max version of Blender to online asset listing

Add two Blender versions to each asset in the online asset listing:
`min` and `until`. The asset is shown in Blender if `min <=
BLENDER_VERSION < until`.

This includes changes to the schema, the listing generator, and
Blender itself to do the filtering.

This is intended for two things:

- Ensuring older Blenders don't see assets that are made with a newer
  version of Blender.
- Making it possible to replace assets, where older Blender versions
  still see the older version of the asset, and newer versions of
  Blender only see the newer asset.

Example listing JSON:

```json
{
  "name": "Mrežnica",
  "id_type": "WORLD",
  "files": ["worlds.blend"],
  "bl_versions": {
    "min": "5.2"
  },
  "thumbnail": {
    "url": "worlds_thumbnails/World/mreznica.webp",
    "hash": "SHA256:9785a7e242dbd8ff973736c51fb09a6a1efe401dfff62d38f38d9fb48b7f6e46"
  },
  "meta": {
    "catalog_id": "efd4ea51-c968-44a6-9781-09c20796e8a6",
    "tags": ["River", "Croatia", "HDRi"],
    "author": "Sybren A. Stüvel",
    "description": "HDRi of river Mrežnica in Croatia"
  }
},
```

The listing generator writes the version of Blender that was used to
save the blend file.

Once an asset is downloaded, it will always be shown, regardless of
the version of Blender used. That may be changed in a future PR, but
such filtering is out of scope for this one.

Note: after landing this, all remote asset listings need to be
regenerated. Without a `bl_versions.max` field, the asset will not be
shown in Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/158768
This commit is contained in:
Sybren A. Stüvel 2026-05-19 13:58:59 +02:00
parent 2b8e1805f3
commit e36f48f8b4
6 changed files with 140 additions and 7 deletions

View file

@ -67,6 +67,7 @@ class ListingDownloaderTest(unittest.TestCase):
files=[blend_path],
thumbnail=api_models.URLWithHash(url="thumbs/kubus.webp", hash="12345"),
meta=None,
bl_versions=api_models.AssetBlenderVersionsV1(min="2.0"),
),
],
files=[
@ -121,6 +122,7 @@ class ListingDownloaderTest(unittest.TestCase):
files=[bad_path],
thumbnail=api_models.URLWithHash(url="thumbs/kubus.webp", hash="12345"),
meta=None,
bl_versions=api_models.AssetBlenderVersionsV1(min="2.0"),
),
],
files=[