增加导出速度设置
This commit is contained in:
@@ -55,6 +55,21 @@ namespace Spine.Exporters
|
||||
}
|
||||
protected float _fps = 24;
|
||||
|
||||
public float Speed
|
||||
{
|
||||
get => _speed;
|
||||
set
|
||||
{
|
||||
if (_speed <= 0)
|
||||
{
|
||||
_logger.Warn("Omit invalid speed: {0}", value);
|
||||
return;
|
||||
}
|
||||
_speed = value;
|
||||
}
|
||||
}
|
||||
protected float _speed = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// 是否保留最后一帧
|
||||
/// </summary>
|
||||
@@ -92,7 +107,7 @@ namespace Spine.Exporters
|
||||
// 导出完整帧
|
||||
for (int i = 0; i < total; i++)
|
||||
{
|
||||
foreach (var spine in spines) spine.Update(delta);
|
||||
foreach (var spine in spines) spine.Update(delta * _speed);
|
||||
yield return GetFrame(spines);
|
||||
}
|
||||
|
||||
@@ -100,7 +115,7 @@ namespace Spine.Exporters
|
||||
if (hasFinal)
|
||||
{
|
||||
// XXX: 此处还是按照完整的一帧时长进行更新, 也许可以只更新准确的最后一帧时长
|
||||
foreach (var spine in spines) spine.Update(delta);
|
||||
foreach (var spine in spines) spine.Update(delta * _speed);
|
||||
yield return GetFrame(spines);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +167,8 @@
|
||||
<s:String x:Key="Str_ExportDurationTooltip">Export duration; if less than 0, the maximum duration of all animations in all models will be used during export.</s:String>
|
||||
|
||||
<s:String x:Key="Str_Fps">FPS</s:String>
|
||||
<s:String x:Key="Str_ExportSpeed">Export Speed</s:String>
|
||||
<s:String x:Key="Str_ExportSpeedTooltip">Export speed factor; only affects the animation speed of the model, not the export duration or frame rate.</s:String>
|
||||
<s:String x:Key="Str_KeepLastFrame">Keep Last Frame</s:String>
|
||||
<s:String x:Key="Str_KeepLastFrameTooltip">When keeping the last frame, animation is smoother but frame count may be one higher</s:String>
|
||||
|
||||
|
||||
@@ -167,6 +167,8 @@
|
||||
<s:String x:Key="Str_ExportDurationTooltip">エクスポート時間。0 未満の場合、エクスポート時にすべてのモデルのすべてのアニメーションの最大時間が使用されます。</s:String>
|
||||
|
||||
<s:String x:Key="Str_Fps">FPS</s:String>
|
||||
<s:String x:Key="Str_ExportSpeed">エクスポート速度</s:String>
|
||||
<s:String x:Key="Str_ExportSpeedTooltip">エクスポート速度係数。モデルの動作速度のみに影響し、エクスポート時間やフレームレートなどには影響しません。</s:String>
|
||||
<s:String x:Key="Str_KeepLastFrame">最後のフレームを保持</s:String>
|
||||
<s:String x:Key="Str_KeepLastFrameTooltip">最後のフレームを保持すると、アニメーションはより連続して見えますが、フレーム数が予想より1フレーム多くなる可能性があります</s:String>
|
||||
|
||||
|
||||
@@ -167,6 +167,8 @@
|
||||
<s:String x:Key="Str_ExportDurationTooltip">导出时长,如果小于 0,则在导出时使用所有模型所有动画的最大时长</s:String>
|
||||
|
||||
<s:String x:Key="Str_Fps">帧率</s:String>
|
||||
<s:String x:Key="Str_ExportSpeed">导出速度</s:String>
|
||||
<s:String x:Key="Str_ExportSpeedTooltip">导出速度因子, 仅影响模型的动作速度, 不影响导出时长和帧率等参数</s:String>
|
||||
<s:String x:Key="Str_KeepLastFrame">保留最后一帧</s:String>
|
||||
<s:String x:Key="Str_KeepLastFrameTooltip">当设置保留最后一帧时,动图会更为连贯,但是帧数可能比预期帧数多 1</s:String>
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
{
|
||||
BackgroundColor = new(_backgroundColor.R, _backgroundColor.G, _backgroundColor.B, _backgroundColor.A),
|
||||
Fps = _fps,
|
||||
Speed = _speed,
|
||||
KeepLast = _keepLast,
|
||||
Format = _format,
|
||||
Codec = _codec,
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
{
|
||||
BackgroundColor = new(_backgroundColor.R, _backgroundColor.G, _backgroundColor.B, _backgroundColor.A),
|
||||
Fps = _fps,
|
||||
Speed = _speed,
|
||||
KeepLast = _keepLast,
|
||||
Format = _format,
|
||||
Loop = _loop,
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
{
|
||||
BackgroundColor = new(_backgroundColor.R, _backgroundColor.G, _backgroundColor.B, _backgroundColor.A),
|
||||
Fps = _fps,
|
||||
Speed = _speed,
|
||||
KeepLast = _keepLast
|
||||
};
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
public uint Fps { get => _fps; set => SetProperty(ref _fps, Math.Max(1, value)); }
|
||||
protected uint _fps = 30;
|
||||
|
||||
public float Speed { get => _speed; set => SetProperty(ref _speed, Math.Clamp(value, 0.001f, 1000f)); }
|
||||
protected float _speed = 1f;
|
||||
|
||||
public bool KeepLast { get => _keepLast; set => SetProperty(ref _keepLast, value); }
|
||||
protected bool _keepLast = true;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="60"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
@@ -122,38 +123,42 @@
|
||||
<Label Grid.Row="10" Grid.Column="0" Content="{DynamicResource Str_Fps}"/>
|
||||
<TextBox Grid.Row="10" Grid.Column="1" Text="{Binding Fps}"/>
|
||||
|
||||
<!-- 是否保留最后一帧 -->
|
||||
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_KeepLastFrame}" ToolTip="{DynamicResource Str_KeepLastFrameTooltip}"/>
|
||||
<ToggleButton Grid.Row="11" Grid.Column="1" IsChecked="{Binding KeepLast}" ToolTip="{DynamicResource Str_KeelLastFrameTooltip}"/>
|
||||
<!-- 导出速度 -->
|
||||
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_ExportSpeed}" ToolTip="{DynamicResource Str_ExportSpeedTooltip}"/>
|
||||
<TextBox Grid.Row="11" Grid.Column="1" Text="{Binding Speed}" ToolTip="{DynamicResource Str_ExportSpeedTooltip}"/>
|
||||
|
||||
<Separator Grid.Row="12" Grid.ColumnSpan="2" Height="10"/>
|
||||
<!-- 是否保留最后一帧 -->
|
||||
<Label Grid.Row="12" Grid.Column="0" Content="{DynamicResource Str_KeepLastFrame}" ToolTip="{DynamicResource Str_KeepLastFrameTooltip}"/>
|
||||
<ToggleButton Grid.Row="12" Grid.Column="1" IsChecked="{Binding KeepLast}" ToolTip="{DynamicResource Str_KeelLastFrameTooltip}"/>
|
||||
|
||||
<Separator Grid.Row="13" Grid.ColumnSpan="2" Height="10"/>
|
||||
|
||||
<!-- 导出格式 -->
|
||||
<Label Grid.Row="13" Grid.Column="0" Content="{DynamicResource Str_FFmpegFormat}" ToolTip="{DynamicResource Str_FFmpegFormatTooltip}"/>
|
||||
<TextBox Grid.Row="13" Grid.Column="1" Text="{Binding Format}" ToolTip="{DynamicResource Str_FFmpegFormatTooltip}"/>
|
||||
<Label Grid.Row="14" Grid.Column="0" Content="{DynamicResource Str_FFmpegFormat}" ToolTip="{DynamicResource Str_FFmpegFormatTooltip}"/>
|
||||
<TextBox Grid.Row="14" Grid.Column="1" Text="{Binding Format}" ToolTip="{DynamicResource Str_FFmpegFormatTooltip}"/>
|
||||
|
||||
<!-- 编码器 -->
|
||||
<Label Grid.Row="14" Grid.Column="0" Content="{DynamicResource Str_FFmpegCodec}" ToolTip="{DynamicResource Str_FFmpegCodecTooltip}"/>
|
||||
<TextBox Grid.Row="14" Grid.Column="1" Text="{Binding Codec}" ToolTip="{DynamicResource Str_FFmpegCodecTooltip}"/>
|
||||
<Label Grid.Row="15" Grid.Column="0" Content="{DynamicResource Str_FFmpegCodec}" ToolTip="{DynamicResource Str_FFmpegCodecTooltip}"/>
|
||||
<TextBox Grid.Row="15" Grid.Column="1" Text="{Binding Codec}" ToolTip="{DynamicResource Str_FFmpegCodecTooltip}"/>
|
||||
|
||||
<!-- 像素格式 -->
|
||||
<Label Grid.Row="15" Grid.Column="0" Content="{DynamicResource Str_FFmpegPixelFormat}" ToolTip="{DynamicResource Str_FFmpegPixelFormatTooltip}"/>
|
||||
<TextBox Grid.Row="15" Grid.Column="1" Text="{Binding PixelFormat}" ToolTip="{DynamicResource Str_FFmpegPixelFormatTooltip}"/>
|
||||
<Label Grid.Row="16" Grid.Column="0" Content="{DynamicResource Str_FFmpegPixelFormat}" ToolTip="{DynamicResource Str_FFmpegPixelFormatTooltip}"/>
|
||||
<TextBox Grid.Row="16" Grid.Column="1" Text="{Binding PixelFormat}" ToolTip="{DynamicResource Str_FFmpegPixelFormatTooltip}"/>
|
||||
|
||||
<!-- 比特率 -->
|
||||
<Label Grid.Row="16" Grid.Column="0" Content="{DynamicResource Str_FFmpegBitrate}" ToolTip="{DynamicResource Str_FFmpegBitrateTooltip}"/>
|
||||
<TextBox Grid.Row="16" Grid.Column="1" Text="{Binding Bitrate}" ToolTip="{DynamicResource Str_FFmpegBitrateTooltip}"/>
|
||||
<Label Grid.Row="17" Grid.Column="0" Content="{DynamicResource Str_FFmpegBitrate}" ToolTip="{DynamicResource Str_FFmpegBitrateTooltip}"/>
|
||||
<TextBox Grid.Row="17" Grid.Column="1" Text="{Binding Bitrate}" ToolTip="{DynamicResource Str_FFmpegBitrateTooltip}"/>
|
||||
|
||||
<!-- 滤镜 -->
|
||||
<Label Grid.Row="17" Grid.Column="0" Content="{DynamicResource Str_FFmpegFilter}" ToolTip="{DynamicResource Str_FFmpegFilterTooltip}"/>
|
||||
<TextBox Grid.Row="17" Grid.Column="1" Text="{Binding Filter}" ToolTip="{DynamicResource Str_FFmpegFilterTooltip}"/>
|
||||
<Label Grid.Row="18" Grid.Column="0" Content="{DynamicResource Str_FFmpegFilter}" ToolTip="{DynamicResource Str_FFmpegFilterTooltip}"/>
|
||||
<TextBox Grid.Row="18" Grid.Column="1" Text="{Binding Filter}" ToolTip="{DynamicResource Str_FFmpegFilterTooltip}"/>
|
||||
|
||||
<!-- 自定义参数 -->
|
||||
<Label Grid.Row="18" Grid.Column="0"
|
||||
<Label Grid.Row="19" Grid.Column="0"
|
||||
VerticalAlignment="Top"
|
||||
Content="{DynamicResource Str_FFmpegCustomArgs}"
|
||||
ToolTip="{DynamicResource Str_FFmpegCustomArgsTooltip}"/>
|
||||
<TextBox Grid.Row="18" Grid.Column="1"
|
||||
<TextBox Grid.Row="19" Grid.Column="1"
|
||||
HorizontalContentAlignment="Left"
|
||||
VerticalContentAlignment="Top"
|
||||
TextWrapping="Wrap"
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 水平分辨率 -->
|
||||
@@ -121,31 +122,35 @@
|
||||
<Label Grid.Row="10" Grid.Column="0" Content="{DynamicResource Str_Fps}"/>
|
||||
<TextBox Grid.Row="10" Grid.Column="1" Text="{Binding Fps}"/>
|
||||
|
||||
<!-- 是否保留最后一帧 -->
|
||||
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_KeepLastFrame}" ToolTip="{DynamicResource Str_KeepLastFrameTooltip}"/>
|
||||
<ToggleButton Grid.Row="11" Grid.Column="1" IsChecked="{Binding KeepLast}" ToolTip="{DynamicResource Str_KeelLastFrameTooltip}"/>
|
||||
<!-- 导出速度 -->
|
||||
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_ExportSpeed}" ToolTip="{DynamicResource Str_ExportSpeedTooltip}"/>
|
||||
<TextBox Grid.Row="11" Grid.Column="1" Text="{Binding Speed}" ToolTip="{DynamicResource Str_ExportSpeedTooltip}"/>
|
||||
|
||||
<Separator Grid.Row="12" Grid.ColumnSpan="2" Height="10"/>
|
||||
<!-- 是否保留最后一帧 -->
|
||||
<Label Grid.Row="12" Grid.Column="0" Content="{DynamicResource Str_KeepLastFrame}" ToolTip="{DynamicResource Str_KeepLastFrameTooltip}"/>
|
||||
<ToggleButton Grid.Row="12" Grid.Column="1" IsChecked="{Binding KeepLast}" ToolTip="{DynamicResource Str_KeelLastFrameTooltip}"/>
|
||||
|
||||
<Separator Grid.Row="13" Grid.ColumnSpan="2" Height="10"/>
|
||||
|
||||
<!-- 视频格式 -->
|
||||
<Label Grid.Row="13" Grid.Column="0" Content="{DynamicResource Str_VideoFormat}"/>
|
||||
<ComboBox Grid.Row="13" Grid.Column="1" SelectedItem="{Binding Format}" ItemsSource="{Binding VideoFormatOptions}"/>
|
||||
<Label Grid.Row="14" Grid.Column="0" Content="{DynamicResource Str_VideoFormat}"/>
|
||||
<ComboBox Grid.Row="14" Grid.Column="1" SelectedItem="{Binding Format}" ItemsSource="{Binding VideoFormatOptions}"/>
|
||||
|
||||
<!-- 动图是否循环 -->
|
||||
<Label Grid.Row="14" Grid.Column="0" Content="{DynamicResource Str_LoopPlay}" ToolTip="{DynamicResource Str_LoopPlayTooltip}"/>
|
||||
<ToggleButton Grid.Row="14" Grid.Column="1" IsChecked="{Binding Loop}" ToolTip="{DynamicResource Str_LoopPlayTooltip}"/>
|
||||
<Label Grid.Row="15" Grid.Column="0" Content="{DynamicResource Str_LoopPlay}" ToolTip="{DynamicResource Str_LoopPlayTooltip}"/>
|
||||
<ToggleButton Grid.Row="15" Grid.Column="1" IsChecked="{Binding Loop}" ToolTip="{DynamicResource Str_LoopPlayTooltip}"/>
|
||||
|
||||
<!-- 质量参数 -->
|
||||
<Label Grid.Row="15" Grid.Column="0" Content="{DynamicResource Str_QualityParameter}" ToolTip="{DynamicResource Str_QualityParameterTooltip}"/>
|
||||
<TextBox Grid.Row="15" Grid.Column="1" Text="{Binding Quality}" ToolTip="{DynamicResource Str_QualityParameterTooltip}"/>
|
||||
<Label Grid.Row="16" Grid.Column="0" Content="{DynamicResource Str_QualityParameter}" ToolTip="{DynamicResource Str_QualityParameterTooltip}"/>
|
||||
<TextBox Grid.Row="16" Grid.Column="1" Text="{Binding Quality}" ToolTip="{DynamicResource Str_QualityParameterTooltip}"/>
|
||||
|
||||
<!-- 无损压缩 -->
|
||||
<Label Grid.Row="16" Grid.Column="0" Content="{DynamicResource Str_LosslessParam}" ToolTip="{DynamicResource Str_LosslessParamTooltip}"/>
|
||||
<ToggleButton Grid.Row="16" Grid.Column="1" IsChecked="{Binding Lossless}" ToolTip="{DynamicResource Str_LosslessParamTooltip}"/>
|
||||
<Label Grid.Row="17" Grid.Column="0" Content="{DynamicResource Str_LosslessParam}" ToolTip="{DynamicResource Str_LosslessParamTooltip}"/>
|
||||
<ToggleButton Grid.Row="17" Grid.Column="1" IsChecked="{Binding Lossless}" ToolTip="{DynamicResource Str_LosslessParamTooltip}"/>
|
||||
|
||||
<!-- CRF 参数 -->
|
||||
<Label Grid.Row="17" Grid.Column="0" Content="{DynamicResource Str_CrfParameter}" ToolTip="{DynamicResource Str_CrfParameterTooltip}"/>
|
||||
<TextBox Grid.Row="17" Grid.Column="1" Text="{Binding Crf}" ToolTip="{DynamicResource Str_CrfParameterTooltip}"/>
|
||||
<Label Grid.Row="18" Grid.Column="0" Content="{DynamicResource Str_CrfParameter}" ToolTip="{DynamicResource Str_CrfParameterTooltip}"/>
|
||||
<TextBox Grid.Row="18" Grid.Column="1" Text="{Binding Crf}" ToolTip="{DynamicResource Str_CrfParameterTooltip}"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 水平分辨率 -->
|
||||
@@ -116,9 +117,13 @@
|
||||
<Label Grid.Row="10" Grid.Column="0" Content="{DynamicResource Str_Fps}"/>
|
||||
<TextBox Grid.Row="10" Grid.Column="1" Text="{Binding Fps}"/>
|
||||
|
||||
<!-- 导出速度 -->
|
||||
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_ExportSpeed}" ToolTip="{DynamicResource Str_ExportSpeedTooltip}"/>
|
||||
<TextBox Grid.Row="11" Grid.Column="1" Text="{Binding Speed}" ToolTip="{DynamicResource Str_ExportSpeedTooltip}"/>
|
||||
|
||||
<!-- 是否保留最后一帧 -->
|
||||
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_KeepLastFrame}" ToolTip="{DynamicResource Str_KeepLastFrameTooltip}"/>
|
||||
<ToggleButton Grid.Row="11" Grid.Column="1" IsChecked="{Binding KeepLast}" ToolTip="{DynamicResource Str_KeelLastFrameTooltip}"/>
|
||||
<Label Grid.Row="12" Grid.Column="0" Content="{DynamicResource Str_KeepLastFrame}" ToolTip="{DynamicResource Str_KeepLastFrameTooltip}"/>
|
||||
<ToggleButton Grid.Row="12" Grid.Column="1" IsChecked="{Binding KeepLast}" ToolTip="{DynamicResource Str_KeelLastFrameTooltip}"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
Reference in New Issue
Block a user