diff --git a/CHANGELOG.md b/CHANGELOG.md index ba8dfcd..13b602e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # CHANGELOG +## v0.15.8 + +- 修复渲染纹理过程中可能的 null 错误 + +## v0.15.7 + +- 合并社区 CLI 功能项目 + ## v0.15.6 - 修复导出单个的时长错误 diff --git a/Spine/Spine.csproj b/Spine/Spine.csproj index 438207c..717e511 100644 --- a/Spine/Spine.csproj +++ b/Spine/Spine.csproj @@ -7,7 +7,7 @@ net8.0-windows $(SolutionDir)out false - 0.15.6 + 0.15.8 diff --git a/Spine/SpineObject.cs b/Spine/SpineObject.cs index 2144676..bc60f13 100644 --- a/Spine/SpineObject.cs +++ b/Spine/SpineObject.cs @@ -478,7 +478,6 @@ namespace Spine } var attachment = slot.Attachment; - SFML.Graphics.Texture texture; float[] worldVertices; // 顶点世界坐标数组, 连续的 [x0, y0, x1, y1, ...] 坐标值 int worldVerticesLength; // 顶点数组的长度 @@ -491,10 +490,11 @@ namespace Spine float tintB = _skeleton.B * slot.B; float tintA = _skeleton.A * slot.A; + SFML.Graphics.Texture texture; + switch (attachment) { case IRegionAttachment regionAttachment: - texture = regionAttachment.RendererObject; worldVerticesLength = regionAttachment.ComputeWorldVertices(slot, ref _worldVertices); worldVertices = _worldVertices; triangles = regionAttachment.Triangles; @@ -504,9 +504,11 @@ namespace Spine tintG *= regionAttachment.G; tintB *= regionAttachment.B; tintA *= regionAttachment.A; + + // NOTE: RenderObject 的获取要在 ComputeWorldVertices 发生之后, 否则可能存在某些 Region 尚未被赋值产生 null 引用报错 + texture = regionAttachment.RendererObject; break; case IMeshAttachment meshAttachment: - texture = meshAttachment.RendererObject; worldVerticesLength = meshAttachment.ComputeWorldVertices(slot, ref _worldVertices); worldVertices = _worldVertices; triangles = meshAttachment.Triangles; @@ -516,9 +518,9 @@ namespace Spine tintG *= meshAttachment.G; tintB *= meshAttachment.B; tintA *= meshAttachment.A; + texture = meshAttachment.RendererObject; break; case ISkinnedMeshAttachment skinnedMeshAttachment: - texture = skinnedMeshAttachment.RendererObject; worldVerticesLength = skinnedMeshAttachment.ComputeWorldVertices(slot, ref _worldVertices); worldVertices = _worldVertices; triangles = skinnedMeshAttachment.Triangles; @@ -528,6 +530,7 @@ namespace Spine tintG *= skinnedMeshAttachment.G; tintB *= skinnedMeshAttachment.B; tintA *= skinnedMeshAttachment.A; + texture = skinnedMeshAttachment.RendererObject; break; case IClippingAttachment clippingAttachment: _clipping.ClipStart(slot, clippingAttachment); diff --git a/SpineViewer/SpineViewer.csproj b/SpineViewer/SpineViewer.csproj index 2318fd8..fddabc2 100644 --- a/SpineViewer/SpineViewer.csproj +++ b/SpineViewer/SpineViewer.csproj @@ -7,7 +7,7 @@ net8.0-windows $(SolutionDir)out false - 0.15.7 + 0.15.8 WinExe true