SHA256
Add Customizable Output Filename Formatting
This commit is contained in:
1 parent
b66d774cb9
commit
d90d06c095
6 files changed
+287
-3
No files matched your search
@@ -135,6 +135,11 @@ internal static class RenderConfigWindow
|
||||
/// </summary>
|
||||
private static O5InputField? _outputDirInput;
|
||||
|
||||
/// <summary>
|
||||
/// File name format template input. Bound to <c>GlobalSettings.Current.FileNameFormat</c>.
|
||||
/// </summary>
|
||||
private static O5InputField? _fileNameFormatInput;
|
||||
|
||||
private static O5Dropdown<string>? _fileExtensionDropdown;
|
||||
private static O5InputField? _randomSeedInput;
|
||||
private static O5Toggle? _processAudioToggle;
|
||||
@@ -698,6 +703,44 @@ internal static class RenderConfigWindow
|
||||
}
|
||||
);
|
||||
|
||||
// Filename format template: typing updates GlobalSettings.Current.FileNameFormat in memory only.
|
||||
_fileNameFormatInput = CreateFullWidthInputField(
|
||||
ctx, globalContent,
|
||||
"ui.render_config.filename_format",
|
||||
GlobalSettings.DefaultFileNameFormat,
|
||||
GlobalSettings.EffectiveFileNameFormat,
|
||||
"input_filename_format",
|
||||
val =>
|
||||
{
|
||||
var trimmed = val?.Trim() ?? string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(trimmed) ||
|
||||
string.Equals(trimmed, GlobalSettings.DefaultFileNameFormat, StringComparison.Ordinal))
|
||||
{
|
||||
GlobalSettings.Current.FileNameFormat = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalSettings.Current.FileNameFormat = trimmed;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
var fnHint = CreateLabel(ctx, globalContent, "ui.render_config.filename_format_hint", 11f);
|
||||
fnHint.color = new Color(ctx.Theme.TextDim.r, ctx.Theme.TextDim.g, ctx.Theme.TextDim.b, ctx.Theme.TextDim.a * 0.7f);
|
||||
|
||||
var (_, fnRight) = CreateTwoColumnPanel(globalContent);
|
||||
CreateButton(
|
||||
ctx, fnRight,
|
||||
"ui.render_config.reset_filename_default",
|
||||
"btn_reset_filename_format",
|
||||
() =>
|
||||
{
|
||||
_fileNameFormatInput.Set(GlobalSettings.DefaultFileNameFormat);
|
||||
GlobalSettings.Current.FileNameFormat = null;
|
||||
GlobalSettings.Save();
|
||||
}
|
||||
);
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Section 6: Advanced Settings card (RenderConfig.AdvancedConfig)
|
||||
// File Extension | Random Seed
|
||||
@@ -1045,6 +1088,7 @@ internal static class RenderConfigWindow
|
||||
_audioBitrateSlider?.Set(config.AudioConfig.AudioBitrate / 1000.0, false, noFilter: true);
|
||||
|
||||
_outputDirInput?.Set(GlobalSettings.EffectiveOutputDirectory, false);
|
||||
_fileNameFormatInput?.Set(GlobalSettings.EffectiveFileNameFormat, false);
|
||||
|
||||
_fileExtensionDropdown?.Set(config.AdvancedConfig.FileExtension, false);
|
||||
_randomSeedInput?.Set(config.AdvancedConfig.RandomSeed?.ToString() ?? "", false);
|
||||
@@ -1171,6 +1215,20 @@ internal static class RenderConfigWindow
|
||||
}
|
||||
}
|
||||
|
||||
if (_fileNameFormatInput != null)
|
||||
{
|
||||
var format = _fileNameFormatInput.Value.Trim();
|
||||
if (string.IsNullOrWhiteSpace(format) ||
|
||||
string.Equals(format, GlobalSettings.DefaultFileNameFormat, StringComparison.Ordinal))
|
||||
{
|
||||
GlobalSettings.Current.FileNameFormat = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalSettings.Current.FileNameFormat = format;
|
||||
}
|
||||
}
|
||||
|
||||
GlobalSettings.Save();
|
||||
SetWindowActive(false);
|
||||
|
||||
|
||||
Reference in new issue
Block a user