[csharp] Port of commit 11b339b. Added slot path nonsessential data.

This commit is contained in:
Harald Csaszar 2024-01-22 18:43:18 +01:00
parent 9602a715d9
commit 468656ba0e
5 changed files with 27 additions and 4 deletions

View File

@ -199,7 +199,15 @@ namespace Spine {
// Slots.
SlotData[] slots = skeletonData.slots.Resize(n = input.ReadInt(true)).Items;
for (int i = 0; i < n; i++) {
String slotName = input.ReadString();
String slotName = input.ReadString(); //, path = null;
if (nonessential) {
int slash = slotName.LastIndexOf('/');
if (slash != -1) {
//path = slotName.Substring(0, slash);
slotName = slotName.Substring(slash + 1);
}
}
BoneData boneData = bones[input.ReadInt(true)];
SlotData slotData = new SlotData(i, slotName, boneData);
int color = input.ReadInt();
@ -218,7 +226,9 @@ namespace Spine {
slotData.attachmentName = input.ReadStringRef();
slotData.blendMode = (BlendMode)input.ReadInt(true);
if (nonessential) input.ReadBoolean(); // if (nonessential) data.visible = input.readBoolean();
if (nonessential) {
input.ReadBoolean(); // data.visible = input.readBoolean(); data.path = path;
}
slots[i] = slotData;
}

View File

@ -58,6 +58,7 @@ namespace Spine {
/// <summary>The skeleton's bones, sorted parent first. The root bone is always the first bone.</summary>
public ExposedList<BoneData> Bones { get { return bones; } }
/// <summary>The skeleton's slots in the setup pose draw order.</summary>
public ExposedList<SlotData> Slots { get { return slots; } }
/// <summary>All skins, including the default skin.</summary>

View File

@ -143,7 +143,13 @@ namespace Spine {
// Slots.
if (root.ContainsKey("slots")) {
foreach (Dictionary<string, Object> slotMap in (List<Object>)root["slots"]) {
string slotName = (string)slotMap["name"];
string slotName = (string)slotMap["name"]; //, path = null;
int slash = slotName.LastIndexOf('/');
if (slash != -1) {
//path = slotName.Substring(0, slash);
slotName = slotName.Substring(slash + 1);
}
string boneName = (string)slotMap["bone"];
BoneData boneData = skeletonData.FindBone(boneName);
if (boneData == null) throw new Exception("Slot bone not found: " + boneName);
@ -170,6 +176,8 @@ namespace Spine {
data.blendMode = (BlendMode)Enum.Parse(typeof(BlendMode), (string)slotMap["blend"], true);
else
data.blendMode = BlendMode.Normal;
//data.visible = slotMap.getBoolean("visible", true);
//data.path = path;
skeletonData.slots.Add(data);
}
}

View File

@ -40,6 +40,10 @@ namespace Spine {
internal string attachmentName;
internal BlendMode blendMode;
// Nonessential.
// bool visible = true;
// string path;
/// <summary>The index of the slot in <see cref="Skeleton.Slots"/>.</summary>
public int Index { get { return index; } }
/// <summary>The name of the slot, which is unique across all slots in the skeleton.</summary>

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-csharp",
"displayName": "spine-csharp Runtime",
"description": "This plugin provides the spine-csharp core runtime.",
"version": "4.2.11",
"version": "4.2.12",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",