@soonspacejs/plugin-soonbuilder-loader 2.11.55 → 2.11.56

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.
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- class t{constructor(t){this.ssp=t,this.treeData=[],this.modelData=[]}async load(t,e=!1){const{xmlToJson:i,isArray:s,isObject:o}=this.ssp.utils,l=e?`${t}/FileInfo.xml`:t;this.fileInfo=await i(l);const r=this._getFileExtensionFc(this.fileInfo),n=l.split("FileInfo.xml")[0],a=this.fileInfo.folder._attributes.name;this.sceneInfo=await i(`${n}${a}.xml`);const{Project:{Building:{Floors:u,ObjectHierarchy:d}}}=this.sceneInfo,c=async t=>{var e,i,l;const{_attributes:a,FileSource:u}=t,{id:c,name:h}=a,{name:p}=u._attributes,f={id:c,name:h,url:this._pathModeChange(n,p),children:[],userData:t};this._pushModelData(f);const _=await this.ssp.loadModelToGroup({id:`${f.id}_group`},[f]);if(!_)return;let b=null;if(s(d.Entity))b=d.Entity.find((({_attributes:{id:t,type:e}})=>"Floor"===e&&t===c));else if(o(d.Entity)){const{id:t,type:e}=d.Entity._attributes;t===c&&"Floor"===e&&(b=d.Entity)}if(!b)return;let y=null;if(s(b.Entity)?y=b.Entity.filter((({_attributes:{type:t}})=>"FACILITY"===t)):o(d.Entity)&&"FACILITY"===b.Entity._attributes.type&&(y=b.Entity),y){for(let t=0;t<y.length;t++){const{id:s,longname:o,visible:a,position:u,eular:d,scale:c}=Object.assign(Object.assign({},y[t]._attributes),null!==(i=null===(e=y[t].Properties)||void 0===e?void 0:e._attributes)&&void 0!==i?i:{}),h={id:s,name:o,url:this._pathModeChange(n,`/${r(o)}`),visible:this._text2Bool(a),position:this._text2IVector3(u),rotation:this._text2IVector3(d),scale:this._text2IVector3(c),userData:y[t]},p=await this.ssp.loadModel(h);p&&(this.ssp.addObject(p,_),this._pushModelData(h),null===(l=f.children)||void 0===l||l.push(h))}this.treeData.push(f)}};if(s(u.Floor))for(let t=0;t<u.Floor.length;t++)await c(u.Floor[t]);else o(u.Floor)&&await c(u.Floor)}_pushModelData(t){this.modelData.find((({url:e})=>e===t.url))||this.modelData.push(t)}_text2IVector3(t){const e=t.split(", ");return{x:Number(e[0]),y:Number(e[1]),z:Number(e[2])}}_text2Bool(t){return"True"===t}_pathModeChange(t,e){const i=t+e;if(i.includes("://")){const t=i.split("://");return t[0]+"://"+t[1].replace("\\","/").replace("./","/").replace("//","/")}return i.replace("\\","/").replace("./","/").replace("//","/")}_getFileExtensionFc(t){var e;const i=null===(e=null==t?void 0:t.folder)||void 0===e?void 0:e.file;let s=[];return i&&Array.isArray(i)&&(s=i.filter((t=>{const{Extension:e}=t._attributes;return".sbm"===e||".sbmx"===e}))),t=>{var e;const i=null===(e=s.find((e=>{var i;return null===(i=null==e?void 0:e._attributes)||void 0===i?void 0:i.name.startsWith(t)})))||void 0===e?void 0:e._attributes;return`${t}${(null==i?void 0:i.Extension)||".sbm"}`}}}export{t as default};
1
+ class t{constructor(t){this.ssp=t,this.treeData=[],this.modelData=[]}async load(t,e=!1){const{xmlToJson:i,isArray:s,isObject:o}=this.ssp.utils,l=e?`${t}/FileInfo.xml`:t;this.fileInfo=await i(l);const r=this._getFileExtensionFc(this.fileInfo),n=l.split("FileInfo.xml")[0],a=this.fileInfo.folder._attributes.name;this.sceneInfo=await i(`${n}${a}.xml`);const{Project:{Building:{Floors:u,ObjectHierarchy:d}}}=this.sceneInfo,c=async t=>{var e,i,l;const{_attributes:a,FileSource:u}=t,{id:c,name:h}=a,{name:p}=u._attributes,f={id:c,name:h,url:this._pathModeChange(n,p),children:[],userData:t};this._pushModelData(f);const _=await this.ssp.loadModelToGroup({id:`${f.id}_group`},[f]);if(!_)return;let b=null;if(s(d.Entity))b=d.Entity.find((({_attributes:{id:t,type:e}})=>"Floor"===e&&t===c));else if(o(d.Entity)){const{id:t,type:e}=d.Entity._attributes;t===c&&"Floor"===e&&(b=d.Entity)}if(!b)return;let y=null;if(s(b.Entity)?y=b.Entity.filter((({_attributes:{type:t}})=>"FACILITY"===t)):o(b.Entity)&&"FACILITY"===b.Entity._attributes.type&&(y=b.Entity),y){for(let t=0;t<y.length;t++){const{id:s,longname:o,visible:a,position:u,eular:d,scale:c}=Object.assign(Object.assign({},y[t]._attributes),null!==(i=null===(e=y[t].Properties)||void 0===e?void 0:e._attributes)&&void 0!==i?i:{}),h={id:s,name:o,url:this._pathModeChange(n,`/${r(o)}`),visible:this._text2Bool(a),position:this._text2IVector3(u),rotation:this._text2IVector3(d),scale:this._text2IVector3(c),userData:y[t]},p=await this.ssp.loadModel(h);p&&(this.ssp.addObject(p,_),this._pushModelData(h),null===(l=f.children)||void 0===l||l.push(h))}this.treeData.push(f)}};if(s(u.Floor))for(let t=0;t<u.Floor.length;t++)await c(u.Floor[t]);else o(u.Floor)&&await c(u.Floor)}_pushModelData(t){this.modelData.find((({url:e})=>e===t.url))||this.modelData.push(t)}_text2IVector3(t){const e=t.split(", ");return{x:Number(e[0]),y:Number(e[1]),z:Number(e[2])}}_text2Bool(t){return"True"===t}_pathModeChange(t,e){const i=t+e;if(i.includes("://")){const t=i.split("://");return t[0]+"://"+t[1].replace("\\","/").replace("./","/").replace("//","/")}return i.replace("\\","/").replace("./","/").replace("//","/")}_getFileExtensionFc(t){var e;const i=null===(e=null==t?void 0:t.folder)||void 0===e?void 0:e.file;let s=[];return i&&Array.isArray(i)&&(s=i.filter((t=>{const{Extension:e}=t._attributes;return".sbm"===e||".sbmx"===e}))),t=>{var e;const i=null===(e=s.find((e=>{var i;return null===(i=null==e?void 0:e._attributes)||void 0===i?void 0:i.name.startsWith(t)})))||void 0===e?void 0:e._attributes;return`${t}${(null==i?void 0:i.Extension)||".sbm"}`}}}export{t as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-soonbuilder-loader",
3
3
  "pluginName": "SoonbuilderLoaderPlugin",
4
- "version": "2.11.55",
4
+ "version": "2.11.56",
5
5
  "description": "soonbuilder-loader plugin for SoonSpace.js",
6
6
  "main": "dist/index.esm.js",
7
7
  "module": "dist/index.esm.js",
@@ -13,8 +13,8 @@
13
13
  ],
14
14
  "author": "xunwei",
15
15
  "license": "UNLICENSED",
16
- "gitHead": "d053b3ff0481011ad96a25898c02cbf6060ed7f5",
16
+ "gitHead": "157b769871a8692ec2b4318d5a2deecac4cd1c52",
17
17
  "peerDependencies": {
18
- "soonspacejs": "2.11.55"
18
+ "soonspacejs": "2.11.56"
19
19
  }
20
20
  }