Skip to content

Commit

Permalink
Fix skeleton changes not being detected when switching between hairst…
Browse files Browse the repository at this point in the history
…yles with same amount of bones
  • Loading branch information
RisaDev committed Nov 26, 2024
1 parent da7eb91 commit eaeb4cf
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion CustomizePlus/Armatures/Data/Armature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,32 @@ public bool IsSkeletonUpdated(CharacterBase* cBase)
{
for (var i = 0; i < cBase->Skeleton->PartialSkeletonCount; ++i)
{
if (i == 2)
continue; //hair is handled separately

var newPose = cBase->Skeleton->PartialSkeletons[i].GetHavokPose(Constants.TruePoseIndex);

if (newPose != null
&& newPose->Skeleton->Bones.Length != _partialSkeletons[i].Length)
return true;
//todo: compare bones for hair partial skeleton [2]
}

//handle hair separately because different hairstyles can have the same amount of bones.
if(cBase->Skeleton->PartialSkeletonCount > 2)
{
var newPose = cBase->Skeleton->PartialSkeletons[2].GetHavokPose(Constants.TruePoseIndex);

if(newPose != null)
{
if(newPose->Skeleton->Bones.Length != _partialSkeletons[2].Length)
return true;

for(var i = 0; i < newPose->Skeleton->Bones.Length; i++)
{
if (newPose->Skeleton->Bones[i].Name.String != _partialSkeletons[2][i].BoneName)
return true;
}
}
}
}

Expand Down

0 comments on commit eaeb4cf

Please sign in to comment.