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