File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
crates/bevy_scene2/macros/src/bsn Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,15 @@ impl<const ALLOW_FLAT: bool> Bsn<ALLOW_FLAT> {
140140 )
141141 }
142142 }
143+ BsnEntry :: NameExpression ( expr_tokens) => {
144+ quote ! {
145+ <#bevy_ecs:: name:: Name as PatchGetTemplate >:: patch(
146+ move |value| {
147+ * value = Name ( { #expr_tokens} . into( ) ) ;
148+ }
149+ )
150+ }
151+ }
143152 } ) ;
144153 }
145154
Original file line number Diff line number Diff line change @@ -73,7 +73,11 @@ impl Parse for BsnEntry {
7373 BsnEntry :: InheritedScene ( input. parse :: < BsnInheritedScene > ( ) ?)
7474 } else if input. peek ( Token ! [ #] ) {
7575 input. parse :: < Token ! [ #] > ( ) ?;
76- BsnEntry :: Name ( input. parse :: < Ident > ( ) ?)
76+ if input. peek ( Brace ) {
77+ BsnEntry :: NameExpression ( braced_tokens ( input) ?)
78+ } else {
79+ BsnEntry :: Name ( input. parse :: < Ident > ( ) ?)
80+ }
7781 } else if input. peek ( Brace ) {
7882 BsnEntry :: SceneExpression ( braced_tokens ( input) ?)
7983 } else if input. peek ( Bracket ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ pub struct Bsn<const ALLOW_FLAT: bool> {
1212#[ derive( Debug ) ]
1313pub enum BsnEntry {
1414 Name ( Ident ) ,
15+ NameExpression ( TokenStream ) ,
1516 GetTemplatePatch ( BsnType ) ,
1617 TemplatePatch ( BsnType ) ,
1718 GetTemplateConstructor ( BsnConstructor ) ,
You can’t perform that action at this time.
0 commit comments