Skip to content

Commit abc8624

Browse files
committed
#9 renamed slashes in slot attachments go
1 parent 1dc64d7 commit abc8624

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Assets/UnitySpineImporter/Scripts/Editor/Util/SpineUtil.cs

+9-6
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ public AtlasImageDuplicateSpriteName(string message):base(message){
2121
}
2222

2323
public class SpineUtil {
24-
public static string SLOT_PREFIX="slot";
25-
public static string SKIN_PREFIX="skin";
26-
public static string ANIMATION_FOLDER="animation";
24+
public static string SLOT_PREFIX = "slot";
25+
public static string SKIN_PREFIX = "skin";
26+
public static string ANIMATION_FOLDER = "animation";
27+
public static string SLASH_REPLACEMENT = "|";
2728

2829
public static Vector2 lineToVector2(string line){
2930
string[] xy = null;
@@ -297,17 +298,18 @@ public static void addAllAttahcmentsSlots(SpineData spineData, SpritesByName spr
297298

298299
GameObject parentGO;
299300
GameObject spriteGO;
301+
string fixedName = attachmenName.Replace("/",SLASH_REPLACEMENT);
300302
if (isDefault){
301303
parentGO = slotGO;
302-
spriteGO = new GameObject(attachmenName);
304+
spriteGO = new GameObject(fixedName);
303305
Attachment a = new Attachment(attachmenName, AttachmentType.SINGLE_SPRITE, spriteGO);
304306
slot.addAttachment(a);
305307
} else {
306308
spriteGO = new GameObject(skinName);
307309
Attachment a;
308310
slot.attachmentByName.TryGetValue(attachmenName, out a);
309311
if (a == null){
310-
GameObject attachmentGO = new GameObject(attachmenName);
312+
GameObject attachmentGO = new GameObject(fixedName);
311313
attachmentGO.transform.parent = slotGO.transform;
312314
resetLocalTRS(attachmentGO);
313315
a = new Attachment(attachmenName, AttachmentType.SKINED_SPRITE, attachmentGO);
@@ -467,7 +469,8 @@ public static void addSlotAnimationToClip(AnimationClip
467469
foreach(KeyValuePair<string, AnimationCurve> kvp2 in curveByName){
468470
string attachmentName = kvp2.Key;
469471
AnimationCurve animationCurve = kvp2.Value;
470-
string attachmentPath = spineData.slotPathByName[slotName] + "/" + attachmentName;
472+
string attachmentPath = spineData.slotPathByName[slotName] + "/" + attachmentName.Replace("/",SLASH_REPLACEMENT);
473+
Debug.Log(attachmentPath);
471474
clip.SetCurve(attachmentPath, typeof(GameObject),"m_IsActive", animationCurve);
472475
}
473476

0 commit comments

Comments
 (0)