Skip to content

Commit 4e76469

Browse files
authored
Merge pull request #582 from Ka1serM/dev
make HDR export optional
2 parents 4bc93c0 + 75bdfc1 commit 4e76469

File tree

7 files changed

+35
-49
lines changed

7 files changed

+35
-49
lines changed

FModel/Creator/Bases/FN/BaseCommunity.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,9 @@ private string GetCosmeticSeason(string seasonNumber, bool bShort)
123123
{
124124
if (!bShort) return base.GetCosmeticSeason(seasonNumber);
125125
var s = seasonNumber["Cosmetics.Filter.Season.".Length..];
126-
(int chapterIdx, int seasonIdx) = GetInternalSID(int.Parse(s));
127-
return s switch
128-
{
129-
"10" => $"C{chapterIdx} SX",
130-
"27" => $"Fortnite: OG",
131-
"32" => $"Fortnite: Remix",
132-
"35" => $"C{chapterIdx} MS1",
133-
_ => $"C{chapterIdx} S{seasonIdx}"
134-
};
126+
(string chapterIdx, string seasonIdx, bool onlySeason) = GetInternalSID(s);
127+
var prefix = int.TryParse(seasonIdx, out _) ? "S" : "";
128+
return onlySeason ? $"{prefix}{seasonIdx}" : $"C{chapterIdx} {prefix}{seasonIdx}";
135129
}
136130

137131
private new void DrawBackground(SKCanvas c)

FModel/Creator/Bases/FN/BaseIcon.cs

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -221,55 +221,32 @@ protected string GetCosmeticSet(string setName)
221221
return Utils.RemoveHtmlTags(string.Format(format, name));
222222
}
223223

224-
protected (int, int) GetInternalSID(int number)
224+
protected (string, string, bool) GetInternalSID(string number)
225225
{
226-
static int GetSeasonsInChapter(int chapter) => chapter switch
227-
{
228-
1 => 10,
229-
2 => 8,
230-
3 => 4,
231-
4 => 5,
232-
5 => 5,
233-
_ => 10
234-
};
235-
236-
var chapterIdx = 0;
237-
var seasonIdx = 0;
238-
while (number > 0)
239-
{
240-
var seasonsInChapter = GetSeasonsInChapter(++chapterIdx);
241-
if (number > seasonsInChapter)
242-
number -= seasonsInChapter;
243-
else
244-
{
245-
seasonIdx = number;
246-
number = 0;
247-
}
248-
}
249-
return (chapterIdx, seasonIdx);
226+
if (!Utils.TryLoadObject("FortniteGame/Plugins/GameFeatures/BattlePassBase/Content/DataTables/Athena_SeasonTitles.Athena_SeasonTitles", out UDataTable seasonTitles) ||
227+
!seasonTitles.TryGetDataTableRow(number, StringComparison.InvariantCulture, out var row) ||
228+
!row.TryGetValue(out FText chapterText, "DisplayChapterText") ||
229+
!row.TryGetValue(out FText seasonText, "DisplaySeasonText") ||
230+
!row.TryGetValue(out FName displayType, "DisplayType"))
231+
return (string.Empty, string.Empty, true);
232+
233+
var onlySeason = displayType.Text.EndsWith("::OnlySeason") || (chapterText.Text == seasonText.Text && !int.TryParse(seasonText.Text, out _));
234+
return (chapterText.Text, seasonText.Text, onlySeason);
250235
}
251236

252237
protected string GetCosmeticSeason(string seasonNumber)
253238
{
254239
var s = seasonNumber["Cosmetics.Filter.Season.".Length..];
255-
var initial = int.Parse(s);
256-
(int chapterIdx, int seasonIdx) = GetInternalSID(initial);
240+
(string chapterIdx, string seasonIdx, bool onlySeason) = GetInternalSID(s);
257241

258242
var season = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "SeasonTextFormat", "Season {0}");
259243
var introduced = Utils.GetLocalizedResource("Fort.Cosmetics", "CosmeticItemDescription_Season", "\nIntroduced in <SeasonText>{0}</>.");
260-
if (s == "10") return Utils.RemoveHtmlTags(string.Format(introduced, string.Format(season, "X")));
261-
if (initial <= 10) return Utils.RemoveHtmlTags(string.Format(introduced, string.Format(season, s)));
244+
if (onlySeason) return Utils.RemoveHtmlTags(string.Format(introduced, string.Format(season, seasonIdx)));
262245

263246
var chapter = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "ChapterTextFormat", "Chapter {0}");
264247
var chapterFormat = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "ChapterSeasonTextFormat", "{0}, {1}");
265248
var d = string.Format(chapterFormat, string.Format(chapter, chapterIdx), string.Format(season, seasonIdx));
266-
return s switch
267-
{
268-
"27" => Utils.RemoveHtmlTags(string.Format(introduced, string.Format("Fortnite: OG"))),
269-
"32" => Utils.RemoveHtmlTags(string.Format(introduced, string.Format("Fortnite: Remix"))),
270-
"35" => Utils.RemoveHtmlTags(string.Format(introduced, string.Format(chapterFormat, string.Format(chapter, chapterIdx), string.Format("MS1")))),
271-
_ => Utils.RemoveHtmlTags(string.Format(introduced, d))
272-
};
249+
return Utils.RemoveHtmlTags(string.Format(introduced, d));
273250
}
274251

275252
protected void CheckGameplayTags(FInstancedStruct[] dataList)

FModel/Settings/UserSettings.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public static bool IsEndpointValid(EEndpointType type, out EndpointSettings endp
7373
CompressionFormat = Default.CompressionFormat,
7474
Platform = Default.CurrentDir.TexturePlatform,
7575
ExportMorphTargets = Default.SaveMorphTargets,
76-
ExportMaterials = Default.SaveEmbeddedMaterials
76+
ExportMaterials = Default.SaveEmbeddedMaterials,
77+
ExportHdrTexturesAsHdr = Default.SaveHdrTexturesAsHdr
7778
};
7879

7980
private bool _showChangelog = true;
@@ -508,5 +509,12 @@ public bool SaveSkeletonAsMesh
508509
get => _saveSkeletonAsMesh;
509510
set => SetProperty(ref _saveSkeletonAsMesh, value);
510511
}
512+
513+
private bool _saveHdrTexturesAsHdr = true;
514+
public bool SaveHdrTexturesAsHdr
515+
{
516+
get => _saveHdrTexturesAsHdr;
517+
set => SetProperty(ref _saveHdrTexturesAsHdr, value);
518+
}
511519
}
512520
}

FModel/ViewModels/CUE4ParseViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
using CUE4Parse.UE4.Localization;
3131
using CUE4Parse.UE4.Objects.Core.Serialization;
3232
using CUE4Parse.UE4.Objects.Engine;
33-
using CUE4Parse.UE4.Oodle.Objects;
33+
using CUE4Parse.UE4.Oodle.Objects;
3434
using CUE4Parse.UE4.Pak;
3535
using CUE4Parse.UE4.Readers;
3636
using CUE4Parse.UE4.Shaders;
@@ -39,6 +39,7 @@
3939
using CUE4Parse_Conversion;
4040
using CUE4Parse_Conversion.Sounds;
4141
using CUE4Parse.FileProvider.Objects;
42+
using CUE4Parse.GameTypes.AshEchoes.FileProvider;
4243
using CUE4Parse.UE4.Assets;
4344
using CUE4Parse.UE4.BinaryConfig;
4445
using CUE4Parse.UE4.Objects.UObject;

FModel/ViewModels/TabControlViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private void SetImage(CTexture bitmap)
105105

106106
if (PixelFormatUtils.IsHDR(bitmap.PixelFormat) || (UserSettings.Default.TextureExportFormat != ETextureFormat.Jpeg && UserSettings.Default.TextureExportFormat != ETextureFormat.Png))
107107
{
108-
ImageBuffer = bitmap.Encode(UserSettings.Default.TextureExportFormat, out var ext);
108+
ImageBuffer = bitmap.Encode(UserSettings.Default.TextureExportFormat, UserSettings.Default.SaveHdrTexturesAsHdr, out var ext);
109109
ExportName += "." + ext;
110110
}
111111
else

FModel/Views/SettingsView.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@
323323
<RowDefinition Height="Auto" />
324324
<RowDefinition Height="Auto" />
325325
<RowDefinition Height="Auto" />
326+
<RowDefinition Height="Auto" />
326327
</Grid.RowDefinitions>
327328
<Grid.ColumnDefinitions>
328329
<ColumnDefinition Width="Auto" />
@@ -495,6 +496,11 @@
495496
</DataTemplate>
496497
</ComboBox.ItemTemplate>
497498
</ComboBox>
499+
500+
<TextBlock Grid.Row="20" Grid.Column="0" Text="Save HDR Textures as Radiance .hdr" VerticalAlignment="Center" />
501+
<CheckBox Grid.Row="20" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
502+
IsChecked="{Binding SaveHdrTexturesAsHdr, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
503+
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>
498504
</Grid>
499505
</DataTemplate>
500506
<DataTemplate x:Key="KeybindingsTemplate">

0 commit comments

Comments
 (0)