three-base 2.0.92 → 2.0.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/threeLoader.js +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "2.0.92",
3
+ "version": "2.0.93",
4
4
  "description": "three 3d three-base",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/threeLoader.js CHANGED
@@ -25,7 +25,7 @@ import axios from "axios";
25
25
  import dracoDecoderWASM from "./lib/draco/draco_decoder.wasm?url";
26
26
  import threeUtils from "./threeUtils";
27
27
  import { generateUUID } from "three/src/math/MathUtils";
28
- import { isString } from "lodash";
28
+ import { isEmpty, isString } from "lodash";
29
29
  // 加载器
30
30
  class ThreeLoader extends EventDispatcher {
31
31
  constructor() {
@@ -181,6 +181,9 @@ class ThreeLoader extends EventDispatcher {
181
181
  }
182
182
  /** 加载模型支持glb,gltf,fbx,stl,obj,usdz,dae,zip */
183
183
  async loadModel(url, filename = "") {
184
+ if (isEmpty(url)) {
185
+ throw new Error(`loadModel:无效的参数 url=${url}`);
186
+ }
184
187
  // 本次需要销毁的bloburl,加载完成后就去销毁本次的文件
185
188
  const revokeObjectfile = [];
186
189
  // 获取模型文件的后缀
@@ -256,7 +259,9 @@ class ThreeLoader extends EventDispatcher {
256
259
  responseType: "arraybuffer",
257
260
  })
258
261
  .then((res) => res.data)
259
- : url;
262
+ : url instanceof File
263
+ ? url
264
+ : url[0];
260
265
  return await JSZip.loadAsync(arrayBuffer).then(async (zip) => {
261
266
  for (let filename in zip.files) {
262
267
  if (!zip.files[filename].dir) {