Skip to content

Commit

Permalink
HighlightedCheckBox
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed May 24, 2024
1 parent ba31c63 commit eb49b3c
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 8 deletions.
6 changes: 3 additions & 3 deletions FModel/Settings/CustomDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public static IList<CustomDirectory> Default(string gameName)
case "Fortnite [LIVE]":
return new List<CustomDirectory>
{
new("Cosmetics", "FortniteGame/Content/Athena/Items/Cosmetics/"),
new("Emotes [AUDIO]", "FortniteGame/Content/Athena/Sounds/Emotes/"),
new("Music Packs [AUDIO]", "FortniteGame/Content/Athena/Sounds/MusicPacks/"),
new("Cosmetics", "FortniteGame/Plugins/GameFeatures/BRCosmetics/Content/Athena/Items/Cosmetics/"),
new("Emotes [AUDIO]", "FortniteGame/Plugins/GameFeatures/BRCosmetics/Content/Athena/Sounds/Emotes/"),
new("Music Packs [AUDIO]", "FortniteGame/Plugins/GameFeatures/BRCosmetics/Content/Athena/Sounds/MusicPacks/"),
new("Weapons", "FortniteGame/Content/Athena/Items/Weapons/"),
new("Strings", "FortniteGame/Content/Localization/")
};
Expand Down
2 changes: 2 additions & 0 deletions FModel/ViewModels/CUE4ParseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
using CUE4Parse.GameTypes.PAXDEI.Encryption.Aes;
using CUE4Parse.GameTypes.NetEase.MAR.Encryption.Aes;
using CUE4Parse.GameTypes.FSR.Encryption.Aes;
using CUE4Parse.UE4.Assets.Exports.Atom;
using EpicManifestParser;
using FModel.Creator;
using FModel.Extensions;
Expand Down Expand Up @@ -854,6 +855,7 @@ public void ExtractAndScroll(CancellationToken cancellationToken, string fullPat
return false;
}
case UWorld when isNone && UserSettings.Default.PreviewWorlds:
case UAtomModel when isNone && UserSettings.Default.PreviewStaticMeshes:
case UStaticMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
case USkeletalMesh when isNone && UserSettings.Default.PreviewSkeletalMeshes:
case USkeleton when isNone && UserSettings.Default.SaveSkeletonAsMesh:
Expand Down
4 changes: 2 additions & 2 deletions FModel/ViewModels/GameSelectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public void DeleteSelectedGame()
.GroupBy(value => (int)value == ((int)value & ~0xF));
private IEnumerable<DirectorySettings> EnumerateDetectedGames()
{
yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_4);
yield return DirectorySettings.Default("Fortnite [LIVE]", Constants._FN_LIVE_TRIGGER, ue: EGame.GAME_UE5_4);
yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_5);
yield return DirectorySettings.Default("Fortnite [LIVE]", Constants._FN_LIVE_TRIGGER, ue: EGame.GAME_UE5_5);
yield return GetUnrealEngineGame("Pewee", "\\RogueCompany\\Content\\Paks", EGame.GAME_RogueCompany);
yield return GetUnrealEngineGame("Rosemallow", "\\Indiana\\Content\\Paks", EGame.GAME_UE4_21);
yield return GetUnrealEngineGame("Catnip", "\\OakGame\\Content\\Paks", EGame.GAME_Borderlands3);
Expand Down
3 changes: 2 additions & 1 deletion FModel/Views/DirectorySelector.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
</ComboBox.ItemTemplate>
</ComboBox>
<CheckBox Grid.Row="1" Grid.Column="4" Margin="5 0 0 5" ToolTip="Enable custom UE versions"
IsChecked="{Binding UseCustomEGames, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
IsChecked="{Binding UseCustomEGames, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="White" Style="{StaticResource HighlightedCheckBox}" />

<TextBlock Grid.Row="2" Grid.Column="0" Text="Directory" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding SelectedDirectory.GameDirectory, Mode=TwoWay}" />
Expand Down
25 changes: 25 additions & 0 deletions FModel/Views/Resources/Resources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,31 @@
</Setter>
</Style>

<Style x:Key="HighlightedCheckBox" TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="White" />
<Style.Triggers>
<EventTrigger RoutedEvent="CheckBox.Loaded">
<BeginStoryboard>
<Storyboard>
<ColorAnimation From="YellowGreen"
To="Goldenrod"
Storyboard.TargetProperty="BorderBrush.Color"
AutoReverse="True"
RepeatBehavior="Forever"
Duration="0:0:1" />
<ThicknessAnimation From="0"
To="2"
Storyboard.TargetProperty="BorderThickness"
AutoReverse="True"
RepeatBehavior="Forever"
Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>

<Style x:Key="CustomSeparator" TargetType="Separator" BasedOn="{StaticResource {x:Type Separator}}">
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.Layer1BorderBrush}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"/>
Expand Down
3 changes: 2 additions & 1 deletion FModel/Views/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
</ComboBox>
<CheckBox Grid.Row="6" Grid.Column="6" Margin="5 0 0 5" ToolTip="Enable custom UE versions"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
IsChecked="{Binding SettingsView.UseCustomEGames, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
IsChecked="{Binding SettingsView.UseCustomEGames, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="White" Style="{StaticResource HighlightedCheckBox}" />

<TextBlock Grid.Row="7" Grid.Column="0" Text="Texture Platform *" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Override the game's platform to ensure texture compatibility" />
<ComboBox Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="5" ItemsSource="{Binding SettingsView.Platforms}" SelectedItem="{Binding SettingsView.SelectedUePlatform, Mode=TwoWay}"
Expand Down
48 changes: 48 additions & 0 deletions FModel/Views/Snooper/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using CUE4Parse_Conversion.Meshes;
using CUE4Parse.UE4.Assets.Exports;
using CUE4Parse.UE4.Assets.Exports.Animation;
using CUE4Parse.UE4.Assets.Exports.Atom;
using CUE4Parse.UE4.Assets.Exports.Component.StaticMesh;
using CUE4Parse.UE4.Assets.Exports.Material;
using CUE4Parse.UE4.Assets.Exports.SkeletalMesh;
Expand Down Expand Up @@ -97,6 +98,9 @@ public void Load(CancellationToken cancellationToken, UObject export)
case UWorld wd:
LoadWorld(cancellationToken, wd, Transform.Identity);
break;
case UAtomModel at:
LoadAtom(cancellationToken, at);
break;
}
SetupCamera();
}
Expand Down Expand Up @@ -622,6 +626,50 @@ private void AdditionalWorlds(UObject actor, Matrix4x4 relation, CancellationTok
LoadWorld(cancellationToken, w, transform);
}

private void LoadAtom(CancellationToken cancellationToken, UAtomModel original)
{
var length = original.Primitives.Length;
for (var i = 0; i < length; i++)
{
cancellationToken.ThrowIfCancellationRequested();
Services.ApplicationService.ApplicationView.Status.UpdateStatusLabel($"{original.Name} ... {i}/{length}");

foreach (var part in original.Primitives[i].Parts)
{
var fixedPath = part.AtomPrimitive.AssetPathName.Text
.Replace("Primitives", "ProcessedMeshes")
.Replace("VX", "SM_VX");
if (!Utils.TryLoadObject(fixedPath, out UStaticMesh staticMesh) || !staticMesh.TryConvert(out var mesh))
continue;

var guid = staticMesh.LightingGuid;
var transform = new Transform
{
Position = part.Transforms[0].Translation * Constants.SCALE_DOWN_RATIO,
Rotation = part.Transforms[0].Rotation,
Scale = part.Transforms[0].Scale3D
};

if (Options.TryGetModel(guid, out var model))
{
model.AddInstance(transform);
}
else
{
model = new StaticModel(staticMesh, mesh, transform);
foreach (var section in model.Sections)
{
section.Show = true;
}
Options.Models[guid] = model;
}
}
}

CameraOp.Setup(original.SourceModel.Bounds * Constants.SCALE_DOWN_RATIO);
Services.ApplicationService.ApplicationView.Status.UpdateStatusLabel($"{original.Name} ... {length}/{length}");
}

public void WindowResized(int width, int height)
{
CameraOp.AspectRatio = width / (float) height;
Expand Down

0 comments on commit eb49b3c

Please sign in to comment.