@2112-lab/central-plant 0.3.38 → 0.3.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/dist/bundle/index.js +1096 -562
- package/dist/cjs/src/core/centralPlant.js +115 -68
- package/dist/cjs/src/core/centralPlantInternals.js +20 -36
- package/dist/cjs/src/index.js +23 -0
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +175 -234
- package/dist/cjs/src/managers/components/componentDataManager.js +63 -11
- package/dist/cjs/src/managers/scene/componentTooltipManager.js +95 -65
- package/dist/cjs/src/managers/scene/modelManager.js +93 -145
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +8 -3
- package/dist/cjs/src/utils/animationTransformUtils.js +82 -0
- package/dist/cjs/src/utils/behaviorDispatch.js +62 -0
- package/dist/cjs/src/utils/behaviorRegistration.js +76 -0
- package/dist/cjs/src/utils/behaviorSceneUtils.js +155 -0
- package/dist/cjs/src/utils/behaviorSchema.js +209 -0
- package/dist/esm/src/core/centralPlant.js +115 -68
- package/dist/esm/src/core/centralPlantInternals.js +21 -37
- package/dist/esm/src/index.js +5 -0
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +176 -235
- package/dist/esm/src/managers/components/componentDataManager.js +63 -11
- package/dist/esm/src/managers/scene/componentTooltipManager.js +95 -65
- package/dist/esm/src/managers/scene/modelManager.js +94 -146
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +8 -3
- package/dist/esm/src/utils/animationTransformUtils.js +56 -0
- package/dist/esm/src/utils/behaviorDispatch.js +56 -0
- package/dist/esm/src/utils/behaviorRegistration.js +71 -0
- package/dist/esm/src/utils/behaviorSceneUtils.js +147 -0
- package/dist/esm/src/utils/behaviorSchema.js +201 -0
- package/dist/index.d.ts +186 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
6
|
var THREE = require('three');
|
|
7
7
|
var ioDeviceUtils = require('../../utils/ioDeviceUtils.js');
|
|
8
|
+
var behaviorRegistration = require('../../utils/behaviorRegistration.js');
|
|
8
9
|
var modelPreloader = require('../../rendering/modelPreloader.js');
|
|
9
10
|
var boundingBoxUtils = require('../../utils/boundingBoxUtils.js');
|
|
10
11
|
var viewport2DManager = require('./viewport2DManager.js');
|
|
@@ -77,12 +78,12 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
77
78
|
key: "loadLibraryModel",
|
|
78
79
|
value: function () {
|
|
79
80
|
var _loadLibraryModel = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee(targetMesh, jsonEntry, componentData) {
|
|
80
|
-
var component, _jsonEntry$userData, _jsonEntry$userData2, _jsonEntry$userData3, originalProps, connectorChildren, gltfScene, libraryModel, _this$sceneViewer, ioBehavMgr,
|
|
81
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
82
|
-
while (1) switch (
|
|
81
|
+
var component, _jsonEntry$userData, _jsonEntry$userData2, _jsonEntry$userData3, originalProps, connectorChildren, gltfScene, libraryModel, _this$sceneViewer, ioBehavMgr, warmFn, _jsonEntry$userData4, _t;
|
|
82
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
83
|
+
while (1) switch (_context.n) {
|
|
83
84
|
case 0:
|
|
84
85
|
component = this.sceneViewer;
|
|
85
|
-
|
|
86
|
+
_context.p = 1;
|
|
86
87
|
console.log("Loading library GLB model for ".concat((_jsonEntry$userData = jsonEntry.userData) === null || _jsonEntry$userData === void 0 ? void 0 : _jsonEntry$userData.libraryId, "..."));
|
|
87
88
|
|
|
88
89
|
// Store original mesh properties before async operation
|
|
@@ -95,16 +96,16 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
95
96
|
uuid: targetMesh.uuid
|
|
96
97
|
}; // Preserve connector children (pass parent UUID for proper connector UUID generation)
|
|
97
98
|
connectorChildren = this._preserveConnectorChildren(targetMesh, originalProps.uuid); // Get model from cache or load directly
|
|
98
|
-
|
|
99
|
+
_context.n = 2;
|
|
99
100
|
return this._getLibraryModel(componentData.modelKey, (_jsonEntry$userData2 = jsonEntry.userData) === null || _jsonEntry$userData2 === void 0 ? void 0 : _jsonEntry$userData2.libraryId);
|
|
100
101
|
case 2:
|
|
101
|
-
gltfScene =
|
|
102
|
+
gltfScene = _context.v;
|
|
102
103
|
if (gltfScene) {
|
|
103
|
-
|
|
104
|
+
_context.n = 3;
|
|
104
105
|
break;
|
|
105
106
|
}
|
|
106
107
|
console.warn("\u26A0\uFE0F Could not load model ".concat(componentData.modelKey, ", keeping original mesh"));
|
|
107
|
-
return
|
|
108
|
+
return _context.a(2, targetMesh);
|
|
108
109
|
case 3:
|
|
109
110
|
// Configure the loaded model
|
|
110
111
|
libraryModel = this._configureLibraryModel(gltfScene, jsonEntry, componentData, originalProps); // Add preserved connectors
|
|
@@ -114,70 +115,17 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
114
115
|
|
|
115
116
|
// Attach IO devices for smart components (import flow)
|
|
116
117
|
if (!(componentData.isSmart && componentData.attachedDevices)) {
|
|
117
|
-
|
|
118
|
+
_context.n = 5;
|
|
118
119
|
break;
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
+
_context.n = 4;
|
|
121
122
|
return ioDeviceUtils.attachIODevicesToComponent(libraryModel, componentData, modelPreloader["default"], originalProps.uuid);
|
|
122
123
|
case 4:
|
|
123
|
-
// Register behavior configs for each attached device
|
|
124
124
|
ioBehavMgr = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.ioBehaviorManager;
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
break;
|
|
125
|
+
if (ioBehavMgr) {
|
|
126
|
+
behaviorRegistration.registerBehaviorsForComponent(ioBehavMgr, originalProps.uuid, componentData, libraryModel, modelPreloader["default"].componentDictionary);
|
|
128
127
|
}
|
|
129
|
-
_loop = /*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _loop() {
|
|
130
|
-
var _modelPreloader$compo, _deviceData$behaviorC;
|
|
131
|
-
var _Object$entries$_i, attachmentId, attachment, deviceData, deviceRoot;
|
|
132
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
133
|
-
while (1) switch (_context.n) {
|
|
134
|
-
case 0:
|
|
135
|
-
_Object$entries$_i = _rollupPluginBabelHelpers.slicedToArray(_Object$entries[_i], 2), attachmentId = _Object$entries$_i[0], attachment = _Object$entries$_i[1];
|
|
136
|
-
deviceData = (_modelPreloader$compo = modelPreloader["default"].componentDictionary) === null || _modelPreloader$compo === void 0 ? void 0 : _modelPreloader$compo[attachment.deviceId];
|
|
137
|
-
console.log("[ModelManager] attachment \"".concat(attachmentId, "\" \u2192 deviceId \"").concat(attachment.deviceId, "\" \u2192 behaviorConfig:"), (_deviceData$behaviorC = deviceData === null || deviceData === void 0 ? void 0 : deviceData.behaviorConfig) !== null && _deviceData$behaviorC !== void 0 ? _deviceData$behaviorC : 'NONE');
|
|
138
|
-
if (deviceData !== null && deviceData !== void 0 && deviceData.behaviorConfig) {
|
|
139
|
-
_context.n = 1;
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
return _context.a(2, 1);
|
|
143
|
-
case 1:
|
|
144
|
-
deviceRoot = null;
|
|
145
|
-
libraryModel.traverse(function (obj) {
|
|
146
|
-
var _obj$userData;
|
|
147
|
-
if (!deviceRoot && ((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.attachmentId) === attachmentId) deviceRoot = obj;
|
|
148
|
-
});
|
|
149
|
-
if (deviceRoot) {
|
|
150
|
-
ioBehavMgr.loadBehaviors(attachmentId, deviceData.behaviorConfig, deviceRoot, originalProps.uuid);
|
|
151
|
-
}
|
|
152
|
-
case 2:
|
|
153
|
-
return _context.a(2);
|
|
154
|
-
}
|
|
155
|
-
}, _loop);
|
|
156
|
-
});
|
|
157
|
-
_i = 0, _Object$entries = Object.entries(componentData.attachedDevices);
|
|
158
128
|
case 5:
|
|
159
|
-
if (!(_i < _Object$entries.length)) {
|
|
160
|
-
_context2.n = 8;
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
return _context2.d(_rollupPluginBabelHelpers.regeneratorValues(_loop()), 6);
|
|
164
|
-
case 6:
|
|
165
|
-
if (!_context2.v) {
|
|
166
|
-
_context2.n = 7;
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
return _context2.a(3, 7);
|
|
170
|
-
case 7:
|
|
171
|
-
_i++;
|
|
172
|
-
_context2.n = 5;
|
|
173
|
-
break;
|
|
174
|
-
case 8:
|
|
175
|
-
// Register component-level behaviors (intra-component io-device linking)
|
|
176
|
-
if (componentData.behaviors && componentData.behaviors.length > 0) {
|
|
177
|
-
console.log("[ModelManager] Registering ".concat(componentData.behaviors.length, " component-level behavior(s) for ").concat(originalProps.uuid));
|
|
178
|
-
ioBehavMgr.registerComponentBehaviors(originalProps.uuid, componentData.behaviors);
|
|
179
|
-
}
|
|
180
|
-
case 9:
|
|
181
129
|
// Replace mesh in scene
|
|
182
130
|
this._replaceMeshInScene(targetMesh, libraryModel, originalProps.parent, component);
|
|
183
131
|
|
|
@@ -195,14 +143,14 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
195
143
|
}
|
|
196
144
|
}
|
|
197
145
|
console.log("\uD83C\uDF89 ".concat((_jsonEntry$userData3 = jsonEntry.userData) === null || _jsonEntry$userData3 === void 0 ? void 0 : _jsonEntry$userData3.libraryId, " GLB model successfully rendered in scene"));
|
|
198
|
-
return
|
|
199
|
-
case
|
|
200
|
-
|
|
201
|
-
_t =
|
|
146
|
+
return _context.a(2, libraryModel);
|
|
147
|
+
case 6:
|
|
148
|
+
_context.p = 6;
|
|
149
|
+
_t = _context.v;
|
|
202
150
|
console.error("\u274C Error loading ".concat((_jsonEntry$userData4 = jsonEntry.userData) === null || _jsonEntry$userData4 === void 0 ? void 0 : _jsonEntry$userData4.libraryId, " GLB model:"), _t);
|
|
203
|
-
return
|
|
151
|
+
return _context.a(2, targetMesh);
|
|
204
152
|
}
|
|
205
|
-
}, _callee, this, [[1,
|
|
153
|
+
}, _callee, this, [[1, 6]]);
|
|
206
154
|
}));
|
|
207
155
|
function loadLibraryModel(_x, _x2, _x3) {
|
|
208
156
|
return _loadLibraryModel.apply(this, arguments);
|
|
@@ -281,84 +229,84 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
281
229
|
var _getLibraryModel2 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee2(modelKey, libraryId) {
|
|
282
230
|
var _this2 = this;
|
|
283
231
|
var gltfScene, preloaderStatus, modelPath, gltf, _t2, _t3, _t4;
|
|
284
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
285
|
-
while (1) switch (
|
|
232
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context2) {
|
|
233
|
+
while (1) switch (_context2.n) {
|
|
286
234
|
case 0:
|
|
287
235
|
// Try cache first
|
|
288
236
|
gltfScene = modelPreloader["default"].getCachedModelWithDimensions(modelKey, libraryId);
|
|
289
237
|
if (!gltfScene) {
|
|
290
|
-
|
|
238
|
+
_context2.n = 1;
|
|
291
239
|
break;
|
|
292
240
|
}
|
|
293
241
|
console.log("\uD83C\uDFAF GLB cache HIT: ".concat(modelKey));
|
|
294
|
-
return
|
|
242
|
+
return _context2.a(2, gltfScene);
|
|
295
243
|
case 1:
|
|
296
244
|
// Check if preloading is in progress
|
|
297
245
|
preloaderStatus = modelPreloader["default"].getStatus();
|
|
298
246
|
if (!preloaderStatus.isPreloading) {
|
|
299
|
-
|
|
247
|
+
_context2.n = 6;
|
|
300
248
|
break;
|
|
301
249
|
}
|
|
302
250
|
console.log("\u23F3 Waiting for preloader: ".concat(modelKey));
|
|
303
|
-
|
|
304
|
-
|
|
251
|
+
_context2.p = 2;
|
|
252
|
+
_context2.n = 3;
|
|
305
253
|
return modelPreloader["default"].preloadingPromise;
|
|
306
254
|
case 3:
|
|
307
255
|
gltfScene = modelPreloader["default"].getCachedModelWithDimensions(modelKey, libraryId);
|
|
308
256
|
if (!gltfScene) {
|
|
309
|
-
|
|
257
|
+
_context2.n = 4;
|
|
310
258
|
break;
|
|
311
259
|
}
|
|
312
260
|
console.log("\uD83C\uDFAF GLB cache HIT (after preload): ".concat(modelKey));
|
|
313
|
-
return
|
|
261
|
+
return _context2.a(2, gltfScene);
|
|
314
262
|
case 4:
|
|
315
|
-
|
|
263
|
+
_context2.n = 6;
|
|
316
264
|
break;
|
|
317
265
|
case 5:
|
|
318
|
-
|
|
319
|
-
_t2 =
|
|
266
|
+
_context2.p = 5;
|
|
267
|
+
_t2 = _context2.v;
|
|
320
268
|
console.warn("\u26A0\uFE0F Preloading failed:", _t2);
|
|
321
269
|
case 6:
|
|
322
|
-
|
|
270
|
+
_context2.p = 6;
|
|
323
271
|
if (!modelPreloader["default"].urlResolver) {
|
|
324
|
-
|
|
272
|
+
_context2.n = 11;
|
|
325
273
|
break;
|
|
326
274
|
}
|
|
327
|
-
|
|
328
|
-
|
|
275
|
+
_context2.p = 7;
|
|
276
|
+
_context2.n = 8;
|
|
329
277
|
return modelPreloader["default"].urlResolver(modelKey);
|
|
330
278
|
case 8:
|
|
331
|
-
modelPath =
|
|
279
|
+
modelPath = _context2.v;
|
|
332
280
|
console.log("\uD83D\uDD17 Resolved URL for ".concat(modelKey));
|
|
333
|
-
|
|
281
|
+
_context2.n = 10;
|
|
334
282
|
break;
|
|
335
283
|
case 9:
|
|
336
|
-
|
|
337
|
-
_t3 =
|
|
284
|
+
_context2.p = 9;
|
|
285
|
+
_t3 = _context2.v;
|
|
338
286
|
console.warn("\u26A0\uFE0F URL resolver failed for ".concat(modelKey, ", falling back to local path:"), _t3);
|
|
339
287
|
modelPath = "".concat(modelPreloader["default"].modelsBasePath).concat(modelKey);
|
|
340
288
|
case 10:
|
|
341
|
-
|
|
289
|
+
_context2.n = 12;
|
|
342
290
|
break;
|
|
343
291
|
case 11:
|
|
344
292
|
modelPath = "".concat(modelPreloader["default"].modelsBasePath).concat(modelKey);
|
|
345
293
|
case 12:
|
|
346
294
|
console.log("\uD83D\uDCC2 Fallback loading from: ".concat(modelPath));
|
|
347
|
-
|
|
295
|
+
_context2.n = 13;
|
|
348
296
|
return new Promise(function (resolve, reject) {
|
|
349
297
|
_this2.sceneViewer.gltfLoader.load(modelPath, resolve, undefined, reject);
|
|
350
298
|
});
|
|
351
299
|
case 13:
|
|
352
|
-
gltf =
|
|
300
|
+
gltf = _context2.v;
|
|
353
301
|
if (libraryId) {
|
|
354
302
|
modelPreloader["default"].cacheModel(modelKey, gltf.scene.clone(), libraryId);
|
|
355
303
|
}
|
|
356
|
-
return
|
|
304
|
+
return _context2.a(2, gltf.scene);
|
|
357
305
|
case 14:
|
|
358
|
-
|
|
359
|
-
_t4 =
|
|
306
|
+
_context2.p = 14;
|
|
307
|
+
_t4 = _context2.v;
|
|
360
308
|
console.error("Failed to load model ".concat(modelKey, ":"), _t4);
|
|
361
|
-
return
|
|
309
|
+
return _context2.a(2, null);
|
|
362
310
|
}
|
|
363
311
|
}, _callee2, null, [[7, 9], [6, 14], [2, 5]]);
|
|
364
312
|
}));
|
|
@@ -465,8 +413,8 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
465
413
|
value: (function () {
|
|
466
414
|
var _verifyModelPreloaderCache = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee3() {
|
|
467
415
|
var preloaderStatus, _t5;
|
|
468
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
469
|
-
while (1) switch (
|
|
416
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context3) {
|
|
417
|
+
while (1) switch (_context3.n) {
|
|
470
418
|
case 0:
|
|
471
419
|
console.log('🔍 Verifying model preloader cache state...');
|
|
472
420
|
preloaderStatus = modelPreloader["default"].getStatus();
|
|
@@ -474,23 +422,23 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
474
422
|
|
|
475
423
|
// If preloading is still in progress, wait for completion
|
|
476
424
|
if (!preloaderStatus.isPreloading) {
|
|
477
|
-
|
|
425
|
+
_context3.n = 4;
|
|
478
426
|
break;
|
|
479
427
|
}
|
|
480
428
|
console.log('⏳ Waiting for model preloading to complete...');
|
|
481
|
-
|
|
482
|
-
|
|
429
|
+
_context3.p = 1;
|
|
430
|
+
_context3.n = 2;
|
|
483
431
|
return modelPreloader["default"].preloadingPromise;
|
|
484
432
|
case 2:
|
|
485
433
|
console.log('✅ Model preloading completed');
|
|
486
|
-
|
|
434
|
+
_context3.n = 4;
|
|
487
435
|
break;
|
|
488
436
|
case 3:
|
|
489
|
-
|
|
490
|
-
_t5 =
|
|
437
|
+
_context3.p = 3;
|
|
438
|
+
_t5 = _context3.v;
|
|
491
439
|
console.warn('⚠️ Model preloading failed, some models may load directly:', _t5);
|
|
492
440
|
case 4:
|
|
493
|
-
return
|
|
441
|
+
return _context3.a(2, preloaderStatus);
|
|
494
442
|
}
|
|
495
443
|
}, _callee3, null, [[1, 3]]);
|
|
496
444
|
}));
|
|
@@ -508,11 +456,11 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
508
456
|
value: (function () {
|
|
509
457
|
var _preloadMissingModels = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee4(data, componentDictionary) {
|
|
510
458
|
var _data$scene, _data$scene2, requiredModels, preloaderStatus, cachedModels, missingModels, basePath, modelUrls, _iterator, _step, modelKey, _t6, _t7;
|
|
511
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
512
|
-
while (1) switch (
|
|
459
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context4) {
|
|
460
|
+
while (1) switch (_context4.n) {
|
|
513
461
|
case 0:
|
|
514
462
|
if (!(!data || !data.scene || !Array.isArray(data.scene.children))) {
|
|
515
|
-
|
|
463
|
+
_context4.n = 1;
|
|
516
464
|
break;
|
|
517
465
|
}
|
|
518
466
|
console.warn('⚠️ Invalid scene data structure in preloadMissingModels:', {
|
|
@@ -521,7 +469,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
521
469
|
hasChildren: !!(data !== null && data !== void 0 && (_data$scene = data.scene) !== null && _data$scene !== void 0 && _data$scene.children),
|
|
522
470
|
childrenType: data !== null && data !== void 0 && (_data$scene2 = data.scene) !== null && _data$scene2 !== void 0 && _data$scene2.children ? _rollupPluginBabelHelpers["typeof"](data.scene.children) : 'undefined'
|
|
523
471
|
});
|
|
524
|
-
return
|
|
472
|
+
return _context4.a(2);
|
|
525
473
|
case 1:
|
|
526
474
|
requiredModels = new Set();
|
|
527
475
|
console.log("\uD83D\uDD0D Checking ".concat(data.scene.children.length, " scene objects for required models..."));
|
|
@@ -543,10 +491,10 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
543
491
|
}
|
|
544
492
|
});
|
|
545
493
|
console.log('🔍 Required models for this scene (Set):', Array.from(requiredModels));
|
|
546
|
-
|
|
494
|
+
_context4.n = 2;
|
|
547
495
|
return this.verifyModelPreloaderCache();
|
|
548
496
|
case 2:
|
|
549
|
-
preloaderStatus =
|
|
497
|
+
preloaderStatus = _context4.v;
|
|
550
498
|
cachedModels = preloaderStatus.cachedModels;
|
|
551
499
|
console.log('ModelPreloader cached models:', cachedModels);
|
|
552
500
|
|
|
@@ -577,7 +525,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
577
525
|
});
|
|
578
526
|
}
|
|
579
527
|
if (!(missingModels.length > 0)) {
|
|
580
|
-
|
|
528
|
+
_context4.n = 12;
|
|
581
529
|
break;
|
|
582
530
|
}
|
|
583
531
|
console.warn('⚠️ Some required models are not cached:', missingModels);
|
|
@@ -585,41 +533,41 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
585
533
|
|
|
586
534
|
// Preload missing models (Main in-memory preloader)
|
|
587
535
|
_iterator = _rollupPluginBabelHelpers.createForOfIteratorHelper(missingModels);
|
|
588
|
-
|
|
536
|
+
_context4.p = 3;
|
|
589
537
|
_iterator.s();
|
|
590
538
|
case 4:
|
|
591
539
|
if ((_step = _iterator.n()).done) {
|
|
592
|
-
|
|
540
|
+
_context4.n = 9;
|
|
593
541
|
break;
|
|
594
542
|
}
|
|
595
543
|
modelKey = _step.value;
|
|
596
|
-
|
|
597
|
-
|
|
544
|
+
_context4.p = 5;
|
|
545
|
+
_context4.n = 6;
|
|
598
546
|
return modelPreloader["default"].preloadSingleModel(modelKey);
|
|
599
547
|
case 6:
|
|
600
548
|
console.log("\u2705 Successfully preloaded missing model: ".concat(modelKey));
|
|
601
|
-
|
|
549
|
+
_context4.n = 8;
|
|
602
550
|
break;
|
|
603
551
|
case 7:
|
|
604
|
-
|
|
605
|
-
_t6 =
|
|
552
|
+
_context4.p = 7;
|
|
553
|
+
_t6 = _context4.v;
|
|
606
554
|
console.warn("\u274C Failed to preload missing model ".concat(modelKey, ":"), _t6);
|
|
607
555
|
case 8:
|
|
608
|
-
|
|
556
|
+
_context4.n = 4;
|
|
609
557
|
break;
|
|
610
558
|
case 9:
|
|
611
|
-
|
|
559
|
+
_context4.n = 11;
|
|
612
560
|
break;
|
|
613
561
|
case 10:
|
|
614
|
-
|
|
615
|
-
_t7 =
|
|
562
|
+
_context4.p = 10;
|
|
563
|
+
_t7 = _context4.v;
|
|
616
564
|
_iterator.e(_t7);
|
|
617
565
|
case 11:
|
|
618
|
-
|
|
566
|
+
_context4.p = 11;
|
|
619
567
|
_iterator.f();
|
|
620
|
-
return
|
|
568
|
+
return _context4.f(11);
|
|
621
569
|
case 12:
|
|
622
|
-
return
|
|
570
|
+
return _context4.a(2);
|
|
623
571
|
}
|
|
624
572
|
}, _callee4, this, [[5, 7], [3, 10, 11, 12]]);
|
|
625
573
|
}));
|
|
@@ -638,14 +586,14 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
638
586
|
var _replaceWithGLBModels = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee5(libraryObjectsToReplace) {
|
|
639
587
|
var _this3 = this;
|
|
640
588
|
var startTime, glbLoadingPromises;
|
|
641
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
642
|
-
while (1) switch (
|
|
589
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context5) {
|
|
590
|
+
while (1) switch (_context5.n) {
|
|
643
591
|
case 0:
|
|
644
592
|
if (!(libraryObjectsToReplace.length === 0)) {
|
|
645
|
-
|
|
593
|
+
_context5.n = 1;
|
|
646
594
|
break;
|
|
647
595
|
}
|
|
648
|
-
return
|
|
596
|
+
return _context5.a(2);
|
|
649
597
|
case 1:
|
|
650
598
|
startTime = performance.now();
|
|
651
599
|
console.log("\uD83D\uDD04 Replacing ".concat(libraryObjectsToReplace.length, " objects with GLB models..."));
|
|
@@ -665,7 +613,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
665
613
|
return basicObject;
|
|
666
614
|
});
|
|
667
615
|
});
|
|
668
|
-
|
|
616
|
+
_context5.n = 2;
|
|
669
617
|
return Promise.all(glbLoadingPromises);
|
|
670
618
|
case 2:
|
|
671
619
|
console.log("\u23F1\uFE0F All GLB models loaded in ".concat((performance.now() - startTime).toFixed(0), "ms"));
|
|
@@ -708,7 +656,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
708
656
|
}));
|
|
709
657
|
}
|
|
710
658
|
case 3:
|
|
711
|
-
return
|
|
659
|
+
return _context5.a(2);
|
|
712
660
|
}
|
|
713
661
|
}, _callee5);
|
|
714
662
|
}));
|
|
@@ -743,26 +691,26 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
743
691
|
value: (function () {
|
|
744
692
|
var _loadComponentDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee6() {
|
|
745
693
|
var response, dict, _t8;
|
|
746
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
747
|
-
while (1) switch (
|
|
694
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context6) {
|
|
695
|
+
while (1) switch (_context6.n) {
|
|
748
696
|
case 0:
|
|
749
|
-
|
|
697
|
+
_context6.p = 0;
|
|
750
698
|
console.log('🔄 ModelManager loading component dictionary...');
|
|
751
|
-
|
|
699
|
+
_context6.n = 1;
|
|
752
700
|
return fetch('/library/component-dictionary.json');
|
|
753
701
|
case 1:
|
|
754
|
-
response =
|
|
755
|
-
|
|
702
|
+
response = _context6.v;
|
|
703
|
+
_context6.n = 2;
|
|
756
704
|
return response.json();
|
|
757
705
|
case 2:
|
|
758
|
-
dict =
|
|
706
|
+
dict = _context6.v;
|
|
759
707
|
console.log('✅ ModelManager loaded dictionary:', Object.keys(dict).length, 'entries');
|
|
760
|
-
return
|
|
708
|
+
return _context6.a(2, dict);
|
|
761
709
|
case 3:
|
|
762
|
-
|
|
763
|
-
_t8 =
|
|
710
|
+
_context6.p = 3;
|
|
711
|
+
_t8 = _context6.v;
|
|
764
712
|
console.warn('⚠️ Could not load component dictionary:', _t8);
|
|
765
|
-
return
|
|
713
|
+
return _context6.a(2, {});
|
|
766
714
|
}
|
|
767
715
|
}, _callee6, null, [[0, 3]]);
|
|
768
716
|
}));
|
|
@@ -114,10 +114,15 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
114
114
|
key: "clearSceneObjects",
|
|
115
115
|
value: function () {
|
|
116
116
|
var _clearSceneObjects = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee() {
|
|
117
|
-
var
|
|
117
|
+
var _this$sceneViewer;
|
|
118
|
+
var ioBehavMgr, result;
|
|
118
119
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
119
120
|
while (1) switch (_context.n) {
|
|
120
121
|
case 0:
|
|
122
|
+
ioBehavMgr = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.ioBehaviorManager;
|
|
123
|
+
if (ioBehavMgr !== null && ioBehavMgr !== void 0 && ioBehavMgr.resetForScene) {
|
|
124
|
+
ioBehavMgr.resetForScene();
|
|
125
|
+
}
|
|
121
126
|
_context.n = 1;
|
|
122
127
|
return this.sceneClearingUtility.clearAllObjects();
|
|
123
128
|
case 1:
|
|
@@ -483,9 +488,9 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
483
488
|
// Use crosscubeTextureSet if available, otherwise fallback material
|
|
484
489
|
var material = materials[obj.material];
|
|
485
490
|
if (!material) {
|
|
486
|
-
var _this$
|
|
491
|
+
var _this$sceneViewer2;
|
|
487
492
|
// Check if we have crosscubeTextureSet from scene loading
|
|
488
|
-
var crosscubeTextureSet = (_this$
|
|
493
|
+
var crosscubeTextureSet = (_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.crosscubeTextureSet;
|
|
489
494
|
if (crosscubeTextureSet) {
|
|
490
495
|
// Match PathfindingManager.createPipeMaterial() with textures
|
|
491
496
|
var pathColor = '#245e29'; // Default green color from PathfindingManager.getPathColor()
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var THREE = require('three');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Translation helpers for I/O device animations.
|
|
29
|
+
* Offsets are expressed in the device/model root's local space so every child
|
|
30
|
+
* mesh moves along the same predictable axes regardless of intermediate parents.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {THREE.Object3D} modelRoot
|
|
35
|
+
* @param {{ x?: number, y?: number, z?: number }|THREE.Vector3} offset
|
|
36
|
+
* @returns {THREE.Vector3}
|
|
37
|
+
*/
|
|
38
|
+
function modelOffsetToWorldDelta(modelRoot, offset) {
|
|
39
|
+
var _offset$x, _offset$y, _offset$z;
|
|
40
|
+
var v = offset instanceof THREE__namespace.Vector3 ? offset.clone() : new THREE__namespace.Vector3((_offset$x = offset === null || offset === void 0 ? void 0 : offset.x) !== null && _offset$x !== void 0 ? _offset$x : 0, (_offset$y = offset === null || offset === void 0 ? void 0 : offset.y) !== null && _offset$y !== void 0 ? _offset$y : 0, (_offset$z = offset === null || offset === void 0 ? void 0 : offset.z) !== null && _offset$z !== void 0 ? _offset$z : 0);
|
|
41
|
+
var q = new THREE__namespace.Quaternion();
|
|
42
|
+
modelRoot.getWorldQuaternion(q);
|
|
43
|
+
return v.applyQuaternion(q);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Apply a model-root-space translation from a mesh's rest local pose.
|
|
48
|
+
*
|
|
49
|
+
* @param {THREE.Object3D} mesh
|
|
50
|
+
* @param {THREE.Object3D} modelRoot
|
|
51
|
+
* @param {THREE.Vector3} origLocalPos
|
|
52
|
+
* @param {{ x?: number, y?: number, z?: number }} modelOffset
|
|
53
|
+
*/
|
|
54
|
+
function applyModelRootTranslation(mesh, modelRoot, origLocalPos, modelOffset) {
|
|
55
|
+
if (!mesh || !modelRoot || !origLocalPos) return;
|
|
56
|
+
mesh.position.copy(origLocalPos);
|
|
57
|
+
mesh.updateMatrixWorld(true);
|
|
58
|
+
var origWorldPos = new THREE__namespace.Vector3();
|
|
59
|
+
mesh.getWorldPosition(origWorldPos);
|
|
60
|
+
var newWorldPos = origWorldPos.add(modelOffsetToWorldDelta(modelRoot, modelOffset));
|
|
61
|
+
if (mesh.parent) mesh.parent.worldToLocal(newWorldPos);
|
|
62
|
+
mesh.position.copy(newWorldPos);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Apply a model-root-space translation from a cached rest world position (preview).
|
|
67
|
+
*
|
|
68
|
+
* @param {THREE.Object3D} mesh
|
|
69
|
+
* @param {THREE.Object3D} modelRoot
|
|
70
|
+
* @param {THREE.Vector3} baseWorldPos
|
|
71
|
+
* @param {{ x?: number, y?: number, z?: number }} modelOffset
|
|
72
|
+
*/
|
|
73
|
+
function applyModelRootTranslationFromWorldBase(mesh, modelRoot, baseWorldPos, modelOffset) {
|
|
74
|
+
if (!mesh || !modelRoot || !baseWorldPos) return;
|
|
75
|
+
var newWorldPos = baseWorldPos.clone().add(modelOffsetToWorldDelta(modelRoot, modelOffset));
|
|
76
|
+
if (mesh.parent) mesh.parent.worldToLocal(newWorldPos);
|
|
77
|
+
mesh.position.copy(newWorldPos);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
exports.applyModelRootTranslation = applyModelRootTranslation;
|
|
81
|
+
exports.applyModelRootTranslationFromWorldBase = applyModelRootTranslationFromWorldBase;
|
|
82
|
+
exports.modelOffsetToWorldDelta = modelOffsetToWorldDelta;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared I/O device state dispatch helpers used by centralPlant and componentTooltipManager.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} attachmentId
|
|
11
|
+
* @param {string|null|undefined} parentUuid
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
function getScopedAttachmentKey(attachmentId, parentUuid) {
|
|
15
|
+
if (!parentUuid) return attachmentId;
|
|
16
|
+
return "".concat(parentUuid, "::").concat(attachmentId);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {Object} sceneViewer
|
|
21
|
+
* @returns {import('../managers/behaviors/IoBehaviorManager.js').IoBehaviorManager|null}
|
|
22
|
+
*/
|
|
23
|
+
function getIoBehaviorManager(sceneViewer) {
|
|
24
|
+
var _sceneViewer$managers, _sceneViewer$centralP;
|
|
25
|
+
if (!sceneViewer) return null;
|
|
26
|
+
return ((_sceneViewer$managers = sceneViewer.managers) === null || _sceneViewer$managers === void 0 ? void 0 : _sceneViewer$managers.ioBehaviorManager) || sceneViewer.ioBehaviorManager || ((_sceneViewer$centralP = sceneViewer.centralPlant) === null || _sceneViewer$centralP === void 0 || (_sceneViewer$centralP = _sceneViewer$centralP.managers) === null || _sceneViewer$centralP === void 0 ? void 0 : _sceneViewer$centralP.ioBehaviorManager) || null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Resolve tooltip/drag data points for an I/O device attachment.
|
|
31
|
+
* Prefers behaviorConfig-driven animation data points; merges legacy ioConfig snapshot.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} parentUuid
|
|
34
|
+
* @param {string} attachmentId
|
|
35
|
+
* @param {Object} userData - io-device userData (may include dataPoints snapshot)
|
|
36
|
+
* @param {import('../managers/behaviors/IoBehaviorManager.js').IoBehaviorManager|null} ioBehaviorManager
|
|
37
|
+
* @param {THREE.Object3D|null} [hitMesh]
|
|
38
|
+
* @returns {Object[]}
|
|
39
|
+
*/
|
|
40
|
+
function resolveDataPoints(parentUuid, attachmentId, userData, ioBehaviorManager) {
|
|
41
|
+
var hitMesh = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
42
|
+
var fromAnimations = (ioBehaviorManager === null || ioBehaviorManager === void 0 ? void 0 : ioBehaviorManager.getAnimationDataPoints(parentUuid, attachmentId, hitMesh)) || [];
|
|
43
|
+
if (fromAnimations.length) return fromAnimations;
|
|
44
|
+
var legacy = (userData === null || userData === void 0 ? void 0 : userData.dataPoints) || [];
|
|
45
|
+
return legacy.map(function (dp) {
|
|
46
|
+
var _dp$defaultValue;
|
|
47
|
+
return {
|
|
48
|
+
id: dp.id || dp.name,
|
|
49
|
+
name: dp.name || dp.id,
|
|
50
|
+
stateType: dp.stateType || 'binary',
|
|
51
|
+
stateConfig: dp.stateConfig || {},
|
|
52
|
+
defaultValue: (_dp$defaultValue = dp.defaultValue) !== null && _dp$defaultValue !== void 0 ? _dp$defaultValue : null,
|
|
53
|
+
direction: dp.direction || (userData === null || userData === void 0 ? void 0 : userData.ioDirection) || 'output'
|
|
54
|
+
};
|
|
55
|
+
}).filter(function (dp) {
|
|
56
|
+
return dp.id;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
exports.getIoBehaviorManager = getIoBehaviorManager;
|
|
61
|
+
exports.getScopedAttachmentKey = getScopedAttachmentKey;
|
|
62
|
+
exports.resolveDataPoints = resolveDataPoints;
|