@soonspacejs/plugin-soonmanager2-sync 2.11.38 → 2.11.41
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/README.md +5 -5
- package/dist/constant.d.ts +32 -0
- package/dist/index.d.ts +92 -0
- package/dist/types.d.ts +156 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# @soonspacejs/plugin-soonmanager2-sync
|
|
2
|
-
|
|
3
|
-
> Sync soonmanager 2.x data plugin for SoonSpace.js
|
|
4
|
-
|
|
5
|
-
Document: [http://www.xwbuilders.com:8800/plugin/soonmanager2-sync.html](http://www.xwbuilders.com:8800/plugin/soonmanager2-sync.html)
|
|
1
|
+
# @soonspacejs/plugin-soonmanager2-sync
|
|
2
|
+
|
|
3
|
+
> Sync soonmanager 2.x data plugin for SoonSpace.js
|
|
4
|
+
|
|
5
|
+
Document: [http://www.xwbuilders.com:8800/plugin/soonmanager2-sync.html](http://www.xwbuilders.com:8800/plugin/soonmanager2-sync.html)
|
|
@@ -0,0 +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";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated 使用 plugin-cps-soonmanager 替代
|
|
3
|
+
*/
|
|
4
|
+
import SoonSpace from 'soonspacejs';
|
|
5
|
+
import type { TopologyInfo } from 'soonspacejs/types/Library';
|
|
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/types.d.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Tween } from '@tweenjs/tween.js';
|
|
2
|
+
import { AnimationModeType, IVector3 } from 'soonspacejs/types/Interface';
|
|
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.11.
|
|
4
|
+
"version": "2.11.41",
|
|
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": "48d29072320f2f8c700d75d2839487d3c97008fe",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"soonspacejs": "2.11.
|
|
18
|
+
"soonspacejs": "2.11.41"
|
|
19
19
|
}
|
|
20
20
|
}
|