Now that so much has moved into openusd, I want to restructure bevy_openusd properly and get it integrated way tighter with Bevy's AssetLoader / asset system. One thing's worth sorting out first.
Bevy reads files through its own async asset layer (folder, zip, remote, cache - whatever the app sets up), not straight off disk. Right now I dump the bytes into a tempfile just so Stage::open has a real path. It works but it's ugly, and openusd ends up reading every sublayer/reference/texture off disk itself instead of through Bevy, so I lose hot-reload, dedup, and loading from non-disk sources.
The ar::Resolver is already almost what I need, I can plug one in. The problem is it's sync and my bytes arrive async, so I'd have to block_on inside the loader, which I don't love.
What I'd want is some async way to drive layer collection where the host hands openusd the bytes, so it never reads from disk itself and doesn't tie in a specific async runtime.
Useful beyond just me too - anything reading from somewhere that isn't the local filesystem (an editor with unsaved layers in memory, a networked store, a custom resolver). And it's the same idea as the task-queue indexer you're doing, just on the I/O side: keep the logic pure, let something outside drive it.
Doesn't look like a big change either. open_layer already reads the whole file into memory and parses from a Cursor, so the async part only has to cover "get me the bytes for this layer" - no seeking, and pcp doesn't change since it runs on the layers after they're loaded. collect could split into a pure part, the current sync path as a thin driver, plus an async one for cases like mine.
Does this seem reasonable @mxpv? And does it clash with #103 at all? Based on quick view, it seems not, this is quite isolated.
Now that so much has moved into openusd, I want to restructure bevy_openusd properly and get it integrated way tighter with Bevy's AssetLoader / asset system. One thing's worth sorting out first.
Bevy reads files through its own async asset layer (folder, zip, remote, cache - whatever the app sets up), not straight off disk. Right now I dump the bytes into a tempfile just so
Stage::openhas a real path. It works but it's ugly, and openusd ends up reading every sublayer/reference/texture off disk itself instead of through Bevy, so I lose hot-reload, dedup, and loading from non-disk sources.The
ar::Resolveris already almost what I need, I can plug one in. The problem is it's sync and my bytes arrive async, so I'd have toblock_oninside the loader, which I don't love.What I'd want is some async way to drive layer collection where the host hands openusd the bytes, so it never reads from disk itself and doesn't tie in a specific async runtime.
Useful beyond just me too - anything reading from somewhere that isn't the local filesystem (an editor with unsaved layers in memory, a networked store, a custom resolver). And it's the same idea as the task-queue indexer you're doing, just on the I/O side: keep the logic pure, let something outside drive it.
Doesn't look like a big change either.
open_layeralready reads the whole file into memory and parses from aCursor, so the async part only has to cover "get me the bytes for this layer" - no seeking, and pcp doesn't change since it runs on the layers after they're loaded.collectcould split into a pure part, the current sync path as a thin driver, plus an async one for cases like mine.Does this seem reasonable @mxpv? And does it clash with #103 at all? Based on quick view, it seems not, this is quite isolated.