mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
Return Attachment after adding from Sprite.
Misc clean up
This commit is contained in:
parent
18bbcfdc6a
commit
fcf90be386
@ -105,28 +105,24 @@ public static class SkeletonExtensions {
|
||||
bone.Y = position.y;
|
||||
}
|
||||
|
||||
public static void AttachUnitySprite (this Skeleton skeleton, string slotName, Sprite sprite, string shaderName = "Spine/Skeleton") {
|
||||
var loader = new SpriteAttachmentLoader(sprite, Shader.Find(shaderName));
|
||||
|
||||
var att = loader.NewRegionAttachment(null, sprite.name, "");
|
||||
public static Attachment AttachUnitySprite (this Skeleton skeleton, string slotName, Sprite sprite, string shaderName = "Spine/Skeleton") {
|
||||
var att = sprite.ToRegionAttachment(shaderName);
|
||||
skeleton.FindSlot(slotName).Attachment = att;
|
||||
|
||||
loader = null;
|
||||
return att;
|
||||
}
|
||||
|
||||
public static void AddUnitySprite (this SkeletonData skeletonData, string slotName, Sprite sprite, string skinName = "", string shaderName = "Spine/Skeleton") {
|
||||
var loader = new SpriteAttachmentLoader(sprite, Shader.Find(shaderName));
|
||||
var att = loader.NewRegionAttachment(null, sprite.name, "");
|
||||
public static Attachment AddUnitySprite (this SkeletonData skeletonData, string slotName, Sprite sprite, string skinName = "", string shaderName = "Spine/Skeleton") {
|
||||
var att = sprite.ToRegionAttachment(shaderName);
|
||||
|
||||
var slotIndex = skeletonData.FindSlotIndex(slotName);
|
||||
Skin skin = skeletonData.defaultSkin;
|
||||
if (skinName != "")
|
||||
skin = skeletonData.FindSkin(skinName);
|
||||
|
||||
|
||||
skin.AddAttachment(slotIndex, att.Name, att);
|
||||
|
||||
loader = null;
|
||||
return att;
|
||||
}
|
||||
|
||||
public static RegionAttachment ToRegionAttachment (this Sprite sprite, string shaderName = "Spine/Skeleton") {
|
||||
@ -135,5 +131,4 @@ public static class SkeletonExtensions {
|
||||
loader = null;
|
||||
return att;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user