You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This approach left developers unable to reference a unique Bvh animation without risking the chances of it being removed or moved as the only approach right now is to store the index of that Bvh animation.
Example
During runtime, an index might be used to reference a specific Bvh animation in the bvh_animation list:
let index = None;for i in0..bvh_animation.len(){// find specific bvh animationif xxx == yyy {
index = Some(i);break;}}
The specific index that is being extracted might not stay true if something like this happen during runtime:
bvh_animation.insert(0, new_bvh);
This is a hypothetical situation that may or may not happen for whatever reason, but knowing that such a simple innocent insert operation might cause a seemingly untraceable bug is mind-boggling!
Proposed Solution
We treat every Bvh animation as an asset (a simplified sample). Instead of storing indices pointing to a specific animation, we use Bevy's asset Handle<T> system.
This will guarantee us a unique pointer towards the Bvh animation asset and tell us when it is missing.
nixon-voxell
changed the title
Treat BVH animation data as an asset and create and asset loader for it
Treat BVH animation data as an asset and create an asset loader for it
Apr 8, 2024
The Idea
At the moment, BVH data is loaded and stored inside a Bevy resource struct as a list:
This approach left developers unable to reference a unique
Bvh
animation without risking the chances of it being removed or moved as the only approach right now is to store the index of thatBvh
animation.Example
During runtime, an index might be used to reference a specific
Bvh
animation in thebvh_animation
list:The specific
index
that is being extracted might not stay true if something like this happen during runtime:This is a hypothetical situation that may or may not happen for whatever reason, but knowing that such a simple innocent
insert
operation might cause a seemingly untraceable bug is mind-boggling!Proposed Solution
We treat every
Bvh
animation as an asset (a simplified sample). Instead of storing indices pointing to a specific animation, we use Bevy's assetHandle<T>
system.This will guarantee us a unique pointer towards the
Bvh
animation asset and tell us when it is missing.Bevy
Handle<T>
doc: https://docs.rs/bevy/latest/bevy/prelude/enum.Handle.htmlBevy
Assets
doc:The text was updated successfully, but these errors were encountered: