Compare commits

...

28 Commits

Author SHA1 Message Date
ww-rm
b34639c383 Merge pull request #48 from ww-rm/dev/wf
Release v0.12.16
2025-06-11 13:43:20 +08:00
ww-rm
c0e2bb81e5 更新至v0.12.16 2025-06-11 13:41:25 +08:00
ww-rm
55ebcc1857 合并导出时也允许自动时长 2025-06-11 13:38:55 +08:00
ww-rm
e3a201af89 Merge pull request #42 from ww-rm/dev/wf
修复工作流错误
2025-05-28 18:23:30 +08:00
ww-rm
292ede8461 修复工作流错误 2025-05-28 18:22:33 +08:00
ww-rm
112a9a1bf2 Merge pull request #41 from ww-rm/dev/wf
修复工作流错误
2025-05-28 17:29:22 +08:00
ww-rm
63ed8d7ca4 修复工作流错误 2025-05-28 17:27:55 +08:00
ww-rm
d1e33c25bc Merge pull request #40 from ww-rm/dev/wf
修复工作流错误
2025-05-28 17:15:34 +08:00
ww-rm
ce7c6f3802 修复工作流错误 2025-05-28 17:14:08 +08:00
ww-rm
0a30af0ad2 Merge pull request #39 from ww-rm/dev/wf
修复工作流错误
2025-05-28 17:11:05 +08:00
ww-rm
0b478cab18 修复工作流错误 2025-05-28 17:09:58 +08:00
ww-rm
b14849a0b1 Merge pull request #38 from ww-rm/dev/wf
Dev/wf
2025-05-28 17:00:46 +08:00
ww-rm
b7f5f24e6f Merge branch 'dev/wf' of github.com:ww-rm/SpineViewer into dev/wf 2025-05-28 16:59:51 +08:00
ww-rm
150331d2e4 修复工作流错误 2025-05-28 16:59:38 +08:00
ww-rm
dcec8797b0 Merge pull request #37 from ww-rm/dev/wf
Dev/wf
2025-05-28 16:46:12 +08:00
ww-rm
4d1aec9ed8 Merge branch 'release/wf' into dev/wf 2025-05-28 16:45:42 +08:00
ww-rm
0cb325820b 修复工作流版本提取错误 2025-05-28 16:38:00 +08:00
ww-rm
2a862b28be 更改工作流自动获取版本号 2025-05-28 16:29:29 +08:00
ww-rm
c2935f49e9 更新至v0.12.15 2025-05-28 16:29:29 +08:00
ww-rm
22043f8f38 update changelog 2025-05-28 16:29:29 +08:00
ww-rm
3020a818f0 修复附件类型枚举量的字符串大小写问题 2025-05-28 16:29:29 +08:00
ww-rm
30177e8d7f 更改工作流自动获取版本号 2025-05-28 16:28:12 +08:00
ww-rm
3ad49838be 更新至v0.12.15 2025-05-28 16:05:55 +08:00
ww-rm
3e480abd44 update changelog 2025-05-28 16:05:42 +08:00
ww-rm
49f6b28aef 修复附件类型枚举量的字符串大小写问题 2025-05-28 16:05:09 +08:00
ww-rm
b81d13b582 更新至v0.12.14 2025-05-28 09:13:03 +08:00
ww-rm
04eb3cb640 update changelog 2025-05-28 09:12:37 +08:00
ww-rm
0ac75a088a 修复curve读取错误 2025-05-28 09:11:25 +08:00
7 changed files with 87 additions and 35 deletions

View File

@@ -1,46 +1,80 @@
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
uses: actions/create-release@v1 uses: actions/create-release@v1
@@ -51,7 +85,7 @@ jobs:
release_name: Release ${{ env.VERSION }} release_name: Release ${{ env.VERSION }}
draft: false draft: false
prerelease: false prerelease: false
- name: Upload FrameworkDependent zip - name: Upload FrameworkDependent zip
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
@@ -61,7 +95,7 @@ jobs:
asset_path: release/${{ env.PROJECT_NAME }}-${{ env.VERSION }}.zip asset_path: release/${{ env.PROJECT_NAME }}-${{ env.VERSION }}.zip
asset_name: ${{ env.PROJECT_NAME }}-${{ env.VERSION }}.zip asset_name: ${{ env.PROJECT_NAME }}-${{ env.VERSION }}.zip
asset_content_type: application/zip asset_content_type: application/zip
- name: Upload SelfContained zip - name: Upload SelfContained zip
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:

View File

@@ -1,5 +1,13 @@
# CHANGELOG # CHANGELOG
## v0.12.15
- 修复附件类型枚举量字符串大小写问题
## v0.12.14
- 修复 v38 文件读取的小 bug
## v0.12.13 ## v0.12.13
- 导出文件名增加额外的随机字符串 - 导出文件名增加额外的随机字符串

View File

@@ -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);
} }
} }

View File

@@ -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",

View File

@@ -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",

View File

@@ -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); // 完整帧的数量

View File

@@ -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.16</Version>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>appicon.ico</ApplicationIcon> <ApplicationIcon>appicon.ico</ApplicationIcon>