spine-parts 2.23.1 → 2.23.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/docs/AUTHORING.md +23 -0
- package/package.json +1 -1
- package/src/build.ts +9 -1
- package/src/paintingedges.ts +35 -1
package/docs/AUTHORING.md
CHANGED
|
@@ -798,6 +798,28 @@ existing geometry refusal and its message.
|
|
|
798
798
|
Region take entries accept the same optional `crop` and use this transport before
|
|
799
799
|
selecting the seeded component on the target run canvas.
|
|
800
800
|
|
|
801
|
+
### Owner coverage transfers (`painting_allocation.json`, issue #1146)
|
|
802
|
+
|
|
803
|
+
Under `assemble.project: "visible"`, assemble writes `painting_allocation.json`
|
|
804
|
+
beside `parts.json`. Other projection modes remove a stale report on output
|
|
805
|
+
reuse. Its `spec` is `rig-parts-painting-allocation/1`, `grid` is the native rig
|
|
806
|
+
size, `code` is `PAINTING_EDGE_COVERAGE_TRANSFER`, and `stage` names paintingEdges
|
|
807
|
+
after piece guarding and restoration.
|
|
808
|
+
The report includes the owner `supplier`, `refused` reason counts, `lineage`
|
|
809
|
+
faults, `fallbackHeld` count and `coverageTransfers` rows.
|
|
810
|
+
|
|
811
|
+
Each transfer names `front`, `receiver` and raw-plan `owner`, with
|
|
812
|
+
`pixels.count` and `pixels.spans`. Spans are sorted native rig
|
|
813
|
+
`[y, left, right-exclusive]` coordinates. A row requires an accepted allocation
|
|
814
|
+
to a receiver drawn behind FRONT, positive FRONT alpha in the legacy scratch
|
|
815
|
+
evaluation, zero applied FRONT alpha and positive applied receiver alpha.
|
|
816
|
+
Held clears and restored FRONT coverage are excluded. This is an edge-pass
|
|
817
|
+
observation, before later assembly stages. It establishes neither painted
|
|
818
|
+
strand order nor motion-space gaps.
|
|
819
|
+
|
|
820
|
+
`PAINTING_EDGE_COVERAGE_TRANSFER` prints the pixel count and report filename.
|
|
821
|
+
The report observes the existing allocation and leaves its raster writes intact.
|
|
822
|
+
|
|
801
823
|
### Residual front/back edges (`edge_residuals.json`, issue #999)
|
|
802
824
|
|
|
803
825
|
Under `assemble.project: "visible"`, assemble writes `edge_residuals.json` beside
|
|
@@ -5266,6 +5288,7 @@ those settings. Changing a config seed alone cannot change a no-config run.
|
|
|
5266
5288
|
| <a id="ASSEMBLE_TAKE_DEPTH_AMBIGUOUS"></a>`ASSEMBLE_TAKE_DEPTH_AMBIGUOUS` | different original runs have equal or null depths | use a run with distinct numeric depths; do not invent an inter-run tie order |
|
|
5267
5289
|
| <a id="ASSEMBLE_TAKE_PLAN_ORDER"></a>`ASSEMBLE_TAKE_PLAN_ORDER` | supplied plan reverses an overlapping mixed-run pair: two-run full-layer head roles first, scalar depth within a role band (head-run and single-run rows use scalar depth); names the parts and support intersection | use the order drafted by `assemble --propose-plan`; fallback headwear follows the body and precedes the face, front hair follows the face; disjoint supports impose no plan-order constraint |
|
|
5268
5290
|
| <a id="EDGE_PAIR_RESIDUAL"></a>`EDGE_PAIR_RESIDUAL` | report-only front/back residual candidates after visible edge composition, with pixel spans, boxes and coverage | read measured candidates and explicit skipped/unavailable reasons in `edge_residuals.json`. No pass/fail threshold is applied |
|
|
5291
|
+
| <a id="PAINTING_EDGE_COVERAGE_TRANSFER"></a>`PAINTING_EDGE_COVERAGE_TRANSFER` | accepted allocation clears legacy FRONT coverage into a BEHIND owner | read native rig membership in `painting_allocation.json`. Painted order and motion gaps require separate evidence |
|
|
5269
5292
|
| <a id="ASSEMBLE_REGION_TAKE_REFERENCE_IMPLICIT"></a>`ASSEMBLE_REGION_TAKE_REFERENCE_IMPLICIT` | warning, `reference` is absent and the predicate uses `--source` | declare a painting reference and its PNG hash to keep the mask independent of projection-source changes |
|
|
5270
5293
|
| <a id="ASSEMBLE_REGION_TAKE_REFERENCE"></a>`ASSEMBLE_REGION_TAKE_REFERENCE` | a declared region reference is unreadable | supply the declared PNG, with `source: true` or `painting` and its byte hash |
|
|
5271
5294
|
| <a id="ASSEMBLE_REGION_TAKE_REFERENCE_MATCH"></a>`ASSEMBLE_REGION_TAKE_REFERENCE_MATCH` | a reference hash or painting dimensions differ | supply the declared PNG and preserve the source geometry |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-parts",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.2",
|
|
4
4
|
"description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/build.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { SUPPORT_DOMAINS_FILE, writeSupportDomains } from './supportdomains.ts';
|
|
|
6
6
|
import { COINCIDE_LINE, supportLines } from './coincide.ts';
|
|
7
7
|
import { DEFAULT_SEAM_RULE } from './seamrule.ts';
|
|
8
8
|
import { DEFAULT_PROJECT_RULE } from './projectrule.ts';
|
|
9
|
-
import { EDGE_CONTRAST } from './paintingedges.ts';
|
|
9
|
+
import { EDGE_CONTRAST, PAINTING_ALLOCATION_FILE, PAINTING_EDGE_COVERAGE_TRANSFER } from './paintingedges.ts';
|
|
10
10
|
import { SETUP_PAINTING_LINE, setupPaintingLines } from './setuppainting.ts';
|
|
11
11
|
import { boundaryColourLines } from './boundarycolour.ts';
|
|
12
12
|
import { writeMaterialSources } from './cutmaterialio.ts';
|
|
@@ -846,6 +846,13 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
846
846
|
const residualPath = join(dirname(outs.partsJson), EDGE_RESIDUAL_FILE);
|
|
847
847
|
if (result.edgeResiduals === undefined) rmSync(residualPath, { force: true });
|
|
848
848
|
else writeFileSync(residualPath, JSON.stringify(result.edgeResiduals, null, 2) + '\n');
|
|
849
|
+
const allocationPath = join(dirname(outs.partsJson), PAINTING_ALLOCATION_FILE);
|
|
850
|
+
const allocation = result.paintingEdges?.allocation;
|
|
851
|
+
if (allocation === undefined) rmSync(allocationPath, { force: true });
|
|
852
|
+
else writeFileSync(allocationPath, JSON.stringify({ spec: 'rig-parts-painting-allocation/1',
|
|
853
|
+
code: PAINTING_EDGE_COVERAGE_TRANSFER,
|
|
854
|
+
stage: 'paintingEdges after piece guarding and restoration', grid: result.parts.rig_size,
|
|
855
|
+
...allocation }, null, 2) + '\n');
|
|
849
856
|
for (const { record, image, depthImage } of result.images) {
|
|
850
857
|
writePng(join(outs.partsDir, `${record.name}.png`), image);
|
|
851
858
|
if (depthImage !== undefined && record.depth !== undefined) writePng(join(outs.partsDir, record.depth.image), depthImage);
|
|
@@ -876,6 +883,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
876
883
|
if (e.allocation !== undefined) {
|
|
877
884
|
const a = e.allocation;
|
|
878
885
|
log(`painting owner: ${a.supplier}; ${a.fallbackHeld} clean-fallback part px held by piece preservation`);
|
|
886
|
+
log(`${PAINTING_EDGE_COVERAGE_TRANSFER}: ${a.coverageTransfers.reduce((n, row) => n + row.pixels.count, 0)} native rig px; membership in ${PAINTING_ALLOCATION_FILE}`);
|
|
879
887
|
for (const [reason, px] of Object.entries(a.refused)) log(` painting owner refused: ${reason}, ${px} edge px`);
|
|
880
888
|
for (const fault of a.lineage) log(` painting receiver refused: "${fault.receiver}", ${fault.reason}; one declared raw-plan ancestor is required`);
|
|
881
889
|
}
|
package/src/paintingedges.ts
CHANGED
|
@@ -148,6 +148,8 @@ export const EDGE_RADIUS = 3;
|
|
|
148
148
|
export const EDGE_OWNER_ALPHA = 128;
|
|
149
149
|
/** The least front contrast resolved, max channel. Equal to `ERROR_LIMIT` in `src/assemble.ts` (held by the selftest). */
|
|
150
150
|
export const EDGE_CONTRAST = 40;
|
|
151
|
+
export const PAINTING_ALLOCATION_FILE = 'painting_allocation.json';
|
|
152
|
+
export const PAINTING_EDGE_COVERAGE_TRANSFER = 'PAINTING_EDGE_COVERAGE_TRANSFER';
|
|
151
153
|
|
|
152
154
|
/** Why an edge pixel was left as it was; see {@link paintingEdges}. */
|
|
153
155
|
export interface PaintingEdgeSkips {
|
|
@@ -180,6 +182,15 @@ export interface PaintingAllocationReading {
|
|
|
180
182
|
refused: Record<string, number>;
|
|
181
183
|
lineage: PaintingReceivers['faults'];
|
|
182
184
|
fallbackHeld: number;
|
|
185
|
+
/** Accepted transfers after piece guarding and restoration. These observe
|
|
186
|
+
* allocation, without inferring painted order or motion-space coverage. */
|
|
187
|
+
coverageTransfers: Array<{
|
|
188
|
+
front: string;
|
|
189
|
+
receiver: string;
|
|
190
|
+
owner: string;
|
|
191
|
+
/** Native rig pixels, sorted [y, left, right-exclusive] spans. */
|
|
192
|
+
pixels: { count: number; spans: Array<[number, number, number]> };
|
|
193
|
+
}>;
|
|
183
194
|
}
|
|
184
195
|
|
|
185
196
|
export interface PaintingEdgeOptions {
|
|
@@ -276,7 +287,7 @@ function applyPaintingEdges(
|
|
|
276
287
|
const allocation = options.owner;
|
|
277
288
|
const events: Array<{ p: number; front: number; behind: number; target: number; affected: number[]; status: string; reason: string }> = [];
|
|
278
289
|
const reading: PaintingAllocationReading | undefined = allocation === undefined ? undefined
|
|
279
|
-
: { supplier: allocation.supplier, refused: {}, lineage: allocation.faults, fallbackHeld: 0 };
|
|
290
|
+
: { supplier: allocation.supplier, refused: {}, lineage: allocation.faults, fallbackHeld: 0, coverageTransfers: [] };
|
|
280
291
|
const W = srcr.width;
|
|
281
292
|
const H = srcr.height;
|
|
282
293
|
const n = parts.length;
|
|
@@ -831,6 +842,29 @@ function applyPaintingEdges(
|
|
|
831
842
|
for (const p of writes.keys()) options.written?.(i, p);
|
|
832
843
|
});
|
|
833
844
|
for (const [p, front] of restore) if (!planned[front].has(p)) options.written?.(front, p);
|
|
845
|
+
// The legacy FRONT surface was moved to an accepted BEHIND owner. Read the
|
|
846
|
+
// applied output, including restoration: a held clear is never a transfer.
|
|
847
|
+
if (reading !== undefined && allocation !== undefined && existing !== undefined) {
|
|
848
|
+
const groups = new Map<string, PaintingAllocationReading['coverageTransfers'][number]>();
|
|
849
|
+
for (const event of events) {
|
|
850
|
+
const { p, front, target } = event;
|
|
851
|
+
if (event.status !== 'assigned' || target >= front ||
|
|
852
|
+
existing.parts[front].data[p * 4 + 3] === 0 || parts[front].data[p * 4 + 3] !== 0 ||
|
|
853
|
+
parts[target].data[p * 4 + 3] === 0) continue;
|
|
854
|
+
const key = `${front}/${target}`;
|
|
855
|
+
let row = groups.get(key);
|
|
856
|
+
if (row === undefined) {
|
|
857
|
+
row = { front: allocation.receiverNames[front], receiver: allocation.receiverNames[target],
|
|
858
|
+
owner: allocation.names[allocation.pixels[p]], pixels: { count: 0, spans: [] } };
|
|
859
|
+
groups.set(key, row);
|
|
860
|
+
}
|
|
861
|
+
const x = p % W, y = Math.floor(p / W), previous = row.pixels.spans.at(-1);
|
|
862
|
+
if (previous !== undefined && previous[0] === y && previous[2] === x) previous[2]++;
|
|
863
|
+
else row.pixels.spans.push([y, x, x + 1]);
|
|
864
|
+
row.pixels.count++;
|
|
865
|
+
}
|
|
866
|
+
reading.coverageTransfers = [...groups.values()];
|
|
867
|
+
}
|
|
834
868
|
return { changed, resolved, unseparated, skipped, ...(reading === undefined ? {} : { allocation: reading }) };
|
|
835
869
|
}
|
|
836
870
|
|