Explorar o código

promise update for _SetAlphaToOneAsync slight refactor 2

Kacey Coley %!s(int64=7) %!d(string=hai) anos
pai
achega
ea7aeb34e0
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      serializers/src/glTF/2.0/babylon.glTFMaterial.ts

+ 5 - 4
serializers/src/glTF/2.0/babylon.glTFMaterial.ts

@@ -402,13 +402,14 @@ module BABYLON.GLTF2 {
                     const scene = texture.getScene();
                     if (scene) {
                         const proceduralTexture = new ProceduralTexture('texture', texture.getSize(), 'setAlphaToOne', scene);
-                        if (proceduralTexture == null) {
-                            reject(`Cannot create procedural texture for ${texture.name}!`);
-                        }
-                        else {
+                        
+                        if (proceduralTexture) {
                             proceduralTexture.setTexture('textureSampler', texture as Texture);
                             proceduralTexture.onLoadObservable.add(() => { resolve(proceduralTexture) });
                         }
+                        else {
+                            reject(`Cannot create procedural texture for ${texture.name}!`);
+                        }
                     }
                     else {
                         reject(`Scene not available for texture ${texture.name}`);