@soonspacejs/plugin-soonmanager2-sync 2.13.5 → 2.13.7
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/index.esm.js +383 -1
- package/dist/index.esm.js.map +1 -0
- package/package.json +3 -3
- package/dist/constant.d.ts +0 -32
- package/dist/index.d.ts +0 -92
- package/dist/types.d.ts +0 -156
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)
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1,383 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 场景元数据
|
|
3
|
+
*/
|
|
4
|
+
const META_DATA_FILE_PATH = '/SceneMetadata.json';
|
|
5
|
+
/**
|
|
6
|
+
* 签名文件
|
|
7
|
+
*/
|
|
8
|
+
const SIGN_PATH = '/db/sign';
|
|
9
|
+
/**
|
|
10
|
+
* 模型树
|
|
11
|
+
*/
|
|
12
|
+
const TREE_DATA_FILE_PATH = '/db/tree_models.json';
|
|
13
|
+
/**
|
|
14
|
+
* 拓扑路径
|
|
15
|
+
*/
|
|
16
|
+
const TOPOLOGY_DATA_FILE_PATH = '/db/topology_paths.json';
|
|
17
|
+
/**
|
|
18
|
+
* 自定义属性
|
|
19
|
+
*/
|
|
20
|
+
const PROPERTIES_DATA_FLEE_PATH = '/db/properties.json';
|
|
21
|
+
/**
|
|
22
|
+
* 帧动画
|
|
23
|
+
*/
|
|
24
|
+
const ANIMATIONS_DATA_FILE_PATH = '/db/animations.json';
|
|
25
|
+
/**
|
|
26
|
+
* 模型视角
|
|
27
|
+
*/
|
|
28
|
+
const MODEL_VISIONS_DATA_FILE_PATH = '/db/model_visions.json';
|
|
29
|
+
/**
|
|
30
|
+
* 自定义属性 key
|
|
31
|
+
*/
|
|
32
|
+
const PROPERTIES_KEY = 'properties';
|
|
33
|
+
|
|
34
|
+
var PassableType;
|
|
35
|
+
(function (PassableType) {
|
|
36
|
+
// 双向
|
|
37
|
+
PassableType[PassableType["BIDIRECTION"] = 0] = "BIDIRECTION";
|
|
38
|
+
// 单向正向
|
|
39
|
+
PassableType[PassableType["POSITIVE"] = 1] = "POSITIVE";
|
|
40
|
+
// 单向反向
|
|
41
|
+
PassableType[PassableType["OPPOSITE"] = 2] = "OPPOSITE";
|
|
42
|
+
// 禁止
|
|
43
|
+
PassableType[PassableType["FORBID"] = 3] = "FORBID";
|
|
44
|
+
})(PassableType || (PassableType = {}));
|
|
45
|
+
|
|
46
|
+
class Soonmanager2SyncPlugin {
|
|
47
|
+
get path() {
|
|
48
|
+
return this._path;
|
|
49
|
+
}
|
|
50
|
+
set path(val) {
|
|
51
|
+
this._path = val;
|
|
52
|
+
}
|
|
53
|
+
constructor(ssp) {
|
|
54
|
+
this.ssp = ssp;
|
|
55
|
+
this._path = '';
|
|
56
|
+
/**
|
|
57
|
+
* 场景元数据
|
|
58
|
+
*/
|
|
59
|
+
this.metaData = null;
|
|
60
|
+
/**
|
|
61
|
+
* 模型树
|
|
62
|
+
*/
|
|
63
|
+
this.treeData = null;
|
|
64
|
+
/**
|
|
65
|
+
* 拓扑路径
|
|
66
|
+
*/
|
|
67
|
+
this.topologyData = null;
|
|
68
|
+
/**
|
|
69
|
+
* 自定义属性
|
|
70
|
+
*/
|
|
71
|
+
this.propertiesData = null;
|
|
72
|
+
/**
|
|
73
|
+
* 动画
|
|
74
|
+
*/
|
|
75
|
+
this.animationsData = null;
|
|
76
|
+
/**
|
|
77
|
+
* 模型视角
|
|
78
|
+
*/
|
|
79
|
+
this.modelVisionsData = null;
|
|
80
|
+
}
|
|
81
|
+
_resolvePath(path) {
|
|
82
|
+
return `${this._path}${path}`;
|
|
83
|
+
}
|
|
84
|
+
async _fetchData(filePath) {
|
|
85
|
+
const { utils, } = this.ssp;
|
|
86
|
+
return utils.fetchFile(this._resolvePath(filePath), 'json');
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 获取场景元数据
|
|
90
|
+
*/
|
|
91
|
+
async fetchMetaData() {
|
|
92
|
+
return this._fetchData(META_DATA_FILE_PATH);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 获取场景树
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
async fetchTreeData() {
|
|
99
|
+
return this._fetchData(TREE_DATA_FILE_PATH);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 获取拓扑路径
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
105
|
+
async fetchTopologyData() {
|
|
106
|
+
return this._fetchData(TOPOLOGY_DATA_FILE_PATH).then((res) => {
|
|
107
|
+
/**
|
|
108
|
+
* @TEMP 默认值
|
|
109
|
+
*/
|
|
110
|
+
const defaultOptions = {
|
|
111
|
+
linkWidth: 0.1,
|
|
112
|
+
linkColor: ['#00ff00'],
|
|
113
|
+
nodeRadius: 0.05,
|
|
114
|
+
nodeColor: '#0000ff',
|
|
115
|
+
};
|
|
116
|
+
return res.map(t => {
|
|
117
|
+
const topologyInfo = (Object.assign(Object.assign({}, defaultOptions), t));
|
|
118
|
+
/**
|
|
119
|
+
* 处理 imgUrl
|
|
120
|
+
*/
|
|
121
|
+
if (topologyInfo.imgUrl) {
|
|
122
|
+
topologyInfo.imgUrl = `${this.path}${topologyInfo.imgUrl}`;
|
|
123
|
+
}
|
|
124
|
+
return topologyInfo;
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* 获取自定义属性
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
async fetchPropertiesData() {
|
|
133
|
+
return this._fetchData(PROPERTIES_DATA_FLEE_PATH).then(res => groupBy(res, 'modelId'));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 获取动画
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
async fetchAnimationsData() {
|
|
140
|
+
return this._fetchData(ANIMATIONS_DATA_FILE_PATH).then(res => groupBy(res, 'modelId'));
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 获取模型视角
|
|
144
|
+
* @returns
|
|
145
|
+
*/
|
|
146
|
+
async fetchModelVisionsData() {
|
|
147
|
+
return this._fetchData(MODEL_VISIONS_DATA_FILE_PATH).then(res => new Map(Object.entries(res)));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 加载场景树中的对象
|
|
151
|
+
*/
|
|
152
|
+
async loadObjects(options) {
|
|
153
|
+
if (!this.treeData) {
|
|
154
|
+
console.error('treeData is null');
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* options
|
|
159
|
+
*/
|
|
160
|
+
const { syncProperties, } = options;
|
|
161
|
+
/**
|
|
162
|
+
* load objects
|
|
163
|
+
* @param node
|
|
164
|
+
* @param parent
|
|
165
|
+
*/
|
|
166
|
+
const innerLoader = async (node, parent) => {
|
|
167
|
+
const { ssp, } = this;
|
|
168
|
+
const { THREE: { Matrix4, }, } = ssp;
|
|
169
|
+
const { id, name, renderType, path, matrix, } = node;
|
|
170
|
+
const objectMatrix = new Matrix4().fromArray(matrix);
|
|
171
|
+
let object = null;
|
|
172
|
+
if (renderType === '3D') {
|
|
173
|
+
if (path) {
|
|
174
|
+
/**
|
|
175
|
+
* model
|
|
176
|
+
*/
|
|
177
|
+
try {
|
|
178
|
+
const userData = Object.assign({}, node);
|
|
179
|
+
Reflect.deleteProperty(userData, 'children');
|
|
180
|
+
/**
|
|
181
|
+
* @temp 单独处理 #
|
|
182
|
+
*/
|
|
183
|
+
const decodedPath = path.replaceAll(/#/g, '%23');
|
|
184
|
+
object = await ssp.loadModel({
|
|
185
|
+
id,
|
|
186
|
+
name,
|
|
187
|
+
url: this._resolvePath(decodedPath),
|
|
188
|
+
userData,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
console.error(e);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
ssp.utils.warn(`id: ${id} path 为空`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else if (renderType === 'GROUP' || renderType === 'STUB') {
|
|
200
|
+
/**
|
|
201
|
+
* group、占位符
|
|
202
|
+
*/
|
|
203
|
+
object = ssp.createGroup({
|
|
204
|
+
id,
|
|
205
|
+
name,
|
|
206
|
+
userData: Object.assign({}, node),
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
else ;
|
|
210
|
+
if (object) {
|
|
211
|
+
/**
|
|
212
|
+
* decompose matrix
|
|
213
|
+
*/
|
|
214
|
+
objectMatrix.decompose(object.position, object.quaternion, object.scale);
|
|
215
|
+
/**
|
|
216
|
+
* add object to parent
|
|
217
|
+
*/
|
|
218
|
+
if (parent) {
|
|
219
|
+
ssp.addObject(object, parent);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* sync properties
|
|
223
|
+
*/
|
|
224
|
+
if (syncProperties && this.propertiesData) {
|
|
225
|
+
const propertiesValue = this.propertiesData.get(id);
|
|
226
|
+
if (propertiesValue) {
|
|
227
|
+
object.userData[PROPERTIES_KEY] = propertiesValue;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (node.children.length > 0) {
|
|
232
|
+
await Promise.allSettled(node.children.map((treeNode) => innerLoader(treeNode, object)));
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
await Promise.allSettled(this.treeData.map((treeNode) => innerLoader(treeNode, null)));
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* 设置 path
|
|
239
|
+
* @param path
|
|
240
|
+
*/
|
|
241
|
+
setPath(path) {
|
|
242
|
+
this.path = path;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* 同步场景树
|
|
246
|
+
*/
|
|
247
|
+
async loadScene(options = {}) {
|
|
248
|
+
/**
|
|
249
|
+
* 默认参数
|
|
250
|
+
*/
|
|
251
|
+
options = Object.assign({ syncProperties: true, syncModelVisions: true, needsModelsBoundsTree: true }, options);
|
|
252
|
+
await Promise.allSettled([
|
|
253
|
+
(async () => {
|
|
254
|
+
if (options.syncProperties) {
|
|
255
|
+
this.propertiesData = await this.fetchPropertiesData();
|
|
256
|
+
}
|
|
257
|
+
})(),
|
|
258
|
+
(async () => {
|
|
259
|
+
if (options.syncModelVisions) {
|
|
260
|
+
this.modelVisionsData = await this.fetchModelVisionsData();
|
|
261
|
+
}
|
|
262
|
+
})()
|
|
263
|
+
]);
|
|
264
|
+
this.treeData = await this.fetchTreeData();
|
|
265
|
+
await this.loadObjects(options);
|
|
266
|
+
if (options.needsModelsBoundsTree) {
|
|
267
|
+
this.ssp.computeModelsBoundsTree();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* 获取拓扑路径列表
|
|
272
|
+
*/
|
|
273
|
+
async getTopologies() {
|
|
274
|
+
this.topologyData = await this.fetchTopologyData();
|
|
275
|
+
return this.topologyData;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* 播放动画
|
|
279
|
+
*/
|
|
280
|
+
async playAnimationById(id, animationIndex = 0, options = {}) {
|
|
281
|
+
const { utils: { error, }, animation, THREE, } = this.ssp;
|
|
282
|
+
const { onStart, onUpdate, } = options;
|
|
283
|
+
if (!this.animationsData) {
|
|
284
|
+
this.animationsData = await this.fetchAnimationsData();
|
|
285
|
+
}
|
|
286
|
+
const object = this.ssp.getObjectById(id);
|
|
287
|
+
if (!object) {
|
|
288
|
+
error(`playAnimationById: id 为 ${id} 场景对象未找到`);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const animationsValue = this.animationsData.get(id);
|
|
292
|
+
if (animationsValue) {
|
|
293
|
+
const animationValue = animationsValue[animationIndex];
|
|
294
|
+
if (animationValue) {
|
|
295
|
+
/**
|
|
296
|
+
* keyframes
|
|
297
|
+
*/
|
|
298
|
+
for (let i = 0, len = animationValue.keyframes.length; i < len; i++) {
|
|
299
|
+
let currentFrame;
|
|
300
|
+
if (animationValue.keyframes[i - 1]) {
|
|
301
|
+
const keyframe = animationValue.keyframes[i - 1];
|
|
302
|
+
currentFrame = {
|
|
303
|
+
x: keyframe.x,
|
|
304
|
+
y: keyframe.y,
|
|
305
|
+
z: keyframe.z,
|
|
306
|
+
rotationX: keyframe.rotationX,
|
|
307
|
+
rotationY: keyframe.rotationY,
|
|
308
|
+
rotationZ: keyframe.rotationZ,
|
|
309
|
+
scaleX: keyframe.scaleX,
|
|
310
|
+
scaleY: keyframe.scaleY,
|
|
311
|
+
scaleZ: keyframe.scaleZ,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
const dummy = new THREE.Object3D(), matrix = new THREE.Matrix4().fromArray(object.userData.matrix);
|
|
316
|
+
dummy.applyMatrix4(matrix);
|
|
317
|
+
currentFrame = {
|
|
318
|
+
x: dummy.position.x,
|
|
319
|
+
y: dummy.position.y,
|
|
320
|
+
z: dummy.position.z,
|
|
321
|
+
rotationX: dummy.rotation.x,
|
|
322
|
+
rotationY: dummy.rotation.y,
|
|
323
|
+
rotationZ: dummy.rotation.z,
|
|
324
|
+
scaleX: dummy.scale.x,
|
|
325
|
+
scaleY: dummy.scale.y,
|
|
326
|
+
scaleZ: dummy.scale.z,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
const keyframe = animationValue.keyframes[i];
|
|
330
|
+
const { delay, duration, easing, repeat, yoyo, } = keyframe;
|
|
331
|
+
const nextFrame = {
|
|
332
|
+
x: keyframe.x,
|
|
333
|
+
y: keyframe.y,
|
|
334
|
+
z: keyframe.z,
|
|
335
|
+
rotationX: keyframe.rotationX,
|
|
336
|
+
rotationY: keyframe.rotationY,
|
|
337
|
+
rotationZ: keyframe.rotationZ,
|
|
338
|
+
scaleX: keyframe.scaleX,
|
|
339
|
+
scaleY: keyframe.scaleY,
|
|
340
|
+
scaleZ: keyframe.scaleZ,
|
|
341
|
+
};
|
|
342
|
+
await animation(currentFrame, nextFrame, { delay, duration, mode: easing, repeat: repeat === -1 ? Infinity : repeat, yoyo, }, (source, tween) => {
|
|
343
|
+
object.position.set(source.x, source.y, source.z);
|
|
344
|
+
object.rotation.set(source.rotationX, source.rotationY, source.rotationZ);
|
|
345
|
+
object.scale.set(source.scaleX, source.scaleY, source.scaleZ);
|
|
346
|
+
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(source, tween);
|
|
347
|
+
}, (tween) => {
|
|
348
|
+
onStart === null || onStart === void 0 ? void 0 : onStart(tween);
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
error(`id: ${id} 未找到索引为 ${animationIndex} 的动画`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
error(`id: ${id} 未找到动画`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* 分组
|
|
363
|
+
* @param list
|
|
364
|
+
* @param key
|
|
365
|
+
* @returns Map
|
|
366
|
+
*/
|
|
367
|
+
function groupBy(list, key) {
|
|
368
|
+
const _map = new Map();
|
|
369
|
+
list.reduce((map, curr) => {
|
|
370
|
+
const propertiesValue = map.get(curr[key]);
|
|
371
|
+
if (propertiesValue) {
|
|
372
|
+
propertiesValue.push(curr);
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
map.set(curr[key], [curr]);
|
|
376
|
+
}
|
|
377
|
+
return map;
|
|
378
|
+
}, _map);
|
|
379
|
+
return _map;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export { ANIMATIONS_DATA_FILE_PATH, META_DATA_FILE_PATH, MODEL_VISIONS_DATA_FILE_PATH, PROPERTIES_DATA_FLEE_PATH, PROPERTIES_KEY, SIGN_PATH, TOPOLOGY_DATA_FILE_PATH, TREE_DATA_FILE_PATH, Soonmanager2SyncPlugin as default };
|
|
383
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/constant.ts","../src/types.ts","../src/index.ts"],"sourcesContent":["/**\r\n * 场景元数据\r\n */\r\nexport const META_DATA_FILE_PATH = '/SceneMetadata.json'\r\n/**\r\n * 签名文件\r\n */\r\nexport const SIGN_PATH = '/db/sign'\r\n/**\r\n * 模型树\r\n */\r\nexport const TREE_DATA_FILE_PATH = '/db/tree_models.json'\r\n/**\r\n * 拓扑路径\r\n */\r\nexport const TOPOLOGY_DATA_FILE_PATH = '/db/topology_paths.json'\r\n/**\r\n * 自定义属性\r\n */\r\nexport const PROPERTIES_DATA_FLEE_PATH = '/db/properties.json'\r\n/**\r\n * 帧动画\r\n */\r\nexport const ANIMATIONS_DATA_FILE_PATH = '/db/animations.json'\r\n/**\r\n * 模型视角\r\n */\r\nexport const MODEL_VISIONS_DATA_FILE_PATH = '/db/model_visions.json'\r\n\r\n/**\r\n * 自定义属性 key\r\n */\r\nexport const PROPERTIES_KEY = 'properties'","import { Tween, } from 'three/examples/jsm/libs/tween.module.js'\r\nimport { AnimationModeType, IVector3, } from 'soonspacejs'\r\n\r\n/**\r\n * 场景元数据\r\n */\r\nexport interface IMetadata {\r\n\tplatformVersion: number;\r\n\tversion: number;\r\n\tname: string;\r\n\tprojectId: string;\r\n\tsceneId: string;\r\n\tcover: string | null;\r\n\tflatModel: string;\r\n\ttreeModel: string;\r\n exportTime: number;\r\n}\r\n\r\n/**\r\n * 场景树\r\n */\r\nexport interface ITreeData {\r\n\tid: string;\r\n\tpid: string | null;\r\n\tname: string;\r\n\trenderType: 'GROUP' | '3D' | 'ROOM' | 'STUB';\r\n\tmatrix: number[];\r\n\tpath: string | null;\r\n\tchildren: ITreeData[];\r\n}\r\n\r\n/**\r\n * origin path\r\n */\r\nexport interface ITopologyPath {\r\n id: string;\r\n name: string;\r\n position: IVector3;\r\n rotation: IVector3;\r\n scale: IVector3;\r\n nodes: ITopologyNode[];\r\n\ttype: 'network';\r\n\timgUrl?: string;\r\n\tanimation?: { duration: 0 };\r\n}\r\n\r\nexport interface ITopologyNode {\r\n id: string;\r\n name: string;\r\n position: IVector3;\r\n graphs: ITopologyNodeGraph[];\r\n}\r\n\r\nexport interface ITopologyNodeGraph {\r\n linkInfo: ITopologyEdge;\r\n targetNodeId: string;\r\n passable: PassableType;\r\n length: number;\r\n}\r\n\r\nexport interface ITopologyEdge {\r\n id: string;\r\n name: string;\r\n}\r\n\r\nenum PassableType {\r\n // 双向\r\n BIDIRECTION = 0,\r\n // 单向正向\r\n POSITIVE = 1,\r\n // 单向反向\r\n OPPOSITE = 2,\r\n // 禁止\r\n FORBID = 3,\r\n}\r\n\r\n\r\n/**\r\n * 自定义属性\r\n */\r\nexport interface IProperties {\r\n\tmodelId: string;\r\n\tgroup: string;\r\n\tkey: string;\r\n\tvalue: string | null;\r\n\tlabel: string | null;\r\n}\r\n\r\nexport interface IKeyframe {\r\n\tid: string;\r\n\tuuid: string;\r\n\tx: number;\r\n\ty: number;\r\n\tz: number;\r\n\tscaleX: number;\r\n\tscaleY: number;\r\n\tscaleZ: number;\r\n\trotationX: number;\r\n\trotationY: number;\r\n\trotationZ: number;\r\n\teasing: AnimationModeType;\r\n\tmode: string;\r\n\tdelay: number;\r\n\tduration: number;\r\n\trepeat: number;\r\n\tyoyo: boolean;\r\n}\r\n\r\n/**\r\n * 动画\r\n */\r\nexport interface IAnimations {\r\n\tid: string;\r\n\tuuid: string;\r\n\tmodelId: string;\r\n\tname: string;\r\n\tkeyframes: IKeyframe[];\r\n}\r\n\r\n/**\r\n * 模型视角\r\n */\r\nexport interface IModelVisions {\r\n\tid: string;\r\n\tuuid: string;\r\n\tnodeId: string;\r\n\tname: string;\r\n\tcode?: any;\r\n\tposition: IVector3;\r\n\trotation: IVector3;\r\n\ttarget: IVector3 | null;\r\n}\r\n\r\n\r\n/**\r\n * loadScene options\r\n */\r\nexport interface ILoadSceneOptions {\r\n\t/**\r\n\t * 同步自定义属性\r\n\t */\r\n syncProperties?: boolean;\r\n\t/**\r\n\t * 同步模型视角数据\r\n\t */\r\n\tsyncModelVisions?: boolean;\r\n\t/**\r\n\t * 计算 bounds tree\r\n\t */\r\n\tneedsModelsBoundsTree?: boolean;\r\n}\r\n\r\n/**\r\n * properties map\r\n */\r\nexport type TPropertiesMap = Map<IProperties['modelId'], IProperties[]>\r\n\r\nexport type TAnimationsTweenProps = Pick<IKeyframe, 'x' | 'y' | 'z' | 'rotationX' | 'rotationY' | 'rotationZ' | 'scaleX' | 'scaleY' | 'scaleZ'>\r\n\r\n/**\r\n * playAnimationById options\r\n */\r\nexport interface IPlayAnimationByIdOptions {\r\n\tonUpdate?: ( source: TAnimationsTweenProps, tween: Tween<TAnimationsTweenProps> ) => void;\r\n onStart?: ( tween: Tween<TAnimationsTweenProps> ) => void;\r\n}\r\n\r\n/**\r\n * animation map\r\n */\r\nexport type TAnimationsMap = Map<IAnimations['modelId'], IAnimations[]>\r\n\r\n/**\r\n * model visions map\r\n */\r\nexport type TModelVisionsMap = Map<IModelVisions['nodeId'], IModelVisions>","/**\r\n * @deprecated 使用 plugin-cps-soonmanager 替代\r\n */\r\nimport SoonSpace from 'soonspacejs'\r\nimport type { TopologyInfo, } from 'soonspacejs'\r\nimport { Object3D, } from 'three'\r\nimport { META_DATA_FILE_PATH, TREE_DATA_FILE_PATH, TOPOLOGY_DATA_FILE_PATH, PROPERTIES_DATA_FLEE_PATH, PROPERTIES_KEY, ANIMATIONS_DATA_FILE_PATH, MODEL_VISIONS_DATA_FILE_PATH, } from './constant'\r\nimport { IMetadata, ITreeData, ITopologyPath, IProperties, ILoadSceneOptions, TPropertiesMap, TAnimationsMap, IAnimations, IPlayAnimationByIdOptions, TAnimationsTweenProps, IModelVisions, TModelVisionsMap, } from './types'\r\n\r\nclass Soonmanager2SyncPlugin {\r\n\r\n _path = ''\r\n\r\n get path () {\r\n\r\n return this._path\r\n \r\n }\r\n\r\n set path ( val ) {\r\n\r\n this._path = val\r\n\r\n }\r\n\r\n /**\r\n * 场景元数据\r\n */\r\n metaData: IMetadata | null = null\r\n\r\n /**\r\n * 模型树\r\n */\r\n treeData: ITreeData[] | null = null\r\n\r\n /**\r\n * 拓扑路径\r\n */\r\n topologyData: TopologyInfo[] | null = null\r\n\r\n /**\r\n * 自定义属性\r\n */\r\n propertiesData: TPropertiesMap | null = null\r\n\r\n /**\r\n * 动画\r\n */\r\n animationsData: TAnimationsMap | null = null\r\n\r\n /**\r\n * 模型视角\r\n */\r\n modelVisionsData: TModelVisionsMap | null = null\r\n\r\n constructor ( readonly ssp: SoonSpace ) {\r\n\r\n }\r\n\r\n private _resolvePath ( path: string ) {\r\n\r\n return `${this._path}${path}`\r\n\r\n }\r\n\r\n private async _fetchData<T> ( filePath: string ) {\r\n\r\n const { utils, } = this.ssp\r\n\r\n return utils.fetchFile<T>( this._resolvePath( filePath ), 'json' )\r\n\r\n }\r\n\r\n /**\r\n * 获取场景元数据\r\n */\r\n async fetchMetaData (): Promise<IMetadata> {\r\n\r\n return this._fetchData<IMetadata>( META_DATA_FILE_PATH )\r\n\r\n }\r\n\r\n /**\r\n * 获取场景树\r\n * @returns \r\n */\r\n async fetchTreeData (): Promise<ITreeData[]> {\r\n\r\n return this._fetchData<ITreeData[]>( TREE_DATA_FILE_PATH )\r\n \r\n }\r\n\r\n /**\r\n * 获取拓扑路径\r\n * @returns \r\n */\r\n async fetchTopologyData (): Promise<ITopologyPath[]> {\r\n\r\n return this._fetchData<ITopologyPath[]>( TOPOLOGY_DATA_FILE_PATH ).then( ( res ) => {\r\n\r\n /**\r\n * @TEMP 默认值\r\n */\r\n const defaultOptions = {\r\n linkWidth: 0.1,\r\n linkColor: [ '#00ff00' ],\r\n nodeRadius: 0.05,\r\n nodeColor: '#0000ff',\r\n }\r\n\r\n return res.map( t => {\r\n\r\n const topologyInfo = ( { ...defaultOptions, ...t, } ) \r\n\r\n /**\r\n * 处理 imgUrl\r\n */\r\n if ( topologyInfo.imgUrl ) {\r\n\r\n topologyInfo.imgUrl = `${this.path}${topologyInfo.imgUrl}`\r\n \r\n }\r\n\r\n return topologyInfo\r\n\r\n } )\r\n \r\n } )\r\n\r\n }\r\n\r\n /**\r\n * 获取自定义属性\r\n * @returns \r\n */\r\n async fetchPropertiesData (): Promise<TPropertiesMap> {\r\n\r\n return this._fetchData<IProperties[]>( PROPERTIES_DATA_FLEE_PATH ).then( res => groupBy<IProperties, string>( res, 'modelId' ) )\r\n\r\n }\r\n\r\n /**\r\n * 获取动画\r\n * @returns \r\n */\r\n async fetchAnimationsData (): Promise<TAnimationsMap> {\r\n\r\n return this._fetchData<IAnimations[]>( ANIMATIONS_DATA_FILE_PATH ).then( res => groupBy<IAnimations, string>( res, 'modelId' ) )\r\n\r\n }\r\n\r\n /**\r\n * 获取模型视角\r\n * @returns \r\n */\r\n async fetchModelVisionsData (): Promise<TModelVisionsMap> {\r\n\r\n return this._fetchData<Record<IModelVisions['nodeId'], IModelVisions>>( MODEL_VISIONS_DATA_FILE_PATH ).then( res => new Map( Object.entries( res ) ) )\r\n \r\n }\r\n\r\n\r\n /**\r\n * 加载场景树中的对象\r\n */\r\n private async loadObjects ( options: ILoadSceneOptions ) {\r\n\r\n if ( !this.treeData ) {\r\n\r\n console.error( 'treeData is null' )\r\n\r\n return\r\n\r\n }\r\n\r\n /**\r\n * options\r\n */\r\n const { syncProperties, } = options\r\n\r\n /**\r\n * load objects\r\n * @param node \r\n * @param parent \r\n */\r\n const innerLoader = async ( node: ITreeData, parent: Object3D | null ) => {\r\n\r\n const { ssp, } = this\r\n\r\n const { THREE: { Matrix4, }, } = ssp\r\n\r\n const { id, name, renderType, path, matrix, } = node\r\n\r\n const objectMatrix = new Matrix4().fromArray( matrix )\r\n\r\n let object: Object3D | null = null\r\n\r\n if ( renderType === '3D' ) {\r\n\r\n if ( path ) {\r\n\r\n /**\r\n * model\r\n */\r\n try {\r\n\r\n const userData = { ...node, }\r\n\r\n Reflect.deleteProperty( userData, 'children' )\r\n\r\n /**\r\n * @temp 单独处理 #\r\n */\r\n const decodedPath = path.replaceAll( /#/g, '%23' )\r\n\r\n object = await ssp.loadModel( {\r\n id,\r\n name,\r\n url: this._resolvePath( decodedPath ),\r\n userData,\r\n } )\r\n\r\n } catch ( e ) {\r\n\r\n console.error( e )\r\n\r\n }\r\n\r\n } else {\r\n\r\n ssp.utils.warn( `id: ${id} path 为空` )\r\n\r\n }\r\n\r\n } else if ( renderType === 'GROUP' || renderType === 'STUB' ) {\r\n\r\n /**\r\n * group、占位符\r\n */\r\n\r\n object = ssp.createGroup( {\r\n id,\r\n name,\r\n userData: { ...node, },\r\n } )\r\n\r\n } else if ( renderType === 'ROOM' ) {\r\n\r\n /**\r\n * @TODO\r\n */\r\n\r\n }\r\n\r\n if ( object ) {\r\n\r\n /**\r\n * decompose matrix\r\n */\r\n objectMatrix.decompose( object.position, object.quaternion, object.scale )\r\n\r\n /**\r\n * add object to parent\r\n */\r\n if ( parent ) {\r\n\r\n ssp.addObject( object, parent )\r\n\r\n }\r\n\r\n /**\r\n * sync properties\r\n */\r\n if ( syncProperties && this.propertiesData ) {\r\n\r\n const propertiesValue = this.propertiesData.get( id )\r\n\r\n if ( propertiesValue ) {\r\n\r\n object.userData[ PROPERTIES_KEY ] = propertiesValue\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n if ( node.children.length > 0 ) {\r\n\r\n await Promise.allSettled( node.children.map( ( treeNode ) => innerLoader( treeNode, object ) ) )\r\n\r\n }\r\n\r\n }\r\n\r\n await Promise.allSettled( this.treeData.map( ( treeNode ) => innerLoader( treeNode, null ) ) )\r\n\r\n }\r\n\r\n /**\r\n * 设置 path\r\n * @param path \r\n */\r\n public setPath ( path: string ) {\r\n\r\n this.path = path\r\n\r\n }\r\n\r\n /**\r\n * 同步场景树\r\n */\r\n public async loadScene ( options: ILoadSceneOptions = {} ) {\r\n\r\n /**\r\n * 默认参数\r\n */\r\n options = {\r\n syncProperties: true,\r\n syncModelVisions: true,\r\n needsModelsBoundsTree: true,\r\n ...options,\r\n }\r\n\r\n\r\n await Promise.allSettled( [\r\n ( async () => {\r\n\r\n if ( options.syncProperties ) {\r\n\r\n this.propertiesData = await this.fetchPropertiesData()\r\n \r\n }\r\n \r\n } )(),\r\n ( async () => {\r\n\r\n if ( options.syncModelVisions ) {\r\n\r\n this.modelVisionsData = await this.fetchModelVisionsData()\r\n \r\n }\r\n \r\n } )()\r\n ] )\r\n \r\n this.treeData = await this.fetchTreeData()\r\n\r\n await this.loadObjects( options )\r\n\r\n if ( options.needsModelsBoundsTree ) {\r\n\r\n this.ssp.computeModelsBoundsTree()\r\n\r\n }\r\n\r\n }\r\n\r\n /**\r\n * 获取拓扑路径列表\r\n */\r\n public async getTopologies () {\r\n\r\n this.topologyData = await this.fetchTopologyData()\r\n\r\n return this.topologyData\r\n\r\n }\r\n\r\n /**\r\n * 播放动画\r\n */\r\n public async playAnimationById ( id: string, animationIndex = 0, options: IPlayAnimationByIdOptions = {} ) {\r\n\r\n const { utils: { error, }, animation, THREE, } = this.ssp\r\n\r\n const { onStart, onUpdate, } = options\r\n\r\n if ( !this.animationsData ) {\r\n\r\n this.animationsData = await this.fetchAnimationsData()\r\n\r\n }\r\n\r\n const object = this.ssp.getObjectById( id )\r\n\r\n if ( !object ) {\r\n\r\n error( `playAnimationById: id 为 ${id} 场景对象未找到` )\r\n\r\n return\r\n\r\n }\r\n\r\n const animationsValue = this.animationsData.get( id )\r\n\r\n if ( animationsValue ) {\r\n\r\n const animationValue = animationsValue[ animationIndex ]\r\n\r\n if ( animationValue ) {\r\n\r\n /**\r\n * keyframes\r\n */\r\n for ( let i = 0, len = animationValue.keyframes.length; i < len; i++ ) {\r\n\r\n let currentFrame: TAnimationsTweenProps\r\n\r\n if ( animationValue.keyframes[ i - 1 ] ) {\r\n\r\n const keyframe = animationValue.keyframes[ i - 1 ]\r\n\r\n currentFrame = {\r\n x: keyframe.x,\r\n y: keyframe.y,\r\n z: keyframe.z,\r\n rotationX: keyframe.rotationX,\r\n rotationY: keyframe.rotationY,\r\n rotationZ: keyframe.rotationZ,\r\n scaleX: keyframe.scaleX,\r\n scaleY: keyframe.scaleY,\r\n scaleZ: keyframe.scaleZ,\r\n }\r\n\r\n } else {\r\n\r\n const dummy = new THREE.Object3D(), matrix = new THREE.Matrix4().fromArray( object.userData.matrix )\r\n\r\n dummy.applyMatrix4( matrix )\r\n\r\n currentFrame = {\r\n x: dummy.position.x,\r\n y: dummy.position.y,\r\n z: dummy.position.z,\r\n rotationX: dummy.rotation.x,\r\n rotationY: dummy.rotation.y,\r\n rotationZ: dummy.rotation.z,\r\n scaleX: dummy.scale.x,\r\n scaleY: dummy.scale.y,\r\n scaleZ: dummy.scale.z,\r\n }\r\n\r\n }\r\n\r\n const keyframe = animationValue.keyframes[ i ]\r\n\r\n const { delay, duration, easing, repeat, yoyo, } = keyframe\r\n\r\n const nextFrame: TAnimationsTweenProps = {\r\n x: keyframe.x,\r\n y: keyframe.y,\r\n z: keyframe.z,\r\n rotationX: keyframe.rotationX,\r\n rotationY: keyframe.rotationY,\r\n rotationZ: keyframe.rotationZ,\r\n scaleX: keyframe.scaleX,\r\n scaleY: keyframe.scaleY,\r\n scaleZ: keyframe.scaleZ,\r\n }\r\n\r\n await animation(\r\n currentFrame,\r\n nextFrame,\r\n { delay, duration, mode: easing, repeat: repeat === -1 ? Infinity : repeat, yoyo, },\r\n ( source, tween ) => {\r\n\r\n object.position.set( source.x, source.y, source.z )\r\n object.rotation.set( source.rotationX, source.rotationY, source.rotationZ )\r\n object.scale.set( source.scaleX, source.scaleY, source.scaleZ )\r\n\r\n onUpdate?.( source, tween )\r\n\r\n },\r\n ( tween ) => {\r\n\r\n onStart?.( tween )\r\n\r\n }\r\n )\r\n\r\n }\r\n\r\n } else {\r\n\r\n error( `id: ${id} 未找到索引为 ${animationIndex} 的动画` )\r\n\r\n }\r\n\r\n } else {\r\n\r\n error( `id: ${id} 未找到动画` )\r\n\r\n }\r\n\r\n }\r\n\r\n}\r\n\r\n/**\r\n * 分组\r\n * @param list \r\n * @param key \r\n * @returns Map\r\n */\r\nfunction groupBy<T extends Record<string, any>, V> ( list: T[], key: keyof T ): Map<V, T[]> {\r\n\r\n const _map = new Map<V, T[]>()\r\n\r\n list.reduce( ( map, curr ) => {\r\n\r\n const propertiesValue = map.get( curr[ key ] )\r\n\r\n if ( propertiesValue ) {\r\n\r\n propertiesValue.push( curr )\r\n\r\n } else {\r\n\r\n map.set( curr[ key ], [ curr ] )\r\n\r\n }\r\n\r\n return map\r\n\r\n }, _map )\r\n\r\n return _map\r\n\r\n}\r\n\r\nexport * from './types'\r\nexport * from './constant'\r\n\r\nexport default Soonmanager2SyncPlugin\r\n"],"names":[],"mappings":"AAAA;;AAEG;AACI,MAAM,mBAAmB,GAAG,sBAAqB;AACxD;;AAEG;AACI,MAAM,SAAS,GAAG,WAAU;AACnC;;AAEG;AACI,MAAM,mBAAmB,GAAG,uBAAsB;AACzD;;AAEG;AACI,MAAM,uBAAuB,GAAG,0BAAyB;AAChE;;AAEG;AACI,MAAM,yBAAyB,GAAG,sBAAqB;AAC9D;;AAEG;AACI,MAAM,yBAAyB,GAAG,sBAAqB;AAC9D;;AAEG;AACI,MAAM,4BAA4B,GAAG,yBAAwB;AAEpE;;AAEG;AACI,MAAM,cAAc,GAAG;;ACiC9B,IAAK,YASJ,CAAA;AAT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E,GAAG,EAAE,IAAI,KAAK;QAE3B,MAAM,eAAe,GAAG,GAAG,CAAC,GAAG,CAAE,IAAI,CAAE,GAAG,CAAE,CAAE,CAAA;AAE9C,QAAA,IAAK,eAAe,EAAG;AAErB,YAAA,eAAe,CAAC,IAAI,CAAE,IAAI,CAAE,CAAA;AAE7B,SAAA;AAAM,aAAA;AAEL,YAAA,GAAG,CAAC,GAAG,CAAE,IAAI,CAAE,GAAG,CAAE,EAAE,CAAE,IAAI,CAAE,CAAE,CAAA;AAEjC,SAAA;AAED,QAAA,OAAO,GAAG,CAAA;KAEX,EAAE,IAAI,CAAE,CAAA;AAET,IAAA,OAAO,IAAI,CAAA;AAEb;;;;"}
|
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.7",
|
|
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": "550040550bf20ec0015982ff1159d0cfe9b35ed3",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"soonspacejs": "2.13.
|
|
18
|
+
"soonspacejs": "2.13.7"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/dist/constant.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
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/types.d.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
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 {};
|