@2112-lab/central-plant 0.3.27 → 0.3.29
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 +82 -911
- package/dist/cjs/src/core/centralPlant.js +8 -115
- package/dist/cjs/src/core/centralPlantInternals.js +13 -24
- package/dist/cjs/src/core/sceneViewer.js +4 -4
- package/dist/cjs/src/index.js +2 -4
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +571 -0
- package/dist/cjs/src/managers/scene/componentTooltipManager.js +17 -24
- package/dist/cjs/src/managers/scene/modelManager.js +8 -8
- package/dist/cjs/src/managers/scene/sceneExportManager.js +3 -29
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +12 -289
- package/dist/esm/src/core/centralPlant.js +8 -115
- package/dist/esm/src/core/centralPlantInternals.js +13 -24
- package/dist/esm/src/core/sceneViewer.js +4 -4
- package/dist/esm/src/index.js +1 -2
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +547 -0
- package/dist/esm/src/managers/scene/componentTooltipManager.js +17 -24
- package/dist/esm/src/managers/scene/modelManager.js +8 -8
- package/dist/esm/src/managers/scene/sceneExportManager.js +4 -30
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +12 -289
- package/package.json +1 -1
|
@@ -129,7 +129,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
129
129
|
}, {
|
|
130
130
|
key: "toggleIODeviceBinaryState",
|
|
131
131
|
value: function toggleIODeviceBinaryState(ioDeviceObject) {
|
|
132
|
-
var _ref, _this$sceneViewer
|
|
132
|
+
var _ref, _this$sceneViewer;
|
|
133
133
|
if (!ioDeviceObject || !this._stateAdapter) return;
|
|
134
134
|
var ud = ioDeviceObject.userData;
|
|
135
135
|
var attachmentId = ud === null || ud === void 0 ? void 0 : ud.attachmentId;
|
|
@@ -163,8 +163,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
163
163
|
var currentVal = (_ref = storedVal !== null && storedVal !== void 0 ? storedVal : binaryState.defaultValue) !== null && _ref !== void 0 ? _ref : false;
|
|
164
164
|
var newVal = !Boolean(currentVal);
|
|
165
165
|
this._stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
166
|
-
(_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.
|
|
167
|
-
(_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.managers) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.ioAnimationManager) === null || _this$sceneViewer2 === void 0 || _this$sceneViewer2.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
166
|
+
(_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.ioBehaviorManager) === null || _this$sceneViewer === void 0 || _this$sceneViewer.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
168
167
|
console.log("\uD83D\uDD04 [IODevice] Toggled ".concat(scopedAttachmentId, ".").concat(dpId, ": ").concat(currentVal, " \u2192 ").concat(newVal));
|
|
169
168
|
}
|
|
170
169
|
|
|
@@ -180,7 +179,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
180
179
|
}, {
|
|
181
180
|
key: "startIODeviceDrag",
|
|
182
181
|
value: function startIODeviceDrag(ioDeviceObject) {
|
|
183
|
-
var _this$
|
|
182
|
+
var _this$sceneViewer2,
|
|
184
183
|
_this2 = this;
|
|
185
184
|
if (!ioDeviceObject || !this._stateAdapter) return;
|
|
186
185
|
var ud = ioDeviceObject.userData;
|
|
@@ -197,8 +196,8 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
197
196
|
obj = obj.parent;
|
|
198
197
|
}
|
|
199
198
|
var scopedAttachmentId = this._getScopedAttachmentKey(attachmentId, parentUuid);
|
|
200
|
-
var
|
|
201
|
-
var dataPoints = ((
|
|
199
|
+
var ioBehavMgr = (_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.managers) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.ioBehaviorManager;
|
|
200
|
+
var dataPoints = ((ioBehavMgr === null || ioBehavMgr === void 0 ? void 0 : ioBehavMgr.getAnimationDataPoints(parentUuid, attachmentId)) || []).concat((ud === null || ud === void 0 ? void 0 : ud.dataPoints) || [])
|
|
202
201
|
// deduplicate by id
|
|
203
202
|
.filter(function (dp, i, arr) {
|
|
204
203
|
return arr.findIndex(function (d) {
|
|
@@ -320,15 +319,14 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
320
319
|
}, {
|
|
321
320
|
key: "_applyDpState",
|
|
322
321
|
value: function _applyDpState(_ref2, newVal) {
|
|
323
|
-
var _this$_stateAdapter, _this$
|
|
322
|
+
var _this$_stateAdapter, _this$sceneViewer3;
|
|
324
323
|
var scopedAttachmentId = _ref2.scopedAttachmentId,
|
|
325
324
|
attachmentId = _ref2.attachmentId,
|
|
326
325
|
parentUuid = _ref2.parentUuid,
|
|
327
326
|
dp = _ref2.dp;
|
|
328
327
|
var dpId = dp.id;
|
|
329
328
|
(_this$_stateAdapter = this._stateAdapter) === null || _this$_stateAdapter === void 0 || _this$_stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
330
|
-
(_this$
|
|
331
|
-
(_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.ioAnimationManager) === null || _this$sceneViewer5 === void 0 || _this$sceneViewer5.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
329
|
+
(_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.managers) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.ioBehaviorManager) === null || _this$sceneViewer3 === void 0 || _this$sceneViewer3.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
332
330
|
}
|
|
333
331
|
|
|
334
332
|
/**
|
|
@@ -453,11 +451,11 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
453
451
|
var _this3$sceneViewer$ma, _this3$sceneViewer;
|
|
454
452
|
var attachmentId = child.userData.attachmentId || '';
|
|
455
453
|
|
|
456
|
-
// Use only data points from the animate window (
|
|
454
|
+
// Use only data points from the animate window (behaviorConfig).
|
|
457
455
|
// The static ioConfig.states[] snapshot on userData is intentionally ignored.
|
|
458
|
-
var dataPoints = (_this3$sceneViewer$ma = (_this3$sceneViewer = _this3.sceneViewer) === null || _this3$sceneViewer === void 0 || (_this3$sceneViewer = _this3$sceneViewer.managers) === null || _this3$sceneViewer === void 0 || (_this3$sceneViewer = _this3$sceneViewer.
|
|
456
|
+
var dataPoints = (_this3$sceneViewer$ma = (_this3$sceneViewer = _this3.sceneViewer) === null || _this3$sceneViewer === void 0 || (_this3$sceneViewer = _this3$sceneViewer.managers) === null || _this3$sceneViewer === void 0 || (_this3$sceneViewer = _this3$sceneViewer.ioBehaviorManager) === null || _this3$sceneViewer === void 0 ? void 0 : _this3$sceneViewer.getAnimationDataPoints(parentUuid, attachmentId)) !== null && _this3$sceneViewer$ma !== void 0 ? _this3$sceneViewer$ma : [];
|
|
459
457
|
|
|
460
|
-
// When data points come from
|
|
458
|
+
// When data points come from behaviorConfig they already carry direction:'input'.
|
|
461
459
|
// Pass null so _buildDataPointRow uses the per-dp direction instead of the
|
|
462
460
|
// device-level ioDirection (which may be 'output' and would hide controls).
|
|
463
461
|
var deviceDirection = dataPoints.length > 0 ? null : child.userData.ioDirection || 'output';
|
|
@@ -611,11 +609,11 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
611
609
|
}, {
|
|
612
610
|
key: "_positionTooltip",
|
|
613
611
|
value: function _positionTooltip() {
|
|
614
|
-
var _this$
|
|
612
|
+
var _this$sceneViewer4, _this$sceneViewer5;
|
|
615
613
|
if (!this.tooltipEl || !this.selectedObject) return;
|
|
616
614
|
var container = this._getContainer();
|
|
617
|
-
var camera = (_this$
|
|
618
|
-
var renderer = (_this$
|
|
615
|
+
var camera = (_this$sceneViewer4 = this.sceneViewer) === null || _this$sceneViewer4 === void 0 ? void 0 : _this$sceneViewer4.camera;
|
|
616
|
+
var renderer = (_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 ? void 0 : _this$sceneViewer5.renderer;
|
|
619
617
|
if (!container || !camera || !renderer) return;
|
|
620
618
|
|
|
621
619
|
// Compute bounding box to position above the component
|
|
@@ -652,8 +650,8 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
652
650
|
}, {
|
|
653
651
|
key: "_getContainer",
|
|
654
652
|
value: function _getContainer() {
|
|
655
|
-
var _this$
|
|
656
|
-
return ((_this$
|
|
653
|
+
var _this$sceneViewer6;
|
|
654
|
+
return ((_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.renderer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.domElement) === null || _this$sceneViewer6 === void 0 ? void 0 : _this$sceneViewer6.parentElement) || null;
|
|
657
655
|
}
|
|
658
656
|
|
|
659
657
|
// -----------------------------------------------------------------------
|
|
@@ -693,15 +691,10 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
693
691
|
var currentVal = (_ref3 = (_this$_stateAdapter$g = (_this$_stateAdapter2 = this._stateAdapter) === null || _this$_stateAdapter2 === void 0 ? void 0 : _this$_stateAdapter2.getState(scopedAttachmentId, dpId)) !== null && _this$_stateAdapter$g !== void 0 ? _this$_stateAdapter$g : dp.defaultValue) !== null && _ref3 !== void 0 ? _ref3 : null;
|
|
694
692
|
if (isInput) {
|
|
695
693
|
var ctrl = this._buildInputControl(dp, currentVal, function (newVal) {
|
|
696
|
-
var _this5$_stateAdapter, _this5$selectedObject, _this5$sceneViewer
|
|
694
|
+
var _this5$_stateAdapter, _this5$selectedObject, _this5$sceneViewer;
|
|
697
695
|
(_this5$_stateAdapter = _this5._stateAdapter) === null || _this5$_stateAdapter === void 0 || _this5$_stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
698
|
-
// Also fire BehaviorManager so any wired behaviors react immediately.
|
|
699
|
-
// Pass the parent component UUID so behaviors scoped to a specific instance
|
|
700
|
-
// don't bleed across clones that share the same attachmentId.
|
|
701
|
-
// Use originalAttachmentId for behavior triggering as behaviors are keyed by original ID
|
|
702
696
|
var parentUuid = ((_this5$selectedObject = _this5.selectedObject) === null || _this5$selectedObject === void 0 ? void 0 : _this5$selectedObject.uuid) || null;
|
|
703
|
-
(_this5$sceneViewer = _this5.sceneViewer) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.managers) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.
|
|
704
|
-
(_this5$sceneViewer2 = _this5.sceneViewer) === null || _this5$sceneViewer2 === void 0 || (_this5$sceneViewer2 = _this5$sceneViewer2.managers) === null || _this5$sceneViewer2 === void 0 || (_this5$sceneViewer2 = _this5$sceneViewer2.ioAnimationManager) === null || _this5$sceneViewer2 === void 0 || _this5$sceneViewer2.triggerState(originalAttachmentId || scopedAttachmentId, dpId, newVal, parentUuid);
|
|
697
|
+
(_this5$sceneViewer = _this5.sceneViewer) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.managers) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.ioBehaviorManager) === null || _this5$sceneViewer === void 0 || _this5$sceneViewer.triggerState(originalAttachmentId || scopedAttachmentId, dpId, newVal, parentUuid);
|
|
705
698
|
});
|
|
706
699
|
row.appendChild(ctrl);
|
|
707
700
|
this._stateElements.set(key, {
|
|
@@ -77,7 +77,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
77
77
|
key: "loadLibraryModel",
|
|
78
78
|
value: function () {
|
|
79
79
|
var _loadLibraryModel = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee(targetMesh, jsonEntry, componentData) {
|
|
80
|
-
var component, _jsonEntry$userData, _jsonEntry$userData2, _jsonEntry$userData3, originalProps, connectorChildren, gltfScene, libraryModel, _this$sceneViewer,
|
|
80
|
+
var component, _jsonEntry$userData, _jsonEntry$userData2, _jsonEntry$userData3, originalProps, connectorChildren, gltfScene, libraryModel, _this$sceneViewer, ioBehavMgr, _loop, _i, _Object$entries, warmFn, _jsonEntry$userData4, _t;
|
|
81
81
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context2) {
|
|
82
82
|
while (1) switch (_context2.n) {
|
|
83
83
|
case 0:
|
|
@@ -120,22 +120,22 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
120
120
|
_context2.n = 4;
|
|
121
121
|
return ioDeviceUtils.attachIODevicesToComponent(libraryModel, componentData, modelPreloader["default"], originalProps.uuid);
|
|
122
122
|
case 4:
|
|
123
|
-
// Register
|
|
124
|
-
|
|
125
|
-
if (!
|
|
123
|
+
// Register behavior configs for each attached device
|
|
124
|
+
ioBehavMgr = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.ioBehaviorManager;
|
|
125
|
+
if (!ioBehavMgr) {
|
|
126
126
|
_context2.n = 8;
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
_loop = /*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _loop() {
|
|
130
|
-
var _modelPreloader$compo, _deviceData$
|
|
130
|
+
var _modelPreloader$compo, _deviceData$behaviorC;
|
|
131
131
|
var _Object$entries$_i, attachmentId, attachment, deviceData, deviceRoot;
|
|
132
132
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
133
133
|
while (1) switch (_context.n) {
|
|
134
134
|
case 0:
|
|
135
135
|
_Object$entries$_i = _rollupPluginBabelHelpers.slicedToArray(_Object$entries[_i], 2), attachmentId = _Object$entries$_i[0], attachment = _Object$entries$_i[1];
|
|
136
136
|
deviceData = (_modelPreloader$compo = modelPreloader["default"].componentDictionary) === null || _modelPreloader$compo === void 0 ? void 0 : _modelPreloader$compo[attachment.deviceId];
|
|
137
|
-
console.log("[ModelManager] attachment \"".concat(attachmentId, "\" \u2192 deviceId \"").concat(attachment.deviceId, "\" \u2192
|
|
138
|
-
if (deviceData !== null && deviceData !== void 0 && deviceData.
|
|
137
|
+
console.log("[ModelManager] attachment \"".concat(attachmentId, "\" \u2192 deviceId \"").concat(attachment.deviceId, "\" \u2192 behaviorConfig:"), (_deviceData$behaviorC = deviceData === null || deviceData === void 0 ? void 0 : deviceData.behaviorConfig) !== null && _deviceData$behaviorC !== void 0 ? _deviceData$behaviorC : 'NONE');
|
|
138
|
+
if (deviceData !== null && deviceData !== void 0 && deviceData.behaviorConfig) {
|
|
139
139
|
_context.n = 1;
|
|
140
140
|
break;
|
|
141
141
|
}
|
|
@@ -147,7 +147,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
147
147
|
if (!deviceRoot && ((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.attachmentId) === attachmentId) deviceRoot = obj;
|
|
148
148
|
});
|
|
149
149
|
if (deviceRoot) {
|
|
150
|
-
|
|
150
|
+
ioBehavMgr.loadBehaviors(attachmentId, deviceData.behaviorConfig, deviceRoot, originalProps.uuid);
|
|
151
151
|
}
|
|
152
152
|
case 2:
|
|
153
153
|
return _context.a(2);
|
|
@@ -281,40 +281,14 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
|
|
284
|
-
// Helper function to extract behaviors from current scene data
|
|
285
|
-
var extractBehaviors = function extractBehaviors() {
|
|
286
|
-
var _this$sceneViewer, _this$sceneViewer2;
|
|
287
|
-
// Only export behaviors that are NOT re-derivable from a component's
|
|
288
|
-
// defaultBehaviors[]. All component/device default behaviors are
|
|
289
|
-
// reconstructed at load time by Step B of _processBehaviors() using the
|
|
290
|
-
// component dictionary, so writing compact behaviorRef entries for them
|
|
291
|
-
// would be redundant. The scene JSON behaviors[] array is reserved for
|
|
292
|
-
// any future scene-level overrides that cannot be derived from the asset.
|
|
293
|
-
if ((_this$sceneViewer = _this.sceneViewer) !== null && _this$sceneViewer !== void 0 && (_this$sceneViewer = _this$sceneViewer.managers) !== null && _this$sceneViewer !== void 0 && _this$sceneViewer.behaviorManager) {
|
|
294
|
-
return _this.sceneViewer.managers.behaviorManager.getBehaviors().filter(function (b) {
|
|
295
|
-
return !b._isDefaultBehavior;
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
// Fallback when BehaviorManager is not available: exclude any entry that
|
|
299
|
-
// was already a behaviorRef (it was derivable from the component asset)
|
|
300
|
-
// and exclude the legacy _isDefaultBehavior marker if present.
|
|
301
|
-
return (((_this$sceneViewer2 = _this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.currentSceneData) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.behaviors) || []).filter(function (b) {
|
|
302
|
-
return !b.behaviorRef && !b._isDefaultBehavior;
|
|
303
|
-
});
|
|
304
|
-
};
|
|
305
|
-
|
|
306
284
|
// Build the complete export data structure (matching central-plant-input.json format)
|
|
307
|
-
var
|
|
308
|
-
var exportData = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
|
|
285
|
+
var exportData = {
|
|
309
286
|
version: '2.3',
|
|
310
|
-
connections: extractConnections()
|
|
311
|
-
}, behaviors.length > 0 ? {
|
|
312
|
-
behaviors: behaviors
|
|
313
|
-
} : {}), {}, {
|
|
287
|
+
connections: extractConnections(),
|
|
314
288
|
scene: {
|
|
315
289
|
children: sceneChildren
|
|
316
290
|
}
|
|
317
|
-
}
|
|
291
|
+
};
|
|
318
292
|
console.log('✅ Scene export completed:', exportData);
|
|
319
293
|
console.log("\uD83D\uDCCA Exported ".concat(sceneChildren.length, " components and ").concat(exportData.connections.length, " connections"));
|
|
320
294
|
return exportData;
|
|
@@ -761,13 +761,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
761
761
|
phaseStart = performance.now();
|
|
762
762
|
this._finalizeScene(data, crosscubeTextureSet, isImported);
|
|
763
763
|
timers.phase5_finalize = performance.now() - phaseStart;
|
|
764
|
-
|
|
765
|
-
// Phase 6: Load behaviors (after GLB models are present so output objects can be resolved)
|
|
766
|
-
phaseStart = performance.now();
|
|
767
|
-
this._processBehaviors(data);
|
|
768
|
-
timers.phase6_behaviors = performance.now() - phaseStart;
|
|
769
764
|
totalTime = performance.now() - totalStart;
|
|
770
|
-
console.log("\u23F1\uFE0F Scene Loading Performance:\n Phase 1 (Prepare) : ".concat(timers.phase1_prepare.toFixed(0), "ms\n Phase 2 (Create Objects): ").concat(timers.phase2_createObjects.toFixed(0), "ms\n Phase 3 (GLB Models) : ").concat(timers.phase3_glbModels.toFixed(0), "ms\n Phase 4 (Pathfinding) : ").concat(timers.phase4_pathfinding.toFixed(0), "ms\n Phase 5 (Finalize) : ").concat(timers.phase5_finalize.toFixed(0), "ms\n
|
|
765
|
+
console.log("\u23F1\uFE0F Scene Loading Performance:\n Phase 1 (Prepare) : ".concat(timers.phase1_prepare.toFixed(0), "ms\n Phase 2 (Create Objects): ").concat(timers.phase2_createObjects.toFixed(0), "ms\n Phase 3 (GLB Models) : ").concat(timers.phase3_glbModels.toFixed(0), "ms\n Phase 4 (Pathfinding) : ").concat(timers.phase4_pathfinding.toFixed(0), "ms\n Phase 5 (Finalize) : ").concat(timers.phase5_finalize.toFixed(0), "ms\n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n Total : ").concat(totalTime.toFixed(0), "ms"));
|
|
771
766
|
console.log('✅ Scene loaded successfully');
|
|
772
767
|
|
|
773
768
|
// Notify UI components (e.g. SceneHierarchy) that the scene is fully loaded
|
|
@@ -1125,278 +1120,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1125
1120
|
}
|
|
1126
1121
|
}
|
|
1127
1122
|
|
|
1128
|
-
/**
|
|
1129
|
-
* Process behaviors from the scene data, expand any defaultBehaviors defined
|
|
1130
|
-
* on component dictionary entries, resolve behaviorRef entries against device
|
|
1131
|
-
* assets, inject per-instance component UUIDs, and hand the flat resolved
|
|
1132
|
-
* array to BehaviorManager.
|
|
1133
|
-
*
|
|
1134
|
-
* Resolution cascade:
|
|
1135
|
-
* 1. Explicit behaviors in data.behaviors — passed through as-is (behaviorRef
|
|
1136
|
-
* entries are resolved against the component/device dictionaries).
|
|
1137
|
-
* 2. defaultBehaviors[] on each placed smart component's dictionary entry —
|
|
1138
|
-
* expanded per instance with the instance UUID injected. Compact
|
|
1139
|
-
* behaviorRef-derived entries are tagged _isDefaultBehavior:true (the
|
|
1140
|
-
* exporter can re-derive them); full L2 behavior objects are tagged false
|
|
1141
|
-
* so they are exported verbatim and survive round-trips.
|
|
1142
|
-
*
|
|
1143
|
-
* @param {Object} data - Scene JSON data
|
|
1144
|
-
*/
|
|
1145
|
-
}, {
|
|
1146
|
-
key: "_processBehaviors",
|
|
1147
|
-
value: function _processBehaviors(data) {
|
|
1148
|
-
var _this$sceneViewer2,
|
|
1149
|
-
_this$sceneViewer$cen2,
|
|
1150
|
-
_this5 = this,
|
|
1151
|
-
_data$scene3;
|
|
1152
|
-
var behaviorManager = (_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.managers) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.behaviorManager;
|
|
1153
|
-
if (!behaviorManager) {
|
|
1154
|
-
console.warn('⚠️ _processBehaviors: BehaviorManager not available');
|
|
1155
|
-
return;
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
// Obtain the component dictionary (extended = includes S3/smart components)
|
|
1159
|
-
var componentDictionary = ((_this$sceneViewer$cen2 = this.sceneViewer.centralPlant) === null || _this$sceneViewer$cen2 === void 0 || (_this$sceneViewer$cen2 = _this$sceneViewer$cen2.managers) === null || _this$sceneViewer$cen2 === void 0 || (_this$sceneViewer$cen2 = _this$sceneViewer$cen2.componentDataManager) === null || _this$sceneViewer$cen2 === void 0 ? void 0 : _this$sceneViewer$cen2.componentDictionary) || {};
|
|
1160
|
-
|
|
1161
|
-
// ── Step A: Resolve any behaviorRef entries from data.behaviors ─────────
|
|
1162
|
-
var explicitBehaviors = [];
|
|
1163
|
-
if (Array.isArray(data === null || data === void 0 ? void 0 : data.behaviors)) {
|
|
1164
|
-
data.behaviors.forEach(function (entry) {
|
|
1165
|
-
if (entry.behaviorRef) {
|
|
1166
|
-
var resolved = _this5._resolveBehaviorRef(entry, componentDictionary);
|
|
1167
|
-
if (resolved) explicitBehaviors.push(resolved);
|
|
1168
|
-
} else {
|
|
1169
|
-
explicitBehaviors.push(entry);
|
|
1170
|
-
}
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
// Build a set of explicit behavior ids for deduplication
|
|
1175
|
-
var explicitIds = new Set(explicitBehaviors.map(function (b) {
|
|
1176
|
-
return b.id;
|
|
1177
|
-
}));
|
|
1178
|
-
|
|
1179
|
-
// Build a set of (component::attachment::state) tuples covered by explicit
|
|
1180
|
-
// behaviors. If an expanded default behavior would produce the SAME input
|
|
1181
|
-
// tuple, the explicit behavior is treated as the intentional override and
|
|
1182
|
-
// the default expansion is skipped. This prevents a component's built-in
|
|
1183
|
-
// switch→LED wiring from doubling-up when the user has deliberately authored
|
|
1184
|
-
// cross-component behaviors that re-wire the same switch.
|
|
1185
|
-
var explicitInputTuples = new Set(explicitBehaviors.filter(function (b) {
|
|
1186
|
-
var _b$input, _b$input2, _b$input3;
|
|
1187
|
-
return ((_b$input = b.input) === null || _b$input === void 0 ? void 0 : _b$input.component) && ((_b$input2 = b.input) === null || _b$input2 === void 0 ? void 0 : _b$input2.attachment) && ((_b$input3 = b.input) === null || _b$input3 === void 0 ? void 0 : _b$input3.state);
|
|
1188
|
-
}).map(function (b) {
|
|
1189
|
-
return "".concat(b.input.component, "::").concat(b.input.attachment, "::").concat(b.input.state);
|
|
1190
|
-
}));
|
|
1191
|
-
|
|
1192
|
-
// Build a set of instanceUuids already covered by behaviorRef entries in
|
|
1193
|
-
// data.behaviors (written by the exporter for smart component defaults).
|
|
1194
|
-
// Step B skips these instances to avoid loading the same behaviors twice —
|
|
1195
|
-
// once via Step A (resolved from data.behaviors refs) and once via Step B
|
|
1196
|
-
// (auto-expanded from the component dictionary).
|
|
1197
|
-
var coveredInstances = new Set();
|
|
1198
|
-
if (Array.isArray(data === null || data === void 0 ? void 0 : data.behaviors)) {
|
|
1199
|
-
data.behaviors.forEach(function (entry) {
|
|
1200
|
-
if (entry.behaviorRef && entry.component) {
|
|
1201
|
-
coveredInstances.add(entry.component);
|
|
1202
|
-
}
|
|
1203
|
-
});
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
// ── Step B: Walk placed components and expand their defaultBehaviors ─────
|
|
1207
|
-
var instanceBehaviors = [];
|
|
1208
|
-
if (Array.isArray(data === null || data === void 0 || (_data$scene3 = data.scene) === null || _data$scene3 === void 0 ? void 0 : _data$scene3.children)) {
|
|
1209
|
-
data.scene.children.forEach(function (child) {
|
|
1210
|
-
var _child$userData0, _compData$defaultBeha;
|
|
1211
|
-
var libraryId = (_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.libraryId;
|
|
1212
|
-
if (!libraryId) return;
|
|
1213
|
-
var instanceUuid = child.uuid;
|
|
1214
|
-
// Skip instances whose defaults were already resolved by Step A
|
|
1215
|
-
// (they have explicit behaviorRef entries in data.behaviors).
|
|
1216
|
-
if (coveredInstances.has(instanceUuid)) return;
|
|
1217
|
-
var compData = componentDictionary[libraryId];
|
|
1218
|
-
if (!(compData !== null && compData !== void 0 && (_compData$defaultBeha = compData.defaultBehaviors) !== null && _compData$defaultBeha !== void 0 && _compData$defaultBeha.length)) return;
|
|
1219
|
-
compData.defaultBehaviors.forEach(function (template) {
|
|
1220
|
-
var _expanded$input, _expanded$input2, _expanded$input3;
|
|
1221
|
-
var expanded = _this5._expandDefaultBehavior(template, instanceUuid, componentDictionary);
|
|
1222
|
-
if (!expanded) return;
|
|
1223
|
-
// Skip if an explicit scene behavior already covers this id
|
|
1224
|
-
if (explicitIds.has(expanded.id)) return;
|
|
1225
|
-
// Skip if an explicit scene behavior already covers the same
|
|
1226
|
-
// (component, attachment, state) input tuple. This prevents a
|
|
1227
|
-
// component's built-in default wiring (e.g. switch → own LED) from
|
|
1228
|
-
// double-firing when the user has authored a cross-component override
|
|
1229
|
-
// that rewires the same switch to a different target.
|
|
1230
|
-
if ((_expanded$input = expanded.input) !== null && _expanded$input !== void 0 && _expanded$input.component && (_expanded$input2 = expanded.input) !== null && _expanded$input2 !== void 0 && _expanded$input2.attachment && (_expanded$input3 = expanded.input) !== null && _expanded$input3 !== void 0 && _expanded$input3.state) {
|
|
1231
|
-
var tuple = "".concat(expanded.input.component, "::").concat(expanded.input.attachment, "::").concat(expanded.input.state);
|
|
1232
|
-
if (explicitInputTuples.has(tuple)) return;
|
|
1233
|
-
}
|
|
1234
|
-
// All component defaultBehaviors are re-derivable from the component
|
|
1235
|
-
// asset at export time (via compact behaviorRef), so mark them all.
|
|
1236
|
-
expanded._isDefaultBehavior = true;
|
|
1237
|
-
instanceBehaviors.push(expanded);
|
|
1238
|
-
});
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
var allBehaviors = [].concat(explicitBehaviors, instanceBehaviors);
|
|
1242
|
-
if (allBehaviors.length === 0) return;
|
|
1243
|
-
behaviorManager.loadBehaviors(allBehaviors);
|
|
1244
|
-
console.log("\u2705 _processBehaviors: loaded ".concat(explicitBehaviors.length, " explicit + ").concat(instanceBehaviors.length, " default-expanded behavior(s)"));
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
/**
|
|
1248
|
-
* Register the defaultBehaviors of a single newly placed component instance
|
|
1249
|
-
* into the BehaviorManager. Called from addComponent() (drag-drop), where
|
|
1250
|
-
* _processBehaviors() (scene-load path) is not invoked.
|
|
1251
|
-
*
|
|
1252
|
-
* @param {Object} componentData - Entry from the component dictionary
|
|
1253
|
-
* @param {string} instanceUuid - UUID of the placed component (componentModel.uuid)
|
|
1254
|
-
*/
|
|
1255
|
-
}, {
|
|
1256
|
-
key: "registerBehaviorsForComponentInstance",
|
|
1257
|
-
value: function registerBehaviorsForComponentInstance(componentData, instanceUuid) {
|
|
1258
|
-
var _this$sceneViewer3,
|
|
1259
|
-
_componentData$defaul,
|
|
1260
|
-
_this$sceneViewer$cen3,
|
|
1261
|
-
_this6 = this;
|
|
1262
|
-
var behaviorManager = (_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.managers) === null || _this$sceneViewer3 === void 0 ? void 0 : _this$sceneViewer3.behaviorManager;
|
|
1263
|
-
if (!behaviorManager) return;
|
|
1264
|
-
if (!(componentData !== null && componentData !== void 0 && (_componentData$defaul = componentData.defaultBehaviors) !== null && _componentData$defaul !== void 0 && _componentData$defaul.length)) return;
|
|
1265
|
-
var componentDictionary = ((_this$sceneViewer$cen3 = this.sceneViewer.centralPlant) === null || _this$sceneViewer$cen3 === void 0 || (_this$sceneViewer$cen3 = _this$sceneViewer$cen3.managers) === null || _this$sceneViewer$cen3 === void 0 || (_this$sceneViewer$cen3 = _this$sceneViewer$cen3.componentDataManager) === null || _this$sceneViewer$cen3 === void 0 ? void 0 : _this$sceneViewer$cen3.componentDictionary) || {};
|
|
1266
|
-
var registered = 0;
|
|
1267
|
-
componentData.defaultBehaviors.forEach(function (template) {
|
|
1268
|
-
var expanded = _this6._expandDefaultBehavior(template, instanceUuid, componentDictionary);
|
|
1269
|
-
if (!expanded) return;
|
|
1270
|
-
expanded._isDefaultBehavior = true;
|
|
1271
|
-
behaviorManager.addBehavior(expanded);
|
|
1272
|
-
registered++;
|
|
1273
|
-
});
|
|
1274
|
-
if (registered > 0) {
|
|
1275
|
-
console.log("\u2705 registerBehaviorsForComponentInstance: registered ".concat(registered, " behavior(s) for instance ").concat(instanceUuid));
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
/**
|
|
1280
|
-
* Resolve a scene-level or component-level behaviorRef entry into a full
|
|
1281
|
-
* behavior definition by looking up the referenced template in the device
|
|
1282
|
-
* asset's defaultBehaviors[] and substituting 'self' with the real
|
|
1283
|
-
* attachmentId.
|
|
1284
|
-
*
|
|
1285
|
-
* Ref shape: { behaviorRef, deviceId, attachment, component? }
|
|
1286
|
-
*
|
|
1287
|
-
* @param {Object} ref
|
|
1288
|
-
* @param {Object} componentDictionary
|
|
1289
|
-
* @returns {Object|null} Resolved behavior or null if not found
|
|
1290
|
-
*/
|
|
1291
|
-
}, {
|
|
1292
|
-
key: "_resolveBehaviorRef",
|
|
1293
|
-
value: function _resolveBehaviorRef(ref, componentDictionary) {
|
|
1294
|
-
var _resolved$input, _resolved$output;
|
|
1295
|
-
if (!ref.behaviorRef) {
|
|
1296
|
-
console.warn('⚠️ _resolveBehaviorRef: missing behaviorRef', ref);
|
|
1297
|
-
return null;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
// ── Component-level L2 ref: { behaviorRef, libraryId, component } ──────
|
|
1301
|
-
// The full behavior template lives on the smart component's defaultBehaviors[].
|
|
1302
|
-
// No 'self' substitution needed — attachment IDs are already real.
|
|
1303
|
-
if (ref.libraryId) {
|
|
1304
|
-
var compData = componentDictionary[ref.libraryId];
|
|
1305
|
-
if (!compData) {
|
|
1306
|
-
console.warn("\u26A0\uFE0F _resolveBehaviorRef: component \"".concat(ref.libraryId, "\" not in dictionary"));
|
|
1307
|
-
return null;
|
|
1308
|
-
}
|
|
1309
|
-
var _template = (compData.defaultBehaviors || []).find(function (b) {
|
|
1310
|
-
return b.id === ref.behaviorRef;
|
|
1311
|
-
});
|
|
1312
|
-
if (!_template) {
|
|
1313
|
-
console.warn("\u26A0\uFE0F _resolveBehaviorRef: behavior \"".concat(ref.behaviorRef, "\" not found on component \"").concat(ref.libraryId, "\""));
|
|
1314
|
-
return null;
|
|
1315
|
-
}
|
|
1316
|
-
var _resolved = JSON.parse(JSON.stringify(_template));
|
|
1317
|
-
_resolved.id = "".concat(_resolved.id, "::").concat(ref.component);
|
|
1318
|
-
if (ref.component) {
|
|
1319
|
-
_resolved.input = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, _resolved.input), {}, {
|
|
1320
|
-
component: ref.component
|
|
1321
|
-
});
|
|
1322
|
-
_resolved.output = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, _resolved.output), {}, {
|
|
1323
|
-
component: ref.component
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1326
|
-
return _resolved;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
// ── Device-level L1 ref: { behaviorRef, deviceId, attachment, component } ─
|
|
1330
|
-
if (!ref.deviceId || !ref.attachment) {
|
|
1331
|
-
console.warn('⚠️ _resolveBehaviorRef: incomplete ref', ref);
|
|
1332
|
-
return null;
|
|
1333
|
-
}
|
|
1334
|
-
var deviceData = componentDictionary[ref.deviceId];
|
|
1335
|
-
if (!deviceData) {
|
|
1336
|
-
console.warn("\u26A0\uFE0F _resolveBehaviorRef: device \"".concat(ref.deviceId, "\" not in dictionary"));
|
|
1337
|
-
return null;
|
|
1338
|
-
}
|
|
1339
|
-
var template = (deviceData.defaultBehaviors || []).find(function (b) {
|
|
1340
|
-
return b.id === ref.behaviorRef;
|
|
1341
|
-
});
|
|
1342
|
-
if (!template) {
|
|
1343
|
-
console.warn("\u26A0\uFE0F _resolveBehaviorRef: behavior \"".concat(ref.behaviorRef, "\" not found on device \"").concat(ref.deviceId, "\""));
|
|
1344
|
-
return null;
|
|
1345
|
-
}
|
|
1346
|
-
// Deep clone and substitute 'self' -> real attachmentId
|
|
1347
|
-
var resolved = JSON.parse(JSON.stringify(template));
|
|
1348
|
-
resolved.id = "".concat(resolved.id, "::").concat(ref.attachment);
|
|
1349
|
-
if (((_resolved$input = resolved.input) === null || _resolved$input === void 0 ? void 0 : _resolved$input.attachment) === 'self') resolved.input.attachment = ref.attachment;
|
|
1350
|
-
if (((_resolved$output = resolved.output) === null || _resolved$output === void 0 ? void 0 : _resolved$output.attachment) === 'self') resolved.output.attachment = ref.attachment;
|
|
1351
|
-
// Inject component UUID guard if the ref carries one
|
|
1352
|
-
if (ref.component) {
|
|
1353
|
-
resolved.input = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, resolved.input), {}, {
|
|
1354
|
-
component: ref.component
|
|
1355
|
-
});
|
|
1356
|
-
resolved.output = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, resolved.output), {}, {
|
|
1357
|
-
component: ref.component
|
|
1358
|
-
});
|
|
1359
|
-
}
|
|
1360
|
-
return resolved;
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
/**
|
|
1364
|
-
* Expand a single defaultBehaviors[] template entry for a specific component
|
|
1365
|
-
* instance placed in the scene.
|
|
1366
|
-
*
|
|
1367
|
-
* If the entry is a behaviorRef, it is first resolved against the device
|
|
1368
|
-
* library; otherwise it is treated as a full behavior definition.
|
|
1369
|
-
* In both cases the instanceUuid is injected as input.component and
|
|
1370
|
-
* output.component, and the behavior id is suffixed with ::instanceUuid.
|
|
1371
|
-
*
|
|
1372
|
-
* @param {Object} template - Entry from compData.defaultBehaviors[]
|
|
1373
|
-
* @param {string} instanceUuid - UUID of the placed component instance
|
|
1374
|
-
* @param {Object} componentDictionary
|
|
1375
|
-
* @returns {Object|null}
|
|
1376
|
-
*/
|
|
1377
|
-
}, {
|
|
1378
|
-
key: "_expandDefaultBehavior",
|
|
1379
|
-
value: function _expandDefaultBehavior(template, instanceUuid, componentDictionary) {
|
|
1380
|
-
var base;
|
|
1381
|
-
if (template.behaviorRef) {
|
|
1382
|
-
// Resolve the device ref first (substitutes 'self' -> attachment)
|
|
1383
|
-
base = this._resolveBehaviorRef(template, componentDictionary);
|
|
1384
|
-
if (!base) return null;
|
|
1385
|
-
} else {
|
|
1386
|
-
base = JSON.parse(JSON.stringify(template));
|
|
1387
|
-
}
|
|
1388
|
-
// Suffix the id so each instance gets a unique behavior id
|
|
1389
|
-
base.id = "".concat(base.id, "::").concat(instanceUuid);
|
|
1390
|
-
// Inject the instance UUID as the component scope guard
|
|
1391
|
-
base.input = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, base.input), {}, {
|
|
1392
|
-
component: instanceUuid
|
|
1393
|
-
});
|
|
1394
|
-
base.output = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, base.output), {}, {
|
|
1395
|
-
component: instanceUuid
|
|
1396
|
-
});
|
|
1397
|
-
return base;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
1123
|
/**
|
|
1401
1124
|
* Save original world matrices for direction calculations
|
|
1402
1125
|
*/
|
|
@@ -1465,7 +1188,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1465
1188
|
key: "loadSceneFromData",
|
|
1466
1189
|
value: (function () {
|
|
1467
1190
|
var _loadSceneFromData = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee9(data) {
|
|
1468
|
-
var _data$
|
|
1191
|
+
var _data$scene3, _data$scene4, _data$scene5, _data$scene6;
|
|
1469
1192
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context9) {
|
|
1470
1193
|
while (1) switch (_context9.n) {
|
|
1471
1194
|
case 0:
|
|
@@ -1475,10 +1198,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1475
1198
|
dataType: _rollupPluginBabelHelpers["typeof"](data),
|
|
1476
1199
|
hasScene: !!(data !== null && data !== void 0 && data.scene),
|
|
1477
1200
|
sceneType: _rollupPluginBabelHelpers["typeof"](data === null || data === void 0 ? void 0 : data.scene),
|
|
1478
|
-
hasChildren: !!(data !== null && data !== void 0 && (_data$
|
|
1479
|
-
childrenType: data !== null && data !== void 0 && (_data$
|
|
1480
|
-
isArray: Array.isArray(data === null || data === void 0 || (_data$
|
|
1481
|
-
childrenLength: data === null || data === void 0 || (_data$
|
|
1201
|
+
hasChildren: !!(data !== null && data !== void 0 && (_data$scene3 = data.scene) !== null && _data$scene3 !== void 0 && _data$scene3.children),
|
|
1202
|
+
childrenType: data !== null && data !== void 0 && (_data$scene4 = data.scene) !== null && _data$scene4 !== void 0 && _data$scene4.children ? _rollupPluginBabelHelpers["typeof"](data.scene.children) : 'undefined',
|
|
1203
|
+
isArray: Array.isArray(data === null || data === void 0 || (_data$scene5 = data.scene) === null || _data$scene5 === void 0 ? void 0 : _data$scene5.children),
|
|
1204
|
+
childrenLength: data === null || data === void 0 || (_data$scene6 = data.scene) === null || _data$scene6 === void 0 || (_data$scene6 = _data$scene6.children) === null || _data$scene6 === void 0 ? void 0 : _data$scene6.length,
|
|
1482
1205
|
dataKeys: data ? Object.keys(data) : [],
|
|
1483
1206
|
sceneKeys: data !== null && data !== void 0 && data.scene ? Object.keys(data.scene) : []
|
|
1484
1207
|
});
|
|
@@ -1609,8 +1332,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1609
1332
|
// Process children (connectors, etc.) if they exist
|
|
1610
1333
|
if (componentModel.children && componentModel.children.length > 0) {
|
|
1611
1334
|
componentModel.children.forEach(function (child) {
|
|
1612
|
-
var _child$
|
|
1613
|
-
var childType = ((_child$
|
|
1335
|
+
var _child$userData0, _child$userData1;
|
|
1336
|
+
var childType = ((_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.objectType) || ((_child$userData1 = child.userData) === null || _child$userData1 === void 0 ? void 0 : _child$userData1.objectType);
|
|
1614
1337
|
if (childType === 'connector') {
|
|
1615
1338
|
var _child$geometry;
|
|
1616
1339
|
var childBoundingBox = new THREE__namespace.Box3().setFromObject(child);
|
|
@@ -1695,8 +1418,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1695
1418
|
if (segment.children && segment.children.length > 0) {
|
|
1696
1419
|
var childrenToRemove = _rollupPluginBabelHelpers.toConsumableArray(segment.children);
|
|
1697
1420
|
childrenToRemove.forEach(function (child) {
|
|
1698
|
-
var _child$
|
|
1699
|
-
if ((_child$
|
|
1421
|
+
var _child$userData10;
|
|
1422
|
+
if ((_child$userData10 = child.userData) !== null && _child$userData10 !== void 0 && _child$userData10.isPipeElbow) {
|
|
1700
1423
|
console.log("\uD83D\uDDD1\uFE0F Removing elbow child from segment before manualization: ".concat(child.uuid));
|
|
1701
1424
|
segment.remove(child);
|
|
1702
1425
|
if (child.geometry) child.geometry.dispose();
|
|
@@ -1847,7 +1570,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1847
1570
|
value: function _convertConnectedGatewaysToManual(connectors, currentSceneData) {
|
|
1848
1571
|
var _connectors$,
|
|
1849
1572
|
_segment$userData2,
|
|
1850
|
-
|
|
1573
|
+
_this5 = this;
|
|
1851
1574
|
console.log('🔍 Checking for connected gateways to convert to manual...');
|
|
1852
1575
|
var sceneViewer = this.sceneViewer;
|
|
1853
1576
|
var convertedGateways = [];
|
|
@@ -1884,7 +1607,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1884
1607
|
console.log("\uD83D\uDD27 Found computed gateway at endpoint: ".concat(endpointObject.uuid, " - converting to manual"));
|
|
1885
1608
|
|
|
1886
1609
|
// Convert gateway to manual (declared) using manualizeGateway for consistency
|
|
1887
|
-
|
|
1610
|
+
_this5.manualizeGateway(endpointObject, currentSceneData);
|
|
1888
1611
|
convertedGateways.push(endpointObject);
|
|
1889
1612
|
} else if (((_endpointObject$userD5 = endpointObject.userData) === null || _endpointObject$userD5 === void 0 ? void 0 : _endpointObject$userD5.objectType) === 'gateway' && ((_endpointObject$userD6 = endpointObject.userData) === null || _endpointObject$userD6 === void 0 ? void 0 : _endpointObject$userD6.isDeclared) === true) {
|
|
1890
1613
|
console.log("\u2139\uFE0F Gateway ".concat(endpointObject.uuid, " is already declared (manual), skipping conversion"));
|