@soonspacejs/plugin-soonmanager2-sync 2.5.0-alpha.0 → 2.5.0-alpha.1
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.d.ts +28 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import SoonSpace from 'soonspacejs';
|
|
2
|
+
import { TreeData } from './types';
|
|
3
|
+
declare class Soonmanager2SyncPlugin {
|
|
4
|
+
readonly ssp: SoonSpace;
|
|
5
|
+
path: string;
|
|
6
|
+
treeData: TreeData[] | null;
|
|
7
|
+
constructor(ssp: SoonSpace);
|
|
8
|
+
private resolvePath;
|
|
9
|
+
private fetchData;
|
|
10
|
+
/**
|
|
11
|
+
* 获取场景树
|
|
12
|
+
*/
|
|
13
|
+
private fetchTreeData;
|
|
14
|
+
/**
|
|
15
|
+
* 设置 path
|
|
16
|
+
* @param path
|
|
17
|
+
*/
|
|
18
|
+
setPath(path: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* 加载场景树中的对象
|
|
21
|
+
*/
|
|
22
|
+
private loadObjects;
|
|
23
|
+
/**
|
|
24
|
+
* 同步场景树
|
|
25
|
+
*/
|
|
26
|
+
loadScene(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export default Soonmanager2SyncPlugin;
|
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,
|
|
15
|
+
function t(t,e,i,a){return new(i||(i=Promise))((function(n,r){function s(t){try{l(a.next(t))}catch(t){r(t)}}function o(t){try{l(a.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((a=a.apply(t,e||[])).next())}))}class e{constructor(t){this.ssp=t,this.path="",this.treeData=null}resolvePath(t){return`${this.path}${t}`}fetchData(e){return t(this,void 0,void 0,(function*(){const{utils:t}=this.ssp;return yield t.fetchFile(this.resolvePath(e)).then((t=>t.json()))}))}fetchTreeData(){return t(this,void 0,void 0,(function*(){this.treeData=yield this.fetchData("/db/tree_models.json")}))}setPath(t){this.path=t}loadObjects(){return t(this,void 0,void 0,(function*(){if(!this.treeData)return void console.error("treeData is null");const e=(i,a)=>t(this,void 0,void 0,(function*(){const{ssp:t}=this,{THREE:{Matrix4:n}}=t,{id:r,name:s,renderType:o,path:l,matrix:h,pid:d}=i,c=(new n).fromArray(h);let u=null;if("3D"===o&&l)try{u=yield t.loadModel({id:r,name:s,url:this.resolvePath(l),userData:{pid:d}})}catch(t){console.error(t)}else"GROUP"===o&&(u=t.createGroup({id:r,name:s,userData:{pid:d}}));u&&(u.applyMatrix4(c),a&&t.addObject(u,a)),i.children.length>0&&(yield Promise.allSettled(i.children.map((t=>e(t,u)))))}));yield Promise.allSettled(this.treeData.map((t=>e(t,null))))}))}loadScene(){return t(this,void 0,void 0,(function*(){this.treeData||(yield this.fetchTreeData()),yield this.loadObjects()}))}}export{e as default};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Soonmanager2SyncPlugin=e()}(this,(function(){"use strict";
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -12,4 +12,4 @@ var Soonmanager2SyncPlugin=function(){"use strict";
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function t(t,e,i,
|
|
15
|
+
***************************************************************************** */function t(t,e,i,n){return new(i||(i=Promise))((function(o,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function s(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))}return class{constructor(t){this.ssp=t,this.path="",this.treeData=null}resolvePath(t){return`${this.path}${t}`}fetchData(e){return t(this,void 0,void 0,(function*(){const{utils:t}=this.ssp;return yield t.fetchFile(this.resolvePath(e)).then((t=>t.json()))}))}fetchTreeData(){return t(this,void 0,void 0,(function*(){this.treeData=yield this.fetchData("/db/tree_models.json")}))}setPath(t){this.path=t}loadObjects(){return t(this,void 0,void 0,(function*(){if(!this.treeData)return void console.error("treeData is null");const e=(i,n)=>t(this,void 0,void 0,(function*(){const{ssp:t}=this,{THREE:{Matrix4:o}}=t,{id:r,name:a,renderType:s,path:l,matrix:d,pid:h}=i,c=(new o).fromArray(d);let u=null;if("3D"===s&&l)try{u=yield t.loadModel({id:r,name:a,url:this.resolvePath(l),userData:{pid:h}})}catch(t){console.error(t)}else"GROUP"===s&&(u=t.createGroup({id:r,name:a,userData:{pid:h}}));u&&(u.applyMatrix4(c),n&&t.addObject(u,n)),i.children.length>0&&(yield Promise.allSettled(i.children.map((t=>e(t,u)))))}));yield Promise.allSettled(this.treeData.map((t=>e(t,null))))}))}loadScene(){return t(this,void 0,void 0,(function*(){this.treeData||(yield this.fetchTreeData()),yield this.loadObjects()}))}}}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-soonmanager2-sync",
|
|
3
3
|
"pluginName": "Soonmanager2SyncPlugin",
|
|
4
|
-
"version": "2.5.0-alpha.
|
|
4
|
+
"version": "2.5.0-alpha.1",
|
|
5
5
|
"description": "Sync soonmanager 2.x data plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
],
|
|
14
14
|
"author": "xuek",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "0718030c70fef431833f4f3d46829009f8d9d2be"
|
|
17
17
|
}
|