[ts] Port of commit 687260a: Removed SlotData#path.

The name now always contains the full path.
This commit is contained in:
Davide Tantillo 2024-05-15 09:35:47 +02:00
parent e99899e819
commit 24dc328b15
3 changed files with 2 additions and 23 deletions

View File

@ -128,14 +128,6 @@ export class SkeletonBinary {
for (let i = 0; i < n; i++) {
let slotName = input.readString();
if (!slotName) throw new Error("Slot name must not be null.");
let path: string | null = null;
if (nonessential) {
const slash = slotName!.lastIndexOf('/');
if (slash != -1) {
path = slotName.substring(0, slash);
slotName = slotName.substring(slash + 1);
}
}
let boneData = skeletonData.bones[input.readInt(true)];
let data = new SlotData(i, slotName, boneData);
Color.rgba8888ToColor(data.color, input.readInt32());
@ -145,10 +137,7 @@ export class SkeletonBinary {
data.attachmentName = input.readStringRef();
data.blendMode = input.readInt(true);
if (nonessential) {
data.visible = input.readBoolean();
data.path = path;
}
if (nonessential) data.visible = input.readBoolean();
skeletonData.slots.push(data);
}

View File

@ -116,13 +116,8 @@ export class SkeletonJson {
if (root.slots) {
for (let i = 0; i < root.slots.length; i++) {
let slotMap = root.slots[i];
let path: string | null = null;
let slotName = slotMap.name;
const slash = slotName.lastIndexOf('/');
if (slash != -1) {
path = slotName.substring(0, slash);
slotName = slotName.substring(slash + 1);
}
let boneData = skeletonData.findBone(slotMap.bone);
if (!boneData) throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
let data = new SlotData(skeletonData.slots.length, slotName, boneData);
@ -136,7 +131,6 @@ export class SkeletonJson {
data.attachmentName = getValue(slotMap, "attachment", null);
data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal"));
data.visible = getValue(slotMap, "visible", true);
data.path = path;
skeletonData.slots.push(data);
}
}

View File

@ -58,10 +58,6 @@ export class SlotData {
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
visible = true;
/** The folders for this slot in the draw order, delimited by <code>/</code>, or null if nonessential data was not exported. */
path: string | null = null;
constructor (index: number, name: string, boneData: BoneData) {
if (index < 0) throw new Error("index must be >= 0.");
if (!name) throw new Error("name cannot be null.");