mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-15 15:55:18 +02:00
[ui] Viewer3D: do not load too large EXR files in 3D to avoid crashes in qt
This commit is contained in:
parent
ce77d7b018
commit
2f77a236b3
2 changed files with 14 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
||||||
# coding:utf-8
|
# coding:utf-8
|
||||||
from meshroom.core import pyCompatibility
|
from meshroom.core import pyCompatibility
|
||||||
|
|
||||||
from PySide2.QtCore import QUrl
|
from PySide2.QtCore import QUrl, QFileInfo
|
||||||
from PySide2.QtCore import QObject, Slot
|
from PySide2.QtCore import QObject, Slot
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -89,3 +89,8 @@ class FilepathHelper(QObject):
|
||||||
if fileList:
|
if fileList:
|
||||||
return fileList[0]
|
return fileList[0]
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
@Slot(QUrl, result=int)
|
||||||
|
def fileSizeMB(self, path):
|
||||||
|
""" Returns the file size in MB. """
|
||||||
|
return QFileInfo(self.asStr(path)).size() / (1024*1024)
|
||||||
|
|
|
@ -110,6 +110,14 @@ import Utils 1.0
|
||||||
MediaLoaderEntity {
|
MediaLoaderEntity {
|
||||||
id: exrLoaderEntity
|
id: exrLoaderEntity
|
||||||
Component.onCompleted: {
|
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:
|
// EXR loading strategy:
|
||||||
// - [1] as a depth map
|
// - [1] as a depth map
|
||||||
var obj = Viewer3DSettings.depthMapLoaderComp.createObject(
|
var obj = Viewer3DSettings.depthMapLoaderComp.createObject(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue