@2112-lab/central-plant 0.3.45 → 0.3.47
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 +635 -337
- package/dist/cjs/src/core/centralPlant.js +342 -218
- package/dist/cjs/src/core/centralPlantInternals.js +2 -0
- package/dist/cjs/src/core/sceneViewer.js +0 -1
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +1 -2
- package/dist/cjs/src/managers/components/componentDataManager.js +0 -1
- package/dist/cjs/src/managers/controls/componentDragManager.js +4 -8
- package/dist/cjs/src/managers/pathfinding/pathfindingManager.js +55 -1
- package/dist/cjs/src/managers/scene/collisionManager.js +142 -0
- package/dist/cjs/src/managers/scene/componentTooltipManager.js +2 -3
- package/dist/cjs/src/managers/scene/sceneExportManager.js +32 -11
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +17 -33
- package/dist/cjs/src/utils/behaviorDispatch.js +11 -42
- package/dist/cjs/src/utils/boundingBoxUtils.js +54 -8
- package/dist/cjs/src/utils/ioDeviceUtils.js +3 -9
- package/dist/esm/src/core/centralPlant.js +342 -218
- package/dist/esm/src/core/centralPlantInternals.js +2 -0
- package/dist/esm/src/core/sceneViewer.js +0 -1
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +1 -2
- package/dist/esm/src/managers/components/componentDataManager.js +0 -1
- package/dist/esm/src/managers/controls/componentDragManager.js +4 -8
- package/dist/esm/src/managers/pathfinding/pathfindingManager.js +56 -2
- package/dist/esm/src/managers/scene/collisionManager.js +118 -0
- package/dist/esm/src/managers/scene/componentTooltipManager.js +2 -3
- package/dist/esm/src/managers/scene/sceneExportManager.js +33 -12
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +17 -33
- package/dist/esm/src/utils/behaviorDispatch.js +11 -42
- package/dist/esm/src/utils/boundingBoxUtils.js +55 -10
- package/dist/esm/src/utils/ioDeviceUtils.js +3 -9
- package/dist/index.d.ts +0 -6
- 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.47
|
|
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;
|
|
@@ -1212,7 +1337,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1212
1337
|
* List all available I/O Device assets from the component dictionary.
|
|
1213
1338
|
* @param {Object} [options={}]
|
|
1214
1339
|
* @param {'all'|'bundled'|'user'} [options.source='all'] - Filter by asset origin
|
|
1215
|
-
* @returns {Array<{uuid: string, name: string, assetType: string
|
|
1340
|
+
* @returns {Array<{uuid: string, name: string, assetType: string}>}
|
|
1216
1341
|
* @example
|
|
1217
1342
|
* const devices = centralPlant.getIoDevices({ source: 'all' })
|
|
1218
1343
|
* const bundledOnly = centralPlant.getIoDevices({ source: 'bundled' })
|
|
@@ -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) {
|
|
@@ -1239,8 +1364,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1239
1364
|
return {
|
|
1240
1365
|
uuid: entry.uuid || entry.id,
|
|
1241
1366
|
name: entry.name,
|
|
1242
|
-
assetType: entry.assetType
|
|
1243
|
-
ioConfig: entry.ioConfig || {}
|
|
1367
|
+
assetType: entry.assetType
|
|
1244
1368
|
};
|
|
1245
1369
|
});
|
|
1246
1370
|
}
|
|
@@ -1258,8 +1382,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1258
1382
|
}, {
|
|
1259
1383
|
key: "getIoDeviceUsage",
|
|
1260
1384
|
value: function getIoDeviceUsage() {
|
|
1261
|
-
var
|
|
1262
|
-
deviceUuid =
|
|
1385
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1386
|
+
deviceUuid = _ref3.deviceUuid;
|
|
1263
1387
|
if (!deviceUuid) {
|
|
1264
1388
|
console.warn('⚠️ getIoDeviceUsage(): deviceUuid is required');
|
|
1265
1389
|
return [];
|
|
@@ -1310,38 +1434,38 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1310
1434
|
}, {
|
|
1311
1435
|
key: "createSmartComponent",
|
|
1312
1436
|
value: (function () {
|
|
1313
|
-
var _createSmartComponent = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
1314
|
-
var
|
|
1437
|
+
var _createSmartComponent = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee4() {
|
|
1438
|
+
var _ref4,
|
|
1315
1439
|
componentUuid,
|
|
1316
1440
|
name,
|
|
1317
1441
|
attachments,
|
|
1318
1442
|
thumbnailBlob,
|
|
1319
1443
|
newAsset,
|
|
1320
1444
|
mp,
|
|
1321
|
-
|
|
1322
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
1323
|
-
while (1) switch (
|
|
1445
|
+
_args4 = arguments;
|
|
1446
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context4) {
|
|
1447
|
+
while (1) switch (_context4.n) {
|
|
1324
1448
|
case 0:
|
|
1325
|
-
|
|
1449
|
+
_ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, name = _ref4.name, attachments = _ref4.attachments, thumbnailBlob = _ref4.thumbnailBlob;
|
|
1326
1450
|
if (this.assetService) {
|
|
1327
|
-
|
|
1451
|
+
_context4.n = 1;
|
|
1328
1452
|
break;
|
|
1329
1453
|
}
|
|
1330
1454
|
throw new Error('createSmartComponent(): no asset service set — call setAssetService() first');
|
|
1331
1455
|
case 1:
|
|
1332
1456
|
if (componentUuid) {
|
|
1333
|
-
|
|
1457
|
+
_context4.n = 2;
|
|
1334
1458
|
break;
|
|
1335
1459
|
}
|
|
1336
1460
|
throw new Error('createSmartComponent(): componentUuid is required');
|
|
1337
1461
|
case 2:
|
|
1338
1462
|
if (!(!Array.isArray(attachments) || attachments.length === 0)) {
|
|
1339
|
-
|
|
1463
|
+
_context4.n = 3;
|
|
1340
1464
|
break;
|
|
1341
1465
|
}
|
|
1342
1466
|
throw new Error('createSmartComponent(): at least one attachment is required');
|
|
1343
1467
|
case 3:
|
|
1344
|
-
|
|
1468
|
+
_context4.n = 4;
|
|
1345
1469
|
return this.assetService.createSmartComponent({
|
|
1346
1470
|
componentUuid: componentUuid,
|
|
1347
1471
|
name: name,
|
|
@@ -1349,7 +1473,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1349
1473
|
thumbnailBlob: thumbnailBlob
|
|
1350
1474
|
});
|
|
1351
1475
|
case 4:
|
|
1352
|
-
newAsset =
|
|
1476
|
+
newAsset = _context4.v;
|
|
1353
1477
|
// Register in model preloader dictionary so addComponent() can use it immediately
|
|
1354
1478
|
mp = this.getUtility('modelPreloader');
|
|
1355
1479
|
if (mp !== null && mp !== void 0 && mp.componentDictionary && newAsset !== null && newAsset !== void 0 && newAsset.uuid) {
|
|
@@ -1358,9 +1482,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1358
1482
|
});
|
|
1359
1483
|
console.log("\u2705 createSmartComponent(): registered \"".concat(newAsset.name, "\" in component dictionary"));
|
|
1360
1484
|
}
|
|
1361
|
-
return
|
|
1485
|
+
return _context4.a(2, newAsset);
|
|
1362
1486
|
}
|
|
1363
|
-
},
|
|
1487
|
+
}, _callee4, this);
|
|
1364
1488
|
}));
|
|
1365
1489
|
function createSmartComponent() {
|
|
1366
1490
|
return _createSmartComponent.apply(this, arguments);
|
|
@@ -1394,42 +1518,42 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1394
1518
|
}, {
|
|
1395
1519
|
key: "addComponentAttachment",
|
|
1396
1520
|
value: (function () {
|
|
1397
|
-
var _addComponentAttachment = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
1398
|
-
var
|
|
1521
|
+
var _addComponentAttachment = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee5() {
|
|
1522
|
+
var _ref5,
|
|
1399
1523
|
componentUuid,
|
|
1400
1524
|
attachment,
|
|
1401
1525
|
updatedAsset,
|
|
1402
1526
|
mp,
|
|
1403
|
-
|
|
1404
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
1405
|
-
while (1) switch (
|
|
1527
|
+
_args5 = arguments;
|
|
1528
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context5) {
|
|
1529
|
+
while (1) switch (_context5.n) {
|
|
1406
1530
|
case 0:
|
|
1407
|
-
|
|
1531
|
+
_ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachment = _ref5.attachment;
|
|
1408
1532
|
if (this.assetService) {
|
|
1409
|
-
|
|
1533
|
+
_context5.n = 1;
|
|
1410
1534
|
break;
|
|
1411
1535
|
}
|
|
1412
1536
|
throw new Error('addComponentAttachment(): no asset service set — call setAssetService() first');
|
|
1413
1537
|
case 1:
|
|
1414
1538
|
if (componentUuid) {
|
|
1415
|
-
|
|
1539
|
+
_context5.n = 2;
|
|
1416
1540
|
break;
|
|
1417
1541
|
}
|
|
1418
1542
|
throw new Error('addComponentAttachment(): componentUuid is required');
|
|
1419
1543
|
case 2:
|
|
1420
1544
|
if (!(!(attachment !== null && attachment !== void 0 && attachment.attachmentId) || !(attachment !== null && attachment !== void 0 && attachment.deviceId))) {
|
|
1421
|
-
|
|
1545
|
+
_context5.n = 3;
|
|
1422
1546
|
break;
|
|
1423
1547
|
}
|
|
1424
1548
|
throw new Error('addComponentAttachment(): attachment must have attachmentId and deviceId');
|
|
1425
1549
|
case 3:
|
|
1426
|
-
|
|
1550
|
+
_context5.n = 4;
|
|
1427
1551
|
return this.assetService.addComponentAttachment({
|
|
1428
1552
|
componentUuid: componentUuid,
|
|
1429
1553
|
attachment: attachment
|
|
1430
1554
|
});
|
|
1431
1555
|
case 4:
|
|
1432
|
-
updatedAsset =
|
|
1556
|
+
updatedAsset = _context5.v;
|
|
1433
1557
|
// Sync component dictionary
|
|
1434
1558
|
mp = this.getUtility('modelPreloader');
|
|
1435
1559
|
if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
|
|
@@ -1437,9 +1561,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1437
1561
|
id: updatedAsset.uuid
|
|
1438
1562
|
});
|
|
1439
1563
|
}
|
|
1440
|
-
return
|
|
1564
|
+
return _context5.a(2, updatedAsset);
|
|
1441
1565
|
}
|
|
1442
|
-
},
|
|
1566
|
+
}, _callee5, this);
|
|
1443
1567
|
}));
|
|
1444
1568
|
function addComponentAttachment() {
|
|
1445
1569
|
return _addComponentAttachment.apply(this, arguments);
|
|
@@ -1465,42 +1589,42 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1465
1589
|
}, {
|
|
1466
1590
|
key: "removeComponentAttachment",
|
|
1467
1591
|
value: (function () {
|
|
1468
|
-
var _removeComponentAttachment = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
1469
|
-
var
|
|
1592
|
+
var _removeComponentAttachment = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee6() {
|
|
1593
|
+
var _ref6,
|
|
1470
1594
|
componentUuid,
|
|
1471
1595
|
attachmentId,
|
|
1472
1596
|
updatedAsset,
|
|
1473
1597
|
mp,
|
|
1474
|
-
|
|
1475
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
1476
|
-
while (1) switch (
|
|
1598
|
+
_args6 = arguments;
|
|
1599
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context6) {
|
|
1600
|
+
while (1) switch (_context6.n) {
|
|
1477
1601
|
case 0:
|
|
1478
|
-
|
|
1602
|
+
_ref6 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, componentUuid = _ref6.componentUuid, attachmentId = _ref6.attachmentId;
|
|
1479
1603
|
if (this.assetService) {
|
|
1480
|
-
|
|
1604
|
+
_context6.n = 1;
|
|
1481
1605
|
break;
|
|
1482
1606
|
}
|
|
1483
1607
|
throw new Error('removeComponentAttachment(): no asset service set — call setAssetService() first');
|
|
1484
1608
|
case 1:
|
|
1485
1609
|
if (componentUuid) {
|
|
1486
|
-
|
|
1610
|
+
_context6.n = 2;
|
|
1487
1611
|
break;
|
|
1488
1612
|
}
|
|
1489
1613
|
throw new Error('removeComponentAttachment(): componentUuid is required');
|
|
1490
1614
|
case 2:
|
|
1491
1615
|
if (attachmentId) {
|
|
1492
|
-
|
|
1616
|
+
_context6.n = 3;
|
|
1493
1617
|
break;
|
|
1494
1618
|
}
|
|
1495
1619
|
throw new Error('removeComponentAttachment(): attachmentId is required');
|
|
1496
1620
|
case 3:
|
|
1497
|
-
|
|
1621
|
+
_context6.n = 4;
|
|
1498
1622
|
return this.assetService.removeComponentAttachment({
|
|
1499
1623
|
componentUuid: componentUuid,
|
|
1500
1624
|
attachmentId: attachmentId
|
|
1501
1625
|
});
|
|
1502
1626
|
case 4:
|
|
1503
|
-
updatedAsset =
|
|
1627
|
+
updatedAsset = _context6.v;
|
|
1504
1628
|
// Sync component dictionary
|
|
1505
1629
|
mp = this.getUtility('modelPreloader');
|
|
1506
1630
|
if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
|
|
@@ -1508,9 +1632,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1508
1632
|
id: updatedAsset.uuid
|
|
1509
1633
|
});
|
|
1510
1634
|
}
|
|
1511
|
-
return
|
|
1635
|
+
return _context6.a(2, updatedAsset);
|
|
1512
1636
|
}
|
|
1513
|
-
},
|
|
1637
|
+
}, _callee6, this);
|
|
1514
1638
|
}));
|
|
1515
1639
|
function removeComponentAttachment() {
|
|
1516
1640
|
return _removeComponentAttachment.apply(this, arguments);
|
|
@@ -1703,41 +1827,41 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1703
1827
|
}, {
|
|
1704
1828
|
key: "getComponents",
|
|
1705
1829
|
value: (function () {
|
|
1706
|
-
var _getComponents = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
1830
|
+
var _getComponents = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee7() {
|
|
1707
1831
|
var options,
|
|
1708
1832
|
validation,
|
|
1709
1833
|
enhancedOptions,
|
|
1710
|
-
|
|
1834
|
+
_args7 = arguments,
|
|
1711
1835
|
_t;
|
|
1712
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
1713
|
-
while (1) switch (
|
|
1836
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context7) {
|
|
1837
|
+
while (1) switch (_context7.n) {
|
|
1714
1838
|
case 0:
|
|
1715
|
-
options =
|
|
1839
|
+
options = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
1716
1840
|
// Validate filter options using centralized validator
|
|
1717
1841
|
validation = this.internals.validator.validateComponentFilter(options);
|
|
1718
1842
|
if (validation.isValid) {
|
|
1719
|
-
|
|
1843
|
+
_context7.n = 1;
|
|
1720
1844
|
break;
|
|
1721
1845
|
}
|
|
1722
1846
|
console.warn('⚠️ getComponents(): Invalid filter options provided:', validation.message);
|
|
1723
|
-
return
|
|
1847
|
+
return _context7.a(2, []);
|
|
1724
1848
|
case 1:
|
|
1725
|
-
|
|
1849
|
+
_context7.p = 1;
|
|
1726
1850
|
// Always include metadata
|
|
1727
1851
|
enhancedOptions = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, options), {}, {
|
|
1728
1852
|
includeMetadata: true
|
|
1729
1853
|
});
|
|
1730
|
-
|
|
1854
|
+
_context7.n = 2;
|
|
1731
1855
|
return this.managers.componentDataManager.getDictionaryComponents(enhancedOptions);
|
|
1732
1856
|
case 2:
|
|
1733
|
-
return
|
|
1857
|
+
return _context7.a(2, _context7.v);
|
|
1734
1858
|
case 3:
|
|
1735
|
-
|
|
1736
|
-
_t =
|
|
1859
|
+
_context7.p = 3;
|
|
1860
|
+
_t = _context7.v;
|
|
1737
1861
|
console.error('❌ getDictionaryComponents(): Error retrieving available components:', _t);
|
|
1738
|
-
return
|
|
1862
|
+
return _context7.a(2, []);
|
|
1739
1863
|
}
|
|
1740
|
-
},
|
|
1864
|
+
}, _callee7, this, [[1, 3]]);
|
|
1741
1865
|
}));
|
|
1742
1866
|
function getComponents() {
|
|
1743
1867
|
return _getComponents.apply(this, arguments);
|
|
@@ -1840,23 +1964,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1840
1964
|
}, {
|
|
1841
1965
|
key: "extendComponentDictionary",
|
|
1842
1966
|
value: (function () {
|
|
1843
|
-
var _extendComponentDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
1844
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
1845
|
-
while (1) switch (
|
|
1967
|
+
var _extendComponentDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee8(additionalComponents) {
|
|
1968
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context8) {
|
|
1969
|
+
while (1) switch (_context8.n) {
|
|
1846
1970
|
case 0:
|
|
1847
1971
|
if (this.managers.componentDataManager) {
|
|
1848
|
-
|
|
1972
|
+
_context8.n = 1;
|
|
1849
1973
|
break;
|
|
1850
1974
|
}
|
|
1851
1975
|
console.warn('⚠️ extendComponentDictionary(): Component data manager not available');
|
|
1852
|
-
return
|
|
1976
|
+
return _context8.a(2, false);
|
|
1853
1977
|
case 1:
|
|
1854
|
-
|
|
1978
|
+
_context8.n = 2;
|
|
1855
1979
|
return this.managers.componentDataManager.extendComponentDictionary(additionalComponents);
|
|
1856
1980
|
case 2:
|
|
1857
|
-
return
|
|
1981
|
+
return _context8.a(2, _context8.v);
|
|
1858
1982
|
}
|
|
1859
|
-
},
|
|
1983
|
+
}, _callee8, this);
|
|
1860
1984
|
}));
|
|
1861
1985
|
function extendComponentDictionary(_x3) {
|
|
1862
1986
|
return _extendComponentDictionary.apply(this, arguments);
|
|
@@ -1930,23 +2054,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1930
2054
|
}, {
|
|
1931
2055
|
key: "removeS3Components",
|
|
1932
2056
|
value: (function () {
|
|
1933
|
-
var _removeS3Components = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
1934
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
1935
|
-
while (1) switch (
|
|
2057
|
+
var _removeS3Components = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee9() {
|
|
2058
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context9) {
|
|
2059
|
+
while (1) switch (_context9.n) {
|
|
1936
2060
|
case 0:
|
|
1937
2061
|
if (this.managers.componentDataManager) {
|
|
1938
|
-
|
|
2062
|
+
_context9.n = 1;
|
|
1939
2063
|
break;
|
|
1940
2064
|
}
|
|
1941
2065
|
console.warn('⚠️ removeS3Components(): Component data manager not available');
|
|
1942
|
-
return
|
|
2066
|
+
return _context9.a(2, false);
|
|
1943
2067
|
case 1:
|
|
1944
|
-
|
|
2068
|
+
_context9.n = 2;
|
|
1945
2069
|
return this.managers.componentDataManager.removeS3Components();
|
|
1946
2070
|
case 2:
|
|
1947
|
-
return
|
|
2071
|
+
return _context9.a(2, _context9.v);
|
|
1948
2072
|
}
|
|
1949
|
-
},
|
|
2073
|
+
}, _callee9, this);
|
|
1950
2074
|
}));
|
|
1951
2075
|
function removeS3Components() {
|
|
1952
2076
|
return _removeS3Components.apply(this, arguments);
|
|
@@ -1970,23 +2094,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1970
2094
|
}, {
|
|
1971
2095
|
key: "removeComponentFromDictionary",
|
|
1972
2096
|
value: (function () {
|
|
1973
|
-
var _removeComponentFromDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
1974
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
1975
|
-
while (1) switch (
|
|
2097
|
+
var _removeComponentFromDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee0(componentKey) {
|
|
2098
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context0) {
|
|
2099
|
+
while (1) switch (_context0.n) {
|
|
1976
2100
|
case 0:
|
|
1977
2101
|
if (this.managers.componentDataManager) {
|
|
1978
|
-
|
|
2102
|
+
_context0.n = 1;
|
|
1979
2103
|
break;
|
|
1980
2104
|
}
|
|
1981
2105
|
console.warn('⚠️ removeComponentFromDictionary(): Component data manager not available');
|
|
1982
|
-
return
|
|
2106
|
+
return _context0.a(2, false);
|
|
1983
2107
|
case 1:
|
|
1984
|
-
|
|
2108
|
+
_context0.n = 2;
|
|
1985
2109
|
return this.managers.componentDataManager.removeComponentFromDictionary(componentKey);
|
|
1986
2110
|
case 2:
|
|
1987
|
-
return
|
|
2111
|
+
return _context0.a(2, _context0.v);
|
|
1988
2112
|
}
|
|
1989
|
-
},
|
|
2113
|
+
}, _callee0, this);
|
|
1990
2114
|
}));
|
|
1991
2115
|
function removeComponentFromDictionary(_x4) {
|
|
1992
2116
|
return _removeComponentFromDictionary.apply(this, arguments);
|
|
@@ -2022,8 +2146,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2022
2146
|
var componentDictionary = ((_this$managers$compon = this.managers.componentDataManager) === null || _this$managers$compon === void 0 ? void 0 : _this$managers$compon.componentDictionary) || {};
|
|
2023
2147
|
var missingIds = [];
|
|
2024
2148
|
sceneData.scene.children.forEach(function (child) {
|
|
2025
|
-
var _child$
|
|
2026
|
-
var libraryId = (_child$
|
|
2149
|
+
var _child$userData2;
|
|
2150
|
+
var libraryId = (_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.libraryId;
|
|
2027
2151
|
if (libraryId && !componentDictionary[libraryId]) {
|
|
2028
2152
|
// Only add unique IDs
|
|
2029
2153
|
if (!missingIds.includes(libraryId)) {
|
|
@@ -2101,8 +2225,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2101
2225
|
// If still not found, try finding by originalUuid in userData
|
|
2102
2226
|
if (!targetObject) {
|
|
2103
2227
|
this.sceneViewer.scene.traverse(function (child) {
|
|
2104
|
-
var _child$
|
|
2105
|
-
if (((_child$
|
|
2228
|
+
var _child$userData3;
|
|
2229
|
+
if (((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.originalUuid) === objectId) {
|
|
2106
2230
|
targetObject = child;
|
|
2107
2231
|
return;
|
|
2108
2232
|
}
|
|
@@ -2233,49 +2357,49 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2233
2357
|
}, {
|
|
2234
2358
|
key: "initialize2DViewport",
|
|
2235
2359
|
value: function () {
|
|
2236
|
-
var _initialize2DViewport = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
2360
|
+
var _initialize2DViewport = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee1(container) {
|
|
2237
2361
|
var viewType,
|
|
2238
2362
|
instanceKey,
|
|
2239
2363
|
success,
|
|
2240
|
-
|
|
2364
|
+
_args1 = arguments,
|
|
2241
2365
|
_t2;
|
|
2242
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
2243
|
-
while (1) switch (
|
|
2366
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context1) {
|
|
2367
|
+
while (1) switch (_context1.n) {
|
|
2244
2368
|
case 0:
|
|
2245
|
-
viewType =
|
|
2246
|
-
instanceKey =
|
|
2369
|
+
viewType = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : 'top';
|
|
2370
|
+
instanceKey = _args1.length > 2 && _args1[2] !== undefined ? _args1[2] : null;
|
|
2247
2371
|
if (container) {
|
|
2248
|
-
|
|
2372
|
+
_context1.n = 1;
|
|
2249
2373
|
break;
|
|
2250
2374
|
}
|
|
2251
2375
|
console.warn('⚠️ initialize2DViewport(): No container provided');
|
|
2252
|
-
return
|
|
2376
|
+
return _context1.a(2, false);
|
|
2253
2377
|
case 1:
|
|
2254
2378
|
if (this.managers.viewport2DManager) {
|
|
2255
|
-
|
|
2379
|
+
_context1.n = 2;
|
|
2256
2380
|
break;
|
|
2257
2381
|
}
|
|
2258
2382
|
console.warn('⚠️ initialize2DViewport(): Viewport2D manager not available');
|
|
2259
|
-
return
|
|
2383
|
+
return _context1.a(2, false);
|
|
2260
2384
|
case 2:
|
|
2261
|
-
|
|
2262
|
-
|
|
2385
|
+
_context1.p = 2;
|
|
2386
|
+
_context1.n = 3;
|
|
2263
2387
|
return this.managers.viewport2DManager.initialize(container, viewType, instanceKey);
|
|
2264
2388
|
case 3:
|
|
2265
|
-
success =
|
|
2389
|
+
success = _context1.v;
|
|
2266
2390
|
if (success) {
|
|
2267
2391
|
console.log("\u2705 2D viewport initialized successfully (".concat(viewType, " view, key: ").concat(instanceKey || viewType, ")"));
|
|
2268
2392
|
} else {
|
|
2269
2393
|
console.warn("\u26A0\uFE0F Failed to initialize 2D viewport (".concat(viewType, " view)"));
|
|
2270
2394
|
}
|
|
2271
|
-
return
|
|
2395
|
+
return _context1.a(2, success);
|
|
2272
2396
|
case 4:
|
|
2273
|
-
|
|
2274
|
-
_t2 =
|
|
2397
|
+
_context1.p = 4;
|
|
2398
|
+
_t2 = _context1.v;
|
|
2275
2399
|
console.error('❌ initialize2DViewport(): Error initializing 2D viewport:', _t2);
|
|
2276
|
-
return
|
|
2400
|
+
return _context1.a(2, false);
|
|
2277
2401
|
}
|
|
2278
|
-
},
|
|
2402
|
+
}, _callee1, this, [[2, 4]]);
|
|
2279
2403
|
}));
|
|
2280
2404
|
function initialize2DViewport(_x5) {
|
|
2281
2405
|
return _initialize2DViewport.apply(this, arguments);
|
|
@@ -2453,7 +2577,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2453
2577
|
}, {
|
|
2454
2578
|
key: "initializeModelPreloading",
|
|
2455
2579
|
value: (function () {
|
|
2456
|
-
var _initializeModelPreloading = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
2580
|
+
var _initializeModelPreloading = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee10() {
|
|
2457
2581
|
var basePath,
|
|
2458
2582
|
normalizedBasePath,
|
|
2459
2583
|
dictionaryPath,
|
|
@@ -2462,13 +2586,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2462
2586
|
componentDictionary,
|
|
2463
2587
|
_modelPreloader2,
|
|
2464
2588
|
progress,
|
|
2465
|
-
|
|
2589
|
+
_args10 = arguments,
|
|
2466
2590
|
_t3;
|
|
2467
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
2468
|
-
while (1) switch (
|
|
2591
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context10) {
|
|
2592
|
+
while (1) switch (_context10.n) {
|
|
2469
2593
|
case 0:
|
|
2470
|
-
basePath =
|
|
2471
|
-
|
|
2594
|
+
basePath = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : '/library/';
|
|
2595
|
+
_context10.p = 1;
|
|
2472
2596
|
// Ensure basePath ends with a slash
|
|
2473
2597
|
normalizedBasePath = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
|
|
2474
2598
|
dictionaryPath = "".concat(normalizedBasePath, "component-dictionary.json");
|
|
@@ -2479,39 +2603,39 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2479
2603
|
console.log("\uFFFD Models path: ".concat(modelsBasePath));
|
|
2480
2604
|
|
|
2481
2605
|
// Load the component dictionary
|
|
2482
|
-
|
|
2606
|
+
_context10.n = 2;
|
|
2483
2607
|
return fetch(dictionaryPath);
|
|
2484
2608
|
case 2:
|
|
2485
|
-
response =
|
|
2609
|
+
response = _context10.v;
|
|
2486
2610
|
if (response.ok) {
|
|
2487
|
-
|
|
2611
|
+
_context10.n = 3;
|
|
2488
2612
|
break;
|
|
2489
2613
|
}
|
|
2490
2614
|
throw new Error("Failed to load component dictionary: ".concat(response.status));
|
|
2491
2615
|
case 3:
|
|
2492
|
-
|
|
2616
|
+
_context10.n = 4;
|
|
2493
2617
|
return response.json();
|
|
2494
2618
|
case 4:
|
|
2495
|
-
componentDictionary =
|
|
2619
|
+
componentDictionary = _context10.v;
|
|
2496
2620
|
console.log('📚 Component dictionary loaded:', Object.keys(componentDictionary));
|
|
2497
2621
|
|
|
2498
2622
|
// Start preloading all models with the specified base path
|
|
2499
2623
|
_modelPreloader2 = this.getUtility('modelPreloader');
|
|
2500
|
-
|
|
2624
|
+
_context10.n = 5;
|
|
2501
2625
|
return _modelPreloader2.preloadAllModels(componentDictionary, modelsBasePath);
|
|
2502
2626
|
case 5:
|
|
2503
|
-
progress =
|
|
2627
|
+
progress = _context10.v;
|
|
2504
2628
|
console.log('🎉 Model preloading completed:', progress);
|
|
2505
|
-
return
|
|
2629
|
+
return _context10.a(2, progress);
|
|
2506
2630
|
case 6:
|
|
2507
|
-
|
|
2508
|
-
_t3 =
|
|
2631
|
+
_context10.p = 6;
|
|
2632
|
+
_t3 = _context10.v;
|
|
2509
2633
|
console.error('❌ Failed to initialize model preloading:', _t3);
|
|
2510
2634
|
throw _t3;
|
|
2511
2635
|
case 7:
|
|
2512
|
-
return
|
|
2636
|
+
return _context10.a(2);
|
|
2513
2637
|
}
|
|
2514
|
-
},
|
|
2638
|
+
}, _callee10, this, [[1, 6]]);
|
|
2515
2639
|
}));
|
|
2516
2640
|
function initializeModelPreloading() {
|
|
2517
2641
|
return _initializeModelPreloading.apply(this, arguments);
|
|
@@ -2528,86 +2652,86 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2528
2652
|
}, {
|
|
2529
2653
|
key: "importScene",
|
|
2530
2654
|
value: (function () {
|
|
2531
|
-
var _importScene = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
2655
|
+
var _importScene = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee11(jsonData) {
|
|
2532
2656
|
var validation, missingIds, resolved, _t4, _t5;
|
|
2533
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
2534
|
-
while (1) switch (
|
|
2657
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context11) {
|
|
2658
|
+
while (1) switch (_context11.n) {
|
|
2535
2659
|
case 0:
|
|
2536
2660
|
if (jsonData) {
|
|
2537
|
-
|
|
2661
|
+
_context11.n = 1;
|
|
2538
2662
|
break;
|
|
2539
2663
|
}
|
|
2540
2664
|
console.error('❌ No JSON data provided for import');
|
|
2541
|
-
return
|
|
2665
|
+
return _context11.a(2, false);
|
|
2542
2666
|
case 1:
|
|
2543
|
-
|
|
2667
|
+
_context11.p = 1;
|
|
2544
2668
|
// Validate scene data structure
|
|
2545
2669
|
validation = this.internals.validateAndAnalyzeSceneData(jsonData);
|
|
2546
2670
|
if (validation.isValid) {
|
|
2547
|
-
|
|
2671
|
+
_context11.n = 2;
|
|
2548
2672
|
break;
|
|
2549
2673
|
}
|
|
2550
2674
|
console.error('❌ Invalid scene data format:', validation.message);
|
|
2551
|
-
return
|
|
2675
|
+
return _context11.a(2, false);
|
|
2552
2676
|
case 2:
|
|
2553
2677
|
if (!this._componentDefinitionResolver) {
|
|
2554
|
-
|
|
2678
|
+
_context11.n = 8;
|
|
2555
2679
|
break;
|
|
2556
2680
|
}
|
|
2557
2681
|
missingIds = this.getMissingLibraryIds(jsonData);
|
|
2558
2682
|
if (!(missingIds.length > 0)) {
|
|
2559
|
-
|
|
2683
|
+
_context11.n = 8;
|
|
2560
2684
|
break;
|
|
2561
2685
|
}
|
|
2562
|
-
|
|
2686
|
+
_context11.p = 3;
|
|
2563
2687
|
console.log("\uD83D\uDD0D importScene(): Resolving ".concat(missingIds.length, " missing component definition(s)..."));
|
|
2564
|
-
|
|
2688
|
+
_context11.n = 4;
|
|
2565
2689
|
return this._componentDefinitionResolver(missingIds);
|
|
2566
2690
|
case 4:
|
|
2567
|
-
resolved =
|
|
2691
|
+
resolved = _context11.v;
|
|
2568
2692
|
if (!(resolved && _rollupPluginBabelHelpers["typeof"](resolved) === 'object' && Object.keys(resolved).length > 0)) {
|
|
2569
|
-
|
|
2693
|
+
_context11.n = 6;
|
|
2570
2694
|
break;
|
|
2571
2695
|
}
|
|
2572
|
-
|
|
2696
|
+
_context11.n = 5;
|
|
2573
2697
|
return this.extendComponentDictionary(resolved);
|
|
2574
2698
|
case 5:
|
|
2575
2699
|
console.log("\u2705 importScene(): Resolved ".concat(Object.keys(resolved).length, " component definition(s)"));
|
|
2576
2700
|
case 6:
|
|
2577
|
-
|
|
2701
|
+
_context11.n = 8;
|
|
2578
2702
|
break;
|
|
2579
2703
|
case 7:
|
|
2580
|
-
|
|
2581
|
-
_t4 =
|
|
2704
|
+
_context11.p = 7;
|
|
2705
|
+
_t4 = _context11.v;
|
|
2582
2706
|
console.warn('⚠️ importScene(): Component definition resolver failed, continuing with existing dictionary:', _t4);
|
|
2583
2707
|
case 8:
|
|
2584
|
-
|
|
2708
|
+
_context11.n = 9;
|
|
2585
2709
|
return this.setImportedSceneData(jsonData);
|
|
2586
2710
|
case 9:
|
|
2587
2711
|
if (!(this.sceneViewer && this.sceneViewer.sceneOperationsManager)) {
|
|
2588
|
-
|
|
2712
|
+
_context11.n = 11;
|
|
2589
2713
|
break;
|
|
2590
2714
|
}
|
|
2591
|
-
|
|
2715
|
+
_context11.n = 10;
|
|
2592
2716
|
return this.sceneViewer.sceneOperationsManager.loadSceneFromData(jsonData);
|
|
2593
2717
|
case 10:
|
|
2594
2718
|
console.log('✅ Scene imported successfully');
|
|
2595
|
-
return
|
|
2719
|
+
return _context11.a(2, true);
|
|
2596
2720
|
case 11:
|
|
2597
2721
|
console.error('❌ SceneViewer not available for scene loading');
|
|
2598
|
-
return
|
|
2722
|
+
return _context11.a(2, false);
|
|
2599
2723
|
case 12:
|
|
2600
|
-
|
|
2724
|
+
_context11.n = 14;
|
|
2601
2725
|
break;
|
|
2602
2726
|
case 13:
|
|
2603
|
-
|
|
2604
|
-
_t5 =
|
|
2727
|
+
_context11.p = 13;
|
|
2728
|
+
_t5 = _context11.v;
|
|
2605
2729
|
console.error('❌ Error importing scene:', _t5);
|
|
2606
|
-
return
|
|
2730
|
+
return _context11.a(2, false);
|
|
2607
2731
|
case 14:
|
|
2608
|
-
return
|
|
2732
|
+
return _context11.a(2);
|
|
2609
2733
|
}
|
|
2610
|
-
},
|
|
2734
|
+
}, _callee11, this, [[3, 7], [1, 13]]);
|
|
2611
2735
|
}));
|
|
2612
2736
|
function importScene(_x6) {
|
|
2613
2737
|
return _importScene.apply(this, arguments);
|
|
@@ -2631,33 +2755,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2631
2755
|
}, {
|
|
2632
2756
|
key: "exportSceneJSON",
|
|
2633
2757
|
value: (function () {
|
|
2634
|
-
var _exportSceneJSON = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
2758
|
+
var _exportSceneJSON = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee12() {
|
|
2635
2759
|
var filename,
|
|
2636
|
-
|
|
2760
|
+
_args12 = arguments,
|
|
2637
2761
|
_t6;
|
|
2638
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
2639
|
-
while (1) switch (
|
|
2762
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context12) {
|
|
2763
|
+
while (1) switch (_context12.n) {
|
|
2640
2764
|
case 0:
|
|
2641
|
-
filename =
|
|
2765
|
+
filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
|
|
2642
2766
|
if (this.managers.sceneExportManager) {
|
|
2643
|
-
|
|
2767
|
+
_context12.n = 1;
|
|
2644
2768
|
break;
|
|
2645
2769
|
}
|
|
2646
2770
|
console.error('❌ Scene export manager not available');
|
|
2647
|
-
return
|
|
2771
|
+
return _context12.a(2, false);
|
|
2648
2772
|
case 1:
|
|
2649
|
-
|
|
2650
|
-
|
|
2773
|
+
_context12.p = 1;
|
|
2774
|
+
_context12.n = 2;
|
|
2651
2775
|
return this.managers.sceneExportManager.downloadSceneJSON(filename);
|
|
2652
2776
|
case 2:
|
|
2653
|
-
return
|
|
2777
|
+
return _context12.a(2, _context12.v);
|
|
2654
2778
|
case 3:
|
|
2655
|
-
|
|
2656
|
-
_t6 =
|
|
2779
|
+
_context12.p = 3;
|
|
2780
|
+
_t6 = _context12.v;
|
|
2657
2781
|
console.error('❌ Error exporting scene as JSON:', _t6);
|
|
2658
|
-
return
|
|
2782
|
+
return _context12.a(2, false);
|
|
2659
2783
|
}
|
|
2660
|
-
},
|
|
2784
|
+
}, _callee12, this, [[1, 3]]);
|
|
2661
2785
|
}));
|
|
2662
2786
|
function exportSceneJSON() {
|
|
2663
2787
|
return _exportSceneJSON.apply(this, arguments);
|
|
@@ -2682,33 +2806,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2682
2806
|
}, {
|
|
2683
2807
|
key: "exportSceneGLTF",
|
|
2684
2808
|
value: (function () {
|
|
2685
|
-
var _exportSceneGLTF = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
2809
|
+
var _exportSceneGLTF = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee13() {
|
|
2686
2810
|
var filename,
|
|
2687
|
-
|
|
2811
|
+
_args13 = arguments,
|
|
2688
2812
|
_t7;
|
|
2689
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
2690
|
-
while (1) switch (
|
|
2813
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context13) {
|
|
2814
|
+
while (1) switch (_context13.n) {
|
|
2691
2815
|
case 0:
|
|
2692
|
-
filename =
|
|
2816
|
+
filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
|
|
2693
2817
|
if (this.managers.sceneExportManager) {
|
|
2694
|
-
|
|
2818
|
+
_context13.n = 1;
|
|
2695
2819
|
break;
|
|
2696
2820
|
}
|
|
2697
2821
|
console.error('❌ Scene export manager not available');
|
|
2698
|
-
return
|
|
2822
|
+
return _context13.a(2, false);
|
|
2699
2823
|
case 1:
|
|
2700
|
-
|
|
2701
|
-
|
|
2824
|
+
_context13.p = 1;
|
|
2825
|
+
_context13.n = 2;
|
|
2702
2826
|
return this.managers.sceneExportManager.exportSceneAsGLTF(filename, false);
|
|
2703
2827
|
case 2:
|
|
2704
|
-
return
|
|
2828
|
+
return _context13.a(2, _context13.v);
|
|
2705
2829
|
case 3:
|
|
2706
|
-
|
|
2707
|
-
_t7 =
|
|
2830
|
+
_context13.p = 3;
|
|
2831
|
+
_t7 = _context13.v;
|
|
2708
2832
|
console.error('❌ Error exporting scene as GLTF:', _t7);
|
|
2709
|
-
return
|
|
2833
|
+
return _context13.a(2, false);
|
|
2710
2834
|
}
|
|
2711
|
-
},
|
|
2835
|
+
}, _callee13, this, [[1, 3]]);
|
|
2712
2836
|
}));
|
|
2713
2837
|
function exportSceneGLTF() {
|
|
2714
2838
|
return _exportSceneGLTF.apply(this, arguments);
|
|
@@ -2734,33 +2858,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2734
2858
|
}, {
|
|
2735
2859
|
key: "exportSceneGLB",
|
|
2736
2860
|
value: (function () {
|
|
2737
|
-
var _exportSceneGLB = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
2861
|
+
var _exportSceneGLB = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee14() {
|
|
2738
2862
|
var filename,
|
|
2739
|
-
|
|
2863
|
+
_args14 = arguments,
|
|
2740
2864
|
_t8;
|
|
2741
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
2742
|
-
while (1) switch (
|
|
2865
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context14) {
|
|
2866
|
+
while (1) switch (_context14.n) {
|
|
2743
2867
|
case 0:
|
|
2744
|
-
filename =
|
|
2868
|
+
filename = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : null;
|
|
2745
2869
|
if (this.managers.sceneExportManager) {
|
|
2746
|
-
|
|
2870
|
+
_context14.n = 1;
|
|
2747
2871
|
break;
|
|
2748
2872
|
}
|
|
2749
2873
|
console.error('❌ Scene export manager not available');
|
|
2750
|
-
return
|
|
2874
|
+
return _context14.a(2, false);
|
|
2751
2875
|
case 1:
|
|
2752
|
-
|
|
2753
|
-
|
|
2876
|
+
_context14.p = 1;
|
|
2877
|
+
_context14.n = 2;
|
|
2754
2878
|
return this.managers.sceneExportManager.exportSceneAsGLB(filename);
|
|
2755
2879
|
case 2:
|
|
2756
|
-
return
|
|
2880
|
+
return _context14.a(2, _context14.v);
|
|
2757
2881
|
case 3:
|
|
2758
|
-
|
|
2759
|
-
_t8 =
|
|
2882
|
+
_context14.p = 3;
|
|
2883
|
+
_t8 = _context14.v;
|
|
2760
2884
|
console.error('❌ Error exporting scene as GLB:', _t8);
|
|
2761
|
-
return
|
|
2885
|
+
return _context14.a(2, false);
|
|
2762
2886
|
}
|
|
2763
|
-
},
|
|
2887
|
+
}, _callee14, this, [[1, 3]]);
|
|
2764
2888
|
}));
|
|
2765
2889
|
function exportSceneGLB() {
|
|
2766
2890
|
return _exportSceneGLB.apply(this, arguments);
|
|
@@ -2799,16 +2923,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2799
2923
|
}, {
|
|
2800
2924
|
key: "loadSceneFromData",
|
|
2801
2925
|
value: (function () {
|
|
2802
|
-
var _loadSceneFromData = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function
|
|
2803
|
-
return _rollupPluginBabelHelpers.regenerator().w(function (
|
|
2804
|
-
while (1) switch (
|
|
2926
|
+
var _loadSceneFromData = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee15(sceneData) {
|
|
2927
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context15) {
|
|
2928
|
+
while (1) switch (_context15.n) {
|
|
2805
2929
|
case 0:
|
|
2806
|
-
|
|
2930
|
+
_context15.n = 1;
|
|
2807
2931
|
return this.setImportedSceneData(sceneData);
|
|
2808
2932
|
case 1:
|
|
2809
|
-
return
|
|
2933
|
+
return _context15.a(2, true);
|
|
2810
2934
|
}
|
|
2811
|
-
},
|
|
2935
|
+
}, _callee15, this);
|
|
2812
2936
|
}));
|
|
2813
2937
|
function loadSceneFromData(_x7) {
|
|
2814
2938
|
return _loadSceneFromData.apply(this, arguments);
|
|
@@ -2833,9 +2957,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2833
2957
|
}, {
|
|
2834
2958
|
key: "clearScene",
|
|
2835
2959
|
value: function clearScene() {
|
|
2836
|
-
var _this$
|
|
2960
|
+
var _this$sceneViewer13;
|
|
2837
2961
|
this.importedSceneData = null;
|
|
2838
|
-
var ioBehavMgr = (_this$
|
|
2962
|
+
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
2963
|
if (ioBehavMgr) {
|
|
2840
2964
|
ioBehavMgr.setCrossComponentBehaviors([]);
|
|
2841
2965
|
}
|