lighttransport/tinyusdz

Add a cancel / continue callback to control LoadUSDFromFile

Opened this issue · 1 comments

We are currently implementing an USD parser based on tinyusdz for an application that is displaying thumbnails from these files.
As the user might browse to another folder without waiting end of parsing, it must be possible to stop USD reading when this occurs.

When processing large file it would be convenient to add the ability to cancel the usd file parsing.
I don't find such possibility and that would be nice to be able to set a callback that returns true or false when the process should stop whould be nice.

TinyUSDZ does not have a feature to cancel the parsing(and progress callback) at the moment.

For a while you can wrap USD Load API with C++ thread/future and set timeout or force kill the thread, but adding a progress callback would be better as you suggests.

Fortunately TinyUSDZ uses hand-written USDA parser and USDC parser, so adding a callback at arbitrary granularity(e.g. per-Prim, per-Property/Attribute) in the parser would be possible, but it would require some amount of work to implement it and also need some time to think about a good logic.

Priority is low unless you contribute or sponsor implementing this feature 🥺
(If you can sponsor it, you may also be interested in sponsoring optimized Ascii parser #164 and multi-threaded USD parsing #56 )