animation relative retargeting? + covering fmodel's ass

This commit is contained in:
4sval 2023-02-26 06:14:05 +01:00
parent 412c5dd786
commit ab13eff151
3 changed files with 16 additions and 7 deletions

View File

@ -78,13 +78,10 @@ public partial class MainWindow
#if DEBUG
// await _threadWorkerView.Begin(cancellationToken =>
// _applicationView.CUE4Parse.Extract(cancellationToken,
// "fortnitegame/Content/Characters/Player/Female/Medium/Bodies/F_MED_Prime/Meshes/F_MED_Prime.uasset"));
// "Phoenix/Content/RiggedObjects/Characters/Creatures/Elves/OneOff/HouseElf_F_T3/SK_HouseElf_F_T3_Master.uasset"));
// await _threadWorkerView.Begin(cancellationToken =>
// _applicationView.CUE4Parse.Extract(cancellationToken,
// "fortnitegame/Content/Animation/Game/MainPlayer/Emotes/Annual/Emote_Annual_CMM_BODY.uasset"));
// await _threadWorkerView.Begin(cancellationToken =>
// _applicationView.CUE4Parse.Extract(cancellationToken,
// "fortnitegame/Content/Animation/Game/MainPlayer/Emotes/Annual/Emote_Annual_CMF_BODY.uasset"));
// "Phoenix/Content/Animation/Creatures/Elves/ELF_Rct_Mandrake_Loop_anm.uasset"));
#endif
}

View File

@ -94,7 +94,9 @@ public class Skeleton : IDisposable
{
_animatedBonesTransform[s][boneIndices.BoneIndex][frame] = new Transform
{
Relation = originalTransform.LocalMatrix * _animatedBonesTransform[s][boneIndices.ParentTrackIndex][frame].Matrix
Relation = boneIndices.HasParentTrack ?
originalTransform.LocalMatrix * _animatedBonesTransform[s][boneIndices.ParentTrackIndex][frame].Matrix :
originalTransform.Relation
};
}
}
@ -131,8 +133,14 @@ public class Skeleton : IDisposable
}
case EBoneTranslationRetargetingMode.AnimationRelative when !rotationOnly:
{
// https://github.com/EpicGames/UnrealEngine/blob/cdaec5b33ea5d332e51eee4e4866495c90442122/Engine/Source/Runtime/Engine/Private/Animation/AnimationRuntime.cpp#L2586
// can't tell if it's working or not
var sourceSkelTrans = originalTransform.Position / Constants.SCALE_DOWN_RATIO;
var refPoseTransform = sequence.RetargetBasePose?[trackIndex] ?? anim.BonePositions[trackIndex];
boneOrientation = boneOrientation * FQuat.Conjugate(originalTransform.Rotation) * refPoseTransform.Rotation;
bonePosition += refPoseTransform.Translation - sourceSkelTrans;
boneScale *= refPoseTransform.Scale3D * originalTransform.Scale;
boneOrientation.Normalize();
break;
}
case EBoneTranslationRetargetingMode.OrientAndScale when !rotationOnly:

View File

@ -751,6 +751,10 @@ Snooper aims to give an accurate preview of models, materials, skeletal animatio
float framerate = ImGui.GetIO().Framerate;
ImGui.SetCursorPos(size with { X = 7.5f });
ImGui.Text($"FPS: {framerate:0} ({1000.0f / framerate:0.##} ms)");
const string label = "Previewed content may differ from final version saved or used in-game.";
ImGui.SetCursorPos(size with { X = size.X - ImGui.CalcTextSize(label).X - 7.5f });
ImGui.TextColored(new Vector4(0.50f, 0.50f, 0.50f, 1.00f), label);
}, false);
ImGui.PopStyleVar();
}