@2112-lab/central-plant 0.3.28 → 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 +47 -47
- package/dist/cjs/src/core/centralPlant.js +3 -3
- package/dist/cjs/src/core/centralPlantInternals.js +7 -7
- package/dist/cjs/src/core/sceneViewer.js +4 -4
- package/dist/cjs/src/index.js +2 -2
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +571 -0
- package/dist/cjs/src/managers/scene/componentTooltipManager.js +8 -8
- package/dist/cjs/src/managers/scene/modelManager.js +8 -8
- package/dist/esm/src/core/centralPlant.js +3 -3
- package/dist/esm/src/core/centralPlantInternals.js +7 -7
- package/dist/esm/src/core/sceneViewer.js +4 -4
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +547 -0
- package/dist/esm/src/managers/scene/componentTooltipManager.js +8 -8
- package/dist/esm/src/managers/scene/modelManager.js +8 -8
- package/package.json +1 -1
package/dist/bundle/index.js
CHANGED
|
@@ -31309,7 +31309,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
31309
31309
|
key: "loadLibraryModel",
|
|
31310
31310
|
value: function () {
|
|
31311
31311
|
var _loadLibraryModel = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(targetMesh, jsonEntry, componentData) {
|
|
31312
|
-
var component, _jsonEntry$userData, _jsonEntry$userData2, _jsonEntry$userData3, originalProps, connectorChildren, gltfScene, libraryModel, _this$sceneViewer,
|
|
31312
|
+
var component, _jsonEntry$userData, _jsonEntry$userData2, _jsonEntry$userData3, originalProps, connectorChildren, gltfScene, libraryModel, _this$sceneViewer, ioBehavMgr, _loop, _i, _Object$entries, warmFn, _jsonEntry$userData4, _t;
|
|
31313
31313
|
return _regenerator().w(function (_context2) {
|
|
31314
31314
|
while (1) switch (_context2.n) {
|
|
31315
31315
|
case 0:
|
|
@@ -31352,22 +31352,22 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
31352
31352
|
_context2.n = 4;
|
|
31353
31353
|
return attachIODevicesToComponent(libraryModel, componentData, modelPreloader, originalProps.uuid);
|
|
31354
31354
|
case 4:
|
|
31355
|
-
// Register
|
|
31356
|
-
|
|
31357
|
-
if (!
|
|
31355
|
+
// Register behavior configs for each attached device
|
|
31356
|
+
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;
|
|
31357
|
+
if (!ioBehavMgr) {
|
|
31358
31358
|
_context2.n = 8;
|
|
31359
31359
|
break;
|
|
31360
31360
|
}
|
|
31361
31361
|
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
31362
|
-
var _modelPreloader$compo, _deviceData$
|
|
31362
|
+
var _modelPreloader$compo, _deviceData$behaviorC;
|
|
31363
31363
|
var _Object$entries$_i, attachmentId, attachment, deviceData, deviceRoot;
|
|
31364
31364
|
return _regenerator().w(function (_context) {
|
|
31365
31365
|
while (1) switch (_context.n) {
|
|
31366
31366
|
case 0:
|
|
31367
31367
|
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), attachmentId = _Object$entries$_i[0], attachment = _Object$entries$_i[1];
|
|
31368
31368
|
deviceData = (_modelPreloader$compo = modelPreloader.componentDictionary) === null || _modelPreloader$compo === void 0 ? void 0 : _modelPreloader$compo[attachment.deviceId];
|
|
31369
|
-
console.log("[ModelManager] attachment \"".concat(attachmentId, "\" \u2192 deviceId \"").concat(attachment.deviceId, "\" \u2192
|
|
31370
|
-
if (deviceData !== null && deviceData !== void 0 && deviceData.
|
|
31369
|
+
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');
|
|
31370
|
+
if (deviceData !== null && deviceData !== void 0 && deviceData.behaviorConfig) {
|
|
31371
31371
|
_context.n = 1;
|
|
31372
31372
|
break;
|
|
31373
31373
|
}
|
|
@@ -31379,7 +31379,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
31379
31379
|
if (!deviceRoot && ((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.attachmentId) === attachmentId) deviceRoot = obj;
|
|
31380
31380
|
});
|
|
31381
31381
|
if (deviceRoot) {
|
|
31382
|
-
|
|
31382
|
+
ioBehavMgr.loadBehaviors(attachmentId, deviceData.behaviorConfig, deviceRoot, originalProps.uuid);
|
|
31383
31383
|
}
|
|
31384
31384
|
case 2:
|
|
31385
31385
|
return _context.a(2);
|
|
@@ -36654,7 +36654,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36654
36654
|
var currentVal = (_ref = storedVal !== null && storedVal !== void 0 ? storedVal : binaryState.defaultValue) !== null && _ref !== void 0 ? _ref : false;
|
|
36655
36655
|
var newVal = !Boolean(currentVal);
|
|
36656
36656
|
this._stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
36657
|
-
(_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.
|
|
36657
|
+
(_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);
|
|
36658
36658
|
console.log("\uD83D\uDD04 [IODevice] Toggled ".concat(scopedAttachmentId, ".").concat(dpId, ": ").concat(currentVal, " \u2192 ").concat(newVal));
|
|
36659
36659
|
}
|
|
36660
36660
|
|
|
@@ -36687,8 +36687,8 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36687
36687
|
obj = obj.parent;
|
|
36688
36688
|
}
|
|
36689
36689
|
var scopedAttachmentId = this._getScopedAttachmentKey(attachmentId, parentUuid);
|
|
36690
|
-
var
|
|
36691
|
-
var dataPoints = ((
|
|
36690
|
+
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;
|
|
36691
|
+
var dataPoints = ((ioBehavMgr === null || ioBehavMgr === void 0 ? void 0 : ioBehavMgr.getAnimationDataPoints(parentUuid, attachmentId)) || []).concat((ud === null || ud === void 0 ? void 0 : ud.dataPoints) || [])
|
|
36692
36692
|
// deduplicate by id
|
|
36693
36693
|
.filter(function (dp, i, arr) {
|
|
36694
36694
|
return arr.findIndex(function (d) {
|
|
@@ -36817,7 +36817,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36817
36817
|
dp = _ref2.dp;
|
|
36818
36818
|
var dpId = dp.id;
|
|
36819
36819
|
(_this$_stateAdapter = this._stateAdapter) === null || _this$_stateAdapter === void 0 || _this$_stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
36820
|
-
(_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.managers) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.
|
|
36820
|
+
(_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);
|
|
36821
36821
|
}
|
|
36822
36822
|
|
|
36823
36823
|
/**
|
|
@@ -36942,11 +36942,11 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36942
36942
|
var _this3$sceneViewer$ma, _this3$sceneViewer;
|
|
36943
36943
|
var attachmentId = child.userData.attachmentId || '';
|
|
36944
36944
|
|
|
36945
|
-
// Use only data points from the animate window (
|
|
36945
|
+
// Use only data points from the animate window (behaviorConfig).
|
|
36946
36946
|
// The static ioConfig.states[] snapshot on userData is intentionally ignored.
|
|
36947
|
-
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.
|
|
36947
|
+
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 : [];
|
|
36948
36948
|
|
|
36949
|
-
// When data points come from
|
|
36949
|
+
// When data points come from behaviorConfig they already carry direction:'input'.
|
|
36950
36950
|
// Pass null so _buildDataPointRow uses the per-dp direction instead of the
|
|
36951
36951
|
// device-level ioDirection (which may be 'output' and would hide controls).
|
|
36952
36952
|
var deviceDirection = dataPoints.length > 0 ? null : child.userData.ioDirection || 'output';
|
|
@@ -37185,7 +37185,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37185
37185
|
var _this5$_stateAdapter, _this5$selectedObject, _this5$sceneViewer;
|
|
37186
37186
|
(_this5$_stateAdapter = _this5._stateAdapter) === null || _this5$_stateAdapter === void 0 || _this5$_stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
37187
37187
|
var parentUuid = ((_this5$selectedObject = _this5.selectedObject) === null || _this5$selectedObject === void 0 ? void 0 : _this5$selectedObject.uuid) || null;
|
|
37188
|
-
(_this5$sceneViewer = _this5.sceneViewer) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.managers) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.
|
|
37188
|
+
(_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);
|
|
37189
37189
|
});
|
|
37190
37190
|
row.appendChild(ctrl);
|
|
37191
37191
|
this._stateElements.set(key, {
|
|
@@ -37357,11 +37357,11 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37357
37357
|
}]);
|
|
37358
37358
|
}(BaseDisposable);
|
|
37359
37359
|
|
|
37360
|
-
var
|
|
37361
|
-
function
|
|
37360
|
+
var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
37361
|
+
function IoBehaviorManager(sceneViewer) {
|
|
37362
37362
|
var _this;
|
|
37363
|
-
_classCallCheck(this,
|
|
37364
|
-
_this = _callSuper(this,
|
|
37363
|
+
_classCallCheck(this, IoBehaviorManager);
|
|
37364
|
+
_this = _callSuper(this, IoBehaviorManager);
|
|
37365
37365
|
_this.sceneViewer = sceneViewer;
|
|
37366
37366
|
|
|
37367
37367
|
/**
|
|
@@ -37386,18 +37386,18 @@ var IoAnimationManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37386
37386
|
* so that mesh references are live.
|
|
37387
37387
|
*
|
|
37388
37388
|
* @param {string} attachmentId - The attachment key (e.g. 'attch-switch-01')
|
|
37389
|
-
* @param {Object|Array}
|
|
37390
|
-
* {
|
|
37389
|
+
* @param {Object|Array} behaviorConfig - Serialized config; either the full object
|
|
37390
|
+
* { behaviors: [...] } or a plain array of behavior entries.
|
|
37391
37391
|
* @param {THREE.Object3D} deviceModelRoot - The device's root Object3D as added to the scene
|
|
37392
37392
|
* @param {string} parentUuid - UUID of the host component Object3D
|
|
37393
37393
|
*/
|
|
37394
|
-
_inherits(
|
|
37395
|
-
return _createClass(
|
|
37396
|
-
key: "
|
|
37397
|
-
value: function
|
|
37398
|
-
var
|
|
37399
|
-
if (!
|
|
37400
|
-
var anims = Array.isArray(
|
|
37394
|
+
_inherits(IoBehaviorManager, _BaseDisposable);
|
|
37395
|
+
return _createClass(IoBehaviorManager, [{
|
|
37396
|
+
key: "loadBehaviors",
|
|
37397
|
+
value: function loadBehaviors(attachmentId, behaviorConfig, deviceModelRoot, parentUuid) {
|
|
37398
|
+
var _behaviorConfig$behav;
|
|
37399
|
+
if (!behaviorConfig || !deviceModelRoot) return;
|
|
37400
|
+
var anims = Array.isArray(behaviorConfig) ? behaviorConfig : (_behaviorConfig$behav = behaviorConfig.behaviors) !== null && _behaviorConfig$behav !== void 0 ? _behaviorConfig$behav : [];
|
|
37401
37401
|
if (!anims.length) return;
|
|
37402
37402
|
var key = this._key(parentUuid, attachmentId);
|
|
37403
37403
|
var entries = [];
|
|
@@ -37408,7 +37408,7 @@ var IoAnimationManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37408
37408
|
var anim = _step.value;
|
|
37409
37409
|
var mesh = this._resolveMesh(anim, deviceModelRoot);
|
|
37410
37410
|
if (!mesh) {
|
|
37411
|
-
console.warn("[
|
|
37411
|
+
console.warn("[IoBehaviorManager] Could not find mesh for animation \"".concat(anim.name || anim.stateVariable, "\" (uuid: ").concat(anim.meshUuid, ", name: \"").concat(anim.meshName, "\")"));
|
|
37412
37412
|
continue;
|
|
37413
37413
|
}
|
|
37414
37414
|
entries.push({
|
|
@@ -37425,11 +37425,11 @@ var IoAnimationManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37425
37425
|
}
|
|
37426
37426
|
if (entries.length) {
|
|
37427
37427
|
this._entries.set(key, entries);
|
|
37428
|
-
console.log("[
|
|
37428
|
+
console.log("[IoBehaviorManager] Loaded ".concat(entries.length, " animation(s) for attachment \"").concat(attachmentId, "\" (parent: ").concat(parentUuid, ") \u2014 stateVariables: ").concat(entries.map(function (e) {
|
|
37429
37429
|
return e.anim.stateVariable;
|
|
37430
37430
|
}).join(', ')));
|
|
37431
37431
|
} else {
|
|
37432
|
-
console.warn("[
|
|
37432
|
+
console.warn("[IoBehaviorManager] No mesh entries resolved for attachment \"".concat(attachmentId, "\" \u2014 behaviorConfig had ").concat(anims.length, " entries but none matched a mesh"));
|
|
37433
37433
|
}
|
|
37434
37434
|
}
|
|
37435
37435
|
|
|
@@ -37623,7 +37623,7 @@ var IoAnimationManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37623
37623
|
key: "dispose",
|
|
37624
37624
|
value: function dispose() {
|
|
37625
37625
|
this._entries.clear();
|
|
37626
|
-
_superPropGet(
|
|
37626
|
+
_superPropGet(IoBehaviorManager, "dispose", this, 3)([]);
|
|
37627
37627
|
}
|
|
37628
37628
|
|
|
37629
37629
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -38248,7 +38248,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
38248
38248
|
this.centralPlant.managers.cameraControlsManager = new CameraControlsManager(this.centralPlant.sceneViewer);
|
|
38249
38249
|
this.centralPlant.managers.componentDragManager = new ComponentDragManager(this.centralPlant.sceneViewer);
|
|
38250
38250
|
this.centralPlant.managers.viewport2DManager = new Viewport2DManager(this.centralPlant.sceneViewer);
|
|
38251
|
-
this.centralPlant.managers.
|
|
38251
|
+
this.centralPlant.managers.ioBehaviorManager = new IoBehaviorManager(this.centralPlant.sceneViewer);
|
|
38252
38252
|
this.centralPlant.managers.ioOutlineManager = new IoOutlineManager(this.centralPlant.sceneViewer);
|
|
38253
38253
|
|
|
38254
38254
|
// All managers are now stored in the managers collection and will be attached via attachToComponent()
|
|
@@ -39227,23 +39227,23 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
39227
39227
|
var _this$centralPlant$sc8;
|
|
39228
39228
|
attachIODevicesToComponent(componentModel, componentData, modelPreloader, componentId);
|
|
39229
39229
|
|
|
39230
|
-
// Register
|
|
39231
|
-
var
|
|
39232
|
-
if (
|
|
39230
|
+
// Register behavior configs so IoBehaviorManager can respond to state changes
|
|
39231
|
+
var ioBehavMgr = (_this$centralPlant$sc8 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc8 === void 0 || (_this$centralPlant$sc8 = _this$centralPlant$sc8.managers) === null || _this$centralPlant$sc8 === void 0 ? void 0 : _this$centralPlant$sc8.ioBehaviorManager;
|
|
39232
|
+
if (ioBehavMgr) {
|
|
39233
39233
|
var _loop = function _loop() {
|
|
39234
39234
|
var _modelPreloader$compo;
|
|
39235
39235
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
39236
39236
|
attachmentId = _Object$entries$_i[0],
|
|
39237
39237
|
attachment = _Object$entries$_i[1];
|
|
39238
39238
|
var deviceData = (_modelPreloader$compo = modelPreloader.componentDictionary) === null || _modelPreloader$compo === void 0 ? void 0 : _modelPreloader$compo[attachment.deviceId];
|
|
39239
|
-
if (!(deviceData !== null && deviceData !== void 0 && deviceData.
|
|
39239
|
+
if (!(deviceData !== null && deviceData !== void 0 && deviceData.behaviorConfig)) return 1; // continue
|
|
39240
39240
|
var deviceRoot = null;
|
|
39241
39241
|
componentModel.traverse(function (obj) {
|
|
39242
39242
|
var _obj$userData2;
|
|
39243
39243
|
if (!deviceRoot && ((_obj$userData2 = obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.attachmentId) === attachmentId) deviceRoot = obj;
|
|
39244
39244
|
});
|
|
39245
39245
|
if (deviceRoot) {
|
|
39246
|
-
|
|
39246
|
+
ioBehavMgr.loadBehaviors(attachmentId, deviceData.behaviorConfig, deviceRoot, componentId);
|
|
39247
39247
|
}
|
|
39248
39248
|
};
|
|
39249
39249
|
for (var _i = 0, _Object$entries = Object.entries(componentData.attachedDevices); _i < _Object$entries.length; _i++) {
|
|
@@ -39550,7 +39550,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
39550
39550
|
* Initialize the CentralPlant manager
|
|
39551
39551
|
*
|
|
39552
39552
|
* @constructor
|
|
39553
|
-
* @version 0.3.
|
|
39553
|
+
* @version 0.3.29
|
|
39554
39554
|
* @updated 2025-10-22
|
|
39555
39555
|
*
|
|
39556
39556
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -40628,8 +40628,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
40628
40628
|
}
|
|
40629
40629
|
}
|
|
40630
40630
|
|
|
40631
|
-
// 2. Apply io-
|
|
40632
|
-
(_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.
|
|
40631
|
+
// 2. Apply io-behavior changes
|
|
40632
|
+
(_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.ioBehaviorManager) === null || _this$sceneViewer5 === void 0 || _this$sceneViewer5.triggerState(attachmentId, stateId, value, parentUuid);
|
|
40633
40633
|
|
|
40634
40634
|
// 3. Emit event for host apps that don't use the state adapter (e.g. cp3d-viewer)
|
|
40635
40635
|
(_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || _this$sceneViewer6.emit('io-device-state-changed', {
|
|
@@ -42460,7 +42460,7 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
42460
42460
|
this.centralPlant.attachToComponent();
|
|
42461
42461
|
|
|
42462
42462
|
// Sync our managers tracking object after attachment
|
|
42463
|
-
managerKeys = ['threeJSResourceManager', 'performanceMonitorManager', 'settingsManager', 'sceneExportManager', 'componentManager', 'sceneInitializationManager', 'environmentManager', 'keyboardControlsManager', 'pathfindingManager', 'pathFlowManager', '
|
|
42463
|
+
managerKeys = ['threeJSResourceManager', 'performanceMonitorManager', 'settingsManager', 'sceneExportManager', 'componentManager', 'sceneInitializationManager', 'environmentManager', 'keyboardControlsManager', 'pathfindingManager', 'pathFlowManager', 'ioBehaviorManager', 'ioOutlineManager', 'sceneOperationsManager', 'animationManager', 'cameraControlsManager', 'componentDragManager', 'tooltipsManager', 'componentTooltipManager']; // Populate our managers tracking object
|
|
42464
42464
|
managerKeys.forEach(function (key) {
|
|
42465
42465
|
if (_this2[key]) {
|
|
42466
42466
|
_this2.managers[key] = _this2[key];
|
|
@@ -42792,10 +42792,10 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
42792
42792
|
},
|
|
42793
42793
|
onIODeviceDrag: function onIODeviceDrag(ioDeviceObject, signedDelta, isStart) {
|
|
42794
42794
|
if (isStart) {
|
|
42795
|
-
var _ioDeviceObject$userD, _this4$managers$
|
|
42795
|
+
var _ioDeviceObject$userD, _this4$managers$ioBeh, _this4$managers, _this4$managers2;
|
|
42796
42796
|
// Resolve parentUuid by walking up to the host component.
|
|
42797
42797
|
// Use userData.originalUuid (the custom componentId) because that
|
|
42798
|
-
// is what
|
|
42798
|
+
// is what IoBehaviorManager uses as the map key — NOT obj.uuid.
|
|
42799
42799
|
var parentUuid = null;
|
|
42800
42800
|
var obj = ioDeviceObject.parent;
|
|
42801
42801
|
while (obj) {
|
|
@@ -42811,7 +42811,7 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
42811
42811
|
// silhouette is isolated and the outline ring is visible around
|
|
42812
42812
|
// them specifically (not swallowed by the larger device body).
|
|
42813
42813
|
// Fall back to the whole device group when none are registered.
|
|
42814
|
-
var animatedMeshes = attachmentId && parentUuid ? (_this4$managers$
|
|
42814
|
+
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 : [] : [];
|
|
42815
42815
|
var targets = animatedMeshes.length > 0 ? animatedMeshes : [ioDeviceObject];
|
|
42816
42816
|
(_this4$managers2 = _this4.managers) === null || _this4$managers2 === void 0 || (_this4$managers2 = _this4$managers2.ioOutlineManager) === null || _this4$managers2 === void 0 || _this4$managers2.setTargets(targets);
|
|
42817
42817
|
}
|
|
@@ -48190,7 +48190,7 @@ exports.ComponentTooltipManager = ComponentTooltipManager;
|
|
|
48190
48190
|
exports.EnvironmentManager = EnvironmentManager;
|
|
48191
48191
|
exports.FLOW_ATTRIBUTE_KEYS = FLOW_ATTRIBUTE_KEYS;
|
|
48192
48192
|
exports.GLOBAL_CACHE_NAME = GLOBAL_CACHE_NAME;
|
|
48193
|
-
exports.
|
|
48193
|
+
exports.IoBehaviorManager = IoBehaviorManager;
|
|
48194
48194
|
exports.KeyboardControlsManager = KeyboardControlsManager;
|
|
48195
48195
|
exports.ModelManager = ModelManager;
|
|
48196
48196
|
exports.OperationHistoryManager = OperationHistoryManager;
|
|
@@ -35,7 +35,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
35
35
|
* Initialize the CentralPlant manager
|
|
36
36
|
*
|
|
37
37
|
* @constructor
|
|
38
|
-
* @version 0.3.
|
|
38
|
+
* @version 0.3.29
|
|
39
39
|
* @updated 2025-10-22
|
|
40
40
|
*
|
|
41
41
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -1113,8 +1113,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
|
-
// 2. Apply io-
|
|
1117
|
-
(_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.
|
|
1116
|
+
// 2. Apply io-behavior changes
|
|
1117
|
+
(_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.ioBehaviorManager) === null || _this$sceneViewer5 === void 0 || _this$sceneViewer5.triggerState(attachmentId, stateId, value, parentUuid);
|
|
1118
1118
|
|
|
1119
1119
|
// 3. Emit event for host apps that don't use the state adapter (e.g. cp3d-viewer)
|
|
1120
1120
|
(_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || _this$sceneViewer6.emit('io-device-state-changed', {
|
|
@@ -26,7 +26,7 @@ var componentDragManager = require('../managers/controls/componentDragManager.js
|
|
|
26
26
|
var sceneTooltipsManager = require('../managers/scene/sceneTooltipsManager.js');
|
|
27
27
|
var componentTooltipManager = require('../managers/scene/componentTooltipManager.js');
|
|
28
28
|
var viewport2DManager = require('../managers/scene/viewport2DManager.js');
|
|
29
|
-
var
|
|
29
|
+
var IoBehaviorManager = require('../managers/behaviors/IoBehaviorManager.js');
|
|
30
30
|
var IoOutlineManager = require('../managers/behaviors/IoOutlineManager.js');
|
|
31
31
|
var nameUtils = require('../utils/nameUtils.js');
|
|
32
32
|
var ioDeviceUtils = require('../utils/ioDeviceUtils.js');
|
|
@@ -173,7 +173,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
173
173
|
this.centralPlant.managers.cameraControlsManager = new cameraControlsManager.CameraControlsManager(this.centralPlant.sceneViewer);
|
|
174
174
|
this.centralPlant.managers.componentDragManager = new componentDragManager.ComponentDragManager(this.centralPlant.sceneViewer);
|
|
175
175
|
this.centralPlant.managers.viewport2DManager = new viewport2DManager.Viewport2DManager(this.centralPlant.sceneViewer);
|
|
176
|
-
this.centralPlant.managers.
|
|
176
|
+
this.centralPlant.managers.ioBehaviorManager = new IoBehaviorManager.IoBehaviorManager(this.centralPlant.sceneViewer);
|
|
177
177
|
this.centralPlant.managers.ioOutlineManager = new IoOutlineManager.IoOutlineManager(this.centralPlant.sceneViewer);
|
|
178
178
|
|
|
179
179
|
// All managers are now stored in the managers collection and will be attached via attachToComponent()
|
|
@@ -1152,23 +1152,23 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
1152
1152
|
var _this$centralPlant$sc8;
|
|
1153
1153
|
ioDeviceUtils.attachIODevicesToComponent(componentModel, componentData, modelPreloader, componentId);
|
|
1154
1154
|
|
|
1155
|
-
// Register
|
|
1156
|
-
var
|
|
1157
|
-
if (
|
|
1155
|
+
// Register behavior configs so IoBehaviorManager can respond to state changes
|
|
1156
|
+
var ioBehavMgr = (_this$centralPlant$sc8 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc8 === void 0 || (_this$centralPlant$sc8 = _this$centralPlant$sc8.managers) === null || _this$centralPlant$sc8 === void 0 ? void 0 : _this$centralPlant$sc8.ioBehaviorManager;
|
|
1157
|
+
if (ioBehavMgr) {
|
|
1158
1158
|
var _loop = function _loop() {
|
|
1159
1159
|
var _modelPreloader$compo;
|
|
1160
1160
|
var _Object$entries$_i = _rollupPluginBabelHelpers.slicedToArray(_Object$entries[_i], 2),
|
|
1161
1161
|
attachmentId = _Object$entries$_i[0],
|
|
1162
1162
|
attachment = _Object$entries$_i[1];
|
|
1163
1163
|
var deviceData = (_modelPreloader$compo = modelPreloader.componentDictionary) === null || _modelPreloader$compo === void 0 ? void 0 : _modelPreloader$compo[attachment.deviceId];
|
|
1164
|
-
if (!(deviceData !== null && deviceData !== void 0 && deviceData.
|
|
1164
|
+
if (!(deviceData !== null && deviceData !== void 0 && deviceData.behaviorConfig)) return 1; // continue
|
|
1165
1165
|
var deviceRoot = null;
|
|
1166
1166
|
componentModel.traverse(function (obj) {
|
|
1167
1167
|
var _obj$userData2;
|
|
1168
1168
|
if (!deviceRoot && ((_obj$userData2 = obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.attachmentId) === attachmentId) deviceRoot = obj;
|
|
1169
1169
|
});
|
|
1170
1170
|
if (deviceRoot) {
|
|
1171
|
-
|
|
1171
|
+
ioBehavMgr.loadBehaviors(attachmentId, deviceData.behaviorConfig, deviceRoot, componentId);
|
|
1172
1172
|
}
|
|
1173
1173
|
};
|
|
1174
1174
|
for (var _i = 0, _Object$entries = Object.entries(componentData.attachedDevices); _i < _Object$entries.length; _i++) {
|
|
@@ -102,7 +102,7 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
102
102
|
this.centralPlant.attachToComponent();
|
|
103
103
|
|
|
104
104
|
// Sync our managers tracking object after attachment
|
|
105
|
-
managerKeys = ['threeJSResourceManager', 'performanceMonitorManager', 'settingsManager', 'sceneExportManager', 'componentManager', 'sceneInitializationManager', 'environmentManager', 'keyboardControlsManager', 'pathfindingManager', 'pathFlowManager', '
|
|
105
|
+
managerKeys = ['threeJSResourceManager', 'performanceMonitorManager', 'settingsManager', 'sceneExportManager', 'componentManager', 'sceneInitializationManager', 'environmentManager', 'keyboardControlsManager', 'pathfindingManager', 'pathFlowManager', 'ioBehaviorManager', 'ioOutlineManager', 'sceneOperationsManager', 'animationManager', 'cameraControlsManager', 'componentDragManager', 'tooltipsManager', 'componentTooltipManager']; // Populate our managers tracking object
|
|
106
106
|
managerKeys.forEach(function (key) {
|
|
107
107
|
if (_this2[key]) {
|
|
108
108
|
_this2.managers[key] = _this2[key];
|
|
@@ -434,10 +434,10 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
434
434
|
},
|
|
435
435
|
onIODeviceDrag: function onIODeviceDrag(ioDeviceObject, signedDelta, isStart) {
|
|
436
436
|
if (isStart) {
|
|
437
|
-
var _ioDeviceObject$userD, _this4$managers$
|
|
437
|
+
var _ioDeviceObject$userD, _this4$managers$ioBeh, _this4$managers, _this4$managers2;
|
|
438
438
|
// Resolve parentUuid by walking up to the host component.
|
|
439
439
|
// Use userData.originalUuid (the custom componentId) because that
|
|
440
|
-
// is what
|
|
440
|
+
// is what IoBehaviorManager uses as the map key — NOT obj.uuid.
|
|
441
441
|
var parentUuid = null;
|
|
442
442
|
var obj = ioDeviceObject.parent;
|
|
443
443
|
while (obj) {
|
|
@@ -453,7 +453,7 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
453
453
|
// silhouette is isolated and the outline ring is visible around
|
|
454
454
|
// them specifically (not swallowed by the larger device body).
|
|
455
455
|
// Fall back to the whole device group when none are registered.
|
|
456
|
-
var animatedMeshes = attachmentId && parentUuid ? (_this4$managers$
|
|
456
|
+
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 : [] : [];
|
|
457
457
|
var targets = animatedMeshes.length > 0 ? animatedMeshes : [ioDeviceObject];
|
|
458
458
|
(_this4$managers2 = _this4.managers) === null || _this4$managers2 === void 0 || (_this4$managers2 = _this4$managers2.ioOutlineManager) === null || _this4$managers2 === void 0 || _this4$managers2.setTargets(targets);
|
|
459
459
|
}
|
package/dist/cjs/src/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var sceneExportManager = require('./managers/scene/sceneExportManager.js');
|
|
|
13
13
|
var sceneTooltipsManager = require('./managers/scene/sceneTooltipsManager.js');
|
|
14
14
|
var componentTooltipManager = require('./managers/scene/componentTooltipManager.js');
|
|
15
15
|
var sceneHierarchyManager = require('./managers/scene/sceneHierarchyManager.js');
|
|
16
|
-
var
|
|
16
|
+
var IoBehaviorManager = require('./managers/behaviors/IoBehaviorManager.js');
|
|
17
17
|
var componentManager = require('./managers/components/componentManager.js');
|
|
18
18
|
var animationManager = require('./managers/scene/animationManager.js');
|
|
19
19
|
var pathfindingManager = require('./managers/pathfinding/pathfindingManager.js');
|
|
@@ -67,7 +67,7 @@ exports.SceneExportManager = sceneExportManager.SceneExportManager;
|
|
|
67
67
|
exports.SceneTooltipsManager = sceneTooltipsManager.SceneTooltipsManager;
|
|
68
68
|
exports.ComponentTooltipManager = componentTooltipManager.ComponentTooltipManager;
|
|
69
69
|
exports.SceneHierarchyManager = sceneHierarchyManager.SceneHierarchyManager;
|
|
70
|
-
exports.
|
|
70
|
+
exports.IoBehaviorManager = IoBehaviorManager.IoBehaviorManager;
|
|
71
71
|
exports.ComponentManager = componentManager.ComponentManager;
|
|
72
72
|
exports.AnimationManager = animationManager.AnimationManager;
|
|
73
73
|
exports.PathfindingManager = pathfindingManager.PathfindingManager;
|