pixelkiln 0.53.0 → 0.53.2
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/cli.js +26 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +26 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/docs/TILES.md +49 -0
- package/package.json +1 -1
- package/skills/pixelkiln/references/pixellab-fidelity.md +4 -4
package/dist/cli.js
CHANGED
|
@@ -15596,6 +15596,25 @@ function normalizeTileRules(raw) {
|
|
|
15596
15596
|
raw
|
|
15597
15597
|
};
|
|
15598
15598
|
}
|
|
15599
|
+
function normalizeTerrainTiles(metadata) {
|
|
15600
|
+
if (!isRecord2(metadata) || !Array.isArray(metadata.terrainTiles)) return null;
|
|
15601
|
+
const terrains = Array.isArray(metadata.terrainTypes) ? metadata.terrainTypes.filter((item) => typeof item === "string") : [];
|
|
15602
|
+
if (terrains.length < 2) return null;
|
|
15603
|
+
const masks = {};
|
|
15604
|
+
metadata.terrainTiles.forEach((tile, index) => {
|
|
15605
|
+
if (!isRecord2(tile) || !isRecord2(tile.corners)) return;
|
|
15606
|
+
const corners = tile.corners;
|
|
15607
|
+
const bit = (corner) => corners[corner] === terrains[0] ? 1 : 0;
|
|
15608
|
+
masks[index] = bit("NW") << 3 | bit("NE") << 2 | bit("SW") << 1 | bit("SE");
|
|
15609
|
+
});
|
|
15610
|
+
return {
|
|
15611
|
+
ruleType: "corner",
|
|
15612
|
+
arity: 4,
|
|
15613
|
+
terrains,
|
|
15614
|
+
masks,
|
|
15615
|
+
raw: metadata
|
|
15616
|
+
};
|
|
15617
|
+
}
|
|
15599
15618
|
function exportTileset(entry, spec, options) {
|
|
15600
15619
|
let outputs = resolveSpecEntryOutputs(entry, spec);
|
|
15601
15620
|
if (!outputs.length) throw new Error(`${spec.styleId}/${spec.assetId} has no downloaded outputs`);
|
|
@@ -15616,14 +15635,16 @@ function exportTileset(entry, spec, options) {
|
|
|
15616
15635
|
}
|
|
15617
15636
|
const metadata = entry.providerMetadata?.[entry.provider];
|
|
15618
15637
|
const rawRules = isRecord2(metadata) ? metadata.tileRules : void 0;
|
|
15619
|
-
const
|
|
15638
|
+
const terrainRules = normalizeTerrainTiles(metadata);
|
|
15639
|
+
const rules = normalizeTileRules(rawRules) ?? terrainRules;
|
|
15640
|
+
const providerRules = isRecord2(rawRules) ? rawRules : terrainRules ? metadata : null;
|
|
15620
15641
|
const frames = packed.atlas.frames;
|
|
15621
15642
|
const generic = buildGeneric(
|
|
15622
15643
|
spec,
|
|
15623
15644
|
options.imageName,
|
|
15624
15645
|
packed.atlas,
|
|
15625
15646
|
frames,
|
|
15626
|
-
|
|
15647
|
+
providerRules,
|
|
15627
15648
|
rules
|
|
15628
15649
|
);
|
|
15629
15650
|
if (options.format === "generic") {
|
|
@@ -15636,7 +15657,7 @@ function exportTileset(entry, spec, options) {
|
|
|
15636
15657
|
};
|
|
15637
15658
|
}
|
|
15638
15659
|
assertUniformTiles(generic);
|
|
15639
|
-
if ((rawRules !== void 0 || entry.tileFeature) && !rules) {
|
|
15660
|
+
if ((rawRules !== void 0 || entry.tileFeature || entry.generator === "terrain") && !rules) {
|
|
15640
15661
|
throw new Error(
|
|
15641
15662
|
`${options.format} export needs recognized adjacency rules; use --format generic to retain this provider rule object without guessing`
|
|
15642
15663
|
);
|
|
@@ -16096,13 +16117,13 @@ async function runExport(args) {
|
|
|
16096
16117
|
const format = args.format ?? "generic";
|
|
16097
16118
|
const manifestDir = path38.dirname(path38.resolve(args.manifest));
|
|
16098
16119
|
const selected = specs.filter((spec) => {
|
|
16099
|
-
if (spec.generator !== "tiles") return false;
|
|
16120
|
+
if (spec.generator !== "tiles" && spec.generator !== "terrain") return false;
|
|
16100
16121
|
if (args.styles.length && !args.styles.includes(spec.styleId)) return false;
|
|
16101
16122
|
if (args.assets.length && !args.assets.includes(spec.assetId)) return false;
|
|
16102
16123
|
return Boolean(lock.entries[lockKey(spec.styleId, spec.assetId)]);
|
|
16103
16124
|
});
|
|
16104
16125
|
if (!selected.length) {
|
|
16105
|
-
throw new Error("No downloaded tiles entries match the requested --style/--only filters.");
|
|
16126
|
+
throw new Error("No downloaded tiles/terrain entries match the requested --style/--only filters.");
|
|
16106
16127
|
}
|
|
16107
16128
|
if (args.out && selected.length > 1) {
|
|
16108
16129
|
throw new Error("--out can name one tileset only; add --style/--only to select one asset.");
|