@2112-lab/central-plant 0.3.44 → 0.3.46
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 +557 -349
- package/dist/cjs/src/core/centralPlant.js +352 -241
- package/dist/cjs/src/core/centralPlantInternals.js +2 -0
- package/dist/cjs/src/index.js +0 -1
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +62 -7
- package/dist/cjs/src/managers/controls/componentDragManager.js +2 -1
- package/dist/cjs/src/managers/scene/collisionManager.js +143 -0
- package/dist/cjs/src/managers/scene/sceneExportManager.js +2 -0
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +10 -46
- package/dist/cjs/src/utils/animationTransformUtils.js +8 -1
- package/dist/cjs/src/utils/demoSceneUtils.js +1 -51
- package/dist/esm/src/core/centralPlant.js +352 -241
- package/dist/esm/src/core/centralPlantInternals.js +2 -0
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +62 -7
- package/dist/esm/src/managers/controls/componentDragManager.js +2 -1
- package/dist/esm/src/managers/scene/collisionManager.js +119 -0
- package/dist/esm/src/managers/scene/sceneExportManager.js +2 -0
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +10 -46
- package/dist/esm/src/utils/animationTransformUtils.js +8 -1
- package/dist/esm/src/utils/demoSceneUtils.js +2 -51
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
33
33
|
* Initialize the CentralPlant manager
|
|
34
34
|
*
|
|
35
35
|
* @constructor
|
|
36
|
-
* @version 0.3.
|
|
36
|
+
* @version 0.3.46
|
|
37
37
|
* @updated 2025-10-22
|
|
38
38
|
*
|
|
39
39
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -171,6 +171,32 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
171
171
|
return this.internals.attachToComponent();
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Check if an object in the scene collides with any other objects
|
|
176
|
+
* @param {string} objectId - The UUID or originalUuid of the object to check
|
|
177
|
+
* @returns {Object|null} Collision info if detected, null otherwise
|
|
178
|
+
*/
|
|
179
|
+
}, {
|
|
180
|
+
key: "checkCollision",
|
|
181
|
+
value: function checkCollision(objectId) {
|
|
182
|
+
if (!this.sceneViewer || !this.managers.collisionManager) {
|
|
183
|
+
console.warn('⚠️ checkCollision(): Scene viewer or collision manager not available');
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
var targetObject = null;
|
|
187
|
+
this.sceneViewer.scene.traverse(function (child) {
|
|
188
|
+
var _child$userData;
|
|
189
|
+
if (child.uuid === objectId || ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.originalUuid) === objectId) {
|
|
190
|
+
targetObject = child;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
if (!targetObject) {
|
|
194
|
+
console.warn("\u26A0\uFE0F checkCollision(): Object with ID '".concat(objectId, "' not found"));
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return this.managers.collisionManager.checkCollision(targetObject);
|
|
198
|
+
}
|
|
199
|
+
|
|
174
200
|
/**
|
|
175
201
|
* Initialize specific managers that need to be created after scene setup
|
|
176
202
|
* @returns {boolean} True if post-scene managers were initialized successfully, false otherwise
|
|
@@ -851,6 +877,104 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
851
877
|
return this.internals.addConnection(fromConnectorId, toConnectorId);
|
|
852
878
|
}
|
|
853
879
|
|
|
880
|
+
/**
|
|
881
|
+
* Randomly connect available component connectors in the scene.
|
|
882
|
+
* Attempts to pair as many free connectors as possible.
|
|
883
|
+
* @returns {Array<Object>} List of added connections.
|
|
884
|
+
*/
|
|
885
|
+
}, {
|
|
886
|
+
key: "addRandomConnections",
|
|
887
|
+
value: (function () {
|
|
888
|
+
var _addRandomConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
889
|
+
var _this$sceneViewer4;
|
|
890
|
+
var connectors, scene, currentConns, busyConnectorIds, freeConnectors, i, j, _ref, added, from, _i, to, isCompatible, isDifferentParent, conn;
|
|
891
|
+
return _regenerator().w(function (_context3) {
|
|
892
|
+
while (1) switch (_context3.n) {
|
|
893
|
+
case 0:
|
|
894
|
+
connectors = [];
|
|
895
|
+
scene = (_this$sceneViewer4 = this.sceneViewer) === null || _this$sceneViewer4 === void 0 ? void 0 : _this$sceneViewer4.scene;
|
|
896
|
+
if (scene) {
|
|
897
|
+
_context3.n = 1;
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
return _context3.a(2, []);
|
|
901
|
+
case 1:
|
|
902
|
+
// Find all free connectors in the scene
|
|
903
|
+
scene.traverse(function (obj) {
|
|
904
|
+
var _obj$userData;
|
|
905
|
+
if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'connector' && obj.uuid) {
|
|
906
|
+
connectors.push({
|
|
907
|
+
uuid: obj.uuid,
|
|
908
|
+
flow: obj.userData.flow || 'bi',
|
|
909
|
+
parent: obj.parent
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
// Get current connections to avoid double-connecting
|
|
915
|
+
currentConns = this.getConnections();
|
|
916
|
+
busyConnectorIds = new Set();
|
|
917
|
+
currentConns.forEach(function (conn) {
|
|
918
|
+
busyConnectorIds.add(conn.from);
|
|
919
|
+
busyConnectorIds.add(conn.to);
|
|
920
|
+
});
|
|
921
|
+
freeConnectors = connectors.filter(function (c) {
|
|
922
|
+
return !busyConnectorIds.has(c.uuid);
|
|
923
|
+
}); // Shuffle free connectors
|
|
924
|
+
for (i = freeConnectors.length - 1; i > 0; i--) {
|
|
925
|
+
j = Math.floor(Math.random() * (i + 1));
|
|
926
|
+
_ref = [freeConnectors[j], freeConnectors[i]];
|
|
927
|
+
freeConnectors[i] = _ref[0];
|
|
928
|
+
freeConnectors[j] = _ref[1];
|
|
929
|
+
}
|
|
930
|
+
added = []; // Greedy pairing
|
|
931
|
+
case 2:
|
|
932
|
+
if (!(freeConnectors.length >= 2)) {
|
|
933
|
+
_context3.n = 6;
|
|
934
|
+
break;
|
|
935
|
+
}
|
|
936
|
+
from = freeConnectors.pop();
|
|
937
|
+
_i = 0;
|
|
938
|
+
case 3:
|
|
939
|
+
if (!(_i < freeConnectors.length)) {
|
|
940
|
+
_context3.n = 5;
|
|
941
|
+
break;
|
|
942
|
+
}
|
|
943
|
+
to = freeConnectors[_i]; // Basic flow compatibility check (CentralPlantInternals.addConnection does this too)
|
|
944
|
+
isCompatible = from.flow === 'bi' || to.flow === 'bi' || from.flow !== to.flow;
|
|
945
|
+
isDifferentParent = from.parent !== to.parent;
|
|
946
|
+
if (!(isCompatible && isDifferentParent)) {
|
|
947
|
+
_context3.n = 4;
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
conn = this.addConnection(from.uuid, to.uuid);
|
|
951
|
+
if (!conn) {
|
|
952
|
+
_context3.n = 4;
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
955
|
+
added.push(conn);
|
|
956
|
+
freeConnectors.splice(_i, 1);
|
|
957
|
+
return _context3.a(3, 5);
|
|
958
|
+
case 4:
|
|
959
|
+
_i++;
|
|
960
|
+
_context3.n = 3;
|
|
961
|
+
break;
|
|
962
|
+
case 5:
|
|
963
|
+
_context3.n = 2;
|
|
964
|
+
break;
|
|
965
|
+
case 6:
|
|
966
|
+
if (added.length > 0) {
|
|
967
|
+
this.updatePaths();
|
|
968
|
+
}
|
|
969
|
+
return _context3.a(2, added);
|
|
970
|
+
}
|
|
971
|
+
}, _callee3, this);
|
|
972
|
+
}));
|
|
973
|
+
function addRandomConnections() {
|
|
974
|
+
return _addRandomConnections.apply(this, arguments);
|
|
975
|
+
}
|
|
976
|
+
return addRandomConnections;
|
|
977
|
+
}()
|
|
854
978
|
/**
|
|
855
979
|
* Remove a connection between two component connectors
|
|
856
980
|
* @param {string} fromConnectorId - The UUID of the source connector
|
|
@@ -872,6 +996,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
872
996
|
* centralPlant.updatePaths();
|
|
873
997
|
* }
|
|
874
998
|
*/
|
|
999
|
+
)
|
|
875
1000
|
}, {
|
|
876
1001
|
key: "removeConnection",
|
|
877
1002
|
value: function removeConnection(fromConnectorId, toConnectorId) {
|
|
@@ -1076,8 +1201,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1076
1201
|
}, {
|
|
1077
1202
|
key: "_dispatchIoState",
|
|
1078
1203
|
value: function _dispatchIoState(attachmentId, stateId, value, parentUuid) {
|
|
1079
|
-
var _this$managers, _this$
|
|
1080
|
-
var tooltipMgr = ((_this$managers = this.managers) === null || _this$managers === void 0 ? void 0 : _this$managers.componentTooltipManager) || ((_this$
|
|
1204
|
+
var _this$managers, _this$sceneViewer5, _this$sceneViewer6, _this$managers2, _this$sceneViewer7, _this$sceneViewer8, _this$sceneViewer9;
|
|
1205
|
+
var tooltipMgr = ((_this$managers = this.managers) === null || _this$managers === void 0 ? void 0 : _this$managers.componentTooltipManager) || ((_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 ? void 0 : _this$sceneViewer5.componentTooltipManager) || ((_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.managers) === null || _this$sceneViewer6 === void 0 ? void 0 : _this$sceneViewer6.componentTooltipManager);
|
|
1081
1206
|
var stateAdapter = tooltipMgr === null || tooltipMgr === void 0 ? void 0 : tooltipMgr._stateAdapter;
|
|
1082
1207
|
if (stateAdapter !== null && stateAdapter !== void 0 && stateAdapter.setState) {
|
|
1083
1208
|
var scopedKey = getScopedAttachmentKey(attachmentId, parentUuid);
|
|
@@ -1087,11 +1212,11 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1087
1212
|
console.warn('⚠️ _dispatchIoState(): stateAdapter.setState() threw:', err);
|
|
1088
1213
|
}
|
|
1089
1214
|
}
|
|
1090
|
-
var ioBehavMgr = ((_this$managers2 = this.managers) === null || _this$managers2 === void 0 ? void 0 : _this$managers2.ioBehaviorManager) || ((_this$
|
|
1215
|
+
var ioBehavMgr = ((_this$managers2 = this.managers) === null || _this$managers2 === void 0 ? void 0 : _this$managers2.ioBehaviorManager) || ((_this$sceneViewer7 = this.sceneViewer) === null || _this$sceneViewer7 === void 0 || (_this$sceneViewer7 = _this$sceneViewer7.managers) === null || _this$sceneViewer7 === void 0 ? void 0 : _this$sceneViewer7.ioBehaviorManager) || ((_this$sceneViewer8 = this.sceneViewer) === null || _this$sceneViewer8 === void 0 ? void 0 : _this$sceneViewer8.ioBehaviorManager);
|
|
1091
1216
|
if (ioBehavMgr) {
|
|
1092
1217
|
ioBehavMgr.triggerState(attachmentId, stateId, value, parentUuid);
|
|
1093
1218
|
}
|
|
1094
|
-
(_this$
|
|
1219
|
+
(_this$sceneViewer9 = this.sceneViewer) === null || _this$sceneViewer9 === void 0 || _this$sceneViewer9.emit('io-device-state-changed', {
|
|
1095
1220
|
attachmentId: attachmentId,
|
|
1096
1221
|
stateId: stateId,
|
|
1097
1222
|
value: value,
|
|
@@ -1106,16 +1231,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1106
1231
|
}, {
|
|
1107
1232
|
key: "configureStateAdapter",
|
|
1108
1233
|
value: function configureStateAdapter(stateAdapter) {
|
|
1109
|
-
var _this$managers3, _this$
|
|
1110
|
-
var tooltipMgr = ((_this$managers3 = this.managers) === null || _this$managers3 === void 0 ? void 0 : _this$managers3.componentTooltipManager) || ((_this$
|
|
1234
|
+
var _this$managers3, _this$sceneViewer0, _this$managers4, _this$sceneViewer10, _this$sceneViewer11;
|
|
1235
|
+
var tooltipMgr = ((_this$managers3 = this.managers) === null || _this$managers3 === void 0 ? void 0 : _this$managers3.componentTooltipManager) || ((_this$sceneViewer0 = this.sceneViewer) === null || _this$sceneViewer0 === void 0 ? void 0 : _this$sceneViewer0.componentTooltipManager);
|
|
1111
1236
|
if (tooltipMgr !== null && tooltipMgr !== void 0 && tooltipMgr.configure) {
|
|
1112
|
-
var _this$
|
|
1237
|
+
var _this$sceneViewer1;
|
|
1113
1238
|
tooltipMgr.configure(stateAdapter);
|
|
1114
|
-
if ((_this$
|
|
1239
|
+
if ((_this$sceneViewer1 = this.sceneViewer) !== null && _this$sceneViewer1 !== void 0 && _this$sceneViewer1.managers) {
|
|
1115
1240
|
this.sceneViewer.managers.componentTooltipManager = tooltipMgr;
|
|
1116
1241
|
}
|
|
1117
1242
|
}
|
|
1118
|
-
var ioBehavMgr = ((_this$managers4 = this.managers) === null || _this$managers4 === void 0 ? void 0 : _this$managers4.ioBehaviorManager) || ((_this$
|
|
1243
|
+
var ioBehavMgr = ((_this$managers4 = this.managers) === null || _this$managers4 === void 0 ? void 0 : _this$managers4.ioBehaviorManager) || ((_this$sceneViewer10 = this.sceneViewer) === null || _this$sceneViewer10 === void 0 || (_this$sceneViewer10 = _this$sceneViewer10.managers) === null || _this$sceneViewer10 === void 0 ? void 0 : _this$sceneViewer10.ioBehaviorManager) || ((_this$sceneViewer11 = this.sceneViewer) === null || _this$sceneViewer11 === void 0 ? void 0 : _this$sceneViewer11.ioBehaviorManager);
|
|
1119
1244
|
if (ioBehavMgr !== null && ioBehavMgr !== void 0 && ioBehavMgr.configure) {
|
|
1120
1245
|
ioBehavMgr.configure(stateAdapter);
|
|
1121
1246
|
}
|
|
@@ -1150,13 +1275,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1150
1275
|
}, {
|
|
1151
1276
|
key: "getSceneAttachments",
|
|
1152
1277
|
value: function getSceneAttachments() {
|
|
1153
|
-
var _this$
|
|
1154
|
-
var scene = (_this$
|
|
1278
|
+
var _this$sceneViewer12;
|
|
1279
|
+
var scene = (_this$sceneViewer12 = this.sceneViewer) === null || _this$sceneViewer12 === void 0 ? void 0 : _this$sceneViewer12.scene;
|
|
1155
1280
|
if (!scene) return [];
|
|
1156
1281
|
var results = [];
|
|
1157
1282
|
scene.traverse(function (obj) {
|
|
1158
|
-
var _obj$
|
|
1159
|
-
if (((_obj$
|
|
1283
|
+
var _obj$userData2;
|
|
1284
|
+
if (((_obj$userData2 = obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.objectType) === 'io-device') {
|
|
1160
1285
|
var _parent$userData;
|
|
1161
1286
|
var attachmentId = obj.userData.attachmentId || obj.name || obj.uuid;
|
|
1162
1287
|
var label = obj.userData.attachmentLabel || attachmentId;
|
|
@@ -1216,9 +1341,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1216
1341
|
}, {
|
|
1217
1342
|
key: "getIoDevices",
|
|
1218
1343
|
value: function getIoDevices() {
|
|
1219
|
-
var
|
|
1220
|
-
|
|
1221
|
-
source =
|
|
1344
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1345
|
+
_ref2$source = _ref2.source,
|
|
1346
|
+
source = _ref2$source === void 0 ? 'all' : _ref2$source;
|
|
1222
1347
|
var mp = this.getUtility('modelPreloader');
|
|
1223
1348
|
var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
|
|
1224
1349
|
if (!dict) {
|
|
@@ -1254,8 +1379,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1254
1379
|
}, {
|
|
1255
1380
|
key: "getIoDeviceUsage",
|
|
1256
1381
|
value: function getIoDeviceUsage() {
|
|
1257
|
-
var
|
|
1258
|
-
deviceUuid =
|
|
1382
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1383
|
+
deviceUuid = _ref3.deviceUuid;
|
|
1259
1384
|
if (!deviceUuid) {
|
|
1260
1385
|
console.warn('⚠️ getIoDeviceUsage(): deviceUuid is required');
|
|
1261
1386
|
return [];
|
|
@@ -1306,38 +1431,38 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1306
1431
|
}, {
|
|
1307
1432
|
key: "createSmartComponent",
|
|
1308
1433
|
value: (function () {
|
|
1309
|
-
var _createSmartComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1310
|
-
var
|
|
1434
|
+
var _createSmartComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
1435
|
+
var _ref4,
|
|
1311
1436
|
componentUuid,
|
|
1312
1437
|
name,
|
|
1313
1438
|
attachments,
|
|
1314
1439
|
thumbnailBlob,
|
|
1315
1440
|
newAsset,
|
|
1316
1441
|
mp,
|
|
1317
|
-
|
|
1318
|
-
return _regenerator().w(function (
|
|
1319
|
-
while (1) switch (
|
|
1442
|
+
_args4 = arguments;
|
|
1443
|
+
return _regenerator().w(function (_context4) {
|
|
1444
|
+
while (1) switch (_context4.n) {
|
|
1320
1445
|
case 0:
|
|
1321
|
-
|
|
1446
|
+
_ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, name = _ref4.name, attachments = _ref4.attachments, thumbnailBlob = _ref4.thumbnailBlob;
|
|
1322
1447
|
if (this.assetService) {
|
|
1323
|
-
|
|
1448
|
+
_context4.n = 1;
|
|
1324
1449
|
break;
|
|
1325
1450
|
}
|
|
1326
1451
|
throw new Error('createSmartComponent(): no asset service set — call setAssetService() first');
|
|
1327
1452
|
case 1:
|
|
1328
1453
|
if (componentUuid) {
|
|
1329
|
-
|
|
1454
|
+
_context4.n = 2;
|
|
1330
1455
|
break;
|
|
1331
1456
|
}
|
|
1332
1457
|
throw new Error('createSmartComponent(): componentUuid is required');
|
|
1333
1458
|
case 2:
|
|
1334
1459
|
if (!(!Array.isArray(attachments) || attachments.length === 0)) {
|
|
1335
|
-
|
|
1460
|
+
_context4.n = 3;
|
|
1336
1461
|
break;
|
|
1337
1462
|
}
|
|
1338
1463
|
throw new Error('createSmartComponent(): at least one attachment is required');
|
|
1339
1464
|
case 3:
|
|
1340
|
-
|
|
1465
|
+
_context4.n = 4;
|
|
1341
1466
|
return this.assetService.createSmartComponent({
|
|
1342
1467
|
componentUuid: componentUuid,
|
|
1343
1468
|
name: name,
|
|
@@ -1345,7 +1470,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1345
1470
|
thumbnailBlob: thumbnailBlob
|
|
1346
1471
|
});
|
|
1347
1472
|
case 4:
|
|
1348
|
-
newAsset =
|
|
1473
|
+
newAsset = _context4.v;
|
|
1349
1474
|
// Register in model preloader dictionary so addComponent() can use it immediately
|
|
1350
1475
|
mp = this.getUtility('modelPreloader');
|
|
1351
1476
|
if (mp !== null && mp !== void 0 && mp.componentDictionary && newAsset !== null && newAsset !== void 0 && newAsset.uuid) {
|
|
@@ -1354,9 +1479,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1354
1479
|
});
|
|
1355
1480
|
console.log("\u2705 createSmartComponent(): registered \"".concat(newAsset.name, "\" in component dictionary"));
|
|
1356
1481
|
}
|
|
1357
|
-
return
|
|
1482
|
+
return _context4.a(2, newAsset);
|
|
1358
1483
|
}
|
|
1359
|
-
},
|
|
1484
|
+
}, _callee4, this);
|
|
1360
1485
|
}));
|
|
1361
1486
|
function createSmartComponent() {
|
|
1362
1487
|
return _createSmartComponent.apply(this, arguments);
|
|
@@ -1390,42 +1515,42 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1390
1515
|
}, {
|
|
1391
1516
|
key: "addComponentAttachment",
|
|
1392
1517
|
value: (function () {
|
|
1393
|
-
var _addComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1394
|
-
var
|
|
1518
|
+
var _addComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
1519
|
+
var _ref5,
|
|
1395
1520
|
componentUuid,
|
|
1396
1521
|
attachment,
|
|
1397
1522
|
updatedAsset,
|
|
1398
1523
|
mp,
|
|
1399
|
-
|
|
1400
|
-
return _regenerator().w(function (
|
|
1401
|
-
while (1) switch (
|
|
1524
|
+
_args5 = arguments;
|
|
1525
|
+
return _regenerator().w(function (_context5) {
|
|
1526
|
+
while (1) switch (_context5.n) {
|
|
1402
1527
|
case 0:
|
|
1403
|
-
|
|
1528
|
+
_ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachment = _ref5.attachment;
|
|
1404
1529
|
if (this.assetService) {
|
|
1405
|
-
|
|
1530
|
+
_context5.n = 1;
|
|
1406
1531
|
break;
|
|
1407
1532
|
}
|
|
1408
1533
|
throw new Error('addComponentAttachment(): no asset service set — call setAssetService() first');
|
|
1409
1534
|
case 1:
|
|
1410
1535
|
if (componentUuid) {
|
|
1411
|
-
|
|
1536
|
+
_context5.n = 2;
|
|
1412
1537
|
break;
|
|
1413
1538
|
}
|
|
1414
1539
|
throw new Error('addComponentAttachment(): componentUuid is required');
|
|
1415
1540
|
case 2:
|
|
1416
1541
|
if (!(!(attachment !== null && attachment !== void 0 && attachment.attachmentId) || !(attachment !== null && attachment !== void 0 && attachment.deviceId))) {
|
|
1417
|
-
|
|
1542
|
+
_context5.n = 3;
|
|
1418
1543
|
break;
|
|
1419
1544
|
}
|
|
1420
1545
|
throw new Error('addComponentAttachment(): attachment must have attachmentId and deviceId');
|
|
1421
1546
|
case 3:
|
|
1422
|
-
|
|
1547
|
+
_context5.n = 4;
|
|
1423
1548
|
return this.assetService.addComponentAttachment({
|
|
1424
1549
|
componentUuid: componentUuid,
|
|
1425
1550
|
attachment: attachment
|
|
1426
1551
|
});
|
|
1427
1552
|
case 4:
|
|
1428
|
-
updatedAsset =
|
|
1553
|
+
updatedAsset = _context5.v;
|
|
1429
1554
|
// Sync component dictionary
|
|
1430
1555
|
mp = this.getUtility('modelPreloader');
|
|
1431
1556
|
if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
|
|
@@ -1433,9 +1558,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1433
1558
|
id: updatedAsset.uuid
|
|
1434
1559
|
});
|
|
1435
1560
|
}
|
|
1436
|
-
return
|
|
1561
|
+
return _context5.a(2, updatedAsset);
|
|
1437
1562
|
}
|
|
1438
|
-
},
|
|
1563
|
+
}, _callee5, this);
|
|
1439
1564
|
}));
|
|
1440
1565
|
function addComponentAttachment() {
|
|
1441
1566
|
return _addComponentAttachment.apply(this, arguments);
|
|
@@ -1461,42 +1586,42 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1461
1586
|
}, {
|
|
1462
1587
|
key: "removeComponentAttachment",
|
|
1463
1588
|
value: (function () {
|
|
1464
|
-
var _removeComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1465
|
-
var
|
|
1589
|
+
var _removeComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
1590
|
+
var _ref6,
|
|
1466
1591
|
componentUuid,
|
|
1467
1592
|
attachmentId,
|
|
1468
1593
|
updatedAsset,
|
|
1469
1594
|
mp,
|
|
1470
|
-
|
|
1471
|
-
return _regenerator().w(function (
|
|
1472
|
-
while (1) switch (
|
|
1595
|
+
_args6 = arguments;
|
|
1596
|
+
return _regenerator().w(function (_context6) {
|
|
1597
|
+
while (1) switch (_context6.n) {
|
|
1473
1598
|
case 0:
|
|
1474
|
-
|
|
1599
|
+
_ref6 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, componentUuid = _ref6.componentUuid, attachmentId = _ref6.attachmentId;
|
|
1475
1600
|
if (this.assetService) {
|
|
1476
|
-
|
|
1601
|
+
_context6.n = 1;
|
|
1477
1602
|
break;
|
|
1478
1603
|
}
|
|
1479
1604
|
throw new Error('removeComponentAttachment(): no asset service set — call setAssetService() first');
|
|
1480
1605
|
case 1:
|
|
1481
1606
|
if (componentUuid) {
|
|
1482
|
-
|
|
1607
|
+
_context6.n = 2;
|
|
1483
1608
|
break;
|
|
1484
1609
|
}
|
|
1485
1610
|
throw new Error('removeComponentAttachment(): componentUuid is required');
|
|
1486
1611
|
case 2:
|
|
1487
1612
|
if (attachmentId) {
|
|
1488
|
-
|
|
1613
|
+
_context6.n = 3;
|
|
1489
1614
|
break;
|
|
1490
1615
|
}
|
|
1491
1616
|
throw new Error('removeComponentAttachment(): attachmentId is required');
|
|
1492
1617
|
case 3:
|
|
1493
|
-
|
|
1618
|
+
_context6.n = 4;
|
|
1494
1619
|
return this.assetService.removeComponentAttachment({
|
|
1495
1620
|
componentUuid: componentUuid,
|
|
1496
1621
|
attachmentId: attachmentId
|
|
1497
1622
|
});
|
|
1498
1623
|
case 4:
|
|
1499
|
-
updatedAsset =
|
|
1624
|
+
updatedAsset = _context6.v;
|
|
1500
1625
|
// Sync component dictionary
|
|
1501
1626
|
mp = this.getUtility('modelPreloader');
|
|
1502
1627
|
if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
|
|
@@ -1504,9 +1629,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1504
1629
|
id: updatedAsset.uuid
|
|
1505
1630
|
});
|
|
1506
1631
|
}
|
|
1507
|
-
return
|
|
1632
|
+
return _context6.a(2, updatedAsset);
|
|
1508
1633
|
}
|
|
1509
|
-
},
|
|
1634
|
+
}, _callee6, this);
|
|
1510
1635
|
}));
|
|
1511
1636
|
function removeComponentAttachment() {
|
|
1512
1637
|
return _removeComponentAttachment.apply(this, arguments);
|
|
@@ -1699,41 +1824,41 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1699
1824
|
}, {
|
|
1700
1825
|
key: "getComponents",
|
|
1701
1826
|
value: (function () {
|
|
1702
|
-
var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1827
|
+
var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
1703
1828
|
var options,
|
|
1704
1829
|
validation,
|
|
1705
1830
|
enhancedOptions,
|
|
1706
|
-
|
|
1831
|
+
_args7 = arguments,
|
|
1707
1832
|
_t;
|
|
1708
|
-
return _regenerator().w(function (
|
|
1709
|
-
while (1) switch (
|
|
1833
|
+
return _regenerator().w(function (_context7) {
|
|
1834
|
+
while (1) switch (_context7.n) {
|
|
1710
1835
|
case 0:
|
|
1711
|
-
options =
|
|
1836
|
+
options = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
1712
1837
|
// Validate filter options using centralized validator
|
|
1713
1838
|
validation = this.internals.validator.validateComponentFilter(options);
|
|
1714
1839
|
if (validation.isValid) {
|
|
1715
|
-
|
|
1840
|
+
_context7.n = 1;
|
|
1716
1841
|
break;
|
|
1717
1842
|
}
|
|
1718
1843
|
console.warn('⚠️ getComponents(): Invalid filter options provided:', validation.message);
|
|
1719
|
-
return
|
|
1844
|
+
return _context7.a(2, []);
|
|
1720
1845
|
case 1:
|
|
1721
|
-
|
|
1846
|
+
_context7.p = 1;
|
|
1722
1847
|
// Always include metadata
|
|
1723
1848
|
enhancedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1724
1849
|
includeMetadata: true
|
|
1725
1850
|
});
|
|
1726
|
-
|
|
1851
|
+
_context7.n = 2;
|
|
1727
1852
|
return this.managers.componentDataManager.getDictionaryComponents(enhancedOptions);
|
|
1728
1853
|
case 2:
|
|
1729
|
-
return
|
|
1854
|
+
return _context7.a(2, _context7.v);
|
|
1730
1855
|
case 3:
|
|
1731
|
-
|
|
1732
|
-
_t =
|
|
1856
|
+
_context7.p = 3;
|
|
1857
|
+
_t = _context7.v;
|
|
1733
1858
|
console.error('❌ getDictionaryComponents(): Error retrieving available components:', _t);
|
|
1734
|
-
return
|
|
1859
|
+
return _context7.a(2, []);
|
|
1735
1860
|
}
|
|
1736
|
-
},
|
|
1861
|
+
}, _callee7, this, [[1, 3]]);
|
|
1737
1862
|
}));
|
|
1738
1863
|
function getComponents() {
|
|
1739
1864
|
return _getComponents.apply(this, arguments);
|
|
@@ -1836,23 +1961,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1836
1961
|
}, {
|
|
1837
1962
|
key: "extendComponentDictionary",
|
|
1838
1963
|
value: (function () {
|
|
1839
|
-
var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1840
|
-
return _regenerator().w(function (
|
|
1841
|
-
while (1) switch (
|
|
1964
|
+
var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(additionalComponents) {
|
|
1965
|
+
return _regenerator().w(function (_context8) {
|
|
1966
|
+
while (1) switch (_context8.n) {
|
|
1842
1967
|
case 0:
|
|
1843
1968
|
if (this.managers.componentDataManager) {
|
|
1844
|
-
|
|
1969
|
+
_context8.n = 1;
|
|
1845
1970
|
break;
|
|
1846
1971
|
}
|
|
1847
1972
|
console.warn('⚠️ extendComponentDictionary(): Component data manager not available');
|
|
1848
|
-
return
|
|
1973
|
+
return _context8.a(2, false);
|
|
1849
1974
|
case 1:
|
|
1850
|
-
|
|
1975
|
+
_context8.n = 2;
|
|
1851
1976
|
return this.managers.componentDataManager.extendComponentDictionary(additionalComponents);
|
|
1852
1977
|
case 2:
|
|
1853
|
-
return
|
|
1978
|
+
return _context8.a(2, _context8.v);
|
|
1854
1979
|
}
|
|
1855
|
-
},
|
|
1980
|
+
}, _callee8, this);
|
|
1856
1981
|
}));
|
|
1857
1982
|
function extendComponentDictionary(_x3) {
|
|
1858
1983
|
return _extendComponentDictionary.apply(this, arguments);
|
|
@@ -1926,23 +2051,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1926
2051
|
}, {
|
|
1927
2052
|
key: "removeS3Components",
|
|
1928
2053
|
value: (function () {
|
|
1929
|
-
var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1930
|
-
return _regenerator().w(function (
|
|
1931
|
-
while (1) switch (
|
|
2054
|
+
var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
2055
|
+
return _regenerator().w(function (_context9) {
|
|
2056
|
+
while (1) switch (_context9.n) {
|
|
1932
2057
|
case 0:
|
|
1933
2058
|
if (this.managers.componentDataManager) {
|
|
1934
|
-
|
|
2059
|
+
_context9.n = 1;
|
|
1935
2060
|
break;
|
|
1936
2061
|
}
|
|
1937
2062
|
console.warn('⚠️ removeS3Components(): Component data manager not available');
|
|
1938
|
-
return
|
|
2063
|
+
return _context9.a(2, false);
|
|
1939
2064
|
case 1:
|
|
1940
|
-
|
|
2065
|
+
_context9.n = 2;
|
|
1941
2066
|
return this.managers.componentDataManager.removeS3Components();
|
|
1942
2067
|
case 2:
|
|
1943
|
-
return
|
|
2068
|
+
return _context9.a(2, _context9.v);
|
|
1944
2069
|
}
|
|
1945
|
-
},
|
|
2070
|
+
}, _callee9, this);
|
|
1946
2071
|
}));
|
|
1947
2072
|
function removeS3Components() {
|
|
1948
2073
|
return _removeS3Components.apply(this, arguments);
|
|
@@ -1966,23 +2091,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1966
2091
|
}, {
|
|
1967
2092
|
key: "removeComponentFromDictionary",
|
|
1968
2093
|
value: (function () {
|
|
1969
|
-
var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1970
|
-
return _regenerator().w(function (
|
|
1971
|
-
while (1) switch (
|
|
2094
|
+
var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(componentKey) {
|
|
2095
|
+
return _regenerator().w(function (_context0) {
|
|
2096
|
+
while (1) switch (_context0.n) {
|
|
1972
2097
|
case 0:
|
|
1973
2098
|
if (this.managers.componentDataManager) {
|
|
1974
|
-
|
|
2099
|
+
_context0.n = 1;
|
|
1975
2100
|
break;
|
|
1976
2101
|
}
|
|
1977
2102
|
console.warn('⚠️ removeComponentFromDictionary(): Component data manager not available');
|
|
1978
|
-
return
|
|
2103
|
+
return _context0.a(2, false);
|
|
1979
2104
|
case 1:
|
|
1980
|
-
|
|
2105
|
+
_context0.n = 2;
|
|
1981
2106
|
return this.managers.componentDataManager.removeComponentFromDictionary(componentKey);
|
|
1982
2107
|
case 2:
|
|
1983
|
-
return
|
|
2108
|
+
return _context0.a(2, _context0.v);
|
|
1984
2109
|
}
|
|
1985
|
-
},
|
|
2110
|
+
}, _callee0, this);
|
|
1986
2111
|
}));
|
|
1987
2112
|
function removeComponentFromDictionary(_x4) {
|
|
1988
2113
|
return _removeComponentFromDictionary.apply(this, arguments);
|
|
@@ -2018,8 +2143,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2018
2143
|
var componentDictionary = ((_this$managers$compon = this.managers.componentDataManager) === null || _this$managers$compon === void 0 ? void 0 : _this$managers$compon.componentDictionary) || {};
|
|
2019
2144
|
var missingIds = [];
|
|
2020
2145
|
sceneData.scene.children.forEach(function (child) {
|
|
2021
|
-
var _child$
|
|
2022
|
-
var libraryId = (_child$
|
|
2146
|
+
var _child$userData2;
|
|
2147
|
+
var libraryId = (_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.libraryId;
|
|
2023
2148
|
if (libraryId && !componentDictionary[libraryId]) {
|
|
2024
2149
|
// Only add unique IDs
|
|
2025
2150
|
if (!missingIds.includes(libraryId)) {
|
|
@@ -2097,8 +2222,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2097
2222
|
// If still not found, try finding by originalUuid in userData
|
|
2098
2223
|
if (!targetObject) {
|
|
2099
2224
|
this.sceneViewer.scene.traverse(function (child) {
|
|
2100
|
-
var _child$
|
|
2101
|
-
if (((_child$
|
|
2225
|
+
var _child$userData3;
|
|
2226
|
+
if (((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.originalUuid) === objectId) {
|
|
2102
2227
|
targetObject = child;
|
|
2103
2228
|
return;
|
|
2104
2229
|
}
|
|
@@ -2229,49 +2354,49 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2229
2354
|
}, {
|
|
2230
2355
|
key: "initialize2DViewport",
|
|
2231
2356
|
value: function () {
|
|
2232
|
-
var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2357
|
+
var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(container) {
|
|
2233
2358
|
var viewType,
|
|
2234
2359
|
instanceKey,
|
|
2235
2360
|
success,
|
|
2236
|
-
|
|
2361
|
+
_args1 = arguments,
|
|
2237
2362
|
_t2;
|
|
2238
|
-
return _regenerator().w(function (
|
|
2239
|
-
while (1) switch (
|
|
2363
|
+
return _regenerator().w(function (_context1) {
|
|
2364
|
+
while (1) switch (_context1.n) {
|
|
2240
2365
|
case 0:
|
|
2241
|
-
viewType =
|
|
2242
|
-
instanceKey =
|
|
2366
|
+
viewType = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : 'top';
|
|
2367
|
+
instanceKey = _args1.length > 2 && _args1[2] !== undefined ? _args1[2] : null;
|
|
2243
2368
|
if (container) {
|
|
2244
|
-
|
|
2369
|
+
_context1.n = 1;
|
|
2245
2370
|
break;
|
|
2246
2371
|
}
|
|
2247
2372
|
console.warn('⚠️ initialize2DViewport(): No container provided');
|
|
2248
|
-
return
|
|
2373
|
+
return _context1.a(2, false);
|
|
2249
2374
|
case 1:
|
|
2250
2375
|
if (this.managers.viewport2DManager) {
|
|
2251
|
-
|
|
2376
|
+
_context1.n = 2;
|
|
2252
2377
|
break;
|
|
2253
2378
|
}
|
|
2254
2379
|
console.warn('⚠️ initialize2DViewport(): Viewport2D manager not available');
|
|
2255
|
-
return
|
|
2380
|
+
return _context1.a(2, false);
|
|
2256
2381
|
case 2:
|
|
2257
|
-
|
|
2258
|
-
|
|
2382
|
+
_context1.p = 2;
|
|
2383
|
+
_context1.n = 3;
|
|
2259
2384
|
return this.managers.viewport2DManager.initialize(container, viewType, instanceKey);
|
|
2260
2385
|
case 3:
|
|
2261
|
-
success =
|
|
2386
|
+
success = _context1.v;
|
|
2262
2387
|
if (success) {
|
|
2263
2388
|
console.log("\u2705 2D viewport initialized successfully (".concat(viewType, " view, key: ").concat(instanceKey || viewType, ")"));
|
|
2264
2389
|
} else {
|
|
2265
2390
|
console.warn("\u26A0\uFE0F Failed to initialize 2D viewport (".concat(viewType, " view)"));
|
|
2266
2391
|
}
|
|
2267
|
-
return
|
|
2392
|
+
return _context1.a(2, success);
|
|
2268
2393
|
case 4:
|
|
2269
|
-
|
|
2270
|
-
_t2 =
|
|
2394
|
+
_context1.p = 4;
|
|
2395
|
+
_t2 = _context1.v;
|
|
2271
2396
|
console.error('❌ initialize2DViewport(): Error initializing 2D viewport:', _t2);
|
|
2272
|
-
return
|
|
2397
|
+
return _context1.a(2, false);
|
|
2273
2398
|
}
|
|
2274
|
-
},
|
|
2399
|
+
}, _callee1, this, [[2, 4]]);
|
|
2275
2400
|
}));
|
|
2276
2401
|
function initialize2DViewport(_x5) {
|
|
2277
2402
|
return _initialize2DViewport.apply(this, arguments);
|
|
@@ -2449,7 +2574,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2449
2574
|
}, {
|
|
2450
2575
|
key: "initializeModelPreloading",
|
|
2451
2576
|
value: (function () {
|
|
2452
|
-
var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2577
|
+
var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
2453
2578
|
var basePath,
|
|
2454
2579
|
normalizedBasePath,
|
|
2455
2580
|
dictionaryPath,
|
|
@@ -2458,13 +2583,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2458
2583
|
componentDictionary,
|
|
2459
2584
|
_modelPreloader2,
|
|
2460
2585
|
progress,
|
|
2461
|
-
|
|
2586
|
+
_args10 = arguments,
|
|
2462
2587
|
_t3;
|
|
2463
|
-
return _regenerator().w(function (
|
|
2464
|
-
while (1) switch (
|
|
2588
|
+
return _regenerator().w(function (_context10) {
|
|
2589
|
+
while (1) switch (_context10.n) {
|
|
2465
2590
|
case 0:
|
|
2466
|
-
basePath =
|
|
2467
|
-
|
|
2591
|
+
basePath = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : '/library/';
|
|
2592
|
+
_context10.p = 1;
|
|
2468
2593
|
// Ensure basePath ends with a slash
|
|
2469
2594
|
normalizedBasePath = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
|
|
2470
2595
|
dictionaryPath = "".concat(normalizedBasePath, "component-dictionary.json");
|
|
@@ -2475,39 +2600,39 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2475
2600
|
console.log("\uFFFD Models path: ".concat(modelsBasePath));
|
|
2476
2601
|
|
|
2477
2602
|
// Load the component dictionary
|
|
2478
|
-
|
|
2603
|
+
_context10.n = 2;
|
|
2479
2604
|
return fetch(dictionaryPath);
|
|
2480
2605
|
case 2:
|
|
2481
|
-
response =
|
|
2606
|
+
response = _context10.v;
|
|
2482
2607
|
if (response.ok) {
|
|
2483
|
-
|
|
2608
|
+
_context10.n = 3;
|
|
2484
2609
|
break;
|
|
2485
2610
|
}
|
|
2486
2611
|
throw new Error("Failed to load component dictionary: ".concat(response.status));
|
|
2487
2612
|
case 3:
|
|
2488
|
-
|
|
2613
|
+
_context10.n = 4;
|
|
2489
2614
|
return response.json();
|
|
2490
2615
|
case 4:
|
|
2491
|
-
componentDictionary =
|
|
2616
|
+
componentDictionary = _context10.v;
|
|
2492
2617
|
console.log('📚 Component dictionary loaded:', Object.keys(componentDictionary));
|
|
2493
2618
|
|
|
2494
2619
|
// Start preloading all models with the specified base path
|
|
2495
2620
|
_modelPreloader2 = this.getUtility('modelPreloader');
|
|
2496
|
-
|
|
2621
|
+
_context10.n = 5;
|
|
2497
2622
|
return _modelPreloader2.preloadAllModels(componentDictionary, modelsBasePath);
|
|
2498
2623
|
case 5:
|
|
2499
|
-
progress =
|
|
2624
|
+
progress = _context10.v;
|
|
2500
2625
|
console.log('🎉 Model preloading completed:', progress);
|
|
2501
|
-
return
|
|
2626
|
+
return _context10.a(2, progress);
|
|
2502
2627
|
case 6:
|
|
2503
|
-
|
|
2504
|
-
_t3 =
|
|
2628
|
+
_context10.p = 6;
|
|
2629
|
+
_t3 = _context10.v;
|
|
2505
2630
|
console.error('❌ Failed to initialize model preloading:', _t3);
|
|
2506
2631
|
throw _t3;
|
|
2507
2632
|
case 7:
|
|
2508
|
-
return
|
|
2633
|
+
return _context10.a(2);
|
|
2509
2634
|
}
|
|
2510
|
-
},
|
|
2635
|
+
}, _callee10, this, [[1, 6]]);
|
|
2511
2636
|
}));
|
|
2512
2637
|
function initializeModelPreloading() {
|
|
2513
2638
|
return _initializeModelPreloading.apply(this, arguments);
|
|
@@ -2524,100 +2649,86 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2524
2649
|
}, {
|
|
2525
2650
|
key: "importScene",
|
|
2526
2651
|
value: (function () {
|
|
2527
|
-
var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2528
|
-
var validation,
|
|
2529
|
-
return _regenerator().w(function (
|
|
2530
|
-
while (1) switch (
|
|
2652
|
+
var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(jsonData) {
|
|
2653
|
+
var validation, missingIds, resolved, _t4, _t5;
|
|
2654
|
+
return _regenerator().w(function (_context11) {
|
|
2655
|
+
while (1) switch (_context11.n) {
|
|
2531
2656
|
case 0:
|
|
2532
2657
|
if (jsonData) {
|
|
2533
|
-
|
|
2658
|
+
_context11.n = 1;
|
|
2534
2659
|
break;
|
|
2535
2660
|
}
|
|
2536
2661
|
console.error('❌ No JSON data provided for import');
|
|
2537
|
-
return
|
|
2662
|
+
return _context11.a(2, false);
|
|
2538
2663
|
case 1:
|
|
2539
|
-
|
|
2664
|
+
_context11.p = 1;
|
|
2540
2665
|
// Validate scene data structure
|
|
2541
2666
|
validation = this.internals.validateAndAnalyzeSceneData(jsonData);
|
|
2542
2667
|
if (validation.isValid) {
|
|
2543
|
-
|
|
2668
|
+
_context11.n = 2;
|
|
2544
2669
|
break;
|
|
2545
2670
|
}
|
|
2546
2671
|
console.error('❌ Invalid scene data format:', validation.message);
|
|
2547
|
-
return
|
|
2672
|
+
return _context11.a(2, false);
|
|
2548
2673
|
case 2:
|
|
2549
|
-
if (!(jsonData.componentDefinitions && _typeof(jsonData.componentDefinitions) === 'object')) {
|
|
2550
|
-
_context10.n = 4;
|
|
2551
|
-
break;
|
|
2552
|
-
}
|
|
2553
|
-
embeddedCount = Object.keys(jsonData.componentDefinitions).length;
|
|
2554
|
-
if (!(embeddedCount > 0)) {
|
|
2555
|
-
_context10.n = 4;
|
|
2556
|
-
break;
|
|
2557
|
-
}
|
|
2558
|
-
_context10.n = 3;
|
|
2559
|
-
return this.extendComponentDictionary(jsonData.componentDefinitions);
|
|
2560
|
-
case 3:
|
|
2561
|
-
console.log("\uD83D\uDCE6 importScene(): Applied ".concat(embeddedCount, " embedded component definition(s)"));
|
|
2562
|
-
case 4:
|
|
2563
2674
|
if (!this._componentDefinitionResolver) {
|
|
2564
|
-
|
|
2675
|
+
_context11.n = 8;
|
|
2565
2676
|
break;
|
|
2566
2677
|
}
|
|
2567
2678
|
missingIds = this.getMissingLibraryIds(jsonData);
|
|
2568
2679
|
if (!(missingIds.length > 0)) {
|
|
2569
|
-
|
|
2680
|
+
_context11.n = 8;
|
|
2570
2681
|
break;
|
|
2571
2682
|
}
|
|
2572
|
-
|
|
2683
|
+
_context11.p = 3;
|
|
2573
2684
|
console.log("\uD83D\uDD0D importScene(): Resolving ".concat(missingIds.length, " missing component definition(s)..."));
|
|
2574
|
-
|
|
2685
|
+
_context11.n = 4;
|
|
2575
2686
|
return this._componentDefinitionResolver(missingIds);
|
|
2576
|
-
case
|
|
2577
|
-
resolved =
|
|
2687
|
+
case 4:
|
|
2688
|
+
resolved = _context11.v;
|
|
2578
2689
|
if (!(resolved && _typeof(resolved) === 'object' && Object.keys(resolved).length > 0)) {
|
|
2579
|
-
|
|
2690
|
+
_context11.n = 6;
|
|
2580
2691
|
break;
|
|
2581
2692
|
}
|
|
2582
|
-
|
|
2693
|
+
_context11.n = 5;
|
|
2583
2694
|
return this.extendComponentDictionary(resolved);
|
|
2584
|
-
case
|
|
2695
|
+
case 5:
|
|
2585
2696
|
console.log("\u2705 importScene(): Resolved ".concat(Object.keys(resolved).length, " component definition(s)"));
|
|
2586
|
-
case
|
|
2587
|
-
|
|
2697
|
+
case 6:
|
|
2698
|
+
_context11.n = 8;
|
|
2588
2699
|
break;
|
|
2589
|
-
case
|
|
2590
|
-
|
|
2591
|
-
_t4 =
|
|
2700
|
+
case 7:
|
|
2701
|
+
_context11.p = 7;
|
|
2702
|
+
_t4 = _context11.v;
|
|
2592
2703
|
console.warn('⚠️ importScene(): Component definition resolver failed, continuing with existing dictionary:', _t4);
|
|
2593
|
-
case
|
|
2594
|
-
|
|
2704
|
+
case 8:
|
|
2705
|
+
_context11.n = 9;
|
|
2595
2706
|
return this.setImportedSceneData(jsonData);
|
|
2596
|
-
case
|
|
2707
|
+
case 9:
|
|
2597
2708
|
if (!(this.sceneViewer && this.sceneViewer.sceneOperationsManager)) {
|
|
2598
|
-
|
|
2709
|
+
_context11.n = 11;
|
|
2599
2710
|
break;
|
|
2600
2711
|
}
|
|
2601
|
-
|
|
2712
|
+
_context11.n = 10;
|
|
2602
2713
|
return this.sceneViewer.sceneOperationsManager.loadSceneFromData(jsonData);
|
|
2603
|
-
case
|
|
2714
|
+
case 10:
|
|
2604
2715
|
console.log('✅ Scene imported successfully');
|
|
2605
|
-
return
|
|
2606
|
-
case
|
|
2716
|
+
return _context11.a(2, true);
|
|
2717
|
+
case 11:
|
|
2607
2718
|
console.error('❌ SceneViewer not available for scene loading');
|
|
2608
|
-
return
|
|
2609
|
-
case
|
|
2610
|
-
|
|
2719
|
+
return _context11.a(2, false);
|
|
2720
|
+
case 12:
|
|
2721
|
+
_context11.n = 14;
|
|
2611
2722
|
break;
|
|
2612
|
-
case
|
|
2613
|
-
|
|
2614
|
-
_t5 =
|
|
2723
|
+
case 13:
|
|
2724
|
+
_context11.p = 13;
|
|
2725
|
+
_t5 = _context11.v;
|
|
2615
2726
|
console.error('❌ Error importing scene:', _t5);
|
|
2616
|
-
return
|
|
2617
|
-
case
|
|
2618
|
-
return
|
|
2727
|
+
return _context11.a(2, false);
|
|
2728
|
+
case 14:
|
|
2729
|
+
return _context11.a(2);
|
|
2619
2730
|
}
|
|
2620
|
-
},
|
|
2731
|
+
}, _callee11, this, [[3, 7], [1, 13]]);
|
|
2621
2732
|
}));
|
|
2622
2733
|
function importScene(_x6) {
|
|
2623
2734
|
return _importScene.apply(this, arguments);
|
|
@@ -2641,33 +2752,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2641
2752
|
}, {
|
|
2642
2753
|
key: "exportSceneJSON",
|
|
2643
2754
|
value: (function () {
|
|
2644
|
-
var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2755
|
+
var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
2645
2756
|
var filename,
|
|
2646
|
-
|
|
2757
|
+
_args12 = arguments,
|
|
2647
2758
|
_t6;
|
|
2648
|
-
return _regenerator().w(function (
|
|
2649
|
-
while (1) switch (
|
|
2759
|
+
return _regenerator().w(function (_context12) {
|
|
2760
|
+
while (1) switch (_context12.n) {
|
|
2650
2761
|
case 0:
|
|
2651
|
-
filename =
|
|
2762
|
+
filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
|
|
2652
2763
|
if (this.managers.sceneExportManager) {
|
|
2653
|
-
|
|
2764
|
+
_context12.n = 1;
|
|
2654
2765
|
break;
|
|
2655
2766
|
}
|
|
2656
2767
|
console.error('❌ Scene export manager not available');
|
|
2657
|
-
return
|
|
2768
|
+
return _context12.a(2, false);
|
|
2658
2769
|
case 1:
|
|
2659
|
-
|
|
2660
|
-
|
|
2770
|
+
_context12.p = 1;
|
|
2771
|
+
_context12.n = 2;
|
|
2661
2772
|
return this.managers.sceneExportManager.downloadSceneJSON(filename);
|
|
2662
2773
|
case 2:
|
|
2663
|
-
return
|
|
2774
|
+
return _context12.a(2, _context12.v);
|
|
2664
2775
|
case 3:
|
|
2665
|
-
|
|
2666
|
-
_t6 =
|
|
2776
|
+
_context12.p = 3;
|
|
2777
|
+
_t6 = _context12.v;
|
|
2667
2778
|
console.error('❌ Error exporting scene as JSON:', _t6);
|
|
2668
|
-
return
|
|
2779
|
+
return _context12.a(2, false);
|
|
2669
2780
|
}
|
|
2670
|
-
},
|
|
2781
|
+
}, _callee12, this, [[1, 3]]);
|
|
2671
2782
|
}));
|
|
2672
2783
|
function exportSceneJSON() {
|
|
2673
2784
|
return _exportSceneJSON.apply(this, arguments);
|
|
@@ -2692,33 +2803,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2692
2803
|
}, {
|
|
2693
2804
|
key: "exportSceneGLTF",
|
|
2694
2805
|
value: (function () {
|
|
2695
|
-
var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2806
|
+
var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
2696
2807
|
var filename,
|
|
2697
|
-
|
|
2808
|
+
_args13 = arguments,
|
|
2698
2809
|
_t7;
|
|
2699
|
-
return _regenerator().w(function (
|
|
2700
|
-
while (1) switch (
|
|
2810
|
+
return _regenerator().w(function (_context13) {
|
|
2811
|
+
while (1) switch (_context13.n) {
|
|
2701
2812
|
case 0:
|
|
2702
|
-
filename =
|
|
2813
|
+
filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
|
|
2703
2814
|
if (this.managers.sceneExportManager) {
|
|
2704
|
-
|
|
2815
|
+
_context13.n = 1;
|
|
2705
2816
|
break;
|
|
2706
2817
|
}
|
|
2707
2818
|
console.error('❌ Scene export manager not available');
|
|
2708
|
-
return
|
|
2819
|
+
return _context13.a(2, false);
|
|
2709
2820
|
case 1:
|
|
2710
|
-
|
|
2711
|
-
|
|
2821
|
+
_context13.p = 1;
|
|
2822
|
+
_context13.n = 2;
|
|
2712
2823
|
return this.managers.sceneExportManager.exportSceneAsGLTF(filename, false);
|
|
2713
2824
|
case 2:
|
|
2714
|
-
return
|
|
2825
|
+
return _context13.a(2, _context13.v);
|
|
2715
2826
|
case 3:
|
|
2716
|
-
|
|
2717
|
-
_t7 =
|
|
2827
|
+
_context13.p = 3;
|
|
2828
|
+
_t7 = _context13.v;
|
|
2718
2829
|
console.error('❌ Error exporting scene as GLTF:', _t7);
|
|
2719
|
-
return
|
|
2830
|
+
return _context13.a(2, false);
|
|
2720
2831
|
}
|
|
2721
|
-
},
|
|
2832
|
+
}, _callee13, this, [[1, 3]]);
|
|
2722
2833
|
}));
|
|
2723
2834
|
function exportSceneGLTF() {
|
|
2724
2835
|
return _exportSceneGLTF.apply(this, arguments);
|
|
@@ -2744,33 +2855,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2744
2855
|
}, {
|
|
2745
2856
|
key: "exportSceneGLB",
|
|
2746
2857
|
value: (function () {
|
|
2747
|
-
var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2858
|
+
var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
2748
2859
|
var filename,
|
|
2749
|
-
|
|
2860
|
+
_args14 = arguments,
|
|
2750
2861
|
_t8;
|
|
2751
|
-
return _regenerator().w(function (
|
|
2752
|
-
while (1) switch (
|
|
2862
|
+
return _regenerator().w(function (_context14) {
|
|
2863
|
+
while (1) switch (_context14.n) {
|
|
2753
2864
|
case 0:
|
|
2754
|
-
filename =
|
|
2865
|
+
filename = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : null;
|
|
2755
2866
|
if (this.managers.sceneExportManager) {
|
|
2756
|
-
|
|
2867
|
+
_context14.n = 1;
|
|
2757
2868
|
break;
|
|
2758
2869
|
}
|
|
2759
2870
|
console.error('❌ Scene export manager not available');
|
|
2760
|
-
return
|
|
2871
|
+
return _context14.a(2, false);
|
|
2761
2872
|
case 1:
|
|
2762
|
-
|
|
2763
|
-
|
|
2873
|
+
_context14.p = 1;
|
|
2874
|
+
_context14.n = 2;
|
|
2764
2875
|
return this.managers.sceneExportManager.exportSceneAsGLB(filename);
|
|
2765
2876
|
case 2:
|
|
2766
|
-
return
|
|
2877
|
+
return _context14.a(2, _context14.v);
|
|
2767
2878
|
case 3:
|
|
2768
|
-
|
|
2769
|
-
_t8 =
|
|
2879
|
+
_context14.p = 3;
|
|
2880
|
+
_t8 = _context14.v;
|
|
2770
2881
|
console.error('❌ Error exporting scene as GLB:', _t8);
|
|
2771
|
-
return
|
|
2882
|
+
return _context14.a(2, false);
|
|
2772
2883
|
}
|
|
2773
|
-
},
|
|
2884
|
+
}, _callee14, this, [[1, 3]]);
|
|
2774
2885
|
}));
|
|
2775
2886
|
function exportSceneGLB() {
|
|
2776
2887
|
return _exportSceneGLB.apply(this, arguments);
|
|
@@ -2809,16 +2920,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2809
2920
|
}, {
|
|
2810
2921
|
key: "loadSceneFromData",
|
|
2811
2922
|
value: (function () {
|
|
2812
|
-
var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2813
|
-
return _regenerator().w(function (
|
|
2814
|
-
while (1) switch (
|
|
2923
|
+
var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(sceneData) {
|
|
2924
|
+
return _regenerator().w(function (_context15) {
|
|
2925
|
+
while (1) switch (_context15.n) {
|
|
2815
2926
|
case 0:
|
|
2816
|
-
|
|
2927
|
+
_context15.n = 1;
|
|
2817
2928
|
return this.setImportedSceneData(sceneData);
|
|
2818
2929
|
case 1:
|
|
2819
|
-
return
|
|
2930
|
+
return _context15.a(2, true);
|
|
2820
2931
|
}
|
|
2821
|
-
},
|
|
2932
|
+
}, _callee15, this);
|
|
2822
2933
|
}));
|
|
2823
2934
|
function loadSceneFromData(_x7) {
|
|
2824
2935
|
return _loadSceneFromData.apply(this, arguments);
|
|
@@ -2843,9 +2954,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2843
2954
|
}, {
|
|
2844
2955
|
key: "clearScene",
|
|
2845
2956
|
value: function clearScene() {
|
|
2846
|
-
var _this$
|
|
2957
|
+
var _this$sceneViewer13;
|
|
2847
2958
|
this.importedSceneData = null;
|
|
2848
|
-
var ioBehavMgr = (_this$
|
|
2959
|
+
var ioBehavMgr = (_this$sceneViewer13 = this.sceneViewer) === null || _this$sceneViewer13 === void 0 || (_this$sceneViewer13 = _this$sceneViewer13.managers) === null || _this$sceneViewer13 === void 0 ? void 0 : _this$sceneViewer13.ioBehaviorManager;
|
|
2849
2960
|
if (ioBehavMgr) {
|
|
2850
2961
|
ioBehavMgr.setCrossComponentBehaviors([]);
|
|
2851
2962
|
}
|