mirror of
https://github.com/4sval/FModel.git
synced 2026-04-16 22:46:09 -05:00
quality of use
This commit is contained in:
parent
94c5bba770
commit
ec2e25153e
|
|
@ -73,15 +73,18 @@ public partial class MainWindow
|
|||
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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ namespace FModel.Services
|
|||
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);
|
||||
|
|
@ -48,7 +48,7 @@ namespace FModel.Services
|
|||
|
||||
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)
|
||||
|
|
@ -93,4 +93,4 @@ namespace FModel.Services
|
|||
_client.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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" />
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class Animation : IDisposable
|
|||
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);
|
||||
|
|
@ -125,20 +125,24 @@ public class Animation : IDisposable
|
|||
}
|
||||
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 });
|
||||
|
|
|
|||
|
|
@ -28,13 +28,22 @@ public class 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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ public class Skeleton : IDisposable
|
|||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public class TimeTracker : IDisposable
|
|||
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();
|
||||
|
|
@ -155,7 +155,7 @@ public class TimeTracker : IDisposable
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,23 @@ namespace FModel.Views.Snooper;
|
|||
|
||||
public class Swap
|
||||
{
|
||||
public string Title;
|
||||
public string Description;
|
||||
public bool Value;
|
||||
public bool IsAware;
|
||||
public Action Content;
|
||||
|
||||
public Swap()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Title = string.Empty;
|
||||
Description = string.Empty;
|
||||
Value = false;
|
||||
Content = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -32,6 +43,11 @@ public class Save
|
|||
public string Label;
|
||||
public string Path;
|
||||
|
||||
public Save()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Value = false;
|
||||
|
|
@ -84,10 +100,67 @@ public class SnimGui
|
|||
Draw3DViewport(s);
|
||||
DrawNavbar();
|
||||
|
||||
DrawModals(s);
|
||||
|
||||
if (_ti_open) DrawTextureInspector(s);
|
||||
Controller.Render();
|
||||
}
|
||||
|
||||
private void DrawModals(Snooper s)
|
||||
{
|
||||
Modal(_swapper.Title, _swapper.Value, () =>
|
||||
{
|
||||
ImGui.TextWrapped(_swapper.Description);
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, Vector2.Zero);
|
||||
ImGui.Checkbox("Got it! Don't show me again", ref _swapper.IsAware);
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
var size = new Vector2(120, 0);
|
||||
if (ImGui.Button("OK", size))
|
||||
{
|
||||
_swapper.Content();
|
||||
_swapper.Reset();
|
||||
ImGui.CloseCurrentPopup();
|
||||
s.WindowShouldClose(true, false);
|
||||
}
|
||||
|
||||
ImGui.SetItemDefaultFocus();
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Cancel", size))
|
||||
{
|
||||
_swapper.Reset();
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
});
|
||||
|
||||
Modal("Saved", _saver.Value, () =>
|
||||
{
|
||||
ImGui.TextWrapped($"Successfully saved {_saver.Label}");
|
||||
ImGui.Separator();
|
||||
|
||||
var size = new Vector2(120, 0);
|
||||
if (ImGui.Button("OK", size))
|
||||
{
|
||||
_saver.Reset();
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui.SetItemDefaultFocus();
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Show In Explorer", size))
|
||||
{
|
||||
Process.Start("explorer.exe", $"/select, \"{_saver.Path.Replace('/', '\\')}\"");
|
||||
|
||||
_saver.Reset();
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawWorld(Snooper s)
|
||||
{
|
||||
if (ImGui.BeginTable("world_details", 2, ImGuiTableFlags.SizingStretchProp))
|
||||
|
|
@ -344,30 +417,42 @@ Snooper aims to give an accurate preview of models, materials, skeletal animatio
|
|||
if (ImGui.MenuItem("Show", null, model.Show)) model.Show = !model.Show;
|
||||
if (ImGui.MenuItem("Wireframe", null, model.Wireframe)) model.Wireframe = !model.Wireframe;
|
||||
ImGui.Separator();
|
||||
if (ImGui.Selectable("Save"))
|
||||
if (ImGui.MenuItem("Save"))
|
||||
{
|
||||
s.WindowShouldFreeze(true);
|
||||
_saver.Value = s.Renderer.Options.TrySave(model.Export, out _saver.Label, out _saver.Path);
|
||||
s.WindowShouldFreeze(false);
|
||||
}
|
||||
ImGui.BeginDisabled(!model.HasSkeleton);
|
||||
if (ImGui.Selectable("Animate"))
|
||||
if (ImGui.MenuItem("Animate", model.HasSkeleton))
|
||||
{
|
||||
s.Renderer.Options.RemoveAnimations();
|
||||
s.Renderer.Options.AnimateMesh(true);
|
||||
s.WindowShouldClose(true, false);
|
||||
if (_swapper.IsAware)
|
||||
{
|
||||
s.Renderer.Options.RemoveAnimations();
|
||||
s.Renderer.Options.AnimateMesh(true);
|
||||
s.WindowShouldClose(true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_swapper.Title = "Skeletal Animation";
|
||||
_swapper.Description = "You're about to animate a model.\nThe window will close for you to extract an animation!\n\n";
|
||||
_swapper.Content = () =>
|
||||
{
|
||||
s.Renderer.Options.RemoveAnimations();
|
||||
s.Renderer.Options.AnimateMesh(true);
|
||||
};
|
||||
_swapper.Value = true;
|
||||
}
|
||||
}
|
||||
ImGui.EndDisabled();
|
||||
if (ImGui.Selectable("Teleport To"))
|
||||
if (ImGui.MenuItem("Teleport To"))
|
||||
{
|
||||
var instancePos = model.Transforms[model.SelectedInstance].Matrix.Translation;
|
||||
s.Renderer.CameraOp.Teleport(instancePos, model.Box);
|
||||
}
|
||||
|
||||
if (ImGui.Selectable("Delete")) s.Renderer.Options.RemoveModel(guid);
|
||||
if (ImGui.Selectable("Deselect")) s.Renderer.Options.SelectModel(Guid.Empty);
|
||||
if (ImGui.MenuItem("Delete")) s.Renderer.Options.RemoveModel(guid);
|
||||
if (ImGui.MenuItem("Deselect")) s.Renderer.Options.SelectModel(Guid.Empty);
|
||||
ImGui.Separator();
|
||||
if (ImGui.Selectable("Copy Name to Clipboard")) ImGui.SetClipboardText(model.Name);
|
||||
if (ImGui.MenuItem("Copy Path to Clipboard")) ImGui.SetClipboardText(model.Path);
|
||||
});
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
|
|
@ -382,30 +467,6 @@ Snooper aims to give an accurate preview of models, materials, skeletal animatio
|
|||
}
|
||||
});
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
Modal("Saved", _saver.Value, () =>
|
||||
{
|
||||
ImGui.TextWrapped($"Successfully saved {_saver.Label}");
|
||||
ImGui.Separator();
|
||||
|
||||
var size = new Vector2(120, 0);
|
||||
if (ImGui.Button("OK", size))
|
||||
{
|
||||
_saver.Reset();
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui.SetItemDefaultFocus();
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Show In Explorer", size))
|
||||
{
|
||||
Process.Start("explorer.exe", $"/select, \"{_saver.Path.Replace('/', '\\')}\"");
|
||||
|
||||
_saver.Reset();
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawSockets(Snooper s)
|
||||
|
|
@ -499,50 +560,28 @@ Snooper aims to give an accurate preview of models, materials, skeletal animatio
|
|||
{
|
||||
s.Renderer.Options.SelectSection(i);
|
||||
if (ImGui.MenuItem("Show", null, section.Show)) section.Show = !section.Show;
|
||||
if (ImGui.Selectable("Swap"))
|
||||
if (ImGui.MenuItem("Swap"))
|
||||
{
|
||||
if (_swapper.IsAware)
|
||||
{
|
||||
s.Renderer.Options.SwapMaterial(true);
|
||||
s.WindowShouldClose(true, false);
|
||||
}
|
||||
else _swapper.Value = true;
|
||||
else
|
||||
{
|
||||
_swapper.Title = "Material Swap";
|
||||
_swapper.Description = "You're about to swap a material.\nThe window will close for you to extract a material!\n\n";
|
||||
_swapper.Content = () => s.Renderer.Options.SwapMaterial(true);
|
||||
_swapper.Value = true;
|
||||
}
|
||||
}
|
||||
ImGui.Separator();
|
||||
if (ImGui.Selectable("Copy Path to Clipboard")) ImGui.SetClipboardText(material.Path);
|
||||
if (ImGui.MenuItem("Copy Path to Clipboard")) ImGui.SetClipboardText(material.Path);
|
||||
});
|
||||
ImGui.PopID();
|
||||
}
|
||||
ImGui.EndTable();
|
||||
|
||||
Modal("Swap?", _swapper.Value, () =>
|
||||
{
|
||||
ImGui.TextWrapped("You're about to swap a material.\nThe window will close for you to extract a material!\n\n");
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, Vector2.Zero);
|
||||
ImGui.Checkbox("Got it! Don't show me again", ref _swapper.IsAware);
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
var size = new Vector2(120, 0);
|
||||
if (ImGui.Button("OK", size))
|
||||
{
|
||||
_swapper.Reset();
|
||||
s.Renderer.Options.SwapMaterial(true);
|
||||
ImGui.CloseCurrentPopup();
|
||||
s.WindowShouldClose(true, false);
|
||||
}
|
||||
|
||||
ImGui.SetItemDefaultFocus();
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Cancel", size))
|
||||
{
|
||||
_swapper.Reset();
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
});
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user