donmccurdy / glTF-Transform

glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.
https://gltf-transform.dev
MIT License
1.3k stars 145 forks source link

Support transforms reporting a 'skip' result #1406

Open donmccurdy opened 1 month ago

donmccurdy commented 1 month ago

In many cases transforms complete without doing anything. Examples include resample() on a model with no animation, or textureCompress() on a model with no textures.

If a model quits early with nothing to do, it'd be nice if there were some API for it to report that result. This could be shown in the CLI output, for example,

Before:

> gltf-transform optimize in.glb out.glb

✔ dedup                731ms
✔ instance             1ms
✔ palette              27ms
✔ flatten              1ms
✔ join                 1,115ms
✔ weld                 23ms
✔ simplify             26ms
✔ resample             0ms
✔ prune                0ms
✔ sparse               9ms
✔ textureCompress      0ms
✔ meshopt              40ms

After:

> gltf-transform optimize in.glb out.glb

✔ dedup                731ms
✔ instance             –
✔ palette              27ms
✔ flatten              1ms
✔ join                 1,115ms
✔ weld                 23ms
✔ simplify             26ms
✔ resample             –
✔ prune                0ms
✔ sparse               9ms
✔ textureCompress      –
✔ meshopt              40ms

In some cases it might take a transform a non-trivial amount of time to determine that it can't do anything ... TBD how that should be handled, and whether the CLI should display the time or a -.