Skip to content

Commit ef823aa

Browse files
committed
docs + version bump
1 parent 3e33498 commit ef823aa

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ categories.workspace = true
1313
readme.workspace = true
1414

1515
[workspace.package]
16-
version = "0.16.0"
16+
version = "0.16.1"
1717
edition = "2024"
1818
authors = ["Maksymilian Mozolewski <makspl17@gmail.com>"]
1919
license = "MIT OR Apache-2.0"

docs/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [Constructing Arbitrary Types](./ScriptingReference/constructing-arbitrary-types.md)
3131
- [Core Bindings](./ladfiles/bindings.lad.json)
3232
- [Core Callbacks](./ScriptingReference/core-callbacks.md)
33+
- [Asset Operations](./ScriptingReference/asset-operations.md)
3334

3435
# Developing BMS
3536

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Asset Operations
2+
3+
BMS provides built-in support for working with Bevy assets from scripts. You can check for asset existence, retrieve assets by handle, and manipulate asset data through the reflection system.
4+
5+
## Prerequisites
6+
7+
To use asset operations in your scripts, you need to ensure that:
8+
9+
1. Your asset type implements `Asset` and `Reflect`
10+
2. The asset type is registered with `app.register_asset_reflect::<YourAsset>()`
11+
3. The asset handle type has `ReflectHandle` type data registered
12+
13+
## Available Functions
14+
15+
### `world.has_asset(handle)`
16+
17+
Checks if an asset exists and is loaded for the given handle.
18+
19+
**Parameters:**
20+
21+
- `handle`: A ReflectReference to an existing asset handle
22+
23+
**Returns:**
24+
25+
- `boolean`: `true` if the asset exists and is loaded, `false` otherwise
26+
27+
### `world.get_asset(handle, asset_type)`
28+
29+
Retrieves a loaded asset by its handle and returns a reflected reference to it.
30+
31+
**Parameters:**
32+
33+
- `handle`: A reflected reference to an asset handle
34+
- `asset_type`: The type registration of the asset (e.g., `types.Image`, `types.Mesh`)
35+
36+
**Returns:**
37+
38+
- `ReflectReference`: A reference to the asset data, or `nil`/`()` if not loaded
39+
40+
Examples:
41+
See usage examples in the `assets\tests\asset_operations` directory.

0 commit comments

Comments
 (0)