Ver código fonte

promise update

Kacey Coley 7 anos atrás
pai
commit
e52ff66123
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      serializers/src/glTF/2.0/babylon.glTFMaterial.ts

+ 2 - 2
serializers/src/glTF/2.0/babylon.glTFMaterial.ts

@@ -408,9 +408,9 @@ module BABYLON.GLTF2 {
                         return Promise.reject(`Cannot create procedural texture for ${texture.name}!`);
                         return Promise.reject(`Cannot create procedural texture for ${texture.name}!`);
                     }
                     }
                     else {
                     else {
-                        proceduralTexture.setTexture('textureSampler', texture as Texture);
                         return new Promise((resolve, reject) => {
                         return new Promise((resolve, reject) => {
-                            proceduralTexture.onLoadObservable.add(() => { return proceduralTexture });
+                            proceduralTexture.setTexture('textureSampler', texture as Texture);
+                            proceduralTexture.onLoadObservable.add(() => { resolve(proceduralTexture) });
                         })
                         })
                     }
                     }
                 }
                 }