mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-11 17:48:45 +08:00
[unity] Some editor fixes.
This commit is contained in:
parent
5d78359b7c
commit
2cb188e568
@ -41,7 +41,7 @@ namespace Spine.Unity.Editor {
|
||||
[CustomEditor(typeof(SkeletonRenderer))]
|
||||
[CanEditMultipleObjects]
|
||||
public class SkeletonRendererInspector : UnityEditor.Editor {
|
||||
protected static bool advancedFoldout;
|
||||
public static bool advancedFoldout;
|
||||
|
||||
protected SerializedProperty skeletonDataAsset, initialSkinName;
|
||||
protected SerializedProperty initialFlipX, initialFlipY;
|
||||
@ -278,7 +278,7 @@ namespace Spine.Unity.Editor {
|
||||
using (new SpineInspectorUtility.LabelWidthScope()) {
|
||||
// Optimization options
|
||||
if (singleSubmesh != null) EditorGUILayout.PropertyField(singleSubmesh, SingleSubmeshLabel);
|
||||
if (meshes != null) EditorGUILayout.PropertyField(meshes, MeshesLabel);
|
||||
//if (meshes != null) EditorGUILayout.PropertyField(meshes, MeshesLabel);
|
||||
if (immutableTriangles != null) EditorGUILayout.PropertyField(immutableTriangles, ImmubleTrianglesLabel);
|
||||
EditorGUILayout.PropertyField(clearStateOnDisable, ClearStateOnDisableLabel);
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@ -68,6 +68,7 @@ namespace Spine.Unity.Editor {
|
||||
freeze_ = so.FindProperty("freeze");
|
||||
|
||||
meshGeneratorSettings_ = so.FindProperty("meshGenerator").FindPropertyRelative("settings");
|
||||
meshGeneratorSettings_.isExpanded = SkeletonRendererInspector.advancedFoldout;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI () {
|
||||
@ -85,6 +86,7 @@ namespace Spine.Unity.Editor {
|
||||
}
|
||||
using (new SpineInspectorUtility.BoxScope()) {
|
||||
EditorGUILayout.PropertyField(meshGeneratorSettings_, SpineInspectorUtility.TempContent("Advanced..."), includeChildren: true);
|
||||
SkeletonRendererInspector.advancedFoldout = meshGeneratorSettings_.isExpanded;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@ -50,7 +50,6 @@ namespace Spine.Unity {
|
||||
public float timeScale = 1f;
|
||||
public bool freeze;
|
||||
public bool unscaledTime;
|
||||
//public bool tintBlack = false;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnValidate () {
|
||||
@ -204,8 +203,24 @@ namespace Spine.Unity {
|
||||
if (!string.IsNullOrEmpty(initialSkinName))
|
||||
skeleton.SetSkin(initialSkinName);
|
||||
|
||||
if (!string.IsNullOrEmpty(startingAnimation))
|
||||
#if UNITY_EDITOR
|
||||
if (!string.IsNullOrEmpty(startingAnimation)) {
|
||||
if (Application.isPlaying) {
|
||||
state.SetAnimation(0, startingAnimation, startingLoop);
|
||||
} else {
|
||||
// Assume SkeletonAnimation is valid for skeletonData and skeleton. Checked above.
|
||||
var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(startingAnimation);
|
||||
if (animationObject != null)
|
||||
animationObject.Apply(skeleton, 0f, 0f, false, null, 1f, true, false);
|
||||
}
|
||||
Update(0);
|
||||
}
|
||||
#else
|
||||
if (!string.IsNullOrEmpty(startingAnimation)) {
|
||||
state.SetAnimation(0, startingAnimation, startingLoop);
|
||||
Update(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void UpdateMesh () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user