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 poses a problem when inserting handles that don't correspond 1:1 with an asset path.
For instance, when loading an Aseprite file with bevy_ase, one .aseprite file path corresponds to many different handles (each frame has its own Image handle, other metadata handles are inserted, etc.)
As far as I can tell, ProtoData only uses this path as a key in its map. Fortunately for us, Handle already exposes HandleId, which implements Hash and uniquely identifies the Handle. We can fix this problem and simplify our API by keying on HandleId instead of a HandlePath.
The text was updated successfully, but these errors were encountered:
B-Reif
changed the title
Allow ProtoData to store paths without handles
Allow ProtoData to store handles without paths
Mar 13, 2022
This poses a problem when inserting handles that don't correspond 1:1 with an asset path.
For instance, when loading an Aseprite file with bevy_ase, one .aseprite file path corresponds to many different handles (each frame has its own Image handle, other metadata handles are inserted, etc.)
Good point. Not something I had considered when making this.
As far as I can tell, ProtoData only uses this path as a key in its map. Fortunately for us, Handle already exposes HandleId, which implements Hash and uniquely identifies the Handle. We can fix this problem and simplify our API by keying on HandleId instead of a HandlePath.
Yep, this is definitely a better way of doing this.
Currently the
ProtoData
struct requires a path when insert a handle:This poses a problem when inserting handles that don't correspond 1:1 with an asset path.
For instance, when loading an Aseprite file with bevy_ase, one
.aseprite
file path corresponds to many different handles (each frame has its own Image handle, other metadata handles are inserted, etc.)As far as I can tell,
ProtoData
only uses this path as a key in its map. Fortunately for us,Handle
already exposesHandleId
, which implementsHash
and uniquely identifies theHandle
. We can fix this problem and simplify our API by keying onHandleId
instead of aHandlePath
.The text was updated successfully, but these errors were encountered: