fix(animation): variant randomness no longer permanently cached + fix FullHead false-positive

Two fixes from the animation audit:

1. Variant cache key now includes the resolved animation name (e.g., Struggle.2).
   Previously, the cache key only used context+parts, so the first random variant
   pick was reused forever. Now each variant gets its own cache entry, and a fresh
   random pick happens each time the context changes.

2. FullHead check changed from contains("Head") to startsWith("gltf_FullHead")
   to prevent false positives on names like FullOverhead or FullAhead.
This commit is contained in:
NotEvil
2026-04-17 03:11:29 +02:00
parent e56e6dd551
commit a3287b7db8
2 changed files with 38 additions and 23 deletions

View File

@@ -587,7 +587,10 @@ public final class GltfPoseConverter {
// Head is protected by default — only enabled as a free bone when the animation
// name contains "Head" (e.g., FullHeadStruggle, FullHeadIdle).
// This lets artists opt-in per animation without affecting the item's regions.
boolean allowFreeHead = isFullBodyAnimation && animName.contains("Head");
// FullHead prefix (e.g., FullHeadStruggle) opts into head as a free bone.
// Use startsWith to avoid false positives (e.g., FullOverhead, FullAhead).
boolean allowFreeHead = isFullBodyAnimation &&
animName.startsWith("gltf_FullHead");
String[] allParts = {
"head",