mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Added skinField param to [SpineAttachment] attribute.
This commit is contained in:
parent
3fe876adcd
commit
d1a2b3125f
@ -254,8 +254,15 @@ namespace Spine.Unity.Editor {
|
|||||||
ISkeletonComponent skeletonComponent = GetTargetSkeletonComponent(property);
|
ISkeletonComponent skeletonComponent = GetTargetSkeletonComponent(property);
|
||||||
var validSkins = new List<Skin>();
|
var validSkins = new List<Skin>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (skeletonComponent != null && targetAttribute.currentSkinOnly) {
|
if (skeletonComponent != null && targetAttribute.currentSkinOnly) {
|
||||||
var currentSkin = skeletonComponent.Skeleton.Skin;
|
Skin currentSkin = null;
|
||||||
|
|
||||||
|
var skinProperty = property.FindPropertyRelative(targetAttribute.skinField);
|
||||||
|
if (skinProperty != null) currentSkin = skeletonComponent.Skeleton.Data.FindSkin(skinProperty.stringValue);
|
||||||
|
|
||||||
|
currentSkin = currentSkin ?? skeletonComponent.Skeleton.Skin;
|
||||||
if (currentSkin != null)
|
if (currentSkin != null)
|
||||||
validSkins.Add(currentSkin);
|
validSkins.Add(currentSkin);
|
||||||
else
|
else
|
||||||
|
|||||||
@ -114,6 +114,7 @@ namespace Spine.Unity {
|
|||||||
public bool returnAttachmentPath = false;
|
public bool returnAttachmentPath = false;
|
||||||
public bool currentSkinOnly = false;
|
public bool currentSkinOnly = false;
|
||||||
public bool placeholdersOnly = false;
|
public bool placeholdersOnly = false;
|
||||||
|
public string skinField = "";
|
||||||
public string slotField = "";
|
public string slotField = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -127,12 +128,13 @@ namespace Spine.Unity {
|
|||||||
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
|
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
|
||||||
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
|
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
|
||||||
/// </param>
|
/// </param>
|
||||||
public SpineAttachment (bool currentSkinOnly = true, bool returnAttachmentPath = false, bool placeholdersOnly = false, string slotField = "", string dataField = "", bool includeNone = true) {
|
public SpineAttachment (bool currentSkinOnly = true, bool returnAttachmentPath = false, bool placeholdersOnly = false, string slotField = "", string dataField = "", string skinField = "", bool includeNone = true) {
|
||||||
this.currentSkinOnly = currentSkinOnly;
|
this.currentSkinOnly = currentSkinOnly;
|
||||||
this.returnAttachmentPath = returnAttachmentPath;
|
this.returnAttachmentPath = returnAttachmentPath;
|
||||||
this.placeholdersOnly = placeholdersOnly;
|
this.placeholdersOnly = placeholdersOnly;
|
||||||
this.slotField = slotField;
|
this.slotField = slotField;
|
||||||
this.dataField = dataField;
|
this.dataField = dataField;
|
||||||
|
this.skinField = skinField;
|
||||||
this.includeNone = includeNone;
|
this.includeNone = includeNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user