@soonspacejs/plugin-soonmanager2-sync 2.13.9 → 2.13.11
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/constant.d.ts +32 -32
- package/dist/index.d.ts +92 -92
- package/dist/index.esm.js +1 -1
- package/dist/types.d.ts +156 -156
- package/package.json +3 -3
package/dist/constant.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 场景元数据
|
|
3
|
-
*/
|
|
4
|
-
export declare const META_DATA_FILE_PATH = "/SceneMetadata.json";
|
|
5
|
-
/**
|
|
6
|
-
* 签名文件
|
|
7
|
-
*/
|
|
8
|
-
export declare const SIGN_PATH = "/db/sign";
|
|
9
|
-
/**
|
|
10
|
-
* 模型树
|
|
11
|
-
*/
|
|
12
|
-
export declare const TREE_DATA_FILE_PATH = "/db/tree_models.json";
|
|
13
|
-
/**
|
|
14
|
-
* 拓扑路径
|
|
15
|
-
*/
|
|
16
|
-
export declare const TOPOLOGY_DATA_FILE_PATH = "/db/topology_paths.json";
|
|
17
|
-
/**
|
|
18
|
-
* 自定义属性
|
|
19
|
-
*/
|
|
20
|
-
export declare const PROPERTIES_DATA_FLEE_PATH = "/db/properties.json";
|
|
21
|
-
/**
|
|
22
|
-
* 帧动画
|
|
23
|
-
*/
|
|
24
|
-
export declare const ANIMATIONS_DATA_FILE_PATH = "/db/animations.json";
|
|
25
|
-
/**
|
|
26
|
-
* 模型视角
|
|
27
|
-
*/
|
|
28
|
-
export declare const MODEL_VISIONS_DATA_FILE_PATH = "/db/model_visions.json";
|
|
29
|
-
/**
|
|
30
|
-
* 自定义属性 key
|
|
31
|
-
*/
|
|
32
|
-
export declare const PROPERTIES_KEY = "properties";
|
|
1
|
+
/**
|
|
2
|
+
* 场景元数据
|
|
3
|
+
*/
|
|
4
|
+
export declare const META_DATA_FILE_PATH = "/SceneMetadata.json";
|
|
5
|
+
/**
|
|
6
|
+
* 签名文件
|
|
7
|
+
*/
|
|
8
|
+
export declare const SIGN_PATH = "/db/sign";
|
|
9
|
+
/**
|
|
10
|
+
* 模型树
|
|
11
|
+
*/
|
|
12
|
+
export declare const TREE_DATA_FILE_PATH = "/db/tree_models.json";
|
|
13
|
+
/**
|
|
14
|
+
* 拓扑路径
|
|
15
|
+
*/
|
|
16
|
+
export declare const TOPOLOGY_DATA_FILE_PATH = "/db/topology_paths.json";
|
|
17
|
+
/**
|
|
18
|
+
* 自定义属性
|
|
19
|
+
*/
|
|
20
|
+
export declare const PROPERTIES_DATA_FLEE_PATH = "/db/properties.json";
|
|
21
|
+
/**
|
|
22
|
+
* 帧动画
|
|
23
|
+
*/
|
|
24
|
+
export declare const ANIMATIONS_DATA_FILE_PATH = "/db/animations.json";
|
|
25
|
+
/**
|
|
26
|
+
* 模型视角
|
|
27
|
+
*/
|
|
28
|
+
export declare const MODEL_VISIONS_DATA_FILE_PATH = "/db/model_visions.json";
|
|
29
|
+
/**
|
|
30
|
+
* 自定义属性 key
|
|
31
|
+
*/
|
|
32
|
+
export declare const PROPERTIES_KEY = "properties";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated 使用 plugin-cps-soonmanager 替代
|
|
3
|
-
*/
|
|
4
|
-
import SoonSpace from 'soonspacejs';
|
|
5
|
-
import type { TopologyInfo } from 'soonspacejs';
|
|
6
|
-
import { IMetadata, ITreeData, ITopologyPath, ILoadSceneOptions, TPropertiesMap, TAnimationsMap, IPlayAnimationByIdOptions, TModelVisionsMap } from './types';
|
|
7
|
-
declare class Soonmanager2SyncPlugin {
|
|
8
|
-
readonly ssp: SoonSpace;
|
|
9
|
-
_path: string;
|
|
10
|
-
get path(): string;
|
|
11
|
-
set path(val: string);
|
|
12
|
-
/**
|
|
13
|
-
* 场景元数据
|
|
14
|
-
*/
|
|
15
|
-
metaData: IMetadata | null;
|
|
16
|
-
/**
|
|
17
|
-
* 模型树
|
|
18
|
-
*/
|
|
19
|
-
treeData: ITreeData[] | null;
|
|
20
|
-
/**
|
|
21
|
-
* 拓扑路径
|
|
22
|
-
*/
|
|
23
|
-
topologyData: TopologyInfo[] | null;
|
|
24
|
-
/**
|
|
25
|
-
* 自定义属性
|
|
26
|
-
*/
|
|
27
|
-
propertiesData: TPropertiesMap | null;
|
|
28
|
-
/**
|
|
29
|
-
* 动画
|
|
30
|
-
*/
|
|
31
|
-
animationsData: TAnimationsMap | null;
|
|
32
|
-
/**
|
|
33
|
-
* 模型视角
|
|
34
|
-
*/
|
|
35
|
-
modelVisionsData: TModelVisionsMap | null;
|
|
36
|
-
constructor(ssp: SoonSpace);
|
|
37
|
-
private _resolvePath;
|
|
38
|
-
private _fetchData;
|
|
39
|
-
/**
|
|
40
|
-
* 获取场景元数据
|
|
41
|
-
*/
|
|
42
|
-
fetchMetaData(): Promise<IMetadata>;
|
|
43
|
-
/**
|
|
44
|
-
* 获取场景树
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
|
-
fetchTreeData(): Promise<ITreeData[]>;
|
|
48
|
-
/**
|
|
49
|
-
* 获取拓扑路径
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
fetchTopologyData(): Promise<ITopologyPath[]>;
|
|
53
|
-
/**
|
|
54
|
-
* 获取自定义属性
|
|
55
|
-
* @returns
|
|
56
|
-
*/
|
|
57
|
-
fetchPropertiesData(): Promise<TPropertiesMap>;
|
|
58
|
-
/**
|
|
59
|
-
* 获取动画
|
|
60
|
-
* @returns
|
|
61
|
-
*/
|
|
62
|
-
fetchAnimationsData(): Promise<TAnimationsMap>;
|
|
63
|
-
/**
|
|
64
|
-
* 获取模型视角
|
|
65
|
-
* @returns
|
|
66
|
-
*/
|
|
67
|
-
fetchModelVisionsData(): Promise<TModelVisionsMap>;
|
|
68
|
-
/**
|
|
69
|
-
* 加载场景树中的对象
|
|
70
|
-
*/
|
|
71
|
-
private loadObjects;
|
|
72
|
-
/**
|
|
73
|
-
* 设置 path
|
|
74
|
-
* @param path
|
|
75
|
-
*/
|
|
76
|
-
setPath(path: string): void;
|
|
77
|
-
/**
|
|
78
|
-
* 同步场景树
|
|
79
|
-
*/
|
|
80
|
-
loadScene(options?: ILoadSceneOptions): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* 获取拓扑路径列表
|
|
83
|
-
*/
|
|
84
|
-
getTopologies(): Promise<TopologyInfo[]>;
|
|
85
|
-
/**
|
|
86
|
-
* 播放动画
|
|
87
|
-
*/
|
|
88
|
-
playAnimationById(id: string, animationIndex?: number, options?: IPlayAnimationByIdOptions): Promise<void>;
|
|
89
|
-
}
|
|
90
|
-
export * from './types';
|
|
91
|
-
export * from './constant';
|
|
92
|
-
export default Soonmanager2SyncPlugin;
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated 使用 plugin-cps-soonmanager 替代
|
|
3
|
+
*/
|
|
4
|
+
import SoonSpace from 'soonspacejs';
|
|
5
|
+
import type { TopologyInfo } from 'soonspacejs';
|
|
6
|
+
import { IMetadata, ITreeData, ITopologyPath, ILoadSceneOptions, TPropertiesMap, TAnimationsMap, IPlayAnimationByIdOptions, TModelVisionsMap } from './types';
|
|
7
|
+
declare class Soonmanager2SyncPlugin {
|
|
8
|
+
readonly ssp: SoonSpace;
|
|
9
|
+
_path: string;
|
|
10
|
+
get path(): string;
|
|
11
|
+
set path(val: string);
|
|
12
|
+
/**
|
|
13
|
+
* 场景元数据
|
|
14
|
+
*/
|
|
15
|
+
metaData: IMetadata | null;
|
|
16
|
+
/**
|
|
17
|
+
* 模型树
|
|
18
|
+
*/
|
|
19
|
+
treeData: ITreeData[] | null;
|
|
20
|
+
/**
|
|
21
|
+
* 拓扑路径
|
|
22
|
+
*/
|
|
23
|
+
topologyData: TopologyInfo[] | null;
|
|
24
|
+
/**
|
|
25
|
+
* 自定义属性
|
|
26
|
+
*/
|
|
27
|
+
propertiesData: TPropertiesMap | null;
|
|
28
|
+
/**
|
|
29
|
+
* 动画
|
|
30
|
+
*/
|
|
31
|
+
animationsData: TAnimationsMap | null;
|
|
32
|
+
/**
|
|
33
|
+
* 模型视角
|
|
34
|
+
*/
|
|
35
|
+
modelVisionsData: TModelVisionsMap | null;
|
|
36
|
+
constructor(ssp: SoonSpace);
|
|
37
|
+
private _resolvePath;
|
|
38
|
+
private _fetchData;
|
|
39
|
+
/**
|
|
40
|
+
* 获取场景元数据
|
|
41
|
+
*/
|
|
42
|
+
fetchMetaData(): Promise<IMetadata>;
|
|
43
|
+
/**
|
|
44
|
+
* 获取场景树
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
fetchTreeData(): Promise<ITreeData[]>;
|
|
48
|
+
/**
|
|
49
|
+
* 获取拓扑路径
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
fetchTopologyData(): Promise<ITopologyPath[]>;
|
|
53
|
+
/**
|
|
54
|
+
* 获取自定义属性
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
fetchPropertiesData(): Promise<TPropertiesMap>;
|
|
58
|
+
/**
|
|
59
|
+
* 获取动画
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
fetchAnimationsData(): Promise<TAnimationsMap>;
|
|
63
|
+
/**
|
|
64
|
+
* 获取模型视角
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
fetchModelVisionsData(): Promise<TModelVisionsMap>;
|
|
68
|
+
/**
|
|
69
|
+
* 加载场景树中的对象
|
|
70
|
+
*/
|
|
71
|
+
private loadObjects;
|
|
72
|
+
/**
|
|
73
|
+
* 设置 path
|
|
74
|
+
* @param path
|
|
75
|
+
*/
|
|
76
|
+
setPath(path: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* 同步场景树
|
|
79
|
+
*/
|
|
80
|
+
loadScene(options?: ILoadSceneOptions): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* 获取拓扑路径列表
|
|
83
|
+
*/
|
|
84
|
+
getTopologies(): Promise<TopologyInfo[]>;
|
|
85
|
+
/**
|
|
86
|
+
* 播放动画
|
|
87
|
+
*/
|
|
88
|
+
playAnimationById(id: string, animationIndex?: number, options?: IPlayAnimationByIdOptions): Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
export * from './types';
|
|
91
|
+
export * from './constant';
|
|
92
|
+
export default Soonmanager2SyncPlugin;
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t="/SceneMetadata.json",a="/db/sign",e="/db/tree_models.json",s="/db/topology_paths.json",o="/db/properties.json",i="/db/animations.json",n="/db/model_visions.json",r="properties";var l;!function(t){t[t.BIDIRECTION=0]="BIDIRECTION",t[t.POSITIVE=1]="POSITIVE",t[t.OPPOSITE=2]="OPPOSITE",t[t.FORBID=3]="FORBID"}(l||(l={}));class c{get path(){return this._path}set path(t){this._path=t}constructor(t){this.ssp=t,this._path="",this.metaData=null,this.treeData=null,this.topologyData=null,this.propertiesData=null,this.animationsData=null,this.modelVisionsData=null}_resolvePath(t){return`${this._path}${t}`}async _fetchData(t){const{utils:a}=this.ssp;return a.fetchFile(this._resolvePath(t),"json")}async fetchMetaData(){return this._fetchData(t)}async fetchTreeData(){return this._fetchData(e)}async fetchTopologyData(){return this._fetchData(s).then(
|
|
1
|
+
const t="/SceneMetadata.json",a="/db/sign",e="/db/tree_models.json",s="/db/topology_paths.json",o="/db/properties.json",i="/db/animations.json",n="/db/model_visions.json",r="properties";var l;!function(t){t[t.BIDIRECTION=0]="BIDIRECTION",t[t.POSITIVE=1]="POSITIVE",t[t.OPPOSITE=2]="OPPOSITE",t[t.FORBID=3]="FORBID"}(l||(l={}));class c{get path(){return this._path}set path(t){this._path=t}constructor(t){this.ssp=t,this._path="",this.metaData=null,this.treeData=null,this.topologyData=null,this.propertiesData=null,this.animationsData=null,this.modelVisionsData=null}_resolvePath(t){return`${this._path}${t}`}async _fetchData(t){const{utils:a}=this.ssp;return a.fetchFile(this._resolvePath(t),"json")}async fetchMetaData(){return this._fetchData(t)}async fetchTreeData(){return this._fetchData(e)}async fetchTopologyData(){return this._fetchData(s).then(t=>{const a={linkWidth:.1,linkColor:["#00ff00"],nodeRadius:.05,nodeColor:"#0000ff"};return t.map(t=>{const e=Object.assign(Object.assign({},a),t);return e.imgUrl&&(e.imgUrl=`${this.path}${e.imgUrl}`),e})})}async fetchPropertiesData(){return this._fetchData(o).then(t=>h(t,"modelId"))}async fetchAnimationsData(){return this._fetchData(i).then(t=>h(t,"modelId"))}async fetchModelVisionsData(){return this._fetchData(n).then(t=>new Map(Object.entries(t)))}async loadObjects(t){if(!this.treeData)return void console.error("treeData is null");const{syncProperties:a}=t,e=async(t,s)=>{const{ssp:o}=this,{THREE:{Matrix4:i}}=o,{id:n,name:l,renderType:c,path:h,matrix:d}=t,p=(new i).fromArray(d);let y=null;if("3D"===c)if(h)try{const a=Object.assign({},t);Reflect.deleteProperty(a,"children");const e=h.replaceAll(/#/g,"%23");y=await o.loadModel({id:n,name:l,url:this._resolvePath(e),userData:a})}catch(t){console.error(t)}else o.utils.warn(`id: ${n} path 为空`);else"GROUP"!==c&&"STUB"!==c||(y=o.createGroup({id:n,name:l,userData:Object.assign({},t)}));if(y&&(p.decompose(y.position,y.quaternion,y.scale),s&&o.addObject(y,s),a&&this.propertiesData)){const t=this.propertiesData.get(n);t&&(y.userData[r]=t)}t.children.length>0&&await Promise.allSettled(t.children.map(t=>e(t,y)))};await Promise.allSettled(this.treeData.map(t=>e(t,null)))}setPath(t){this.path=t}async loadScene(t={}){t=Object.assign({syncProperties:!0,syncModelVisions:!0,needsModelsBoundsTree:!0},t),await Promise.allSettled([(async()=>{t.syncProperties&&(this.propertiesData=await this.fetchPropertiesData())})(),(async()=>{t.syncModelVisions&&(this.modelVisionsData=await this.fetchModelVisionsData())})()]),this.treeData=await this.fetchTreeData(),await this.loadObjects(t),t.needsModelsBoundsTree&&this.ssp.computeModelsBoundsTree()}async getTopologies(){return this.topologyData=await this.fetchTopologyData(),this.topologyData}async playAnimationById(t,a=0,e={}){const{utils:{error:s},animation:o,THREE:i}=this.ssp,{onStart:n,onUpdate:r}=e;this.animationsData||(this.animationsData=await this.fetchAnimationsData());const l=this.ssp.getObjectById(t);if(!l)return void s(`playAnimationById: id 为 ${t} 场景对象未找到`);const c=this.animationsData.get(t);if(c){const e=c[a];if(e)for(let t=0,a=e.keyframes.length;t<a;t++){let a;if(e.keyframes[t-1]){const s=e.keyframes[t-1];a={x:s.x,y:s.y,z:s.z,rotationX:s.rotationX,rotationY:s.rotationY,rotationZ:s.rotationZ,scaleX:s.scaleX,scaleY:s.scaleY,scaleZ:s.scaleZ}}else{const t=new i.Object3D,e=(new i.Matrix4).fromArray(l.userData.matrix);t.applyMatrix4(e),a={x:t.position.x,y:t.position.y,z:t.position.z,rotationX:t.rotation.x,rotationY:t.rotation.y,rotationZ:t.rotation.z,scaleX:t.scale.x,scaleY:t.scale.y,scaleZ:t.scale.z}}const s=e.keyframes[t],{delay:c,duration:h,easing:d,repeat:p,yoyo:y}=s,u={x:s.x,y:s.y,z:s.z,rotationX:s.rotationX,rotationY:s.rotationY,rotationZ:s.rotationZ,scaleX:s.scaleX,scaleY:s.scaleY,scaleZ:s.scaleZ};await o(a,u,{delay:c,duration:h,mode:d,repeat:-1===p?1/0:p,yoyo:y},(t,a)=>{l.position.set(t.x,t.y,t.z),l.rotation.set(t.rotationX,t.rotationY,t.rotationZ),l.scale.set(t.scaleX,t.scaleY,t.scaleZ),null==r||r(t,a)},t=>{null==n||n(t)})}else s(`id: ${t} 未找到索引为 ${a} 的动画`)}else s(`id: ${t} 未找到动画`)}}function h(t,a){const e=new Map;return t.reduce((t,e)=>{const s=t.get(e[a]);return s?s.push(e):t.set(e[a],[e]),t},e),e}export{i as ANIMATIONS_DATA_FILE_PATH,t as META_DATA_FILE_PATH,n as MODEL_VISIONS_DATA_FILE_PATH,o as PROPERTIES_DATA_FLEE_PATH,r as PROPERTIES_KEY,a as SIGN_PATH,s as TOPOLOGY_DATA_FILE_PATH,e as TREE_DATA_FILE_PATH,c as default};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
import { Tween } from 'three/examples/jsm/libs/tween.module.js';
|
|
2
|
-
import { AnimationModeType, IVector3 } from 'soonspacejs';
|
|
3
|
-
/**
|
|
4
|
-
* 场景元数据
|
|
5
|
-
*/
|
|
6
|
-
export interface IMetadata {
|
|
7
|
-
platformVersion: number;
|
|
8
|
-
version: number;
|
|
9
|
-
name: string;
|
|
10
|
-
projectId: string;
|
|
11
|
-
sceneId: string;
|
|
12
|
-
cover: string | null;
|
|
13
|
-
flatModel: string;
|
|
14
|
-
treeModel: string;
|
|
15
|
-
exportTime: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 场景树
|
|
19
|
-
*/
|
|
20
|
-
export interface ITreeData {
|
|
21
|
-
id: string;
|
|
22
|
-
pid: string | null;
|
|
23
|
-
name: string;
|
|
24
|
-
renderType: 'GROUP' | '3D' | 'ROOM' | 'STUB';
|
|
25
|
-
matrix: number[];
|
|
26
|
-
path: string | null;
|
|
27
|
-
children: ITreeData[];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* origin path
|
|
31
|
-
*/
|
|
32
|
-
export interface ITopologyPath {
|
|
33
|
-
id: string;
|
|
34
|
-
name: string;
|
|
35
|
-
position: IVector3;
|
|
36
|
-
rotation: IVector3;
|
|
37
|
-
scale: IVector3;
|
|
38
|
-
nodes: ITopologyNode[];
|
|
39
|
-
type: 'network';
|
|
40
|
-
imgUrl?: string;
|
|
41
|
-
animation?: {
|
|
42
|
-
duration: 0;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export interface ITopologyNode {
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
position: IVector3;
|
|
49
|
-
graphs: ITopologyNodeGraph[];
|
|
50
|
-
}
|
|
51
|
-
export interface ITopologyNodeGraph {
|
|
52
|
-
linkInfo: ITopologyEdge;
|
|
53
|
-
targetNodeId: string;
|
|
54
|
-
passable: PassableType;
|
|
55
|
-
length: number;
|
|
56
|
-
}
|
|
57
|
-
export interface ITopologyEdge {
|
|
58
|
-
id: string;
|
|
59
|
-
name: string;
|
|
60
|
-
}
|
|
61
|
-
declare enum PassableType {
|
|
62
|
-
BIDIRECTION = 0,
|
|
63
|
-
POSITIVE = 1,
|
|
64
|
-
OPPOSITE = 2,
|
|
65
|
-
FORBID = 3
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* 自定义属性
|
|
69
|
-
*/
|
|
70
|
-
export interface IProperties {
|
|
71
|
-
modelId: string;
|
|
72
|
-
group: string;
|
|
73
|
-
key: string;
|
|
74
|
-
value: string | null;
|
|
75
|
-
label: string | null;
|
|
76
|
-
}
|
|
77
|
-
export interface IKeyframe {
|
|
78
|
-
id: string;
|
|
79
|
-
uuid: string;
|
|
80
|
-
x: number;
|
|
81
|
-
y: number;
|
|
82
|
-
z: number;
|
|
83
|
-
scaleX: number;
|
|
84
|
-
scaleY: number;
|
|
85
|
-
scaleZ: number;
|
|
86
|
-
rotationX: number;
|
|
87
|
-
rotationY: number;
|
|
88
|
-
rotationZ: number;
|
|
89
|
-
easing: AnimationModeType;
|
|
90
|
-
mode: string;
|
|
91
|
-
delay: number;
|
|
92
|
-
duration: number;
|
|
93
|
-
repeat: number;
|
|
94
|
-
yoyo: boolean;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* 动画
|
|
98
|
-
*/
|
|
99
|
-
export interface IAnimations {
|
|
100
|
-
id: string;
|
|
101
|
-
uuid: string;
|
|
102
|
-
modelId: string;
|
|
103
|
-
name: string;
|
|
104
|
-
keyframes: IKeyframe[];
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* 模型视角
|
|
108
|
-
*/
|
|
109
|
-
export interface IModelVisions {
|
|
110
|
-
id: string;
|
|
111
|
-
uuid: string;
|
|
112
|
-
nodeId: string;
|
|
113
|
-
name: string;
|
|
114
|
-
code?: any;
|
|
115
|
-
position: IVector3;
|
|
116
|
-
rotation: IVector3;
|
|
117
|
-
target: IVector3 | null;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* loadScene options
|
|
121
|
-
*/
|
|
122
|
-
export interface ILoadSceneOptions {
|
|
123
|
-
/**
|
|
124
|
-
* 同步自定义属性
|
|
125
|
-
*/
|
|
126
|
-
syncProperties?: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* 同步模型视角数据
|
|
129
|
-
*/
|
|
130
|
-
syncModelVisions?: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* 计算 bounds tree
|
|
133
|
-
*/
|
|
134
|
-
needsModelsBoundsTree?: boolean;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* properties map
|
|
138
|
-
*/
|
|
139
|
-
export type TPropertiesMap = Map<IProperties['modelId'], IProperties[]>;
|
|
140
|
-
export type TAnimationsTweenProps = Pick<IKeyframe, 'x' | 'y' | 'z' | 'rotationX' | 'rotationY' | 'rotationZ' | 'scaleX' | 'scaleY' | 'scaleZ'>;
|
|
141
|
-
/**
|
|
142
|
-
* playAnimationById options
|
|
143
|
-
*/
|
|
144
|
-
export interface IPlayAnimationByIdOptions {
|
|
145
|
-
onUpdate?: (source: TAnimationsTweenProps, tween: Tween<TAnimationsTweenProps>) => void;
|
|
146
|
-
onStart?: (tween: Tween<TAnimationsTweenProps>) => void;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* animation map
|
|
150
|
-
*/
|
|
151
|
-
export type TAnimationsMap = Map<IAnimations['modelId'], IAnimations[]>;
|
|
152
|
-
/**
|
|
153
|
-
* model visions map
|
|
154
|
-
*/
|
|
155
|
-
export type TModelVisionsMap = Map<IModelVisions['nodeId'], IModelVisions>;
|
|
156
|
-
export {};
|
|
1
|
+
import { Tween } from 'three/examples/jsm/libs/tween.module.js';
|
|
2
|
+
import { AnimationModeType, IVector3 } from 'soonspacejs';
|
|
3
|
+
/**
|
|
4
|
+
* 场景元数据
|
|
5
|
+
*/
|
|
6
|
+
export interface IMetadata {
|
|
7
|
+
platformVersion: number;
|
|
8
|
+
version: number;
|
|
9
|
+
name: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
sceneId: string;
|
|
12
|
+
cover: string | null;
|
|
13
|
+
flatModel: string;
|
|
14
|
+
treeModel: string;
|
|
15
|
+
exportTime: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 场景树
|
|
19
|
+
*/
|
|
20
|
+
export interface ITreeData {
|
|
21
|
+
id: string;
|
|
22
|
+
pid: string | null;
|
|
23
|
+
name: string;
|
|
24
|
+
renderType: 'GROUP' | '3D' | 'ROOM' | 'STUB';
|
|
25
|
+
matrix: number[];
|
|
26
|
+
path: string | null;
|
|
27
|
+
children: ITreeData[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* origin path
|
|
31
|
+
*/
|
|
32
|
+
export interface ITopologyPath {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
position: IVector3;
|
|
36
|
+
rotation: IVector3;
|
|
37
|
+
scale: IVector3;
|
|
38
|
+
nodes: ITopologyNode[];
|
|
39
|
+
type: 'network';
|
|
40
|
+
imgUrl?: string;
|
|
41
|
+
animation?: {
|
|
42
|
+
duration: 0;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface ITopologyNode {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
position: IVector3;
|
|
49
|
+
graphs: ITopologyNodeGraph[];
|
|
50
|
+
}
|
|
51
|
+
export interface ITopologyNodeGraph {
|
|
52
|
+
linkInfo: ITopologyEdge;
|
|
53
|
+
targetNodeId: string;
|
|
54
|
+
passable: PassableType;
|
|
55
|
+
length: number;
|
|
56
|
+
}
|
|
57
|
+
export interface ITopologyEdge {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
}
|
|
61
|
+
declare enum PassableType {
|
|
62
|
+
BIDIRECTION = 0,
|
|
63
|
+
POSITIVE = 1,
|
|
64
|
+
OPPOSITE = 2,
|
|
65
|
+
FORBID = 3
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 自定义属性
|
|
69
|
+
*/
|
|
70
|
+
export interface IProperties {
|
|
71
|
+
modelId: string;
|
|
72
|
+
group: string;
|
|
73
|
+
key: string;
|
|
74
|
+
value: string | null;
|
|
75
|
+
label: string | null;
|
|
76
|
+
}
|
|
77
|
+
export interface IKeyframe {
|
|
78
|
+
id: string;
|
|
79
|
+
uuid: string;
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
z: number;
|
|
83
|
+
scaleX: number;
|
|
84
|
+
scaleY: number;
|
|
85
|
+
scaleZ: number;
|
|
86
|
+
rotationX: number;
|
|
87
|
+
rotationY: number;
|
|
88
|
+
rotationZ: number;
|
|
89
|
+
easing: AnimationModeType;
|
|
90
|
+
mode: string;
|
|
91
|
+
delay: number;
|
|
92
|
+
duration: number;
|
|
93
|
+
repeat: number;
|
|
94
|
+
yoyo: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 动画
|
|
98
|
+
*/
|
|
99
|
+
export interface IAnimations {
|
|
100
|
+
id: string;
|
|
101
|
+
uuid: string;
|
|
102
|
+
modelId: string;
|
|
103
|
+
name: string;
|
|
104
|
+
keyframes: IKeyframe[];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 模型视角
|
|
108
|
+
*/
|
|
109
|
+
export interface IModelVisions {
|
|
110
|
+
id: string;
|
|
111
|
+
uuid: string;
|
|
112
|
+
nodeId: string;
|
|
113
|
+
name: string;
|
|
114
|
+
code?: any;
|
|
115
|
+
position: IVector3;
|
|
116
|
+
rotation: IVector3;
|
|
117
|
+
target: IVector3 | null;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* loadScene options
|
|
121
|
+
*/
|
|
122
|
+
export interface ILoadSceneOptions {
|
|
123
|
+
/**
|
|
124
|
+
* 同步自定义属性
|
|
125
|
+
*/
|
|
126
|
+
syncProperties?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* 同步模型视角数据
|
|
129
|
+
*/
|
|
130
|
+
syncModelVisions?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* 计算 bounds tree
|
|
133
|
+
*/
|
|
134
|
+
needsModelsBoundsTree?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* properties map
|
|
138
|
+
*/
|
|
139
|
+
export type TPropertiesMap = Map<IProperties['modelId'], IProperties[]>;
|
|
140
|
+
export type TAnimationsTweenProps = Pick<IKeyframe, 'x' | 'y' | 'z' | 'rotationX' | 'rotationY' | 'rotationZ' | 'scaleX' | 'scaleY' | 'scaleZ'>;
|
|
141
|
+
/**
|
|
142
|
+
* playAnimationById options
|
|
143
|
+
*/
|
|
144
|
+
export interface IPlayAnimationByIdOptions {
|
|
145
|
+
onUpdate?: (source: TAnimationsTweenProps, tween: Tween<TAnimationsTweenProps>) => void;
|
|
146
|
+
onStart?: (tween: Tween<TAnimationsTweenProps>) => void;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* animation map
|
|
150
|
+
*/
|
|
151
|
+
export type TAnimationsMap = Map<IAnimations['modelId'], IAnimations[]>;
|
|
152
|
+
/**
|
|
153
|
+
* model visions map
|
|
154
|
+
*/
|
|
155
|
+
export type TModelVisionsMap = Map<IModelVisions['nodeId'], IModelVisions>;
|
|
156
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-soonmanager2-sync",
|
|
3
3
|
"pluginName": "Soonmanager2SyncPlugin",
|
|
4
|
-
"version": "2.13.
|
|
4
|
+
"version": "2.13.11",
|
|
5
5
|
"description": "Sync soonmanager 2.x data 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": "
|
|
16
|
+
"gitHead": "08bf9efb38c291f22ca044b936fd49269c716bbb",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"soonspacejs": "2.13.
|
|
18
|
+
"soonspacejs": "2.13.11"
|
|
19
19
|
}
|
|
20
20
|
}
|