@2112-lab/central-plant 0.1.39 → 0.1.40
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 +113 -61
- package/dist/cjs/src/core/centralPlant.js +1 -1
- package/dist/cjs/src/core/centralPlantInternals.js +1 -3
- package/dist/cjs/src/core/sceneViewer.js +30 -3
- package/dist/cjs/src/managers/components/pathfindingManager.js +20 -28
- package/dist/cjs/src/managers/scene/sceneExportManager.js +10 -5
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +49 -17
- package/dist/cjs/src/utils/objectTypes.js +2 -4
- package/dist/esm/src/core/centralPlant.js +1 -1
- package/dist/esm/src/core/centralPlantInternals.js +1 -3
- package/dist/esm/src/core/sceneViewer.js +30 -3
- package/dist/esm/src/managers/components/pathfindingManager.js +20 -28
- package/dist/esm/src/managers/scene/sceneExportManager.js +10 -5
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +49 -17
- package/dist/esm/src/utils/objectTypes.js +2 -4
- package/package.json +1 -1
package/dist/bundle/index.js
CHANGED
|
@@ -3210,7 +3210,7 @@ function isConnector(obj) {
|
|
|
3210
3210
|
}
|
|
3211
3211
|
|
|
3212
3212
|
/**
|
|
3213
|
-
* Check if object
|
|
3213
|
+
* Check if object is declared (manually placed/positioned)
|
|
3214
3214
|
* Declared objects should be preserved during regeneration.
|
|
3215
3215
|
*
|
|
3216
3216
|
* @param {Object} obj - Three.js object to check
|
|
@@ -3223,7 +3223,7 @@ function isConnector(obj) {
|
|
|
3223
3223
|
*/
|
|
3224
3224
|
function isDeclared(obj) {
|
|
3225
3225
|
if (!obj || !obj.userData) return false;
|
|
3226
|
-
return obj.userData.isDeclared === true
|
|
3226
|
+
return obj.userData.isDeclared === true;
|
|
3227
3227
|
}
|
|
3228
3228
|
|
|
3229
3229
|
/**
|
|
@@ -3335,7 +3335,6 @@ function getObjectTypeName(obj) {
|
|
|
3335
3335
|
function markAsDeclared(obj) {
|
|
3336
3336
|
if (obj && obj.userData) {
|
|
3337
3337
|
obj.userData.isDeclared = true;
|
|
3338
|
-
obj.userData.origin = 'declared'; // Backward compatibility
|
|
3339
3338
|
}
|
|
3340
3339
|
}
|
|
3341
3340
|
|
|
@@ -3352,7 +3351,6 @@ function markAsDeclared(obj) {
|
|
|
3352
3351
|
function markAsComputed(obj) {
|
|
3353
3352
|
if (obj && obj.userData) {
|
|
3354
3353
|
obj.userData.isDeclared = false;
|
|
3355
|
-
obj.userData.origin = 'computed'; // Backward compatibility
|
|
3356
3354
|
}
|
|
3357
3355
|
}
|
|
3358
3356
|
|
|
@@ -9739,7 +9737,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
9739
9737
|
|
|
9740
9738
|
// Helper function to convert Three.js object to minimal JSON format
|
|
9741
9739
|
var convertObjectToJson = function convertObjectToJson(threeObject) {
|
|
9742
|
-
var _threeObject$name, _threeObject$userData, _threeObject$userData2, _threeObject$userData3, _threeObject$userData4, _threeObject$userData5, _threeObject$userData6, _threeObject$userData7, _threeObject$userData8, _threeObject$userData9;
|
|
9740
|
+
var _threeObject$name, _threeObject$userData, _threeObject$userData2, _threeObject$userData3, _threeObject$userData4, _threeObject$userData5, _threeObject$userData6, _threeObject$userData7, _threeObject$userData8, _threeObject$userData9, _threeObject$userData0, _threeObject$userData1, _threeObject$userData10;
|
|
9743
9741
|
// Skip certain objects that shouldn't be exported
|
|
9744
9742
|
if (!threeObject || (_threeObject$name = threeObject.name) !== null && _threeObject$name !== void 0 && _threeObject$name.includes('Polyline') ||
|
|
9745
9743
|
// Skip pipe paths
|
|
@@ -9763,11 +9761,16 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
9763
9761
|
return null;
|
|
9764
9762
|
}
|
|
9765
9763
|
|
|
9766
|
-
//
|
|
9767
|
-
|
|
9764
|
+
// Skip computed segments (auto-generated), only export DECLARED/MANUAL segments
|
|
9765
|
+
if ((_threeObject$userData7 = threeObject.userData) !== null && _threeObject$userData7 !== void 0 && _threeObject$userData7.isPipeSegment && ((_threeObject$userData8 = threeObject.userData) === null || _threeObject$userData8 === void 0 ? void 0 : _threeObject$userData8.isDeclared) === false) {
|
|
9766
|
+
return null;
|
|
9767
|
+
}
|
|
9768
|
+
|
|
9769
|
+
// Export manual segments (isPipeSegment with isDeclared === true)
|
|
9770
|
+
var isManualSegment = ((_threeObject$userData9 = threeObject.userData) === null || _threeObject$userData9 === void 0 ? void 0 : _threeObject$userData9.isPipeSegment) && ((_threeObject$userData0 = threeObject.userData) === null || _threeObject$userData0 === void 0 ? void 0 : _threeObject$userData0.isDeclared) === true;
|
|
9768
9771
|
|
|
9769
9772
|
// Only export objects with objectType (components, connectors, gateways) OR manual segments
|
|
9770
|
-
if (!((_threeObject$
|
|
9773
|
+
if (!((_threeObject$userData1 = threeObject.userData) !== null && _threeObject$userData1 !== void 0 && _threeObject$userData1.objectType) && !isManualSegment) {
|
|
9771
9774
|
return null;
|
|
9772
9775
|
}
|
|
9773
9776
|
|
|
@@ -9859,7 +9862,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
9859
9862
|
};
|
|
9860
9863
|
|
|
9861
9864
|
// Skip rotation for gateways (they're just routing points)
|
|
9862
|
-
var isGateway = ((_threeObject$
|
|
9865
|
+
var isGateway = ((_threeObject$userData10 = threeObject.userData) === null || _threeObject$userData10 === void 0 ? void 0 : _threeObject$userData10.objectType) === 'gateway';
|
|
9863
9866
|
if (!isGateway) {
|
|
9864
9867
|
jsonObject.rotation = {
|
|
9865
9868
|
x: roundIfClose(threeObject.rotation.x * (180 / Math.PI)),
|
|
@@ -21741,18 +21744,10 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
21741
21744
|
return;
|
|
21742
21745
|
}
|
|
21743
21746
|
children.forEach(function (child) {
|
|
21744
|
-
var _child$userData, _child$userData2, _child$userData3, _child$userData5, _child$userData6, _child$userData7;
|
|
21747
|
+
var _child$userData, _child$userData2, _child$userData3, _child$userData5, _child$userData6, _child$userData7, _child$userData8;
|
|
21745
21748
|
// Skip manual segments - they are visual only and not obstacles for pathfinding
|
|
21749
|
+
// BUT: Keep them in the scene data structure for parent-child relationships
|
|
21746
21750
|
var isManualSegment = ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'segment';
|
|
21747
|
-
if (isManualSegment) {
|
|
21748
|
-
console.log("\u23ED\uFE0F Skipping manual segment in pathfinder: ".concat(child.uuid));
|
|
21749
|
-
|
|
21750
|
-
// Still process the segment's connector children if they exist
|
|
21751
|
-
if (child.children && Array.isArray(child.children) && child.children.length > 0) {
|
|
21752
|
-
_collectAllObjects(child.children);
|
|
21753
|
-
}
|
|
21754
|
-
return; // Skip adding the segment itself
|
|
21755
|
-
}
|
|
21756
21751
|
|
|
21757
21752
|
// Convert connectors to position-based format (Phase 2 Refactoring)
|
|
21758
21753
|
// BUT: Skip manual (declared) connectors and gateways - their positions are already set
|
|
@@ -21786,6 +21781,13 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
21786
21781
|
delete child.rotation;
|
|
21787
21782
|
}
|
|
21788
21783
|
|
|
21784
|
+
// IMPORTANT: Remove bounding boxes from manual segments so they're not treated as obstacles
|
|
21785
|
+
// Manual segments are visual-only representations of paths that have already been manually positioned
|
|
21786
|
+
if (isManualSegment && (_child$userData8 = child.userData) !== null && _child$userData8 !== void 0 && _child$userData8.worldBoundingBox) {
|
|
21787
|
+
console.log("\uD83D\uDD27 Removing bounding box from manual segment: ".concat(child.uuid));
|
|
21788
|
+
delete child.userData.worldBoundingBox;
|
|
21789
|
+
}
|
|
21790
|
+
|
|
21789
21791
|
// If this object has children, recursively collect them before clearing
|
|
21790
21792
|
if (child.children && Array.isArray(child.children) && child.children.length > 0) {
|
|
21791
21793
|
_collectAllObjects(child.children);
|
|
@@ -21909,8 +21911,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
21909
21911
|
isDeclared: false,
|
|
21910
21912
|
gatewayId: gateway.id,
|
|
21911
21913
|
originalUuid: gateway.id,
|
|
21912
|
-
origin: 'computed',
|
|
21913
|
-
// Keep for backward compatibility
|
|
21914
21914
|
// Deep copy connections to prevent mutations affecting pathfinder's internal state
|
|
21915
21915
|
connections: gateway.connections ? {
|
|
21916
21916
|
removed: gateway.connections.removed ? _toConsumableArray(gateway.connections.removed) : [],
|
|
@@ -22309,18 +22309,16 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
22309
22309
|
var additionalSceneDataProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
22310
22310
|
// Mark in the scene object
|
|
22311
22311
|
object.userData.isDeclared = true;
|
|
22312
|
-
object.userData.origin = 'declared'; // Backward compatibility
|
|
22313
22312
|
|
|
22314
22313
|
// Find and update in scene data
|
|
22315
22314
|
var foundInSceneData = false;
|
|
22316
22315
|
for (var i = 0; i < currentSceneData.scene.children.length; i++) {
|
|
22317
|
-
var _object$userData, _child$
|
|
22316
|
+
var _object$userData, _child$userData9;
|
|
22318
22317
|
var child = currentSceneData.scene.children[i];
|
|
22319
|
-
if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$
|
|
22318
|
+
if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$userData9 = child.userData) === null || _child$userData9 === void 0 ? void 0 : _child$userData9.originalUuid)) {
|
|
22320
22319
|
var _object$userData2, _object$userData3;
|
|
22321
22320
|
if (!child.userData) child.userData = {};
|
|
22322
22321
|
child.userData.isDeclared = true;
|
|
22323
|
-
child.userData.origin = 'declared';
|
|
22324
22322
|
|
|
22325
22323
|
// Update position in scene data
|
|
22326
22324
|
if (!child.position) {
|
|
@@ -22348,8 +22346,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
22348
22346
|
uuid: object.uuid,
|
|
22349
22347
|
userData: _objectSpread2({
|
|
22350
22348
|
objectType: object.userData.objectType,
|
|
22351
|
-
isDeclared: true
|
|
22352
|
-
origin: 'declared'
|
|
22349
|
+
isDeclared: true
|
|
22353
22350
|
}, object.userData),
|
|
22354
22351
|
position: {
|
|
22355
22352
|
x: object.position.x,
|
|
@@ -22388,7 +22385,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
22388
22385
|
|
|
22389
22386
|
/**
|
|
22390
22387
|
* Check and convert gateways at the original path endpoints to manual (declared)
|
|
22391
|
-
* This method now delegates to
|
|
22388
|
+
* This method now delegates to manualizeGateway to ensure consistent gateway handling
|
|
22392
22389
|
* @param {Array} connectors - Array of connector objects (used to get segment reference)
|
|
22393
22390
|
* @param {Object} currentSceneData - Current scene data
|
|
22394
22391
|
* @returns {Array<string>} Array of converted gateway UUIDs
|
|
@@ -22426,18 +22423,18 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
22426
22423
|
}
|
|
22427
22424
|
});
|
|
22428
22425
|
if (endpointObject) {
|
|
22429
|
-
var _endpointObject$userD, _endpointObject$userD2, _endpointObject$userD3, _endpointObject$userD4, _endpointObject$userD5, _endpointObject$userD6
|
|
22430
|
-
console.log("\uD83D\uDD0D Found endpoint object: ".concat(endpointObject.uuid, " - objectType: ").concat((_endpointObject$userD = endpointObject.userData) === null || _endpointObject$userD === void 0 ? void 0 : _endpointObject$userD.objectType, ", isDeclared: ").concat((_endpointObject$userD2 = endpointObject.userData) === null || _endpointObject$userD2 === void 0 ? void 0 : _endpointObject$userD2.isDeclared
|
|
22426
|
+
var _endpointObject$userD, _endpointObject$userD2, _endpointObject$userD3, _endpointObject$userD4, _endpointObject$userD5, _endpointObject$userD6;
|
|
22427
|
+
console.log("\uD83D\uDD0D Found endpoint object: ".concat(endpointObject.uuid, " - objectType: ").concat((_endpointObject$userD = endpointObject.userData) === null || _endpointObject$userD === void 0 ? void 0 : _endpointObject$userD.objectType, ", isDeclared: ").concat((_endpointObject$userD2 = endpointObject.userData) === null || _endpointObject$userD2 === void 0 ? void 0 : _endpointObject$userD2.isDeclared));
|
|
22431
22428
|
|
|
22432
22429
|
// Check if this endpoint is a gateway that needs to be converted to manual
|
|
22433
22430
|
// IMPORTANT: Only convert if it's NOT already declared to prevent double-processing
|
|
22434
|
-
if (((_endpointObject$
|
|
22431
|
+
if (((_endpointObject$userD3 = endpointObject.userData) === null || _endpointObject$userD3 === void 0 ? void 0 : _endpointObject$userD3.objectType) === 'gateway' && ((_endpointObject$userD4 = endpointObject.userData) === null || _endpointObject$userD4 === void 0 ? void 0 : _endpointObject$userD4.isDeclared) !== true) {
|
|
22435
22432
|
console.log("\uD83D\uDD27 Found computed gateway at endpoint: ".concat(endpointObject.uuid, " - converting to manual"));
|
|
22436
22433
|
|
|
22437
22434
|
// Convert gateway to manual (declared) using manualizeGateway for consistency
|
|
22438
22435
|
_this5.manualizeGateway(endpointObject, currentSceneData);
|
|
22439
22436
|
convertedGateways.push(endpointObject);
|
|
22440
|
-
} else if (((_endpointObject$
|
|
22437
|
+
} else if (((_endpointObject$userD5 = endpointObject.userData) === null || _endpointObject$userD5 === void 0 ? void 0 : _endpointObject$userD5.objectType) === 'gateway' && ((_endpointObject$userD6 = endpointObject.userData) === null || _endpointObject$userD6 === void 0 ? void 0 : _endpointObject$userD6.isDeclared) === true) {
|
|
22441
22438
|
console.log("\u2139\uFE0F Gateway ".concat(endpointObject.uuid, " is already declared (manual), skipping conversion"));
|
|
22442
22439
|
}
|
|
22443
22440
|
} else {
|
|
@@ -22526,8 +22523,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
22526
22523
|
if (!gateway || !gateway.userData || gateway.userData.objectType !== 'gateway') {
|
|
22527
22524
|
console.log('❌ Object is not a gateway:', {
|
|
22528
22525
|
isObject: !!gateway,
|
|
22529
|
-
hasUserData: !!(gateway && gateway.userData)
|
|
22530
|
-
isGateway: !!(gateway && gateway.userData && gateway.userData.objectType === 'gateway')
|
|
22526
|
+
hasUserData: !!(gateway && gateway.userData)
|
|
22531
22527
|
});
|
|
22532
22528
|
return;
|
|
22533
22529
|
}
|
|
@@ -22591,7 +22587,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
22591
22587
|
gatewayId: gateway.userData.gatewayId || gateway.uuid,
|
|
22592
22588
|
originalUuid: gateway.userData.originalUuid || gateway.uuid,
|
|
22593
22589
|
isDeclared: true,
|
|
22594
|
-
origin: 'declared',
|
|
22595
22590
|
connections: gateway.userData.connections,
|
|
22596
22591
|
position: [gateway.position.x, gateway.position.y, gateway.position.z]
|
|
22597
22592
|
},
|
|
@@ -23078,11 +23073,11 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
23078
23073
|
_step2;
|
|
23079
23074
|
try {
|
|
23080
23075
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
23081
|
-
var _object$userData1, _child$
|
|
23076
|
+
var _object$userData1, _child$userData0;
|
|
23082
23077
|
var child = _step2.value;
|
|
23083
23078
|
// Use the centralized findObjectByHardcodedUuid logic (but for JSON objects)
|
|
23084
23079
|
// Strategy 1: Direct hardcoded UUID match (HIGHEST PRIORITY)
|
|
23085
|
-
if (child.uuid === object.uuid || child.uuid === ((_object$userData1 = object.userData) === null || _object$userData1 === void 0 ? void 0 : _object$userData1.originalUuid) || object.uuid === ((_child$
|
|
23080
|
+
if (child.uuid === object.uuid || child.uuid === ((_object$userData1 = object.userData) === null || _object$userData1 === void 0 ? void 0 : _object$userData1.originalUuid) || object.uuid === ((_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.originalUuid)) {
|
|
23086
23081
|
return child;
|
|
23087
23082
|
}
|
|
23088
23083
|
|
|
@@ -24732,11 +24727,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
24732
24727
|
// If a gateway appears in the JSON, it's manual by definition
|
|
24733
24728
|
mesh.userData.isDeclared = true;
|
|
24734
24729
|
}
|
|
24735
|
-
|
|
24736
|
-
// For gateways, also set origin flag for backward compatibility
|
|
24737
|
-
if (mesh.userData.objectType === 'gateway') {
|
|
24738
|
-
mesh.userData.origin = 'declared'; // Explicit origin marker for manual gateways
|
|
24739
|
-
}
|
|
24740
24730
|
if (mesh.isMesh) {
|
|
24741
24731
|
mesh.castShadow = true;
|
|
24742
24732
|
mesh.receiveShadow = true;
|
|
@@ -25042,11 +25032,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
25042
25032
|
jsonObject.userData.position = [worldPos.x, worldPos.y, worldPos.z];
|
|
25043
25033
|
console.log("\u2705 Set userData.position for ".concat(jsonObject.userData.objectType, " ").concat(jsonObject.uuid, ": [").concat(worldPos.x.toFixed(2), ", ").concat(worldPos.y.toFixed(2), ", ").concat(worldPos.z.toFixed(2), "]"));
|
|
25044
25034
|
|
|
25045
|
-
// For gateways, ensure
|
|
25035
|
+
// For gateways, ensure isDeclared flag is in scene data
|
|
25046
25036
|
if (jsonObject.userData.objectType === 'gateway') {
|
|
25047
|
-
if (!jsonObject.userData.origin) {
|
|
25048
|
-
jsonObject.userData.origin = 'declared'; // Mark as declared gateway
|
|
25049
|
-
}
|
|
25050
25037
|
if (jsonObject.userData.isDeclared === undefined) {
|
|
25051
25038
|
jsonObject.userData.isDeclared = true;
|
|
25052
25039
|
}
|
|
@@ -25147,6 +25134,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
25147
25134
|
_context5.n = 1;
|
|
25148
25135
|
return this.clearSceneObjects();
|
|
25149
25136
|
case 1:
|
|
25137
|
+
// Mark all imported objects as declared in the scene data
|
|
25138
|
+
// This ensures manual segment connectors and other objects are recognized as declared
|
|
25139
|
+
// when flattenSceneStructure() processes them for pathfinding
|
|
25140
|
+
this._markImportedObjectsAsDeclared(data);
|
|
25150
25141
|
component.currentSceneData = data;
|
|
25151
25142
|
case 2:
|
|
25152
25143
|
return _context5.a(2);
|
|
@@ -25158,19 +25149,55 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
25158
25149
|
}
|
|
25159
25150
|
return _prepareSceneForLoading;
|
|
25160
25151
|
}()
|
|
25152
|
+
/**
|
|
25153
|
+
* Recursively mark all objects in imported scene data as declared
|
|
25154
|
+
* This ensures that manual segments and their connectors are properly recognized
|
|
25155
|
+
* @param {Object} data - Scene data object
|
|
25156
|
+
*/
|
|
25157
|
+
)
|
|
25158
|
+
}, {
|
|
25159
|
+
key: "_markImportedObjectsAsDeclared",
|
|
25160
|
+
value: function _markImportedObjectsAsDeclared(data) {
|
|
25161
|
+
var _data$scene;
|
|
25162
|
+
if (!(data !== null && data !== void 0 && (_data$scene = data.scene) !== null && _data$scene !== void 0 && _data$scene.children)) {
|
|
25163
|
+
return;
|
|
25164
|
+
}
|
|
25165
|
+
var _markChildren = function markChildren(children) {
|
|
25166
|
+
if (!Array.isArray(children)) {
|
|
25167
|
+
return;
|
|
25168
|
+
}
|
|
25169
|
+
children.forEach(function (child) {
|
|
25170
|
+
if (!child.userData) {
|
|
25171
|
+
child.userData = {};
|
|
25172
|
+
}
|
|
25173
|
+
|
|
25174
|
+
// Set isDeclared to true for all imported objects
|
|
25175
|
+
if (child.userData.isDeclared === undefined) {
|
|
25176
|
+
child.userData.isDeclared = true;
|
|
25177
|
+
}
|
|
25178
|
+
|
|
25179
|
+
// Recursively process children (e.g., manual segment connectors)
|
|
25180
|
+
if (child.children && Array.isArray(child.children)) {
|
|
25181
|
+
_markChildren(child.children);
|
|
25182
|
+
}
|
|
25183
|
+
});
|
|
25184
|
+
};
|
|
25185
|
+
_markChildren(data.scene.children);
|
|
25186
|
+
console.log('✅ Marked all imported objects as declared in scene data');
|
|
25187
|
+
}
|
|
25188
|
+
|
|
25161
25189
|
/**
|
|
25162
25190
|
* Inject connector children from component dictionary into scene data components
|
|
25163
25191
|
* This allows scene files to omit connector children since they're defined in the dictionary
|
|
25164
25192
|
* @param {Object} data - Scene data to modify
|
|
25165
25193
|
* @param {Object} componentDictionary - Component dictionary with connector definitions
|
|
25166
25194
|
*/
|
|
25167
|
-
)
|
|
25168
25195
|
}, {
|
|
25169
25196
|
key: "_injectConnectorChildrenFromDictionary",
|
|
25170
25197
|
value: function _injectConnectorChildrenFromDictionary(data, componentDictionary) {
|
|
25171
|
-
var _data$
|
|
25198
|
+
var _data$scene2,
|
|
25172
25199
|
_this3 = this;
|
|
25173
|
-
if (!(data !== null && data !== void 0 && (_data$
|
|
25200
|
+
if (!(data !== null && data !== void 0 && (_data$scene2 = data.scene) !== null && _data$scene2 !== void 0 && _data$scene2.children) || !componentDictionary) {
|
|
25174
25201
|
return;
|
|
25175
25202
|
}
|
|
25176
25203
|
var componentsProcessed = 0;
|
|
@@ -25470,7 +25497,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
25470
25497
|
key: "loadSceneFromData",
|
|
25471
25498
|
value: (function () {
|
|
25472
25499
|
var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(data) {
|
|
25473
|
-
var _data$
|
|
25500
|
+
var _data$scene3, _data$scene4, _data$scene5, _data$scene6;
|
|
25474
25501
|
return _regenerator().w(function (_context9) {
|
|
25475
25502
|
while (1) switch (_context9.n) {
|
|
25476
25503
|
case 0:
|
|
@@ -25480,10 +25507,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
25480
25507
|
dataType: _typeof(data),
|
|
25481
25508
|
hasScene: !!(data !== null && data !== void 0 && data.scene),
|
|
25482
25509
|
sceneType: _typeof(data === null || data === void 0 ? void 0 : data.scene),
|
|
25483
|
-
hasChildren: !!(data !== null && data !== void 0 && (_data$
|
|
25484
|
-
childrenType: data !== null && data !== void 0 && (_data$
|
|
25485
|
-
isArray: Array.isArray(data === null || data === void 0 || (_data$
|
|
25486
|
-
childrenLength: data === null || data === void 0 || (_data$
|
|
25510
|
+
hasChildren: !!(data !== null && data !== void 0 && (_data$scene3 = data.scene) !== null && _data$scene3 !== void 0 && _data$scene3.children),
|
|
25511
|
+
childrenType: data !== null && data !== void 0 && (_data$scene4 = data.scene) !== null && _data$scene4 !== void 0 && _data$scene4.children ? _typeof(data.scene.children) : 'undefined',
|
|
25512
|
+
isArray: Array.isArray(data === null || data === void 0 || (_data$scene5 = data.scene) === null || _data$scene5 === void 0 ? void 0 : _data$scene5.children),
|
|
25513
|
+
childrenLength: data === null || data === void 0 || (_data$scene6 = data.scene) === null || _data$scene6 === void 0 || (_data$scene6 = _data$scene6.children) === null || _data$scene6 === void 0 ? void 0 : _data$scene6.length,
|
|
25487
25514
|
dataKeys: data ? Object.keys(data) : [],
|
|
25488
25515
|
sceneKeys: data !== null && data !== void 0 && data.scene ? Object.keys(data.scene) : []
|
|
25489
25516
|
});
|
|
@@ -29955,9 +29982,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
29955
29982
|
originalUuid: componentId,
|
|
29956
29983
|
addedTimestamp: new Date().toISOString(),
|
|
29957
29984
|
addedBy: 'centralPlant.addComponent()',
|
|
29958
|
-
|
|
29959
|
-
initialPosition: _objectSpread2({}, position),
|
|
29960
|
-
initialRotation: _objectSpread2({}, rotation)
|
|
29985
|
+
initialPosition: _objectSpread2({}, position)
|
|
29961
29986
|
};
|
|
29962
29987
|
|
|
29963
29988
|
// Add the component to the scene
|
|
@@ -30108,7 +30133,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
30108
30133
|
* Initialize the CentralPlant manager
|
|
30109
30134
|
*
|
|
30110
30135
|
* @constructor
|
|
30111
|
-
* @version 0.1.
|
|
30136
|
+
* @version 0.1.40
|
|
30112
30137
|
* @updated 2025-10-22
|
|
30113
30138
|
*
|
|
30114
30139
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -31979,8 +32004,19 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
31979
32004
|
var _this3 = this;
|
|
31980
32005
|
// Prevent duplicate handlers
|
|
31981
32006
|
if (this._resizeHandlerSetup) return;
|
|
32007
|
+
|
|
32008
|
+
// Debounce timer for resize events
|
|
32009
|
+
var resizeTimeout = null;
|
|
31982
32010
|
var resizeHandler = function resizeHandler() {
|
|
31983
|
-
|
|
32011
|
+
// Clear any pending resize
|
|
32012
|
+
if (resizeTimeout) {
|
|
32013
|
+
clearTimeout(resizeTimeout);
|
|
32014
|
+
}
|
|
32015
|
+
|
|
32016
|
+
// Debounce resize to prevent excessive calls
|
|
32017
|
+
resizeTimeout = setTimeout(function () {
|
|
32018
|
+
_this3.handleResize();
|
|
32019
|
+
}, 100); // 100ms debounce delay
|
|
31984
32020
|
};
|
|
31985
32021
|
window.addEventListener('resize', resizeHandler);
|
|
31986
32022
|
this._resizeHandlerSetup = true;
|
|
@@ -31999,17 +32035,33 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
31999
32035
|
var width = this.container.clientWidth;
|
|
32000
32036
|
var height = this.container.clientHeight;
|
|
32001
32037
|
|
|
32038
|
+
// Validate dimensions to prevent invalid resize
|
|
32039
|
+
if (width <= 0 || height <= 0) {
|
|
32040
|
+
console.warn('⚠️ Invalid resize dimensions:', {
|
|
32041
|
+
width: width,
|
|
32042
|
+
height: height
|
|
32043
|
+
});
|
|
32044
|
+
return;
|
|
32045
|
+
}
|
|
32046
|
+
|
|
32002
32047
|
// Update camera aspect ratio
|
|
32003
32048
|
this.camera.aspect = width / height;
|
|
32004
32049
|
this.camera.updateProjectionMatrix();
|
|
32005
32050
|
|
|
32006
|
-
// Update renderer size
|
|
32007
|
-
this.renderer.setSize(width, height);
|
|
32051
|
+
// Update renderer size (updateStyle=true to sync canvas CSS)
|
|
32052
|
+
this.renderer.setSize(width, height, true);
|
|
32053
|
+
|
|
32054
|
+
// Force renderer to clear and re-render to prevent blank screen
|
|
32055
|
+
this.renderer.clear();
|
|
32008
32056
|
|
|
32009
32057
|
// Update tooltips manager if available
|
|
32010
32058
|
if (this.tooltipsManager) {
|
|
32011
32059
|
this.tooltipsManager.resize();
|
|
32012
32060
|
}
|
|
32061
|
+
console.log('🔄 Window resized:', {
|
|
32062
|
+
width: width,
|
|
32063
|
+
height: height
|
|
32064
|
+
});
|
|
32013
32065
|
}
|
|
32014
32066
|
|
|
32015
32067
|
/**
|
|
@@ -19,7 +19,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
19
19
|
* Initialize the CentralPlant manager
|
|
20
20
|
*
|
|
21
21
|
* @constructor
|
|
22
|
-
* @version 0.1.
|
|
22
|
+
* @version 0.1.40
|
|
23
23
|
* @updated 2025-10-22
|
|
24
24
|
*
|
|
25
25
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -1320,9 +1320,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
1320
1320
|
originalUuid: componentId,
|
|
1321
1321
|
addedTimestamp: new Date().toISOString(),
|
|
1322
1322
|
addedBy: 'centralPlant.addComponent()',
|
|
1323
|
-
|
|
1324
|
-
initialPosition: _rollupPluginBabelHelpers.objectSpread2({}, position),
|
|
1325
|
-
initialRotation: _rollupPluginBabelHelpers.objectSpread2({}, rotation)
|
|
1323
|
+
initialPosition: _rollupPluginBabelHelpers.objectSpread2({}, position)
|
|
1326
1324
|
};
|
|
1327
1325
|
|
|
1328
1326
|
// Add the component to the scene
|
|
@@ -249,8 +249,19 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
249
249
|
var _this3 = this;
|
|
250
250
|
// Prevent duplicate handlers
|
|
251
251
|
if (this._resizeHandlerSetup) return;
|
|
252
|
+
|
|
253
|
+
// Debounce timer for resize events
|
|
254
|
+
var resizeTimeout = null;
|
|
252
255
|
var resizeHandler = function resizeHandler() {
|
|
253
|
-
|
|
256
|
+
// Clear any pending resize
|
|
257
|
+
if (resizeTimeout) {
|
|
258
|
+
clearTimeout(resizeTimeout);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Debounce resize to prevent excessive calls
|
|
262
|
+
resizeTimeout = setTimeout(function () {
|
|
263
|
+
_this3.handleResize();
|
|
264
|
+
}, 100); // 100ms debounce delay
|
|
254
265
|
};
|
|
255
266
|
window.addEventListener('resize', resizeHandler);
|
|
256
267
|
this._resizeHandlerSetup = true;
|
|
@@ -269,17 +280,33 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
269
280
|
var width = this.container.clientWidth;
|
|
270
281
|
var height = this.container.clientHeight;
|
|
271
282
|
|
|
283
|
+
// Validate dimensions to prevent invalid resize
|
|
284
|
+
if (width <= 0 || height <= 0) {
|
|
285
|
+
console.warn('⚠️ Invalid resize dimensions:', {
|
|
286
|
+
width: width,
|
|
287
|
+
height: height
|
|
288
|
+
});
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
272
292
|
// Update camera aspect ratio
|
|
273
293
|
this.camera.aspect = width / height;
|
|
274
294
|
this.camera.updateProjectionMatrix();
|
|
275
295
|
|
|
276
|
-
// Update renderer size
|
|
277
|
-
this.renderer.setSize(width, height);
|
|
296
|
+
// Update renderer size (updateStyle=true to sync canvas CSS)
|
|
297
|
+
this.renderer.setSize(width, height, true);
|
|
298
|
+
|
|
299
|
+
// Force renderer to clear and re-render to prevent blank screen
|
|
300
|
+
this.renderer.clear();
|
|
278
301
|
|
|
279
302
|
// Update tooltips manager if available
|
|
280
303
|
if (this.tooltipsManager) {
|
|
281
304
|
this.tooltipsManager.resize();
|
|
282
305
|
}
|
|
306
|
+
console.log('🔄 Window resized:', {
|
|
307
|
+
width: width,
|
|
308
|
+
height: height
|
|
309
|
+
});
|
|
283
310
|
}
|
|
284
311
|
|
|
285
312
|
/**
|
|
@@ -148,18 +148,10 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
children.forEach(function (child) {
|
|
151
|
-
var _child$userData, _child$userData2, _child$userData3, _child$userData5, _child$userData6, _child$userData7;
|
|
151
|
+
var _child$userData, _child$userData2, _child$userData3, _child$userData5, _child$userData6, _child$userData7, _child$userData8;
|
|
152
152
|
// Skip manual segments - they are visual only and not obstacles for pathfinding
|
|
153
|
+
// BUT: Keep them in the scene data structure for parent-child relationships
|
|
153
154
|
var isManualSegment = ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'segment';
|
|
154
|
-
if (isManualSegment) {
|
|
155
|
-
console.log("\u23ED\uFE0F Skipping manual segment in pathfinder: ".concat(child.uuid));
|
|
156
|
-
|
|
157
|
-
// Still process the segment's connector children if they exist
|
|
158
|
-
if (child.children && Array.isArray(child.children) && child.children.length > 0) {
|
|
159
|
-
_collectAllObjects(child.children);
|
|
160
|
-
}
|
|
161
|
-
return; // Skip adding the segment itself
|
|
162
|
-
}
|
|
163
155
|
|
|
164
156
|
// Convert connectors to position-based format (Phase 2 Refactoring)
|
|
165
157
|
// BUT: Skip manual (declared) connectors and gateways - their positions are already set
|
|
@@ -193,6 +185,13 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
193
185
|
delete child.rotation;
|
|
194
186
|
}
|
|
195
187
|
|
|
188
|
+
// IMPORTANT: Remove bounding boxes from manual segments so they're not treated as obstacles
|
|
189
|
+
// Manual segments are visual-only representations of paths that have already been manually positioned
|
|
190
|
+
if (isManualSegment && (_child$userData8 = child.userData) !== null && _child$userData8 !== void 0 && _child$userData8.worldBoundingBox) {
|
|
191
|
+
console.log("\uD83D\uDD27 Removing bounding box from manual segment: ".concat(child.uuid));
|
|
192
|
+
delete child.userData.worldBoundingBox;
|
|
193
|
+
}
|
|
194
|
+
|
|
196
195
|
// If this object has children, recursively collect them before clearing
|
|
197
196
|
if (child.children && Array.isArray(child.children) && child.children.length > 0) {
|
|
198
197
|
_collectAllObjects(child.children);
|
|
@@ -316,8 +315,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
316
315
|
isDeclared: false,
|
|
317
316
|
gatewayId: gateway.id,
|
|
318
317
|
originalUuid: gateway.id,
|
|
319
|
-
origin: 'computed',
|
|
320
|
-
// Keep for backward compatibility
|
|
321
318
|
// Deep copy connections to prevent mutations affecting pathfinder's internal state
|
|
322
319
|
connections: gateway.connections ? {
|
|
323
320
|
removed: gateway.connections.removed ? _rollupPluginBabelHelpers.toConsumableArray(gateway.connections.removed) : [],
|
|
@@ -716,18 +713,16 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
716
713
|
var additionalSceneDataProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
717
714
|
// Mark in the scene object
|
|
718
715
|
object.userData.isDeclared = true;
|
|
719
|
-
object.userData.origin = 'declared'; // Backward compatibility
|
|
720
716
|
|
|
721
717
|
// Find and update in scene data
|
|
722
718
|
var foundInSceneData = false;
|
|
723
719
|
for (var i = 0; i < currentSceneData.scene.children.length; i++) {
|
|
724
|
-
var _object$userData, _child$
|
|
720
|
+
var _object$userData, _child$userData9;
|
|
725
721
|
var child = currentSceneData.scene.children[i];
|
|
726
|
-
if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$
|
|
722
|
+
if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$userData9 = child.userData) === null || _child$userData9 === void 0 ? void 0 : _child$userData9.originalUuid)) {
|
|
727
723
|
var _object$userData2, _object$userData3;
|
|
728
724
|
if (!child.userData) child.userData = {};
|
|
729
725
|
child.userData.isDeclared = true;
|
|
730
|
-
child.userData.origin = 'declared';
|
|
731
726
|
|
|
732
727
|
// Update position in scene data
|
|
733
728
|
if (!child.position) {
|
|
@@ -755,8 +750,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
755
750
|
uuid: object.uuid,
|
|
756
751
|
userData: _rollupPluginBabelHelpers.objectSpread2({
|
|
757
752
|
objectType: object.userData.objectType,
|
|
758
|
-
isDeclared: true
|
|
759
|
-
origin: 'declared'
|
|
753
|
+
isDeclared: true
|
|
760
754
|
}, object.userData),
|
|
761
755
|
position: {
|
|
762
756
|
x: object.position.x,
|
|
@@ -795,7 +789,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
795
789
|
|
|
796
790
|
/**
|
|
797
791
|
* Check and convert gateways at the original path endpoints to manual (declared)
|
|
798
|
-
* This method now delegates to
|
|
792
|
+
* This method now delegates to manualizeGateway to ensure consistent gateway handling
|
|
799
793
|
* @param {Array} connectors - Array of connector objects (used to get segment reference)
|
|
800
794
|
* @param {Object} currentSceneData - Current scene data
|
|
801
795
|
* @returns {Array<string>} Array of converted gateway UUIDs
|
|
@@ -833,18 +827,18 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
833
827
|
}
|
|
834
828
|
});
|
|
835
829
|
if (endpointObject) {
|
|
836
|
-
var _endpointObject$userD, _endpointObject$userD2, _endpointObject$userD3, _endpointObject$userD4, _endpointObject$userD5, _endpointObject$userD6
|
|
837
|
-
console.log("\uD83D\uDD0D Found endpoint object: ".concat(endpointObject.uuid, " - objectType: ").concat((_endpointObject$userD = endpointObject.userData) === null || _endpointObject$userD === void 0 ? void 0 : _endpointObject$userD.objectType, ", isDeclared: ").concat((_endpointObject$userD2 = endpointObject.userData) === null || _endpointObject$userD2 === void 0 ? void 0 : _endpointObject$userD2.isDeclared
|
|
830
|
+
var _endpointObject$userD, _endpointObject$userD2, _endpointObject$userD3, _endpointObject$userD4, _endpointObject$userD5, _endpointObject$userD6;
|
|
831
|
+
console.log("\uD83D\uDD0D Found endpoint object: ".concat(endpointObject.uuid, " - objectType: ").concat((_endpointObject$userD = endpointObject.userData) === null || _endpointObject$userD === void 0 ? void 0 : _endpointObject$userD.objectType, ", isDeclared: ").concat((_endpointObject$userD2 = endpointObject.userData) === null || _endpointObject$userD2 === void 0 ? void 0 : _endpointObject$userD2.isDeclared));
|
|
838
832
|
|
|
839
833
|
// Check if this endpoint is a gateway that needs to be converted to manual
|
|
840
834
|
// IMPORTANT: Only convert if it's NOT already declared to prevent double-processing
|
|
841
|
-
if (((_endpointObject$
|
|
835
|
+
if (((_endpointObject$userD3 = endpointObject.userData) === null || _endpointObject$userD3 === void 0 ? void 0 : _endpointObject$userD3.objectType) === 'gateway' && ((_endpointObject$userD4 = endpointObject.userData) === null || _endpointObject$userD4 === void 0 ? void 0 : _endpointObject$userD4.isDeclared) !== true) {
|
|
842
836
|
console.log("\uD83D\uDD27 Found computed gateway at endpoint: ".concat(endpointObject.uuid, " - converting to manual"));
|
|
843
837
|
|
|
844
838
|
// Convert gateway to manual (declared) using manualizeGateway for consistency
|
|
845
839
|
_this5.manualizeGateway(endpointObject, currentSceneData);
|
|
846
840
|
convertedGateways.push(endpointObject);
|
|
847
|
-
} else if (((_endpointObject$
|
|
841
|
+
} else if (((_endpointObject$userD5 = endpointObject.userData) === null || _endpointObject$userD5 === void 0 ? void 0 : _endpointObject$userD5.objectType) === 'gateway' && ((_endpointObject$userD6 = endpointObject.userData) === null || _endpointObject$userD6 === void 0 ? void 0 : _endpointObject$userD6.isDeclared) === true) {
|
|
848
842
|
console.log("\u2139\uFE0F Gateway ".concat(endpointObject.uuid, " is already declared (manual), skipping conversion"));
|
|
849
843
|
}
|
|
850
844
|
} else {
|
|
@@ -933,8 +927,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
933
927
|
if (!gateway || !gateway.userData || gateway.userData.objectType !== 'gateway') {
|
|
934
928
|
console.log('❌ Object is not a gateway:', {
|
|
935
929
|
isObject: !!gateway,
|
|
936
|
-
hasUserData: !!(gateway && gateway.userData)
|
|
937
|
-
isGateway: !!(gateway && gateway.userData && gateway.userData.objectType === 'gateway')
|
|
930
|
+
hasUserData: !!(gateway && gateway.userData)
|
|
938
931
|
});
|
|
939
932
|
return;
|
|
940
933
|
}
|
|
@@ -998,7 +991,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
998
991
|
gatewayId: gateway.userData.gatewayId || gateway.uuid,
|
|
999
992
|
originalUuid: gateway.userData.originalUuid || gateway.uuid,
|
|
1000
993
|
isDeclared: true,
|
|
1001
|
-
origin: 'declared',
|
|
1002
994
|
connections: gateway.userData.connections,
|
|
1003
995
|
position: [gateway.position.x, gateway.position.y, gateway.position.z]
|
|
1004
996
|
},
|
|
@@ -1485,11 +1477,11 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1485
1477
|
_step2;
|
|
1486
1478
|
try {
|
|
1487
1479
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1488
|
-
var _object$userData1, _child$
|
|
1480
|
+
var _object$userData1, _child$userData0;
|
|
1489
1481
|
var child = _step2.value;
|
|
1490
1482
|
// Use the centralized findObjectByHardcodedUuid logic (but for JSON objects)
|
|
1491
1483
|
// Strategy 1: Direct hardcoded UUID match (HIGHEST PRIORITY)
|
|
1492
|
-
if (child.uuid === object.uuid || child.uuid === ((_object$userData1 = object.userData) === null || _object$userData1 === void 0 ? void 0 : _object$userData1.originalUuid) || object.uuid === ((_child$
|
|
1484
|
+
if (child.uuid === object.uuid || child.uuid === ((_object$userData1 = object.userData) === null || _object$userData1 === void 0 ? void 0 : _object$userData1.originalUuid) || object.uuid === ((_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.originalUuid)) {
|
|
1493
1485
|
return child;
|
|
1494
1486
|
}
|
|
1495
1487
|
|
|
@@ -101,7 +101,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
101
101
|
|
|
102
102
|
// Helper function to convert Three.js object to minimal JSON format
|
|
103
103
|
var convertObjectToJson = function convertObjectToJson(threeObject) {
|
|
104
|
-
var _threeObject$name, _threeObject$userData, _threeObject$userData2, _threeObject$userData3, _threeObject$userData4, _threeObject$userData5, _threeObject$userData6, _threeObject$userData7, _threeObject$userData8, _threeObject$userData9;
|
|
104
|
+
var _threeObject$name, _threeObject$userData, _threeObject$userData2, _threeObject$userData3, _threeObject$userData4, _threeObject$userData5, _threeObject$userData6, _threeObject$userData7, _threeObject$userData8, _threeObject$userData9, _threeObject$userData0, _threeObject$userData1, _threeObject$userData10;
|
|
105
105
|
// Skip certain objects that shouldn't be exported
|
|
106
106
|
if (!threeObject || (_threeObject$name = threeObject.name) !== null && _threeObject$name !== void 0 && _threeObject$name.includes('Polyline') ||
|
|
107
107
|
// Skip pipe paths
|
|
@@ -125,11 +125,16 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
//
|
|
129
|
-
|
|
128
|
+
// Skip computed segments (auto-generated), only export DECLARED/MANUAL segments
|
|
129
|
+
if ((_threeObject$userData7 = threeObject.userData) !== null && _threeObject$userData7 !== void 0 && _threeObject$userData7.isPipeSegment && ((_threeObject$userData8 = threeObject.userData) === null || _threeObject$userData8 === void 0 ? void 0 : _threeObject$userData8.isDeclared) === false) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Export manual segments (isPipeSegment with isDeclared === true)
|
|
134
|
+
var isManualSegment = ((_threeObject$userData9 = threeObject.userData) === null || _threeObject$userData9 === void 0 ? void 0 : _threeObject$userData9.isPipeSegment) && ((_threeObject$userData0 = threeObject.userData) === null || _threeObject$userData0 === void 0 ? void 0 : _threeObject$userData0.isDeclared) === true;
|
|
130
135
|
|
|
131
136
|
// Only export objects with objectType (components, connectors, gateways) OR manual segments
|
|
132
|
-
if (!((_threeObject$
|
|
137
|
+
if (!((_threeObject$userData1 = threeObject.userData) !== null && _threeObject$userData1 !== void 0 && _threeObject$userData1.objectType) && !isManualSegment) {
|
|
133
138
|
return null;
|
|
134
139
|
}
|
|
135
140
|
|
|
@@ -221,7 +226,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
221
226
|
};
|
|
222
227
|
|
|
223
228
|
// Skip rotation for gateways (they're just routing points)
|
|
224
|
-
var isGateway = ((_threeObject$
|
|
229
|
+
var isGateway = ((_threeObject$userData10 = threeObject.userData) === null || _threeObject$userData10 === void 0 ? void 0 : _threeObject$userData10.objectType) === 'gateway';
|
|
225
230
|
if (!isGateway) {
|
|
226
231
|
jsonObject.rotation = {
|
|
227
232
|
x: roundIfClose(threeObject.rotation.x * (180 / Math.PI)),
|
|
@@ -369,11 +369,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
369
369
|
// If a gateway appears in the JSON, it's manual by definition
|
|
370
370
|
mesh.userData.isDeclared = true;
|
|
371
371
|
}
|
|
372
|
-
|
|
373
|
-
// For gateways, also set origin flag for backward compatibility
|
|
374
|
-
if (mesh.userData.objectType === 'gateway') {
|
|
375
|
-
mesh.userData.origin = 'declared'; // Explicit origin marker for manual gateways
|
|
376
|
-
}
|
|
377
372
|
if (mesh.isMesh) {
|
|
378
373
|
mesh.castShadow = true;
|
|
379
374
|
mesh.receiveShadow = true;
|
|
@@ -679,11 +674,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
679
674
|
jsonObject.userData.position = [worldPos.x, worldPos.y, worldPos.z];
|
|
680
675
|
console.log("\u2705 Set userData.position for ".concat(jsonObject.userData.objectType, " ").concat(jsonObject.uuid, ": [").concat(worldPos.x.toFixed(2), ", ").concat(worldPos.y.toFixed(2), ", ").concat(worldPos.z.toFixed(2), "]"));
|
|
681
676
|
|
|
682
|
-
// For gateways, ensure
|
|
677
|
+
// For gateways, ensure isDeclared flag is in scene data
|
|
683
678
|
if (jsonObject.userData.objectType === 'gateway') {
|
|
684
|
-
if (!jsonObject.userData.origin) {
|
|
685
|
-
jsonObject.userData.origin = 'declared'; // Mark as declared gateway
|
|
686
|
-
}
|
|
687
679
|
if (jsonObject.userData.isDeclared === undefined) {
|
|
688
680
|
jsonObject.userData.isDeclared = true;
|
|
689
681
|
}
|
|
@@ -784,6 +776,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
784
776
|
_context5.n = 1;
|
|
785
777
|
return this.clearSceneObjects();
|
|
786
778
|
case 1:
|
|
779
|
+
// Mark all imported objects as declared in the scene data
|
|
780
|
+
// This ensures manual segment connectors and other objects are recognized as declared
|
|
781
|
+
// when flattenSceneStructure() processes them for pathfinding
|
|
782
|
+
this._markImportedObjectsAsDeclared(data);
|
|
787
783
|
component.currentSceneData = data;
|
|
788
784
|
case 2:
|
|
789
785
|
return _context5.a(2);
|
|
@@ -795,19 +791,55 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
795
791
|
}
|
|
796
792
|
return _prepareSceneForLoading;
|
|
797
793
|
}()
|
|
794
|
+
/**
|
|
795
|
+
* Recursively mark all objects in imported scene data as declared
|
|
796
|
+
* This ensures that manual segments and their connectors are properly recognized
|
|
797
|
+
* @param {Object} data - Scene data object
|
|
798
|
+
*/
|
|
799
|
+
)
|
|
800
|
+
}, {
|
|
801
|
+
key: "_markImportedObjectsAsDeclared",
|
|
802
|
+
value: function _markImportedObjectsAsDeclared(data) {
|
|
803
|
+
var _data$scene;
|
|
804
|
+
if (!(data !== null && data !== void 0 && (_data$scene = data.scene) !== null && _data$scene !== void 0 && _data$scene.children)) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
var _markChildren = function markChildren(children) {
|
|
808
|
+
if (!Array.isArray(children)) {
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
children.forEach(function (child) {
|
|
812
|
+
if (!child.userData) {
|
|
813
|
+
child.userData = {};
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// Set isDeclared to true for all imported objects
|
|
817
|
+
if (child.userData.isDeclared === undefined) {
|
|
818
|
+
child.userData.isDeclared = true;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// Recursively process children (e.g., manual segment connectors)
|
|
822
|
+
if (child.children && Array.isArray(child.children)) {
|
|
823
|
+
_markChildren(child.children);
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
};
|
|
827
|
+
_markChildren(data.scene.children);
|
|
828
|
+
console.log('✅ Marked all imported objects as declared in scene data');
|
|
829
|
+
}
|
|
830
|
+
|
|
798
831
|
/**
|
|
799
832
|
* Inject connector children from component dictionary into scene data components
|
|
800
833
|
* This allows scene files to omit connector children since they're defined in the dictionary
|
|
801
834
|
* @param {Object} data - Scene data to modify
|
|
802
835
|
* @param {Object} componentDictionary - Component dictionary with connector definitions
|
|
803
836
|
*/
|
|
804
|
-
)
|
|
805
837
|
}, {
|
|
806
838
|
key: "_injectConnectorChildrenFromDictionary",
|
|
807
839
|
value: function _injectConnectorChildrenFromDictionary(data, componentDictionary) {
|
|
808
|
-
var _data$
|
|
840
|
+
var _data$scene2,
|
|
809
841
|
_this3 = this;
|
|
810
|
-
if (!(data !== null && data !== void 0 && (_data$
|
|
842
|
+
if (!(data !== null && data !== void 0 && (_data$scene2 = data.scene) !== null && _data$scene2 !== void 0 && _data$scene2.children) || !componentDictionary) {
|
|
811
843
|
return;
|
|
812
844
|
}
|
|
813
845
|
var componentsProcessed = 0;
|
|
@@ -1107,7 +1139,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1107
1139
|
key: "loadSceneFromData",
|
|
1108
1140
|
value: (function () {
|
|
1109
1141
|
var _loadSceneFromData = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee9(data) {
|
|
1110
|
-
var _data$
|
|
1142
|
+
var _data$scene3, _data$scene4, _data$scene5, _data$scene6;
|
|
1111
1143
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context9) {
|
|
1112
1144
|
while (1) switch (_context9.n) {
|
|
1113
1145
|
case 0:
|
|
@@ -1117,10 +1149,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1117
1149
|
dataType: _rollupPluginBabelHelpers["typeof"](data),
|
|
1118
1150
|
hasScene: !!(data !== null && data !== void 0 && data.scene),
|
|
1119
1151
|
sceneType: _rollupPluginBabelHelpers["typeof"](data === null || data === void 0 ? void 0 : data.scene),
|
|
1120
|
-
hasChildren: !!(data !== null && data !== void 0 && (_data$
|
|
1121
|
-
childrenType: data !== null && data !== void 0 && (_data$
|
|
1122
|
-
isArray: Array.isArray(data === null || data === void 0 || (_data$
|
|
1123
|
-
childrenLength: data === null || data === void 0 || (_data$
|
|
1152
|
+
hasChildren: !!(data !== null && data !== void 0 && (_data$scene3 = data.scene) !== null && _data$scene3 !== void 0 && _data$scene3.children),
|
|
1153
|
+
childrenType: data !== null && data !== void 0 && (_data$scene4 = data.scene) !== null && _data$scene4 !== void 0 && _data$scene4.children ? _rollupPluginBabelHelpers["typeof"](data.scene.children) : 'undefined',
|
|
1154
|
+
isArray: Array.isArray(data === null || data === void 0 || (_data$scene5 = data.scene) === null || _data$scene5 === void 0 ? void 0 : _data$scene5.children),
|
|
1155
|
+
childrenLength: data === null || data === void 0 || (_data$scene6 = data.scene) === null || _data$scene6 === void 0 || (_data$scene6 = _data$scene6.children) === null || _data$scene6 === void 0 ? void 0 : _data$scene6.length,
|
|
1124
1156
|
dataKeys: data ? Object.keys(data) : [],
|
|
1125
1157
|
sceneKeys: data !== null && data !== void 0 && data.scene ? Object.keys(data.scene) : []
|
|
1126
1158
|
});
|
|
@@ -73,7 +73,7 @@ function isConnector(obj) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* Check if object
|
|
76
|
+
* Check if object is declared (manually placed/positioned)
|
|
77
77
|
* Declared objects should be preserved during regeneration.
|
|
78
78
|
*
|
|
79
79
|
* @param {Object} obj - Three.js object to check
|
|
@@ -86,7 +86,7 @@ function isConnector(obj) {
|
|
|
86
86
|
*/
|
|
87
87
|
function isDeclared(obj) {
|
|
88
88
|
if (!obj || !obj.userData) return false;
|
|
89
|
-
return obj.userData.isDeclared === true
|
|
89
|
+
return obj.userData.isDeclared === true;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
@@ -198,7 +198,6 @@ function getObjectTypeName(obj) {
|
|
|
198
198
|
function markAsDeclared(obj) {
|
|
199
199
|
if (obj && obj.userData) {
|
|
200
200
|
obj.userData.isDeclared = true;
|
|
201
|
-
obj.userData.origin = 'declared'; // Backward compatibility
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
|
|
@@ -215,7 +214,6 @@ function markAsDeclared(obj) {
|
|
|
215
214
|
function markAsComputed(obj) {
|
|
216
215
|
if (obj && obj.userData) {
|
|
217
216
|
obj.userData.isDeclared = false;
|
|
218
|
-
obj.userData.origin = 'computed'; // Backward compatibility
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
219
|
|
|
@@ -15,7 +15,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
15
15
|
* Initialize the CentralPlant manager
|
|
16
16
|
*
|
|
17
17
|
* @constructor
|
|
18
|
-
* @version 0.1.
|
|
18
|
+
* @version 0.1.40
|
|
19
19
|
* @updated 2025-10-22
|
|
20
20
|
*
|
|
21
21
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -1296,9 +1296,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
1296
1296
|
originalUuid: componentId,
|
|
1297
1297
|
addedTimestamp: new Date().toISOString(),
|
|
1298
1298
|
addedBy: 'centralPlant.addComponent()',
|
|
1299
|
-
|
|
1300
|
-
initialPosition: _objectSpread2({}, position),
|
|
1301
|
-
initialRotation: _objectSpread2({}, rotation)
|
|
1299
|
+
initialPosition: _objectSpread2({}, position)
|
|
1302
1300
|
};
|
|
1303
1301
|
|
|
1304
1302
|
// Add the component to the scene
|
|
@@ -245,8 +245,19 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
245
245
|
var _this3 = this;
|
|
246
246
|
// Prevent duplicate handlers
|
|
247
247
|
if (this._resizeHandlerSetup) return;
|
|
248
|
+
|
|
249
|
+
// Debounce timer for resize events
|
|
250
|
+
var resizeTimeout = null;
|
|
248
251
|
var resizeHandler = function resizeHandler() {
|
|
249
|
-
|
|
252
|
+
// Clear any pending resize
|
|
253
|
+
if (resizeTimeout) {
|
|
254
|
+
clearTimeout(resizeTimeout);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Debounce resize to prevent excessive calls
|
|
258
|
+
resizeTimeout = setTimeout(function () {
|
|
259
|
+
_this3.handleResize();
|
|
260
|
+
}, 100); // 100ms debounce delay
|
|
250
261
|
};
|
|
251
262
|
window.addEventListener('resize', resizeHandler);
|
|
252
263
|
this._resizeHandlerSetup = true;
|
|
@@ -265,17 +276,33 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
265
276
|
var width = this.container.clientWidth;
|
|
266
277
|
var height = this.container.clientHeight;
|
|
267
278
|
|
|
279
|
+
// Validate dimensions to prevent invalid resize
|
|
280
|
+
if (width <= 0 || height <= 0) {
|
|
281
|
+
console.warn('⚠️ Invalid resize dimensions:', {
|
|
282
|
+
width: width,
|
|
283
|
+
height: height
|
|
284
|
+
});
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
268
288
|
// Update camera aspect ratio
|
|
269
289
|
this.camera.aspect = width / height;
|
|
270
290
|
this.camera.updateProjectionMatrix();
|
|
271
291
|
|
|
272
|
-
// Update renderer size
|
|
273
|
-
this.renderer.setSize(width, height);
|
|
292
|
+
// Update renderer size (updateStyle=true to sync canvas CSS)
|
|
293
|
+
this.renderer.setSize(width, height, true);
|
|
294
|
+
|
|
295
|
+
// Force renderer to clear and re-render to prevent blank screen
|
|
296
|
+
this.renderer.clear();
|
|
274
297
|
|
|
275
298
|
// Update tooltips manager if available
|
|
276
299
|
if (this.tooltipsManager) {
|
|
277
300
|
this.tooltipsManager.resize();
|
|
278
301
|
}
|
|
302
|
+
console.log('🔄 Window resized:', {
|
|
303
|
+
width: width,
|
|
304
|
+
height: height
|
|
305
|
+
});
|
|
279
306
|
}
|
|
280
307
|
|
|
281
308
|
/**
|
|
@@ -124,18 +124,10 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
children.forEach(function (child) {
|
|
127
|
-
var _child$userData, _child$userData2, _child$userData3, _child$userData5, _child$userData6, _child$userData7;
|
|
127
|
+
var _child$userData, _child$userData2, _child$userData3, _child$userData5, _child$userData6, _child$userData7, _child$userData8;
|
|
128
128
|
// Skip manual segments - they are visual only and not obstacles for pathfinding
|
|
129
|
+
// BUT: Keep them in the scene data structure for parent-child relationships
|
|
129
130
|
var isManualSegment = ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'segment';
|
|
130
|
-
if (isManualSegment) {
|
|
131
|
-
console.log("\u23ED\uFE0F Skipping manual segment in pathfinder: ".concat(child.uuid));
|
|
132
|
-
|
|
133
|
-
// Still process the segment's connector children if they exist
|
|
134
|
-
if (child.children && Array.isArray(child.children) && child.children.length > 0) {
|
|
135
|
-
_collectAllObjects(child.children);
|
|
136
|
-
}
|
|
137
|
-
return; // Skip adding the segment itself
|
|
138
|
-
}
|
|
139
131
|
|
|
140
132
|
// Convert connectors to position-based format (Phase 2 Refactoring)
|
|
141
133
|
// BUT: Skip manual (declared) connectors and gateways - their positions are already set
|
|
@@ -169,6 +161,13 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
169
161
|
delete child.rotation;
|
|
170
162
|
}
|
|
171
163
|
|
|
164
|
+
// IMPORTANT: Remove bounding boxes from manual segments so they're not treated as obstacles
|
|
165
|
+
// Manual segments are visual-only representations of paths that have already been manually positioned
|
|
166
|
+
if (isManualSegment && (_child$userData8 = child.userData) !== null && _child$userData8 !== void 0 && _child$userData8.worldBoundingBox) {
|
|
167
|
+
console.log("\uD83D\uDD27 Removing bounding box from manual segment: ".concat(child.uuid));
|
|
168
|
+
delete child.userData.worldBoundingBox;
|
|
169
|
+
}
|
|
170
|
+
|
|
172
171
|
// If this object has children, recursively collect them before clearing
|
|
173
172
|
if (child.children && Array.isArray(child.children) && child.children.length > 0) {
|
|
174
173
|
_collectAllObjects(child.children);
|
|
@@ -292,8 +291,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
292
291
|
isDeclared: false,
|
|
293
292
|
gatewayId: gateway.id,
|
|
294
293
|
originalUuid: gateway.id,
|
|
295
|
-
origin: 'computed',
|
|
296
|
-
// Keep for backward compatibility
|
|
297
294
|
// Deep copy connections to prevent mutations affecting pathfinder's internal state
|
|
298
295
|
connections: gateway.connections ? {
|
|
299
296
|
removed: gateway.connections.removed ? _toConsumableArray(gateway.connections.removed) : [],
|
|
@@ -692,18 +689,16 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
692
689
|
var additionalSceneDataProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
693
690
|
// Mark in the scene object
|
|
694
691
|
object.userData.isDeclared = true;
|
|
695
|
-
object.userData.origin = 'declared'; // Backward compatibility
|
|
696
692
|
|
|
697
693
|
// Find and update in scene data
|
|
698
694
|
var foundInSceneData = false;
|
|
699
695
|
for (var i = 0; i < currentSceneData.scene.children.length; i++) {
|
|
700
|
-
var _object$userData, _child$
|
|
696
|
+
var _object$userData, _child$userData9;
|
|
701
697
|
var child = currentSceneData.scene.children[i];
|
|
702
|
-
if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$
|
|
698
|
+
if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$userData9 = child.userData) === null || _child$userData9 === void 0 ? void 0 : _child$userData9.originalUuid)) {
|
|
703
699
|
var _object$userData2, _object$userData3;
|
|
704
700
|
if (!child.userData) child.userData = {};
|
|
705
701
|
child.userData.isDeclared = true;
|
|
706
|
-
child.userData.origin = 'declared';
|
|
707
702
|
|
|
708
703
|
// Update position in scene data
|
|
709
704
|
if (!child.position) {
|
|
@@ -731,8 +726,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
731
726
|
uuid: object.uuid,
|
|
732
727
|
userData: _objectSpread2({
|
|
733
728
|
objectType: object.userData.objectType,
|
|
734
|
-
isDeclared: true
|
|
735
|
-
origin: 'declared'
|
|
729
|
+
isDeclared: true
|
|
736
730
|
}, object.userData),
|
|
737
731
|
position: {
|
|
738
732
|
x: object.position.x,
|
|
@@ -771,7 +765,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
771
765
|
|
|
772
766
|
/**
|
|
773
767
|
* Check and convert gateways at the original path endpoints to manual (declared)
|
|
774
|
-
* This method now delegates to
|
|
768
|
+
* This method now delegates to manualizeGateway to ensure consistent gateway handling
|
|
775
769
|
* @param {Array} connectors - Array of connector objects (used to get segment reference)
|
|
776
770
|
* @param {Object} currentSceneData - Current scene data
|
|
777
771
|
* @returns {Array<string>} Array of converted gateway UUIDs
|
|
@@ -809,18 +803,18 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
809
803
|
}
|
|
810
804
|
});
|
|
811
805
|
if (endpointObject) {
|
|
812
|
-
var _endpointObject$userD, _endpointObject$userD2, _endpointObject$userD3, _endpointObject$userD4, _endpointObject$userD5, _endpointObject$userD6
|
|
813
|
-
console.log("\uD83D\uDD0D Found endpoint object: ".concat(endpointObject.uuid, " - objectType: ").concat((_endpointObject$userD = endpointObject.userData) === null || _endpointObject$userD === void 0 ? void 0 : _endpointObject$userD.objectType, ", isDeclared: ").concat((_endpointObject$userD2 = endpointObject.userData) === null || _endpointObject$userD2 === void 0 ? void 0 : _endpointObject$userD2.isDeclared
|
|
806
|
+
var _endpointObject$userD, _endpointObject$userD2, _endpointObject$userD3, _endpointObject$userD4, _endpointObject$userD5, _endpointObject$userD6;
|
|
807
|
+
console.log("\uD83D\uDD0D Found endpoint object: ".concat(endpointObject.uuid, " - objectType: ").concat((_endpointObject$userD = endpointObject.userData) === null || _endpointObject$userD === void 0 ? void 0 : _endpointObject$userD.objectType, ", isDeclared: ").concat((_endpointObject$userD2 = endpointObject.userData) === null || _endpointObject$userD2 === void 0 ? void 0 : _endpointObject$userD2.isDeclared));
|
|
814
808
|
|
|
815
809
|
// Check if this endpoint is a gateway that needs to be converted to manual
|
|
816
810
|
// IMPORTANT: Only convert if it's NOT already declared to prevent double-processing
|
|
817
|
-
if (((_endpointObject$
|
|
811
|
+
if (((_endpointObject$userD3 = endpointObject.userData) === null || _endpointObject$userD3 === void 0 ? void 0 : _endpointObject$userD3.objectType) === 'gateway' && ((_endpointObject$userD4 = endpointObject.userData) === null || _endpointObject$userD4 === void 0 ? void 0 : _endpointObject$userD4.isDeclared) !== true) {
|
|
818
812
|
console.log("\uD83D\uDD27 Found computed gateway at endpoint: ".concat(endpointObject.uuid, " - converting to manual"));
|
|
819
813
|
|
|
820
814
|
// Convert gateway to manual (declared) using manualizeGateway for consistency
|
|
821
815
|
_this5.manualizeGateway(endpointObject, currentSceneData);
|
|
822
816
|
convertedGateways.push(endpointObject);
|
|
823
|
-
} else if (((_endpointObject$
|
|
817
|
+
} else if (((_endpointObject$userD5 = endpointObject.userData) === null || _endpointObject$userD5 === void 0 ? void 0 : _endpointObject$userD5.objectType) === 'gateway' && ((_endpointObject$userD6 = endpointObject.userData) === null || _endpointObject$userD6 === void 0 ? void 0 : _endpointObject$userD6.isDeclared) === true) {
|
|
824
818
|
console.log("\u2139\uFE0F Gateway ".concat(endpointObject.uuid, " is already declared (manual), skipping conversion"));
|
|
825
819
|
}
|
|
826
820
|
} else {
|
|
@@ -909,8 +903,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
909
903
|
if (!gateway || !gateway.userData || gateway.userData.objectType !== 'gateway') {
|
|
910
904
|
console.log('❌ Object is not a gateway:', {
|
|
911
905
|
isObject: !!gateway,
|
|
912
|
-
hasUserData: !!(gateway && gateway.userData)
|
|
913
|
-
isGateway: !!(gateway && gateway.userData && gateway.userData.objectType === 'gateway')
|
|
906
|
+
hasUserData: !!(gateway && gateway.userData)
|
|
914
907
|
});
|
|
915
908
|
return;
|
|
916
909
|
}
|
|
@@ -974,7 +967,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
974
967
|
gatewayId: gateway.userData.gatewayId || gateway.uuid,
|
|
975
968
|
originalUuid: gateway.userData.originalUuid || gateway.uuid,
|
|
976
969
|
isDeclared: true,
|
|
977
|
-
origin: 'declared',
|
|
978
970
|
connections: gateway.userData.connections,
|
|
979
971
|
position: [gateway.position.x, gateway.position.y, gateway.position.z]
|
|
980
972
|
},
|
|
@@ -1461,11 +1453,11 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1461
1453
|
_step2;
|
|
1462
1454
|
try {
|
|
1463
1455
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1464
|
-
var _object$userData1, _child$
|
|
1456
|
+
var _object$userData1, _child$userData0;
|
|
1465
1457
|
var child = _step2.value;
|
|
1466
1458
|
// Use the centralized findObjectByHardcodedUuid logic (but for JSON objects)
|
|
1467
1459
|
// Strategy 1: Direct hardcoded UUID match (HIGHEST PRIORITY)
|
|
1468
|
-
if (child.uuid === object.uuid || child.uuid === ((_object$userData1 = object.userData) === null || _object$userData1 === void 0 ? void 0 : _object$userData1.originalUuid) || object.uuid === ((_child$
|
|
1460
|
+
if (child.uuid === object.uuid || child.uuid === ((_object$userData1 = object.userData) === null || _object$userData1 === void 0 ? void 0 : _object$userData1.originalUuid) || object.uuid === ((_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.originalUuid)) {
|
|
1469
1461
|
return child;
|
|
1470
1462
|
}
|
|
1471
1463
|
|
|
@@ -79,7 +79,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
79
79
|
|
|
80
80
|
// Helper function to convert Three.js object to minimal JSON format
|
|
81
81
|
var convertObjectToJson = function convertObjectToJson(threeObject) {
|
|
82
|
-
var _threeObject$name, _threeObject$userData, _threeObject$userData2, _threeObject$userData3, _threeObject$userData4, _threeObject$userData5, _threeObject$userData6, _threeObject$userData7, _threeObject$userData8, _threeObject$userData9;
|
|
82
|
+
var _threeObject$name, _threeObject$userData, _threeObject$userData2, _threeObject$userData3, _threeObject$userData4, _threeObject$userData5, _threeObject$userData6, _threeObject$userData7, _threeObject$userData8, _threeObject$userData9, _threeObject$userData0, _threeObject$userData1, _threeObject$userData10;
|
|
83
83
|
// Skip certain objects that shouldn't be exported
|
|
84
84
|
if (!threeObject || (_threeObject$name = threeObject.name) !== null && _threeObject$name !== void 0 && _threeObject$name.includes('Polyline') ||
|
|
85
85
|
// Skip pipe paths
|
|
@@ -103,11 +103,16 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
//
|
|
107
|
-
|
|
106
|
+
// Skip computed segments (auto-generated), only export DECLARED/MANUAL segments
|
|
107
|
+
if ((_threeObject$userData7 = threeObject.userData) !== null && _threeObject$userData7 !== void 0 && _threeObject$userData7.isPipeSegment && ((_threeObject$userData8 = threeObject.userData) === null || _threeObject$userData8 === void 0 ? void 0 : _threeObject$userData8.isDeclared) === false) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Export manual segments (isPipeSegment with isDeclared === true)
|
|
112
|
+
var isManualSegment = ((_threeObject$userData9 = threeObject.userData) === null || _threeObject$userData9 === void 0 ? void 0 : _threeObject$userData9.isPipeSegment) && ((_threeObject$userData0 = threeObject.userData) === null || _threeObject$userData0 === void 0 ? void 0 : _threeObject$userData0.isDeclared) === true;
|
|
108
113
|
|
|
109
114
|
// Only export objects with objectType (components, connectors, gateways) OR manual segments
|
|
110
|
-
if (!((_threeObject$
|
|
115
|
+
if (!((_threeObject$userData1 = threeObject.userData) !== null && _threeObject$userData1 !== void 0 && _threeObject$userData1.objectType) && !isManualSegment) {
|
|
111
116
|
return null;
|
|
112
117
|
}
|
|
113
118
|
|
|
@@ -199,7 +204,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
199
204
|
};
|
|
200
205
|
|
|
201
206
|
// Skip rotation for gateways (they're just routing points)
|
|
202
|
-
var isGateway = ((_threeObject$
|
|
207
|
+
var isGateway = ((_threeObject$userData10 = threeObject.userData) === null || _threeObject$userData10 === void 0 ? void 0 : _threeObject$userData10.objectType) === 'gateway';
|
|
203
208
|
if (!isGateway) {
|
|
204
209
|
jsonObject.rotation = {
|
|
205
210
|
x: roundIfClose(threeObject.rotation.x * (180 / Math.PI)),
|
|
@@ -345,11 +345,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
345
345
|
// If a gateway appears in the JSON, it's manual by definition
|
|
346
346
|
mesh.userData.isDeclared = true;
|
|
347
347
|
}
|
|
348
|
-
|
|
349
|
-
// For gateways, also set origin flag for backward compatibility
|
|
350
|
-
if (mesh.userData.objectType === 'gateway') {
|
|
351
|
-
mesh.userData.origin = 'declared'; // Explicit origin marker for manual gateways
|
|
352
|
-
}
|
|
353
348
|
if (mesh.isMesh) {
|
|
354
349
|
mesh.castShadow = true;
|
|
355
350
|
mesh.receiveShadow = true;
|
|
@@ -655,11 +650,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
655
650
|
jsonObject.userData.position = [worldPos.x, worldPos.y, worldPos.z];
|
|
656
651
|
console.log("\u2705 Set userData.position for ".concat(jsonObject.userData.objectType, " ").concat(jsonObject.uuid, ": [").concat(worldPos.x.toFixed(2), ", ").concat(worldPos.y.toFixed(2), ", ").concat(worldPos.z.toFixed(2), "]"));
|
|
657
652
|
|
|
658
|
-
// For gateways, ensure
|
|
653
|
+
// For gateways, ensure isDeclared flag is in scene data
|
|
659
654
|
if (jsonObject.userData.objectType === 'gateway') {
|
|
660
|
-
if (!jsonObject.userData.origin) {
|
|
661
|
-
jsonObject.userData.origin = 'declared'; // Mark as declared gateway
|
|
662
|
-
}
|
|
663
655
|
if (jsonObject.userData.isDeclared === undefined) {
|
|
664
656
|
jsonObject.userData.isDeclared = true;
|
|
665
657
|
}
|
|
@@ -760,6 +752,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
760
752
|
_context5.n = 1;
|
|
761
753
|
return this.clearSceneObjects();
|
|
762
754
|
case 1:
|
|
755
|
+
// Mark all imported objects as declared in the scene data
|
|
756
|
+
// This ensures manual segment connectors and other objects are recognized as declared
|
|
757
|
+
// when flattenSceneStructure() processes them for pathfinding
|
|
758
|
+
this._markImportedObjectsAsDeclared(data);
|
|
763
759
|
component.currentSceneData = data;
|
|
764
760
|
case 2:
|
|
765
761
|
return _context5.a(2);
|
|
@@ -771,19 +767,55 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
771
767
|
}
|
|
772
768
|
return _prepareSceneForLoading;
|
|
773
769
|
}()
|
|
770
|
+
/**
|
|
771
|
+
* Recursively mark all objects in imported scene data as declared
|
|
772
|
+
* This ensures that manual segments and their connectors are properly recognized
|
|
773
|
+
* @param {Object} data - Scene data object
|
|
774
|
+
*/
|
|
775
|
+
)
|
|
776
|
+
}, {
|
|
777
|
+
key: "_markImportedObjectsAsDeclared",
|
|
778
|
+
value: function _markImportedObjectsAsDeclared(data) {
|
|
779
|
+
var _data$scene;
|
|
780
|
+
if (!(data !== null && data !== void 0 && (_data$scene = data.scene) !== null && _data$scene !== void 0 && _data$scene.children)) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
var _markChildren = function markChildren(children) {
|
|
784
|
+
if (!Array.isArray(children)) {
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
children.forEach(function (child) {
|
|
788
|
+
if (!child.userData) {
|
|
789
|
+
child.userData = {};
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// Set isDeclared to true for all imported objects
|
|
793
|
+
if (child.userData.isDeclared === undefined) {
|
|
794
|
+
child.userData.isDeclared = true;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// Recursively process children (e.g., manual segment connectors)
|
|
798
|
+
if (child.children && Array.isArray(child.children)) {
|
|
799
|
+
_markChildren(child.children);
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
};
|
|
803
|
+
_markChildren(data.scene.children);
|
|
804
|
+
console.log('✅ Marked all imported objects as declared in scene data');
|
|
805
|
+
}
|
|
806
|
+
|
|
774
807
|
/**
|
|
775
808
|
* Inject connector children from component dictionary into scene data components
|
|
776
809
|
* This allows scene files to omit connector children since they're defined in the dictionary
|
|
777
810
|
* @param {Object} data - Scene data to modify
|
|
778
811
|
* @param {Object} componentDictionary - Component dictionary with connector definitions
|
|
779
812
|
*/
|
|
780
|
-
)
|
|
781
813
|
}, {
|
|
782
814
|
key: "_injectConnectorChildrenFromDictionary",
|
|
783
815
|
value: function _injectConnectorChildrenFromDictionary(data, componentDictionary) {
|
|
784
|
-
var _data$
|
|
816
|
+
var _data$scene2,
|
|
785
817
|
_this3 = this;
|
|
786
|
-
if (!(data !== null && data !== void 0 && (_data$
|
|
818
|
+
if (!(data !== null && data !== void 0 && (_data$scene2 = data.scene) !== null && _data$scene2 !== void 0 && _data$scene2.children) || !componentDictionary) {
|
|
787
819
|
return;
|
|
788
820
|
}
|
|
789
821
|
var componentsProcessed = 0;
|
|
@@ -1083,7 +1115,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1083
1115
|
key: "loadSceneFromData",
|
|
1084
1116
|
value: (function () {
|
|
1085
1117
|
var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(data) {
|
|
1086
|
-
var _data$
|
|
1118
|
+
var _data$scene3, _data$scene4, _data$scene5, _data$scene6;
|
|
1087
1119
|
return _regenerator().w(function (_context9) {
|
|
1088
1120
|
while (1) switch (_context9.n) {
|
|
1089
1121
|
case 0:
|
|
@@ -1093,10 +1125,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
1093
1125
|
dataType: _typeof(data),
|
|
1094
1126
|
hasScene: !!(data !== null && data !== void 0 && data.scene),
|
|
1095
1127
|
sceneType: _typeof(data === null || data === void 0 ? void 0 : data.scene),
|
|
1096
|
-
hasChildren: !!(data !== null && data !== void 0 && (_data$
|
|
1097
|
-
childrenType: data !== null && data !== void 0 && (_data$
|
|
1098
|
-
isArray: Array.isArray(data === null || data === void 0 || (_data$
|
|
1099
|
-
childrenLength: data === null || data === void 0 || (_data$
|
|
1128
|
+
hasChildren: !!(data !== null && data !== void 0 && (_data$scene3 = data.scene) !== null && _data$scene3 !== void 0 && _data$scene3.children),
|
|
1129
|
+
childrenType: data !== null && data !== void 0 && (_data$scene4 = data.scene) !== null && _data$scene4 !== void 0 && _data$scene4.children ? _typeof(data.scene.children) : 'undefined',
|
|
1130
|
+
isArray: Array.isArray(data === null || data === void 0 || (_data$scene5 = data.scene) === null || _data$scene5 === void 0 ? void 0 : _data$scene5.children),
|
|
1131
|
+
childrenLength: data === null || data === void 0 || (_data$scene6 = data.scene) === null || _data$scene6 === void 0 || (_data$scene6 = _data$scene6.children) === null || _data$scene6 === void 0 ? void 0 : _data$scene6.length,
|
|
1100
1132
|
dataKeys: data ? Object.keys(data) : [],
|
|
1101
1133
|
sceneKeys: data !== null && data !== void 0 && data.scene ? Object.keys(data.scene) : []
|
|
1102
1134
|
});
|
|
@@ -69,7 +69,7 @@ function isConnector(obj) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* Check if object
|
|
72
|
+
* Check if object is declared (manually placed/positioned)
|
|
73
73
|
* Declared objects should be preserved during regeneration.
|
|
74
74
|
*
|
|
75
75
|
* @param {Object} obj - Three.js object to check
|
|
@@ -82,7 +82,7 @@ function isConnector(obj) {
|
|
|
82
82
|
*/
|
|
83
83
|
function isDeclared(obj) {
|
|
84
84
|
if (!obj || !obj.userData) return false;
|
|
85
|
-
return obj.userData.isDeclared === true
|
|
85
|
+
return obj.userData.isDeclared === true;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
@@ -194,7 +194,6 @@ function getObjectTypeName(obj) {
|
|
|
194
194
|
function markAsDeclared(obj) {
|
|
195
195
|
if (obj && obj.userData) {
|
|
196
196
|
obj.userData.isDeclared = true;
|
|
197
|
-
obj.userData.origin = 'declared'; // Backward compatibility
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
199
|
|
|
@@ -211,7 +210,6 @@ function markAsDeclared(obj) {
|
|
|
211
210
|
function markAsComputed(obj) {
|
|
212
211
|
if (obj && obj.userData) {
|
|
213
212
|
obj.userData.isDeclared = false;
|
|
214
|
-
obj.userData.origin = 'computed'; // Backward compatibility
|
|
215
213
|
}
|
|
216
214
|
}
|
|
217
215
|
|