pixelkiln 0.97.0 → 0.99.0
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 +1 -1
- package/dist/cli.js +312 -19
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +281 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1094 -50
- package/dist/index.d.ts +1094 -50
- package/dist/index.js +277 -11
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +27 -4
- package/docs/ENDPOINTS.md +82 -3
- package/docs/GENERATORS.md +2 -2
- package/docs/MANIFEST.md +7 -0
- package/docs/PIXELLAB.md +2 -2
- package/docs/REVISIONS.md +9 -1
- package/docs/TILES.md +29 -0
- package/package.json +1 -1
- package/schema/manifest.schema.json +119 -0
- package/schema/recipe.schema.json +29 -0
- package/skills/pixelkiln/references/pixellab.md +1 -1
package/dist/index.cjs
CHANGED
|
@@ -106,9 +106,12 @@ __export(index_exports, {
|
|
|
106
106
|
MediaType: () => MediaType,
|
|
107
107
|
NORMAL_MAP_CONVENTIONS: () => NORMAL_MAP_CONVENTIONS,
|
|
108
108
|
NORMAL_MAP_COST_GENERATIONS: () => NORMAL_MAP_COST_GENERATIONS,
|
|
109
|
+
NORMAL_MAP_KINDS: () => NORMAL_MAP_KINDS,
|
|
109
110
|
NORMAL_MAP_MAX_FRAMES: () => NORMAL_MAP_MAX_FRAMES,
|
|
110
111
|
NORMAL_MAP_MAX_SIDE: () => NORMAL_MAP_MAX_SIDE,
|
|
111
112
|
NORMAL_MAP_MIN_SIDE: () => NORMAL_MAP_MIN_SIDE,
|
|
113
|
+
NORMAL_MAP_MODES: () => NORMAL_MAP_MODES,
|
|
114
|
+
NORMAL_MAP_SHAPE_RANGES: () => NORMAL_MAP_SHAPE_RANGES,
|
|
112
115
|
NormalMapConventionSchema: () => NormalMapConventionSchema,
|
|
113
116
|
OverwriteRefusedError: () => OverwriteRefusedError,
|
|
114
117
|
PIXELATE_COST_GENERATIONS: () => PIXELATE_COST_GENERATIONS,
|
|
@@ -276,6 +279,7 @@ __export(index_exports, {
|
|
|
276
279
|
mountStyle: () => mountStyle,
|
|
277
280
|
musicCost: () => musicCost,
|
|
278
281
|
musicOutputPaths: () => musicOutputPaths,
|
|
282
|
+
normalMapCost: () => normalMapCost,
|
|
279
283
|
normalMapFile: () => normalMapFile,
|
|
280
284
|
normalMapResultPng: () => normalMapResultPng,
|
|
281
285
|
normalMapSizeProblem: () => normalMapSizeProblem,
|
|
@@ -535,7 +539,7 @@ function terrainTileCount(transitionSize, mode2, orientation) {
|
|
|
535
539
|
return transitionSize === 1 ? 25 : 16;
|
|
536
540
|
}
|
|
537
541
|
function terrainCost(mode2, tileSize, orientation) {
|
|
538
|
-
if (orientation === "sidescroller") return
|
|
542
|
+
if (orientation === "sidescroller") return mode2 === "pro" ? 15 : 1;
|
|
539
543
|
if (mode2 === "pro") return tileSize <= 32 ? 15 : 25;
|
|
540
544
|
return 4;
|
|
541
545
|
}
|
|
@@ -961,6 +965,24 @@ var RevisionSchema = import_zod.z.object({
|
|
|
961
965
|
removalTask: import_zod.z.enum(["simple", "complex"]).optional(),
|
|
962
966
|
/** `normal-map` only: `opengl` (green up; PixelLab's default) or `directx` (green down, for Unreal). */
|
|
963
967
|
convention: NormalMapConventionSchema.optional(),
|
|
968
|
+
/**
|
|
969
|
+
* `normal-map` only: `lite` (PixelLab's default, 0.1 generation) makes the
|
|
970
|
+
* map from the art alone; `pro` (0.5) plans each part's shape, what is in
|
|
971
|
+
* front and what is sunk.
|
|
972
|
+
*/
|
|
973
|
+
normalMapMode: import_zod.z.enum(["lite", "pro"]).optional(),
|
|
974
|
+
/** `normal-map` only: what the picture is. Left out, PixelLab reads it from the picture; set it for sidescroller, isometric and UI art. */
|
|
975
|
+
normalMapKind: import_zod.z.enum(["character", "object", "topdown", "side", "iso", "ui"]).optional(),
|
|
976
|
+
/** `normal-map` only: how far every pixel tilts away from facing the viewer, 0 to 2 (the API refuses more). */
|
|
977
|
+
normalMapStrength: import_zod.z.number().min(0).max(2).optional(),
|
|
978
|
+
/** `normal-map` only: how much the outline rounds off, 0 to 3; 0 keeps it flat to the edge. */
|
|
979
|
+
outlineRounding: import_zod.z.number().min(0).max(3).optional(),
|
|
980
|
+
/** `normal-map` only: how much the sprite's 3D parts (a round head, an arm) add, 0 to 2. */
|
|
981
|
+
partShapes: import_zod.z.number().min(0).max(2).optional(),
|
|
982
|
+
/** `normal-map` only: the art's own light and dark as bumps, 0 to 2; 0 for a smooth surface. */
|
|
983
|
+
surfaceDetail: import_zod.z.number().min(0).max(2).optional(),
|
|
984
|
+
/** `normal-map` only: how far that detail is blurred, 0.6 to 3 px. */
|
|
985
|
+
detailSoftness: import_zod.z.number().min(0.6).max(3).optional(),
|
|
964
986
|
/**
|
|
965
987
|
* `animate-skeleton`: what the character *looks like*, a noun
|
|
966
988
|
* phrase (colours, clothing, held items) — distinct from the asset's
|
|
@@ -1121,6 +1143,15 @@ var RevisionSchema = import_zod.z.object({
|
|
|
1121
1143
|
path: ["convention"]
|
|
1122
1144
|
});
|
|
1123
1145
|
}
|
|
1146
|
+
for (const field of ["normalMapMode", "normalMapKind", "normalMapStrength", "outlineRounding", "partShapes", "surfaceDetail", "detailSoftness"]) {
|
|
1147
|
+
if (revision[field] !== void 0 && revision.mode !== "normal-map") {
|
|
1148
|
+
context.addIssue({
|
|
1149
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
1150
|
+
message: `${field} applies to normal-map revisions only`,
|
|
1151
|
+
path: [field]
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1124
1155
|
if (revision.description !== void 0 && revision.mode !== "animate-skeleton" && revision.mode !== "remove-background") {
|
|
1125
1156
|
context.addIssue({
|
|
1126
1157
|
code: import_zod.z.ZodIssueCode.custom,
|
|
@@ -1323,6 +1354,48 @@ var StyleObjectSchema = import_zod.z.object({
|
|
|
1323
1354
|
* lower terrain between them.
|
|
1324
1355
|
*/
|
|
1325
1356
|
terrainConnectDiagonals: import_zod.z.boolean().optional(),
|
|
1357
|
+
/**
|
|
1358
|
+
* `terrain` generator only, standard mode, top-down. Which ragged border
|
|
1359
|
+
* `terrainRaggedness` draws, 0 to 99 (the website's Reshuffle): another
|
|
1360
|
+
* number gives a different boundary at the same raggedness. API default 0.
|
|
1361
|
+
*/
|
|
1362
|
+
terrainShapeSeed: import_zod.z.number().int().min(0).max(99).optional(),
|
|
1363
|
+
/**
|
|
1364
|
+
* `terrain` generator only, standard mode, top-down, with
|
|
1365
|
+
* `terrainTransitionSize` above 0. How thick the wall reads on the top
|
|
1366
|
+
* rim and down both sides of the front face, 0 to 1. The website starts
|
|
1367
|
+
* at 0.1.
|
|
1368
|
+
*/
|
|
1369
|
+
terrainSideWallThickness: import_zod.z.number().min(0).max(1).optional(),
|
|
1370
|
+
/**
|
|
1371
|
+
* `terrain` generator only, standard mode, top-down, with
|
|
1372
|
+
* `terrainTransitionSize` above 0. Which side of the border the wall sits
|
|
1373
|
+
* on: 0 sticks out past the terrain (the API default), 1 is carved into
|
|
1374
|
+
* it so the shape stays put. The website starts at 0.5.
|
|
1375
|
+
*/
|
|
1376
|
+
terrainSideWallPlacement: import_zod.z.number().min(0).max(1).optional(),
|
|
1377
|
+
/**
|
|
1378
|
+
* `terrain` generator only, standard mode. PixelLab rewrites the terrain
|
|
1379
|
+
* descriptions and picks base colors before drawing unless this is
|
|
1380
|
+
* false. On by default upstream; set false to have your wording used as
|
|
1381
|
+
* written.
|
|
1382
|
+
*/
|
|
1383
|
+
terrainEnhance: import_zod.z.boolean().optional(),
|
|
1384
|
+
/**
|
|
1385
|
+
* `terrain` generator only, a standard sidescroller set. How thick the
|
|
1386
|
+
* platform body is, 0 thin to 1 thick. Left out, PixelLab fits it to
|
|
1387
|
+
* `terrainTransitionSize`.
|
|
1388
|
+
*/
|
|
1389
|
+
terrainPlatformThickness: import_zod.z.number().min(0).max(1).optional(),
|
|
1390
|
+
/**
|
|
1391
|
+
* `terrain` generator only, top-down. Whether each terrain can be walked
|
|
1392
|
+
* on, stored with the set for PixelLab's maps and engine exports (left
|
|
1393
|
+
* out, those guess from the terrain's name). They change no pixel, so
|
|
1394
|
+
* they are sent when the set is generated and are not part of its
|
|
1395
|
+
* identity: changing one later does not make the set stale.
|
|
1396
|
+
*/
|
|
1397
|
+
terrainLowerWalkable: import_zod.z.boolean().optional(),
|
|
1398
|
+
terrainUpperWalkable: import_zod.z.boolean().optional(),
|
|
1326
1399
|
/**
|
|
1327
1400
|
* `terrain` generator only. Visual height of the step between lower and
|
|
1328
1401
|
* upper terrain. Without `terrainShapeStyle`, only 0, 0.25, 0.5, or 1 are
|
|
@@ -1715,6 +1788,18 @@ var AssetSchema = import_zod.z.object({
|
|
|
1715
1788
|
* (a sword hand, a parted fringe) comes out the other way round.
|
|
1716
1789
|
*/
|
|
1717
1790
|
mirror: import_zod.z.string().min(1).optional(),
|
|
1791
|
+
/**
|
|
1792
|
+
* `terrain` styles only: a PNG per terrain for PixelLab to take that
|
|
1793
|
+
* terrain's look from, paths relative to the manifest. Top-down sets
|
|
1794
|
+
* take `lower`, `upper` and `transition`. A sidescroller set takes
|
|
1795
|
+
* `lower` (the platform body, pro mode) or `transition` (the surface
|
|
1796
|
+
* layer, standard mode), each a square PNG of the tile size.
|
|
1797
|
+
*/
|
|
1798
|
+
terrainReferences: import_zod.z.object({
|
|
1799
|
+
lower: import_zod.z.string().min(1).optional(),
|
|
1800
|
+
upper: import_zod.z.string().min(1).optional(),
|
|
1801
|
+
transition: import_zod.z.string().min(1).optional()
|
|
1802
|
+
}).strict().optional(),
|
|
1718
1803
|
/** Made from existing pixels by a local transform; see AssetDeriveSchema. Free; the provider is never called. */
|
|
1719
1804
|
derive: AssetDeriveSchema.optional(),
|
|
1720
1805
|
/** Built by a tool outside pixelkiln; see AssetExternalSchema. Never generated. */
|
|
@@ -2738,7 +2823,12 @@ function refusalReason(status, body) {
|
|
|
2738
2823
|
if (status < 400 || status >= 500 || !body.startsWith("{")) return "";
|
|
2739
2824
|
try {
|
|
2740
2825
|
const detail = JSON.parse(body).detail;
|
|
2741
|
-
|
|
2826
|
+
if (typeof detail === "string" && detail) return `: ${detail.slice(0, 400)}`;
|
|
2827
|
+
if (Array.isArray(detail)) {
|
|
2828
|
+
const messages = detail.map((item) => item && typeof item === "object" && typeof item.msg === "string" ? item.msg : "").filter(Boolean).map((msg) => msg.replace(/^Value error, /, ""));
|
|
2829
|
+
if (messages.length) return `: ${messages.join("; ").slice(0, 400)}`;
|
|
2830
|
+
}
|
|
2831
|
+
return "";
|
|
2742
2832
|
} catch {
|
|
2743
2833
|
return "";
|
|
2744
2834
|
}
|
|
@@ -2772,6 +2862,14 @@ function targetPaletteBody(palette) {
|
|
|
2772
2862
|
}
|
|
2773
2863
|
};
|
|
2774
2864
|
}
|
|
2865
|
+
var NORMAL_MAP_MODES = ["lite", "pro"];
|
|
2866
|
+
var NORMAL_MAP_KINDS = ["character", "object", "topdown", "side", "iso", "ui"];
|
|
2867
|
+
var NORMAL_MAP_SHAPE_RANGES = {
|
|
2868
|
+
outlineRounding: [0, 3],
|
|
2869
|
+
partShapes: [0, 2],
|
|
2870
|
+
surfaceDetail: [0, 2],
|
|
2871
|
+
detailSoftness: [0.6, 3]
|
|
2872
|
+
};
|
|
2775
2873
|
var PixelLabClient = class {
|
|
2776
2874
|
constructor(apiKey, timeoutMs = 12e4) {
|
|
2777
2875
|
this.apiKey = apiKey;
|
|
@@ -2940,6 +3038,16 @@ var PixelLabClient = class {
|
|
|
2940
3038
|
lower_description: args.lowerDescription,
|
|
2941
3039
|
upper_description: args.upperDescription
|
|
2942
3040
|
};
|
|
3041
|
+
const image = (value) => ({ type: "base64", base64: value.base64, format: value.format });
|
|
3042
|
+
if (args.shapeSeed != null) body.shape_seed = args.shapeSeed;
|
|
3043
|
+
if (args.sideWallThickness != null) body.side_wall_thickness = args.sideWallThickness;
|
|
3044
|
+
if (args.sideWallPlacement != null) body.side_wall_placement = args.sideWallPlacement;
|
|
3045
|
+
if (args.enhance != null) body.enhance = args.enhance;
|
|
3046
|
+
if (args.lowerWalkable != null) body.lower_walkable = args.lowerWalkable;
|
|
3047
|
+
if (args.upperWalkable != null) body.upper_walkable = args.upperWalkable;
|
|
3048
|
+
if (args.lowerReferenceImage) body.lower_reference_image = image(args.lowerReferenceImage);
|
|
3049
|
+
if (args.upperReferenceImage) body.upper_reference_image = image(args.upperReferenceImage);
|
|
3050
|
+
if (args.transitionReferenceImage) body.transition_reference_image = image(args.transitionReferenceImage);
|
|
2943
3051
|
if (args.transitionDescription) body.transition_description = args.transitionDescription;
|
|
2944
3052
|
if (args.lowerBaseTileId) body.lower_base_tile_id = args.lowerBaseTileId;
|
|
2945
3053
|
if (args.upperBaseTileId) body.upper_base_tile_id = args.upperBaseTileId;
|
|
@@ -2977,6 +3085,12 @@ var PixelLabClient = class {
|
|
|
2977
3085
|
*/
|
|
2978
3086
|
async createTilesetSidescroller(args) {
|
|
2979
3087
|
const body = { lower_description: args.lowerDescription };
|
|
3088
|
+
const image = (value) => ({ type: "base64", base64: value.base64, format: value.format });
|
|
3089
|
+
if (args.mode) body.mode = args.mode;
|
|
3090
|
+
if (args.enhance != null) body.enhance = args.enhance;
|
|
3091
|
+
if (args.platformThickness != null) body.platform_thickness = args.platformThickness;
|
|
3092
|
+
if (args.transitionReferenceImage) body.transition_reference_image = image(args.transitionReferenceImage);
|
|
3093
|
+
if (args.lowerReferenceImage) body.lower_reference_image = image(args.lowerReferenceImage);
|
|
2980
3094
|
if (args.transitionDescription) body.transition_description = args.transitionDescription;
|
|
2981
3095
|
if (args.lowerBaseTileId) body.lower_base_tile_id = args.lowerBaseTileId;
|
|
2982
3096
|
if (args.tileSize != null) body.tile_size = { width: args.tileSize, height: args.tileSize };
|
|
@@ -3834,8 +3948,15 @@ var PixelLabClient = class {
|
|
|
3834
3948
|
*/
|
|
3835
3949
|
async normalMap(args) {
|
|
3836
3950
|
const body = { image: args.image };
|
|
3951
|
+
if (args.mode) body.mode = args.mode;
|
|
3952
|
+
if (args.kind) body.kind = args.kind;
|
|
3953
|
+
if (args.shape?.strength != null) body.strength = args.shape.strength;
|
|
3837
3954
|
if (args.frames != null && args.frames !== 1) body.frames = args.frames;
|
|
3838
3955
|
if (args.convention) body.convention = args.convention;
|
|
3956
|
+
if (args.shape?.outlineRounding != null) body.outline_rounding = args.shape.outlineRounding;
|
|
3957
|
+
if (args.shape?.partShapes != null) body.part_shapes = args.shape.partShapes;
|
|
3958
|
+
if (args.shape?.surfaceDetail != null) body.surface_detail = args.shape.surfaceDetail;
|
|
3959
|
+
if (args.shape?.detailSoftness != null) body.detail_softness = args.shape.detailSoftness;
|
|
3839
3960
|
return validateResponse(
|
|
3840
3961
|
RevisionJobSubmitSchema,
|
|
3841
3962
|
await this.request("/normal-map", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -4952,6 +5073,21 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
|
|
|
4952
5073
|
terrainBoundarySeed: spec.terrainBoundarySeed,
|
|
4953
5074
|
terrainStepSlope: spec.terrainStepSlope,
|
|
4954
5075
|
terrainConnectDiagonals: spec.terrainConnectDiagonals,
|
|
5076
|
+
// Added after the fields above, each only when set, so no terrain entry
|
|
5077
|
+
// written before them changes hash. The walkable flags change no pixel
|
|
5078
|
+
// and are deliberately not here.
|
|
5079
|
+
terrainShapeSeed: spec.terrainShapeSeed,
|
|
5080
|
+
terrainSideWallThickness: spec.terrainSideWallThickness,
|
|
5081
|
+
terrainSideWallPlacement: spec.terrainSideWallPlacement,
|
|
5082
|
+
terrainEnhance: spec.terrainEnhance,
|
|
5083
|
+
terrainPlatformThickness: spec.terrainPlatformThickness,
|
|
5084
|
+
// Reference images enter as their bytes' hashes, never their paths.
|
|
5085
|
+
terrainReferences: spec.terrainReferences && Object.keys(spec.terrainReferences).length ? Object.fromEntries(
|
|
5086
|
+
["lower", "upper", "transition"].flatMap((side) => {
|
|
5087
|
+
const reference = spec.terrainReferences[side];
|
|
5088
|
+
return reference ? [[side, reference.sha256]] : [];
|
|
5089
|
+
})
|
|
5090
|
+
) : void 0,
|
|
4955
5091
|
// "top-down" is the default and draws the same set as leaving it out.
|
|
4956
5092
|
terrainOrientation: spec.terrainOrientation === "sidescroller" ? spec.terrainOrientation : void 0,
|
|
4957
5093
|
// Which set and which of its terrains, not that terrain's id: the id
|
|
@@ -5084,6 +5220,14 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
|
|
|
5084
5220
|
description: spec.revision.description,
|
|
5085
5221
|
removalTask: spec.revision.removalTask,
|
|
5086
5222
|
convention: spec.revision.convention,
|
|
5223
|
+
// Each only when set, so normal-map revisions made before them keep their hash.
|
|
5224
|
+
normalMapMode: spec.revision.normalMapMode,
|
|
5225
|
+
normalMapKind: spec.revision.normalMapKind,
|
|
5226
|
+
normalMapStrength: spec.revision.normalMapStrength,
|
|
5227
|
+
outlineRounding: spec.revision.outlineRounding,
|
|
5228
|
+
partShapes: spec.revision.partShapes,
|
|
5229
|
+
surfaceDetail: spec.revision.surfaceDetail,
|
|
5230
|
+
detailSoftness: spec.revision.detailSoftness,
|
|
5087
5231
|
driftThreshold: spec.revision.driftThreshold,
|
|
5088
5232
|
subjectDescription: spec.revision.subjectDescription,
|
|
5089
5233
|
initialPose: spec.revision.initialPose,
|
|
@@ -5860,6 +6004,9 @@ async function pixelateFile(client2, input, opts = {}) {
|
|
|
5860
6004
|
await sleep3(interval);
|
|
5861
6005
|
}
|
|
5862
6006
|
}
|
|
6007
|
+
function normalMapCost(mode2) {
|
|
6008
|
+
return mode2 === "pro" ? 0.5 : 0.1;
|
|
6009
|
+
}
|
|
5863
6010
|
var NORMAL_MAP_COST_GENERATIONS = 0.5;
|
|
5864
6011
|
var NORMAL_MAP_MIN_SIDE = 8;
|
|
5865
6012
|
var NORMAL_MAP_MAX_SIDE = 512;
|
|
@@ -5904,7 +6051,10 @@ async function normalMapFile(client2, input, opts = {}) {
|
|
|
5904
6051
|
const submitted = await client2.normalMap({
|
|
5905
6052
|
image: { base64: bytes.toString("base64"), format: "png" },
|
|
5906
6053
|
frames,
|
|
5907
|
-
convention: opts.convention
|
|
6054
|
+
convention: opts.convention,
|
|
6055
|
+
shape: opts.shape,
|
|
6056
|
+
mode: opts.mode,
|
|
6057
|
+
kind: opts.kind
|
|
5908
6058
|
});
|
|
5909
6059
|
const jobId = submitted.background_job_id;
|
|
5910
6060
|
const started = Date.now();
|
|
@@ -6169,7 +6319,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6169
6319
|
return { unit: "generations", amount: 1, candidates: 1 };
|
|
6170
6320
|
}
|
|
6171
6321
|
if (spec.revision?.mode === "normal-map") {
|
|
6172
|
-
return { unit: "generations", amount:
|
|
6322
|
+
return { unit: "generations", amount: normalMapCost(spec.revision.normalMapMode), candidates: 1 };
|
|
6173
6323
|
}
|
|
6174
6324
|
if (spec.revision?.mode === "reduce-colors" || spec.revision?.mode === "correct-pixelart") {
|
|
6175
6325
|
return { unit: "generations", amount: 0.1, candidates: 1 };
|
|
@@ -6537,6 +6687,23 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6537
6687
|
if (spec.terrainTileSize === 64 && spec.terrainMode !== "pro") {
|
|
6538
6688
|
throw new Error('PixelLab terrain: a 64px tile needs terrainMode: "pro"');
|
|
6539
6689
|
}
|
|
6690
|
+
const standardOnly = {
|
|
6691
|
+
terrainShapeSeed: spec.terrainShapeSeed,
|
|
6692
|
+
terrainSideWallThickness: spec.terrainSideWallThickness,
|
|
6693
|
+
terrainSideWallPlacement: spec.terrainSideWallPlacement,
|
|
6694
|
+
terrainEnhance: spec.terrainEnhance
|
|
6695
|
+
};
|
|
6696
|
+
const proSet = Object.entries(standardOnly).filter(([, value]) => value != null).map(([field]) => field);
|
|
6697
|
+
if (pro && proSet.length) {
|
|
6698
|
+
throw new Error(`PixelLab terrain: ${proSet.join(", ")} shape a standard set; terrainMode: "pro" ignores them`);
|
|
6699
|
+
}
|
|
6700
|
+
if ((spec.terrainSideWallThickness != null || spec.terrainSideWallPlacement != null) && !(spec.terrainTransitionSize != null && spec.terrainTransitionSize > 0)) {
|
|
6701
|
+
throw new Error("PixelLab terrain: terrainSideWallThickness and terrainSideWallPlacement shape the wall, which needs a terrainTransitionSize above 0");
|
|
6702
|
+
}
|
|
6703
|
+
if (spec.terrainPlatformThickness != null) {
|
|
6704
|
+
throw new Error("PixelLab terrain: terrainPlatformThickness is a sidescroller control");
|
|
6705
|
+
}
|
|
6706
|
+
this.requireTerrainReferences(spec);
|
|
6540
6707
|
if (spec.terrainShapeStyle && spec.terrainTransitionSize != null && spec.terrainTransitionSize > 0.5) {
|
|
6541
6708
|
throw new Error(
|
|
6542
6709
|
"PixelLab terrain: terrainShapeStyle with terrainTransitionSize above 0.5 uses an extended 32-tile layout pixelkiln does not model; use 0, 0.25, or 0.5"
|
|
@@ -6555,7 +6722,6 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6555
6722
|
*/
|
|
6556
6723
|
validateSidescrollerTerrain(spec) {
|
|
6557
6724
|
const topDownOnly = {
|
|
6558
|
-
terrainMode: spec.terrainMode,
|
|
6559
6725
|
terrainShapeStyle: spec.terrainShapeStyle,
|
|
6560
6726
|
terrainView: spec.terrainView,
|
|
6561
6727
|
terrainSpreadX: spec.terrainSpreadX,
|
|
@@ -6565,7 +6731,12 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6565
6731
|
terrainBoundaryAmplitude: spec.terrainBoundaryAmplitude,
|
|
6566
6732
|
terrainBoundarySeed: spec.terrainBoundarySeed,
|
|
6567
6733
|
terrainStepSlope: spec.terrainStepSlope,
|
|
6568
|
-
terrainConnectDiagonals: spec.terrainConnectDiagonals
|
|
6734
|
+
terrainConnectDiagonals: spec.terrainConnectDiagonals,
|
|
6735
|
+
terrainShapeSeed: spec.terrainShapeSeed,
|
|
6736
|
+
terrainSideWallThickness: spec.terrainSideWallThickness,
|
|
6737
|
+
terrainSideWallPlacement: spec.terrainSideWallPlacement,
|
|
6738
|
+
terrainLowerWalkable: spec.terrainLowerWalkable,
|
|
6739
|
+
terrainUpperWalkable: spec.terrainUpperWalkable
|
|
6569
6740
|
};
|
|
6570
6741
|
const set = Object.entries(topDownOnly).filter(([, value]) => value != null).map(([field]) => field);
|
|
6571
6742
|
if (set.length) {
|
|
@@ -6574,9 +6745,26 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6574
6745
|
if (spec.terrainTileSize !== 16 && spec.terrainTileSize !== 32) {
|
|
6575
6746
|
throw new Error(`PixelLab terrain: a sidescroller set's tiles are 16 or 32px, got ${spec.terrainTileSize}`);
|
|
6576
6747
|
}
|
|
6577
|
-
if (spec.terrainTransitionSize != null && ![0, 0.25, 0.5
|
|
6578
|
-
throw new Error("PixelLab terrain: a sidescroller set's terrainTransitionSize must be 0, 0.25, 0.5
|
|
6748
|
+
if (spec.terrainTransitionSize != null && ![0, 0.25, 0.5].includes(spec.terrainTransitionSize)) {
|
|
6749
|
+
throw new Error("PixelLab terrain: a sidescroller set's terrainTransitionSize must be 0, 0.25, or 0.5 (the top layer stops at half a tile)");
|
|
6750
|
+
}
|
|
6751
|
+
const pro = spec.terrainMode === "pro";
|
|
6752
|
+
if (pro && (spec.terrainEnhance != null || spec.terrainPlatformThickness != null)) {
|
|
6753
|
+
throw new Error('PixelLab terrain: terrainEnhance and terrainPlatformThickness shape a standard sidescroller set; terrainMode: "pro" ignores them');
|
|
6579
6754
|
}
|
|
6755
|
+
if (spec.terrainConnect?.lower && !pro) {
|
|
6756
|
+
throw new Error(`PixelLab terrain: a sidescroller set connects to another set's platform only with terrainMode: "pro"`);
|
|
6757
|
+
}
|
|
6758
|
+
if (spec.terrainReferences?.upper) {
|
|
6759
|
+
throw new Error("PixelLab terrain: a sidescroller set's upper terrain is empty air; it takes no upper reference");
|
|
6760
|
+
}
|
|
6761
|
+
if (spec.terrainReferences?.lower && !pro) {
|
|
6762
|
+
throw new Error('PixelLab terrain: a sidescroller set keeps a lower (platform body) reference only with terrainMode: "pro"');
|
|
6763
|
+
}
|
|
6764
|
+
if (spec.terrainReferences?.transition && pro) {
|
|
6765
|
+
throw new Error('PixelLab terrain: a sidescroller set textures its top layer from a transition reference only on standard mode; drop it or terrainMode: "pro"');
|
|
6766
|
+
}
|
|
6767
|
+
this.requireTerrainReferences(spec, spec.terrainTileSize);
|
|
6580
6768
|
if (spec.terrainConnect?.upper) {
|
|
6581
6769
|
throw new Error(
|
|
6582
6770
|
"PixelLab terrain: a sidescroller set's upper terrain is empty air; only its lower (platform) terrain can connect"
|
|
@@ -6589,6 +6777,19 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6589
6777
|
);
|
|
6590
6778
|
}
|
|
6591
6779
|
}
|
|
6780
|
+
/** Reference files must exist; a sidescroller's must be a square PNG of the tile size. */
|
|
6781
|
+
requireTerrainReferences(spec, tileSize) {
|
|
6782
|
+
for (const [side, reference] of Object.entries(spec.terrainReferences ?? {})) {
|
|
6783
|
+
if (!reference?.sha256) {
|
|
6784
|
+
throw new Error(`PixelLab terrain: the ${side} reference is missing or not a PNG: ${reference?.file}`);
|
|
6785
|
+
}
|
|
6786
|
+
if (tileSize != null && (reference.width !== tileSize || reference.height !== tileSize)) {
|
|
6787
|
+
throw new Error(
|
|
6788
|
+
`PixelLab terrain: a sidescroller set's ${side} reference must be a ${tileSize}x${tileSize} PNG; ${reference.file} is ${reference.width}x${reference.height}`
|
|
6789
|
+
);
|
|
6790
|
+
}
|
|
6791
|
+
}
|
|
6792
|
+
}
|
|
6592
6793
|
validateCharacter(spec, styleImages = []) {
|
|
6593
6794
|
const character = spec.character;
|
|
6594
6795
|
if (!character) throw new Error(`${spec.styleId}/${spec.assetId} has no character shape`);
|
|
@@ -7366,7 +7567,12 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
7366
7567
|
outline: spec.outline,
|
|
7367
7568
|
shading: spec.shading,
|
|
7368
7569
|
detail: spec.detail,
|
|
7369
|
-
seed: spec.seed
|
|
7570
|
+
seed: spec.seed,
|
|
7571
|
+
mode: spec.terrainMode,
|
|
7572
|
+
enhance: spec.terrainEnhance,
|
|
7573
|
+
platformThickness: spec.terrainPlatformThickness,
|
|
7574
|
+
lowerReferenceImage: await terrainReferenceImage(spec, "lower"),
|
|
7575
|
+
transitionReferenceImage: await terrainReferenceImage(spec, "transition")
|
|
7370
7576
|
});
|
|
7371
7577
|
return {
|
|
7372
7578
|
jobId: res2.tileset_id,
|
|
@@ -7401,7 +7607,16 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
7401
7607
|
shading: spec.shading,
|
|
7402
7608
|
detail: spec.detail,
|
|
7403
7609
|
seed: spec.seed,
|
|
7404
|
-
targetPalette: targetPaletteFor(spec)
|
|
7610
|
+
targetPalette: targetPaletteFor(spec),
|
|
7611
|
+
shapeSeed: spec.terrainShapeSeed,
|
|
7612
|
+
sideWallThickness: spec.terrainSideWallThickness,
|
|
7613
|
+
sideWallPlacement: spec.terrainSideWallPlacement,
|
|
7614
|
+
enhance: spec.terrainEnhance,
|
|
7615
|
+
lowerWalkable: spec.terrainLowerWalkable,
|
|
7616
|
+
upperWalkable: spec.terrainUpperWalkable,
|
|
7617
|
+
lowerReferenceImage: await terrainReferenceImage(spec, "lower"),
|
|
7618
|
+
upperReferenceImage: await terrainReferenceImage(spec, "upper"),
|
|
7619
|
+
transitionReferenceImage: await terrainReferenceImage(spec, "transition")
|
|
7405
7620
|
});
|
|
7406
7621
|
return {
|
|
7407
7622
|
jobId: res2.tileset_id,
|
|
@@ -7578,7 +7793,20 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
7578
7793
|
}
|
|
7579
7794
|
if (revision.mode === "normal-map") {
|
|
7580
7795
|
const strip = roles ? { base64: joinStripPng(images.map((member) => Buffer.from(member.base64, "base64"))).toString("base64"), format: "png" } : image;
|
|
7581
|
-
const res2 = await this.client.normalMap({
|
|
7796
|
+
const res2 = await this.client.normalMap({
|
|
7797
|
+
image: strip,
|
|
7798
|
+
frames: roles?.length ?? 1,
|
|
7799
|
+
convention: revision.convention,
|
|
7800
|
+
mode: revision.normalMapMode,
|
|
7801
|
+
kind: revision.normalMapKind,
|
|
7802
|
+
shape: {
|
|
7803
|
+
strength: revision.normalMapStrength,
|
|
7804
|
+
outlineRounding: revision.outlineRounding,
|
|
7805
|
+
partShapes: revision.partShapes,
|
|
7806
|
+
surfaceDetail: revision.surfaceDetail,
|
|
7807
|
+
detailSoftness: revision.detailSoftness
|
|
7808
|
+
}
|
|
7809
|
+
});
|
|
7582
7810
|
return {
|
|
7583
7811
|
jobId: res2.background_job_id,
|
|
7584
7812
|
metadata: roles ? { revisionMembers: roles, ...revision.sourceFps != null ? { revisionFps: revision.sourceFps } : {} } : {}
|
|
@@ -8580,6 +8808,16 @@ function sendsTargetPalette(spec) {
|
|
|
8580
8808
|
return false;
|
|
8581
8809
|
}
|
|
8582
8810
|
}
|
|
8811
|
+
async function terrainReferenceImage(spec, side) {
|
|
8812
|
+
const reference = spec.terrainReferences?.[side];
|
|
8813
|
+
if (!reference) return void 0;
|
|
8814
|
+
if (!(0, import_node_fs4.existsSync)(reference.file)) throw new Error(`terrain ${side} reference is missing: ${reference.file}`);
|
|
8815
|
+
const bytes = (0, import_node_fs4.readFileSync)(reference.file);
|
|
8816
|
+
if (sha256(bytes) !== reference.sha256) {
|
|
8817
|
+
throw new Error(`terrain ${side} reference changed after the manifest was resolved: ${reference.file}; run the command again`);
|
|
8818
|
+
}
|
|
8819
|
+
return { base64: bytes.toString("base64"), format: "png" };
|
|
8820
|
+
}
|
|
8583
8821
|
function targetPaletteFor(spec) {
|
|
8584
8822
|
if (!sendsTargetPalette(spec)) return void 0;
|
|
8585
8823
|
if (!spec.palette.length && spec.maxColors == null) return void 0;
|
|
@@ -11862,6 +12100,13 @@ async function resolveSpecs(loaded, filter) {
|
|
|
11862
12100
|
terrainBoundarySeed: generator === "terrain" ? style.terrainBoundarySeed : void 0,
|
|
11863
12101
|
terrainStepSlope: generator === "terrain" ? style.terrainStepSlope : void 0,
|
|
11864
12102
|
terrainConnectDiagonals: generator === "terrain" ? style.terrainConnectDiagonals : void 0,
|
|
12103
|
+
terrainShapeSeed: generator === "terrain" ? style.terrainShapeSeed : void 0,
|
|
12104
|
+
terrainSideWallThickness: generator === "terrain" ? style.terrainSideWallThickness : void 0,
|
|
12105
|
+
terrainSideWallPlacement: generator === "terrain" ? style.terrainSideWallPlacement : void 0,
|
|
12106
|
+
terrainEnhance: generator === "terrain" ? style.terrainEnhance : void 0,
|
|
12107
|
+
terrainPlatformThickness: generator === "terrain" ? style.terrainPlatformThickness : void 0,
|
|
12108
|
+
terrainLowerWalkable: generator === "terrain" ? style.terrainLowerWalkable : void 0,
|
|
12109
|
+
terrainUpperWalkable: generator === "terrain" ? style.terrainUpperWalkable : void 0,
|
|
11865
12110
|
terrainTransitionSize: generator === "terrain" ? style.terrainTransitionSize : void 0,
|
|
11866
12111
|
terrainView: generator === "terrain" ? style.terrainView : void 0,
|
|
11867
12112
|
terrainOrientation: generator === "terrain" ? style.terrainOrientation : void 0,
|
|
@@ -12220,6 +12465,13 @@ async function resolveSpecs(loaded, filter) {
|
|
|
12220
12465
|
...asset.revision.description ? { description: asset.revision.description } : {},
|
|
12221
12466
|
...asset.revision.removalTask ? { removalTask: asset.revision.removalTask } : {},
|
|
12222
12467
|
...asset.revision.convention ? { convention: asset.revision.convention } : {},
|
|
12468
|
+
...asset.revision.normalMapMode ? { normalMapMode: asset.revision.normalMapMode } : {},
|
|
12469
|
+
...asset.revision.normalMapKind ? { normalMapKind: asset.revision.normalMapKind } : {},
|
|
12470
|
+
...asset.revision.normalMapStrength == null ? {} : { normalMapStrength: asset.revision.normalMapStrength },
|
|
12471
|
+
...asset.revision.outlineRounding == null ? {} : { outlineRounding: asset.revision.outlineRounding },
|
|
12472
|
+
...asset.revision.partShapes == null ? {} : { partShapes: asset.revision.partShapes },
|
|
12473
|
+
...asset.revision.surfaceDetail == null ? {} : { surfaceDetail: asset.revision.surfaceDetail },
|
|
12474
|
+
...asset.revision.detailSoftness == null ? {} : { detailSoftness: asset.revision.detailSoftness },
|
|
12223
12475
|
...asset.revision.driftThreshold == null ? {} : { driftThreshold: asset.revision.driftThreshold },
|
|
12224
12476
|
...asset.revision.subjectDescription ? { subjectDescription: asset.revision.subjectDescription } : {},
|
|
12225
12477
|
...asset.revision.initialPose ? { initialPose: asset.revision.initialPose } : {},
|
|
@@ -12294,6 +12546,20 @@ async function resolveSpecs(loaded, filter) {
|
|
|
12294
12546
|
}
|
|
12295
12547
|
resolved.terrainConnect = links;
|
|
12296
12548
|
}
|
|
12549
|
+
if (asset.terrainReferences) {
|
|
12550
|
+
if (resolved.generator !== "terrain") {
|
|
12551
|
+
throw new Error(`assets.${assetId}.terrainReferences: only a terrain set takes terrain references; style "${styleId}" uses "${resolved.generator}"`);
|
|
12552
|
+
}
|
|
12553
|
+
const references = {};
|
|
12554
|
+
for (const side of ["lower", "upper", "transition"]) {
|
|
12555
|
+
const relative = asset.terrainReferences[side];
|
|
12556
|
+
if (!relative) continue;
|
|
12557
|
+
const file = import_node_path8.default.resolve(root, relative);
|
|
12558
|
+
const image = await optionalRevisionImage(file, `terrain ${side} reference`, "png");
|
|
12559
|
+
references[side] = { file, sha256: image?.hash ?? null, width: image?.width ?? null, height: image?.height ?? null };
|
|
12560
|
+
}
|
|
12561
|
+
if (Object.keys(references).length) resolved.terrainReferences = references;
|
|
12562
|
+
}
|
|
12297
12563
|
if (asset.scene) resolved.scene = await resolveMapScene(root, styleId, assetId, resolved.generator, asset.scene, activeProvider);
|
|
12298
12564
|
resolved.specHash = specHash(
|
|
12299
12565
|
resolved,
|
|
@@ -23293,9 +23559,12 @@ async function workspaceStatus(ws, dir) {
|
|
|
23293
23559
|
MediaType,
|
|
23294
23560
|
NORMAL_MAP_CONVENTIONS,
|
|
23295
23561
|
NORMAL_MAP_COST_GENERATIONS,
|
|
23562
|
+
NORMAL_MAP_KINDS,
|
|
23296
23563
|
NORMAL_MAP_MAX_FRAMES,
|
|
23297
23564
|
NORMAL_MAP_MAX_SIDE,
|
|
23298
23565
|
NORMAL_MAP_MIN_SIDE,
|
|
23566
|
+
NORMAL_MAP_MODES,
|
|
23567
|
+
NORMAL_MAP_SHAPE_RANGES,
|
|
23299
23568
|
NormalMapConventionSchema,
|
|
23300
23569
|
OverwriteRefusedError,
|
|
23301
23570
|
PIXELATE_COST_GENERATIONS,
|
|
@@ -23463,6 +23732,7 @@ async function workspaceStatus(ws, dir) {
|
|
|
23463
23732
|
mountStyle,
|
|
23464
23733
|
musicCost,
|
|
23465
23734
|
musicOutputPaths,
|
|
23735
|
+
normalMapCost,
|
|
23466
23736
|
normalMapFile,
|
|
23467
23737
|
normalMapResultPng,
|
|
23468
23738
|
normalMapSizeProblem,
|