fix(dvergur): carve the hood out of the dvergr mesh as a submesh
The log settled it: the Dverger prefab holds a single renderer, dvergr, with the hood, body and clothes baked into one mesh. There was never a separate object to lift out, so the whole-object search could only ever fail. Resolution now falls through three steps - a separate renderer object, a submesh picked out by its material name, and an index pinned by hand in DvergurConfig - and the submesh path rebuilds the chosen triangles as a standalone skinned renderer. Vertices, bone weights and bindposes are all carried over untouched and only the triangle list is narrowed, so the skinning still lines up and the player rig places the hood without any offsets. The candidate list also covers the mage variants, which wear a different hood and may keep it as its own object. dumpdverger now reports submesh count, per-submesh material and triangle count, which is the part that actually identifies the hood.
This commit is contained in:
parent
8df7681cea
commit
d157a730a3
3 changed files with 220 additions and 59 deletions
|
|
@ -52,11 +52,31 @@ namespace RacesOfValheim
|
|||
//
|
||||
// The hood is lifted straight off the Dvergr NPC rather than off the Dverger Circlet item:
|
||||
// the circlet is a metal band, not the hood the race is meant to wear.
|
||||
//
|
||||
// 'Dverger' turned out to carry a single renderer named 'dvergr' with the hood baked into
|
||||
// the same mesh as the body, so a whole-object lift was never going to work. Resolution now
|
||||
// tries, in order: a separate renderer object; a submesh of a combined mesh picked out by
|
||||
// its material; and finally an index pinned by hand below.
|
||||
public const string DvergerPrefabName = "Dverger";
|
||||
|
||||
// Matched against renderer object names inside that prefab, lowercased, by Contains.
|
||||
// Scanned in order. The mage variants are included because they wear a different hood and
|
||||
// may well keep it as its own object.
|
||||
public static readonly string[] DvergerPrefabCandidates =
|
||||
{
|
||||
"Dverger", "DvergerMage", "DvergerMageFire", "DvergerMageIce", "DvergerMageSupport"
|
||||
};
|
||||
|
||||
// Matched against renderer object names, lowercased, by Contains.
|
||||
public static readonly string[] HoodRendererNames = { "hat", "hood", "helmet", "cap" };
|
||||
|
||||
// Matched against material names when the hood is a submesh of a combined mesh.
|
||||
public static readonly string[] HoodMaterialNames = { "hat", "hood", "helm", "cap", "head" };
|
||||
|
||||
// Escape hatch for when neither name matches: pin the prefab and the submesh index by hand
|
||||
// from what `dumpdverger` reports. An empty prefab or a negative index means "auto".
|
||||
public const string HoodForcedPrefab = "";
|
||||
public const int HoodForcedSubmeshIndex = -1;
|
||||
|
||||
// Applied on top of whatever the rig positions the hood at. Identity is correct when the
|
||||
// bone remap succeeds; these exist so a stubborn mesh can be nudged without a code change.
|
||||
public static readonly Vector3 HoodOffsetPosition = Vector3.zero;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue