@bendyline/molen-tooling 0.0.11 → 0.0.12
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/capture/harness.js +596 -275
- package/dist/capture/worldgen-preview.js +394 -296
- package/dist/cli.mjs +2 -2
- package/dist/docs-src/guide/3d-art-guidelines.md +34 -10
- package/dist/docs-src/guide/3d-model-assets.md +27 -2
- package/dist/docs-src/guide/adaptive-performance.md +12 -4
- package/dist/docs-src/guide/aircraft.md +126 -26
- package/dist/docs-src/guide/ambient-life.md +13 -4
- package/dist/docs-src/guide/audio.md +19 -5
- package/dist/docs-src/guide/building-interiors.md +7 -2
- package/dist/docs-src/guide/determinism.md +1 -1
- package/dist/docs-src/guide/dioramas.md +6 -0
- package/dist/docs-src/guide/earth-view.md +121 -20
- package/dist/docs-src/guide/entities.md +84 -5
- package/dist/docs-src/guide/figures.md +31 -7
- package/dist/docs-src/guide/graphics-performance.md +27 -12
- package/dist/docs-src/guide/medium-fi.md +269 -25
- package/dist/docs-src/guide/navigation.md +5 -2
- package/dist/docs-src/guide/project.md +5 -0
- package/dist/docs-src/guide/recognizable-places.md +6 -0
- package/dist/docs-src/guide/regional-fleets.md +94 -0
- package/dist/docs-src/guide/regional-world.md +16 -5
- package/dist/docs-src/guide/sky.md +36 -3
- package/dist/docs-src/guide/structure-library.md +4 -1
- package/dist/docs-src/guide/surface-rendering.md +264 -2
- package/dist/docs-src/guide/terrain.md +5 -0
- package/dist/docs-src/guide/typography.md +105 -0
- package/dist/docs-src/guide/vehicle-interiors.md +169 -9
- package/dist/docs-src/guide/vehicles.md +13 -2
- package/dist/docs-src/guide/weather.md +15 -8
- package/dist/docs-src/guide/worldgen.md +81 -9
- package/dist/docs-src/llms.txt +4 -1
- package/dist/docs-src/schemas/README.md +3 -0
- package/dist/docs-src/schemas/archstyle.md +36 -0
- package/dist/docs-src/schemas/components.md +1087 -66
- package/dist/docs-src/schemas/fleet-catalog.md +113 -0
- package/dist/docs-src/schemas/landmark.md +10 -0
- package/dist/docs-src/schemas/matgraph.md +11 -1
- package/dist/docs-src/schemas/pack-source.md +11 -1
- package/dist/docs-src/schemas/pack.md +1 -1
- package/dist/docs-src/schemas/project.md +1 -1
- package/dist/docs-src/schemas/structure-placement-data.md +662 -0
- package/dist/docs-src/schemas/structure-placement-index.md +87 -0
- package/dist/docs-src/schemas/structure-placements.md +183 -0
- package/dist/docs-src/schemas/transport-network.md +8 -0
- package/dist/docs-src/schemas/types.md +1 -1
- package/dist/docs-src/schemas/worldgen-batch.md +40 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{mcp-BbxqqnD1.mjs → mcp-BXaK46X-.mjs} +1 -1
- package/dist/{ops-b4Pag8U-.mjs → ops-Cm7WNvb9.mjs} +55 -22
- package/dist/templates/city-courier/gen/molen-types.ts +138 -17
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +138 -17
- package/dist/templates/figures-gallery/test/headless.test.ts +2 -1
- package/dist/templates/index.json +17 -17
- package/dist/templates/skybound/gen/molen-types.ts +138 -17
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +138 -17
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +138 -17
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +138 -17
- package/package.json +13 -13
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Regional structure placement directory (`molen/structure-placement-index@1`)
|
|
2
|
+
|
|
3
|
+
Spatial coverage and pack paths for lazily loaded placement regions.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"format": "molen/structure-placement-index@1",
|
|
10
|
+
"shards": {},
|
|
11
|
+
"cells": {}
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## JSON Schema
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
20
|
+
"type": "object",
|
|
21
|
+
"properties": {
|
|
22
|
+
"format": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"const": "molen/structure-placement-index@1"
|
|
25
|
+
},
|
|
26
|
+
"shards": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"propertyNames": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"pattern": "^[0123456789bcdefghjkmnpqrstuvwxyz]{2,12}$"
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"path": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"pattern": "^(?![A-Za-z]:|[/\\\\])(?!.*\\\\)(?!.*(?:^|\\/)\\.\\.?(?:\\/|$)).+\\.json$"
|
|
38
|
+
},
|
|
39
|
+
"bytes": {
|
|
40
|
+
"type": "integer",
|
|
41
|
+
"exclusiveMinimum": 0,
|
|
42
|
+
"maximum": 9007199254740991
|
|
43
|
+
},
|
|
44
|
+
"count": {
|
|
45
|
+
"type": "integer",
|
|
46
|
+
"exclusiveMinimum": 0,
|
|
47
|
+
"maximum": 9007199254740991
|
|
48
|
+
},
|
|
49
|
+
"minLevel": {
|
|
50
|
+
"type": "integer",
|
|
51
|
+
"minimum": 0,
|
|
52
|
+
"maximum": 26
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"required": [
|
|
56
|
+
"path",
|
|
57
|
+
"bytes",
|
|
58
|
+
"count",
|
|
59
|
+
"minLevel"
|
|
60
|
+
],
|
|
61
|
+
"additionalProperties": false
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"cells": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"propertyNames": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"pattern": "^[0123456789bcdefghjkmnpqrstuvwxyz]{2}$"
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": {
|
|
71
|
+
"minItems": 1,
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"pattern": "^[0123456789bcdefghjkmnpqrstuvwxyz]{2,12}$"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"required": [
|
|
81
|
+
"format",
|
|
82
|
+
"shards",
|
|
83
|
+
"cells"
|
|
84
|
+
],
|
|
85
|
+
"additionalProperties": false
|
|
86
|
+
}
|
|
87
|
+
```
|
|
@@ -231,6 +231,68 @@ WGS84 anchors for authored models; draft entries are indexed but not rendered.
|
|
|
231
231
|
"replaceFootprint": {
|
|
232
232
|
"type": "boolean"
|
|
233
233
|
},
|
|
234
|
+
"buildingCutout": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"properties": {
|
|
237
|
+
"minimumCoverage": {
|
|
238
|
+
"type": "number",
|
|
239
|
+
"exclusiveMinimum": 0,
|
|
240
|
+
"maximum": 1
|
|
241
|
+
},
|
|
242
|
+
"outline": {
|
|
243
|
+
"minItems": 3,
|
|
244
|
+
"maxItems": 512,
|
|
245
|
+
"type": "array",
|
|
246
|
+
"items": {
|
|
247
|
+
"type": "array",
|
|
248
|
+
"prefixItems": [
|
|
249
|
+
{
|
|
250
|
+
"type": "number"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"type": "number"
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"items": false,
|
|
257
|
+
"minItems": 2,
|
|
258
|
+
"maxItems": 2
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"outlines": {
|
|
262
|
+
"minItems": 1,
|
|
263
|
+
"maxItems": 64,
|
|
264
|
+
"type": "array",
|
|
265
|
+
"items": {
|
|
266
|
+
"minItems": 3,
|
|
267
|
+
"maxItems": 512,
|
|
268
|
+
"type": "array",
|
|
269
|
+
"items": {
|
|
270
|
+
"type": "array",
|
|
271
|
+
"prefixItems": [
|
|
272
|
+
{
|
|
273
|
+
"type": "number"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"type": "number"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
"items": false,
|
|
280
|
+
"minItems": 2,
|
|
281
|
+
"maxItems": 2
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"basis": {
|
|
286
|
+
"type": "string",
|
|
287
|
+
"minLength": 1
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"required": [
|
|
291
|
+
"outline",
|
|
292
|
+
"basis"
|
|
293
|
+
],
|
|
294
|
+
"additionalProperties": false
|
|
295
|
+
},
|
|
234
296
|
"groundCutout": {
|
|
235
297
|
"type": "object",
|
|
236
298
|
"properties": {
|
|
@@ -253,6 +315,53 @@ WGS84 anchors for authored models; draft entries are indexed but not rendered.
|
|
|
253
315
|
"maxItems": 2
|
|
254
316
|
}
|
|
255
317
|
},
|
|
318
|
+
"outlines": {
|
|
319
|
+
"minItems": 1,
|
|
320
|
+
"maxItems": 64,
|
|
321
|
+
"type": "array",
|
|
322
|
+
"items": {
|
|
323
|
+
"minItems": 3,
|
|
324
|
+
"maxItems": 512,
|
|
325
|
+
"type": "array",
|
|
326
|
+
"items": {
|
|
327
|
+
"type": "array",
|
|
328
|
+
"prefixItems": [
|
|
329
|
+
{
|
|
330
|
+
"type": "number"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"type": "number"
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
"items": false,
|
|
337
|
+
"minItems": 2,
|
|
338
|
+
"maxItems": 2
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"additionalOutlines": {
|
|
343
|
+
"maxItems": 63,
|
|
344
|
+
"type": "array",
|
|
345
|
+
"items": {
|
|
346
|
+
"minItems": 3,
|
|
347
|
+
"maxItems": 512,
|
|
348
|
+
"type": "array",
|
|
349
|
+
"items": {
|
|
350
|
+
"type": "array",
|
|
351
|
+
"prefixItems": [
|
|
352
|
+
{
|
|
353
|
+
"type": "number"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"type": "number"
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"items": false,
|
|
360
|
+
"minItems": 2,
|
|
361
|
+
"maxItems": 2
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
},
|
|
256
365
|
"basis": {
|
|
257
366
|
"type": "string",
|
|
258
367
|
"minLength": 1
|
|
@@ -264,6 +373,44 @@ WGS84 anchors for authored models; draft entries are indexed but not rendered.
|
|
|
264
373
|
],
|
|
265
374
|
"additionalProperties": false
|
|
266
375
|
},
|
|
376
|
+
"waterCutout": {
|
|
377
|
+
"type": "object",
|
|
378
|
+
"properties": {
|
|
379
|
+
"outlines": {
|
|
380
|
+
"minItems": 1,
|
|
381
|
+
"maxItems": 16,
|
|
382
|
+
"type": "array",
|
|
383
|
+
"items": {
|
|
384
|
+
"minItems": 3,
|
|
385
|
+
"maxItems": 512,
|
|
386
|
+
"type": "array",
|
|
387
|
+
"items": {
|
|
388
|
+
"type": "array",
|
|
389
|
+
"prefixItems": [
|
|
390
|
+
{
|
|
391
|
+
"type": "number"
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"type": "number"
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
"items": false,
|
|
398
|
+
"minItems": 2,
|
|
399
|
+
"maxItems": 2
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"basis": {
|
|
404
|
+
"type": "string",
|
|
405
|
+
"minLength": 1
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"required": [
|
|
409
|
+
"outlines",
|
|
410
|
+
"basis"
|
|
411
|
+
],
|
|
412
|
+
"additionalProperties": false
|
|
413
|
+
},
|
|
267
414
|
"mapIdentity": {
|
|
268
415
|
"type": "object",
|
|
269
416
|
"properties": {
|
|
@@ -399,6 +546,14 @@ WGS84 anchors for authored models; draft entries are indexed but not rendered.
|
|
|
399
546
|
"minLength": 1
|
|
400
547
|
}
|
|
401
548
|
},
|
|
549
|
+
"names": {
|
|
550
|
+
"minItems": 1,
|
|
551
|
+
"type": "array",
|
|
552
|
+
"items": {
|
|
553
|
+
"type": "string",
|
|
554
|
+
"minLength": 1
|
|
555
|
+
}
|
|
556
|
+
},
|
|
402
557
|
"tags": {
|
|
403
558
|
"type": "object",
|
|
404
559
|
"propertyNames": {
|
|
@@ -437,6 +592,34 @@ WGS84 anchors for authored models; draft entries are indexed but not rendered.
|
|
|
437
592
|
"minItems": 3,
|
|
438
593
|
"maxItems": 3
|
|
439
594
|
},
|
|
595
|
+
"bounds": {
|
|
596
|
+
"type": "array",
|
|
597
|
+
"prefixItems": [
|
|
598
|
+
{
|
|
599
|
+
"type": "number",
|
|
600
|
+
"minimum": -180,
|
|
601
|
+
"maximum": 180
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"type": "number",
|
|
605
|
+
"minimum": -90,
|
|
606
|
+
"maximum": 90
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"type": "number",
|
|
610
|
+
"minimum": -180,
|
|
611
|
+
"maximum": 180
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"type": "number",
|
|
615
|
+
"minimum": -90,
|
|
616
|
+
"maximum": 90
|
|
617
|
+
}
|
|
618
|
+
],
|
|
619
|
+
"items": false,
|
|
620
|
+
"minItems": 4,
|
|
621
|
+
"maxItems": 4
|
|
622
|
+
},
|
|
440
623
|
"orientation": {
|
|
441
624
|
"type": "string",
|
|
442
625
|
"enum": [
|
|
@@ -148,6 +148,14 @@ Roads, railways and paths ambient NPCs move on, for scenes without streamed map
|
|
|
148
148
|
"items": {
|
|
149
149
|
"type": "object",
|
|
150
150
|
"properties": {
|
|
151
|
+
"drivingSide": {
|
|
152
|
+
"type": "string",
|
|
153
|
+
"enum": [
|
|
154
|
+
"right",
|
|
155
|
+
"left"
|
|
156
|
+
],
|
|
157
|
+
"description": "Overrides the document road driving side."
|
|
158
|
+
},
|
|
151
159
|
"id": {
|
|
152
160
|
"type": "string",
|
|
153
161
|
"minLength": 1,
|
|
@@ -113,7 +113,7 @@ Namespaced entity types with doc strings, default components, inheritance, and a
|
|
|
113
113
|
"type": "array",
|
|
114
114
|
"items": {
|
|
115
115
|
"type": "string",
|
|
116
|
-
"pattern": "^[a-z][a-z0-9_]*(\\.[a-
|
|
116
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z0-9][a-z0-9_]*)*$"
|
|
117
117
|
},
|
|
118
118
|
"description": "Project asset ids this type references (e.g. its gltf model)."
|
|
119
119
|
},
|
|
@@ -133,6 +133,46 @@ A serialized generation request: labeled building outlines, optional labeled pol
|
|
|
133
133
|
"items": {
|
|
134
134
|
"type": "object",
|
|
135
135
|
"properties": {
|
|
136
|
+
"priority": {
|
|
137
|
+
"type": "number"
|
|
138
|
+
},
|
|
139
|
+
"access": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"properties": {
|
|
142
|
+
"from": {
|
|
143
|
+
"minItems": 2,
|
|
144
|
+
"maxItems": 2,
|
|
145
|
+
"type": "array",
|
|
146
|
+
"items": {
|
|
147
|
+
"type": "number"
|
|
148
|
+
},
|
|
149
|
+
"description": "[x, z] in local meters."
|
|
150
|
+
},
|
|
151
|
+
"to": {
|
|
152
|
+
"minItems": 2,
|
|
153
|
+
"maxItems": 2,
|
|
154
|
+
"type": "array",
|
|
155
|
+
"items": {
|
|
156
|
+
"type": "number"
|
|
157
|
+
},
|
|
158
|
+
"description": "[x, z] in local meters."
|
|
159
|
+
},
|
|
160
|
+
"width": {
|
|
161
|
+
"type": "number",
|
|
162
|
+
"exclusiveMinimum": 0,
|
|
163
|
+
"maximum": 12
|
|
164
|
+
},
|
|
165
|
+
"garage": {
|
|
166
|
+
"type": "boolean"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"required": [
|
|
170
|
+
"from",
|
|
171
|
+
"to",
|
|
172
|
+
"width"
|
|
173
|
+
],
|
|
174
|
+
"additionalProperties": false
|
|
175
|
+
},
|
|
136
176
|
"identity": {
|
|
137
177
|
"type": "string",
|
|
138
178
|
"minLength": 1,
|
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ import { ResolvedTypes, World, WorldSetup } from "@bendyline/molen-kernel";
|
|
|
7
7
|
import { PackSet } from "@bendyline/molen-pack";
|
|
8
8
|
import { AssertionResult, ComponentDiff, RecordedEvent } from "@bendyline/molen-kernel/testing";
|
|
9
9
|
import { PMTiles } from "pmtiles";
|
|
10
|
+
import { FontLibrary } from "@bendyline/molen-materials/text";
|
|
10
11
|
//#region src/frame-stats.d.ts
|
|
11
12
|
/** A rectangle as fractions of the frame (0 to 1), so a check reads the same at any size. */
|
|
12
13
|
interface FrameRegion {
|
|
@@ -1231,6 +1232,7 @@ declare function bakeWorldgen(input: WorldgenBakeInput): Promise<WorldgenBakeOut
|
|
|
1231
1232
|
//#endregion
|
|
1232
1233
|
//#region src/ops/worldgen-pack.d.ts
|
|
1233
1234
|
interface LoadedStylePackFiles {
|
|
1235
|
+
fonts?: FontLibrary;
|
|
1234
1236
|
pack: ResolvedStylePack;
|
|
1235
1237
|
/** Directory every pack path resolves against. */
|
|
1236
1238
|
dir: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, G as schemaToTsType, H as describeOps, L as exportFrames, N as generateTypes, O as extractContentPack, P as renderTypesModule, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Y as ASSET_INDEX_FILE, Z as screenshotAsset, a as lineupBatchDoc, at as findProjectFile, b as diffSnapshots, c as validateAsset, ct as loadSetupLike, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, ft as registerExperiencePlaySchema, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, lt as updateProjectFile, m as getSchemaOp, n as worldgenStats, nt as listAssets, o as loadStylePackFromDisk, ot as loadProject, p as getComponentOp, r as previewWorldgen, rt as assetFileIndex, s as simWatch, st as loadSceneDocument, tt as inspectAsset, u as testTypes, ut as parseExperiencePlayScenario, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates, z as locateDocsRoot } from "./ops-
|
|
1
|
+
import { A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, G as schemaToTsType, H as describeOps, L as exportFrames, N as generateTypes, O as extractContentPack, P as renderTypesModule, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Y as ASSET_INDEX_FILE, Z as screenshotAsset, a as lineupBatchDoc, at as findProjectFile, b as diffSnapshots, c as validateAsset, ct as loadSetupLike, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, ft as registerExperiencePlaySchema, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, lt as updateProjectFile, m as getSchemaOp, n as worldgenStats, nt as listAssets, o as loadStylePackFromDisk, ot as loadProject, p as getComponentOp, r as previewWorldgen, rt as assetFileIndex, s as simWatch, st as loadSceneDocument, tt as inspectAsset, u as testTypes, ut as parseExperiencePlayScenario, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates, z as locateDocsRoot } from "./ops-Cm7WNvb9.mjs";
|
|
2
2
|
import { access, copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { PNG } from "pngjs";
|
|
4
4
|
import { dirname } from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-
|
|
1
|
+
import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-Cm7WNvb9.mjs";
|
|
2
2
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -29,6 +29,7 @@ import { AudioDirector, entitySourceFromWorld, mergeSoundbanks } from "@bendylin
|
|
|
29
29
|
import { diffKeyframes, firstDivergentTick, formatAssertionResults, perTickHashes, runAssertions, runHeadless } from "@bendyline/molen-kernel/testing";
|
|
30
30
|
import { hashJson } from "@bendyline/molen-kernel/determinism";
|
|
31
31
|
import { PMTiles } from "pmtiles";
|
|
32
|
+
import { loadFontLibrary } from "@bendyline/molen-materials/text";
|
|
32
33
|
//#region src/capture-server.ts
|
|
33
34
|
const MIME$1 = {
|
|
34
35
|
".html": "text/html; charset=utf-8",
|
|
@@ -603,6 +604,34 @@ async function playExperience(input) {
|
|
|
603
604
|
}
|
|
604
605
|
}
|
|
605
606
|
//#endregion
|
|
607
|
+
//#region src/file-io.ts
|
|
608
|
+
const WINDOWS_FILE_LOCKS = new Set([
|
|
609
|
+
"EBUSY",
|
|
610
|
+
"EPERM",
|
|
611
|
+
"EACCES",
|
|
612
|
+
"EUNKNOWN",
|
|
613
|
+
"UNKNOWN"
|
|
614
|
+
]);
|
|
615
|
+
/** Retry short-lived Windows scanner/editor locks at the filesystem operation, not the import. */
|
|
616
|
+
async function retryFileOperation(operation) {
|
|
617
|
+
for (let attempt = 0;; attempt++) try {
|
|
618
|
+
return await operation();
|
|
619
|
+
} catch (error) {
|
|
620
|
+
if (process.platform !== "win32" || attempt >= 20 || !WINDOWS_FILE_LOCKS.has(error.code ?? "")) throw error;
|
|
621
|
+
await new Promise((done) => setTimeout(done, Math.min(25 * 2 ** attempt, 250)));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
/** Replace a file without truncating a destination that another process may have mapped. */
|
|
625
|
+
async function writeFileAtomic(path, data) {
|
|
626
|
+
const temporary = `${path}.${process.pid}.${randomUUID()}.tmp`;
|
|
627
|
+
try {
|
|
628
|
+
await retryFileOperation(() => writeFile(temporary, data));
|
|
629
|
+
await retryFileOperation(() => rename(temporary, path));
|
|
630
|
+
} finally {
|
|
631
|
+
await retryFileOperation(() => rm(temporary, { force: true }));
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
//#endregion
|
|
606
635
|
//#region src/content.ts
|
|
607
636
|
/** Where downloaded packs are cached: $MOLEN_CACHE_DIR, else the XDG cache, else ~/.cache. */
|
|
608
637
|
function packCacheDir() {
|
|
@@ -792,21 +821,24 @@ async function updateProjectFile(path, mutate) {
|
|
|
792
821
|
const lockPath = `${projectPath}.lock`;
|
|
793
822
|
const start = Date.now();
|
|
794
823
|
const staleAfterMs = 3e4;
|
|
795
|
-
const waitLimitMs =
|
|
824
|
+
const waitLimitMs = 3e4;
|
|
796
825
|
for (;;) try {
|
|
797
|
-
const handle = await open(lockPath, "wx");
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
826
|
+
const handle = await retryFileOperation(() => open(lockPath, "wx"));
|
|
827
|
+
try {
|
|
828
|
+
await handle.writeFile(`${JSON.stringify({
|
|
829
|
+
pid: process.pid,
|
|
830
|
+
createdAt: Date.now()
|
|
831
|
+
})}\n`);
|
|
832
|
+
} finally {
|
|
833
|
+
await handle.close();
|
|
834
|
+
}
|
|
803
835
|
break;
|
|
804
836
|
} catch (error) {
|
|
805
837
|
if (error.code !== "EEXIST") throw error;
|
|
806
838
|
try {
|
|
807
839
|
const info = await stat(lockPath);
|
|
808
840
|
if (Date.now() - info.mtimeMs > staleAfterMs) {
|
|
809
|
-
await rm(lockPath, { force: true });
|
|
841
|
+
await retryFileOperation(() => rm(lockPath, { force: true }));
|
|
810
842
|
continue;
|
|
811
843
|
}
|
|
812
844
|
} catch (statError) {
|
|
@@ -816,21 +848,18 @@ async function updateProjectFile(path, mutate) {
|
|
|
816
848
|
if (Date.now() - start > waitLimitMs) throw new Error(`project manifest is locked by another writer: ${lockPath}`);
|
|
817
849
|
await new Promise((r) => setTimeout(r, 25));
|
|
818
850
|
}
|
|
819
|
-
const tmpPath = `${projectPath}.${process.pid}.${randomUUID()}.tmp`;
|
|
820
851
|
try {
|
|
821
|
-
const parsed = validate("project", parseJson(await readFile(projectPath, "utf8")));
|
|
852
|
+
const parsed = validate("project", parseJson(await retryFileOperation(() => readFile(projectPath, "utf8"))));
|
|
822
853
|
if (!parsed.ok) throw new Error(parsed.formatted);
|
|
823
854
|
const manifest = parsed.value;
|
|
855
|
+
const before = JSON.stringify(manifest);
|
|
824
856
|
const next = mutate(manifest) ?? manifest;
|
|
825
857
|
const reparsed = validate("project", JSON.parse(JSON.stringify(next)));
|
|
826
858
|
if (!reparsed.ok) throw new Error(`project.json update produced an invalid manifest:\n${reparsed.formatted}`);
|
|
827
|
-
await
|
|
828
|
-
await writeFile(tmpPath, `${JSON.stringify(reparsed.value, null, 2)}\n`);
|
|
829
|
-
await rename(tmpPath, projectPath);
|
|
859
|
+
if (JSON.stringify(reparsed.value) !== before) await writeFileAtomic(projectPath, `${JSON.stringify(reparsed.value, null, 2)}\n`);
|
|
830
860
|
return reparsed.value;
|
|
831
861
|
} finally {
|
|
832
|
-
await rm(
|
|
833
|
-
await rm(lockPath, { force: true });
|
|
862
|
+
await retryFileOperation(() => rm(lockPath, { force: true }));
|
|
834
863
|
}
|
|
835
864
|
}
|
|
836
865
|
/**
|
|
@@ -1186,7 +1215,7 @@ async function importAsset(input) {
|
|
|
1186
1215
|
if (resolved.warning !== void 0) warnings.push(resolved.warning);
|
|
1187
1216
|
let registeredAssets = {};
|
|
1188
1217
|
if (projectPath !== void 0) {
|
|
1189
|
-
const project = validate("project", parseJson(await readFile(projectPath, "utf8")));
|
|
1218
|
+
const project = validate("project", parseJson(await retryFileOperation(() => readFile(projectPath, "utf8"))));
|
|
1190
1219
|
if (!project.ok) return {
|
|
1191
1220
|
ok: false,
|
|
1192
1221
|
error: project.formatted
|
|
@@ -1214,7 +1243,7 @@ async function importAsset(input) {
|
|
|
1214
1243
|
};
|
|
1215
1244
|
let existing;
|
|
1216
1245
|
try {
|
|
1217
|
-
existing = parseJson(await readFile(sidecarPath, "utf8"));
|
|
1246
|
+
existing = parseJson(await retryFileOperation(() => readFile(sidecarPath, "utf8")));
|
|
1218
1247
|
} catch (error) {
|
|
1219
1248
|
if (error.code !== "ENOENT" && !(error instanceof SyntaxError)) throw error;
|
|
1220
1249
|
}
|
|
@@ -1336,7 +1365,7 @@ async function importAsset(input) {
|
|
|
1336
1365
|
});
|
|
1337
1366
|
await mkdir(dir, { recursive: true });
|
|
1338
1367
|
const glb = await io.writeBinary(doc);
|
|
1339
|
-
await
|
|
1368
|
+
await writeFileAtomic(join(dir, "model.glb"), glb);
|
|
1340
1369
|
let trimeshHeader;
|
|
1341
1370
|
let collisionFile;
|
|
1342
1371
|
if (input.trimesh === true) {
|
|
@@ -1352,7 +1381,7 @@ async function importAsset(input) {
|
|
|
1352
1381
|
});
|
|
1353
1382
|
const encoded = encodeCollisionTrimesh(positions, new Uint32Array(allIndices));
|
|
1354
1383
|
collisionFile = "collision.bin";
|
|
1355
|
-
await
|
|
1384
|
+
await writeFileAtomic(join(dir, collisionFile), encoded.bin);
|
|
1356
1385
|
trimeshHeader = {
|
|
1357
1386
|
bin: collisionFile,
|
|
1358
1387
|
positions: encoded.positions,
|
|
@@ -1396,7 +1425,7 @@ async function importAsset(input) {
|
|
|
1396
1425
|
ok: false,
|
|
1397
1426
|
error: `sidecar failed self-validation:\n${checked.formatted}`
|
|
1398
1427
|
};
|
|
1399
|
-
await
|
|
1428
|
+
await writeFileAtomic(sidecarPath, `${JSON.stringify(checked.value, null, 2)}\n`);
|
|
1400
1429
|
try {
|
|
1401
1430
|
await stat(sidecarPath);
|
|
1402
1431
|
} catch (e) {
|
|
@@ -7730,9 +7759,12 @@ async function landmarkDocs(source) {
|
|
|
7730
7759
|
}
|
|
7731
7760
|
async function withLandmarks(loaded, own, options) {
|
|
7732
7761
|
const source = await providedBy("landmarks", own, options);
|
|
7733
|
-
|
|
7762
|
+
const fontSource = await providedBy("fonts", own, options);
|
|
7763
|
+
const fonts = fontSource ? await loadFontLibrary(await fontSource.pack.readJson(fontSource.path), (path) => fontSource.pack.readJson(fontSource.path.slice(0, fontSource.path.lastIndexOf("/") + 1) + path)) : void 0;
|
|
7764
|
+
return {
|
|
7734
7765
|
...loaded,
|
|
7735
|
-
landmarks: await landmarkDocs(source)
|
|
7766
|
+
...source ? { landmarks: await landmarkDocs(source) } : {},
|
|
7767
|
+
...fonts ? { fonts } : {}
|
|
7736
7768
|
};
|
|
7737
7769
|
}
|
|
7738
7770
|
async function stylePackAt(path) {
|
|
@@ -8310,6 +8342,7 @@ async function previewWorldgenImpl(input) {
|
|
|
8310
8342
|
filesBaseUrl,
|
|
8311
8343
|
assetIndex: stylePackAssetIndex(pack, filesBaseUrl),
|
|
8312
8344
|
landmarks,
|
|
8345
|
+
...loaded.fonts ? { fonts: loaded.fonts } : {},
|
|
8313
8346
|
materialRefs: [...new Set(output.buildings?.groups.map((group) => group.materialRef) ?? [])],
|
|
8314
8347
|
ground: {
|
|
8315
8348
|
y: groundY,
|