@2112-lab/central-plant 0.3.34 → 0.3.36
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 +632 -170
- package/dist/cjs/src/core/centralPlant.js +41 -17
- package/dist/cjs/src/core/centralPlantInternals.js +6 -2
- package/dist/cjs/src/core/sceneViewer.js +6 -24
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +510 -44
- package/dist/cjs/src/managers/cache/S3CacheService.js +2 -33
- package/dist/cjs/src/managers/cache/S3MetadataCacheService.js +0 -1
- package/dist/cjs/src/managers/components/componentDataManager.js +2 -6
- package/dist/cjs/src/managers/controls/transformControlsManager.js +32 -10
- package/dist/cjs/src/managers/scene/modelManager.js +11 -5
- package/dist/cjs/src/managers/scene/sceneExportManager.js +10 -3
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +11 -3
- package/dist/cjs/src/rendering/modelPreloader.js +1 -17
- package/dist/cjs/src/utils/ioDeviceUtils.js +0 -5
- package/dist/esm/src/core/centralPlant.js +41 -17
- package/dist/esm/src/core/centralPlantInternals.js +6 -2
- package/dist/esm/src/core/sceneViewer.js +6 -24
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +511 -45
- package/dist/esm/src/managers/cache/S3CacheService.js +2 -33
- package/dist/esm/src/managers/cache/S3MetadataCacheService.js +0 -1
- package/dist/esm/src/managers/components/componentDataManager.js +2 -6
- package/dist/esm/src/managers/controls/transformControlsManager.js +32 -10
- package/dist/esm/src/managers/scene/modelManager.js +11 -5
- package/dist/esm/src/managers/scene/sceneExportManager.js +10 -3
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +11 -3
- package/dist/esm/src/rendering/modelPreloader.js +1 -17
- package/dist/esm/src/utils/ioDeviceUtils.js +0 -5
- package/package.json +1 -1
|
@@ -766,7 +766,6 @@ function _findInAllCachePartitions() {
|
|
|
766
766
|
_context16.n = 7;
|
|
767
767
|
break;
|
|
768
768
|
}
|
|
769
|
-
console.log("\u2705 [findInAllCachePartitions] Found in ".concat(cacheName, " (exact match): ").concat(cacheKey.substring(0, 80), "..."));
|
|
770
769
|
return _context16.a(2, response);
|
|
771
770
|
case 7:
|
|
772
771
|
if (!(encodedCacheKey !== cacheKey)) {
|
|
@@ -781,7 +780,6 @@ function _findInAllCachePartitions() {
|
|
|
781
780
|
_context16.n = 9;
|
|
782
781
|
break;
|
|
783
782
|
}
|
|
784
|
-
console.log("\u2705 [findInAllCachePartitions] Found in ".concat(cacheName, " (encoded match): ").concat(encodedCacheKey.substring(0, 80), "..."));
|
|
785
783
|
return _context16.a(2, response);
|
|
786
784
|
case 9:
|
|
787
785
|
_context16.n = 4;
|
|
@@ -816,8 +814,6 @@ function _getCachedS3Object() {
|
|
|
816
814
|
cachedResponse,
|
|
817
815
|
cachedTime,
|
|
818
816
|
age,
|
|
819
|
-
_allKeys,
|
|
820
|
-
matchingKeys,
|
|
821
817
|
_args19 = arguments;
|
|
822
818
|
return _regenerator().w(function (_context19) {
|
|
823
819
|
while (1) switch (_context19.n) {
|
|
@@ -825,50 +821,26 @@ function _getCachedS3Object() {
|
|
|
825
821
|
storageOptions = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
826
822
|
expiryMs = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : null;
|
|
827
823
|
cacheKey = "https://s3.cache/".concat(s3Key);
|
|
828
|
-
expiry = expiryMs || cacheManager.getExpiryForPath(s3Key);
|
|
829
|
-
console.log("\uD83D\uDD0D [S3Cache] Checking for cached S3 object:", {
|
|
830
|
-
s3Key: s3Key,
|
|
831
|
-
cacheKey: cacheKey
|
|
832
|
-
});
|
|
833
|
-
|
|
834
|
-
// First, check ALL app cache partitions for a hit (handles auth race condition)
|
|
824
|
+
expiry = expiryMs || cacheManager.getExpiryForPath(s3Key); // First, check ALL app cache partitions for a hit (handles auth race condition)
|
|
835
825
|
_context19.n = 1;
|
|
836
826
|
return findInAllCachePartitions(cacheKey);
|
|
837
827
|
case 1:
|
|
838
828
|
cachedResponse = _context19.v;
|
|
839
829
|
if (!cachedResponse) {
|
|
840
|
-
_context19.n =
|
|
830
|
+
_context19.n = 3;
|
|
841
831
|
break;
|
|
842
832
|
}
|
|
843
833
|
cachedTime = cachedResponse.headers.get('x-cached-time');
|
|
844
834
|
age = Date.now() - parseInt(cachedTime || '0');
|
|
845
|
-
console.log("\u2705 [S3Cache] Found in cache partition, age: ".concat(Math.round(age / 1000), "s, expiry: ").concat(Math.round(expiry / 1000), "s"));
|
|
846
835
|
if (!(age < expiry)) {
|
|
847
836
|
_context19.n = 3;
|
|
848
837
|
break;
|
|
849
838
|
}
|
|
850
|
-
console.log("\u2705 [S3Cache] Returning cached blob for: ".concat(s3Key));
|
|
851
839
|
_context19.n = 2;
|
|
852
840
|
return cachedResponse.blob();
|
|
853
841
|
case 2:
|
|
854
842
|
return _context19.a(2, _context19.v);
|
|
855
843
|
case 3:
|
|
856
|
-
console.log("\u23F0 [S3Cache] Cache entry expired, will re-fetch");
|
|
857
|
-
_context19.n = 6;
|
|
858
|
-
break;
|
|
859
|
-
case 4:
|
|
860
|
-
console.log("\u274C [S3Cache] Not found in any cache partition");
|
|
861
|
-
_context19.n = 5;
|
|
862
|
-
return getAllCacheKeys();
|
|
863
|
-
case 5:
|
|
864
|
-
_allKeys = _context19.v;
|
|
865
|
-
matchingKeys = _toConsumableArray(_allKeys).filter(function (k) {
|
|
866
|
-
return k.includes('24dd6a7a') || k.includes('.glb');
|
|
867
|
-
});
|
|
868
|
-
if (matchingKeys.length > 0) {
|
|
869
|
-
console.log("\uD83D\uDD0D [S3Cache] Available GLB cache keys:", matchingKeys.slice(0, 5));
|
|
870
|
-
}
|
|
871
|
-
case 6:
|
|
872
844
|
return _context19.a(2, cacheManager.execute({
|
|
873
845
|
cacheKey: cacheKey,
|
|
874
846
|
sourceKey: s3Key,
|
|
@@ -1027,7 +999,6 @@ function _preloadS3Objects() {
|
|
|
1027
999
|
};
|
|
1028
1000
|
}()));
|
|
1029
1001
|
case 1:
|
|
1030
|
-
console.log("\u2705 Preload complete: ".concat(results.success, " success, ").concat(results.failed, " failed"));
|
|
1031
1002
|
return _context22.a(2, results);
|
|
1032
1003
|
}
|
|
1033
1004
|
}, _callee22);
|
|
@@ -1205,7 +1176,6 @@ function _preloadLocalFiles() {
|
|
|
1205
1176
|
return _regenerator().w(function (_context29) {
|
|
1206
1177
|
while (1) switch (_context29.n) {
|
|
1207
1178
|
case 0:
|
|
1208
|
-
console.log("preloadLocalFiles started");
|
|
1209
1179
|
results = {
|
|
1210
1180
|
success: 0,
|
|
1211
1181
|
failed: 0,
|
|
@@ -1244,7 +1214,6 @@ function _preloadLocalFiles() {
|
|
|
1244
1214
|
};
|
|
1245
1215
|
}()));
|
|
1246
1216
|
case 1:
|
|
1247
|
-
console.log("preloadLocalFiles finished");
|
|
1248
1217
|
if (results.failed > 0) {
|
|
1249
1218
|
console.warn("\u26A0\uFE0F preloadLocalFiles Cache priming finished with errors: ".concat(results.failed, " failed"), results.errors);
|
|
1250
1219
|
}
|
|
@@ -469,7 +469,6 @@ var S3MetadataCacheService = /*#__PURE__*/function () {
|
|
|
469
469
|
// Update memory cache
|
|
470
470
|
this._memoryCache = metadata;
|
|
471
471
|
this._memoryCacheTime = Date.now();
|
|
472
|
-
console.log("\uD83D\uDCBE S3MetadataCacheService: Set ".concat(components.length, " components"));
|
|
473
472
|
return _context9.a(2, true);
|
|
474
473
|
case 4:
|
|
475
474
|
_context9.p = 4;
|
|
@@ -320,7 +320,7 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
320
320
|
value: (function () {
|
|
321
321
|
var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(additionalComponents) {
|
|
322
322
|
var _this3 = this;
|
|
323
|
-
var _this$sceneViewer, newComponents,
|
|
323
|
+
var _this$sceneViewer, newComponents, modelPreloader, _t;
|
|
324
324
|
return _regenerator().w(function (_context3) {
|
|
325
325
|
while (1) switch (_context3.n) {
|
|
326
326
|
case 0:
|
|
@@ -344,7 +344,6 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
344
344
|
_context3.p = 3;
|
|
345
345
|
// Filter out components that already exist in the dictionary (deduplication)
|
|
346
346
|
newComponents = {};
|
|
347
|
-
skippedCount = 0;
|
|
348
347
|
Object.entries(additionalComponents).forEach(function (_ref3) {
|
|
349
348
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
350
349
|
key = _ref4[0],
|
|
@@ -352,13 +351,12 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
352
351
|
if (!_this3.componentDictionary[key]) {
|
|
353
352
|
newComponents[key] = component;
|
|
354
353
|
} else {
|
|
355
|
-
skippedCount++;
|
|
356
354
|
console.log("\u26A0\uFE0F Skipping duplicate component: ".concat(key, " (").concat(component.name || 'unnamed', ")"));
|
|
357
355
|
}
|
|
358
356
|
});
|
|
359
357
|
|
|
360
358
|
// Merge only new components into dictionary
|
|
361
|
-
|
|
359
|
+
Object.keys(newComponents).length;
|
|
362
360
|
Object.assign(this.componentDictionary, newComponents);
|
|
363
361
|
|
|
364
362
|
// Update ModelPreloader's dictionary reference
|
|
@@ -366,12 +364,10 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
366
364
|
modelPreloader = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.centralPlant) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.utilities) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.modelPreloader;
|
|
367
365
|
if (modelPreloader) {
|
|
368
366
|
modelPreloader.componentDictionary = this.componentDictionary;
|
|
369
|
-
console.log("\uD83D\uDD04 Updated ModelPreloader's dictionary reference (".concat(Object.keys(this.componentDictionary).length, " total components)"));
|
|
370
367
|
}
|
|
371
368
|
|
|
372
369
|
// Clear cache to force refresh
|
|
373
370
|
this.clearCache();
|
|
374
|
-
console.log("\u2705 extendComponentDictionary(): Added ".concat(addedCount, " new components (").concat(skippedCount, " duplicates skipped)"));
|
|
375
371
|
return _context3.a(2, true);
|
|
376
372
|
case 4:
|
|
377
373
|
_context3.p = 4;
|
|
@@ -439,6 +439,7 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
439
439
|
// Detect pointerdown on an IO device mesh and convert a drag gesture into
|
|
440
440
|
// state changes. Up/right = positive direction, down/left = negative.
|
|
441
441
|
this.eventHandlers.pointerdown = function (event) {
|
|
442
|
+
var _ioDeviceObject$userD, _this4$sceneViewer;
|
|
442
443
|
if (_this4.transformState.isTransforming) return;
|
|
443
444
|
if (!_this4.callbacks.onIODeviceDrag) return;
|
|
444
445
|
_this4._calculateMousePosition(event, mouse);
|
|
@@ -451,14 +452,14 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
451
452
|
try {
|
|
452
453
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
453
454
|
var hit = _step.value;
|
|
454
|
-
var
|
|
455
|
-
while (
|
|
456
|
-
var _obj$
|
|
457
|
-
if (((_obj$
|
|
458
|
-
ioDeviceObject =
|
|
455
|
+
var _obj = hit.object;
|
|
456
|
+
while (_obj) {
|
|
457
|
+
var _obj$userData2;
|
|
458
|
+
if (((_obj$userData2 = _obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.objectType) === 'io-device') {
|
|
459
|
+
ioDeviceObject = _obj;
|
|
459
460
|
break;
|
|
460
461
|
}
|
|
461
|
-
|
|
462
|
+
_obj = _obj.parent;
|
|
462
463
|
}
|
|
463
464
|
if (ioDeviceObject) {
|
|
464
465
|
hitMesh = hit.object;
|
|
@@ -472,6 +473,27 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
472
473
|
}
|
|
473
474
|
if (!ioDeviceObject) return;
|
|
474
475
|
|
|
476
|
+
// Only allow drag if the clicked mesh is animated (not the parent io-device group)
|
|
477
|
+
// Resolve parentUuid and attachmentId
|
|
478
|
+
var parentUuid = null;
|
|
479
|
+
var obj = ioDeviceObject.parent;
|
|
480
|
+
while (obj) {
|
|
481
|
+
var _obj$userData;
|
|
482
|
+
if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'component') {
|
|
483
|
+
parentUuid = obj.userData.originalUuid || obj.uuid;
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
obj = obj.parent;
|
|
487
|
+
}
|
|
488
|
+
var attachmentId = (_ioDeviceObject$userD = ioDeviceObject.userData) === null || _ioDeviceObject$userD === void 0 ? void 0 : _ioDeviceObject$userD.attachmentId;
|
|
489
|
+
if (parentUuid && attachmentId && (_this4$sceneViewer = _this4.sceneViewer) !== null && _this4$sceneViewer !== void 0 && (_this4$sceneViewer = _this4$sceneViewer.managers) !== null && _this4$sceneViewer !== void 0 && _this4$sceneViewer.ioBehaviorManager) {
|
|
490
|
+
var animatedMeshes = _this4.sceneViewer.managers.ioBehaviorManager.getAnimatedMeshes(parentUuid, attachmentId);
|
|
491
|
+
// If there are animated meshes registered, only allow drag if hitMesh is one of them
|
|
492
|
+
if (animatedMeshes.length > 0 && !animatedMeshes.includes(hitMesh)) {
|
|
493
|
+
return; // Clicked on non-draggable part of the io-device
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
475
497
|
// Begin session
|
|
476
498
|
_this4._ioDragMesh = ioDeviceObject;
|
|
477
499
|
_this4._ioDragStartX = event.clientX;
|
|
@@ -534,8 +556,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
534
556
|
var hit = _step2.value;
|
|
535
557
|
var obj = hit.object;
|
|
536
558
|
while (obj) {
|
|
537
|
-
var _obj$
|
|
538
|
-
if (((_obj$
|
|
559
|
+
var _obj$userData3;
|
|
560
|
+
if (((_obj$userData3 = obj.userData) === null || _obj$userData3 === void 0 ? void 0 : _obj$userData3.objectType) === 'io-device') {
|
|
539
561
|
_this4.callbacks.onIODeviceClick(obj);
|
|
540
562
|
return;
|
|
541
563
|
}
|
|
@@ -2195,8 +2217,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
2195
2217
|
key: "_updateSegmentReference",
|
|
2196
2218
|
value: function _updateSegmentReference(oldSegment, newSegment, index) {
|
|
2197
2219
|
var selectedIndex = this.selectedObjects.findIndex(function (obj) {
|
|
2198
|
-
var _obj$
|
|
2199
|
-
return obj.uuid === oldSegment.uuid || ((_obj$
|
|
2220
|
+
var _obj$userData4;
|
|
2221
|
+
return obj.uuid === oldSegment.uuid || ((_obj$userData4 = obj.userData) === null || _obj$userData4 === void 0 ? void 0 : _obj$userData4.originalUuid) === oldSegment.uuid;
|
|
2200
2222
|
});
|
|
2201
2223
|
if (selectedIndex !== -1 && newSegment) {
|
|
2202
2224
|
// Clear bounding box cache
|
|
@@ -90,7 +90,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
90
90
|
|
|
91
91
|
// Attach IO devices for smart components (import flow)
|
|
92
92
|
if (!(componentData.isSmart && componentData.attachedDevices)) {
|
|
93
|
-
_context2.n =
|
|
93
|
+
_context2.n = 9;
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
96
|
_context2.n = 4;
|
|
@@ -99,7 +99,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
99
99
|
// Register behavior configs for each attached device
|
|
100
100
|
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;
|
|
101
101
|
if (!ioBehavMgr) {
|
|
102
|
-
_context2.n =
|
|
102
|
+
_context2.n = 9;
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
@@ -148,6 +148,12 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
148
148
|
_context2.n = 5;
|
|
149
149
|
break;
|
|
150
150
|
case 8:
|
|
151
|
+
// Register component-level behaviors (intra-component io-device linking)
|
|
152
|
+
if (componentData.behaviors && componentData.behaviors.length > 0) {
|
|
153
|
+
console.log("[ModelManager] Registering ".concat(componentData.behaviors.length, " component-level behavior(s) for ").concat(originalProps.uuid));
|
|
154
|
+
ioBehavMgr.registerComponentBehaviors(originalProps.uuid, componentData.behaviors);
|
|
155
|
+
}
|
|
156
|
+
case 9:
|
|
151
157
|
// Replace mesh in scene
|
|
152
158
|
this._replaceMeshInScene(targetMesh, libraryModel, originalProps.parent, component);
|
|
153
159
|
|
|
@@ -166,13 +172,13 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
166
172
|
}
|
|
167
173
|
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"));
|
|
168
174
|
return _context2.a(2, libraryModel);
|
|
169
|
-
case
|
|
170
|
-
_context2.p =
|
|
175
|
+
case 10:
|
|
176
|
+
_context2.p = 10;
|
|
171
177
|
_t = _context2.v;
|
|
172
178
|
console.error("\u274C Error loading ".concat((_jsonEntry$userData4 = jsonEntry.userData) === null || _jsonEntry$userData4 === void 0 ? void 0 : _jsonEntry$userData4.libraryId, " GLB model:"), _t);
|
|
173
179
|
return _context2.a(2, targetMesh);
|
|
174
180
|
}
|
|
175
|
-
}, _callee, this, [[1,
|
|
181
|
+
}, _callee, this, [[1, 10]]);
|
|
176
182
|
}));
|
|
177
183
|
function loadLibraryModel(_x, _x2, _x3) {
|
|
178
184
|
return _loadLibraryModel.apply(this, arguments);
|
|
@@ -55,7 +55,8 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
55
55
|
}, {
|
|
56
56
|
key: "exportSceneData",
|
|
57
57
|
value: function exportSceneData() {
|
|
58
|
-
var _this = this
|
|
58
|
+
var _this = this,
|
|
59
|
+
_this$sceneViewer$cur2;
|
|
59
60
|
console.log('📤 Starting scene export...');
|
|
60
61
|
if (!this.sceneViewer.scene) {
|
|
61
62
|
console.warn('⚠️ No scene available for export');
|
|
@@ -267,6 +268,12 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
267
268
|
children: sceneChildren
|
|
268
269
|
}
|
|
269
270
|
};
|
|
271
|
+
|
|
272
|
+
// Preserve cross-component behaviors authored in the Behavior window
|
|
273
|
+
var sceneBehaviors = (_this$sceneViewer$cur2 = this.sceneViewer.currentSceneData) === null || _this$sceneViewer$cur2 === void 0 ? void 0 : _this$sceneViewer$cur2.behaviors;
|
|
274
|
+
if (sceneBehaviors && sceneBehaviors.length > 0) {
|
|
275
|
+
exportData.behaviors = sceneBehaviors;
|
|
276
|
+
}
|
|
270
277
|
console.log('✅ Scene export completed:', exportData);
|
|
271
278
|
console.log("\uD83D\uDCCA Exported ".concat(sceneChildren.length, " components and ").concat(exportData.connections.length, " connections"));
|
|
272
279
|
return exportData;
|
|
@@ -332,7 +339,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
332
339
|
}, {
|
|
333
340
|
key: "getExportMetadata",
|
|
334
341
|
value: function getExportMetadata() {
|
|
335
|
-
var _this$sceneViewer$
|
|
342
|
+
var _this$sceneViewer$cur3;
|
|
336
343
|
if (!this.sceneViewer.scene) {
|
|
337
344
|
return null;
|
|
338
345
|
}
|
|
@@ -343,7 +350,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
343
350
|
return {
|
|
344
351
|
totalObjects: objectCount,
|
|
345
352
|
hasCurrentSceneData: !!this.sceneViewer.currentSceneData,
|
|
346
|
-
connectionsCount: ((_this$sceneViewer$
|
|
353
|
+
connectionsCount: ((_this$sceneViewer$cur3 = this.sceneViewer.currentSceneData) === null || _this$sceneViewer$cur3 === void 0 || (_this$sceneViewer$cur3 = _this$sceneViewer$cur3.connections) === null || _this$sceneViewer$cur3 === void 0 ? void 0 : _this$sceneViewer$cur3.length) || 0,
|
|
347
354
|
exportTimestamp: new Date().toISOString()
|
|
348
355
|
};
|
|
349
356
|
}
|
|
@@ -768,7 +768,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
768
768
|
key: "_prepareSceneForLoading",
|
|
769
769
|
value: (function () {
|
|
770
770
|
var _prepareSceneForLoading2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(data, isImported) {
|
|
771
|
-
var component, _component$managers;
|
|
771
|
+
var component, _component$managers, _component$managers2, ioBehavMgr;
|
|
772
772
|
return _regenerator().w(function (_context5) {
|
|
773
773
|
while (1) switch (_context5.n) {
|
|
774
774
|
case 0:
|
|
@@ -785,6 +785,16 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
785
785
|
if ((_component$managers = component.managers) !== null && _component$managers !== void 0 && (_component$managers = _component$managers.pathfinding) !== null && _component$managers !== void 0 && _component$managers.snapshotManager) {
|
|
786
786
|
component.managers.pathfinding.snapshotManager.reset();
|
|
787
787
|
}
|
|
788
|
+
|
|
789
|
+
// Register behaviors with IoBehaviorManager
|
|
790
|
+
ioBehavMgr = (_component$managers2 = component.managers) === null || _component$managers2 === void 0 ? void 0 : _component$managers2.ioBehaviorManager;
|
|
791
|
+
if (ioBehavMgr && data.behaviors) {
|
|
792
|
+
console.log("[Behavior] Registering ".concat(data.behaviors.length, " behavior(s) from scene data"));
|
|
793
|
+
ioBehavMgr.setCrossComponentBehaviors(data.behaviors);
|
|
794
|
+
} else if (ioBehavMgr) {
|
|
795
|
+
console.log('[Behavior] No behaviors in scene data, clearing cross-component behaviors');
|
|
796
|
+
ioBehavMgr.setCrossComponentBehaviors([]);
|
|
797
|
+
}
|
|
788
798
|
case 2:
|
|
789
799
|
// Mark all imported objects as declared in the scene data
|
|
790
800
|
// This ensures manual segment connectors and other objects are recognized as declared
|
|
@@ -863,7 +873,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
863
873
|
|
|
864
874
|
// Check if dictionary has connector children and component doesn't already have them
|
|
865
875
|
if (dictEntry !== null && dictEntry !== void 0 && dictEntry.children && Array.isArray(dictEntry.children) && dictEntry.children.length > 0) {
|
|
866
|
-
// Only inject if the component doesn't already have children
|
|
867
876
|
if (!child.children || child.children.length === 0) {
|
|
868
877
|
// Get component rotation (in degrees from JSON)
|
|
869
878
|
var rotation = child.rotation || {
|
|
@@ -893,7 +902,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
893
902
|
connectorsInjected++;
|
|
894
903
|
return clonedConnector;
|
|
895
904
|
});
|
|
896
|
-
console.log("\uD83D\uDD0C Injected ".concat(child.children.length, " connectors for ").concat(child.uuid, " (").concat(libraryId, ") with rotation [").concat(rotation.x, "\xB0, ").concat(rotation.y, "\xB0, ").concat(rotation.z, "\xB0]"));
|
|
897
905
|
componentsProcessed++;
|
|
898
906
|
}
|
|
899
907
|
}
|
|
@@ -180,17 +180,14 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
180
180
|
_context3.n = 1;
|
|
181
181
|
break;
|
|
182
182
|
}
|
|
183
|
-
console.log("\uD83C\uDFAF Model ".concat(modelKey, " already cached, skipping"));
|
|
184
183
|
return _context3.a(2, this.modelCache.get(modelKey));
|
|
185
184
|
case 1:
|
|
186
185
|
if (!this.loadingPromises.has(modelKey)) {
|
|
187
186
|
_context3.n = 2;
|
|
188
187
|
break;
|
|
189
188
|
}
|
|
190
|
-
console.log("\u23F3 Model ".concat(modelKey, " already loading, waiting for completion"));
|
|
191
189
|
return _context3.a(2, this.loadingPromises.get(modelKey));
|
|
192
190
|
case 2:
|
|
193
|
-
console.log("\uD83D\uDD04 Starting preload of GLB model: ".concat(modelKey));
|
|
194
191
|
loadPromise = new Promise(/*#__PURE__*/function () {
|
|
195
192
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(resolve, reject) {
|
|
196
193
|
var modelPath, _t;
|
|
@@ -206,7 +203,6 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
206
203
|
return _this2.urlResolver(modelKey);
|
|
207
204
|
case 2:
|
|
208
205
|
modelPath = _context2.v;
|
|
209
|
-
console.log("\uD83D\uDD17 Resolved URL for ".concat(modelKey, ":"), modelPath.substring(0, 100) + '...');
|
|
210
206
|
_context2.n = 4;
|
|
211
207
|
break;
|
|
212
208
|
case 3:
|
|
@@ -220,11 +216,9 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
220
216
|
break;
|
|
221
217
|
case 5:
|
|
222
218
|
modelPath = "".concat(_this2.modelsBasePath).concat(modelKey);
|
|
223
|
-
console.log("\uD83D\uDCC2 Loading from: ".concat(modelPath));
|
|
224
219
|
case 6:
|
|
225
220
|
// Load GLB model
|
|
226
221
|
_this2.gltfLoader.load(modelPath, function (gltf) {
|
|
227
|
-
console.log("\u2705 Successfully preloaded GLB model: ".concat(modelKey));
|
|
228
222
|
// Cache the scene for future use
|
|
229
223
|
_this2.modelCache.set(modelKey, gltf.scene);
|
|
230
224
|
|
|
@@ -243,13 +237,6 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
243
237
|
resolve(gltf.scene);
|
|
244
238
|
}, function (progress) {
|
|
245
239
|
// Optional: track loading progress
|
|
246
|
-
if (progress.lengthComputable) {
|
|
247
|
-
var percentage = progress.loaded / progress.total * 100;
|
|
248
|
-
if (percentage % 25 === 0) {
|
|
249
|
-
// Log every 25%
|
|
250
|
-
console.log("\uD83D\uDCCA Loading GLB ".concat(modelKey, ": ").concat(percentage.toFixed(0), "%"));
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
240
|
}, function (error) {
|
|
254
241
|
console.error("\u274C Failed to preload GLB model ".concat(modelKey, ":"), error);
|
|
255
242
|
// Remove from loading promises
|
|
@@ -287,13 +274,10 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
287
274
|
value: function getCachedModel(modelKey) {
|
|
288
275
|
var useIndexedGeometry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
289
276
|
if (this.modelCache.has(modelKey)) {
|
|
290
|
-
console.log("\uD83C\uDFAF Returning cached model: ".concat(modelKey));
|
|
291
277
|
var cachedData = this.modelCache.get(modelKey);
|
|
292
278
|
|
|
293
279
|
// Handle OBJ models with processed geometry
|
|
294
280
|
if (cachedData && cachedData.isObjModel && useIndexedGeometry && cachedData.processedGeometry) {
|
|
295
|
-
console.log("\uD83D\uDD27 Using indexed BufferGeometry for OBJ: ".concat(modelKey));
|
|
296
|
-
|
|
297
281
|
// Create a mesh from the processed indexed geometry
|
|
298
282
|
var mesh = new THREE.Mesh(cachedData.processedGeometry.clone(), cachedData.materials.clone());
|
|
299
283
|
|
|
@@ -529,7 +513,7 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
529
513
|
}
|
|
530
514
|
|
|
531
515
|
// Model not cached, need to load it
|
|
532
|
-
|
|
516
|
+
// Loading model for library ID
|
|
533
517
|
this.preloadSingleModel(modelKey).then(function (model) {
|
|
534
518
|
if (model) {
|
|
535
519
|
var _clonedModel = model.clone();
|
|
@@ -57,7 +57,6 @@ function _attachIODevicesToComponent() {
|
|
|
57
57
|
_context.n = 10;
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
|
-
console.log("\uD83D\uDD04 IO device model not in cache, preloading: ".concat(deviceData.modelKey));
|
|
61
60
|
_context.p = 5;
|
|
62
61
|
if (!((_modelPreloader$loadi = modelPreloader.loadingPromises) !== null && _modelPreloader$loadi !== void 0 && _modelPreloader$loadi.has(deviceData.modelKey))) {
|
|
63
62
|
_context.n = 7;
|
|
@@ -139,10 +138,6 @@ function _attachIODevicesToComponent() {
|
|
|
139
138
|
|
|
140
139
|
// Add as child of the component
|
|
141
140
|
componentModel.add(deviceModel);
|
|
142
|
-
console.log("\u2705 Attached IO device: ".concat(attachment.attachmentLabel || attachment.deviceId, " at"), {
|
|
143
|
-
position: deviceModel.position,
|
|
144
|
-
scale: deviceModel.scale
|
|
145
|
-
});
|
|
146
141
|
_context.n = 13;
|
|
147
142
|
break;
|
|
148
143
|
case 12:
|