Przeglądaj źródła

NodeObjectLoader: Fix `parseAsync()`. (#33377)

Michael Herzog 3 dni temu
rodzic
commit
b09501a9a4
1 zmienionych plików z 18 dodań i 0 usunięć
  1. 18 0
      src/loaders/nodes/NodeObjectLoader.js

+ 18 - 0
src/loaders/nodes/NodeObjectLoader.js

@@ -89,6 +89,24 @@ class NodeObjectLoader extends ObjectLoader {
 
 	}
 
+	/**
+	 * Async version of {@link NodeObjectLoader#parse}.
+	 *
+	 * @param {Object} json - The JSON definition
+	 * @return {Promise<Object3D>} A Promise that resolves with the parsed 3D object.
+	 */
+	async parseAsync( json ) {
+
+		this._nodesJSON = json.nodes;
+
+		const data = await super.parseAsync( json );
+
+		this._nodesJSON = null; // dispose
+
+		return data;
+
+	}
+
 	/**
 	 * Parses the node objects from the given JSON and textures.
 	 *

粤ICP备19079148号