Add Customizable Output Filename Formatting

This commit is contained in:
copecone committed 2026-10-19 18:14:02 +09:00
1 parent b66d774cb9
commit d90d06c095
6 files changed
+287 -3

No files matched your search

+17
View File
@@ -17,6 +17,11 @@ internal class GlobalConfig
/// GlobalSettings.DefaultOutputDirectory. Ignored while the directory does not exist (see EffectiveOutputDirectory).
/// </summary>
public string? OutputDirectory { get; set; }
/// <summary>
/// File name format template chosen in the render configuration window; null or empty selects
/// GlobalSettings.DefaultFileNameFormat ("{date} {time}").
/// </summary>
public string? FileNameFormat { get; set; }
/// <summary>Name of the preset last selected or saved in the render configuration window; selected again when it opens.</summary>
public string? LastPresetName { get; set; }
/// <summary>
@@ -72,6 +77,18 @@ internal static class GlobalSettings
}
}
/// <summary>Default file name format template: "{date} {time}".</summary>
public const string DefaultFileNameFormat = "{date} {time}";
/// <summary>
/// File name format used for renders without an explicit output path: Current.FileNameFormat when it is set,
/// otherwise <see cref="DefaultFileNameFormat"/>.
/// </summary>
public static string EffectiveFileNameFormat =>
string.IsNullOrWhiteSpace(Current.FileNameFormat)
? DefaultFileNameFormat
: Current.FileNameFormat;
static GlobalSettings()
{
Load();
+14 -3
View File
@@ -1053,9 +1053,20 @@ internal class RenderManager : MonoBehaviour
var startTime = DateTime.Now;
if (RenderContext.OutputPath != null) CurrentOutPath = RenderContext.OutputPath;
else {
var fileName = startTime.ToString("yyyy-MM-dd HH-mm-ss") +
$".{Configuration.AdvancedConfig.FileExtension.TrimStart('.').ToLower()}";
CurrentOutPath = Path.Combine(GlobalSettings.EffectiveOutputDirectory, fileName);
var format = GlobalSettings.EffectiveFileNameFormat;
var ext = Configuration.AdvancedConfig.FileExtension;
var baseName = RenderFileNameUtil.FormatFileName(
format,
startTime,
Configuration,
GlobalSettings.Current.LastPresetName,
levelPath
);
CurrentOutPath = RenderFileNameUtil.GetUniqueFilePath(
GlobalSettings.EffectiveOutputDirectory,
baseName,
ext
);
}
FFmpegNativeEncoder? videoFFmpeg = null;