[ui] Viewer3D: do not load too large EXR files in 3D to avoid crashes in qt

This commit is contained in:
Fabien Castan 2020-09-14 21:50:43 +02:00
parent ce77d7b018
commit 2f77a236b3
2 changed files with 14 additions and 1 deletions

View file

@ -110,6 +110,14 @@ import Utils 1.0
MediaLoaderEntity {
id: exrLoaderEntity
Component.onCompleted: {
var fSize = Filepath.fileSizeMB(source)
if(fSize > 500)
{
// Do not load images that are larger than 500MB
console.warn("Viewer3D: Do not load the EXR in 3D as the file size is too large: " + fSize + "MB")
root.status = SceneLoader.Error;
return;
}
// EXR loading strategy:
// - [1] as a depth map
var obj = Viewer3DSettings.depthMapLoaderComp.createObject(