Closed B-Reif closed 2 years ago
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 exposesHandleId
, which implementsHash
and uniquely identifies theHandle
. We can fix this problem and simplify our API by keying onHandleId
instead of aHandlePath
.
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
.