spine-parts 2.30.1 → 2.30.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-parts",
3
- "version": "2.30.1",
3
+ "version": "2.30.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": {
@@ -658,7 +658,7 @@ function applyPaintingEdges(
658
658
  pieces.set(o, set);
659
659
  }
660
660
  // A piece of art the step would split: each cut-off part of it is joined back to its largest part along the path that
661
- // restores the fewest lowered pixels (a 0-1 search inside the piece as it was), and only those are not written.
661
+ // restores the fewest lowered pixels (a 0-1 search inside the piece as it was) and retains their support.
662
662
  for (const [o, set] of pieces) {
663
663
  if (set.size < 2) continue;
664
664
  const labels = [...set].sort((u, v) => now.stats[v].area - now.stats[u].area || u - v);
@@ -692,7 +692,18 @@ function applyPaintingEdges(
692
692
  let best = -1;
693
693
  for (let p = 0; p < W * H; p++) if (now.labels[p] === l && cost[p] >= 0 && (best < 0 || cost[p] < cost[best])) best = p;
694
694
  for (let p = best; p >= 0 && cost[p] > 0; p = from[p]) {
695
- if (nowOver.data[p] === 0 && writes.delete(p)) skipped.pieces++;
695
+ if (nowOver.data[p] === 0 && writes.has(p)) {
696
+ if (allocation === undefined) writes.delete(p);
697
+ else {
698
+ // Keep the original colour at the least alpha that retains this
699
+ // art bridge. Its guarded support is identical to restoring the
700
+ // original pixel, including clean fallbacks and silhouettes.
701
+ const offset = p * 4;
702
+ const original = parts[i].data;
703
+ writes.set(p, [original[offset], original[offset + 1], original[offset + 2], OPAQUE_ALPHA_ABOVE + 1]);
704
+ }
705
+ skipped.pieces++;
706
+ }
696
707
  }
697
708
  }
698
709
  }