diff --git a/CUE4Parse b/CUE4Parse index d0a84960..4a3efdaf 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit d0a849608247dbdcb14b9b6e6851addd761f3c73 +Subproject commit 4a3efdafa7321e98d0ca1c29d3c3d2140980ab9f diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index c5bcaea6..1dcc3fc3 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -16,7 +16,7 @@ using CUE4Parse.UE4.Assets.Exports; using CUE4Parse.UE4.Assets.Exports.Animation; using CUE4Parse.UE4.Assets.Exports.Material; using CUE4Parse.UE4.Assets.Exports.SkeletalMesh; -using CUE4Parse.UE4.Assets.Exports.Solaris; +using CUE4Parse.UE4.Assets.Exports.Verse; using CUE4Parse.UE4.Assets.Exports.Sound; using CUE4Parse.UE4.Assets.Exports.StaticMesh; using CUE4Parse.UE4.Assets.Exports.Texture; @@ -781,13 +781,13 @@ public class CUE4ParseViewModel : ViewModel var saveTextures = HasFlag(bulk, EBulkType.Textures); switch (export) { - case USolarisDigest solarisDigest when isNone: + case UVerseDigest verseDigest when isNone: { if (!TabControl.CanAddTabs) return false; - TabControl.AddTab($"{solarisDigest.ProjectName}.verse"); + TabControl.AddTab($"{verseDigest.ProjectName}.verse"); TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("verse"); - TabControl.SelectedTab.SetDocumentText(solarisDigest.ReadableCode, false, false); + TabControl.SelectedTab.SetDocumentText(verseDigest.ReadableCode, false, false); return true; } case UTexture2D { IsVirtual: false } texture when isNone: diff --git a/FModel/Views/Snooper/Animations/Bone.cs b/FModel/Views/Snooper/Animations/Bone.cs index 50268a1d..460618f3 100644 --- a/FModel/Views/Snooper/Animations/Bone.cs +++ b/FModel/Views/Snooper/Animations/Bone.cs @@ -8,7 +8,7 @@ public class Bone public string LoweredParentName; public int SkeletonIndex = -1; - public bool[] IsAnimated; + public bool IsAnimated; public Bone(int i, int p, Transform t) { @@ -21,5 +21,5 @@ public class Bone public bool IsMapped => SkeletonIndex > -1; public bool IsNative => Index == SkeletonIndex; - public override string ToString() => $"Mesh Ref '{Index}' is Skel Ref '{SkeletonIndex}' ({IsNative})"; + public override string ToString() => $"Mesh Ref '{Index}' is Skel Ref '{SkeletonIndex}' ({IsAnimated})"; } diff --git a/FModel/Views/Snooper/Animations/Skeleton.cs b/FModel/Views/Snooper/Animations/Skeleton.cs index 33cf1681..d79b99f5 100644 --- a/FModel/Views/Snooper/Animations/Skeleton.cs +++ b/FModel/Views/Snooper/Animations/Skeleton.cs @@ -62,7 +62,7 @@ public class Skeleton : IDisposable public void Animate(CAnimSet anim, bool rotationOnly) { - TrackSkeleton(anim); + MapSkeleton(anim); _animatedBonesTransform = new Transform[anim.Sequences.Count][][]; for (int s = 0; s < _animatedBonesTransform.Length; s++) @@ -74,9 +74,9 @@ public class Skeleton : IDisposable _animatedBonesTransform[s][bone.Index] = new Transform[sequence.NumFrames]; var skeletonBoneIndex = bone.SkeletonIndex; - bone.IsAnimated[s] = sequence.OriginalSequence.FindTrackForBoneIndex(skeletonBoneIndex) >= 0; - if (!bone.IsAnimated[s]) + if (sequence.OriginalSequence.FindTrackForBoneIndex(skeletonBoneIndex) < 0) { + bone.IsAnimated |= false; for (int frame = 0; frame < _animatedBonesTransform[s][bone.Index].Length; frame++) { _animatedBonesTransform[s][bone.Index][frame] = new Transform @@ -88,6 +88,7 @@ public class Skeleton : IDisposable } else { + bone.IsAnimated |= true; for (int frame = 0; frame < _animatedBonesTransform[s][bone.Index].Length; frame++) { var boneOrientation = bone.Rest.Rotation; @@ -162,7 +163,7 @@ public class Skeleton : IDisposable } } - private void TrackSkeleton(CAnimSet anim) + private void MapSkeleton(CAnimSet anim) { ResetAnimatedData(); @@ -174,19 +175,18 @@ public class Skeleton : IDisposable continue; bone.SkeletonIndex = boneIndex; + bone.IsAnimated = false; } - var seqCount = anim.Sequences.Count; +#if DEBUG foreach ((var boneName, var bone) in BonesByLoweredName) { - bone.IsAnimated = new bool[seqCount]; -#if DEBUG if (bone.IsRoot || bone.IsMapped) // assuming root bone always is mapped continue; Log.Warning($"{Name} Bone Mismatch: {boneName} ({bone.Index}) was not present in the anim's target skeleton"); -#endif } +#endif } public void ResetAnimatedData(bool full = false) @@ -194,7 +194,7 @@ public class Skeleton : IDisposable foreach (var bone in BonesByLoweredName.Values) { bone.SkeletonIndex = -1; - bone.IsAnimated = null; + bone.IsAnimated = false; } if (!full) return; diff --git a/FModel/Views/Snooper/SnimGui.cs b/FModel/Views/Snooper/SnimGui.cs index 6fcff481..81a775c3 100644 --- a/FModel/Views/Snooper/SnimGui.cs +++ b/FModel/Views/Snooper/SnimGui.cs @@ -295,7 +295,7 @@ public class SnimGui - WASD to move around - Shift to move faster - XC to zoom - - Z to animate selected model + - Z to animate the selected model - Left Mouse Button pressed to look around - Right Click to select a model in the world diff --git a/FModel/Views/Snooper/Snooper.cs b/FModel/Views/Snooper/Snooper.cs index 23e7b188..f4749be4 100644 --- a/FModel/Views/Snooper/Snooper.cs +++ b/FModel/Views/Snooper/Snooper.cs @@ -159,7 +159,9 @@ public class Snooper : GameWindow var delta = (float) e.Time; Renderer.CameraOp.Modify(KeyboardState, delta); - if (KeyboardState.IsKeyPressed(Keys.Z)) + if (KeyboardState.IsKeyPressed(Keys.Z) && + Renderer.Options.TryGetModel(out var selectedModel) && + selectedModel.HasSkeleton) { Renderer.Options.RemoveAnimations(); Renderer.Options.AnimateMesh(true);