1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
use TokenStream;
use ;
/// Macro which returns a [`Scene`](https://docs.rs/bevy/latest/bevy/prelude/trait.Scene.html), comprehensive docs at [`bevy_scene`](https://docs.rs/bevy/latest/bevy/scene/index.html)
///
/// Example macro showcasing most syntax (complex, most scenes won't look like this):
/// ```rust,ignore
/// bsn! {
/// some_scene() // include a scene function
/// #SomeName // entity name, will insert Name("SomeName")
/// ComponentA // component without fields: will use the default field values
/// ComponentB(0.0) // when setting a field, unmentioned fields will use defaults
/// Node {
/// height: px(0.1) // same with named fields, unmentioned ones stay default
/// }
/// on(|evt: On<MyEntityEvent>, mut query: Query<&mut ComponentB>| { // add an observer
/// let mut b = query.get_mut(evt.entity).unwrap();
/// b.0 += evt.value;
/// })
/// Children [ // spawning multiple related entities using a RelationshipTarget component
/// #Child1 ComponentA, // entities are comma-separated
/// (other_scene() #Child3), // parentheses around a single entity are optional for clarity
/// Link(#SomeName), // passing a entity reference to a component as `Entity`, component has to implement FromTemplate
/// @MySceneComponent { // components which derive SceneComponent have scenes and can be inherited from
/// @some_prop: 3, // props, look like fields prefixed with @ but end up passed to the components scene as arguments
/// normal_field: 5 // while normal fields are the actual fields of the component
/// },
/// Node {
/// width: some_var // variables can be assigned to field values
/// }
/// ComponentB({some_variable + 3.}) // values can be expressions, when wrapped in {}
/// @Container {
/// @items: {
/// bsn_list![ // sometimes you may need to nest macro calls
/// #Item1 SomeComponent, // note: the name #Item1 here is in its own scope
/// some_scene() #Item2
/// ]
/// }
/// }
/// ]
/// }
/// ```
/// Creates a `SceneList` using BSN (Bevy Scene Notation) syntax.
///
/// This is useful when you want multiple root entities in your scene
/// that do not share a common parent, or if you want to create multiple scenes at once.
///
/// Like in [`bsn!`], commas separate entities,
/// while whitespace separates components on the same entity.
///
/// All root entries in a [`bsn_list!`] share a single name scope, so sibling root entities
/// can cross-reference each other by `#Name`.
/// This is not possible with separate [`bsn!`] calls, and is a key motivation for using [`bsn_list!`].
///
/// See [`bsn!`] for an example of the syntax.
/// See the `bevy_scene` crate docs for a high-level overview of the key concepts.#[doc(hidden)]