@forgeax/engine-gltf 0.1.27 → 0.1.28
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/README.md +12 -10
- package/dist/cli-gltf.d.ts.map +1 -1
- package/dist/cli-gltf.mjs +13 -13
- package/dist/cli-gltf.mjs.map +1 -1
- package/dist/importer-entry.mjs +3 -3
- package/dist/importer-entry.mjs.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/node-file-entry.mjs +3 -3
- package/dist/node-file-entry.mjs.map +1 -1
- package/package.json +13 -16
- package/src/__tests__/cli-gltf.integration.test.ts +1 -1
- package/src/__tests__/gltf.unit.test.ts +1 -1
- package/src/cli-gltf.ts +16 -18
- package/src/errors.ts +3 -3
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ reflection, Pack refs, Catalog/load, and runtime sampling.
|
|
|
51
51
|
> structured `material-tangent-required` error. The importer persists generated
|
|
52
52
|
> tangents in `MeshAsset.attributes.tangent` and never writes an identity guess.
|
|
53
53
|
|
|
54
|
-
> Runtime glTF 2.0 importer (Tier-C subset). Pure-function pipeline `parseGlb` / `parseGltf` / `toAssetPack`
|
|
54
|
+
> Runtime glTF 2.0 importer (Tier-C subset). Pure-function pipeline `parseGlb` / `parseGltf` / `toAssetPack` is selected by the unified `forgeax asset import` producer, which writes `<source>.meta.json` (external-asset-package; dispatch on top-level `importer: 'gltf'`); runtime spawn happens via the existing `loadByGuid<SceneAsset>` plus `world.instantiateScene` 4-step recipe (no `loadGltf(url)` parallel API).
|
|
55
55
|
|
|
56
56
|
> [!IMPORTANT]
|
|
57
57
|
> `toAssetPack` and `reimportReuseMeta` return `Result` values. The producer derives semantic `sourceKey` values before GUID reuse; duplicate or ambiguous identities return `duplicate-source-key` / `ambiguous-source-key` and the CLI leaves the previous sidecar untouched. `sourceIndex` is a locator only, never a generated identity.
|
|
@@ -248,19 +248,21 @@ const root = engine.assets.instantiate(sceneResult.value, world);
|
|
|
248
248
|
// equivalent to world.instantiateScene(handle).
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
-
##
|
|
251
|
+
## Unified asset producer
|
|
252
252
|
|
|
253
|
-
The
|
|
253
|
+
The glTF producer is selected by the unified `asset import` command. DevKit
|
|
254
|
+
loads this package's producer only when a `.gltf` or `.glb` source is passed;
|
|
255
|
+
the package no longer publishes an independent executable.
|
|
254
256
|
|
|
255
257
|
| Subcommand | Description | Exit code |
|
|
256
258
|
|:--|:--|:--|
|
|
257
|
-
| `forgeax
|
|
258
|
-
| `forgeax
|
|
259
|
+
| `forgeax asset import <path> --root <project>` | Parse `.gltf` / `.glb`; write sidecar `<source>.meta.json` (top-level `importer: 'gltf'`) next to source; UUIDv7 GUIDs assigned per sub-asset in document order | 0 success / 1 `GltfError` |
|
|
260
|
+
| `forgeax asset import <path> --dry-run --root <project>` | Validate the producer path without writing a sidecar | 0 if valid / 1 if missing or invalid |
|
|
259
261
|
|
|
260
262
|
```bash
|
|
261
|
-
#
|
|
262
|
-
forgeax
|
|
263
|
-
forgeax
|
|
263
|
+
# Unified invocation
|
|
264
|
+
forgeax asset import apps/hello/gltf/assets/box.glb --root ./game --json
|
|
265
|
+
forgeax asset import apps/hello/gltf/assets/ --dry-run --root ./game --json
|
|
264
266
|
```
|
|
265
267
|
|
|
266
268
|
### End-to-end source-to-Pack route
|
|
@@ -270,14 +272,14 @@ Pack/DDC publication path. Keep these steps together when adding a glTF LOD:
|
|
|
270
272
|
|
|
271
273
|
```mermaid
|
|
272
274
|
flowchart LR
|
|
273
|
-
source["source .gltf/.glb"] --> cli["
|
|
275
|
+
source["source .gltf/.glb"] --> cli["forgeax asset import"]
|
|
274
276
|
cli --> meta["source.meta.json"]
|
|
275
277
|
meta --> registry["ImporterRegistry + gltfImporter"]
|
|
276
278
|
registry --> runner["runImport"]
|
|
277
279
|
runner --> pack["Pack/DDC + Catalog"]
|
|
278
280
|
```
|
|
279
281
|
|
|
280
|
-
1. Run `forgeax
|
|
282
|
+
1. Run `forgeax asset import <source> --root <project>` to create or refresh the
|
|
281
283
|
adjacent `<source>.meta.json` and its stable sub-asset GUIDs.
|
|
282
284
|
2. Register `gltfImporter` with the build-time `ImporterRegistry` and pass the
|
|
283
285
|
sidecar to `runImport`; this validates the declared LOD GUID closure and
|
package/dist/cli-gltf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-gltf.d.ts","sourceRoot":"","sources":["../src/cli-gltf.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli-gltf.d.ts","sourceRoot":"","sources":["../src/cli-gltf.ts"],"names":[],"mappings":";AA8BA,UAAU,QAAQ;IAChB,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAkCD,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAe/E"}
|
package/dist/cli-gltf.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var GLTF_MESHOPT_FILTERS = ["NONE", "OCTAHEDRAL", "QUATERNION", "EXPONENTIAL"];
|
|
|
14
14
|
var gltfErrorPolicy = {
|
|
15
15
|
"gltf-malformed-header": {
|
|
16
16
|
expected: "GLB 12-byte header (magic 0x46546C67 + version=2 + length) plus mandatory JSON chunk",
|
|
17
|
-
hint: "verify .glb is not truncated; rerun: forgeax
|
|
17
|
+
hint: "verify .glb is not truncated; rerun: forgeax asset import <path> --root <project> --json"
|
|
18
18
|
},
|
|
19
19
|
"gltf-version-unsupported": {
|
|
20
20
|
expected: 'asset.version === "2.0"',
|
|
@@ -50,7 +50,7 @@ var gltfErrorPolicy = {
|
|
|
50
50
|
},
|
|
51
51
|
"gltf-meta-missing": {
|
|
52
52
|
expected: "sidecar <source>.meta.json (importer: 'gltf') present in same directory",
|
|
53
|
-
hint: "run: forgeax
|
|
53
|
+
hint: "run: forgeax asset import <path> --root <project> --json"
|
|
54
54
|
},
|
|
55
55
|
"gltf-instancing-count-mismatch": {
|
|
56
56
|
expected: "all instance attribute accessors share the same count",
|
|
@@ -78,7 +78,7 @@ var gltfErrorPolicy = {
|
|
|
78
78
|
},
|
|
79
79
|
"gltf-image-extract-failed": {
|
|
80
80
|
expected: "image bytes extractable from bufferView / data-URI / external URI without corruption",
|
|
81
|
-
hint: "verify the bufferView byte range / data: URI base64 / external URI sibling file is intact next to the .gltf source; rerun: forgeax
|
|
81
|
+
hint: "verify the bufferView byte range / data: URI base64 / external URI sibling file is intact next to the .gltf source; rerun: forgeax asset import <path> --root <project> --json"
|
|
82
82
|
},
|
|
83
83
|
"gltf-skin-attr-asymmetric": {
|
|
84
84
|
expected: "mesh primitive declares JOINTS_0 and WEIGHTS_0 symmetrically (both present or both absent)",
|
|
@@ -2612,14 +2612,14 @@ function emitError(ctx, err3) {
|
|
|
2612
2612
|
}
|
|
2613
2613
|
function helpBody() {
|
|
2614
2614
|
return [
|
|
2615
|
-
"forgeax
|
|
2615
|
+
"forgeax asset import \u2014 glTF / GLB sidecar importer (internal producer)",
|
|
2616
2616
|
"",
|
|
2617
2617
|
"Usage:",
|
|
2618
|
-
" forgeax
|
|
2619
|
-
" forgeax
|
|
2618
|
+
" forgeax asset import <path.gltf|path.glb> --root <project>",
|
|
2619
|
+
" forgeax asset import <dir> --dry-run --root <project>",
|
|
2620
2620
|
"",
|
|
2621
|
-
"
|
|
2622
|
-
"
|
|
2621
|
+
"produces texture, mesh, material, and scene sub-asset entries in a sibling",
|
|
2622
|
+
"<source>.meta.json sidecar.",
|
|
2623
2623
|
""
|
|
2624
2624
|
].join("\n");
|
|
2625
2625
|
}
|
|
@@ -2633,7 +2633,7 @@ async function runCliGltf(rest, ctx) {
|
|
|
2633
2633
|
return emitError(ctx, {
|
|
2634
2634
|
code: "unknown-subcommand",
|
|
2635
2635
|
expected: "subcommand 'import'",
|
|
2636
|
-
hint: "run 'forgeax
|
|
2636
|
+
hint: "run 'forgeax help asset import' for usage",
|
|
2637
2637
|
detail: { subcommand: sub }
|
|
2638
2638
|
});
|
|
2639
2639
|
}
|
|
@@ -2655,8 +2655,8 @@ async function runImport(rest, ctx) {
|
|
|
2655
2655
|
const message = e instanceof Error ? e.message : String(e);
|
|
2656
2656
|
return emitError(ctx, {
|
|
2657
2657
|
code: "cli-parse-error",
|
|
2658
|
-
expected: "forgeax
|
|
2659
|
-
hint: "run 'forgeax
|
|
2658
|
+
expected: "forgeax asset import [--dry-run] <path> --root <project>",
|
|
2659
|
+
hint: "run 'forgeax help asset import' for usage",
|
|
2660
2660
|
detail: { message }
|
|
2661
2661
|
});
|
|
2662
2662
|
}
|
|
@@ -2664,7 +2664,7 @@ async function runImport(rest, ctx) {
|
|
|
2664
2664
|
if (target === void 0) {
|
|
2665
2665
|
return emitError(ctx, {
|
|
2666
2666
|
code: "cli-parse-error",
|
|
2667
|
-
expected: check ? "forgeax
|
|
2667
|
+
expected: check ? "forgeax asset import <dir> --dry-run --root <project>" : "forgeax asset import <path.gltf|path.glb> --root <project>",
|
|
2668
2668
|
hint: "pass a positional <gltf-or-glb> argument; with --check pass a directory"
|
|
2669
2669
|
});
|
|
2670
2670
|
}
|
|
@@ -2730,7 +2730,7 @@ async function runCheck(target, ctx) {
|
|
|
2730
2730
|
const message = e instanceof Error ? e.message : String(e);
|
|
2731
2731
|
return emitError(ctx, {
|
|
2732
2732
|
code: "cli-parse-error",
|
|
2733
|
-
expected: "forgeax
|
|
2733
|
+
expected: "forgeax asset import <dir> --dry-run --root <project>",
|
|
2734
2734
|
hint: "pass a directory that exists and is readable",
|
|
2735
2735
|
detail: { path: target, message }
|
|
2736
2736
|
});
|