Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acf48cd74d | ||
|
|
2fecf4223a | ||
|
|
2953ec44fb | ||
|
|
77399b4524 | ||
|
|
b34639c383 | ||
|
|
c0e2bb81e5 | ||
|
|
55ebcc1857 | ||
|
|
e3a201af89 | ||
|
|
292ede8461 | ||
|
|
112a9a1bf2 | ||
|
|
63ed8d7ca4 | ||
|
|
d1e33c25bc | ||
|
|
ce7c6f3802 | ||
|
|
0a30af0ad2 | ||
|
|
0b478cab18 | ||
|
|
b14849a0b1 | ||
|
|
b7f5f24e6f | ||
|
|
150331d2e4 | ||
|
|
dcec8797b0 | ||
|
|
4d1aec9ed8 | ||
|
|
0cb325820b | ||
|
|
2a862b28be | ||
|
|
c2935f49e9 | ||
|
|
22043f8f38 | ||
|
|
3020a818f0 | ||
|
|
30177e8d7f | ||
|
|
3ad49838be | ||
|
|
3e480abd44 | ||
|
|
49f6b28aef | ||
|
|
b81d13b582 | ||
|
|
04eb3cb640 | ||
|
|
0ac75a088a |
54
.github/workflows/dotnet-desktop.yml
vendored
54
.github/workflows/dotnet-desktop.yml
vendored
@@ -1,45 +1,79 @@
|
|||||||
name: Build & Release
|
name: Build & Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
pull_request:
|
||||||
tags:
|
branches:
|
||||||
- 'v*.*.*'
|
- release/wf
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-release:
|
build-release:
|
||||||
|
if: ${{ github.event.pull_request.merged == true }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
env:
|
env:
|
||||||
PROJECT_NAME: SpineViewer
|
PROJECT_NAME: SpineViewer
|
||||||
VERSION: ${{ github.ref_name }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
- name: Setup .NET SDK
|
- name: Setup .NET SDK
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: '8.0.x'
|
dotnet-version: "8.0.x"
|
||||||
|
|
||||||
|
- name: Extract version from csproj
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
[xml]$proj = Get-Content "$env:PROJECT_NAME\$env:PROJECT_NAME.csproj"
|
||||||
|
$VERSION_NUM = $proj.Project.PropertyGroup.Version
|
||||||
|
$VERSION_TAG = "v$VERSION_NUM"
|
||||||
|
"VERSION=$VERSION_TAG" >> $env:GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Check Version Tag
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
if (-not $env:VERSION) {
|
||||||
|
Write-Error "Version tag not found in csproj file."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
Write-Host "Version tag found: $env:VERSION"
|
||||||
|
|
||||||
|
- name: Tag merge commit
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git tag $env:VERSION
|
||||||
|
git push --tags
|
||||||
|
|
||||||
- name: Publish FrameworkDependent version
|
- name: Publish FrameworkDependent version
|
||||||
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
dotnet publish ${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj -c Release -r win-x64 --sc false -p:PublishSingleFile=true -o publish/${{ env.PROJECT_NAME }}-${{ env.VERSION }}
|
dotnet publish "$env:PROJECT_NAME\$env:PROJECT_NAME.csproj" -c Release -r win-x64 --sc false -o "publish\$env:PROJECT_NAME-$env:VERSION"
|
||||||
|
|
||||||
- name: Publish SelfContained version
|
- name: Publish SelfContained version
|
||||||
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
dotnet publish ${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj -c Release -r win-x64 --sc true -p:PublishSingleFile=true -o publish/${{ env.PROJECT_NAME }}-${{ env.VERSION }}-SelfContained
|
dotnet publish "$env:PROJECT_NAME\$env:PROJECT_NAME.csproj" -c Release -r win-x64 --sc true -o "publish\$env:PROJECT_NAME-$env:VERSION-SelfContained"
|
||||||
|
|
||||||
- name: Create release directory
|
- name: Create release directory
|
||||||
run: mkdir release
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
New-Item -ItemType Directory -Path release -Force | Out-Null
|
||||||
|
|
||||||
- name: Compress FrameworkDependent version
|
- name: Compress FrameworkDependent version
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
Compress-Archive -Path "publish/${env:PROJECT_NAME}-${env:VERSION}" -DestinationPath "release/${env:PROJECT_NAME}-${env:VERSION}.zip" -Force
|
Compress-Archive -Path "publish\$env:PROJECT_NAME-$env:VERSION\*" -DestinationPath "release\$env:PROJECT_NAME-$env:VERSION.zip" -Force
|
||||||
|
|
||||||
- name: Compress SelfContained version
|
- name: Compress SelfContained version
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
Compress-Archive -Path "publish/${env:PROJECT_NAME}-${env:VERSION}-SelfContained" -DestinationPath "release/${env:PROJECT_NAME}-${env:VERSION}-SelfContained.zip" -Force
|
Compress-Archive -Path "publish\$env:PROJECT_NAME-$env:VERSION-SelfContained\*" -DestinationPath "release\$env:PROJECT_NAME-$env:VERSION-SelfContained.zip" -Force
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
id: create_release
|
id: create_release
|
||||||
|
|||||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,5 +1,21 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## v0.12.17
|
||||||
|
|
||||||
|
- 动画边界检测的帧率提高到100帧每秒
|
||||||
|
|
||||||
|
## v0.12.16
|
||||||
|
|
||||||
|
- 导出多个时允许自动时长
|
||||||
|
|
||||||
|
## v0.12.15
|
||||||
|
|
||||||
|
- 修复附件类型枚举量字符串大小写问题
|
||||||
|
|
||||||
|
## v0.12.14
|
||||||
|
|
||||||
|
- 修复 v38 文件读取的小 bug
|
||||||
|
|
||||||
## v0.12.13
|
## v0.12.13
|
||||||
|
|
||||||
- 导出文件名增加额外的随机字符串
|
- 导出文件名增加额外的随机字符串
|
||||||
|
|||||||
@@ -51,6 +51,17 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
|
|||||||
[RotateMode.ChainScale] = "chainScale",
|
[RotateMode.ChainScale] = "chainScale",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static readonly Dictionary<AttachmentType, string> AttachmentTypeJsonValue = new()
|
||||||
|
{
|
||||||
|
[AttachmentType.Region] = "region",
|
||||||
|
[AttachmentType.Boundingbox] = "bounding",
|
||||||
|
[AttachmentType.Mesh] = "mesh",
|
||||||
|
[AttachmentType.Linkedmesh] = "linkedmesh",
|
||||||
|
[AttachmentType.Path] = "path",
|
||||||
|
[AttachmentType.Point] = "point",
|
||||||
|
[AttachmentType.Clipping] = "clipping",
|
||||||
|
};
|
||||||
|
|
||||||
private BinaryReader reader = null;
|
private BinaryReader reader = null;
|
||||||
private JsonObject root = null;
|
private JsonObject root = null;
|
||||||
private bool nonessential = false;
|
private bool nonessential = false;
|
||||||
@@ -298,7 +309,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
|
|||||||
var name = reader.ReadStringRef() ?? keyName;
|
var name = reader.ReadStringRef() ?? keyName;
|
||||||
var type = (AttachmentType)reader.ReadByte();
|
var type = (AttachmentType)reader.ReadByte();
|
||||||
attachment["name"] = name;
|
attachment["name"] = name;
|
||||||
attachment["type"] = type.ToString();
|
attachment["type"] = AttachmentTypeJsonValue[type];
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case AttachmentType.Region:
|
case AttachmentType.Region:
|
||||||
@@ -586,7 +597,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
|
|||||||
["compress"] = reader.ReadBoolean(),
|
["compress"] = reader.ReadBoolean(),
|
||||||
["stretch"] = reader.ReadBoolean(),
|
["stretch"] = reader.ReadBoolean(),
|
||||||
};
|
};
|
||||||
if (frameCount > 1) ReadCurve(o);
|
if (frameIdx < frameCount - 1) ReadCurve(o);
|
||||||
frames.Add(o);
|
frames.Add(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -613,7 +624,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
|
|||||||
["scaleMix"] = reader.ReadFloat(),
|
["scaleMix"] = reader.ReadFloat(),
|
||||||
["shearMix"] = reader.ReadFloat(),
|
["shearMix"] = reader.ReadFloat(),
|
||||||
};
|
};
|
||||||
if (frameCount > 1) ReadCurve(o);
|
if (frameIdx < frameCount - 1) ReadCurve(o);
|
||||||
frames.Add(o);
|
frames.Add(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
|
|||||||
private static readonly Dictionary<AttachmentType, string> AttachmentTypeJsonValue = new()
|
private static readonly Dictionary<AttachmentType, string> AttachmentTypeJsonValue = new()
|
||||||
{
|
{
|
||||||
[AttachmentType.Region] = "region",
|
[AttachmentType.Region] = "region",
|
||||||
[AttachmentType.Boundingbox] = "boundingBox",
|
[AttachmentType.Boundingbox] = "boundingbox",
|
||||||
[AttachmentType.Mesh] = "mesh",
|
[AttachmentType.Mesh] = "mesh",
|
||||||
[AttachmentType.Linkedmesh] = "linkedMesh",
|
[AttachmentType.Linkedmesh] = "linkedmesh",
|
||||||
[AttachmentType.Path] = "path",
|
[AttachmentType.Path] = "path",
|
||||||
[AttachmentType.Point] = "point",
|
[AttachmentType.Point] = "point",
|
||||||
[AttachmentType.Clipping] = "clipping",
|
[AttachmentType.Clipping] = "clipping",
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
|
|||||||
[AttachmentType.Region] = "region",
|
[AttachmentType.Region] = "region",
|
||||||
[AttachmentType.Boundingbox] = "bounding",
|
[AttachmentType.Boundingbox] = "bounding",
|
||||||
[AttachmentType.Mesh] = "mesh",
|
[AttachmentType.Mesh] = "mesh",
|
||||||
[AttachmentType.Linkedmesh] = "linkedMesh",
|
[AttachmentType.Linkedmesh] = "linkedmesh",
|
||||||
[AttachmentType.Path] = "path",
|
[AttachmentType.Path] = "path",
|
||||||
[AttachmentType.Point] = "point",
|
[AttachmentType.Point] = "point",
|
||||||
[AttachmentType.Clipping] = "clipping",
|
[AttachmentType.Clipping] = "clipping",
|
||||||
|
|||||||
@@ -222,10 +222,10 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 按 10 帧每秒计算边框
|
// 按 100 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.01f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h);
|
||||||
bounds = bounds.Union(new(x, y, w, h));
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
|
|||||||
@@ -222,10 +222,10 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 按 10 帧每秒计算边框
|
// 按 100 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.01f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
bounds = bounds.Union(new(x, y, w, h));
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
|
|||||||
@@ -219,10 +219,10 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 按 10 帧每秒计算边框
|
// 按 100 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.01f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
bounds = bounds.Union(new(x, y, w, h));
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
|
|||||||
@@ -217,10 +217,10 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 按 10 帧每秒计算边框
|
// 按 100 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.01f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
bounds = bounds.Union(new(x, y, w, h));
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
|
|||||||
@@ -216,10 +216,10 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 按 10 帧每秒计算边框
|
// 按 100 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.01f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
bounds = bounds.Union(new(x, y, w, h));
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
|
|||||||
@@ -216,10 +216,10 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
//tmpSkeleton.Update(0);
|
//tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 按 10 帧每秒计算边框
|
// 按 100 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.01f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
bounds = bounds.Union(new(x, y, w, h));
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
|
|||||||
@@ -216,10 +216,10 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform(Skeleton.Physics.Update);
|
tmpSkeleton.UpdateWorldTransform(Skeleton.Physics.Update);
|
||||||
|
|
||||||
// 按 10 帧每秒计算边框
|
// 按 100 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.01f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
bounds = bounds.Union(new(x, y, w, h));
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
|
|||||||
@@ -30,15 +30,6 @@ namespace SpineViewer.Spine.SpineExporter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool KeepLast { get; set; } = true;
|
public bool KeepLast { get; set; } = true;
|
||||||
|
|
||||||
public override string? Validate()
|
|
||||||
{
|
|
||||||
if (base.Validate() is string error)
|
|
||||||
return error;
|
|
||||||
if (IsExportSingle && Duration < 0)
|
|
||||||
return Properties.Resources.negativeDuration;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成单个模型的帧序列
|
/// 生成单个模型的帧序列
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -93,8 +84,16 @@ namespace SpineViewer.Spine.SpineExporter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected IEnumerable<SFMLImageVideoFrame> GetFrames(SpineObject[] spinesToRender, BackgroundWorker? worker = null)
|
protected IEnumerable<SFMLImageVideoFrame> GetFrames(SpineObject[] spinesToRender, BackgroundWorker? worker = null)
|
||||||
{
|
{
|
||||||
// 导出单个时必须根据 Duration 决定导出时长
|
// 导出单个时取所有模型的所有轨道时长最大值
|
||||||
var duration = Duration;
|
var duration = Duration;
|
||||||
|
if (duration < 0)
|
||||||
|
{
|
||||||
|
duration = spinesToRender.Select(
|
||||||
|
sp => sp.GetTrackIndices().Select(
|
||||||
|
i => sp.GetAnimationDuration(sp.GetAnimation(i))
|
||||||
|
).DefaultIfEmpty(0).Max()
|
||||||
|
).Max();
|
||||||
|
}
|
||||||
|
|
||||||
float delta = 1f / FPS;
|
float delta = 1f / FPS;
|
||||||
int total = (int)(duration * FPS); // 完整帧的数量
|
int total = (int)(duration * FPS); // 完整帧的数量
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
||||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||||
<Version>0.12.13</Version>
|
<Version>0.12.17</Version>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ApplicationIcon>appicon.ico</ApplicationIcon>
|
<ApplicationIcon>appicon.ico</ApplicationIcon>
|
||||||
|
|||||||
Reference in New Issue
Block a user