@soonspacejs/plugin-soonbuilder-loader 2.5.56 → 2.5.58
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 +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
|
-
function t(t,e,i,o){return new(i||(i=Promise))((function(n,s){function r(t){try{a(o.next(t))}catch(t){s(t)}}function l(t){try{a(o.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,l)}a((o=o.apply(t,e||[])).next())}))}class e{constructor(t){this.ssp=t,this.treeData=[],this.modelData=[]}load(e){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t(this,void 0,void 0,(function*(){const{xmlToJson:o,isArray:n,isObject:s}=this.ssp.utils,r=i?`${e}/FileInfo.xml`:e;this.fileInfo=yield o(r);const l=r.split("FileInfo.xml")[0],a=this.fileInfo.folder._attributes.name;this.sceneInfo=yield o(`${l}${a}.xml`);const{Project:{Building:{Floors:u,SpaceInfo:c,ObjectHierarchy:h}}}=this.sceneInfo,d=e=>t(this,void 0,void 0,(function*(){var t;const{_attributes:i,FileSource:o}=e,{id:r,name:a}=i,{name:u}=o._attributes,c={id:r,name:a,url:this._pathModeChange(l,u),children:[],userData:e};this._pushModelData(c);const d=yield this.ssp.loadModelToGroup({id:`${c.id}_group`},[c]);if(!d)return;let p=null;if(n(h.Entity))p=h.Entity.find((t=>{let{_attributes:{id:e,type:i}}=t;return"Floor"===i&&e===r}));else if(s(h.Entity)){const{id:t,type:e}=h.Entity._attributes;t===r&&"Floor"===e&&(p=h.Entity)}if(!p)return;const f=p.Entity.filter((t=>{let{_attributes:{type:e}}=t;return"FACILITY"===e}));for(let e=0;e<f.length;e++){const{id:i,longname:o,visible:n,position:s,eular:r,scale:a}=f[e]._attributes,u={id:i,name:o,url:this._pathModeChange(l,`/${o}.sbm`),visible:this._text2Bool(n),position:this._text2IVector3(s),rotation:this._text2IVector3(r),scale:this._text2IVector3(a),userData:f[e]},h=yield this.ssp.loadModel(u);h&&(this.ssp.addObject(h,d),this._pushModelData(u),null===(t=c.children)||void 0===t||t.push(u))}this.treeData.push(c)}));if(n(u.Floor))for(let t=0;t<u.Floor.length;t++)yield d(u.Floor[t]);else s(u.Floor)&&(yield d(u.Floor))}))}_pushModelData(t){this.modelData.find((e=>{let{url:i}=e;return i===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("//","/")}}export{e as default};
|
|
15
|
+
function t(t,e,i,o){return new(i||(i=Promise))((function(n,s){function r(t){try{a(o.next(t))}catch(t){s(t)}}function l(t){try{a(o.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,l)}a((o=o.apply(t,e||[])).next())}))}class e{constructor(t){this.ssp=t,this.treeData=[],this.modelData=[]}load(e){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t(this,void 0,void 0,(function*(){const{xmlToJson:o,isArray:n,isObject:s}=this.ssp.utils,r=i?`${e}/FileInfo.xml`:e;this.fileInfo=yield o(r);const l=r.split("FileInfo.xml")[0],a=this.fileInfo.folder._attributes.name;this.sceneInfo=yield o(`${l}${a}.xml`);const{Project:{Building:{Floors:u,SpaceInfo:c,ObjectHierarchy:h}}}=this.sceneInfo,d=e=>t(this,void 0,void 0,(function*(){var t;const{_attributes:i,FileSource:o}=e,{id:r,name:a}=i,{name:u}=o._attributes,c={id:r,name:a,url:this._pathModeChange(l,u),children:[],userData:e};this._pushModelData(c);const d=yield this.ssp.loadModelToGroup({id:`${c.id}_group`},[c]);if(!d)return;let p=null;if(n(h.Entity))p=h.Entity.find((t=>{let{_attributes:{id:e,type:i}}=t;return"Floor"===i&&e===r}));else if(s(h.Entity)){const{id:t,type:e}=h.Entity._attributes;t===r&&"Floor"===e&&(p=h.Entity)}if(!p)return;const f=p.Entity.filter((t=>{let{_attributes:{type:e}}=t;return"FACILITY"===e}));for(let e=0;e<f.length;e++){const{id:i,longname:o,visible:n,position:s,eular:r,scale:a}=f[e]._attributes,u={id:i,name:o,url:this._pathModeChange(l,`/${o}.sbm`),visible:this._text2Bool(n),position:this._text2IVector3(s),rotation:this._text2IVector3(r),scale:this._text2IVector3(a),userData:f[e]},h=yield this.ssp.loadModel(u);h&&(this.ssp.addObject(h,d),this._pushModelData(u),null===(t=c.children)||void 0===t||t.push(u))}this.treeData.push(c)}));if(n(u.Floor))for(let t=0;t<u.Floor.length;t++)yield d(u.Floor[t]);else s(u.Floor)&&(yield d(u.Floor))}))}_pushModelData(t){this.modelData.find((e=>{let{url:i}=e;return i===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("//","/")}}export{e 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.5.
|
|
4
|
+
"version": "2.5.58",
|
|
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": "xuek",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "338483dd017e15e9d9ac3682f1265b0531fedfdb",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"soonspacejs": "2.5.
|
|
18
|
+
"soonspacejs": "2.5.58"
|
|
19
19
|
}
|
|
20
20
|
}
|