pixelkiln 0.98.0 → 0.100.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 +182 -13
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +151 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +472 -48
- package/dist/index.d.ts +472 -48
- package/dist/index.js +147 -5
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +27 -4
- package/docs/ENDPOINTS.md +58 -4
- package/docs/MANIFEST.md +39 -0
- package/docs/PIXELLAB.md +1 -1
- package/docs/REVISIONS.md +9 -1
- package/package.json +1 -1
- package/schema/manifest.schema.json +52 -0
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ provenance and no long-lived npm token.
|
|
|
55
55
|
| Hand edits | Touch-ups in your own editor or a pinned in-browser Pixelorama, kept beside the generated art with the generation still the record; frame and tile sets member by member. |
|
|
56
56
|
| Controlled inputs | Hashed revision lineage (image-to-image and inpaint; on PixelLab also palette reduction, pixel cleanup, animation, skeleton posing, interpolation, and animation edits), fail-closed parent approval, source-versus-candidate review, and content-addressed per-asset ComfyUI bindings. |
|
|
57
57
|
| Characters | A base in 4 or 8 directions from a prompt or your own sprite (four PixelLab engines), poses, loops, portraits, and outfit transfers as dependent assets generated in waves, free mirrored directions (one `directions` list declares a loop and mirrors the rest), account adoption and salvage, and SpriteFrames export. |
|
|
58
|
-
| PixelLab utilities | `unzoom` returns upscaled reference art to its native grid, `pixelate` turns a photo or render into pixel art (Image to Pixel Art Pro Flash, 6 generations, or `--pro` for 20), `normal-map` makes a sprite's or a loop strip's normal map for lighting (0.5
|
|
58
|
+
| PixelLab utilities | `unzoom` returns upscaled reference art to its native grid, `pixelate` turns a photo or render into pixel art (Image to Pixel Art Pro Flash, 6 generations, or `--pro` for 20), `normal-map` makes a sprite's or a loop strip's normal map for lighting (0.1 generation, or 0.5 on pro), `vfx` builds animated effects such as explosions and auras with PixelLab's free VFX workbench, `font` generates a `.ttf` and glyph atlas, `music` makes a song (two MP3 takes, with optional seamless loops and loop points) and `sfx` a sound effect (WAV), `ui` splits a generated UI panel into elements, draws their hover and pressed states, sets 9-slice insets, and pulls every piece with a record, `asset` imports your own sprite as an object, expands it to 8 directions, resizes its canvas, and exports it as a spritesheet, `.aseprite` file or GIF, `estimate-skeleton` starts a keypoints file for skeleton animation, and `skeleton-preview` draws its poses over the sprite for free. |
|
|
59
59
|
| Existing-art onboarding | Manifest scaffolding, exact-hash account adoption, and prompt recovery. |
|
|
60
60
|
| Recovery | Safe stale-output replacement, validated caches, durable references, resumable paid jobs, and per-asset generation history with free restores. |
|
|
61
61
|
| Shared-account safety | Cross-project claim files or a registered workspace catalog, sibling-style exclusion, reviewed salvage, keep/discard tags, separate confirmed purge. |
|
package/dist/cli.js
CHANGED
|
@@ -135,6 +135,12 @@ var VALUE_FLAGS = [
|
|
|
135
135
|
"--size",
|
|
136
136
|
"--animation",
|
|
137
137
|
"--direction",
|
|
138
|
+
"--outline-rounding",
|
|
139
|
+
"--part-shapes",
|
|
140
|
+
"--surface-detail",
|
|
141
|
+
"--detail-softness",
|
|
142
|
+
"--mode",
|
|
143
|
+
"--strength",
|
|
138
144
|
"--bpm",
|
|
139
145
|
"--seconds",
|
|
140
146
|
"--lyrics",
|
|
@@ -538,6 +544,12 @@ function parseArgs(argv) {
|
|
|
538
544
|
sprite: get("--sprite"),
|
|
539
545
|
fps: numberOption("--fps", { min: 1, max: 60, integer: true }),
|
|
540
546
|
gamePack: rest.includes("--game-pack"),
|
|
547
|
+
mode: get("--mode"),
|
|
548
|
+
strength: numberOption("--strength", { min: 0, max: 2 }),
|
|
549
|
+
outlineRounding: numberOption("--outline-rounding", { min: 0, max: 3 }),
|
|
550
|
+
partShapes: numberOption("--part-shapes", { min: 0, max: 2 }),
|
|
551
|
+
surfaceDetail: numberOption("--surface-detail", { min: 0, max: 2 }),
|
|
552
|
+
detailSoftness: numberOption("--detail-softness", { min: 0.6, max: 3 }),
|
|
541
553
|
kind: get("--kind"),
|
|
542
554
|
size: get("--size"),
|
|
543
555
|
animation: get("--animation"),
|
|
@@ -638,8 +650,10 @@ Commands
|
|
|
638
650
|
generations; asks first.
|
|
639
651
|
normal-map PixelLab: make the normal map of a PNG sprite (--from), or of a
|
|
640
652
|
horizontal strip of --frames equal frames, so an engine can light
|
|
641
|
-
it. --convention opengl (default) or directx. 0.
|
|
642
|
-
|
|
653
|
+
it. --convention opengl (default) or directx. 0.1 generation on
|
|
654
|
+
lite (default), 0.5 with --mode pro; shape it with --strength,
|
|
655
|
+
--outline-rounding, --part-shapes, --surface-detail and
|
|
656
|
+
--detail-softness. Asks first.
|
|
643
657
|
vfx PixelLab: build an animated pixel-art effect with the VFX
|
|
644
658
|
workbench (free) from a --preset, a --recipe file, a saved
|
|
645
659
|
--effect, and/or --part; writes <out>.png/.gif/.json and a
|
|
@@ -694,7 +708,14 @@ Options
|
|
|
694
708
|
--artist <a> vfx --description: lite (default) or pro
|
|
695
709
|
--weight <w> font: Bold or Regular (default)
|
|
696
710
|
--id <id> ui/asset: the PixelLab asset to work on
|
|
697
|
-
--kind <kind> asset: object (default) or character
|
|
711
|
+
--kind <kind> asset: object (default) or character; normal-map: what the
|
|
712
|
+
picture is (character, object, topdown, side, iso, ui)
|
|
713
|
+
--mode <mode> normal-map: lite (default, 0.1 generation) or pro (0.5)
|
|
714
|
+
--strength <n> normal-map: how far pixels tilt from the viewer, 0-2
|
|
715
|
+
--outline-rounding <n> normal-map: how much the outline rounds off, 0-3
|
|
716
|
+
--part-shapes <n> normal-map: how much the sprite's 3D parts add, 0-2
|
|
717
|
+
--surface-detail <n> normal-map: the art's light and dark as bumps, 0-2
|
|
718
|
+
--detail-softness <n> normal-map: blur of that detail in px, 0.6-3
|
|
698
719
|
--size <WxH> asset canvas: the new canvas, in multiples of 4
|
|
699
720
|
--animation <id> asset mirror/export: an animation group id
|
|
700
721
|
--direction <dir> asset mirror: the direction to flip; asset expand: the
|
|
@@ -1339,6 +1360,8 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
|
|
|
1339
1360
|
terrainEnhance: spec.terrainEnhance,
|
|
1340
1361
|
terrainPlatformThickness: spec.terrainPlatformThickness,
|
|
1341
1362
|
// Reference images enter as their bytes' hashes, never their paths.
|
|
1363
|
+
// The starting image by its bytes, with its strength only when set.
|
|
1364
|
+
initImage: spec.initImage ? { sha256: spec.initImage.sha256, strength: spec.initImage.strength } : void 0,
|
|
1342
1365
|
terrainReferences: spec.terrainReferences && Object.keys(spec.terrainReferences).length ? Object.fromEntries(
|
|
1343
1366
|
["lower", "upper", "transition"].flatMap((side) => {
|
|
1344
1367
|
const reference = spec.terrainReferences[side];
|
|
@@ -1477,6 +1500,14 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
|
|
|
1477
1500
|
description: spec.revision.description,
|
|
1478
1501
|
removalTask: spec.revision.removalTask,
|
|
1479
1502
|
convention: spec.revision.convention,
|
|
1503
|
+
// Each only when set, so normal-map revisions made before them keep their hash.
|
|
1504
|
+
normalMapMode: spec.revision.normalMapMode,
|
|
1505
|
+
normalMapKind: spec.revision.normalMapKind,
|
|
1506
|
+
normalMapStrength: spec.revision.normalMapStrength,
|
|
1507
|
+
outlineRounding: spec.revision.outlineRounding,
|
|
1508
|
+
partShapes: spec.revision.partShapes,
|
|
1509
|
+
surfaceDetail: spec.revision.surfaceDetail,
|
|
1510
|
+
detailSoftness: spec.revision.detailSoftness,
|
|
1480
1511
|
driftThreshold: spec.revision.driftThreshold,
|
|
1481
1512
|
subjectDescription: spec.revision.subjectDescription,
|
|
1482
1513
|
initialPose: spec.revision.initialPose,
|
|
@@ -2037,6 +2068,24 @@ var RevisionSchema = z.object({
|
|
|
2037
2068
|
removalTask: z.enum(["simple", "complex"]).optional(),
|
|
2038
2069
|
/** `normal-map` only: `opengl` (green up; PixelLab's default) or `directx` (green down, for Unreal). */
|
|
2039
2070
|
convention: NormalMapConventionSchema.optional(),
|
|
2071
|
+
/**
|
|
2072
|
+
* `normal-map` only: `lite` (PixelLab's default, 0.1 generation) makes the
|
|
2073
|
+
* map from the art alone; `pro` (0.5) plans each part's shape, what is in
|
|
2074
|
+
* front and what is sunk.
|
|
2075
|
+
*/
|
|
2076
|
+
normalMapMode: z.enum(["lite", "pro"]).optional(),
|
|
2077
|
+
/** `normal-map` only: what the picture is. Left out, PixelLab reads it from the picture; set it for sidescroller, isometric and UI art. */
|
|
2078
|
+
normalMapKind: z.enum(["character", "object", "topdown", "side", "iso", "ui"]).optional(),
|
|
2079
|
+
/** `normal-map` only: how far every pixel tilts away from facing the viewer, 0 to 2 (the API refuses more). */
|
|
2080
|
+
normalMapStrength: z.number().min(0).max(2).optional(),
|
|
2081
|
+
/** `normal-map` only: how much the outline rounds off, 0 to 3; 0 keeps it flat to the edge. */
|
|
2082
|
+
outlineRounding: z.number().min(0).max(3).optional(),
|
|
2083
|
+
/** `normal-map` only: how much the sprite's 3D parts (a round head, an arm) add, 0 to 2. */
|
|
2084
|
+
partShapes: z.number().min(0).max(2).optional(),
|
|
2085
|
+
/** `normal-map` only: the art's own light and dark as bumps, 0 to 2; 0 for a smooth surface. */
|
|
2086
|
+
surfaceDetail: z.number().min(0).max(2).optional(),
|
|
2087
|
+
/** `normal-map` only: how far that detail is blurred, 0.6 to 3 px. */
|
|
2088
|
+
detailSoftness: z.number().min(0.6).max(3).optional(),
|
|
2040
2089
|
/**
|
|
2041
2090
|
* `animate-skeleton`: what the character *looks like*, a noun
|
|
2042
2091
|
* phrase (colours, clothing, held items) — distinct from the asset's
|
|
@@ -2197,6 +2246,15 @@ var RevisionSchema = z.object({
|
|
|
2197
2246
|
path: ["convention"]
|
|
2198
2247
|
});
|
|
2199
2248
|
}
|
|
2249
|
+
for (const field of ["normalMapMode", "normalMapKind", "normalMapStrength", "outlineRounding", "partShapes", "surfaceDetail", "detailSoftness"]) {
|
|
2250
|
+
if (revision[field] !== void 0 && revision.mode !== "normal-map") {
|
|
2251
|
+
context.addIssue({
|
|
2252
|
+
code: z.ZodIssueCode.custom,
|
|
2253
|
+
message: `${field} applies to normal-map revisions only`,
|
|
2254
|
+
path: [field]
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2200
2258
|
if (revision.description !== void 0 && revision.mode !== "animate-skeleton" && revision.mode !== "remove-background") {
|
|
2201
2259
|
context.addIssue({
|
|
2202
2260
|
code: z.ZodIssueCode.custom,
|
|
@@ -2833,6 +2891,17 @@ var AssetSchema = z.object({
|
|
|
2833
2891
|
* (a sword hand, a parted fringe) comes out the other way round.
|
|
2834
2892
|
*/
|
|
2835
2893
|
mirror: z.string().min(1).optional(),
|
|
2894
|
+
/**
|
|
2895
|
+
* `pixflux`, `map` and `isometricTile` styles: a PNG to start the drawing
|
|
2896
|
+
* from, relative to the manifest. PixelLab reworks it toward the prompt
|
|
2897
|
+
* instead of starting from nothing.
|
|
2898
|
+
*/
|
|
2899
|
+
initImage: z.string().min(1).optional(),
|
|
2900
|
+
/**
|
|
2901
|
+
* With `initImage`: how strongly the starting image holds, 1 to 999.
|
|
2902
|
+
* PixelLab's default is 300.
|
|
2903
|
+
*/
|
|
2904
|
+
initImageStrength: z.number().int().min(1).max(999).optional(),
|
|
2836
2905
|
/**
|
|
2837
2906
|
* `terrain` styles only: a PNG per terrain for PixelLab to take that
|
|
2838
2907
|
* terrain's look from, paths relative to the manifest. Top-down sets
|
|
@@ -2896,6 +2965,13 @@ var AssetSchema = z.object({
|
|
|
2896
2965
|
path: [shapes[1]]
|
|
2897
2966
|
});
|
|
2898
2967
|
}
|
|
2968
|
+
if (asset.initImageStrength !== void 0 && !asset.initImage) {
|
|
2969
|
+
context.addIssue({
|
|
2970
|
+
code: z.ZodIssueCode.custom,
|
|
2971
|
+
message: "initImageStrength sets how strongly initImage holds; add an initImage or drop it",
|
|
2972
|
+
path: ["initImageStrength"]
|
|
2973
|
+
});
|
|
2974
|
+
}
|
|
2899
2975
|
for (const shape of ["derive", "external"]) {
|
|
2900
2976
|
if (asset[shape] && (asset.source || Object.keys(asset.sourceByStyle).length)) {
|
|
2901
2977
|
context.addIssue({
|
|
@@ -7509,6 +7585,8 @@ function targetPaletteBody(palette) {
|
|
|
7509
7585
|
}
|
|
7510
7586
|
};
|
|
7511
7587
|
}
|
|
7588
|
+
var NORMAL_MAP_MODES = ["lite", "pro"];
|
|
7589
|
+
var NORMAL_MAP_KINDS = ["character", "object", "topdown", "side", "iso", "ui"];
|
|
7512
7590
|
var PixelLabClient = class {
|
|
7513
7591
|
constructor(apiKey, timeoutMs = 12e4) {
|
|
7514
7592
|
this.apiKey = apiKey;
|
|
@@ -7606,6 +7684,10 @@ var PixelLabClient = class {
|
|
|
7606
7684
|
if (args.outline) body.outline = args.outline;
|
|
7607
7685
|
if (args.shading) body.shading = args.shading;
|
|
7608
7686
|
if (args.detail) body.detail = args.detail;
|
|
7687
|
+
if (args.initImage) {
|
|
7688
|
+
body.init_image = { type: "base64", base64: args.initImage.base64, format: args.initImage.format };
|
|
7689
|
+
if (args.initImageStrength != null) body.init_image_strength = args.initImageStrength;
|
|
7690
|
+
}
|
|
7609
7691
|
if (args.seed != null) body.seed = args.seed;
|
|
7610
7692
|
if (args.scene) {
|
|
7611
7693
|
const encode = (image) => ({ type: "base64", base64: image.base64, format: image.format });
|
|
@@ -7774,6 +7856,10 @@ var PixelLabClient = class {
|
|
|
7774
7856
|
if (args.outline) body.outline = args.outline;
|
|
7775
7857
|
if (args.shading) body.shading = args.shading;
|
|
7776
7858
|
if (args.detail) body.detail = args.detail;
|
|
7859
|
+
if (args.initImage) {
|
|
7860
|
+
body.init_image = { type: "base64", base64: args.initImage.base64, format: args.initImage.format };
|
|
7861
|
+
if (args.initImageStrength != null) body.init_image_strength = args.initImageStrength;
|
|
7862
|
+
}
|
|
7777
7863
|
if (args.seed != null) body.seed = args.seed;
|
|
7778
7864
|
return validateResponse(
|
|
7779
7865
|
IsometricTileSubmitSchema,
|
|
@@ -7898,6 +7984,10 @@ var PixelLabClient = class {
|
|
|
7898
7984
|
if (args.paletteSwatchBase64) {
|
|
7899
7985
|
body.color_image = { type: "base64", base64: args.paletteSwatchBase64, format: "png" };
|
|
7900
7986
|
}
|
|
7987
|
+
if (args.initImage) {
|
|
7988
|
+
body.init_image = { type: "base64", base64: args.initImage.base64, format: args.initImage.format };
|
|
7989
|
+
if (args.initImageStrength != null) body.init_image_strength = args.initImageStrength;
|
|
7990
|
+
}
|
|
7901
7991
|
if (args.seed != null) body.seed = args.seed;
|
|
7902
7992
|
const res = validateResponse(
|
|
7903
7993
|
PixfluxResponseSchema,
|
|
@@ -8587,8 +8677,15 @@ var PixelLabClient = class {
|
|
|
8587
8677
|
*/
|
|
8588
8678
|
async normalMap(args) {
|
|
8589
8679
|
const body = { image: args.image };
|
|
8680
|
+
if (args.mode) body.mode = args.mode;
|
|
8681
|
+
if (args.kind) body.kind = args.kind;
|
|
8682
|
+
if (args.shape?.strength != null) body.strength = args.shape.strength;
|
|
8590
8683
|
if (args.frames != null && args.frames !== 1) body.frames = args.frames;
|
|
8591
8684
|
if (args.convention) body.convention = args.convention;
|
|
8685
|
+
if (args.shape?.outlineRounding != null) body.outline_rounding = args.shape.outlineRounding;
|
|
8686
|
+
if (args.shape?.partShapes != null) body.part_shapes = args.shape.partShapes;
|
|
8687
|
+
if (args.shape?.surfaceDetail != null) body.surface_detail = args.shape.surfaceDetail;
|
|
8688
|
+
if (args.shape?.detailSoftness != null) body.detail_softness = args.shape.detailSoftness;
|
|
8592
8689
|
return validateResponse(
|
|
8593
8690
|
RevisionJobSubmitSchema,
|
|
8594
8691
|
await this.request("/normal-map", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -9798,7 +9895,9 @@ async function pixelateFile(client2, input, opts = {}) {
|
|
|
9798
9895
|
await sleep3(interval);
|
|
9799
9896
|
}
|
|
9800
9897
|
}
|
|
9801
|
-
|
|
9898
|
+
function normalMapCost(mode2) {
|
|
9899
|
+
return mode2 === "pro" ? 0.5 : 0.1;
|
|
9900
|
+
}
|
|
9802
9901
|
var NORMAL_MAP_MIN_SIDE = 8;
|
|
9803
9902
|
var NORMAL_MAP_MAX_SIDE = 512;
|
|
9804
9903
|
var NORMAL_MAP_MAX_FRAMES = 32;
|
|
@@ -9842,7 +9941,10 @@ async function normalMapFile(client2, input, opts = {}) {
|
|
|
9842
9941
|
const submitted = await client2.normalMap({
|
|
9843
9942
|
image: { base64: bytes.toString("base64"), format: "png" },
|
|
9844
9943
|
frames,
|
|
9845
|
-
convention: opts.convention
|
|
9944
|
+
convention: opts.convention,
|
|
9945
|
+
shape: opts.shape,
|
|
9946
|
+
mode: opts.mode,
|
|
9947
|
+
kind: opts.kind
|
|
9846
9948
|
});
|
|
9847
9949
|
const jobId = submitted.background_job_id;
|
|
9848
9950
|
const started = Date.now();
|
|
@@ -10166,7 +10268,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10166
10268
|
return { unit: "generations", amount: 1, candidates: 1 };
|
|
10167
10269
|
}
|
|
10168
10270
|
if (spec.revision?.mode === "normal-map") {
|
|
10169
|
-
return { unit: "generations", amount:
|
|
10271
|
+
return { unit: "generations", amount: normalMapCost(spec.revision.normalMapMode), candidates: 1 };
|
|
10170
10272
|
}
|
|
10171
10273
|
if (spec.revision?.mode === "reduce-colors" || spec.revision?.mode === "correct-pixelart") {
|
|
10172
10274
|
return { unit: "generations", amount: 0.1, candidates: 1 };
|
|
@@ -11370,7 +11472,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
11370
11472
|
height: spec.height,
|
|
11371
11473
|
noBackground: spec.noBackground,
|
|
11372
11474
|
paletteSwatchBase64: swatch,
|
|
11373
|
-
seed: spec.seed
|
|
11475
|
+
seed: spec.seed,
|
|
11476
|
+
...await initImageArgs(spec)
|
|
11374
11477
|
});
|
|
11375
11478
|
const jobId = randomUUID3();
|
|
11376
11479
|
writeFileSync(path16.join(_PixelLabProvider.cacheDir(), `${jobId}.png`), png);
|
|
@@ -11483,7 +11586,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
11483
11586
|
outline: spec.outline,
|
|
11484
11587
|
shading: spec.shading,
|
|
11485
11588
|
detail: spec.detail,
|
|
11486
|
-
seed: spec.seed
|
|
11589
|
+
seed: spec.seed,
|
|
11590
|
+
...await initImageArgs(spec)
|
|
11487
11591
|
});
|
|
11488
11592
|
return { jobId: res2.tile_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
11489
11593
|
}
|
|
@@ -11527,6 +11631,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
11527
11631
|
shading: spec.shading,
|
|
11528
11632
|
detail: spec.detail,
|
|
11529
11633
|
seed: spec.seed,
|
|
11634
|
+
...await initImageArgs(spec),
|
|
11530
11635
|
scene: spec.scene ? mapScenePayload(spec) : void 0
|
|
11531
11636
|
});
|
|
11532
11637
|
return { jobId: res.object_id, metadata: { backgroundJobId: res.background_job_id } };
|
|
@@ -11640,7 +11745,20 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
11640
11745
|
}
|
|
11641
11746
|
if (revision.mode === "normal-map") {
|
|
11642
11747
|
const strip = roles ? { base64: joinStripPng(images.map((member) => Buffer.from(member.base64, "base64"))).toString("base64"), format: "png" } : image;
|
|
11643
|
-
const res2 = await this.client.normalMap({
|
|
11748
|
+
const res2 = await this.client.normalMap({
|
|
11749
|
+
image: strip,
|
|
11750
|
+
frames: roles?.length ?? 1,
|
|
11751
|
+
convention: revision.convention,
|
|
11752
|
+
mode: revision.normalMapMode,
|
|
11753
|
+
kind: revision.normalMapKind,
|
|
11754
|
+
shape: {
|
|
11755
|
+
strength: revision.normalMapStrength,
|
|
11756
|
+
outlineRounding: revision.outlineRounding,
|
|
11757
|
+
partShapes: revision.partShapes,
|
|
11758
|
+
surfaceDetail: revision.surfaceDetail,
|
|
11759
|
+
detailSoftness: revision.detailSoftness
|
|
11760
|
+
}
|
|
11761
|
+
});
|
|
11644
11762
|
return {
|
|
11645
11763
|
jobId: res2.background_job_id,
|
|
11646
11764
|
metadata: roles ? { revisionMembers: roles, ...revision.sourceFps != null ? { revisionFps: revision.sourceFps } : {} } : {}
|
|
@@ -12642,6 +12760,16 @@ function sendsTargetPalette(spec) {
|
|
|
12642
12760
|
return false;
|
|
12643
12761
|
}
|
|
12644
12762
|
}
|
|
12763
|
+
async function initImageArgs(spec) {
|
|
12764
|
+
const init = spec.initImage;
|
|
12765
|
+
if (!init) return {};
|
|
12766
|
+
if (!existsSync11(init.file)) throw new Error(`init image is missing: ${init.file}`);
|
|
12767
|
+
const bytes = readFileSync2(init.file);
|
|
12768
|
+
if (sha256(bytes) !== init.sha256) {
|
|
12769
|
+
throw new Error(`init image changed after the manifest was resolved: ${init.file}; run the command again`);
|
|
12770
|
+
}
|
|
12771
|
+
return { initImage: { base64: bytes.toString("base64"), format: "png" }, ...init.strength == null ? {} : { initImageStrength: init.strength } };
|
|
12772
|
+
}
|
|
12645
12773
|
async function terrainReferenceImage(spec, side) {
|
|
12646
12774
|
const reference = spec.terrainReferences?.[side];
|
|
12647
12775
|
if (!reference) return void 0;
|
|
@@ -14881,6 +15009,13 @@ async function resolveSpecs(loaded, filter) {
|
|
|
14881
15009
|
...asset.revision.description ? { description: asset.revision.description } : {},
|
|
14882
15010
|
...asset.revision.removalTask ? { removalTask: asset.revision.removalTask } : {},
|
|
14883
15011
|
...asset.revision.convention ? { convention: asset.revision.convention } : {},
|
|
15012
|
+
...asset.revision.normalMapMode ? { normalMapMode: asset.revision.normalMapMode } : {},
|
|
15013
|
+
...asset.revision.normalMapKind ? { normalMapKind: asset.revision.normalMapKind } : {},
|
|
15014
|
+
...asset.revision.normalMapStrength == null ? {} : { normalMapStrength: asset.revision.normalMapStrength },
|
|
15015
|
+
...asset.revision.outlineRounding == null ? {} : { outlineRounding: asset.revision.outlineRounding },
|
|
15016
|
+
...asset.revision.partShapes == null ? {} : { partShapes: asset.revision.partShapes },
|
|
15017
|
+
...asset.revision.surfaceDetail == null ? {} : { surfaceDetail: asset.revision.surfaceDetail },
|
|
15018
|
+
...asset.revision.detailSoftness == null ? {} : { detailSoftness: asset.revision.detailSoftness },
|
|
14884
15019
|
...asset.revision.driftThreshold == null ? {} : { driftThreshold: asset.revision.driftThreshold },
|
|
14885
15020
|
...asset.revision.subjectDescription ? { subjectDescription: asset.revision.subjectDescription } : {},
|
|
14886
15021
|
...asset.revision.initialPose ? { initialPose: asset.revision.initialPose } : {},
|
|
@@ -14955,6 +15090,23 @@ async function resolveSpecs(loaded, filter) {
|
|
|
14955
15090
|
}
|
|
14956
15091
|
resolved.terrainConnect = links;
|
|
14957
15092
|
}
|
|
15093
|
+
if (asset.initImage) {
|
|
15094
|
+
if (!["pixflux", "map", "isometricTile"].includes(resolved.generator)) {
|
|
15095
|
+
throw new Error(
|
|
15096
|
+
`assets.${assetId}.initImage: a starting image is taken by pixflux, map and isometricTile styles; style "${styleId}" uses "${resolved.generator}"`
|
|
15097
|
+
);
|
|
15098
|
+
}
|
|
15099
|
+
const file = path18.resolve(root, asset.initImage);
|
|
15100
|
+
const image = await optionalRevisionImage(file, "init image", "png");
|
|
15101
|
+
if (!image) throw new Error(`assets.${assetId}.initImage: ${asset.initImage} is missing or not a PNG`);
|
|
15102
|
+
resolved.initImage = {
|
|
15103
|
+
file,
|
|
15104
|
+
sha256: image?.hash ?? null,
|
|
15105
|
+
width: image?.width ?? null,
|
|
15106
|
+
height: image?.height ?? null,
|
|
15107
|
+
...asset.initImageStrength == null ? {} : { strength: asset.initImageStrength }
|
|
15108
|
+
};
|
|
15109
|
+
}
|
|
14958
15110
|
if (asset.terrainReferences) {
|
|
14959
15111
|
if (resolved.generator !== "terrain") {
|
|
14960
15112
|
throw new Error(`assets.${assetId}.terrainReferences: only a terrain set takes terrain references; style "${styleId}" uses "${resolved.generator}"`);
|
|
@@ -24583,21 +24735,38 @@ async function runNormalMap(args) {
|
|
|
24583
24735
|
log(
|
|
24584
24736
|
` normal-map ${args.from}${frames > 1 ? ` (a strip of ${frames} frames)` : ""} \u2192 ${out}, ${convention} (green ${convention === "opengl" ? "up" : "down"})`
|
|
24585
24737
|
);
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24738
|
+
if (args.mode !== void 0 && !NORMAL_MAP_MODES.includes(args.mode)) {
|
|
24739
|
+
throw new UsageError(`--mode must be ${NORMAL_MAP_MODES.join(" or ")}, got "${args.mode}"`);
|
|
24740
|
+
}
|
|
24741
|
+
if (args.kind !== void 0 && !NORMAL_MAP_KINDS.includes(args.kind)) {
|
|
24742
|
+
throw new UsageError(`--kind must be one of ${NORMAL_MAP_KINDS.join(", ")}, got "${args.kind}"`);
|
|
24743
|
+
}
|
|
24744
|
+
const mode2 = args.mode;
|
|
24745
|
+
const cost = normalMapCost(mode2);
|
|
24746
|
+
log(` cost: ${cost} generation (${mode2 === "pro" ? "pro" : "lite, PixelLab's default; --mode pro is 0.5"}, charged on delivery)`);
|
|
24747
|
+
if (args.budget !== void 0 && args.budget < cost) {
|
|
24748
|
+
throw new Error(`--budget ${args.budget} is below this normal map's ${cost}-generation cost`);
|
|
24589
24749
|
}
|
|
24590
24750
|
if (args.dryRun) {
|
|
24591
24751
|
log(" dry run: nothing sent");
|
|
24592
24752
|
return;
|
|
24593
24753
|
}
|
|
24594
|
-
if (!await confirm(` Spend ${
|
|
24754
|
+
if (!await confirm(` Spend ${cost} generation on this normal map?`, args.yes)) return;
|
|
24595
24755
|
loadKeys(args);
|
|
24596
24756
|
let last = "";
|
|
24597
24757
|
const res = await normalMapFile(clientFromEnv(), args.from, {
|
|
24598
24758
|
out,
|
|
24599
24759
|
frames,
|
|
24600
24760
|
convention: args.convention ? convention : void 0,
|
|
24761
|
+
mode: mode2,
|
|
24762
|
+
kind: args.kind,
|
|
24763
|
+
shape: {
|
|
24764
|
+
strength: args.strength,
|
|
24765
|
+
outlineRounding: args.outlineRounding,
|
|
24766
|
+
partShapes: args.partShapes,
|
|
24767
|
+
surfaceDetail: args.surfaceDetail,
|
|
24768
|
+
detailSoftness: args.detailSoftness
|
|
24769
|
+
},
|
|
24601
24770
|
force: args.force,
|
|
24602
24771
|
onProgress: (status) => {
|
|
24603
24772
|
if (status !== last) log(` ${status}\u2026`);
|