mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-07 03:06:55 +08:00
Added SkeletonUtility button to SkeletonAnimatorInspector
This commit is contained in:
parent
9c7b95ff30
commit
678296a3d7
@ -40,10 +40,13 @@ using Spine;
|
|||||||
[CustomEditor(typeof(SkeletonAnimator))]
|
[CustomEditor(typeof(SkeletonAnimator))]
|
||||||
public class SkeletonAnimatorInspector : SkeletonRendererInspector {
|
public class SkeletonAnimatorInspector : SkeletonRendererInspector {
|
||||||
protected SerializedProperty layerMixModes;
|
protected SerializedProperty layerMixModes;
|
||||||
|
protected bool isPrefab;
|
||||||
protected override void OnEnable () {
|
protected override void OnEnable () {
|
||||||
base.OnEnable();
|
base.OnEnable();
|
||||||
layerMixModes = serializedObject.FindProperty("layerMixModes");
|
layerMixModes = serializedObject.FindProperty("layerMixModes");
|
||||||
|
|
||||||
|
if (PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab)
|
||||||
|
isPrefab = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void gui () {
|
protected override void gui () {
|
||||||
@ -51,6 +54,18 @@ public class SkeletonAnimatorInspector : SkeletonRendererInspector {
|
|||||||
|
|
||||||
EditorGUILayout.PropertyField(layerMixModes, true);
|
EditorGUILayout.PropertyField(layerMixModes, true);
|
||||||
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
SkeletonAnimator component = (SkeletonAnimator)target;
|
||||||
|
if (!component.valid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
|
if (!isPrefab) {
|
||||||
|
if (component.GetComponent<SkeletonUtility>() == null) {
|
||||||
|
if (GUILayout.Button(new GUIContent("Add Skeleton Utility", SpineEditorUtilities.Icons.skeletonUtility), GUILayout.Height(30))) {
|
||||||
|
component.gameObject.AddComponent<SkeletonUtility>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user