Sfoglia il codice sorgente

Tentative fix for shadergraph editor crash on launch

Clement Espeute 1 anno fa
parent
commit
aef83db6cf
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. 8 1
      hide/view/shadereditor/ShaderEditor.hx

+ 8 - 1
hide/view/shadereditor/ShaderEditor.hx

@@ -1171,8 +1171,15 @@ class ShaderEditor extends hide.view.Graph {
 	}
 	}
 
 
 	var boxToPreview : Map<Box, Preview>;
 	var boxToPreview : Map<Box, Preview>;
-
+	var timeout = 0;
 	function onMiniPreviewReady() {
 	function onMiniPreviewReady() {
+		if (previewsScene.s2d == null) {
+			timeout ++;
+			if (timeout > 10)
+				throw "Couldn't initialize background previews";
+			haxe.Timer.delay(() -> onMiniPreviewReady, 100);
+			return;
+		}
 		var bg = new h2d.Flow(previewsScene.s2d);
 		var bg = new h2d.Flow(previewsScene.s2d);
 		bg.fillHeight = true;
 		bg.fillHeight = true;
 		bg.fillWidth = true;
 		bg.fillWidth = true;