-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Entity path methods and bsn entity path resolving #24018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alice-i-cecile
merged 24 commits into
bevyengine:main
from
Freyja-moth:bsn_path_resolution
Apr 29, 2026
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e016df0
Added path resolve methods to `World` and use them in `EntityTemplate`
Freyja-moth d5574ba
Remove old doc notes
Freyja-moth 6da3ba4
Merge branch 'main' into bsn_path_resolution
Freyja-moth a0f72ee
Finally fix naming merge issues
Freyja-moth c23f117
Spelling error as suggested by ci
Freyja-moth 6ba9274
Fixed doc generic issues
Freyja-moth 49c3b8a
Even more doc issues
Freyja-moth 65c05a1
Changed methods to remove generic `C`
Freyja-moth 92dff77
Update docs
Freyja-moth ce7192e
Update template method to remove generic
Freyja-moth e3e8edb
Remove unneeded generics
Freyja-moth 5942266
Added release notes
Freyja-moth 8a52fcb
Cleaned up docs and added note about ambiuous / usage
Freyja-moth 40e06fc
Formatting
Freyja-moth 24ec7d6
Even more doc issues
Freyja-moth e8ac3d1
Final round for formatting, please
Freyja-moth 4319a8e
Please ci I am begging you I am tired
Freyja-moth 57a920a
Added language to code block
Freyja-moth 32449ab
Pedantic stuff
Freyja-moth 45cb793
Even more formatting
Freyja-moth 83b42b3
Final doc cleanup and test making
Freyja-moth 88912ed
Spelling errors and formatting
Freyja-moth 969bf02
Yet more test issues
Freyja-moth d44b6cc
Wrong vice
alice-i-cecile File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- | ||
| title: Feature name | ||
| authors: ["@Freyja-moth"] | ||
| pull_requests: [24018] | ||
| --- | ||
|
|
||
| Paths can now be resolved to an entity and vice versa. | ||
| These use the `Name` component, following the `ChildOf` relationship. | ||
|
|
||
| ```rust | ||
| fn character(world: &mut World, player: Entity) -> Result { | ||
| let sword = world.get_entity_from_path("Items/Weapons/Sword", None)?; | ||
|
|
||
| world.entity_mut(player) | ||
| .add_one_related::<ItemOf>(sword); | ||
|
|
||
| // Relative paths can also be resolved | ||
| let left_arm = world.get_entity_from_path("Arms/Left", Some(player))?; | ||
|
|
||
| // You can even use custom relationships. | ||
| let apple = world.get_entity_from_relationship_path::<ItemOf>("Player/Satchel/Apple", None)?; | ||
|
|
||
| Ok(()) | ||
| } | ||
| ``` | ||
|
|
||
| With this a new variant has been added to `EntityTemplate` so that paths can be resolved in scenes | ||
|
|
||
| ```rust | ||
| fn player() -> impl Scene { | ||
| bsn! { | ||
| #Player | ||
| Player | ||
| Wielding("Items/Weapons/Sword") | ||
| } | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.