Skip to content

Commit

Permalink
quality of use
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed Feb 25, 2023
1 parent 94c5bba commit ec2e251
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 92 deletions.
17 changes: 10 additions & 7 deletions FModel/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@ private async void OnLoaded(object sender, RoutedEventArgs e)
await _applicationView.InitOodle();

if (UserSettings.Default.DiscordRpc == EDiscordRpc.Always)
_discordHandler.Initialize(_applicationView.CUE4Parse.Game);
_discordHandler.Initialize(_applicationView.CUE4Parse.Provider.GameName);

#if DEBUG
await _threadWorkerView.Begin(cancellationToken =>
_applicationView.CUE4Parse.Extract(cancellationToken,
"fortnitegame/Content/Characters/Player/Male/Medium/Bodies/M_MED_BlueGlaze/Meshes/M_MED_BlueGlaze.uasset"));
await _threadWorkerView.Begin(cancellationToken =>
_applicationView.CUE4Parse.Extract(cancellationToken,
"fortnitegame/Content/Animation/Game/MainPlayer/Emotes/Troops/Emote_Troops_CMM_M.uasset"));
// await _threadWorkerView.Begin(cancellationToken =>
// _applicationView.CUE4Parse.Extract(cancellationToken,
// "fortnitegame/Content/Characters/Player/Female/Medium/Bodies/F_MED_Prime/Meshes/F_MED_Prime.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"));
#endif
}

Expand Down
8 changes: 4 additions & 4 deletions FModel/Services/DiscordService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public class DiscordHandler
new() {Label = "Support us", Url = Constants.DONATE_LINK}
};

public void Initialize(FGame game)
public void Initialize(string gameName)
{
_currentPresence = new RichPresence
{
Assets = _staticAssets,
Timestamps = _timestamps,
Buttons = _buttons,
Details = $"{game.GetDescription()} - Idling"
Details = $"{gameName} - Idling"
};

_client.OnReady += (_, args) => Log.Information("{Username}#{Discriminator} ({UserId}) is now ready", args.User.Username, args.User.Discriminator, args.User.ID);
Expand All @@ -48,7 +48,7 @@ public void Initialize(FGame game)

public void UpdatePresence(CUE4ParseViewModel viewModel) =>
UpdatePresence(
$"{viewModel.Game.GetDescription()} - {viewModel.Provider.MountedVfs.Count}/{viewModel.Provider.MountedVfs.Count + viewModel.Provider.UnloadedVfs.Count} Packages",
$"{viewModel.Provider.GameName} - {viewModel.Provider.MountedVfs.Count}/{viewModel.Provider.MountedVfs.Count + viewModel.Provider.UnloadedVfs.Count} Packages",
$"Mode: {UserSettings.Default.LoadingMode.GetDescription()} - {viewModel.SearchVm.ResultsCount:### ### ###} Loaded Assets".Trim());

public void UpdatePresence(string details, string state)
Expand Down Expand Up @@ -93,4 +93,4 @@ public void Dispose()
_client.Dispose();
}
}
}
}
4 changes: 2 additions & 2 deletions FModel/Views/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@
<Separator Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource CustomSeparator}" />

<TextBlock Grid.Row="5" Grid.Column="0" Text="Preview Max Texture Size" VerticalAlignment="Center" Margin="0 0 0 5" />
<Slider Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="3" TickPlacement="None" Minimum="4" Maximum="4096"
AutoToolTipPlacement="BottomRight" IsMoveToPointEnabled="True" IsSnapToTickEnabled="True" Ticks="4,8,16,32,64,128,256,512,1024,2048,4096"
<Slider Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="3" TickPlacement="None" Minimum="4" Maximum="4096" Ticks="4,8,16,32,64,128,256,512,1024,2048,4096"
AutoToolTipPlacement="BottomRight" IsMoveToPointEnabled="True" IsSnapToTickEnabled="True" Margin="0 5 0 5"
Value="{Binding PreviewMaxTextureSize, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"/>

<TextBlock Grid.Row="6" Grid.Column="0" Text="Preview Static Meshes" VerticalAlignment="Center" Margin="0 0 0 5" />
Expand Down
12 changes: 8 additions & 4 deletions FModel/Views/Snooper/Animations/Animation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void Dispose()
AttachedModels.Clear();
}

public void ImGuiAnimation(Snooper s, Save saver, ImDrawListPtr drawList, Vector2 timelineP0, Vector2 treeP0, Vector2 treeP1, Vector2 timeStep, Vector2 timeRatio, float y, float t, int i)
public void ImGuiAnimation(Snooper s, Save saver, ImDrawListPtr drawList, ImFontPtr fontPtr, Vector2 timelineP0, Vector2 treeP0, Vector2 timeStep, Vector2 timeRatio, float y, float t, int i)
{
var name = $"{Name}##{i}";
var p1 = new Vector2(timelineP0.X + StartTime * timeRatio.X + t, y + t);
Expand Down Expand Up @@ -125,20 +125,24 @@ public void ImGuiAnimation(Snooper s, Save saver, ImDrawListPtr drawList, Vector
}
ImGui.EndMenu();
}
if (ImGui.Selectable("Save"))
if (ImGui.MenuItem("Additive", false))
{
}
if (ImGui.MenuItem("Save"))
{
s.WindowShouldFreeze(true);
saver.Value = s.Renderer.Options.TrySave(_export, out saver.Label, out saver.Path);
s.WindowShouldFreeze(false);
}
ImGui.Separator();
if (ImGui.Selectable("Copy Path to Clipboard")) ImGui.SetClipboardText(Path);
if (ImGui.MenuItem("Copy Path to Clipboard")) ImGui.SetClipboardText(Path);
});

drawList.AddRectFilled(p1, p2, IsSelected ? 0xFF48B048 : 0xFF175F17, 5.0f, ImDrawFlags.RoundCornersTop);
for (int j = 0; j < Sequences.Length; j++)
{
Sequences[j].DrawSequence(drawList, timelineP0.X, p2, timeStep, timeRatio, t);
Sequences[j].DrawSequence(drawList, fontPtr, timelineP0.X, p2, timeStep, timeRatio, t, IsSelected);
}

ImGui.SetCursorScreenPos(treeP0 with { Y = p1.Y });
Expand Down
21 changes: 15 additions & 6 deletions FModel/Views/Snooper/Animations/Sequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ public Sequence(CAnimSequence sequence)
IsAdditive = sequence.bAdditive;
}

public void DrawSequence(ImDrawListPtr drawList, float x, Vector2 p2, Vector2 timeStep, Vector2 timeRatio, float t)
public void DrawSequence(ImDrawListPtr drawList, ImFontPtr fontPtr, float x, Vector2 p2, Vector2 timeStep, Vector2 timeRatio, float t, bool animSelected)
{
var q1 = new Vector2(x + StartTime * timeRatio.X + t, p2.Y - timeStep.Y / 2.0f);
var q2 = p2 with { X = x + EndTime * timeRatio.X - t - t };
var halfThickness = t / 2.0f;
var q1 = new Vector2(x + StartTime * timeRatio.X + t + halfThickness, p2.Y - timeStep.Y / 2.0f);
var q2 = p2 with { X = x + EndTime * timeRatio.X - t * 2.0f };

drawList.AddLine(new Vector2(q1.X, q2.Y), q1, 0x50FFFFFF, 1.0f);
drawList.AddLine(q1, new Vector2(q2.X, q1.Y), 0x50FFFFFF, 1.0f);
drawList.AddLine(new Vector2(q2.X, q1.Y), q2, 0x50FFFFFF, 1.0f);
drawList.PushClipRect(q1, q2 with { X = q2.X + t }, true);

var lineColor = animSelected ? 0xA0FFFFFF : 0x50FFFFFF;
drawList.AddLine(new Vector2(q1.X, q2.Y), q1, lineColor, 1.0f);
drawList.AddLine(q1, new Vector2(q2.X, q1.Y), lineColor, 1.0f);
drawList.AddLine(new Vector2(q2.X, q1.Y), q2, lineColor, 1.0f);

if (IsAdditive)
drawList.AddText(fontPtr, 12, new Vector2(q1.X + t, q1.Y + halfThickness), animSelected ? 0xFFFFFFFF : 0x50FFFFFF, "Is Additive");

drawList.PopClipRect();
}
}
2 changes: 1 addition & 1 deletion FModel/Views/Snooper/Animations/Skeleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void Animate(CAnimSet anim, bool rotationOnly)
Relation = boneIndices.HasParentTrack ? _animatedBonesTransform[s][boneIndices.ParentTrackIndex][frame].Matrix : originalTransform.Relation,
Rotation = boneOrientation,
Position = rotationOnly ? originalTransform.Position : bonePosition,
Scale = boneScale
Scale = sequence.bAdditive ? FVector.OneVector : boneScale
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions FModel/Views/Snooper/Animations/TimeTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void ImGuiTimeline(Snooper s, Save saver, Dictionary<string, Texture> ico
for (int i = 0; i < animations.Count; i++)
{
var y = timelineP0.Y + _timeBarHeight + _timeStep.Y * i;
animations[i].ImGuiAnimation(s, saver, drawList, timelineP0, treeP0, treeP1, _timeStep, timeRatio, y, _thickness, i);
animations[i].ImGuiAnimation(s, saver, drawList, fontPtr, timelineP0, treeP0, _timeStep, timeRatio, y, _thickness, i);
DrawSeparator(drawList, timelineP0, y + _timeStep.Y, animations[i].EndTime * timeRatio.X, ETrackerType.End);
}
ImGui.PopStyleVar();
Expand All @@ -155,7 +155,7 @@ public void ImGuiTimeline(Snooper s, Save saver, Dictionary<string, Texture> ico
var y = timelineP0.Y + _timeBarHeight + _timeStep.Y * i;
for (int j = 0; j < animations[i].Sequences.Length - 1; j++)
{
DrawSeparator(drawList, timelineP0, y + _timeStep.Y - _thickness, animations[i].Sequences[j].EndTime * timeRatio.X - 1.0f, ETrackerType.InBetween);
DrawSeparator(drawList, timelineP0, y + _timeStep.Y - _thickness, animations[i].Sequences[j].EndTime * timeRatio.X - 0.5f, ETrackerType.InBetween);
}
}

Expand Down
Loading

0 comments on commit ec2e251

Please sign in to comment.