mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
additive ref pose type
This commit is contained in:
parent
0d6f05c0f9
commit
18f0d3a772
|
|
@ -1 +1 @@
|
|||
Subproject commit 0a7c62d751d6ea91bc12fd59c6541cc01a04cb01
|
||||
Subproject commit 55d34868df2cd33aa4daf6815076f36921492471
|
||||
|
|
@ -76,6 +76,13 @@ public partial class MainWindow
|
|||
_discordHandler.Initialize(_applicationView.CUE4Parse.Provider.GameName);
|
||||
|
||||
#if DEBUG
|
||||
// await _threadWorkerView.Begin(cancellationToken =>
|
||||
// _applicationView.CUE4Parse.Extract(cancellationToken,
|
||||
// "ShooterGame/Content/Characters/_Core/3P/Models/TP_Core_NewMale_Skelmesh.uasset"));
|
||||
// await _threadWorkerView.Begin(cancellationToken =>
|
||||
// _applicationView.CUE4Parse.Extract(cancellationToken,
|
||||
// "Game/Characters/_Core/3P/Anims/TP_Core_SprintAddN_UB.uasset"));
|
||||
|
||||
// await _threadWorkerView.Begin(cancellationToken =>
|
||||
// _applicationView.CUE4Parse.Extract(cancellationToken,
|
||||
// "ShooterGame/Content/Characters/Guide/S0/1P/Models/FP_Guide_S0_Skelmesh.uasset"));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using CUE4Parse_Conversion.Animations;
|
||||
using CUE4Parse_Conversion.Animations.PSA;
|
||||
using CUE4Parse.UE4.Assets.Exports;
|
||||
using CUE4Parse.UE4.Objects.Core.Misc;
|
||||
using CUE4Parse.Utils;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System.Numerics;
|
||||
using CUE4Parse_Conversion.Animations;
|
||||
using CUE4Parse_Conversion.Animations.PSA;
|
||||
using CUE4Parse.Utils;
|
||||
using ImGuiNET;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using CUE4Parse_Conversion.Animations;
|
||||
using CUE4Parse_Conversion.Animations.PSA;
|
||||
using CUE4Parse.UE4.Assets.Exports.Animation;
|
||||
using CUE4Parse.UE4.Objects.Core.Math;
|
||||
using FModel.Views.Snooper.Buffers;
|
||||
|
|
@ -68,7 +68,6 @@ public class Skeleton : IDisposable
|
|||
boneTransform.Relation = parentTransform.Matrix;
|
||||
Matrix4x4.Invert(boneTransform.Matrix, out var inverted);
|
||||
|
||||
|
||||
BonesTransformByIndex[boneIndices.BoneIndex] = boneTransform;
|
||||
_invertedBonesMatrix[boneIndices.BoneIndex] = inverted;
|
||||
}
|
||||
|
|
@ -109,9 +108,7 @@ public class Skeleton : IDisposable
|
|||
var bonePosition = originalTransform.Position;
|
||||
var boneScale = originalTransform.Scale;
|
||||
|
||||
sequence.Tracks[trackedBoneIndex].GetBonePosition(frame, sequence.NumFrames, false, ref bonePosition, ref boneOrientation);
|
||||
if (frame < sequence.Tracks[trackedBoneIndex].KeyScale.Length)
|
||||
boneScale = sequence.Tracks[trackedBoneIndex].KeyScale[frame];
|
||||
sequence.Tracks[trackedBoneIndex].GetBoneTransform(frame, sequence.NumFrames, ref boneOrientation, ref bonePosition, ref boneScale);
|
||||
|
||||
switch (anim.BoneModes[trackedBoneIndex])
|
||||
{
|
||||
|
|
@ -166,15 +163,11 @@ public class Skeleton : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
// revert FixRotationKeys
|
||||
if (trackedBoneIndex > 0) boneOrientation.Conjugate();
|
||||
bonePosition *= Constants.SCALE_DOWN_RATIO;
|
||||
|
||||
_animatedBonesTransform[s][boneIndices.BoneIndex][frame] = new Transform
|
||||
{
|
||||
Relation = boneIndices.IsParentTracked ? _animatedBonesTransform[s][boneIndices.TrackedParentBoneIndex][frame].Matrix : originalTransform.Relation,
|
||||
Rotation = boneOrientation,
|
||||
Position = rotationOnly ? originalTransform.Position : bonePosition,
|
||||
Position = rotationOnly ? originalTransform.Position : bonePosition * Constants.SCALE_DOWN_RATIO,
|
||||
Scale = sequence.bAdditive ? FVector.OneVector : boneScale
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class Renderer : IDisposable
|
|||
float maxElapsedTime;
|
||||
switch (anim)
|
||||
{
|
||||
case UAnimSequence animSequence when /*!animSequence.IsValidAdditive() && */animSequence.Skeleton.TryLoad(out USkeleton skeleton):
|
||||
case UAnimSequence animSequence when !animSequence.IsValidAdditive() && animSequence.Skeleton.TryLoad(out USkeleton skeleton):
|
||||
{
|
||||
var animSet = skeleton.ConvertAnims(animSequence);
|
||||
var animation = new Animation(animSequence, animSet, guid);
|
||||
|
|
@ -120,19 +120,26 @@ public class Renderer : IDisposable
|
|||
Options.AddAnimation(animation);
|
||||
break;
|
||||
}
|
||||
/*case UAnimSequence additiveAnimSequence when additiveAnimSequence.IsValidAdditive() && additiveAnimSequence.Skeleton.TryLoad(out USkeleton additiveSkeleton):
|
||||
case UAnimSequence additiveAnimSequence when additiveAnimSequence.IsValidAdditive() && additiveAnimSequence.Skeleton.TryLoad(out USkeleton additiveSkeleton):
|
||||
{
|
||||
var reference = additiveAnimSequence.RefPoseSeq?.Load<UAnimSequence>();
|
||||
var referenceSkeleton = reference.Skeleton.Load<USkeleton>();
|
||||
var referenceSkeleton = reference?.Skeleton.Load<USkeleton>() ?? additiveSkeleton;
|
||||
|
||||
var additiveAnimSet = additiveSkeleton.ConvertAnims(additiveAnimSequence);
|
||||
var referenceAnimSet = referenceSkeleton.ConvertAnims(reference);
|
||||
|
||||
var additivePoses = FAnimationRuntime.LoadAsPoses(additiveAnimSet, additiveSkeleton);
|
||||
var referencePoses = FAnimationRuntime.LoadAsPoses(referenceAnimSet, referenceSkeleton, additiveAnimSet.Sequences[0].NumFrames, additiveAnimSequence.RefFrameIndex);
|
||||
FCompactPose[] additivePoses = FAnimationRuntime.LoadAsPoses(additiveAnimSet);
|
||||
FCompactPose[] referencePoses = additiveAnimSequence.RefPoseType switch
|
||||
{
|
||||
EAdditiveBasePoseType.ABPT_RefPose => FAnimationRuntime.LoadRestAsPoses(additiveAnimSet),
|
||||
// EAdditiveBasePoseType.ABPT_AnimScaled => FAnimationRuntime.LoadAsPoses(referenceAnimSet),
|
||||
EAdditiveBasePoseType.ABPT_AnimFrame => FAnimationRuntime.LoadAsPoses(referenceAnimSet, additiveAnimSequence.RefFrameIndex),
|
||||
EAdditiveBasePoseType.ABPT_LocalAnimFrame => FAnimationRuntime.LoadAsPoses(additiveAnimSet, additiveAnimSequence.RefFrameIndex),
|
||||
_ => throw new NotImplementedException()
|
||||
};
|
||||
|
||||
var animSeq = additiveAnimSet.Sequences[0];
|
||||
animSeq.OriginalSequence = referenceAnimSet.Sequences[0].OriginalSequence;
|
||||
if (reference != null) animSeq.OriginalSequence = referenceAnimSet.Sequences[0].OriginalSequence;
|
||||
animSeq.Tracks = new List<CAnimTrack>(additivePoses[0].Bones.Length);
|
||||
for (int i = 0; i < additivePoses[0].Bones.Length; i++)
|
||||
{
|
||||
|
|
@ -140,10 +147,10 @@ public class Renderer : IDisposable
|
|||
}
|
||||
|
||||
//loop trough each Pose/Frame and add the output to the empty tracks
|
||||
for (var index = 0; index < additivePoses.Length; index++)
|
||||
for (var frameIndex = 0; frameIndex < additivePoses.Length; frameIndex++)
|
||||
{
|
||||
var addPose = additivePoses[index];
|
||||
var refPose = referencePoses[index];
|
||||
var addPose = additivePoses[frameIndex];
|
||||
var refPose = (FCompactPose)referencePoses[additiveAnimSequence.RefFrameIndex].Clone();
|
||||
switch (additiveAnimSequence.AdditiveAnimType)
|
||||
{
|
||||
case EAdditiveAnimationType.AAT_LocalSpaceBase:
|
||||
|
|
@ -154,8 +161,7 @@ public class Renderer : IDisposable
|
|||
break;
|
||||
}
|
||||
|
||||
refPose.Processed = true;
|
||||
refPose.AddToTracks(animSeq.Tracks);
|
||||
refPose.AddToTracks(animSeq.Tracks, frameIndex);
|
||||
}
|
||||
|
||||
var animation = new Animation(additiveAnimSequence, additiveAnimSet, guid);
|
||||
|
|
@ -163,7 +169,7 @@ public class Renderer : IDisposable
|
|||
model.Skeleton.Animate(additiveAnimSet, AnimateWithRotationOnly);
|
||||
Options.AddAnimation(animation);
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
case UAnimMontage animMontage when animMontage.Skeleton.TryLoad(out USkeleton skeleton):
|
||||
{
|
||||
var animSet = skeleton.ConvertAnims(animMontage);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user