Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd652a72a1 | ||
|
|
828ff30dbf | ||
|
|
f452fe8a71 | ||
|
|
15e29a3b8a | ||
|
|
5c6e98f5e1 | ||
|
|
ef06073119 | ||
|
|
bca8b0ad85 |
@@ -1,5 +1,12 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## v0.12.13
|
||||||
|
|
||||||
|
- 导出文件名增加额外的随机字符串
|
||||||
|
|
||||||
|
## v0.12.12
|
||||||
|
|
||||||
|
- 修复 2.1 版本遗漏的 SkinnedMeshAttachment 附件渲染
|
||||||
|
|
||||||
## v0.12.11
|
## v0.12.11
|
||||||
|
|
||||||
|
|||||||
@@ -1069,14 +1069,14 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
|
|||||||
{
|
{
|
||||||
["time"] = reader.ReadFloat(),
|
["time"] = reader.ReadFloat(),
|
||||||
};
|
};
|
||||||
|
ReadCurve(frame, 1);
|
||||||
|
frame = o;
|
||||||
end = reader.ReadVarInt();
|
end = reader.ReadVarInt();
|
||||||
if (end > 0)
|
if (end > 0)
|
||||||
{
|
{
|
||||||
frame["offset"] = reader.ReadVarInt();
|
frame["offset"] = reader.ReadVarInt();
|
||||||
frame["vertices"] = ReadFloatArray(end);
|
frame["vertices"] = ReadFloatArray(end);
|
||||||
}
|
}
|
||||||
ReadCurve(frame, 1);
|
|
||||||
frame = o;
|
|
||||||
frames.Add(frame);
|
frames.Add(frame);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
SFML.Graphics.Texture texture;
|
SFML.Graphics.Texture texture;
|
||||||
|
|
||||||
float[] worldVertices = worldVerticesBuffer; // 顶点世界坐标, 连续的 [x0, y0, x1, y1, ...] 坐标值
|
float[] worldVertices = worldVerticesBuffer; // 顶点世界坐标, 连续的 [x0, y0, x1, y1, ...] 坐标值
|
||||||
int worldVerticesCount; // 等于顶点数组的长度除以 2
|
//int worldVerticesCount; // 等于顶点数组的长度除以 2
|
||||||
int[] worldTriangleIndices; // 三角形索引, 从顶点坐标数组取的时候要乘以 2, 最大值是 worldVerticesCount - 1
|
int[] worldTriangleIndices; // 三角形索引, 从顶点坐标数组取的时候要乘以 2, 最大值是 worldVerticesCount - 1
|
||||||
int worldTriangleIndicesLength; // 三角形索引数组长度
|
int worldTriangleIndicesLength; // 三角形索引数组长度
|
||||||
float[] uvs; // 纹理坐标
|
float[] uvs; // 纹理坐标
|
||||||
@@ -274,7 +274,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
texture = (SFML.Graphics.Texture)((AtlasRegion)regionAttachment.RendererObject).page.rendererObject;
|
texture = (SFML.Graphics.Texture)((AtlasRegion)regionAttachment.RendererObject).page.rendererObject;
|
||||||
|
|
||||||
regionAttachment.ComputeWorldVertices(slot.Bone, worldVertices);
|
regionAttachment.ComputeWorldVertices(slot.Bone, worldVertices);
|
||||||
worldVerticesCount = 4;
|
//worldVerticesCount = 4;
|
||||||
worldTriangleIndices = [0, 1, 2, 2, 3, 0];
|
worldTriangleIndices = [0, 1, 2, 2, 3, 0];
|
||||||
worldTriangleIndicesLength = 6;
|
worldTriangleIndicesLength = 6;
|
||||||
uvs = regionAttachment.UVs;
|
uvs = regionAttachment.UVs;
|
||||||
@@ -290,7 +290,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
if (meshAttachment.Vertices.Length > worldVertices.Length)
|
if (meshAttachment.Vertices.Length > worldVertices.Length)
|
||||||
worldVertices = worldVerticesBuffer = new float[meshAttachment.Vertices.Length * 2];
|
worldVertices = worldVerticesBuffer = new float[meshAttachment.Vertices.Length * 2];
|
||||||
meshAttachment.ComputeWorldVertices(slot, worldVertices);
|
meshAttachment.ComputeWorldVertices(slot, worldVertices);
|
||||||
worldVerticesCount = meshAttachment.Vertices.Length / 2;
|
//worldVerticesCount = meshAttachment.Vertices.Length / 2;
|
||||||
worldTriangleIndices = meshAttachment.Triangles;
|
worldTriangleIndices = meshAttachment.Triangles;
|
||||||
worldTriangleIndicesLength = meshAttachment.Triangles.Length;
|
worldTriangleIndicesLength = meshAttachment.Triangles.Length;
|
||||||
uvs = meshAttachment.UVs;
|
uvs = meshAttachment.UVs;
|
||||||
@@ -299,6 +299,22 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tintB *= meshAttachment.B;
|
tintB *= meshAttachment.B;
|
||||||
tintA *= meshAttachment.A;
|
tintA *= meshAttachment.A;
|
||||||
}
|
}
|
||||||
|
else if (attachment is SkinnedMeshAttachment skinnedMeshAttachment)
|
||||||
|
{
|
||||||
|
texture = (SFML.Graphics.Texture)((AtlasRegion)skinnedMeshAttachment.RendererObject).page.rendererObject;
|
||||||
|
|
||||||
|
if (skinnedMeshAttachment.UVs.Length > worldVertices.Length)
|
||||||
|
worldVertices = worldVerticesBuffer = new float[skinnedMeshAttachment.UVs.Length * 2];
|
||||||
|
skinnedMeshAttachment.ComputeWorldVertices(slot, worldVertices);
|
||||||
|
//worldVerticesCount = skinnedMeshAttachment.Vertices.Length / 2;
|
||||||
|
worldTriangleIndices = skinnedMeshAttachment.Triangles;
|
||||||
|
worldTriangleIndicesLength = skinnedMeshAttachment.Triangles.Length;
|
||||||
|
uvs = skinnedMeshAttachment.UVs;
|
||||||
|
tintR *= skinnedMeshAttachment.R;
|
||||||
|
tintG *= skinnedMeshAttachment.G;
|
||||||
|
tintB *= skinnedMeshAttachment.B;
|
||||||
|
tintA *= skinnedMeshAttachment.A;
|
||||||
|
}
|
||||||
// 2.1.x 不支持剪裁
|
// 2.1.x 不支持剪裁
|
||||||
//else if (attachment is ClippingAttachment clippingAttachment)
|
//else if (attachment is ClippingAttachment clippingAttachment)
|
||||||
//{
|
//{
|
||||||
@@ -432,6 +448,37 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
vt.Position.Y = worldVerticesBuffer[idx2 + 1];
|
vt.Position.Y = worldVerticesBuffer[idx2 + 1];
|
||||||
lineVertices.Append(vt); lineVertices.Append(vt);
|
lineVertices.Append(vt); lineVertices.Append(vt);
|
||||||
|
|
||||||
|
vt.Position.X = worldVerticesBuffer[idx0];
|
||||||
|
vt.Position.Y = worldVerticesBuffer[idx0 + 1];
|
||||||
|
lineVertices.Append(vt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (slot.Attachment is SkinnedMeshAttachment skinnedMeshAttachment)
|
||||||
|
{
|
||||||
|
if (skinnedMeshAttachment.UVs.Length > worldVerticesBuffer.Length)
|
||||||
|
worldVerticesBuffer = new float[skinnedMeshAttachment.UVs.Length * 2];
|
||||||
|
|
||||||
|
skinnedMeshAttachment.ComputeWorldVertices(slot, worldVerticesBuffer);
|
||||||
|
|
||||||
|
var triangleIndices = skinnedMeshAttachment.Triangles;
|
||||||
|
for (int i = 0; i < triangleIndices.Length; i += 3)
|
||||||
|
{
|
||||||
|
var idx0 = triangleIndices[i] * 2;
|
||||||
|
var idx1 = triangleIndices[i + 1] * 2;
|
||||||
|
var idx2 = triangleIndices[i + 2] * 2;
|
||||||
|
|
||||||
|
vt.Position.X = worldVerticesBuffer[idx0];
|
||||||
|
vt.Position.Y = worldVerticesBuffer[idx0 + 1];
|
||||||
|
lineVertices.Append(vt);
|
||||||
|
|
||||||
|
vt.Position.X = worldVerticesBuffer[idx1];
|
||||||
|
vt.Position.Y = worldVerticesBuffer[idx1 + 1];
|
||||||
|
lineVertices.Append(vt); lineVertices.Append(vt);
|
||||||
|
|
||||||
|
vt.Position.X = worldVerticesBuffer[idx2];
|
||||||
|
vt.Position.Y = worldVerticesBuffer[idx2 + 1];
|
||||||
|
lineVertices.Append(vt); lineVertices.Append(vt);
|
||||||
|
|
||||||
vt.Position.X = worldVerticesBuffer[idx0];
|
vt.Position.X = worldVerticesBuffer[idx0];
|
||||||
vt.Position.Y = worldVerticesBuffer[idx0 + 1];
|
vt.Position.Y = worldVerticesBuffer[idx0 + 1];
|
||||||
lineVertices.Append(vt);
|
lineVertices.Append(vt);
|
||||||
@@ -454,6 +501,34 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
|
|
||||||
var hullLength = (meshAttachment.HullLength >> 1) << 1;
|
var hullLength = (meshAttachment.HullLength >> 1) << 1;
|
||||||
|
|
||||||
|
if (debugMeshHulls && hullLength > 2)
|
||||||
|
{
|
||||||
|
vt.Position.X = worldVerticesBuffer[0];
|
||||||
|
vt.Position.Y = worldVerticesBuffer[1];
|
||||||
|
lineVertices.Append(vt);
|
||||||
|
|
||||||
|
for (int i = 2; i < hullLength; i += 2)
|
||||||
|
{
|
||||||
|
vt.Position.X = worldVerticesBuffer[i];
|
||||||
|
vt.Position.Y = worldVerticesBuffer[i + 1];
|
||||||
|
lineVertices.Append(vt);
|
||||||
|
lineVertices.Append(vt);
|
||||||
|
}
|
||||||
|
|
||||||
|
vt.Position.X = worldVerticesBuffer[0];
|
||||||
|
vt.Position.Y = worldVerticesBuffer[1];
|
||||||
|
lineVertices.Append(vt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (slot.Attachment is SkinnedMeshAttachment skinnedMeshAttachment)
|
||||||
|
{
|
||||||
|
if (skinnedMeshAttachment.UVs.Length > worldVerticesBuffer.Length)
|
||||||
|
worldVerticesBuffer = new float[skinnedMeshAttachment.UVs.Length * 2];
|
||||||
|
|
||||||
|
skinnedMeshAttachment.ComputeWorldVertices(slot, worldVerticesBuffer);
|
||||||
|
|
||||||
|
var hullLength = (skinnedMeshAttachment.HullLength >> 1) << 1;
|
||||||
|
|
||||||
if (debugMeshHulls && hullLength > 2)
|
if (debugMeshHulls && hullLength > 2)
|
||||||
{
|
{
|
||||||
vt.Position.X = worldVerticesBuffer[0];
|
vt.Position.X = worldVerticesBuffer[0];
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace SpineViewer.Spine.SpineExporter
|
|||||||
var noteSuffix = FileNameNoteSuffix;
|
var noteSuffix = FileNameNoteSuffix;
|
||||||
if (!string.IsNullOrWhiteSpace(noteSuffix)) noteSuffix = $"_{noteSuffix}";
|
if (!string.IsNullOrWhiteSpace(noteSuffix)) noteSuffix = $"_{noteSuffix}";
|
||||||
|
|
||||||
var filename = $"ffmpeg_{timestamp}_{FPS:f0}{noteSuffix}{Suffix}";
|
var filename = $"ffmpeg_{timestamp}_{Guid.NewGuid().ToString()[..6]}_{FPS:f0}{noteSuffix}{Suffix}";
|
||||||
|
|
||||||
// 导出单个时必定提供输出文件夹
|
// 导出单个时必定提供输出文件夹
|
||||||
var savePath = Path.Combine(OutputDir, filename);
|
var savePath = Path.Combine(OutputDir, filename);
|
||||||
@@ -86,7 +86,7 @@ namespace SpineViewer.Spine.SpineExporter
|
|||||||
{
|
{
|
||||||
if (worker?.CancellationPending == true) break; // 取消的日志在 GetFrames 里输出
|
if (worker?.CancellationPending == true) break; // 取消的日志在 GetFrames 里输出
|
||||||
|
|
||||||
var filename = $"{spine.Name}_{timestamp}_{FPS:f0}{noteSuffix}{Suffix}";
|
var filename = $"{spine.Name}_{timestamp}_{spine.ID[..6]}_{FPS:f0}{noteSuffix}{Suffix}";
|
||||||
|
|
||||||
// 如果提供了输出文件夹, 则全部导出到输出文件夹, 否则导出到各自的文件夹下
|
// 如果提供了输出文件夹, 则全部导出到输出文件夹, 否则导出到各自的文件夹下
|
||||||
var savePath = Path.Combine(OutputDir ?? spine.AssetsDir, filename);
|
var savePath = Path.Combine(OutputDir ?? spine.AssetsDir, filename);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace SpineViewer.Spine.SpineExporter
|
|||||||
protected override void ExportSingle(SpineObject[] spinesToRender, BackgroundWorker? worker = null)
|
protected override void ExportSingle(SpineObject[] spinesToRender, BackgroundWorker? worker = null)
|
||||||
{
|
{
|
||||||
// 导出单个时必定提供输出文件夹
|
// 导出单个时必定提供输出文件夹
|
||||||
var filename = $"frame_{timestamp}{ImageFormat.GetSuffix()}";
|
var filename = $"frame_{timestamp}_{Guid.NewGuid().ToString()[..6]}{ImageFormat.GetSuffix()}";
|
||||||
var savePath = Path.Combine(OutputDir, filename);
|
var savePath = Path.Combine(OutputDir, filename);
|
||||||
|
|
||||||
worker?.ReportProgress(0, $"{Properties.Resources.process} 0/1");
|
worker?.ReportProgress(0, $"{Properties.Resources.process} 0/1");
|
||||||
@@ -78,7 +78,7 @@ namespace SpineViewer.Spine.SpineExporter
|
|||||||
var spine = spinesToRender[i];
|
var spine = spinesToRender[i];
|
||||||
|
|
||||||
// 逐个导出时如果提供了输出文件夹, 则全部导出到输出文件夹, 否则输出到各自的文件夹
|
// 逐个导出时如果提供了输出文件夹, 则全部导出到输出文件夹, 否则输出到各自的文件夹
|
||||||
var filename = $"{spine.Name}_{timestamp}{ImageFormat.GetSuffix()}";
|
var filename = $"{spine.Name}_{timestamp}_{spine.ID[..6]}{ImageFormat.GetSuffix()}";
|
||||||
var savePath = Path.Combine(OutputDir ?? spine.AssetsDir, filename);
|
var savePath = Path.Combine(OutputDir ?? spine.AssetsDir, filename);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -22,14 +22,16 @@ namespace SpineViewer.Spine.SpineExporter
|
|||||||
|
|
||||||
protected override void ExportSingle(SpineObject[] spinesToRender, BackgroundWorker? worker = null)
|
protected override void ExportSingle(SpineObject[] spinesToRender, BackgroundWorker? worker = null)
|
||||||
{
|
{
|
||||||
|
var uniqueSuffix = Guid.NewGuid().ToString()[..6];
|
||||||
|
|
||||||
// 导出单个时必定提供输出文件夹,
|
// 导出单个时必定提供输出文件夹,
|
||||||
var saveDir = Path.Combine(OutputDir, $"frames_{timestamp}_{FPS:f0}");
|
var saveDir = Path.Combine(OutputDir, $"frames_{timestamp}_{uniqueSuffix}_{FPS:f0}");
|
||||||
Directory.CreateDirectory(saveDir);
|
Directory.CreateDirectory(saveDir);
|
||||||
|
|
||||||
int frameIdx = 0;
|
int frameIdx = 0;
|
||||||
foreach (var frame in GetFrames(spinesToRender, worker))
|
foreach (var frame in GetFrames(spinesToRender, worker))
|
||||||
{
|
{
|
||||||
var filename = $"frames_{timestamp}_{FPS:f0}_{frameIdx:d6}{Suffix}";
|
var filename = $"frames_{timestamp}_{uniqueSuffix}_{FPS:f0}_{frameIdx:d6}{Suffix}";
|
||||||
var savePath = Path.Combine(saveDir, filename);
|
var savePath = Path.Combine(saveDir, filename);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -56,14 +58,14 @@ namespace SpineViewer.Spine.SpineExporter
|
|||||||
if (worker?.CancellationPending == true) break; // 取消的日志在 GetFrames 里输出
|
if (worker?.CancellationPending == true) break; // 取消的日志在 GetFrames 里输出
|
||||||
|
|
||||||
// 如果提供了输出文件夹, 则全部导出到输出文件夹, 否则导出到各自的文件夹下
|
// 如果提供了输出文件夹, 则全部导出到输出文件夹, 否则导出到各自的文件夹下
|
||||||
var subDir = $"{spine.Name}_{timestamp}_{FPS:f0}";
|
var subDir = $"{spine.Name}_{timestamp}_{spine.ID[..6]}_{FPS:f0}";
|
||||||
var saveDir = Path.Combine(OutputDir ?? spine.AssetsDir, subDir);
|
var saveDir = Path.Combine(OutputDir ?? spine.AssetsDir, subDir);
|
||||||
Directory.CreateDirectory(saveDir);
|
Directory.CreateDirectory(saveDir);
|
||||||
|
|
||||||
int frameIdx = 0;
|
int frameIdx = 0;
|
||||||
foreach (var frame in GetFrames(spine, worker))
|
foreach (var frame in GetFrames(spine, worker))
|
||||||
{
|
{
|
||||||
var filename = $"{spine.Name}_{timestamp}_{FPS:f0}_{frameIdx:d6}{Suffix}";
|
var filename = $"{spine.Name}_{timestamp}_{spine.ID[..6]}_{FPS:f0}_{frameIdx:d6}{Suffix}";
|
||||||
var savePath = Path.Combine(saveDir, filename);
|
var savePath = Path.Combine(saveDir, filename);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -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.11</Version>
|
<Version>0.12.13</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