@mlightcad/cad-html-core 1.8.0-preview.2 → 1.8.0-preview.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.
Files changed (44) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +23 -23
  3. package/dist/cad-html-core.js +2836 -2146
  4. package/dist/cad-html-core.umd.cjs +47 -47
  5. package/lib/AcExHtmlEmptyLayout.d.ts +14 -0
  6. package/lib/AcExHtmlEmptyLayout.d.ts.map +1 -0
  7. package/lib/AcExHtmlEmptyLayout.js +59 -0
  8. package/lib/AcExHtmlEmptyLayout.js.map +1 -0
  9. package/lib/AcExHtmlI18n.d.ts +18 -4
  10. package/lib/AcExHtmlI18n.d.ts.map +1 -1
  11. package/lib/AcExHtmlI18n.js +240 -199
  12. package/lib/AcExHtmlI18n.js.map +1 -1
  13. package/lib/AcExHtmlIconSvgs.d.ts +13 -13
  14. package/lib/AcExHtmlIconSvgs.d.ts.map +1 -1
  15. package/lib/AcExHtmlIconSvgs.js +33 -31
  16. package/lib/AcExHtmlIconSvgs.js.map +1 -1
  17. package/lib/AcExHtmlIcons.d.ts +5 -5
  18. package/lib/AcExHtmlOsnapPrimitiveBuilder.d.ts.map +1 -1
  19. package/lib/AcExHtmlOsnapPrimitiveBuilder.js +11 -11
  20. package/lib/AcExHtmlOsnapPrimitiveBuilder.js.map +1 -1
  21. package/lib/AcExHtmlSceneBatchCollector.d.ts +22 -3
  22. package/lib/AcExHtmlSceneBatchCollector.d.ts.map +1 -1
  23. package/lib/AcExHtmlSceneBatchCollector.js +497 -176
  24. package/lib/AcExHtmlSceneBatchCollector.js.map +1 -1
  25. package/lib/AcExHtmlShellFragments.d.ts.map +1 -1
  26. package/lib/AcExHtmlShellFragments.js +4 -0
  27. package/lib/AcExHtmlShellFragments.js.map +1 -1
  28. package/lib/AcExHtmlSnapshotFromSceneData.d.ts +19 -0
  29. package/lib/AcExHtmlSnapshotFromSceneData.d.ts.map +1 -1
  30. package/lib/AcExHtmlSnapshotFromSceneData.js +64 -41
  31. package/lib/AcExHtmlSnapshotFromSceneData.js.map +1 -1
  32. package/lib/i18n/ja.d.ts +256 -0
  33. package/lib/i18n/ja.d.ts.map +1 -0
  34. package/lib/i18n/ja.js +256 -0
  35. package/lib/i18n/ja.js.map +1 -0
  36. package/lib/i18n/ko.d.ts +256 -0
  37. package/lib/i18n/ko.d.ts.map +1 -0
  38. package/lib/i18n/ko.js +256 -0
  39. package/lib/i18n/ko.js.map +1 -0
  40. package/lib/index.d.ts +1 -0
  41. package/lib/index.d.ts.map +1 -1
  42. package/lib/index.js +1 -0
  43. package/lib/index.js.map +1 -1
  44. package/package.json +5 -5
@@ -31,6 +31,31 @@ var __values = (this && this.__values) || function(o) {
31
31
  };
32
32
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
33
33
  };
34
+ var __read = (this && this.__read) || function (o, n) {
35
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
36
+ if (!m) return o;
37
+ var i = m.call(o), r, ar = [], e;
38
+ try {
39
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
40
+ }
41
+ catch (error) { e = { error: error }; }
42
+ finally {
43
+ try {
44
+ if (r && !r.done && (m = i["return"])) m.call(i);
45
+ }
46
+ finally { if (e) throw e.error; }
47
+ }
48
+ return ar;
49
+ };
50
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
51
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
52
+ if (ar || !(i in from)) {
53
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
54
+ ar[i] = from[i];
55
+ }
56
+ }
57
+ return to.concat(ar || Array.prototype.slice.call(from));
58
+ };
34
59
  import { AcTrBatchedLine, AcTrBatchedLine2, AcTrBatchedMesh, AcTrBatchedPoint, getMaterialMetadata, getSceneDrawableUserData, isBatchGeometryActive, isBatchGeometryVisible, isHighlightCloneDrawable, isHighlightOverlayDescendant } from '@mlightcad/three-renderer';
35
60
  import * as THREE from 'three';
36
61
  import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial.js';
@@ -97,6 +122,45 @@ export function acexHtmlExportBufferGeometrySlice(geometry) {
97
122
  function shouldExportBatchedSlot(info) {
98
123
  return isBatchGeometryActive(info.flags) && isBatchGeometryVisible(info.flags);
99
124
  }
125
+ function resolveExportLayerForObjectId(objectId, options) {
126
+ var _a;
127
+ var geometryLayer = (_a = options === null || options === void 0 ? void 0 : options.geometryLayerName) !== null && _a !== void 0 ? _a : '';
128
+ if (!objectId || !(options === null || options === void 0 ? void 0 : options.insertLayerByObjectId) || !options.frozenLayers) {
129
+ return geometryLayer;
130
+ }
131
+ var insertLayer = options.insertLayerByObjectId.get(objectId);
132
+ if (insertLayer &&
133
+ insertLayer !== geometryLayer &&
134
+ options.frozenLayers.has(insertLayer)) {
135
+ return insertLayer;
136
+ }
137
+ return geometryLayer;
138
+ }
139
+ function groupSlotIdsByExportLayer(batch, options) {
140
+ var groups = new Map();
141
+ var count = batch.mappingStats.count;
142
+ for (var geometryId = 0; geometryId < count; geometryId++) {
143
+ var info = void 0;
144
+ try {
145
+ info = batch.getGeometryRangeAt(geometryId);
146
+ }
147
+ catch (_a) {
148
+ continue;
149
+ }
150
+ if (!shouldExportBatchedSlot(info)) {
151
+ continue;
152
+ }
153
+ var exportLayer = resolveExportLayerForObjectId(info.objectId, options);
154
+ var ids = groups.get(exportLayer);
155
+ if (ids) {
156
+ ids.push(geometryId);
157
+ }
158
+ else {
159
+ groups.set(exportLayer, [geometryId]);
160
+ }
161
+ }
162
+ return groups;
163
+ }
100
164
  /**
101
165
  * Text/point glyph batches are bucketed with `bboxIntersectionCheck` so their
102
166
  * stroke vertices are not used for CAD-style object snap.
@@ -125,10 +189,12 @@ function drawableExcludesFromOsnap(object) {
125
189
  /**
126
190
  * Exports only active geometry data from a batched line/mesh/point buffer,
127
191
  * skipping reserved padding and inactive (deleted) slots.
192
+ *
193
+ * @param slotIds - When set, only these geometry slot ids are exported.
128
194
  */
129
- export function acexHtmlExportActiveBatchedSlice(batch, geometry) {
130
- var e_1, _a, e_2, _b, e_3, _c;
131
- var _d, _e;
195
+ export function acexHtmlExportActiveBatchedSlice(batch, geometry, slotIds) {
196
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
197
+ var _f, _g;
132
198
  var positionAttr = geometry.getAttribute('position');
133
199
  if (!positionAttr) {
134
200
  return { positions: new Float32Array(0) };
@@ -136,27 +202,37 @@ export function acexHtmlExportActiveBatchedSlice(batch, geometry) {
136
202
  var itemSize = positionAttr.itemSize;
137
203
  var positionArray = positionAttr.array;
138
204
  var indexAttr = geometry.getIndex();
139
- var count = batch.mappingStats.count;
205
+ var slotList = slotIds !== null && slotIds !== void 0 ? slotIds : Array.from({ length: batch.mappingStats.count }, function (_, geometryId) { return geometryId; });
140
206
  if (indexAttr) {
141
207
  var positions_2 = acexHtmlCopyFloat32Range(positionArray, 0, positionAttr.count * itemSize);
142
208
  var indexArray = indexAttr.array;
143
209
  var totalIndices = 0;
144
210
  var ranges_4 = [];
145
- for (var geometryId = 0; geometryId < count; geometryId++) {
146
- var info = void 0;
147
- try {
148
- info = batch.getGeometryRangeAt(geometryId);
149
- }
150
- catch (_f) {
151
- continue;
211
+ try {
212
+ for (var slotList_1 = __values(slotList), slotList_1_1 = slotList_1.next(); !slotList_1_1.done; slotList_1_1 = slotList_1.next()) {
213
+ var geometryId = slotList_1_1.value;
214
+ var info = void 0;
215
+ try {
216
+ info = batch.getGeometryRangeAt(geometryId);
217
+ }
218
+ catch (_h) {
219
+ continue;
220
+ }
221
+ var indexStart = (_f = info.indexStart) !== null && _f !== void 0 ? _f : 0;
222
+ var indexCount = (_g = info.indexCount) !== null && _g !== void 0 ? _g : 0;
223
+ if (!shouldExportBatchedSlot(info) || indexCount <= 0) {
224
+ continue;
225
+ }
226
+ ranges_4.push({ start: indexStart, count: indexCount });
227
+ totalIndices += indexCount;
152
228
  }
153
- var indexStart = (_d = info.indexStart) !== null && _d !== void 0 ? _d : 0;
154
- var indexCount = (_e = info.indexCount) !== null && _e !== void 0 ? _e : 0;
155
- if (!shouldExportBatchedSlot(info) || indexCount <= 0) {
156
- continue;
229
+ }
230
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
231
+ finally {
232
+ try {
233
+ if (slotList_1_1 && !slotList_1_1.done && (_a = slotList_1.return)) _a.call(slotList_1);
157
234
  }
158
- ranges_4.push({ start: indexStart, count: indexCount });
159
- totalIndices += indexCount;
235
+ finally { if (e_1) throw e_1.error; }
160
236
  }
161
237
  if (totalIndices === 0) {
162
238
  return { positions: new Float32Array(0) };
@@ -171,34 +247,44 @@ export function acexHtmlExportActiveBatchedSlice(batch, geometry) {
171
247
  }
172
248
  }
173
249
  }
174
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
250
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
175
251
  finally {
176
252
  try {
177
- if (ranges_1_1 && !ranges_1_1.done && (_a = ranges_1.return)) _a.call(ranges_1);
253
+ if (ranges_1_1 && !ranges_1_1.done && (_b = ranges_1.return)) _b.call(ranges_1);
178
254
  }
179
- finally { if (e_1) throw e_1.error; }
255
+ finally { if (e_2) throw e_2.error; }
180
256
  }
181
257
  return acexHtmlCompactIndexedSlice(positions_2, activeIndices);
182
258
  }
183
259
  var totalFloats = 0;
184
260
  var ranges = [];
185
- for (var geometryId = 0; geometryId < count; geometryId++) {
186
- var info = void 0;
187
- try {
188
- info = batch.getGeometryRangeAt(geometryId);
189
- }
190
- catch (_g) {
191
- continue;
261
+ try {
262
+ for (var slotList_2 = __values(slotList), slotList_2_1 = slotList_2.next(); !slotList_2_1.done; slotList_2_1 = slotList_2.next()) {
263
+ var geometryId = slotList_2_1.value;
264
+ var info = void 0;
265
+ try {
266
+ info = batch.getGeometryRangeAt(geometryId);
267
+ }
268
+ catch (_j) {
269
+ continue;
270
+ }
271
+ if (!shouldExportBatchedSlot(info) || info.vertexCount <= 0) {
272
+ continue;
273
+ }
274
+ var floatCount = info.vertexCount * itemSize;
275
+ ranges.push({
276
+ start: info.vertexStart * itemSize,
277
+ floatCount: floatCount
278
+ });
279
+ totalFloats += floatCount;
192
280
  }
193
- if (!shouldExportBatchedSlot(info) || info.vertexCount <= 0) {
194
- continue;
281
+ }
282
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
283
+ finally {
284
+ try {
285
+ if (slotList_2_1 && !slotList_2_1.done && (_c = slotList_2.return)) _c.call(slotList_2);
195
286
  }
196
- var floatCount = info.vertexCount * itemSize;
197
- ranges.push({
198
- start: info.vertexStart * itemSize,
199
- floatCount: floatCount
200
- });
201
- totalFloats += floatCount;
287
+ finally { if (e_3) throw e_3.error; }
202
288
  }
203
289
  if (totalFloats === 0) {
204
290
  return { positions: new Float32Array(0) };
@@ -213,12 +299,12 @@ export function acexHtmlExportActiveBatchedSlice(batch, geometry) {
213
299
  offset += range.floatCount;
214
300
  }
215
301
  }
216
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
302
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
217
303
  finally {
218
304
  try {
219
- if (ranges_2_1 && !ranges_2_1.done && (_b = ranges_2.return)) _b.call(ranges_2);
305
+ if (ranges_2_1 && !ranges_2_1.done && (_d = ranges_2.return)) _d.call(ranges_2);
220
306
  }
221
- finally { if (e_2) throw e_2.error; }
307
+ finally { if (e_4) throw e_4.error; }
222
308
  }
223
309
  }
224
310
  else {
@@ -230,12 +316,12 @@ export function acexHtmlExportActiveBatchedSlice(batch, geometry) {
230
316
  }
231
317
  }
232
318
  }
233
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
319
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
234
320
  finally {
235
321
  try {
236
- if (ranges_3_1 && !ranges_3_1.done && (_c = ranges_3.return)) _c.call(ranges_3);
322
+ if (ranges_3_1 && !ranges_3_1.done && (_e = ranges_3.return)) _e.call(ranges_3);
237
323
  }
238
- finally { if (e_3) throw e_3.error; }
324
+ finally { if (e_5) throw e_5.error; }
239
325
  }
240
326
  }
241
327
  return { positions: positions };
@@ -247,31 +333,42 @@ function appendSegmentFromAttribute(target, attr, segmentIndex) {
247
333
  * Extracts active wide-line segment data from a batched `LineSegments2` buffer.
248
334
  * Each segment is exported as `[startX, startY, startZ, endX, endY, endZ]`.
249
335
  */
250
- export function acexHtmlExportActiveBatchedLine2Slice(batch, geometry) {
336
+ export function acexHtmlExportActiveBatchedLine2Slice(batch, geometry, slotIds) {
337
+ var e_6, _a;
251
338
  var startAttr = geometry.getAttribute('instanceStart');
252
339
  var endAttr = geometry.getAttribute('instanceEnd');
253
340
  if (!startAttr || !endAttr) {
254
341
  return { positions: new Float32Array(0) };
255
342
  }
256
- var count = batch.mappingStats.count;
343
+ var slotList = slotIds !== null && slotIds !== void 0 ? slotIds : Array.from({ length: batch.mappingStats.count }, function (_, geometryId) { return geometryId; });
257
344
  var activeFloats = [];
258
- for (var geometryId = 0; geometryId < count; geometryId++) {
259
- var info = void 0;
260
- try {
261
- info = batch.getGeometryRangeAt(geometryId);
262
- }
263
- catch (_a) {
264
- continue;
265
- }
266
- if (!shouldExportBatchedSlot(info) || info.vertexCount <= 0) {
267
- continue;
345
+ try {
346
+ for (var slotList_3 = __values(slotList), slotList_3_1 = slotList_3.next(); !slotList_3_1.done; slotList_3_1 = slotList_3.next()) {
347
+ var geometryId = slotList_3_1.value;
348
+ var info = void 0;
349
+ try {
350
+ info = batch.getGeometryRangeAt(geometryId);
351
+ }
352
+ catch (_b) {
353
+ continue;
354
+ }
355
+ if (!shouldExportBatchedSlot(info) || info.vertexCount <= 0) {
356
+ continue;
357
+ }
358
+ var segmentStart = info.vertexStart;
359
+ var segmentEnd = segmentStart + info.vertexCount;
360
+ for (var segment = segmentStart; segment < segmentEnd; segment++) {
361
+ appendSegmentFromAttribute(activeFloats, startAttr, segment);
362
+ appendSegmentFromAttribute(activeFloats, endAttr, segment);
363
+ }
268
364
  }
269
- var segmentStart = info.vertexStart;
270
- var segmentEnd = segmentStart + info.vertexCount;
271
- for (var segment = segmentStart; segment < segmentEnd; segment++) {
272
- appendSegmentFromAttribute(activeFloats, startAttr, segment);
273
- appendSegmentFromAttribute(activeFloats, endAttr, segment);
365
+ }
366
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
367
+ finally {
368
+ try {
369
+ if (slotList_3_1 && !slotList_3_1.done && (_a = slotList_3.return)) _a.call(slotList_3);
274
370
  }
371
+ finally { if (e_6) throw e_6.error; }
275
372
  }
276
373
  return { positions: new Float32Array(activeFloats) };
277
374
  }
@@ -468,53 +565,141 @@ function buildMeshBatch(geometry, material, object, slice, offset, triangleList)
468
565
  assignRenderOrder(batch, object, material);
469
566
  return batch;
470
567
  }
471
- function exportBatchedLine2(batch) {
472
- var slice = acexHtmlExportActiveBatchedLine2Slice(batch, batch.geometry);
473
- if (slice.positions.length === 0) {
474
- return undefined;
568
+ function exportBatchedLine2(batch, options) {
569
+ var e_7, _a;
570
+ var groups = groupSlotIdsByExportLayer(batch, options);
571
+ if (groups.size === 0) {
572
+ return [];
475
573
  }
476
- var _a = readMaterialStyle(batch.material), color = _a.color, layer = _a.layer;
574
+ var color = readMaterialStyle(batch.material).color;
477
575
  var lineWidth = readLineWidth(batch.material);
478
- var exported = __assign({ layer: layer, color: color, offset: readWorldOffset(batch), lineWidth: lineWidth }, slice);
479
- if (batchedLineExcludesFromOsnap(batch)) {
480
- exported.excludeFromOsnap = true;
576
+ var offset = readWorldOffset(batch);
577
+ var excludeFromOsnap = batchedLineExcludesFromOsnap(batch);
578
+ var material = batch.material;
579
+ var exported = [];
580
+ try {
581
+ for (var groups_1 = __values(groups), groups_1_1 = groups_1.next(); !groups_1_1.done; groups_1_1 = groups_1.next()) {
582
+ var _b = __read(groups_1_1.value, 2), layer = _b[0], slotIds = _b[1];
583
+ var slice = acexHtmlExportActiveBatchedLine2Slice(batch, batch.geometry, slotIds);
584
+ if (slice.positions.length === 0) {
585
+ continue;
586
+ }
587
+ var lineBatch = __assign({ layer: layer, color: color, offset: offset, lineWidth: lineWidth }, slice);
588
+ if (excludeFromOsnap) {
589
+ lineBatch.excludeFromOsnap = true;
590
+ }
591
+ assignRenderOrder(lineBatch, batch, material);
592
+ exported.push(lineBatch);
593
+ }
594
+ }
595
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
596
+ finally {
597
+ try {
598
+ if (groups_1_1 && !groups_1_1.done && (_a = groups_1.return)) _a.call(groups_1);
599
+ }
600
+ finally { if (e_7) throw e_7.error; }
481
601
  }
482
- assignRenderOrder(exported, batch, batch.material);
483
602
  return exported;
484
603
  }
485
- function exportBatchedLine(batch) {
486
- var slice = acexHtmlExportActiveBatchedSlice(batch, batch.geometry);
487
- if (slice.positions.length === 0) {
488
- return undefined;
604
+ function exportBatchedLine(batch, options) {
605
+ var e_8, _a;
606
+ var groups = groupSlotIdsByExportLayer(batch, options);
607
+ if (groups.size === 0) {
608
+ return [];
489
609
  }
490
- var _a = readMaterialStyle(batch.material), color = _a.color, layer = _a.layer, linePattern = _a.linePattern;
491
- var lineDistances = linePattern
492
- ? acexHtmlComputeLineDistancesForSegments(slice.positions)
493
- : undefined;
494
- var exported = __assign({ layer: layer, color: color, offset: readWorldOffset(batch), linePattern: linePattern, lineDistances: lineDistances }, slice);
495
- if (batchedLineExcludesFromOsnap(batch)) {
496
- exported.excludeFromOsnap = true;
610
+ var _b = readMaterialStyle(batch.material), color = _b.color, linePattern = _b.linePattern;
611
+ var offset = readWorldOffset(batch);
612
+ var excludeFromOsnap = batchedLineExcludesFromOsnap(batch);
613
+ var material = batch.material;
614
+ var exported = [];
615
+ try {
616
+ for (var groups_2 = __values(groups), groups_2_1 = groups_2.next(); !groups_2_1.done; groups_2_1 = groups_2.next()) {
617
+ var _c = __read(groups_2_1.value, 2), layer = _c[0], slotIds = _c[1];
618
+ var slice = acexHtmlExportActiveBatchedSlice(batch, batch.geometry, slotIds);
619
+ if (slice.positions.length === 0) {
620
+ continue;
621
+ }
622
+ var lineDistances = linePattern
623
+ ? acexHtmlComputeLineDistancesForSegments(slice.positions)
624
+ : undefined;
625
+ var lineBatch = __assign({ layer: layer, color: color, offset: offset, linePattern: linePattern, lineDistances: lineDistances }, slice);
626
+ if (excludeFromOsnap) {
627
+ lineBatch.excludeFromOsnap = true;
628
+ }
629
+ assignRenderOrder(lineBatch, batch, material);
630
+ exported.push(lineBatch);
631
+ }
632
+ }
633
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
634
+ finally {
635
+ try {
636
+ if (groups_2_1 && !groups_2_1.done && (_a = groups_2.return)) _a.call(groups_2);
637
+ }
638
+ finally { if (e_8) throw e_8.error; }
497
639
  }
498
- assignRenderOrder(exported, batch, batch.material);
499
640
  return exported;
500
641
  }
501
- function exportBatchedMesh(batch) {
502
- var slice = acexHtmlExportActiveBatchedSlice(batch, batch.geometry);
503
- if (slice.positions.length === 0) {
504
- return undefined;
642
+ function exportBatchedMesh(batch, options) {
643
+ var e_9, _a;
644
+ var groups = groupSlotIdsByExportLayer(batch, options);
645
+ if (groups.size === 0) {
646
+ return [];
647
+ }
648
+ var exported = [];
649
+ try {
650
+ for (var groups_3 = __values(groups), groups_3_1 = groups_3.next(); !groups_3_1.done; groups_3_1 = groups_3.next()) {
651
+ var _b = __read(groups_3_1.value, 2), layer = _b[0], slotIds = _b[1];
652
+ var slice = acexHtmlExportActiveBatchedSlice(batch, batch.geometry, slotIds);
653
+ if (slice.positions.length === 0) {
654
+ continue;
655
+ }
656
+ var mesh = buildMeshBatch(batch.geometry, batch.material, batch, slice, readWorldOffset(batch), true);
657
+ if (!mesh) {
658
+ continue;
659
+ }
660
+ mesh.layer = layer;
661
+ exported.push(mesh);
662
+ }
663
+ }
664
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
665
+ finally {
666
+ try {
667
+ if (groups_3_1 && !groups_3_1.done && (_a = groups_3.return)) _a.call(groups_3);
668
+ }
669
+ finally { if (e_9) throw e_9.error; }
505
670
  }
506
- return buildMeshBatch(batch.geometry, batch.material, batch, slice, readWorldOffset(batch), true);
671
+ return exported;
507
672
  }
508
- function exportBatchedPoint(batch) {
509
- var slice = acexHtmlExportActiveBatchedSlice(batch, batch.geometry);
510
- if (slice.positions.length === 0) {
511
- return undefined;
673
+ function exportBatchedPoint(batch, options) {
674
+ var e_10, _a;
675
+ var groups = groupSlotIdsByExportLayer(batch, options);
676
+ if (groups.size === 0) {
677
+ return [];
512
678
  }
513
- var mesh = buildMeshBatch(batch.geometry, batch.material, batch, slice, readWorldOffset(batch));
514
- if (!mesh) {
515
- return undefined;
679
+ var exported = [];
680
+ try {
681
+ for (var groups_4 = __values(groups), groups_4_1 = groups_4.next(); !groups_4_1.done; groups_4_1 = groups_4.next()) {
682
+ var _b = __read(groups_4_1.value, 2), layer = _b[0], slotIds = _b[1];
683
+ var slice = acexHtmlExportActiveBatchedSlice(batch, batch.geometry, slotIds);
684
+ if (slice.positions.length === 0) {
685
+ continue;
686
+ }
687
+ var mesh = buildMeshBatch(batch.geometry, batch.material, batch, slice, readWorldOffset(batch));
688
+ if (!mesh) {
689
+ continue;
690
+ }
691
+ mesh.layer = layer;
692
+ exported.push(__assign({ points: true }, mesh));
693
+ }
694
+ }
695
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
696
+ finally {
697
+ try {
698
+ if (groups_4_1 && !groups_4_1.done && (_a = groups_4.return)) _a.call(groups_4);
699
+ }
700
+ finally { if (e_10) throw e_10.error; }
516
701
  }
517
- return __assign({ points: true }, mesh);
702
+ return exported;
518
703
  }
519
704
  var _instanceMatrix = /*@__PURE__*/ new THREE.Matrix4();
520
705
  var _instanceWorld = /*@__PURE__*/ new THREE.Matrix4();
@@ -556,23 +741,78 @@ function isUsableInstanceMatrix(matrix) {
556
741
  return sx + sy + sz >= 1e-8;
557
742
  }
558
743
  /**
559
- * Bakes every visible INSERT of one shared template into a single world-space
560
- * slice, then rebases around the centroid.
744
+ * Resolves the INSERT object id for one GPU instance via the owning
745
+ * {@link AcTrSharedGeometryBatch} parent (`getObjectIdAt`).
746
+ */
747
+ function resolveSharedInstanceObjectId(object, instanceIndex) {
748
+ var current = object;
749
+ while (current) {
750
+ var getObjectIdAt = current.getObjectIdAt;
751
+ if (typeof getObjectIdAt === 'function') {
752
+ return getObjectIdAt.call(current, instanceIndex);
753
+ }
754
+ current = current.parent;
755
+ }
756
+ return undefined;
757
+ }
758
+ /**
759
+ * Groups visible shared-geometry instance indices by export layer, reparenting
760
+ * frozen-INSERT instances onto the INSERT layer when needed.
761
+ */
762
+ function groupVisibleInstancesByExportLayer(object, options) {
763
+ var _a;
764
+ object.updateMatrixWorld(true);
765
+ var array = object.instanceMatrix.array;
766
+ var groups = new Map();
767
+ var fallbackLayer = (_a = options === null || options === void 0 ? void 0 : options.geometryLayerName) !== null && _a !== void 0 ? _a : '';
768
+ for (var i = 0; i < object.count; i++) {
769
+ _instanceMatrix.fromArray(array, i * 16);
770
+ if (!isUsableInstanceMatrix(_instanceMatrix))
771
+ continue;
772
+ var objectId = resolveSharedInstanceObjectId(object, i);
773
+ var exportLayer = resolveExportLayerForObjectId(objectId, options) || fallbackLayer;
774
+ var ids = groups.get(exportLayer);
775
+ if (ids) {
776
+ ids.push(i);
777
+ }
778
+ else {
779
+ groups.set(exportLayer, [i]);
780
+ }
781
+ }
782
+ return groups;
783
+ }
784
+ /**
785
+ * Bakes selected visible INSERTs of one shared template into a single
786
+ * world-space slice, then rebases around the centroid.
787
+ *
788
+ * @param instanceIndices - When set, only these instance slots are baked.
561
789
  */
562
- function expandInstancedGeometry(object, primitiveVertexCount) {
563
- var _a, _b;
790
+ function expandInstancedGeometry(object, primitiveVertexCount, instanceIndices) {
791
+ var e_11, _a, e_12, _b;
792
+ var _c, _d;
564
793
  var template = acexHtmlOmitNonFinitePrimitives(acexHtmlExportBufferGeometrySlice(object.geometry), primitiveVertexCount);
565
794
  var floatsPerInstance = template.positions.length;
566
795
  if (floatsPerInstance === 0)
567
796
  return undefined;
568
797
  object.updateMatrixWorld(true);
569
798
  var array = object.instanceMatrix.array;
570
- var indexCount = (_b = (_a = template.indices) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
799
+ var indexCount = (_d = (_c = template.indices) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
800
+ var slotList = instanceIndices !== null && instanceIndices !== void 0 ? instanceIndices : Array.from({ length: object.count }, function (_, index) { return index; });
571
801
  var visible = 0;
572
- for (var i = 0; i < object.count; i++) {
573
- _instanceMatrix.fromArray(array, i * 16);
574
- if (isUsableInstanceMatrix(_instanceMatrix))
575
- visible++;
802
+ try {
803
+ for (var slotList_4 = __values(slotList), slotList_4_1 = slotList_4.next(); !slotList_4_1.done; slotList_4_1 = slotList_4.next()) {
804
+ var i = slotList_4_1.value;
805
+ _instanceMatrix.fromArray(array, i * 16);
806
+ if (isUsableInstanceMatrix(_instanceMatrix))
807
+ visible++;
808
+ }
809
+ }
810
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
811
+ finally {
812
+ try {
813
+ if (slotList_4_1 && !slotList_4_1.done && (_a = slotList_4.return)) _a.call(slotList_4);
814
+ }
815
+ finally { if (e_11) throw e_11.error; }
576
816
  }
577
817
  if (visible === 0)
578
818
  return undefined;
@@ -580,20 +820,30 @@ function expandInstancedGeometry(object, primitiveVertexCount) {
580
820
  var indices = template.indices != null ? new Uint32Array(visible * indexCount) : undefined;
581
821
  var vertexCount = floatsPerInstance / 3;
582
822
  var slot = 0;
583
- for (var i = 0; i < object.count; i++) {
584
- _instanceMatrix.fromArray(array, i * 16);
585
- if (!isUsableInstanceMatrix(_instanceMatrix))
586
- continue;
587
- _instanceWorld.multiplyMatrices(object.matrixWorld, _instanceMatrix);
588
- var baked = acexHtmlBakePlainDrawableSlice(template, _instanceWorld);
589
- positions.set(baked.positions, slot * floatsPerInstance);
590
- if (indices && baked.indices) {
591
- var base = slot * vertexCount;
592
- for (var k = 0; k < baked.indices.length; k++) {
593
- indices[slot * indexCount + k] = baked.indices[k] + base;
823
+ try {
824
+ for (var slotList_5 = __values(slotList), slotList_5_1 = slotList_5.next(); !slotList_5_1.done; slotList_5_1 = slotList_5.next()) {
825
+ var i = slotList_5_1.value;
826
+ _instanceMatrix.fromArray(array, i * 16);
827
+ if (!isUsableInstanceMatrix(_instanceMatrix))
828
+ continue;
829
+ _instanceWorld.multiplyMatrices(object.matrixWorld, _instanceMatrix);
830
+ var baked = acexHtmlBakePlainDrawableSlice(template, _instanceWorld);
831
+ positions.set(baked.positions, slot * floatsPerInstance);
832
+ if (indices && baked.indices) {
833
+ var base = slot * vertexCount;
834
+ for (var k = 0; k < baked.indices.length; k++) {
835
+ indices[slot * indexCount + k] = baked.indices[k] + base;
836
+ }
594
837
  }
838
+ slot++;
839
+ }
840
+ }
841
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
842
+ finally {
843
+ try {
844
+ if (slotList_5_1 && !slotList_5_1.done && (_b = slotList_5.return)) _b.call(slotList_5);
595
845
  }
596
- slot++;
846
+ finally { if (e_12) throw e_12.error; }
597
847
  }
598
848
  var rebased = acexHtmlRebasePlainDrawableSliceAroundCentroid(acexHtmlOmitNonFinitePrimitives({ positions: positions, indices: indices }, primitiveVertexCount));
599
849
  if (rebased.slice.positions.length === 0)
@@ -605,62 +855,127 @@ function meshNeedsPerInstanceExport(material) {
605
855
  var mapped = material;
606
856
  return !!(style.hatchPattern || style.gradientFill || mapped.map);
607
857
  }
608
- function forEachVisibleInstanceMatrix(object, visit) {
858
+ function forEachVisibleInstanceMatrix(object, visit, instanceIndices) {
859
+ var e_13, _a;
609
860
  object.updateMatrixWorld(true);
610
861
  var array = object.instanceMatrix.array;
611
- for (var i = 0; i < object.count; i++) {
612
- _instanceMatrix.fromArray(array, i * 16);
613
- if (!isUsableInstanceMatrix(_instanceMatrix))
614
- continue;
615
- _instanceWorld.multiplyMatrices(object.matrixWorld, _instanceMatrix);
616
- visit(_instanceWorld);
862
+ var slotList = instanceIndices !== null && instanceIndices !== void 0 ? instanceIndices : Array.from({ length: object.count }, function (_, index) { return index; });
863
+ try {
864
+ for (var slotList_6 = __values(slotList), slotList_6_1 = slotList_6.next(); !slotList_6_1.done; slotList_6_1 = slotList_6.next()) {
865
+ var i = slotList_6_1.value;
866
+ _instanceMatrix.fromArray(array, i * 16);
867
+ if (!isUsableInstanceMatrix(_instanceMatrix))
868
+ continue;
869
+ _instanceWorld.multiplyMatrices(object.matrixWorld, _instanceMatrix);
870
+ visit(_instanceWorld, i);
871
+ }
872
+ }
873
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
874
+ finally {
875
+ try {
876
+ if (slotList_6_1 && !slotList_6_1.done && (_a = slotList_6.return)) _a.call(slotList_6);
877
+ }
878
+ finally { if (e_13) throw e_13.error; }
617
879
  }
618
880
  }
619
- function pushInstancedLine(object, lineBatches) {
620
- var expanded = expandInstancedGeometry(object, 2);
621
- if (!expanded)
881
+ function pushInstancedLine(object, lineBatches, options) {
882
+ var e_14, _a;
883
+ var groups = groupVisibleInstancesByExportLayer(object, options);
884
+ if (groups.size === 0)
622
885
  return;
623
886
  var material = readExportMaterial(object);
624
- var _a = readMaterialStyle(material), color = _a.color, layer = _a.layer, linePattern = _a.linePattern;
625
- var lineDistances = linePattern
626
- ? acexHtmlComputeLineDistancesForSegments(expanded.slice.positions)
627
- : undefined;
628
- var exported = __assign({ layer: layer, color: color, offset: expanded.offset, linePattern: linePattern, lineDistances: lineDistances }, expanded.slice);
629
- if (drawableExcludesFromOsnap(object)) {
630
- exported.excludeFromOsnap = true;
887
+ var _b = readMaterialStyle(material), color = _b.color, materialLayer = _b.layer, linePattern = _b.linePattern;
888
+ var fallbackLayer = (options === null || options === void 0 ? void 0 : options.geometryLayerName) || materialLayer;
889
+ var excludeFromOsnap = drawableExcludesFromOsnap(object);
890
+ try {
891
+ for (var groups_5 = __values(groups), groups_5_1 = groups_5.next(); !groups_5_1.done; groups_5_1 = groups_5.next()) {
892
+ var _c = __read(groups_5_1.value, 2), exportLayer = _c[0], indices = _c[1];
893
+ var expanded = expandInstancedGeometry(object, 2, indices);
894
+ if (!expanded)
895
+ continue;
896
+ var lineDistances = linePattern
897
+ ? acexHtmlComputeLineDistancesForSegments(expanded.slice.positions)
898
+ : undefined;
899
+ var exported = __assign({ layer: exportLayer || fallbackLayer, color: color, offset: expanded.offset, linePattern: linePattern, lineDistances: lineDistances }, expanded.slice);
900
+ if (excludeFromOsnap) {
901
+ exported.excludeFromOsnap = true;
902
+ }
903
+ assignRenderOrder(exported, object, material);
904
+ lineBatches.push(exported);
905
+ }
906
+ }
907
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
908
+ finally {
909
+ try {
910
+ if (groups_5_1 && !groups_5_1.done && (_a = groups_5.return)) _a.call(groups_5);
911
+ }
912
+ finally { if (e_14) throw e_14.error; }
631
913
  }
632
- assignRenderOrder(exported, object, material);
633
- lineBatches.push(exported);
634
914
  }
635
- function pushInstancedMesh(object, meshBatches, asPoints) {
915
+ function pushInstancedMesh(object, meshBatches, asPoints, options) {
916
+ var e_15, _a, e_16, _b;
636
917
  var material = readExportMaterial(object);
637
918
  if (!asPoints && acexHtmlIsTransparentImagePlaceholder(material))
638
919
  return;
920
+ var groups = groupVisibleInstancesByExportLayer(object, options);
921
+ if (groups.size === 0)
922
+ return;
923
+ var fallbackLayer = (options === null || options === void 0 ? void 0 : options.geometryLayerName) || readMaterialStyle(material).layer;
639
924
  if (!asPoints && meshNeedsPerInstanceExport(material)) {
640
925
  var template_1 = acexHtmlOmitNonFinitePrimitives(acexHtmlExportBufferGeometrySlice(object.geometry), 3);
641
926
  if (template_1.positions.length === 0)
642
927
  return;
643
- forEachVisibleInstanceMatrix(object, function (matrixWorld) {
644
- var baked = acexHtmlOmitNonFinitePrimitives(acexHtmlBakePlainDrawableSlice(template_1, matrixWorld), 3);
645
- if (baked.positions.length === 0)
646
- return;
647
- var rebased = acexHtmlRebasePlainDrawableSliceAroundCentroid(baked);
648
- _instancePose.matrix.copy(matrixWorld);
649
- _instancePose.matrixWorld.copy(matrixWorld);
650
- _instancePose.matrixWorldNeedsUpdate = false;
651
- var mesh = buildMeshBatch(object.geometry, material, _instancePose, rebased.slice, rebased.offset, true);
652
- if (mesh)
653
- meshBatches.push(mesh);
654
- });
928
+ var _loop_1 = function (exportLayer, indices) {
929
+ forEachVisibleInstanceMatrix(object, function (matrixWorld) {
930
+ var baked = acexHtmlOmitNonFinitePrimitives(acexHtmlBakePlainDrawableSlice(template_1, matrixWorld), 3);
931
+ if (baked.positions.length === 0)
932
+ return;
933
+ var rebased = acexHtmlRebasePlainDrawableSliceAroundCentroid(baked);
934
+ _instancePose.matrix.copy(matrixWorld);
935
+ _instancePose.matrixWorld.copy(matrixWorld);
936
+ _instancePose.matrixWorldNeedsUpdate = false;
937
+ var mesh = buildMeshBatch(object.geometry, material, _instancePose, rebased.slice, rebased.offset, true);
938
+ if (mesh) {
939
+ mesh.layer = exportLayer || fallbackLayer;
940
+ meshBatches.push(mesh);
941
+ }
942
+ }, indices);
943
+ };
944
+ try {
945
+ for (var groups_6 = __values(groups), groups_6_1 = groups_6.next(); !groups_6_1.done; groups_6_1 = groups_6.next()) {
946
+ var _c = __read(groups_6_1.value, 2), exportLayer = _c[0], indices = _c[1];
947
+ _loop_1(exportLayer, indices);
948
+ }
949
+ }
950
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
951
+ finally {
952
+ try {
953
+ if (groups_6_1 && !groups_6_1.done && (_a = groups_6.return)) _a.call(groups_6);
954
+ }
955
+ finally { if (e_15) throw e_15.error; }
956
+ }
655
957
  return;
656
958
  }
657
- var expanded = expandInstancedGeometry(object, asPoints ? 1 : 3);
658
- if (!expanded)
659
- return;
660
- var mesh = buildMeshBatch(object.geometry, material, object, expanded.slice, expanded.offset, !asPoints);
661
- if (!mesh)
662
- return;
663
- meshBatches.push(asPoints ? __assign(__assign({}, mesh), { points: true }) : mesh);
959
+ try {
960
+ for (var groups_7 = __values(groups), groups_7_1 = groups_7.next(); !groups_7_1.done; groups_7_1 = groups_7.next()) {
961
+ var _d = __read(groups_7_1.value, 2), exportLayer = _d[0], indices = _d[1];
962
+ var expanded = expandInstancedGeometry(object, asPoints ? 1 : 3, indices);
963
+ if (!expanded)
964
+ continue;
965
+ var mesh = buildMeshBatch(object.geometry, material, object, expanded.slice, expanded.offset, !asPoints);
966
+ if (!mesh)
967
+ continue;
968
+ mesh.layer = exportLayer || fallbackLayer;
969
+ meshBatches.push(asPoints ? __assign(__assign({}, mesh), { points: true }) : mesh);
970
+ }
971
+ }
972
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
973
+ finally {
974
+ try {
975
+ if (groups_7_1 && !groups_7_1.done && (_b = groups_7.return)) _b.call(groups_7);
976
+ }
977
+ finally { if (e_16) throw e_16.error; }
978
+ }
664
979
  }
665
980
  function isExportLineSegments2(object) {
666
981
  var candidate = object;
@@ -689,11 +1004,23 @@ function isExportMesh(object) {
689
1004
  * and points).
690
1005
  *
691
1006
  * @param root - Layout or scene root to traverse.
1007
+ * @param options - Optional frozen-INSERT reparenting controls.
692
1008
  * @returns Batches grouped by geometry kind, ready to attach to {@link AcExHtmlLayoutSnapshot}.
693
1009
  */
694
- export function acexHtmlCollectBatchesFromObject3D(root) {
1010
+ export function acexHtmlCollectBatchesFromObject3D(root, options) {
1011
+ var _a;
695
1012
  var lineBatches = [];
696
1013
  var meshBatches = [];
1014
+ var geometryLayerName = (_a = options === null || options === void 0 ? void 0 : options.geometryLayerName) !== null && _a !== void 0 ? _a : '';
1015
+ var resolvePlainExportLayer = function (object) {
1016
+ var _a;
1017
+ // Leaf drawables may carry objectId on userData after INSERT decompose;
1018
+ // shared fat-line instances use `sharedInstanceObjectId` (not `objectId`,
1019
+ // which {@link isHighlightCloneDrawable} would treat as a highlight clone).
1020
+ var userData = object.userData;
1021
+ var objectId = (_a = userData.objectId) !== null && _a !== void 0 ? _a : userData.sharedInstanceObjectId;
1022
+ return resolveExportLayerForObjectId(objectId, options);
1023
+ };
697
1024
  root.traverse(function (child) {
698
1025
  if (isHighlightOverlayDescendant(child) ||
699
1026
  isHighlightCloneDrawable(child) ||
@@ -704,38 +1031,30 @@ export function acexHtmlCollectBatchesFromObject3D(root) {
704
1031
  if (!shouldExportPlainDrawable(child, root))
705
1032
  return;
706
1033
  if (child.isPoints === true) {
707
- pushInstancedMesh(child, meshBatches, true);
1034
+ pushInstancedMesh(child, meshBatches, true, options);
708
1035
  }
709
1036
  else if (isExportLineSegments(child) && !isExportLineSegments2(child)) {
710
- pushInstancedLine(child, lineBatches);
1037
+ pushInstancedLine(child, lineBatches, options);
711
1038
  }
712
1039
  else if (isExportMesh(child) && !isExportLineSegments2(child)) {
713
- pushInstancedMesh(child, meshBatches, false);
1040
+ pushInstancedMesh(child, meshBatches, false, options);
714
1041
  }
715
1042
  return;
716
1043
  }
717
1044
  if (child instanceof AcTrBatchedLine) {
718
- var batch = exportBatchedLine(child);
719
- if (batch)
720
- lineBatches.push(batch);
1045
+ lineBatches.push.apply(lineBatches, __spreadArray([], __read(exportBatchedLine(child, options)), false));
721
1046
  return;
722
1047
  }
723
1048
  if (child instanceof AcTrBatchedLine2) {
724
- var batch = exportBatchedLine2(child);
725
- if (batch)
726
- lineBatches.push(batch);
1049
+ lineBatches.push.apply(lineBatches, __spreadArray([], __read(exportBatchedLine2(child, options)), false));
727
1050
  return;
728
1051
  }
729
1052
  if (child instanceof AcTrBatchedMesh) {
730
- var batch = exportBatchedMesh(child);
731
- if (batch)
732
- meshBatches.push(batch);
1053
+ meshBatches.push.apply(meshBatches, __spreadArray([], __read(exportBatchedMesh(child, options)), false));
733
1054
  return;
734
1055
  }
735
1056
  if (child instanceof AcTrBatchedPoint) {
736
- var batch = exportBatchedPoint(child);
737
- if (batch)
738
- meshBatches.push(batch);
1057
+ meshBatches.push.apply(meshBatches, __spreadArray([], __read(exportBatchedPoint(child, options)), false));
739
1058
  return;
740
1059
  }
741
1060
  if (isExportLineSegments2(child)) {
@@ -745,9 +1064,9 @@ export function acexHtmlCollectBatchesFromObject3D(root) {
745
1064
  if (rawSlice.positions.length === 0)
746
1065
  return;
747
1066
  var material = readExportMaterial(child);
748
- var _a = readMaterialStyle(material), color = _a.color, layer = _a.layer;
749
- var _b = exportSceneDrawableSlice(child, rawSlice), offset = _b.offset, slice = __rest(_b, ["offset"]);
750
- var exported = __assign({ layer: layer, color: color, offset: offset, lineWidth: readLineWidth(material) }, slice);
1067
+ var color = readMaterialStyle(material).color;
1068
+ var _a = exportSceneDrawableSlice(child, rawSlice), offset = _a.offset, slice = __rest(_a, ["offset"]);
1069
+ var exported = __assign({ layer: resolvePlainExportLayer(child) || geometryLayerName, color: color, offset: offset, lineWidth: readLineWidth(material) }, slice);
751
1070
  if (drawableExcludesFromOsnap(child)) {
752
1071
  exported.excludeFromOsnap = true;
753
1072
  }
@@ -761,12 +1080,12 @@ export function acexHtmlCollectBatchesFromObject3D(root) {
761
1080
  if (rawSlice.positions.length === 0)
762
1081
  return;
763
1082
  var material = readExportMaterial(child);
764
- var _c = readMaterialStyle(material), color = _c.color, layer = _c.layer, linePattern = _c.linePattern;
765
- var _d = exportSceneDrawableSlice(child, rawSlice), offset = _d.offset, slice = __rest(_d, ["offset"]);
1083
+ var _b = readMaterialStyle(material), color = _b.color, linePattern = _b.linePattern;
1084
+ var _c = exportSceneDrawableSlice(child, rawSlice), offset = _c.offset, slice = __rest(_c, ["offset"]);
766
1085
  var lineDistances = linePattern
767
1086
  ? acexHtmlComputeLineDistancesForSegments(slice.positions)
768
1087
  : undefined;
769
- var exported = __assign({ layer: layer, color: color, offset: offset, linePattern: linePattern, lineDistances: lineDistances }, slice);
1088
+ var exported = __assign({ layer: resolvePlainExportLayer(child) || geometryLayerName, color: color, offset: offset, linePattern: linePattern, lineDistances: lineDistances }, slice);
770
1089
  if (drawableExcludesFromOsnap(child)) {
771
1090
  exported.excludeFromOsnap = true;
772
1091
  }
@@ -787,10 +1106,12 @@ export function acexHtmlCollectBatchesFromObject3D(root) {
787
1106
  // Pattern fills rebase like other meshes; hatch bases are shifted to the
788
1107
  // same local offset in buildMeshBatch (world-baked verts caused blocky
789
1108
  // hatch shaders at large survey coordinates).
790
- var _e = exportSceneDrawableSlice(child, rawSlice), offset = _e.offset, slice = __rest(_e, ["offset"]);
1109
+ var _d = exportSceneDrawableSlice(child, rawSlice), offset = _d.offset, slice = __rest(_d, ["offset"]);
791
1110
  var mesh = buildMeshBatch(child.geometry, material, child, slice, offset, true);
792
- if (mesh)
1111
+ if (mesh) {
1112
+ mesh.layer = resolvePlainExportLayer(child) || geometryLayerName;
793
1113
  meshBatches.push(mesh);
1114
+ }
794
1115
  }
795
1116
  });
796
1117
  return { lineBatches: lineBatches, meshBatches: meshBatches };