@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
package/dist/bundle/index.js
CHANGED
|
@@ -4165,6 +4165,7 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
4165
4165
|
// Detect pointerdown on an IO device mesh and convert a drag gesture into
|
|
4166
4166
|
// state changes. Up/right = positive direction, down/left = negative.
|
|
4167
4167
|
this.eventHandlers.pointerdown = function (event) {
|
|
4168
|
+
var _ioDeviceObject$userD, _this4$sceneViewer;
|
|
4168
4169
|
if (_this4.transformState.isTransforming) return;
|
|
4169
4170
|
if (!_this4.callbacks.onIODeviceDrag) return;
|
|
4170
4171
|
_this4._calculateMousePosition(event, mouse);
|
|
@@ -4177,14 +4178,14 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
4177
4178
|
try {
|
|
4178
4179
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4179
4180
|
var hit = _step.value;
|
|
4180
|
-
var
|
|
4181
|
-
while (
|
|
4182
|
-
var _obj$
|
|
4183
|
-
if (((_obj$
|
|
4184
|
-
ioDeviceObject =
|
|
4181
|
+
var _obj = hit.object;
|
|
4182
|
+
while (_obj) {
|
|
4183
|
+
var _obj$userData2;
|
|
4184
|
+
if (((_obj$userData2 = _obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.objectType) === 'io-device') {
|
|
4185
|
+
ioDeviceObject = _obj;
|
|
4185
4186
|
break;
|
|
4186
4187
|
}
|
|
4187
|
-
|
|
4188
|
+
_obj = _obj.parent;
|
|
4188
4189
|
}
|
|
4189
4190
|
if (ioDeviceObject) {
|
|
4190
4191
|
hitMesh = hit.object;
|
|
@@ -4198,6 +4199,27 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
4198
4199
|
}
|
|
4199
4200
|
if (!ioDeviceObject) return;
|
|
4200
4201
|
|
|
4202
|
+
// Only allow drag if the clicked mesh is animated (not the parent io-device group)
|
|
4203
|
+
// Resolve parentUuid and attachmentId
|
|
4204
|
+
var parentUuid = null;
|
|
4205
|
+
var obj = ioDeviceObject.parent;
|
|
4206
|
+
while (obj) {
|
|
4207
|
+
var _obj$userData;
|
|
4208
|
+
if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'component') {
|
|
4209
|
+
parentUuid = obj.userData.originalUuid || obj.uuid;
|
|
4210
|
+
break;
|
|
4211
|
+
}
|
|
4212
|
+
obj = obj.parent;
|
|
4213
|
+
}
|
|
4214
|
+
var attachmentId = (_ioDeviceObject$userD = ioDeviceObject.userData) === null || _ioDeviceObject$userD === void 0 ? void 0 : _ioDeviceObject$userD.attachmentId;
|
|
4215
|
+
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) {
|
|
4216
|
+
var animatedMeshes = _this4.sceneViewer.managers.ioBehaviorManager.getAnimatedMeshes(parentUuid, attachmentId);
|
|
4217
|
+
// If there are animated meshes registered, only allow drag if hitMesh is one of them
|
|
4218
|
+
if (animatedMeshes.length > 0 && !animatedMeshes.includes(hitMesh)) {
|
|
4219
|
+
return; // Clicked on non-draggable part of the io-device
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
|
|
4201
4223
|
// Begin session
|
|
4202
4224
|
_this4._ioDragMesh = ioDeviceObject;
|
|
4203
4225
|
_this4._ioDragStartX = event.clientX;
|
|
@@ -4260,8 +4282,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
4260
4282
|
var hit = _step2.value;
|
|
4261
4283
|
var obj = hit.object;
|
|
4262
4284
|
while (obj) {
|
|
4263
|
-
var _obj$
|
|
4264
|
-
if (((_obj$
|
|
4285
|
+
var _obj$userData3;
|
|
4286
|
+
if (((_obj$userData3 = obj.userData) === null || _obj$userData3 === void 0 ? void 0 : _obj$userData3.objectType) === 'io-device') {
|
|
4265
4287
|
_this4.callbacks.onIODeviceClick(obj);
|
|
4266
4288
|
return;
|
|
4267
4289
|
}
|
|
@@ -5921,8 +5943,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
5921
5943
|
key: "_updateSegmentReference",
|
|
5922
5944
|
value: function _updateSegmentReference(oldSegment, newSegment, index) {
|
|
5923
5945
|
var selectedIndex = this.selectedObjects.findIndex(function (obj) {
|
|
5924
|
-
var _obj$
|
|
5925
|
-
return obj.uuid === oldSegment.uuid || ((_obj$
|
|
5946
|
+
var _obj$userData4;
|
|
5947
|
+
return obj.uuid === oldSegment.uuid || ((_obj$userData4 = obj.userData) === null || _obj$userData4 === void 0 ? void 0 : _obj$userData4.originalUuid) === oldSegment.uuid;
|
|
5926
5948
|
});
|
|
5927
5949
|
if (selectedIndex !== -1 && newSegment) {
|
|
5928
5950
|
// Clear bounding box cache
|
|
@@ -11628,7 +11650,8 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
11628
11650
|
}, {
|
|
11629
11651
|
key: "exportSceneData",
|
|
11630
11652
|
value: function exportSceneData() {
|
|
11631
|
-
var _this = this
|
|
11653
|
+
var _this = this,
|
|
11654
|
+
_this$sceneViewer$cur2;
|
|
11632
11655
|
console.log('📤 Starting scene export...');
|
|
11633
11656
|
if (!this.sceneViewer.scene) {
|
|
11634
11657
|
console.warn('⚠️ No scene available for export');
|
|
@@ -11840,6 +11863,12 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
11840
11863
|
children: sceneChildren
|
|
11841
11864
|
}
|
|
11842
11865
|
};
|
|
11866
|
+
|
|
11867
|
+
// Preserve cross-component behaviors authored in the Behavior window
|
|
11868
|
+
var sceneBehaviors = (_this$sceneViewer$cur2 = this.sceneViewer.currentSceneData) === null || _this$sceneViewer$cur2 === void 0 ? void 0 : _this$sceneViewer$cur2.behaviors;
|
|
11869
|
+
if (sceneBehaviors && sceneBehaviors.length > 0) {
|
|
11870
|
+
exportData.behaviors = sceneBehaviors;
|
|
11871
|
+
}
|
|
11843
11872
|
console.log('✅ Scene export completed:', exportData);
|
|
11844
11873
|
console.log("\uD83D\uDCCA Exported ".concat(sceneChildren.length, " components and ").concat(exportData.connections.length, " connections"));
|
|
11845
11874
|
return exportData;
|
|
@@ -11905,7 +11934,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
11905
11934
|
}, {
|
|
11906
11935
|
key: "getExportMetadata",
|
|
11907
11936
|
value: function getExportMetadata() {
|
|
11908
|
-
var _this$sceneViewer$
|
|
11937
|
+
var _this$sceneViewer$cur3;
|
|
11909
11938
|
if (!this.sceneViewer.scene) {
|
|
11910
11939
|
return null;
|
|
11911
11940
|
}
|
|
@@ -11916,7 +11945,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
11916
11945
|
return {
|
|
11917
11946
|
totalObjects: objectCount,
|
|
11918
11947
|
hasCurrentSceneData: !!this.sceneViewer.currentSceneData,
|
|
11919
|
-
connectionsCount: ((_this$sceneViewer$
|
|
11948
|
+
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,
|
|
11920
11949
|
exportTimestamp: new Date().toISOString()
|
|
11921
11950
|
};
|
|
11922
11951
|
}
|
|
@@ -19264,17 +19293,14 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
19264
19293
|
_context3.n = 1;
|
|
19265
19294
|
break;
|
|
19266
19295
|
}
|
|
19267
|
-
console.log("\uD83C\uDFAF Model ".concat(modelKey, " already cached, skipping"));
|
|
19268
19296
|
return _context3.a(2, this.modelCache.get(modelKey));
|
|
19269
19297
|
case 1:
|
|
19270
19298
|
if (!this.loadingPromises.has(modelKey)) {
|
|
19271
19299
|
_context3.n = 2;
|
|
19272
19300
|
break;
|
|
19273
19301
|
}
|
|
19274
|
-
console.log("\u23F3 Model ".concat(modelKey, " already loading, waiting for completion"));
|
|
19275
19302
|
return _context3.a(2, this.loadingPromises.get(modelKey));
|
|
19276
19303
|
case 2:
|
|
19277
|
-
console.log("\uD83D\uDD04 Starting preload of GLB model: ".concat(modelKey));
|
|
19278
19304
|
loadPromise = new Promise(/*#__PURE__*/function () {
|
|
19279
19305
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(resolve, reject) {
|
|
19280
19306
|
var modelPath, _t;
|
|
@@ -19290,7 +19316,6 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
19290
19316
|
return _this2.urlResolver(modelKey);
|
|
19291
19317
|
case 2:
|
|
19292
19318
|
modelPath = _context2.v;
|
|
19293
|
-
console.log("\uD83D\uDD17 Resolved URL for ".concat(modelKey, ":"), modelPath.substring(0, 100) + '...');
|
|
19294
19319
|
_context2.n = 4;
|
|
19295
19320
|
break;
|
|
19296
19321
|
case 3:
|
|
@@ -19304,11 +19329,9 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
19304
19329
|
break;
|
|
19305
19330
|
case 5:
|
|
19306
19331
|
modelPath = "".concat(_this2.modelsBasePath).concat(modelKey);
|
|
19307
|
-
console.log("\uD83D\uDCC2 Loading from: ".concat(modelPath));
|
|
19308
19332
|
case 6:
|
|
19309
19333
|
// Load GLB model
|
|
19310
19334
|
_this2.gltfLoader.load(modelPath, function (gltf) {
|
|
19311
|
-
console.log("\u2705 Successfully preloaded GLB model: ".concat(modelKey));
|
|
19312
19335
|
// Cache the scene for future use
|
|
19313
19336
|
_this2.modelCache.set(modelKey, gltf.scene);
|
|
19314
19337
|
|
|
@@ -19327,13 +19350,6 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
19327
19350
|
resolve(gltf.scene);
|
|
19328
19351
|
}, function (progress) {
|
|
19329
19352
|
// Optional: track loading progress
|
|
19330
|
-
if (progress.lengthComputable) {
|
|
19331
|
-
var percentage = progress.loaded / progress.total * 100;
|
|
19332
|
-
if (percentage % 25 === 0) {
|
|
19333
|
-
// Log every 25%
|
|
19334
|
-
console.log("\uD83D\uDCCA Loading GLB ".concat(modelKey, ": ").concat(percentage.toFixed(0), "%"));
|
|
19335
|
-
}
|
|
19336
|
-
}
|
|
19337
19353
|
}, function (error) {
|
|
19338
19354
|
console.error("\u274C Failed to preload GLB model ".concat(modelKey, ":"), error);
|
|
19339
19355
|
// Remove from loading promises
|
|
@@ -19371,13 +19387,10 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
19371
19387
|
value: function getCachedModel(modelKey) {
|
|
19372
19388
|
var useIndexedGeometry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
19373
19389
|
if (this.modelCache.has(modelKey)) {
|
|
19374
|
-
console.log("\uD83C\uDFAF Returning cached model: ".concat(modelKey));
|
|
19375
19390
|
var cachedData = this.modelCache.get(modelKey);
|
|
19376
19391
|
|
|
19377
19392
|
// Handle OBJ models with processed geometry
|
|
19378
19393
|
if (cachedData && cachedData.isObjModel && useIndexedGeometry && cachedData.processedGeometry) {
|
|
19379
|
-
console.log("\uD83D\uDD27 Using indexed BufferGeometry for OBJ: ".concat(modelKey));
|
|
19380
|
-
|
|
19381
19394
|
// Create a mesh from the processed indexed geometry
|
|
19382
19395
|
var mesh = new THREE__namespace.Mesh(cachedData.processedGeometry.clone(), cachedData.materials.clone());
|
|
19383
19396
|
|
|
@@ -19613,7 +19626,7 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
19613
19626
|
}
|
|
19614
19627
|
|
|
19615
19628
|
// Model not cached, need to load it
|
|
19616
|
-
|
|
19629
|
+
// Loading model for library ID
|
|
19617
19630
|
this.preloadSingleModel(modelKey).then(function (model) {
|
|
19618
19631
|
if (model) {
|
|
19619
19632
|
var _clonedModel = model.clone();
|
|
@@ -20280,7 +20293,7 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
20280
20293
|
value: (function () {
|
|
20281
20294
|
var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(additionalComponents) {
|
|
20282
20295
|
var _this3 = this;
|
|
20283
|
-
var _this$sceneViewer, newComponents,
|
|
20296
|
+
var _this$sceneViewer, newComponents, modelPreloader, _t;
|
|
20284
20297
|
return _regenerator().w(function (_context3) {
|
|
20285
20298
|
while (1) switch (_context3.n) {
|
|
20286
20299
|
case 0:
|
|
@@ -20304,7 +20317,6 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
20304
20317
|
_context3.p = 3;
|
|
20305
20318
|
// Filter out components that already exist in the dictionary (deduplication)
|
|
20306
20319
|
newComponents = {};
|
|
20307
|
-
skippedCount = 0;
|
|
20308
20320
|
Object.entries(additionalComponents).forEach(function (_ref3) {
|
|
20309
20321
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
20310
20322
|
key = _ref4[0],
|
|
@@ -20312,13 +20324,12 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
20312
20324
|
if (!_this3.componentDictionary[key]) {
|
|
20313
20325
|
newComponents[key] = component;
|
|
20314
20326
|
} else {
|
|
20315
|
-
skippedCount++;
|
|
20316
20327
|
console.log("\u26A0\uFE0F Skipping duplicate component: ".concat(key, " (").concat(component.name || 'unnamed', ")"));
|
|
20317
20328
|
}
|
|
20318
20329
|
});
|
|
20319
20330
|
|
|
20320
20331
|
// Merge only new components into dictionary
|
|
20321
|
-
|
|
20332
|
+
Object.keys(newComponents).length;
|
|
20322
20333
|
Object.assign(this.componentDictionary, newComponents);
|
|
20323
20334
|
|
|
20324
20335
|
// Update ModelPreloader's dictionary reference
|
|
@@ -20326,12 +20337,10 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
20326
20337
|
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;
|
|
20327
20338
|
if (modelPreloader) {
|
|
20328
20339
|
modelPreloader.componentDictionary = this.componentDictionary;
|
|
20329
|
-
console.log("\uD83D\uDD04 Updated ModelPreloader's dictionary reference (".concat(Object.keys(this.componentDictionary).length, " total components)"));
|
|
20330
20340
|
}
|
|
20331
20341
|
|
|
20332
20342
|
// Clear cache to force refresh
|
|
20333
20343
|
this.clearCache();
|
|
20334
|
-
console.log("\u2705 extendComponentDictionary(): Added ".concat(addedCount, " new components (").concat(skippedCount, " duplicates skipped)"));
|
|
20335
20344
|
return _context3.a(2, true);
|
|
20336
20345
|
case 4:
|
|
20337
20346
|
_context3.p = 4;
|
|
@@ -29853,7 +29862,6 @@ function _attachIODevicesToComponent() {
|
|
|
29853
29862
|
_context.n = 10;
|
|
29854
29863
|
break;
|
|
29855
29864
|
}
|
|
29856
|
-
console.log("\uD83D\uDD04 IO device model not in cache, preloading: ".concat(deviceData.modelKey));
|
|
29857
29865
|
_context.p = 5;
|
|
29858
29866
|
if (!((_modelPreloader$loadi = modelPreloader.loadingPromises) !== null && _modelPreloader$loadi !== void 0 && _modelPreloader$loadi.has(deviceData.modelKey))) {
|
|
29859
29867
|
_context.n = 7;
|
|
@@ -29935,10 +29943,6 @@ function _attachIODevicesToComponent() {
|
|
|
29935
29943
|
|
|
29936
29944
|
// Add as child of the component
|
|
29937
29945
|
componentModel.add(deviceModel);
|
|
29938
|
-
console.log("\u2705 Attached IO device: ".concat(attachment.attachmentLabel || attachment.deviceId, " at"), {
|
|
29939
|
-
position: deviceModel.position,
|
|
29940
|
-
scale: deviceModel.scale
|
|
29941
|
-
});
|
|
29942
29946
|
_context.n = 13;
|
|
29943
29947
|
break;
|
|
29944
29948
|
case 12:
|
|
@@ -31350,7 +31354,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
31350
31354
|
|
|
31351
31355
|
// Attach IO devices for smart components (import flow)
|
|
31352
31356
|
if (!(componentData.isSmart && componentData.attachedDevices)) {
|
|
31353
|
-
_context2.n =
|
|
31357
|
+
_context2.n = 9;
|
|
31354
31358
|
break;
|
|
31355
31359
|
}
|
|
31356
31360
|
_context2.n = 4;
|
|
@@ -31359,7 +31363,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
31359
31363
|
// Register behavior configs for each attached device
|
|
31360
31364
|
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;
|
|
31361
31365
|
if (!ioBehavMgr) {
|
|
31362
|
-
_context2.n =
|
|
31366
|
+
_context2.n = 9;
|
|
31363
31367
|
break;
|
|
31364
31368
|
}
|
|
31365
31369
|
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
@@ -31408,6 +31412,12 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
31408
31412
|
_context2.n = 5;
|
|
31409
31413
|
break;
|
|
31410
31414
|
case 8:
|
|
31415
|
+
// Register component-level behaviors (intra-component io-device linking)
|
|
31416
|
+
if (componentData.behaviors && componentData.behaviors.length > 0) {
|
|
31417
|
+
console.log("[ModelManager] Registering ".concat(componentData.behaviors.length, " component-level behavior(s) for ").concat(originalProps.uuid));
|
|
31418
|
+
ioBehavMgr.registerComponentBehaviors(originalProps.uuid, componentData.behaviors);
|
|
31419
|
+
}
|
|
31420
|
+
case 9:
|
|
31411
31421
|
// Replace mesh in scene
|
|
31412
31422
|
this._replaceMeshInScene(targetMesh, libraryModel, originalProps.parent, component);
|
|
31413
31423
|
|
|
@@ -31426,13 +31436,13 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
31426
31436
|
}
|
|
31427
31437
|
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"));
|
|
31428
31438
|
return _context2.a(2, libraryModel);
|
|
31429
|
-
case
|
|
31430
|
-
_context2.p =
|
|
31439
|
+
case 10:
|
|
31440
|
+
_context2.p = 10;
|
|
31431
31441
|
_t = _context2.v;
|
|
31432
31442
|
console.error("\u274C Error loading ".concat((_jsonEntry$userData4 = jsonEntry.userData) === null || _jsonEntry$userData4 === void 0 ? void 0 : _jsonEntry$userData4.libraryId, " GLB model:"), _t);
|
|
31433
31443
|
return _context2.a(2, targetMesh);
|
|
31434
31444
|
}
|
|
31435
|
-
}, _callee, this, [[1,
|
|
31445
|
+
}, _callee, this, [[1, 10]]);
|
|
31436
31446
|
}));
|
|
31437
31447
|
function loadLibraryModel(_x, _x2, _x3) {
|
|
31438
31448
|
return _loadLibraryModel.apply(this, arguments);
|
|
@@ -33373,7 +33383,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
33373
33383
|
key: "_prepareSceneForLoading",
|
|
33374
33384
|
value: (function () {
|
|
33375
33385
|
var _prepareSceneForLoading2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(data, isImported) {
|
|
33376
|
-
var component, _component$managers;
|
|
33386
|
+
var component, _component$managers, _component$managers2, ioBehavMgr;
|
|
33377
33387
|
return _regenerator().w(function (_context5) {
|
|
33378
33388
|
while (1) switch (_context5.n) {
|
|
33379
33389
|
case 0:
|
|
@@ -33390,6 +33400,16 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
33390
33400
|
if ((_component$managers = component.managers) !== null && _component$managers !== void 0 && (_component$managers = _component$managers.pathfinding) !== null && _component$managers !== void 0 && _component$managers.snapshotManager) {
|
|
33391
33401
|
component.managers.pathfinding.snapshotManager.reset();
|
|
33392
33402
|
}
|
|
33403
|
+
|
|
33404
|
+
// Register behaviors with IoBehaviorManager
|
|
33405
|
+
ioBehavMgr = (_component$managers2 = component.managers) === null || _component$managers2 === void 0 ? void 0 : _component$managers2.ioBehaviorManager;
|
|
33406
|
+
if (ioBehavMgr && data.behaviors) {
|
|
33407
|
+
console.log("[Behavior] Registering ".concat(data.behaviors.length, " behavior(s) from scene data"));
|
|
33408
|
+
ioBehavMgr.setCrossComponentBehaviors(data.behaviors);
|
|
33409
|
+
} else if (ioBehavMgr) {
|
|
33410
|
+
console.log('[Behavior] No behaviors in scene data, clearing cross-component behaviors');
|
|
33411
|
+
ioBehavMgr.setCrossComponentBehaviors([]);
|
|
33412
|
+
}
|
|
33393
33413
|
case 2:
|
|
33394
33414
|
// Mark all imported objects as declared in the scene data
|
|
33395
33415
|
// This ensures manual segment connectors and other objects are recognized as declared
|
|
@@ -33468,7 +33488,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
33468
33488
|
|
|
33469
33489
|
// Check if dictionary has connector children and component doesn't already have them
|
|
33470
33490
|
if (dictEntry !== null && dictEntry !== void 0 && dictEntry.children && Array.isArray(dictEntry.children) && dictEntry.children.length > 0) {
|
|
33471
|
-
// Only inject if the component doesn't already have children
|
|
33472
33491
|
if (!child.children || child.children.length === 0) {
|
|
33473
33492
|
// Get component rotation (in degrees from JSON)
|
|
33474
33493
|
var rotation = child.rotation || {
|
|
@@ -33498,7 +33517,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
33498
33517
|
connectorsInjected++;
|
|
33499
33518
|
return clonedConnector;
|
|
33500
33519
|
});
|
|
33501
|
-
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]"));
|
|
33502
33520
|
componentsProcessed++;
|
|
33503
33521
|
}
|
|
33504
33522
|
}
|
|
@@ -37377,6 +37395,24 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37377
37395
|
* }>
|
|
37378
37396
|
*/
|
|
37379
37397
|
_this._entries = new Map();
|
|
37398
|
+
_this._crossComponentBehaviors = [];
|
|
37399
|
+
|
|
37400
|
+
/**
|
|
37401
|
+
* Map: `${componentUuid}` → Array<{ id, input, outputs }>
|
|
37402
|
+
* Component-level behaviors for intra-component io-device linking
|
|
37403
|
+
*/
|
|
37404
|
+
_this._componentBehaviors = new Map();
|
|
37405
|
+
|
|
37406
|
+
/**
|
|
37407
|
+
* Injected by the host application to read and write I/O device state.
|
|
37408
|
+
* Set via configure(). Shape:
|
|
37409
|
+
* {
|
|
37410
|
+
* getState(attachmentId, dataPointId) -> value | null,
|
|
37411
|
+
* setState(attachmentId, dataPointId, value) -> void
|
|
37412
|
+
* }
|
|
37413
|
+
* @type {{ getState: Function, setState: Function } | null}
|
|
37414
|
+
*/
|
|
37415
|
+
_this._stateAdapter = null;
|
|
37380
37416
|
return _this;
|
|
37381
37417
|
}
|
|
37382
37418
|
|
|
@@ -37454,9 +37490,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37454
37490
|
}
|
|
37455
37491
|
if (entries.length) {
|
|
37456
37492
|
this._entries.set(key, entries);
|
|
37457
|
-
|
|
37458
|
-
return e.anim.stateVariable;
|
|
37459
|
-
}).join(', ')));
|
|
37493
|
+
// Loaded ${entries.length} animation(s) for attachment "${attachmentId}"
|
|
37460
37494
|
} else {
|
|
37461
37495
|
console.warn("[IoBehaviorManager] No mesh entries resolved for attachment \"".concat(attachmentId, "\" \u2014 behaviorConfig had ").concat(anims.length, " entries but none matched a mesh"));
|
|
37462
37496
|
}
|
|
@@ -37474,29 +37508,479 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37474
37508
|
}, {
|
|
37475
37509
|
key: "triggerState",
|
|
37476
37510
|
value: function triggerState(attachmentId, dataPointId, value, parentUuid) {
|
|
37477
|
-
|
|
37478
|
-
|
|
37479
|
-
|
|
37480
|
-
|
|
37481
|
-
|
|
37482
|
-
|
|
37483
|
-
|
|
37511
|
+
// triggerState: ${attachmentId}.${dataPointId} = ${value}
|
|
37512
|
+
|
|
37513
|
+
if (parentUuid) {
|
|
37514
|
+
var key = this._key(parentUuid, attachmentId);
|
|
37515
|
+
var entries = this._entries.get(key);
|
|
37516
|
+
if (entries) {
|
|
37517
|
+
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
37518
|
+
_step2;
|
|
37484
37519
|
try {
|
|
37485
|
-
for (
|
|
37486
|
-
var entry =
|
|
37520
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
37521
|
+
var entry = _step2.value;
|
|
37487
37522
|
if (entry.anim.stateVariable !== dataPointId) continue;
|
|
37488
37523
|
this._applyAnimation(entry, value);
|
|
37489
37524
|
}
|
|
37490
37525
|
} catch (err) {
|
|
37491
|
-
|
|
37526
|
+
_iterator2.e(err);
|
|
37492
37527
|
} finally {
|
|
37493
|
-
|
|
37528
|
+
_iterator2.f();
|
|
37529
|
+
}
|
|
37530
|
+
}
|
|
37531
|
+
} else {
|
|
37532
|
+
// Fallback when parentUuid is not provided: match by attachmentId suffix or exact key match
|
|
37533
|
+
var suffix = "::".concat(attachmentId);
|
|
37534
|
+
var _iterator3 = _createForOfIteratorHelper(this._entries.entries()),
|
|
37535
|
+
_step3;
|
|
37536
|
+
try {
|
|
37537
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
37538
|
+
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
37539
|
+
_key2 = _step3$value[0],
|
|
37540
|
+
_entries = _step3$value[1];
|
|
37541
|
+
if (_key2 === attachmentId || _key2.endsWith(suffix)) {
|
|
37542
|
+
var _iterator4 = _createForOfIteratorHelper(_entries),
|
|
37543
|
+
_step4;
|
|
37544
|
+
try {
|
|
37545
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
37546
|
+
var _entry = _step4.value;
|
|
37547
|
+
if (_entry.anim.stateVariable !== dataPointId) continue;
|
|
37548
|
+
this._applyAnimation(_entry, value);
|
|
37549
|
+
}
|
|
37550
|
+
} catch (err) {
|
|
37551
|
+
_iterator4.e(err);
|
|
37552
|
+
} finally {
|
|
37553
|
+
_iterator4.f();
|
|
37554
|
+
}
|
|
37555
|
+
}
|
|
37556
|
+
}
|
|
37557
|
+
} catch (err) {
|
|
37558
|
+
_iterator3.e(err);
|
|
37559
|
+
} finally {
|
|
37560
|
+
_iterator3.f();
|
|
37561
|
+
}
|
|
37562
|
+
}
|
|
37563
|
+
|
|
37564
|
+
// Evaluate component-level behaviors (intra-component io-device linking)
|
|
37565
|
+
if (parentUuid && this._componentBehaviors.has(parentUuid)) {
|
|
37566
|
+
var componentBehaviors = this._componentBehaviors.get(parentUuid);
|
|
37567
|
+
// Checking component-level behaviors (count: ${componentBehaviors.length})
|
|
37568
|
+
this.triggerCrossComponentBehaviors(componentBehaviors, parentUuid, attachmentId, dataPointId, value);
|
|
37569
|
+
}
|
|
37570
|
+
|
|
37571
|
+
// Evaluate cross-component behaviors if any are registered
|
|
37572
|
+
// Checking cross-component behaviors (count: ${this._crossComponentBehaviors?.length || 0})
|
|
37573
|
+
if (this._crossComponentBehaviors && this._crossComponentBehaviors.length > 0) {
|
|
37574
|
+
this.triggerCrossComponentBehaviors(this._crossComponentBehaviors, parentUuid, attachmentId, dataPointId, value);
|
|
37575
|
+
}
|
|
37576
|
+
}
|
|
37577
|
+
|
|
37578
|
+
/**
|
|
37579
|
+
* Register the root-level cross-component behaviors from the scene.
|
|
37580
|
+
* Normalizes shorthand syntax to full format.
|
|
37581
|
+
*
|
|
37582
|
+
* @param {Array} behaviors
|
|
37583
|
+
*/
|
|
37584
|
+
}, {
|
|
37585
|
+
key: "setCrossComponentBehaviors",
|
|
37586
|
+
value: function setCrossComponentBehaviors(behaviors) {
|
|
37587
|
+
var _this2 = this;
|
|
37588
|
+
this._crossComponentBehaviors = (behaviors || []).map(function (b) {
|
|
37589
|
+
return _this2._normalizeBehavior(b);
|
|
37590
|
+
});
|
|
37591
|
+
// Loaded ${this._crossComponentBehaviors.length} cross-component behavior(s)
|
|
37592
|
+
}
|
|
37593
|
+
|
|
37594
|
+
/**
|
|
37595
|
+
* Register component-level behaviors (intra-component io-device linking).
|
|
37596
|
+
* These behaviors are defined in the smart component's JSON and link devices within the same component instance.
|
|
37597
|
+
*
|
|
37598
|
+
* @param {string} componentUuid - The UUID of the component
|
|
37599
|
+
* @param {Array} behaviors - Array of behaviors in shorthand format
|
|
37600
|
+
*/
|
|
37601
|
+
}, {
|
|
37602
|
+
key: "registerComponentBehaviors",
|
|
37603
|
+
value: function registerComponentBehaviors(componentUuid, behaviors) {
|
|
37604
|
+
var _this3 = this;
|
|
37605
|
+
if (!behaviors || behaviors.length === 0) return;
|
|
37606
|
+
var normalized = behaviors.map(function (b) {
|
|
37607
|
+
return _this3._normalizeBehavior(b);
|
|
37608
|
+
});
|
|
37609
|
+
this._componentBehaviors.set(componentUuid, normalized);
|
|
37610
|
+
// Registered ${normalized.length} component-level behavior(s) for component ${componentUuid}
|
|
37611
|
+
}
|
|
37612
|
+
|
|
37613
|
+
/**
|
|
37614
|
+
* Normalize behavior from shorthand to full format.
|
|
37615
|
+
* Supports:
|
|
37616
|
+
* - input: "attachment.state" → { attachment, state }
|
|
37617
|
+
* - outputs: ["attachment.state", ...] → converted to individual behaviors
|
|
37618
|
+
*
|
|
37619
|
+
* @param {Object} behavior - Raw behavior from scene JSON
|
|
37620
|
+
* @returns {Object} Normalized behavior
|
|
37621
|
+
*/
|
|
37622
|
+
}, {
|
|
37623
|
+
key: "_normalizeBehavior",
|
|
37624
|
+
value: function _normalizeBehavior(behavior) {
|
|
37625
|
+
var normalized = _objectSpread2({}, behavior);
|
|
37626
|
+
|
|
37627
|
+
// Parse shorthand input: "attachment.state"
|
|
37628
|
+
if (typeof behavior.input === 'string') {
|
|
37629
|
+
var _behavior$input$split = behavior.input.split('.'),
|
|
37630
|
+
_behavior$input$split2 = _slicedToArray(_behavior$input$split, 2),
|
|
37631
|
+
attachment = _behavior$input$split2[0],
|
|
37632
|
+
state = _behavior$input$split2[1];
|
|
37633
|
+
normalized.input = {
|
|
37634
|
+
attachment: attachment,
|
|
37635
|
+
state: state
|
|
37636
|
+
};
|
|
37637
|
+
}
|
|
37638
|
+
|
|
37639
|
+
// Parse shorthand output/outputs
|
|
37640
|
+
if (behavior.outputs) {
|
|
37641
|
+
// Multiple outputs - expand to array
|
|
37642
|
+
normalized._outputs = behavior.outputs.map(function (out) {
|
|
37643
|
+
if (typeof out === 'string') {
|
|
37644
|
+
var _out$split = out.split('.'),
|
|
37645
|
+
_out$split2 = _slicedToArray(_out$split, 2),
|
|
37646
|
+
_attachment = _out$split2[0],
|
|
37647
|
+
_state = _out$split2[1];
|
|
37648
|
+
return {
|
|
37649
|
+
attachment: _attachment,
|
|
37650
|
+
state: _state
|
|
37651
|
+
};
|
|
37652
|
+
}
|
|
37653
|
+
return out;
|
|
37654
|
+
});
|
|
37655
|
+
delete normalized.outputs;
|
|
37656
|
+
} else if (typeof behavior.output === 'string') {
|
|
37657
|
+
// Single output string
|
|
37658
|
+
var _behavior$output$spli = behavior.output.split('.'),
|
|
37659
|
+
_behavior$output$spli2 = _slicedToArray(_behavior$output$spli, 2),
|
|
37660
|
+
_attachment2 = _behavior$output$spli2[0],
|
|
37661
|
+
_state2 = _behavior$output$spli2[1];
|
|
37662
|
+
normalized.output = {
|
|
37663
|
+
attachment: _attachment2,
|
|
37664
|
+
state: _state2
|
|
37665
|
+
};
|
|
37666
|
+
}
|
|
37667
|
+
return normalized;
|
|
37668
|
+
}
|
|
37669
|
+
|
|
37670
|
+
/**
|
|
37671
|
+
* Find the parent component UUID for a given attachment ID.
|
|
37672
|
+
* Searches the scene tree for the io-device with this attachment ID,
|
|
37673
|
+
* then returns its parentComponentId.
|
|
37674
|
+
*
|
|
37675
|
+
* @param {string} attachmentId
|
|
37676
|
+
* @returns {string|null} Component UUID or null if not found
|
|
37677
|
+
*/
|
|
37678
|
+
}, {
|
|
37679
|
+
key: "_findComponentByAttachment",
|
|
37680
|
+
value: function _findComponentByAttachment(attachmentId) {
|
|
37681
|
+
var _this$sceneViewer;
|
|
37682
|
+
if (!((_this$sceneViewer = this.sceneViewer) !== null && _this$sceneViewer !== void 0 && _this$sceneViewer.scene)) return null;
|
|
37683
|
+
var scene = this.sceneViewer.scene;
|
|
37684
|
+
var found = null;
|
|
37685
|
+
scene.traverse(function (obj) {
|
|
37686
|
+
var _obj$userData, _obj$userData2;
|
|
37687
|
+
if (found) return;
|
|
37688
|
+
// Find the io-device object with this attachmentId
|
|
37689
|
+
if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'io-device' && ((_obj$userData2 = obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.attachmentId) === attachmentId) {
|
|
37690
|
+
found = obj.userData.parentComponentId;
|
|
37691
|
+
}
|
|
37692
|
+
});
|
|
37693
|
+
if (!found) {
|
|
37694
|
+
console.warn("[Behavior] Could not find parent component for attachment \"".concat(attachmentId, "\""));
|
|
37695
|
+
}
|
|
37696
|
+
return found;
|
|
37697
|
+
}
|
|
37698
|
+
|
|
37699
|
+
/**
|
|
37700
|
+
* Inject a state adapter so cross-component behaviors can write I/O device state.
|
|
37701
|
+
* Call this once after the host application's state store is ready.
|
|
37702
|
+
*
|
|
37703
|
+
* @param {{ getState: Function, setState: Function }} stateAdapter
|
|
37704
|
+
* - getState(attachmentId, dataPointId) -> current value (any) | null
|
|
37705
|
+
* - setState(attachmentId, dataPointId, value) -> void
|
|
37706
|
+
*
|
|
37707
|
+
* @example
|
|
37708
|
+
* // Sandbox (Vuex)
|
|
37709
|
+
* ioBehaviorManager.configure({
|
|
37710
|
+
* getState: (attId, dpId) =>
|
|
37711
|
+
* store.getters['assetManagerStore/ioDeviceState'](attId)(dpId) ?? null,
|
|
37712
|
+
* setState: (attId, dpId, value) =>
|
|
37713
|
+
* store.dispatch('assetManagerStore/setIoDeviceState',
|
|
37714
|
+
* { attachmentId: attId, dataPointId: dpId, value })
|
|
37715
|
+
* })
|
|
37716
|
+
*/
|
|
37717
|
+
}, {
|
|
37718
|
+
key: "configure",
|
|
37719
|
+
value: function configure(stateAdapter) {
|
|
37720
|
+
this._stateAdapter = stateAdapter || null;
|
|
37721
|
+
// State adapter configured
|
|
37722
|
+
}
|
|
37723
|
+
|
|
37724
|
+
/**
|
|
37725
|
+
* Evaluate and apply cross-component behaviors loaded from the scene JSON.
|
|
37726
|
+
*
|
|
37727
|
+
* @param {Array} behaviors - Root-level behaviors array from the scene JSON
|
|
37728
|
+
* @param {string} triggerParentUuid - Parent component UUID of the triggering device
|
|
37729
|
+
* @param {string} triggerAttachmentId - Attachment ID of the triggering device
|
|
37730
|
+
* @param {string} triggerStateId - The state variable ID that changed
|
|
37731
|
+
* @param {*} value - The new state value
|
|
37732
|
+
*/
|
|
37733
|
+
}, {
|
|
37734
|
+
key: "triggerCrossComponentBehaviors",
|
|
37735
|
+
value: function triggerCrossComponentBehaviors(behaviors, triggerParentUuid, triggerAttachmentId, triggerStateId, value) {
|
|
37736
|
+
if (!behaviors || !Array.isArray(behaviors)) {
|
|
37737
|
+
return;
|
|
37738
|
+
}
|
|
37739
|
+
|
|
37740
|
+
// Evaluating ${behaviors.length} behavior(s)
|
|
37741
|
+
var _iterator5 = _createForOfIteratorHelper(behaviors),
|
|
37742
|
+
_step5;
|
|
37743
|
+
try {
|
|
37744
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
37745
|
+
var behavior = _step5.value;
|
|
37746
|
+
var input = behavior.input,
|
|
37747
|
+
output = behavior.output,
|
|
37748
|
+
_outputs = behavior._outputs,
|
|
37749
|
+
conditions = behavior.conditions;
|
|
37750
|
+
if (!input || !output && !_outputs) {
|
|
37751
|
+
console.warn('[Behavior] Skipping behavior - missing input or output(s):', behavior);
|
|
37752
|
+
continue;
|
|
37753
|
+
}
|
|
37754
|
+
|
|
37755
|
+
// Auto-lookup component if not specified
|
|
37756
|
+
var inputComponent = input.component || this._findComponentByAttachment(input.attachment);
|
|
37757
|
+
console.log("[Behavior] Checking behavior \"".concat(behavior.id, "\":"), {
|
|
37758
|
+
inputMatch: inputComponent === triggerParentUuid,
|
|
37759
|
+
attachmentMatch: input.attachment === triggerAttachmentId,
|
|
37760
|
+
stateMatch: input.state === triggerStateId,
|
|
37761
|
+
expected: {
|
|
37762
|
+
component: inputComponent,
|
|
37763
|
+
attachment: input.attachment,
|
|
37764
|
+
state: input.state
|
|
37765
|
+
},
|
|
37766
|
+
actual: {
|
|
37767
|
+
component: triggerParentUuid,
|
|
37768
|
+
attachment: triggerAttachmentId,
|
|
37769
|
+
state: triggerStateId
|
|
37770
|
+
}
|
|
37771
|
+
});
|
|
37772
|
+
|
|
37773
|
+
// Verify that the input matches the triggering source
|
|
37774
|
+
if (inputComponent === triggerParentUuid && input.attachment === triggerAttachmentId && input.state === triggerStateId) {
|
|
37775
|
+
// Behavior "${behavior.id}" matched
|
|
37776
|
+
|
|
37777
|
+
// Collect all outputs (single or multiple)
|
|
37778
|
+
var outputs = _outputs || (output ? [output] : []);
|
|
37779
|
+
|
|
37780
|
+
// Process each output
|
|
37781
|
+
var _iterator6 = _createForOfIteratorHelper(outputs),
|
|
37782
|
+
_step6;
|
|
37783
|
+
try {
|
|
37784
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
37785
|
+
var out = _step6.value;
|
|
37786
|
+
// NEW: State-to-state pass-through pattern
|
|
37787
|
+
if (out.state) {
|
|
37788
|
+
// Auto-lookup output component if not specified
|
|
37789
|
+
var outputComponent = out.component || this._findComponentByAttachment(out.attachment);
|
|
37790
|
+
|
|
37791
|
+
// Direct state mapping without conditions
|
|
37792
|
+
if (this._stateAdapter) {
|
|
37793
|
+
// Dispatching state-to-state: ${out.attachment}.${out.state} = ${value}
|
|
37794
|
+
this._stateAdapter.setState(out.attachment, out.state, value);
|
|
37795
|
+
|
|
37796
|
+
// Trigger animations on the output component
|
|
37797
|
+
// triggerState(attachmentId, dataPointId, value, parentUuid)
|
|
37798
|
+
if (outputComponent) {
|
|
37799
|
+
// Triggering animations on output component
|
|
37800
|
+
this.triggerState(out.attachment, out.state, value, outputComponent);
|
|
37801
|
+
} else {
|
|
37802
|
+
console.warn("[Behavior] Could not find component for attachment \"".concat(out.attachment, "\""));
|
|
37803
|
+
}
|
|
37804
|
+
} else {
|
|
37805
|
+
console.warn('[Behavior] ✗ State adapter not configured for state-to-state behavior');
|
|
37806
|
+
}
|
|
37807
|
+
}
|
|
37808
|
+
// LEGACY: Mesh-based pattern with conditions
|
|
37809
|
+
else if (conditions && out.child) {
|
|
37810
|
+
// Using legacy mesh-based pattern with conditions
|
|
37811
|
+
// Evaluate conditions
|
|
37812
|
+
var _iterator7 = _createForOfIteratorHelper(conditions),
|
|
37813
|
+
_step7;
|
|
37814
|
+
try {
|
|
37815
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
37816
|
+
var condition = _step7.value;
|
|
37817
|
+
if (this._evaluateCondition(condition.when, value)) {
|
|
37818
|
+
// Apply actions to the target output component/attachment/child mesh
|
|
37819
|
+
this._applyCrossComponentActions(out, condition.actions);
|
|
37820
|
+
}
|
|
37821
|
+
}
|
|
37822
|
+
} catch (err) {
|
|
37823
|
+
_iterator7.e(err);
|
|
37824
|
+
} finally {
|
|
37825
|
+
_iterator7.f();
|
|
37826
|
+
}
|
|
37827
|
+
} else {
|
|
37828
|
+
console.warn('[Behavior] Output has neither state nor (child + conditions):', out);
|
|
37829
|
+
}
|
|
37830
|
+
} // end outputs loop
|
|
37831
|
+
} catch (err) {
|
|
37832
|
+
_iterator6.e(err);
|
|
37833
|
+
} finally {
|
|
37834
|
+
_iterator6.f();
|
|
37835
|
+
}
|
|
37494
37836
|
}
|
|
37495
37837
|
}
|
|
37496
37838
|
} catch (err) {
|
|
37497
|
-
|
|
37839
|
+
_iterator5.e(err);
|
|
37498
37840
|
} finally {
|
|
37499
|
-
|
|
37841
|
+
_iterator5.f();
|
|
37842
|
+
}
|
|
37843
|
+
}
|
|
37844
|
+
|
|
37845
|
+
/**
|
|
37846
|
+
* Safely evaluate a condition expression.
|
|
37847
|
+
*/
|
|
37848
|
+
}, {
|
|
37849
|
+
key: "_evaluateCondition",
|
|
37850
|
+
value: function _evaluateCondition(whenExpr, value) {
|
|
37851
|
+
try {
|
|
37852
|
+
var fn = new Function('state', "return (".concat(whenExpr, ");"));
|
|
37853
|
+
return fn({
|
|
37854
|
+
value: value
|
|
37855
|
+
});
|
|
37856
|
+
} catch (err) {
|
|
37857
|
+
console.warn("[IoBehaviorManager] Failed to evaluate condition: \"".concat(whenExpr, "\""), err);
|
|
37858
|
+
return false;
|
|
37859
|
+
}
|
|
37860
|
+
}
|
|
37861
|
+
|
|
37862
|
+
/**
|
|
37863
|
+
* Resolve target output mesh and apply actions.
|
|
37864
|
+
*/
|
|
37865
|
+
}, {
|
|
37866
|
+
key: "_applyCrossComponentActions",
|
|
37867
|
+
value: function _applyCrossComponentActions(output, actions) {
|
|
37868
|
+
var _this$sceneViewer2;
|
|
37869
|
+
if (!actions || !Array.isArray(actions)) return;
|
|
37870
|
+
|
|
37871
|
+
// 1. Resolve output component
|
|
37872
|
+
var scene = (_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.scene;
|
|
37873
|
+
if (!scene) return;
|
|
37874
|
+
var componentModel = scene.getObjectByProperty('uuid', output.component) || scene.getObjectByProperty('name', output.component);
|
|
37875
|
+
if (!componentModel) {
|
|
37876
|
+
console.warn("[IoBehaviorManager] Output component \"".concat(output.component, "\" not found in scene"));
|
|
37877
|
+
return;
|
|
37878
|
+
}
|
|
37879
|
+
|
|
37880
|
+
// 2. Resolve attachment model under the component
|
|
37881
|
+
var deviceRoot = null;
|
|
37882
|
+
componentModel.traverse(function (obj) {
|
|
37883
|
+
var _obj$userData3;
|
|
37884
|
+
if (!deviceRoot && ((_obj$userData3 = obj.userData) === null || _obj$userData3 === void 0 ? void 0 : _obj$userData3.attachmentId) === output.attachment) {
|
|
37885
|
+
deviceRoot = obj;
|
|
37886
|
+
}
|
|
37887
|
+
});
|
|
37888
|
+
if (!deviceRoot) {
|
|
37889
|
+
console.warn("[IoBehaviorManager] Output attachment \"".concat(output.attachment, "\" not found on component \"").concat(output.component, "\""));
|
|
37890
|
+
return;
|
|
37891
|
+
}
|
|
37892
|
+
|
|
37893
|
+
// 3. Resolve child mesh if specified
|
|
37894
|
+
var targetObj = deviceRoot;
|
|
37895
|
+
if (output.child) {
|
|
37896
|
+
var foundChild = null;
|
|
37897
|
+
deviceRoot.traverse(function (obj) {
|
|
37898
|
+
if (!foundChild && obj.name === output.child) {
|
|
37899
|
+
foundChild = obj;
|
|
37900
|
+
}
|
|
37901
|
+
});
|
|
37902
|
+
if (foundChild) {
|
|
37903
|
+
targetObj = foundChild;
|
|
37904
|
+
} else {
|
|
37905
|
+
console.warn("[IoBehaviorManager] Child \"".concat(output.child, "\" not found under attachment \"").concat(output.attachment, "\" on component \"").concat(output.component, "\""));
|
|
37906
|
+
return;
|
|
37907
|
+
}
|
|
37908
|
+
}
|
|
37909
|
+
|
|
37910
|
+
// 4. Apply actions to targetObj
|
|
37911
|
+
var _iterator8 = _createForOfIteratorHelper(actions),
|
|
37912
|
+
_step8;
|
|
37913
|
+
try {
|
|
37914
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
37915
|
+
var action = _step8.value;
|
|
37916
|
+
this._applyCrossComponentAction(targetObj, action);
|
|
37917
|
+
}
|
|
37918
|
+
} catch (err) {
|
|
37919
|
+
_iterator8.e(err);
|
|
37920
|
+
} finally {
|
|
37921
|
+
_iterator8.f();
|
|
37922
|
+
}
|
|
37923
|
+
}
|
|
37924
|
+
|
|
37925
|
+
/**
|
|
37926
|
+
* Apply a single action to the target mesh.
|
|
37927
|
+
*/
|
|
37928
|
+
}, {
|
|
37929
|
+
key: "_applyCrossComponentAction",
|
|
37930
|
+
value: function _applyCrossComponentAction(targetObj, action) {
|
|
37931
|
+
var set = action.set,
|
|
37932
|
+
value = action.value;
|
|
37933
|
+
if (!set) return;
|
|
37934
|
+
if (set.startsWith('material.')) {
|
|
37935
|
+
var prop = set.slice(9);
|
|
37936
|
+
targetObj.traverse(function (obj) {
|
|
37937
|
+
if (!obj.isMesh || !obj.material) return;
|
|
37938
|
+
if (!obj.userData._materialCloned) {
|
|
37939
|
+
obj.material = obj.material.clone();
|
|
37940
|
+
obj.userData._materialCloned = true;
|
|
37941
|
+
}
|
|
37942
|
+
try {
|
|
37943
|
+
if (prop === 'color') {
|
|
37944
|
+
obj.material.color.set(value);
|
|
37945
|
+
} else {
|
|
37946
|
+
if (prop in obj.material) {
|
|
37947
|
+
if (obj.material[prop] && typeof obj.material[prop].set === 'function') {
|
|
37948
|
+
obj.material[prop].set(value);
|
|
37949
|
+
} else {
|
|
37950
|
+
obj.material[prop] = value;
|
|
37951
|
+
}
|
|
37952
|
+
}
|
|
37953
|
+
}
|
|
37954
|
+
} catch (err) {
|
|
37955
|
+
console.warn("[IoBehaviorManager] Failed to set material property \"".concat(prop, "\""), err);
|
|
37956
|
+
}
|
|
37957
|
+
});
|
|
37958
|
+
} else if (set === 'visible') {
|
|
37959
|
+
targetObj.visible = !!value;
|
|
37960
|
+
} else {
|
|
37961
|
+
// General fallback path parsing (e.g. position.z)
|
|
37962
|
+
var parts = set.split('.');
|
|
37963
|
+
var current = targetObj;
|
|
37964
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
37965
|
+
if (current && current[parts[i]]) {
|
|
37966
|
+
current = current[parts[i]];
|
|
37967
|
+
} else {
|
|
37968
|
+
current = null;
|
|
37969
|
+
break;
|
|
37970
|
+
}
|
|
37971
|
+
}
|
|
37972
|
+
if (current) {
|
|
37973
|
+
var lastPart = parts[parts.length - 1];
|
|
37974
|
+
try {
|
|
37975
|
+
if (current[lastPart] && typeof current[lastPart].set === 'function') {
|
|
37976
|
+
current[lastPart].set(value);
|
|
37977
|
+
} else {
|
|
37978
|
+
current[lastPart] = value;
|
|
37979
|
+
}
|
|
37980
|
+
} catch (err) {
|
|
37981
|
+
console.warn("[IoBehaviorManager] Failed to set property \"".concat(set, "\""), err);
|
|
37982
|
+
}
|
|
37983
|
+
}
|
|
37500
37984
|
}
|
|
37501
37985
|
}
|
|
37502
37986
|
|
|
@@ -37526,7 +38010,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37526
38010
|
}, {
|
|
37527
38011
|
key: "getAnimationDataPoints",
|
|
37528
38012
|
value: function getAnimationDataPoints(parentUuid, attachmentId) {
|
|
37529
|
-
var
|
|
38013
|
+
var _this4 = this;
|
|
37530
38014
|
var hitMesh = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
37531
38015
|
var key = this._key(parentUuid, attachmentId);
|
|
37532
38016
|
var entries = this._entries.get(key);
|
|
@@ -37538,35 +38022,35 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37538
38022
|
var filtered = entries;
|
|
37539
38023
|
if (hitMesh) {
|
|
37540
38024
|
var matching = entries.filter(function (e) {
|
|
37541
|
-
return
|
|
38025
|
+
return _this4._isMeshOrDescendant(hitMesh, e.mesh);
|
|
37542
38026
|
});
|
|
37543
38027
|
if (matching.length > 0) filtered = matching;
|
|
37544
38028
|
}
|
|
37545
38029
|
|
|
37546
38030
|
// Collapse multiple mesh entries that share the same stateVariable
|
|
37547
38031
|
var seen = new Map(); // stateVariable → anim
|
|
37548
|
-
var
|
|
37549
|
-
|
|
38032
|
+
var _iterator9 = _createForOfIteratorHelper(filtered),
|
|
38033
|
+
_step9;
|
|
37550
38034
|
try {
|
|
37551
|
-
for (
|
|
37552
|
-
var anim =
|
|
38035
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
38036
|
+
var anim = _step9.value.anim;
|
|
37553
38037
|
if (!seen.has(anim.stateVariable)) {
|
|
37554
38038
|
seen.set(anim.stateVariable, anim);
|
|
37555
38039
|
}
|
|
37556
38040
|
}
|
|
37557
38041
|
} catch (err) {
|
|
37558
|
-
|
|
38042
|
+
_iterator9.e(err);
|
|
37559
38043
|
} finally {
|
|
37560
|
-
|
|
38044
|
+
_iterator9.f();
|
|
37561
38045
|
}
|
|
37562
38046
|
var dps = [];
|
|
37563
|
-
var
|
|
37564
|
-
|
|
38047
|
+
var _iterator0 = _createForOfIteratorHelper(seen),
|
|
38048
|
+
_step0;
|
|
37565
38049
|
try {
|
|
37566
|
-
for (
|
|
37567
|
-
var
|
|
37568
|
-
stateVar =
|
|
37569
|
-
_anim =
|
|
38050
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
38051
|
+
var _step0$value = _slicedToArray(_step0.value, 2),
|
|
38052
|
+
stateVar = _step0$value[0],
|
|
38053
|
+
_anim = _step0$value[1];
|
|
37570
38054
|
// Normalise stateType from AnimateDevicesDialog variants
|
|
37571
38055
|
var stateType = void 0;
|
|
37572
38056
|
var raw = (_anim.stateType || '').toLowerCase();
|
|
@@ -37617,9 +38101,9 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37617
38101
|
});
|
|
37618
38102
|
}
|
|
37619
38103
|
} catch (err) {
|
|
37620
|
-
|
|
38104
|
+
_iterator0.e(err);
|
|
37621
38105
|
} finally {
|
|
37622
|
-
|
|
38106
|
+
_iterator0.f();
|
|
37623
38107
|
}
|
|
37624
38108
|
return dps;
|
|
37625
38109
|
}
|
|
@@ -37654,19 +38138,19 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37654
38138
|
key: "unloadForComponent",
|
|
37655
38139
|
value: function unloadForComponent(parentUuid) {
|
|
37656
38140
|
var prefix = "".concat(parentUuid, "::");
|
|
37657
|
-
var
|
|
37658
|
-
|
|
38141
|
+
var _iterator1 = _createForOfIteratorHelper(this._entries.keys()),
|
|
38142
|
+
_step1;
|
|
37659
38143
|
try {
|
|
37660
|
-
for (
|
|
37661
|
-
var key =
|
|
38144
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
38145
|
+
var key = _step1.value;
|
|
37662
38146
|
if (key.startsWith(prefix)) {
|
|
37663
38147
|
this._entries.delete(key);
|
|
37664
38148
|
}
|
|
37665
38149
|
}
|
|
37666
38150
|
} catch (err) {
|
|
37667
|
-
|
|
38151
|
+
_iterator1.e(err);
|
|
37668
38152
|
} finally {
|
|
37669
|
-
|
|
38153
|
+
_iterator1.f();
|
|
37670
38154
|
}
|
|
37671
38155
|
}
|
|
37672
38156
|
}, {
|
|
@@ -37750,11 +38234,11 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37750
38234
|
var mapping = this._resolveMapping(anim, value);
|
|
37751
38235
|
if (!mapping) return;
|
|
37752
38236
|
var types = anim.transformTypes || [];
|
|
37753
|
-
var
|
|
37754
|
-
|
|
38237
|
+
var _iterator10 = _createForOfIteratorHelper(types),
|
|
38238
|
+
_step10;
|
|
37755
38239
|
try {
|
|
37756
|
-
for (
|
|
37757
|
-
var type =
|
|
38240
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
38241
|
+
var type = _step10.value;
|
|
37758
38242
|
if (type === 'translation') {
|
|
37759
38243
|
this._applyTranslation(mesh, origPos, mapping.transform);
|
|
37760
38244
|
} else if (type === 'rotation') {
|
|
@@ -37764,9 +38248,9 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37764
38248
|
}
|
|
37765
38249
|
}
|
|
37766
38250
|
} catch (err) {
|
|
37767
|
-
|
|
38251
|
+
_iterator10.e(err);
|
|
37768
38252
|
} finally {
|
|
37769
|
-
|
|
38253
|
+
_iterator10.f();
|
|
37770
38254
|
}
|
|
37771
38255
|
}
|
|
37772
38256
|
|
|
@@ -38424,12 +38908,10 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
38424
38908
|
if (this.centralPlant.sceneViewer.$refs.container && this.centralPlant.sceneViewer.camera && this.centralPlant.sceneViewer.scene) {
|
|
38425
38909
|
this.centralPlant.managers.tooltipsManager = new SceneTooltipsManager(this.centralPlant.sceneViewer.$refs.container, this.centralPlant.sceneViewer.camera, this.centralPlant.sceneViewer.scene);
|
|
38426
38910
|
this.centralPlant.sceneViewer.tooltipsManager = this.centralPlant.managers.tooltipsManager;
|
|
38427
|
-
console.log('🔍 Tooltip manager initialized:', this.centralPlant.managers.tooltipsManager);
|
|
38428
38911
|
|
|
38429
38912
|
// Initialize the component tooltip manager (screen-space tooltip on selection)
|
|
38430
38913
|
this.centralPlant.managers.componentTooltipManager = new ComponentTooltipManager(this.centralPlant.sceneViewer);
|
|
38431
38914
|
this.centralPlant.sceneViewer.componentTooltipManager = this.centralPlant.managers.componentTooltipManager;
|
|
38432
|
-
console.log('🔍 Component tooltip manager initialized');
|
|
38433
38915
|
}
|
|
38434
38916
|
}
|
|
38435
38917
|
|
|
@@ -39362,6 +39844,12 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
39362
39844
|
for (var _i = 0, _Object$entries = Object.entries(componentData.attachedDevices); _i < _Object$entries.length; _i++) {
|
|
39363
39845
|
if (_loop()) continue;
|
|
39364
39846
|
}
|
|
39847
|
+
|
|
39848
|
+
// Register component-level behaviors (intra-component io-device linking)
|
|
39849
|
+
if (componentData.behaviors && componentData.behaviors.length > 0) {
|
|
39850
|
+
// Registering ${componentData.behaviors.length} component-level behavior(s)
|
|
39851
|
+
ioBehavMgr.registerComponentBehaviors(componentId, componentData.behaviors);
|
|
39852
|
+
}
|
|
39365
39853
|
}
|
|
39366
39854
|
}
|
|
39367
39855
|
|
|
@@ -39663,7 +40151,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
39663
40151
|
* Initialize the CentralPlant manager
|
|
39664
40152
|
*
|
|
39665
40153
|
* @constructor
|
|
39666
|
-
* @version 0.3.
|
|
40154
|
+
* @version 0.3.36
|
|
39667
40155
|
* @updated 2025-10-22
|
|
39668
40156
|
*
|
|
39669
40157
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -39837,7 +40325,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
39837
40325
|
key: "setImportedSceneData",
|
|
39838
40326
|
value: (function () {
|
|
39839
40327
|
var _setImportedSceneData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(sceneData) {
|
|
39840
|
-
var _this$importedSceneDa, _this$importedSceneDa2;
|
|
40328
|
+
var _this$importedSceneDa, _this$importedSceneDa2, _this$importedSceneDa3, _this$sceneViewer;
|
|
40329
|
+
var ioBehavMgr;
|
|
39841
40330
|
return _regenerator().w(function (_context2) {
|
|
39842
40331
|
while (1) switch (_context2.n) {
|
|
39843
40332
|
case 0:
|
|
@@ -39848,9 +40337,21 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
39848
40337
|
console.log('📥 Imported scene data stored in CentralPlant:', {
|
|
39849
40338
|
connections: ((_this$importedSceneDa = this.importedSceneData.connections) === null || _this$importedSceneDa === void 0 ? void 0 : _this$importedSceneDa.length) || 0,
|
|
39850
40339
|
sceneObjects: ((_this$importedSceneDa2 = this.importedSceneData.scene) === null || _this$importedSceneDa2 === void 0 || (_this$importedSceneDa2 = _this$importedSceneDa2.children) === null || _this$importedSceneDa2 === void 0 ? void 0 : _this$importedSceneDa2.length) || 0,
|
|
40340
|
+
behaviors: ((_this$importedSceneDa3 = this.importedSceneData.behaviors) === null || _this$importedSceneDa3 === void 0 ? void 0 : _this$importedSceneDa3.length) || 0,
|
|
39851
40341
|
timestamp: new Date().toISOString()
|
|
39852
40342
|
});
|
|
39853
40343
|
|
|
40344
|
+
// Scene behaviors loaded
|
|
40345
|
+
|
|
40346
|
+
// Register behaviors with IoBehaviorManager
|
|
40347
|
+
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;
|
|
40348
|
+
if (ioBehavMgr) {
|
|
40349
|
+
// Setting cross-component behaviors
|
|
40350
|
+
ioBehavMgr.setCrossComponentBehaviors(this.importedSceneData.behaviors || []);
|
|
40351
|
+
} else {
|
|
40352
|
+
console.warn('[Behavior] ioBehaviorManager not available!');
|
|
40353
|
+
}
|
|
40354
|
+
|
|
39854
40355
|
// Reset component counter based on imported components to avoid ID conflicts
|
|
39855
40356
|
this.internals.resetComponentCounter();
|
|
39856
40357
|
case 2:
|
|
@@ -40030,8 +40531,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40030
40531
|
}, {
|
|
40031
40532
|
key: "selectObject",
|
|
40032
40533
|
value: function selectObject(objectOrId) {
|
|
40033
|
-
var _this$
|
|
40034
|
-
if (!((_this$
|
|
40534
|
+
var _this$sceneViewer2, _object;
|
|
40535
|
+
if (!((_this$sceneViewer2 = this.sceneViewer) !== null && _this$sceneViewer2 !== void 0 && _this$sceneViewer2.transformManager)) {
|
|
40035
40536
|
console.warn('⚠️ Transform manager not initialized');
|
|
40036
40537
|
return false;
|
|
40037
40538
|
}
|
|
@@ -40077,8 +40578,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40077
40578
|
}, {
|
|
40078
40579
|
key: "toggleObject",
|
|
40079
40580
|
value: function toggleObject(objectOrId) {
|
|
40080
|
-
var _this$
|
|
40081
|
-
if (!((_this$
|
|
40581
|
+
var _this$sceneViewer3, _object2;
|
|
40582
|
+
if (!((_this$sceneViewer3 = this.sceneViewer) !== null && _this$sceneViewer3 !== void 0 && _this$sceneViewer3.transformManager)) {
|
|
40082
40583
|
console.warn('⚠️ Transform manager not initialized');
|
|
40083
40584
|
return false;
|
|
40084
40585
|
}
|
|
@@ -40114,8 +40615,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40114
40615
|
}, {
|
|
40115
40616
|
key: "deselectObject",
|
|
40116
40617
|
value: function deselectObject() {
|
|
40117
|
-
var _this$
|
|
40118
|
-
if (!((_this$
|
|
40618
|
+
var _this$sceneViewer4;
|
|
40619
|
+
if (!((_this$sceneViewer4 = this.sceneViewer) !== null && _this$sceneViewer4 !== void 0 && _this$sceneViewer4.transformManager)) {
|
|
40119
40620
|
console.warn('⚠️ Transform manager not initialized');
|
|
40120
40621
|
return false;
|
|
40121
40622
|
}
|
|
@@ -40344,7 +40845,6 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40344
40845
|
|
|
40345
40846
|
// Enable drag functionality for the specific element
|
|
40346
40847
|
this.sceneViewer.managers.componentDragManager.enableElementDrag(element, componentId);
|
|
40347
|
-
console.log("\u2705 enableDragDrop(): Enabled drag and drop for ".concat(componentId));
|
|
40348
40848
|
return true;
|
|
40349
40849
|
} catch (error) {
|
|
40350
40850
|
console.error('❌ enableDragDrop(): Error enabling drag and drop:', error);
|
|
@@ -40380,7 +40880,6 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40380
40880
|
}
|
|
40381
40881
|
try {
|
|
40382
40882
|
this.sceneViewer.managers.componentDragManager.disableElementDrag(element);
|
|
40383
|
-
console.log('✅ disableDragDrop(): Disabled drag and drop for element');
|
|
40384
40883
|
return true;
|
|
40385
40884
|
} catch (error) {
|
|
40386
40885
|
console.error('❌ disableDragDrop(): Error disabling drag and drop:', error);
|
|
@@ -40414,7 +40913,6 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40414
40913
|
if (this.sceneViewer.managers.componentDragManager) {
|
|
40415
40914
|
this.sceneViewer.managers.componentDragManager.setEnabled(enabled);
|
|
40416
40915
|
}
|
|
40417
|
-
console.log("\u2705 setDragDropEnabled(): Drag and drop ".concat(enabled ? 'enabled' : 'disabled'));
|
|
40418
40916
|
return true;
|
|
40419
40917
|
} catch (error) {
|
|
40420
40918
|
console.error('❌ setDragDropEnabled(): Error setting drag and drop state:', error);
|
|
@@ -40729,9 +41227,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40729
41227
|
}, {
|
|
40730
41228
|
key: "setIoDeviceState",
|
|
40731
41229
|
value: function setIoDeviceState(attachmentId, stateId, value, parentUuid) {
|
|
40732
|
-
var _this$
|
|
41230
|
+
var _this$sceneViewer5, _this$sceneViewer6, _this$sceneViewer7;
|
|
40733
41231
|
// 1. Persist via state adapter if one has been configured
|
|
40734
|
-
var stateAdapter = (_this$
|
|
41232
|
+
var stateAdapter = (_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.componentTooltipManager) === null || _this$sceneViewer5 === void 0 ? void 0 : _this$sceneViewer5._stateAdapter;
|
|
40735
41233
|
if (stateAdapter !== null && stateAdapter !== void 0 && stateAdapter.setState) {
|
|
40736
41234
|
var scopedKey = parentUuid ? "".concat(parentUuid, "::").concat(attachmentId) : attachmentId;
|
|
40737
41235
|
try {
|
|
@@ -40742,10 +41240,19 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40742
41240
|
}
|
|
40743
41241
|
|
|
40744
41242
|
// 2. Apply io-behavior changes
|
|
40745
|
-
(_this$
|
|
41243
|
+
var ioBehavMgr = (_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.managers) === null || _this$sceneViewer6 === void 0 ? void 0 : _this$sceneViewer6.ioBehaviorManager;
|
|
41244
|
+
if (ioBehavMgr) {
|
|
41245
|
+
var _this$importedSceneDa4;
|
|
41246
|
+
ioBehavMgr.triggerState(attachmentId, stateId, value, parentUuid);
|
|
41247
|
+
|
|
41248
|
+
// Evaluate cross-component behaviors if they exist in the imported scene
|
|
41249
|
+
if ((_this$importedSceneDa4 = this.importedSceneData) !== null && _this$importedSceneDa4 !== void 0 && _this$importedSceneDa4.behaviors) {
|
|
41250
|
+
ioBehavMgr.triggerCrossComponentBehaviors(this.importedSceneData.behaviors, parentUuid, attachmentId, stateId, value);
|
|
41251
|
+
}
|
|
41252
|
+
}
|
|
40746
41253
|
|
|
40747
41254
|
// 3. Emit event for host apps that don't use the state adapter (e.g. cp3d-viewer)
|
|
40748
|
-
(_this$
|
|
41255
|
+
(_this$sceneViewer7 = this.sceneViewer) === null || _this$sceneViewer7 === void 0 || _this$sceneViewer7.emit('io-device-state-changed', {
|
|
40749
41256
|
attachmentId: attachmentId,
|
|
40750
41257
|
stateId: stateId,
|
|
40751
41258
|
value: value,
|
|
@@ -40767,8 +41274,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40767
41274
|
}, {
|
|
40768
41275
|
key: "getSceneAttachments",
|
|
40769
41276
|
value: function getSceneAttachments() {
|
|
40770
|
-
var _this$
|
|
40771
|
-
var scene = (_this$
|
|
41277
|
+
var _this$sceneViewer8;
|
|
41278
|
+
var scene = (_this$sceneViewer8 = this.sceneViewer) === null || _this$sceneViewer8 === void 0 ? void 0 : _this$sceneViewer8.scene;
|
|
40772
41279
|
if (!scene) return [];
|
|
40773
41280
|
var results = [];
|
|
40774
41281
|
scene.traverse(function (obj) {
|
|
@@ -42395,7 +42902,12 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
42395
42902
|
}, {
|
|
42396
42903
|
key: "clearScene",
|
|
42397
42904
|
value: function clearScene() {
|
|
42905
|
+
var _this$sceneViewer9;
|
|
42398
42906
|
this.importedSceneData = null;
|
|
42907
|
+
var ioBehavMgr = (_this$sceneViewer9 = this.sceneViewer) === null || _this$sceneViewer9 === void 0 || (_this$sceneViewer9 = _this$sceneViewer9.managers) === null || _this$sceneViewer9 === void 0 ? void 0 : _this$sceneViewer9.ioBehaviorManager;
|
|
42908
|
+
if (ioBehavMgr) {
|
|
42909
|
+
ioBehavMgr.setCrossComponentBehaviors([]);
|
|
42910
|
+
}
|
|
42399
42911
|
if (this.sceneViewer && this.sceneViewer.scene) {
|
|
42400
42912
|
this.sceneViewer.scene.clear();
|
|
42401
42913
|
}
|
|
@@ -42905,28 +43417,10 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
42905
43417
|
},
|
|
42906
43418
|
onIODeviceDrag: function onIODeviceDrag(ioDeviceObject, signedDelta, isStart, hitMesh) {
|
|
42907
43419
|
if (isStart) {
|
|
42908
|
-
var
|
|
42909
|
-
//
|
|
42910
|
-
|
|
42911
|
-
|
|
42912
|
-
var parentUuid = null;
|
|
42913
|
-
var obj = ioDeviceObject.parent;
|
|
42914
|
-
while (obj) {
|
|
42915
|
-
var _obj$userData;
|
|
42916
|
-
if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'component') {
|
|
42917
|
-
parentUuid = obj.userData.originalUuid || obj.uuid;
|
|
42918
|
-
break;
|
|
42919
|
-
}
|
|
42920
|
-
obj = obj.parent;
|
|
42921
|
-
}
|
|
42922
|
-
var attachmentId = (_ioDeviceObject$userD = ioDeviceObject.userData) === null || _ioDeviceObject$userD === void 0 ? void 0 : _ioDeviceObject$userD.attachmentId;
|
|
42923
|
-
// When animated meshes are available, outline ONLY them so their
|
|
42924
|
-
// silhouette is isolated and the outline ring is visible around
|
|
42925
|
-
// them specifically (not swallowed by the larger device body).
|
|
42926
|
-
// Fall back to the whole device group when none are registered.
|
|
42927
|
-
var animatedMeshes = attachmentId && parentUuid ? (_this4$managers$ioBeh = (_this4$managers = _this4.managers) === null || _this4$managers === void 0 || (_this4$managers = _this4$managers.ioBehaviorManager) === null || _this4$managers === void 0 ? void 0 : _this4$managers.getAnimatedMeshes(parentUuid, attachmentId)) !== null && _this4$managers$ioBeh !== void 0 ? _this4$managers$ioBeh : [] : [];
|
|
42928
|
-
var targets = animatedMeshes.length > 0 ? animatedMeshes : [ioDeviceObject];
|
|
42929
|
-
(_this4$managers2 = _this4.managers) === null || _this4$managers2 === void 0 || (_this4$managers2 = _this4$managers2.ioOutlineManager) === null || _this4$managers2 === void 0 || _this4$managers2.setTargets(targets);
|
|
43420
|
+
var _this4$managers;
|
|
43421
|
+
// Outline only the specific mesh that was clicked
|
|
43422
|
+
var targets = hitMesh ? [hitMesh] : [ioDeviceObject];
|
|
43423
|
+
(_this4$managers = _this4.managers) === null || _this4$managers === void 0 || (_this4$managers = _this4$managers.ioOutlineManager) === null || _this4$managers === void 0 || _this4$managers.setTargets(targets);
|
|
42930
43424
|
}
|
|
42931
43425
|
if (!_this4.componentTooltipManager) return;
|
|
42932
43426
|
if (isStart) {
|
|
@@ -42936,8 +43430,8 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
42936
43430
|
}
|
|
42937
43431
|
},
|
|
42938
43432
|
onIODeviceDragEnd: function onIODeviceDragEnd(ioDeviceObject) {
|
|
42939
|
-
var _this4$
|
|
42940
|
-
(_this4$
|
|
43433
|
+
var _this4$managers2;
|
|
43434
|
+
(_this4$managers2 = _this4.managers) === null || _this4$managers2 === void 0 || (_this4$managers2 = _this4$managers2.ioOutlineManager) === null || _this4$managers2 === void 0 || _this4$managers2.setTargets([]);
|
|
42941
43435
|
if (_this4.componentTooltipManager) {
|
|
42942
43436
|
_this4.componentTooltipManager.endIODeviceDrag();
|
|
42943
43437
|
}
|
|
@@ -45663,7 +46157,6 @@ function _findInAllCachePartitions() {
|
|
|
45663
46157
|
_context16.n = 7;
|
|
45664
46158
|
break;
|
|
45665
46159
|
}
|
|
45666
|
-
console.log("\u2705 [findInAllCachePartitions] Found in ".concat(cacheName, " (exact match): ").concat(cacheKey.substring(0, 80), "..."));
|
|
45667
46160
|
return _context16.a(2, response);
|
|
45668
46161
|
case 7:
|
|
45669
46162
|
if (!(encodedCacheKey !== cacheKey)) {
|
|
@@ -45678,7 +46171,6 @@ function _findInAllCachePartitions() {
|
|
|
45678
46171
|
_context16.n = 9;
|
|
45679
46172
|
break;
|
|
45680
46173
|
}
|
|
45681
|
-
console.log("\u2705 [findInAllCachePartitions] Found in ".concat(cacheName, " (encoded match): ").concat(encodedCacheKey.substring(0, 80), "..."));
|
|
45682
46174
|
return _context16.a(2, response);
|
|
45683
46175
|
case 9:
|
|
45684
46176
|
_context16.n = 4;
|
|
@@ -45713,8 +46205,6 @@ function _getCachedS3Object() {
|
|
|
45713
46205
|
cachedResponse,
|
|
45714
46206
|
cachedTime,
|
|
45715
46207
|
age,
|
|
45716
|
-
_allKeys,
|
|
45717
|
-
matchingKeys,
|
|
45718
46208
|
_args19 = arguments;
|
|
45719
46209
|
return _regenerator().w(function (_context19) {
|
|
45720
46210
|
while (1) switch (_context19.n) {
|
|
@@ -45722,50 +46212,26 @@ function _getCachedS3Object() {
|
|
|
45722
46212
|
storageOptions = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
45723
46213
|
expiryMs = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : null;
|
|
45724
46214
|
cacheKey = "https://s3.cache/".concat(s3Key);
|
|
45725
|
-
expiry = expiryMs || cacheManager.getExpiryForPath(s3Key);
|
|
45726
|
-
console.log("\uD83D\uDD0D [S3Cache] Checking for cached S3 object:", {
|
|
45727
|
-
s3Key: s3Key,
|
|
45728
|
-
cacheKey: cacheKey
|
|
45729
|
-
});
|
|
45730
|
-
|
|
45731
|
-
// First, check ALL app cache partitions for a hit (handles auth race condition)
|
|
46215
|
+
expiry = expiryMs || cacheManager.getExpiryForPath(s3Key); // First, check ALL app cache partitions for a hit (handles auth race condition)
|
|
45732
46216
|
_context19.n = 1;
|
|
45733
46217
|
return findInAllCachePartitions(cacheKey);
|
|
45734
46218
|
case 1:
|
|
45735
46219
|
cachedResponse = _context19.v;
|
|
45736
46220
|
if (!cachedResponse) {
|
|
45737
|
-
_context19.n =
|
|
46221
|
+
_context19.n = 3;
|
|
45738
46222
|
break;
|
|
45739
46223
|
}
|
|
45740
46224
|
cachedTime = cachedResponse.headers.get('x-cached-time');
|
|
45741
46225
|
age = Date.now() - parseInt(cachedTime || '0');
|
|
45742
|
-
console.log("\u2705 [S3Cache] Found in cache partition, age: ".concat(Math.round(age / 1000), "s, expiry: ").concat(Math.round(expiry / 1000), "s"));
|
|
45743
46226
|
if (!(age < expiry)) {
|
|
45744
46227
|
_context19.n = 3;
|
|
45745
46228
|
break;
|
|
45746
46229
|
}
|
|
45747
|
-
console.log("\u2705 [S3Cache] Returning cached blob for: ".concat(s3Key));
|
|
45748
46230
|
_context19.n = 2;
|
|
45749
46231
|
return cachedResponse.blob();
|
|
45750
46232
|
case 2:
|
|
45751
46233
|
return _context19.a(2, _context19.v);
|
|
45752
46234
|
case 3:
|
|
45753
|
-
console.log("\u23F0 [S3Cache] Cache entry expired, will re-fetch");
|
|
45754
|
-
_context19.n = 6;
|
|
45755
|
-
break;
|
|
45756
|
-
case 4:
|
|
45757
|
-
console.log("\u274C [S3Cache] Not found in any cache partition");
|
|
45758
|
-
_context19.n = 5;
|
|
45759
|
-
return getAllCacheKeys();
|
|
45760
|
-
case 5:
|
|
45761
|
-
_allKeys = _context19.v;
|
|
45762
|
-
matchingKeys = _toConsumableArray(_allKeys).filter(function (k) {
|
|
45763
|
-
return k.includes('24dd6a7a') || k.includes('.glb');
|
|
45764
|
-
});
|
|
45765
|
-
if (matchingKeys.length > 0) {
|
|
45766
|
-
console.log("\uD83D\uDD0D [S3Cache] Available GLB cache keys:", matchingKeys.slice(0, 5));
|
|
45767
|
-
}
|
|
45768
|
-
case 6:
|
|
45769
46235
|
return _context19.a(2, cacheManager.execute({
|
|
45770
46236
|
cacheKey: cacheKey,
|
|
45771
46237
|
sourceKey: s3Key,
|
|
@@ -45924,7 +46390,6 @@ function _preloadS3Objects() {
|
|
|
45924
46390
|
};
|
|
45925
46391
|
}()));
|
|
45926
46392
|
case 1:
|
|
45927
|
-
console.log("\u2705 Preload complete: ".concat(results.success, " success, ").concat(results.failed, " failed"));
|
|
45928
46393
|
return _context22.a(2, results);
|
|
45929
46394
|
}
|
|
45930
46395
|
}, _callee22);
|
|
@@ -46102,7 +46567,6 @@ function _preloadLocalFiles() {
|
|
|
46102
46567
|
return _regenerator().w(function (_context29) {
|
|
46103
46568
|
while (1) switch (_context29.n) {
|
|
46104
46569
|
case 0:
|
|
46105
|
-
console.log("preloadLocalFiles started");
|
|
46106
46570
|
results = {
|
|
46107
46571
|
success: 0,
|
|
46108
46572
|
failed: 0,
|
|
@@ -46141,7 +46605,6 @@ function _preloadLocalFiles() {
|
|
|
46141
46605
|
};
|
|
46142
46606
|
}()));
|
|
46143
46607
|
case 1:
|
|
46144
|
-
console.log("preloadLocalFiles finished");
|
|
46145
46608
|
if (results.failed > 0) {
|
|
46146
46609
|
console.warn("\u26A0\uFE0F preloadLocalFiles Cache priming finished with errors: ".concat(results.failed, " failed"), results.errors);
|
|
46147
46610
|
}
|
|
@@ -46803,7 +47266,6 @@ var S3MetadataCacheService = /*#__PURE__*/function () {
|
|
|
46803
47266
|
// Update memory cache
|
|
46804
47267
|
this._memoryCache = metadata;
|
|
46805
47268
|
this._memoryCacheTime = Date.now();
|
|
46806
|
-
console.log("\uD83D\uDCBE S3MetadataCacheService: Set ".concat(components.length, " components"));
|
|
46807
47269
|
return _context9.a(2, true);
|
|
46808
47270
|
case 4:
|
|
46809
47271
|
_context9.p = 4;
|