@2112-lab/central-plant 0.3.2 → 0.3.4
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 +31 -69
- package/dist/cjs/src/core/centralPlant.js +1 -1
- package/dist/cjs/src/managers/scene/modelManager.js +5 -0
- package/dist/cjs/src/managers/scene/sceneExportManager.js +25 -68
- package/dist/esm/src/core/centralPlant.js +1 -1
- package/dist/esm/src/managers/scene/modelManager.js +5 -0
- package/dist/esm/src/managers/scene/sceneExportManager.js +25 -68
- package/package.json +1 -1
package/dist/bundle/index.js
CHANGED
|
@@ -11477,40 +11477,17 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
11477
11477
|
};
|
|
11478
11478
|
}
|
|
11479
11479
|
|
|
11480
|
-
// For components:
|
|
11481
|
-
//
|
|
11482
|
-
//
|
|
11480
|
+
// For components: no children exported — connector positions are defined in the component
|
|
11481
|
+
// dictionary GLB and will be re-injected at import time via _injectConnectorChildrenFromDictionary.
|
|
11482
|
+
// Exporting them here would prevent that injection (it skips if children already exist)
|
|
11483
|
+
// and would leave the pathfinder with connectors in incompatible local-position format.
|
|
11483
11484
|
if (threeObject.children && threeObject.children.length > 0) {
|
|
11484
11485
|
var exportableChildren = [];
|
|
11485
|
-
if (
|
|
11486
|
-
// Export connector children (skip mesh geometry - it lives in the component dictionary GLB)
|
|
11487
|
-
threeObject.children.forEach(function (child) {
|
|
11488
|
-
var _child$userData;
|
|
11489
|
-
if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'connector') {
|
|
11490
|
-
var connectorJson = {
|
|
11491
|
-
// Use the raw Three.js UUID — connections in currentSceneData reference this exact value
|
|
11492
|
-
uuid: child.uuid,
|
|
11493
|
-
userData: _objectSpread2(_objectSpread2({
|
|
11494
|
-
objectType: 'connector'
|
|
11495
|
-
}, child.userData.direction ? {
|
|
11496
|
-
direction: child.userData.direction
|
|
11497
|
-
} : {}), child.userData.group ? {
|
|
11498
|
-
group: child.userData.group
|
|
11499
|
-
} : {}),
|
|
11500
|
-
position: {
|
|
11501
|
-
x: roundIfClose(child.position.x),
|
|
11502
|
-
y: roundIfClose(child.position.y),
|
|
11503
|
-
z: roundIfClose(child.position.z)
|
|
11504
|
-
}
|
|
11505
|
-
};
|
|
11506
|
-
exportableChildren.push(connectorJson);
|
|
11507
|
-
}
|
|
11508
|
-
});
|
|
11509
|
-
} else if (isManualSegment) {
|
|
11486
|
+
if (isManualSegment) {
|
|
11510
11487
|
// For manual segments, export their connector children
|
|
11511
11488
|
threeObject.children.forEach(function (child) {
|
|
11512
|
-
var _child$
|
|
11513
|
-
if (((_child$
|
|
11489
|
+
var _child$userData;
|
|
11490
|
+
if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'segment-connector') {
|
|
11514
11491
|
// Call the class method using bound reference
|
|
11515
11492
|
var connectorJson = convertSegmentConnectorToJson(child, threeObject);
|
|
11516
11493
|
if (connectorJson) {
|
|
@@ -11529,38 +11506,18 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
11529
11506
|
// Bind the convertSegmentConnectorToJson method for use in nested function
|
|
11530
11507
|
var convertSegmentConnectorToJson = this.convertSegmentConnectorToJson.bind(this);
|
|
11531
11508
|
|
|
11532
|
-
// Extract main scene objects (components and standalone connectors
|
|
11509
|
+
// Extract main scene objects (components and standalone connectors)
|
|
11533
11510
|
var sceneChildren = [];
|
|
11534
|
-
|
|
11535
|
-
// Helper to recursively find manual segments within polylines
|
|
11536
|
-
var findManualSegments = function findManualSegments(object) {
|
|
11537
|
-
var manualSegments = [];
|
|
11538
|
-
object.traverse(function (child) {
|
|
11539
|
-
var _child$userData3;
|
|
11540
|
-
// Check if this is a manual segment
|
|
11541
|
-
if (((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.objectType) === 'segment') {
|
|
11542
|
-
manualSegments.push(child);
|
|
11543
|
-
}
|
|
11544
|
-
});
|
|
11545
|
-
return manualSegments;
|
|
11546
|
-
};
|
|
11547
11511
|
this.sceneViewer.scene.children.forEach(function (child) {
|
|
11548
|
-
var _child$
|
|
11549
|
-
//
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
});
|
|
11558
|
-
} else {
|
|
11559
|
-
// Regular scene object export
|
|
11560
|
-
var jsonChild = convertObjectToJson(child);
|
|
11561
|
-
if (jsonChild) {
|
|
11562
|
-
sceneChildren.push(jsonChild);
|
|
11563
|
-
}
|
|
11512
|
+
var _child$userData2;
|
|
11513
|
+
// Only export components and connectors; skip segments, gateways, polylines, etc.
|
|
11514
|
+
var objectType = (_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.objectType;
|
|
11515
|
+
if (objectType !== 'component' && objectType !== 'connector') {
|
|
11516
|
+
return;
|
|
11517
|
+
}
|
|
11518
|
+
var jsonChild = convertObjectToJson(child);
|
|
11519
|
+
if (jsonChild) {
|
|
11520
|
+
sceneChildren.push(jsonChild);
|
|
11564
11521
|
}
|
|
11565
11522
|
});
|
|
11566
11523
|
|
|
@@ -11738,14 +11695,14 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
11738
11695
|
BufferGeometryUtils$1 = BufferGeometryUtilsModule.BufferGeometryUtils || BufferGeometryUtilsModule.default || BufferGeometryUtilsModule; // Create a new scene for export instead of cloning
|
|
11739
11696
|
exportScene = new _THREE.Scene(); // Helper function to check if an object should be exported
|
|
11740
11697
|
shouldExport = function shouldExport(child) {
|
|
11741
|
-
var _child$
|
|
11742
|
-
if ((_child$
|
|
11698
|
+
var _child$name, _child$userData3, _child$userData4, _child$userData5, _child$userData6;
|
|
11699
|
+
if ((_child$name = child.name) !== null && _child$name !== void 0 && _child$name.includes('Polyline')) return false; // Will handle separately
|
|
11743
11700
|
if (child.name === 'fogPlane') return false; // Skip fog plane
|
|
11744
|
-
if ((_child$
|
|
11745
|
-
if ((_child$
|
|
11746
|
-
if ((_child$
|
|
11701
|
+
if ((_child$userData3 = child.userData) !== null && _child$userData3 !== void 0 && _child$userData3.isBrickWall) return false; // Skip environment
|
|
11702
|
+
if ((_child$userData4 = child.userData) !== null && _child$userData4 !== void 0 && _child$userData4.isBaseGround) return false; // Skip environment
|
|
11703
|
+
if ((_child$userData5 = child.userData) !== null && _child$userData5 !== void 0 && _child$userData5.isBaseGrid) return false; // Skip environment
|
|
11747
11704
|
if (child.isLight) return false; // Skip lights
|
|
11748
|
-
if ((_child$
|
|
11705
|
+
if ((_child$userData6 = child.userData) !== null && _child$userData6 !== void 0 && _child$userData6.isTransformControls) return false; // Skip transform controls
|
|
11749
11706
|
if (child.isTransformControls) return false; // Skip transform controls
|
|
11750
11707
|
if (child.type && child.type.includes('TransformControls')) return false;
|
|
11751
11708
|
if (child.type && child.type.includes('Helper')) return false; // Skip helpers
|
|
@@ -11754,8 +11711,8 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
11754
11711
|
pipeGeometries = [];
|
|
11755
11712
|
pipeMaterial = null;
|
|
11756
11713
|
this.sceneViewer.scene.children.forEach(function (child) {
|
|
11757
|
-
var _child$
|
|
11758
|
-
if ((_child$
|
|
11714
|
+
var _child$name2;
|
|
11715
|
+
if ((_child$name2 = child.name) !== null && _child$name2 !== void 0 && _child$name2.includes('Polyline')) {
|
|
11759
11716
|
// Traverse the polyline to collect all mesh geometries
|
|
11760
11717
|
child.traverse(function (obj) {
|
|
11761
11718
|
if (obj.isMesh && obj.geometry) {
|
|
@@ -29587,6 +29544,11 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
29587
29544
|
if (!libraryModel.userData) libraryModel.userData = {};
|
|
29588
29545
|
Object.assign(libraryModel.userData, jsonEntry.userData);
|
|
29589
29546
|
|
|
29547
|
+
// Preserve the original hardcoded UUID so getHardcodedUuid() can find it during export.
|
|
29548
|
+
// jsonEntry is the raw JSON object (no originalUuid), so we must set it explicitly from
|
|
29549
|
+
// originalProps.uuid (which equals the uuid string from the scene JSON, e.g. "PUMP-1").
|
|
29550
|
+
libraryModel.userData.originalUuid = originalProps.uuid;
|
|
29551
|
+
|
|
29590
29552
|
// Apply bounding box configurations
|
|
29591
29553
|
if (componentData.boundingBox) {
|
|
29592
29554
|
libraryModel.userData.boundingBox = componentData.boundingBox;
|
|
@@ -37840,7 +37802,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
37840
37802
|
* Initialize the CentralPlant manager
|
|
37841
37803
|
*
|
|
37842
37804
|
* @constructor
|
|
37843
|
-
* @version 0.3.
|
|
37805
|
+
* @version 0.3.4
|
|
37844
37806
|
* @updated 2025-10-22
|
|
37845
37807
|
*
|
|
37846
37808
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -35,7 +35,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
35
35
|
* Initialize the CentralPlant manager
|
|
36
36
|
*
|
|
37
37
|
* @constructor
|
|
38
|
-
* @version 0.3.
|
|
38
|
+
* @version 0.3.4
|
|
39
39
|
* @updated 2025-10-22
|
|
40
40
|
*
|
|
41
41
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -310,6 +310,11 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
310
310
|
if (!libraryModel.userData) libraryModel.userData = {};
|
|
311
311
|
Object.assign(libraryModel.userData, jsonEntry.userData);
|
|
312
312
|
|
|
313
|
+
// Preserve the original hardcoded UUID so getHardcodedUuid() can find it during export.
|
|
314
|
+
// jsonEntry is the raw JSON object (no originalUuid), so we must set it explicitly from
|
|
315
|
+
// originalProps.uuid (which equals the uuid string from the scene JSON, e.g. "PUMP-1").
|
|
316
|
+
libraryModel.userData.originalUuid = originalProps.uuid;
|
|
317
|
+
|
|
313
318
|
// Apply bounding box configurations
|
|
314
319
|
if (componentData.boundingBox) {
|
|
315
320
|
libraryModel.userData.boundingBox = componentData.boundingBox;
|
|
@@ -237,40 +237,17 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
// For components:
|
|
241
|
-
//
|
|
242
|
-
//
|
|
240
|
+
// For components: no children exported — connector positions are defined in the component
|
|
241
|
+
// dictionary GLB and will be re-injected at import time via _injectConnectorChildrenFromDictionary.
|
|
242
|
+
// Exporting them here would prevent that injection (it skips if children already exist)
|
|
243
|
+
// and would leave the pathfinder with connectors in incompatible local-position format.
|
|
243
244
|
if (threeObject.children && threeObject.children.length > 0) {
|
|
244
245
|
var exportableChildren = [];
|
|
245
|
-
if (
|
|
246
|
-
// Export connector children (skip mesh geometry - it lives in the component dictionary GLB)
|
|
247
|
-
threeObject.children.forEach(function (child) {
|
|
248
|
-
var _child$userData;
|
|
249
|
-
if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'connector') {
|
|
250
|
-
var connectorJson = {
|
|
251
|
-
// Use the raw Three.js UUID — connections in currentSceneData reference this exact value
|
|
252
|
-
uuid: child.uuid,
|
|
253
|
-
userData: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
|
|
254
|
-
objectType: 'connector'
|
|
255
|
-
}, child.userData.direction ? {
|
|
256
|
-
direction: child.userData.direction
|
|
257
|
-
} : {}), child.userData.group ? {
|
|
258
|
-
group: child.userData.group
|
|
259
|
-
} : {}),
|
|
260
|
-
position: {
|
|
261
|
-
x: roundIfClose(child.position.x),
|
|
262
|
-
y: roundIfClose(child.position.y),
|
|
263
|
-
z: roundIfClose(child.position.z)
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
exportableChildren.push(connectorJson);
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
} else if (isManualSegment) {
|
|
246
|
+
if (isManualSegment) {
|
|
270
247
|
// For manual segments, export their connector children
|
|
271
248
|
threeObject.children.forEach(function (child) {
|
|
272
|
-
var _child$
|
|
273
|
-
if (((_child$
|
|
249
|
+
var _child$userData;
|
|
250
|
+
if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'segment-connector') {
|
|
274
251
|
// Call the class method using bound reference
|
|
275
252
|
var connectorJson = convertSegmentConnectorToJson(child, threeObject);
|
|
276
253
|
if (connectorJson) {
|
|
@@ -289,38 +266,18 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
289
266
|
// Bind the convertSegmentConnectorToJson method for use in nested function
|
|
290
267
|
var convertSegmentConnectorToJson = this.convertSegmentConnectorToJson.bind(this);
|
|
291
268
|
|
|
292
|
-
// Extract main scene objects (components and standalone connectors
|
|
269
|
+
// Extract main scene objects (components and standalone connectors)
|
|
293
270
|
var sceneChildren = [];
|
|
294
|
-
|
|
295
|
-
// Helper to recursively find manual segments within polylines
|
|
296
|
-
var findManualSegments = function findManualSegments(object) {
|
|
297
|
-
var manualSegments = [];
|
|
298
|
-
object.traverse(function (child) {
|
|
299
|
-
var _child$userData3;
|
|
300
|
-
// Check if this is a manual segment
|
|
301
|
-
if (((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.objectType) === 'segment') {
|
|
302
|
-
manualSegments.push(child);
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
return manualSegments;
|
|
306
|
-
};
|
|
307
271
|
this.sceneViewer.scene.children.forEach(function (child) {
|
|
308
|
-
var _child$
|
|
309
|
-
//
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
});
|
|
318
|
-
} else {
|
|
319
|
-
// Regular scene object export
|
|
320
|
-
var jsonChild = convertObjectToJson(child);
|
|
321
|
-
if (jsonChild) {
|
|
322
|
-
sceneChildren.push(jsonChild);
|
|
323
|
-
}
|
|
272
|
+
var _child$userData2;
|
|
273
|
+
// Only export components and connectors; skip segments, gateways, polylines, etc.
|
|
274
|
+
var objectType = (_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.objectType;
|
|
275
|
+
if (objectType !== 'component' && objectType !== 'connector') {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
var jsonChild = convertObjectToJson(child);
|
|
279
|
+
if (jsonChild) {
|
|
280
|
+
sceneChildren.push(jsonChild);
|
|
324
281
|
}
|
|
325
282
|
});
|
|
326
283
|
|
|
@@ -498,14 +455,14 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
498
455
|
BufferGeometryUtils = BufferGeometryUtilsModule.BufferGeometryUtils || BufferGeometryUtilsModule.default || BufferGeometryUtilsModule; // Create a new scene for export instead of cloning
|
|
499
456
|
exportScene = new _THREE.Scene(); // Helper function to check if an object should be exported
|
|
500
457
|
shouldExport = function shouldExport(child) {
|
|
501
|
-
var _child$
|
|
502
|
-
if ((_child$
|
|
458
|
+
var _child$name, _child$userData3, _child$userData4, _child$userData5, _child$userData6;
|
|
459
|
+
if ((_child$name = child.name) !== null && _child$name !== void 0 && _child$name.includes('Polyline')) return false; // Will handle separately
|
|
503
460
|
if (child.name === 'fogPlane') return false; // Skip fog plane
|
|
504
|
-
if ((_child$
|
|
505
|
-
if ((_child$
|
|
506
|
-
if ((_child$
|
|
461
|
+
if ((_child$userData3 = child.userData) !== null && _child$userData3 !== void 0 && _child$userData3.isBrickWall) return false; // Skip environment
|
|
462
|
+
if ((_child$userData4 = child.userData) !== null && _child$userData4 !== void 0 && _child$userData4.isBaseGround) return false; // Skip environment
|
|
463
|
+
if ((_child$userData5 = child.userData) !== null && _child$userData5 !== void 0 && _child$userData5.isBaseGrid) return false; // Skip environment
|
|
507
464
|
if (child.isLight) return false; // Skip lights
|
|
508
|
-
if ((_child$
|
|
465
|
+
if ((_child$userData6 = child.userData) !== null && _child$userData6 !== void 0 && _child$userData6.isTransformControls) return false; // Skip transform controls
|
|
509
466
|
if (child.isTransformControls) return false; // Skip transform controls
|
|
510
467
|
if (child.type && child.type.includes('TransformControls')) return false;
|
|
511
468
|
if (child.type && child.type.includes('Helper')) return false; // Skip helpers
|
|
@@ -514,8 +471,8 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
514
471
|
pipeGeometries = [];
|
|
515
472
|
pipeMaterial = null;
|
|
516
473
|
this.sceneViewer.scene.children.forEach(function (child) {
|
|
517
|
-
var _child$
|
|
518
|
-
if ((_child$
|
|
474
|
+
var _child$name2;
|
|
475
|
+
if ((_child$name2 = child.name) !== null && _child$name2 !== void 0 && _child$name2.includes('Polyline')) {
|
|
519
476
|
// Traverse the polyline to collect all mesh geometries
|
|
520
477
|
child.traverse(function (obj) {
|
|
521
478
|
if (obj.isMesh && obj.geometry) {
|
|
@@ -31,7 +31,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
31
31
|
* Initialize the CentralPlant manager
|
|
32
32
|
*
|
|
33
33
|
* @constructor
|
|
34
|
-
* @version 0.3.
|
|
34
|
+
* @version 0.3.4
|
|
35
35
|
* @updated 2025-10-22
|
|
36
36
|
*
|
|
37
37
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -286,6 +286,11 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
286
286
|
if (!libraryModel.userData) libraryModel.userData = {};
|
|
287
287
|
Object.assign(libraryModel.userData, jsonEntry.userData);
|
|
288
288
|
|
|
289
|
+
// Preserve the original hardcoded UUID so getHardcodedUuid() can find it during export.
|
|
290
|
+
// jsonEntry is the raw JSON object (no originalUuid), so we must set it explicitly from
|
|
291
|
+
// originalProps.uuid (which equals the uuid string from the scene JSON, e.g. "PUMP-1").
|
|
292
|
+
libraryModel.userData.originalUuid = originalProps.uuid;
|
|
293
|
+
|
|
289
294
|
// Apply bounding box configurations
|
|
290
295
|
if (componentData.boundingBox) {
|
|
291
296
|
libraryModel.userData.boundingBox = componentData.boundingBox;
|
|
@@ -215,40 +215,17 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
// For components:
|
|
219
|
-
//
|
|
220
|
-
//
|
|
218
|
+
// For components: no children exported — connector positions are defined in the component
|
|
219
|
+
// dictionary GLB and will be re-injected at import time via _injectConnectorChildrenFromDictionary.
|
|
220
|
+
// Exporting them here would prevent that injection (it skips if children already exist)
|
|
221
|
+
// and would leave the pathfinder with connectors in incompatible local-position format.
|
|
221
222
|
if (threeObject.children && threeObject.children.length > 0) {
|
|
222
223
|
var exportableChildren = [];
|
|
223
|
-
if (
|
|
224
|
-
// Export connector children (skip mesh geometry - it lives in the component dictionary GLB)
|
|
225
|
-
threeObject.children.forEach(function (child) {
|
|
226
|
-
var _child$userData;
|
|
227
|
-
if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'connector') {
|
|
228
|
-
var connectorJson = {
|
|
229
|
-
// Use the raw Three.js UUID — connections in currentSceneData reference this exact value
|
|
230
|
-
uuid: child.uuid,
|
|
231
|
-
userData: _objectSpread2(_objectSpread2({
|
|
232
|
-
objectType: 'connector'
|
|
233
|
-
}, child.userData.direction ? {
|
|
234
|
-
direction: child.userData.direction
|
|
235
|
-
} : {}), child.userData.group ? {
|
|
236
|
-
group: child.userData.group
|
|
237
|
-
} : {}),
|
|
238
|
-
position: {
|
|
239
|
-
x: roundIfClose(child.position.x),
|
|
240
|
-
y: roundIfClose(child.position.y),
|
|
241
|
-
z: roundIfClose(child.position.z)
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
exportableChildren.push(connectorJson);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
} else if (isManualSegment) {
|
|
224
|
+
if (isManualSegment) {
|
|
248
225
|
// For manual segments, export their connector children
|
|
249
226
|
threeObject.children.forEach(function (child) {
|
|
250
|
-
var _child$
|
|
251
|
-
if (((_child$
|
|
227
|
+
var _child$userData;
|
|
228
|
+
if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'segment-connector') {
|
|
252
229
|
// Call the class method using bound reference
|
|
253
230
|
var connectorJson = convertSegmentConnectorToJson(child, threeObject);
|
|
254
231
|
if (connectorJson) {
|
|
@@ -267,38 +244,18 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
267
244
|
// Bind the convertSegmentConnectorToJson method for use in nested function
|
|
268
245
|
var convertSegmentConnectorToJson = this.convertSegmentConnectorToJson.bind(this);
|
|
269
246
|
|
|
270
|
-
// Extract main scene objects (components and standalone connectors
|
|
247
|
+
// Extract main scene objects (components and standalone connectors)
|
|
271
248
|
var sceneChildren = [];
|
|
272
|
-
|
|
273
|
-
// Helper to recursively find manual segments within polylines
|
|
274
|
-
var findManualSegments = function findManualSegments(object) {
|
|
275
|
-
var manualSegments = [];
|
|
276
|
-
object.traverse(function (child) {
|
|
277
|
-
var _child$userData3;
|
|
278
|
-
// Check if this is a manual segment
|
|
279
|
-
if (((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.objectType) === 'segment') {
|
|
280
|
-
manualSegments.push(child);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
return manualSegments;
|
|
284
|
-
};
|
|
285
249
|
this.sceneViewer.scene.children.forEach(function (child) {
|
|
286
|
-
var _child$
|
|
287
|
-
//
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
});
|
|
296
|
-
} else {
|
|
297
|
-
// Regular scene object export
|
|
298
|
-
var jsonChild = convertObjectToJson(child);
|
|
299
|
-
if (jsonChild) {
|
|
300
|
-
sceneChildren.push(jsonChild);
|
|
301
|
-
}
|
|
250
|
+
var _child$userData2;
|
|
251
|
+
// Only export components and connectors; skip segments, gateways, polylines, etc.
|
|
252
|
+
var objectType = (_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.objectType;
|
|
253
|
+
if (objectType !== 'component' && objectType !== 'connector') {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
var jsonChild = convertObjectToJson(child);
|
|
257
|
+
if (jsonChild) {
|
|
258
|
+
sceneChildren.push(jsonChild);
|
|
302
259
|
}
|
|
303
260
|
});
|
|
304
261
|
|
|
@@ -476,14 +433,14 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
476
433
|
BufferGeometryUtils = BufferGeometryUtilsModule.BufferGeometryUtils || BufferGeometryUtilsModule.default || BufferGeometryUtilsModule; // Create a new scene for export instead of cloning
|
|
477
434
|
exportScene = new _THREE.Scene(); // Helper function to check if an object should be exported
|
|
478
435
|
shouldExport = function shouldExport(child) {
|
|
479
|
-
var _child$
|
|
480
|
-
if ((_child$
|
|
436
|
+
var _child$name, _child$userData3, _child$userData4, _child$userData5, _child$userData6;
|
|
437
|
+
if ((_child$name = child.name) !== null && _child$name !== void 0 && _child$name.includes('Polyline')) return false; // Will handle separately
|
|
481
438
|
if (child.name === 'fogPlane') return false; // Skip fog plane
|
|
482
|
-
if ((_child$
|
|
483
|
-
if ((_child$
|
|
484
|
-
if ((_child$
|
|
439
|
+
if ((_child$userData3 = child.userData) !== null && _child$userData3 !== void 0 && _child$userData3.isBrickWall) return false; // Skip environment
|
|
440
|
+
if ((_child$userData4 = child.userData) !== null && _child$userData4 !== void 0 && _child$userData4.isBaseGround) return false; // Skip environment
|
|
441
|
+
if ((_child$userData5 = child.userData) !== null && _child$userData5 !== void 0 && _child$userData5.isBaseGrid) return false; // Skip environment
|
|
485
442
|
if (child.isLight) return false; // Skip lights
|
|
486
|
-
if ((_child$
|
|
443
|
+
if ((_child$userData6 = child.userData) !== null && _child$userData6 !== void 0 && _child$userData6.isTransformControls) return false; // Skip transform controls
|
|
487
444
|
if (child.isTransformControls) return false; // Skip transform controls
|
|
488
445
|
if (child.type && child.type.includes('TransformControls')) return false;
|
|
489
446
|
if (child.type && child.type.includes('Helper')) return false; // Skip helpers
|
|
@@ -492,8 +449,8 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
492
449
|
pipeGeometries = [];
|
|
493
450
|
pipeMaterial = null;
|
|
494
451
|
this.sceneViewer.scene.children.forEach(function (child) {
|
|
495
|
-
var _child$
|
|
496
|
-
if ((_child$
|
|
452
|
+
var _child$name2;
|
|
453
|
+
if ((_child$name2 = child.name) !== null && _child$name2 !== void 0 && _child$name2.includes('Polyline')) {
|
|
497
454
|
// Traverse the polyline to collect all mesh geometries
|
|
498
455
|
child.traverse(function (obj) {
|
|
499
456
|
if (obj.isMesh && obj.geometry) {
|