调整结构

This commit is contained in:
ww-rm
2025-03-03 19:40:19 +08:00
parent 6356c7219f
commit d775956e35
109 changed files with 64 additions and 37 deletions

View File

@@ -27,6 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
using SpineRuntime38.Attachments;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -29,7 +29,7 @@
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
/// <summary> /// <summary>
/// An AttachmentLoader that configures attachments using texture regions from an Atlas. /// An AttachmentLoader that configures attachments using texture regions from an Atlas.

View File

@@ -29,7 +29,7 @@
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
abstract public class Attachment { abstract public class Attachment {
public string Name { get; private set; } public string Name { get; private set; }

View File

@@ -27,7 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
public interface AttachmentLoader { public interface AttachmentLoader {
/// <return>May be null to not load any attachment.</return> /// <return>May be null to not load any attachment.</return>
RegionAttachment NewRegionAttachment (Skin skin, string name, string path); RegionAttachment NewRegionAttachment (Skin skin, string name, string path);

View File

@@ -27,7 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
public enum AttachmentType { public enum AttachmentType {
Region, Boundingbox, Mesh, Linkedmesh, Path, Point, Clipping Region, Boundingbox, Mesh, Linkedmesh, Path, Point, Clipping
} }

View File

@@ -29,7 +29,7 @@
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
/// <summary>Attachment that has a polygon for bounds checking.</summary> /// <summary>Attachment that has a polygon for bounds checking.</summary>
public class BoundingBoxAttachment : VertexAttachment { public class BoundingBoxAttachment : VertexAttachment {
public BoundingBoxAttachment (string name) public BoundingBoxAttachment (string name)
@@ -37,7 +37,7 @@ namespace SpineRuntime38 {
} }
public override Attachment Copy () { public override Attachment Copy () {
BoundingBoxAttachment copy = new BoundingBoxAttachment(this.Name); BoundingBoxAttachment copy = new BoundingBoxAttachment(Name);
CopyTo(copy); CopyTo(copy);
return copy; return copy;
} }

View File

@@ -29,7 +29,7 @@
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
public class ClippingAttachment : VertexAttachment { public class ClippingAttachment : VertexAttachment {
internal SlotData endSlot; internal SlotData endSlot;
@@ -39,7 +39,7 @@ namespace SpineRuntime38 {
} }
public override Attachment Copy () { public override Attachment Copy () {
ClippingAttachment copy = new ClippingAttachment(this.Name); ClippingAttachment copy = new ClippingAttachment(Name);
CopyTo(copy); CopyTo(copy);
copy.endSlot = endSlot; copy.endSlot = endSlot;
return copy; return copy;

View File

@@ -29,7 +29,7 @@
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
/// <summary>Attachment that displays a texture region using a mesh.</summary> /// <summary>Attachment that displays a texture region using a mesh.</summary>
public class MeshAttachment : VertexAttachment, IHasRendererObject { public class MeshAttachment : VertexAttachment, IHasRendererObject {
internal float regionOffsetX, regionOffsetY, regionWidth, regionHeight, regionOriginalWidth, regionOriginalHeight; internal float regionOffsetX, regionOffsetY, regionWidth, regionHeight, regionOriginalWidth, regionOriginalHeight;
@@ -41,7 +41,7 @@ namespace SpineRuntime38 {
public int HullLength { get { return hulllength; } set { hulllength = value; } } public int HullLength { get { return hulllength; } set { hulllength = value; } }
public float[] RegionUVs { get { return regionUVs; } set { regionUVs = value; } } public float[] RegionUVs { get { return regionUVs; } set { regionUVs = value; } }
/// <summary>The UV pair for each vertex, normalized within the entire texture. <seealso cref="MeshAttachment.UpdateUVs"/></summary> /// <summary>The UV pair for each vertex, normalized within the entire texture. <seealso cref="UpdateUVs"/></summary>
public float[] UVs { get { return uvs; } set { uvs = value; } } public float[] UVs { get { return uvs; } set { uvs = value; } }
public int[] Triangles { get { return triangles; } set { triangles = value; } } public int[] Triangles { get { return triangles; } set { triangles = value; } }
@@ -99,8 +99,8 @@ namespace SpineRuntime38 {
float u = RegionU, v = RegionV, width = 0, height = 0; float u = RegionU, v = RegionV, width = 0, height = 0;
if (RegionDegrees == 90) { if (RegionDegrees == 90) {
float textureHeight = this.regionWidth / (RegionV2 - RegionV); float textureHeight = regionWidth / (RegionV2 - RegionV);
float textureWidth = this.regionHeight / (RegionU2 - RegionU); float textureWidth = regionHeight / (RegionU2 - RegionU);
u -= (RegionOriginalHeight - RegionOffsetY - RegionHeight) / textureWidth; u -= (RegionOriginalHeight - RegionOffsetY - RegionHeight) / textureWidth;
v -= (RegionOriginalWidth - RegionOffsetX - RegionWidth) / textureHeight; v -= (RegionOriginalWidth - RegionOffsetX - RegionWidth) / textureHeight;
width = RegionOriginalHeight / textureWidth; width = RegionOriginalHeight / textureWidth;
@@ -111,8 +111,8 @@ namespace SpineRuntime38 {
uvs[i + 1] = v + (1 - regionUVs[i]) * height; uvs[i + 1] = v + (1 - regionUVs[i]) * height;
} }
} else if (RegionDegrees == 180) { } else if (RegionDegrees == 180) {
float textureWidth = this.regionWidth / (RegionU2 - RegionU); float textureWidth = regionWidth / (RegionU2 - RegionU);
float textureHeight = this.regionHeight / (RegionV2 - RegionV); float textureHeight = regionHeight / (RegionV2 - RegionV);
u -= (RegionOriginalWidth - RegionOffsetX - RegionWidth) / textureWidth; u -= (RegionOriginalWidth - RegionOffsetX - RegionWidth) / textureWidth;
v -= RegionOffsetY / textureHeight; v -= RegionOffsetY / textureHeight;
width = RegionOriginalWidth / textureWidth; width = RegionOriginalWidth / textureWidth;
@@ -123,8 +123,8 @@ namespace SpineRuntime38 {
uvs[i + 1] = v + (1 - regionUVs[i + 1]) * height; uvs[i + 1] = v + (1 - regionUVs[i + 1]) * height;
} }
} else if (RegionDegrees == 270) { } else if (RegionDegrees == 270) {
float textureWidth = this.regionWidth / (RegionU2 - RegionU); float textureWidth = regionWidth / (RegionU2 - RegionU);
float textureHeight = this.regionHeight / (RegionV2 - RegionV); float textureHeight = regionHeight / (RegionV2 - RegionV);
u -= RegionOffsetY / textureWidth; u -= RegionOffsetY / textureWidth;
v -= RegionOffsetX / textureHeight; v -= RegionOffsetX / textureHeight;
width = RegionOriginalHeight / textureWidth; width = RegionOriginalHeight / textureWidth;
@@ -135,8 +135,8 @@ namespace SpineRuntime38 {
uvs[i + 1] = v + regionUVs[i] * height; uvs[i + 1] = v + regionUVs[i] * height;
} }
} else { } else {
float textureWidth = this.regionWidth / (RegionU2 - RegionU); float textureWidth = regionWidth / (RegionU2 - RegionU);
float textureHeight = this.regionHeight / (RegionV2 - RegionV); float textureHeight = regionHeight / (RegionV2 - RegionV);
u -= RegionOffsetX / textureWidth; u -= RegionOffsetX / textureWidth;
v -= (RegionOriginalHeight - RegionOffsetY - RegionHeight) / textureHeight; v -= (RegionOriginalHeight - RegionOffsetY - RegionHeight) / textureHeight;
width = RegionOriginalWidth / textureWidth; width = RegionOriginalWidth / textureWidth;
@@ -152,7 +152,7 @@ namespace SpineRuntime38 {
public override Attachment Copy () { public override Attachment Copy () {
if (parentMesh != null) return NewLinkedMesh(); if (parentMesh != null) return NewLinkedMesh();
MeshAttachment copy = new MeshAttachment(this.Name); MeshAttachment copy = new MeshAttachment(Name);
copy.RendererObject = RendererObject; copy.RendererObject = RendererObject;
copy.regionOffsetX = regionOffsetX; copy.regionOffsetX = regionOffsetX;
copy.regionOffsetY = regionOffsetY; copy.regionOffsetY = regionOffsetY;

View File

@@ -30,7 +30,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
public class PathAttachment : VertexAttachment { public class PathAttachment : VertexAttachment {
internal float[] lengths; internal float[] lengths;
internal bool closed, constantSpeed; internal bool closed, constantSpeed;
@@ -40,12 +40,12 @@ namespace SpineRuntime38 {
public bool Closed { get { return closed; } set { closed = value; } } public bool Closed { get { return closed; } set { closed = value; } }
public bool ConstantSpeed { get { return constantSpeed; } set { constantSpeed = value; } } public bool ConstantSpeed { get { return constantSpeed; } set { constantSpeed = value; } }
public PathAttachment (String name) public PathAttachment (string name)
: base(name) { : base(name) {
} }
public override Attachment Copy () { public override Attachment Copy () {
PathAttachment copy = new PathAttachment(this.Name); PathAttachment copy = new PathAttachment(Name);
CopyTo(copy); CopyTo(copy);
copy.lengths = new float[lengths.Length]; copy.lengths = new float[lengths.Length];
Array.Copy(lengths, 0, copy.lengths, 0, lengths.Length); Array.Copy(lengths, 0, copy.lengths, 0, lengths.Length);

View File

@@ -27,7 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
/// <summary> /// <summary>
/// An attachment which is a single point and a rotation. This can be used to spawn projectiles, particles, etc. A bone can be /// An attachment which is a single point and a rotation. This can be used to spawn projectiles, particles, etc. A bone can be
/// used in similar ways, but a PointAttachment is slightly less expensive to compute and can be hidden, shown, and placed in a /// used in similar ways, but a PointAttachment is slightly less expensive to compute and can be hidden, shown, and placed in a
@@ -46,7 +46,7 @@ namespace SpineRuntime38 {
} }
public void ComputeWorldPosition (Bone bone, out float ox, out float oy) { public void ComputeWorldPosition (Bone bone, out float ox, out float oy) {
bone.LocalToWorld(this.x, this.y, out ox, out oy); bone.LocalToWorld(x, y, out ox, out oy);
} }
public float ComputeWorldRotation (Bone bone) { public float ComputeWorldRotation (Bone bone) {
@@ -57,7 +57,7 @@ namespace SpineRuntime38 {
} }
public override Attachment Copy () { public override Attachment Copy () {
PointAttachment copy = new PointAttachment(this.Name); PointAttachment copy = new PointAttachment(Name);
copy.x = x; copy.x = x;
copy.y = y; copy.y = y;
copy.rotation = rotation; copy.rotation = rotation;

View File

@@ -29,7 +29,7 @@
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
/// <summary>Attachment that displays a texture region.</summary> /// <summary>Attachment that displays a texture region.</summary>
public class RegionAttachment : Attachment, IHasRendererObject { public class RegionAttachment : Attachment, IHasRendererObject {
public const int BLX = 0; public const int BLX = 0;
@@ -180,7 +180,7 @@ namespace SpineRuntime38 {
} }
public override Attachment Copy () { public override Attachment Copy () {
RegionAttachment copy = new RegionAttachment(this.Name); RegionAttachment copy = new RegionAttachment(Name);
copy.RendererObject = RendererObject; copy.RendererObject = RendererObject;
copy.regionOffsetX = regionOffsetX; copy.regionOffsetX = regionOffsetX;
copy.regionOffsetY = regionOffsetY; copy.regionOffsetY = regionOffsetY;

View File

@@ -29,12 +29,12 @@
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38.Attachments {
/// <summary>>An attachment with vertices that are transformed by one or more bones and can be deformed by a slot's /// <summary>>An attachment with vertices that are transformed by one or more bones and can be deformed by a slot's
/// <see cref="Slot.Deform"/>.</summary> /// <see cref="Slot.Deform"/>.</summary>
public abstract class VertexAttachment : Attachment { public abstract class VertexAttachment : Attachment {
static int nextID = 0; static int nextID = 0;
static readonly Object nextIdLock = new Object(); static readonly object nextIdLock = new object();
internal readonly int id; internal readonly int id;
internal int[] bones; internal int[] bones;
@@ -55,8 +55,8 @@ namespace SpineRuntime38 {
: base(name) { : base(name) {
deformAttachment = this; deformAttachment = this;
lock (VertexAttachment.nextIdLock) { lock (nextIdLock) {
id = (VertexAttachment.nextID++ & 65535) << 11; id = (nextID++ & 65535) << 11;
} }
} }

View File

@@ -27,6 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
using SpineRuntime38.Attachments;
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38 {

View File

@@ -27,6 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
using SpineRuntime38.Attachments;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -34,6 +34,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using SpineRuntime38.Attachments;
#if WINDOWS_STOREAPP #if WINDOWS_STOREAPP
using System.Threading.Tasks; using System.Threading.Tasks;

View File

@@ -27,6 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
using SpineRuntime38.Attachments;
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38 {

View File

@@ -27,6 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
using SpineRuntime38.Attachments;
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38 {

View File

@@ -34,6 +34,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using SpineRuntime38.Attachments;
#if WINDOWS_STOREAPP #if WINDOWS_STOREAPP
using System.Threading.Tasks; using System.Threading.Tasks;

View File

@@ -27,6 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
using SpineRuntime38.Attachments;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -27,6 +27,7 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
using SpineRuntime38.Attachments;
using System; using System;
namespace SpineRuntime38 { namespace SpineRuntime38 {

View File

@@ -41,6 +41,11 @@ namespace SpineViewer
LogManager.ReconfigExistingLoggers(); LogManager.ReconfigExistingLoggers();
} }
private void ExportPng_Work(object? sender, DoWorkEventArgs e)
{
}
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
{ {
spinePreviewer.StartPreview(); spinePreviewer.StartPreview();
@@ -63,11 +68,23 @@ namespace SpineViewer
private void toolStripMenuItem_Export_Click(object sender, EventArgs e) private void toolStripMenuItem_Export_Click(object sender, EventArgs e)
{ {
Program.Logger.Debug("Debug Test"); lock (spineListView.Spines)
Program.Logger.Info("Info Test"); {
Program.Logger.Warn("Warn Test"); if (spineListView.Spines.Count <= 0)
Program.Logger.Error("Error Test"); {
Program.Logger.Fatal("Fatal Test"); MessageBox.Show("请至少打开一个骨骼文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
//var openDialog = new BatchOpenSpineDialog();
//if (openDialog.ShowDialog() != DialogResult.OK)
// return;
//var progressDialog = new ProgressDialog();
//progressDialog.DoWork += ExportPng_Work;
//progressDialog.RunWorkerAsync(new { openDialog.SkelPaths, openDialog.Version });
//progressDialog.ShowDialog();
} }
private void toolStripMenuItem_Exit_Click(object sender, EventArgs e) private void toolStripMenuItem_Exit_Click(object sender, EventArgs e)

View File

@@ -6,6 +6,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpineRuntime38; using SpineRuntime38;
using SpineRuntime38.Attachments;
using SpineViewer.Spine; using SpineViewer.Spine;
namespace SpineViewer.Spine.Implementations namespace SpineViewer.Spine.Implementations

Some files were not shown because too many files have changed in this diff Show More