BABYLON.Tools.DumpData file download doesn't always work

BABYLON.Tools.DumpData’s fileName parameter is ignored when it has a successCallback defined. This means that it’s not possible to wait for a download to be performed. This also means that DumpDataAsync’s fileName parameter is ineffective at all times. The issue is caused by EncodeScreenshotCanvasData having successCallback is passed into it, but it only uses the fileName if successCallback is undefined.

Demo, click on scene to download, and view console to see logs:

It would be desirable to be able to always use a success callback, and that it would be invoked after the download occurs. This may incur a signature change to successCallback, as it might have to be invoked with null instead of the data: url string.

Sounds do-able to me. @sebavan, what do you think?

Not against it at all, @kvbh do you want to create a PR for it ?

1 Like