mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-27 04:01:24 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
709e2dafcb
@ -48,32 +48,27 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
SpineEditorUtilities.ConfirmInitialization();
|
SpineEditorUtilities.ConfirmInitialization();
|
||||||
|
|
||||||
try {
|
atlasAssets = serializedObject.FindProperty("atlasAssets");
|
||||||
atlasAssets = serializedObject.FindProperty("atlasAssets");
|
atlasAssets.isExpanded = true;
|
||||||
atlasAssets.isExpanded = true;
|
skeletonJSON = serializedObject.FindProperty("skeletonJSON");
|
||||||
skeletonJSON = serializedObject.FindProperty("skeletonJSON");
|
scale = serializedObject.FindProperty("scale");
|
||||||
scale = serializedObject.FindProperty("scale");
|
fromAnimation = serializedObject.FindProperty("fromAnimation");
|
||||||
fromAnimation = serializedObject.FindProperty("fromAnimation");
|
toAnimation = serializedObject.FindProperty("toAnimation");
|
||||||
toAnimation = serializedObject.FindProperty("toAnimation");
|
duration = serializedObject.FindProperty("duration");
|
||||||
duration = serializedObject.FindProperty("duration");
|
defaultMix = serializedObject.FindProperty("defaultMix");
|
||||||
defaultMix = serializedObject.FindProperty("defaultMix");
|
#if SPINE_SKELETON_ANIMATOR
|
||||||
#if SPINE_SKELETON_ANIMATOR
|
controller = serializedObject.FindProperty("controller");
|
||||||
controller = serializedObject.FindProperty("controller");
|
#endif
|
||||||
#endif
|
#if SPINE_TK2D
|
||||||
#if SPINE_TK2D
|
spriteCollection = serializedObject.FindProperty("spriteCollection");
|
||||||
spriteCollection = serializedObject.FindProperty("spriteCollection");
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
m_skeletonDataAsset = (SkeletonDataAsset)target;
|
m_skeletonDataAsset = (SkeletonDataAsset)target;
|
||||||
m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
|
m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
|
||||||
|
|
||||||
EditorApplication.update += Update;
|
EditorApplication.update += Update;
|
||||||
} catch {
|
|
||||||
// TODO: WARNING: empty catch block supresses errors.
|
|
||||||
|
|
||||||
}
|
m_skeletonData = m_skeletonDataAsset.GetSkeletonData(false);
|
||||||
|
|
||||||
m_skeletonData = m_skeletonDataAsset.GetSkeletonData(true);
|
|
||||||
|
|
||||||
showBaking = EditorPrefs.GetBool("SkeletonDataAssetInspector_showUnity", false);
|
showBaking = EditorPrefs.GetBool("SkeletonDataAssetInspector_showUnity", false);
|
||||||
|
|
||||||
@ -145,18 +140,18 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
EditorGUILayout.PropertyField(controller, new GUIContent("Controller", SpineEditorUtilities.Icons.controllerIcon));
|
EditorGUILayout.PropertyField(controller, new GUIContent("Controller", SpineEditorUtilities.Icons.controllerIcon));
|
||||||
if (controller.objectReferenceValue == null) {
|
if (controller.objectReferenceValue == null) {
|
||||||
GUILayout.BeginHorizontal();
|
using (new GUILayout.HorizontalScope()) {
|
||||||
GUILayout.Space(32);
|
GUILayout.Space(32);
|
||||||
if (GUILayout.Button(new GUIContent("Generate Mecanim Controller"), GUILayout.Width(195), GUILayout.Height(20)))
|
if (GUILayout.Button(new GUIContent("Generate Mecanim Controller"), GUILayout.Width(195), GUILayout.Height(20)))
|
||||||
SkeletonBaker.GenerateMecanimAnimationClips(m_skeletonDataAsset);
|
SkeletonBaker.GenerateMecanimAnimationClips(m_skeletonDataAsset);
|
||||||
GUILayout.EndHorizontal();
|
}
|
||||||
EditorGUILayout.LabelField("SkeletonAnimator is the Mecanim alternative to SkeletonAnimation. It is not required.", EditorStyles.miniLabel);
|
EditorGUILayout.LabelField("SkeletonAnimator is the Mecanim alternative to SkeletonAnimation. It is not required.", EditorStyles.miniLabel);
|
||||||
} else {
|
} else {
|
||||||
GUILayout.BeginHorizontal();
|
using (new GUILayout.HorizontalScope()) {
|
||||||
GUILayout.Space(32);
|
GUILayout.Space(32);
|
||||||
if (GUILayout.Button(new GUIContent("Update Controller Animations"), GUILayout.Width(195), GUILayout.Height(20)))
|
if (GUILayout.Button(new GUIContent("Update Controller Animations"), GUILayout.Width(195), GUILayout.Height(20)))
|
||||||
SkeletonBaker.GenerateMecanimAnimationClips(m_skeletonDataAsset);
|
SkeletonBaker.GenerateMecanimAnimationClips(m_skeletonDataAsset);
|
||||||
GUILayout.EndHorizontal();
|
}
|
||||||
}
|
}
|
||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
}
|
}
|
||||||
@ -197,7 +192,7 @@ namespace Spine.Unity.Editor {
|
|||||||
} else
|
} else
|
||||||
skinName = m_skeletonAnimation.skeleton.Skin.Name;
|
skinName = m_skeletonAnimation.skeleton.Skin.Name;
|
||||||
|
|
||||||
using (var m = new EditorGUILayout.VerticalScope()) {
|
using (new EditorGUILayout.VerticalScope()) {
|
||||||
if (GUILayout.Button(new GUIContent("Bake " + skinName, SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(250)))
|
if (GUILayout.Button(new GUIContent("Bake " + skinName, SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(250)))
|
||||||
SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, new ExposedList<Skin>(new [] { bakeSkin }), "", bakeAnimations, bakeIK, bakeEventOptions);
|
SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, new ExposedList<Skin>(new [] { bakeSkin }), "", bakeAnimations, bakeIK, bakeEventOptions);
|
||||||
using (new EditorGUILayout.HorizontalScope()) {
|
using (new EditorGUILayout.HorizontalScope()) {
|
||||||
@ -258,26 +253,26 @@ namespace Spine.Unity.Editor {
|
|||||||
SerializedProperty from = fromAnimation.GetArrayElementAtIndex(i);
|
SerializedProperty from = fromAnimation.GetArrayElementAtIndex(i);
|
||||||
SerializedProperty to = toAnimation.GetArrayElementAtIndex(i);
|
SerializedProperty to = toAnimation.GetArrayElementAtIndex(i);
|
||||||
SerializedProperty durationProp = duration.GetArrayElementAtIndex(i);
|
SerializedProperty durationProp = duration.GetArrayElementAtIndex(i);
|
||||||
EditorGUILayout.BeginHorizontal();
|
using (new EditorGUILayout.HorizontalScope()) {
|
||||||
from.stringValue = animations[EditorGUILayout.Popup(Math.Max(Array.IndexOf(animations, from.stringValue), 0), animations)];
|
from.stringValue = animations[EditorGUILayout.Popup(Math.Max(Array.IndexOf(animations, from.stringValue), 0), animations)];
|
||||||
to.stringValue = animations[EditorGUILayout.Popup(Math.Max(Array.IndexOf(animations, to.stringValue), 0), animations)];
|
to.stringValue = animations[EditorGUILayout.Popup(Math.Max(Array.IndexOf(animations, to.stringValue), 0), animations)];
|
||||||
durationProp.floatValue = EditorGUILayout.FloatField(durationProp.floatValue);
|
durationProp.floatValue = EditorGUILayout.FloatField(durationProp.floatValue);
|
||||||
if (GUILayout.Button("Delete")) {
|
if (GUILayout.Button("Delete")) {
|
||||||
duration.DeleteArrayElementAtIndex(i);
|
duration.DeleteArrayElementAtIndex(i);
|
||||||
toAnimation.DeleteArrayElementAtIndex(i);
|
toAnimation.DeleteArrayElementAtIndex(i);
|
||||||
fromAnimation.DeleteArrayElementAtIndex(i);
|
fromAnimation.DeleteArrayElementAtIndex(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
}
|
}
|
||||||
EditorGUILayout.BeginHorizontal();
|
using (new EditorGUILayout.HorizontalScope()) {
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
if (GUILayout.Button("Add Mix")) {
|
if (GUILayout.Button("Add Mix")) {
|
||||||
duration.arraySize++;
|
duration.arraySize++;
|
||||||
toAnimation.arraySize++;
|
toAnimation.arraySize++;
|
||||||
fromAnimation.arraySize++;
|
fromAnimation.arraySize++;
|
||||||
|
}
|
||||||
|
EditorGUILayout.Space();
|
||||||
}
|
}
|
||||||
EditorGUILayout.Space();
|
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
|
|
||||||
if (EditorGUI.EndChangeCheck()) {
|
if (EditorGUI.EndChangeCheck()) {
|
||||||
m_skeletonDataAsset.FillStateData();
|
m_skeletonDataAsset.FillStateData();
|
||||||
@ -304,25 +299,24 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
EditorGUILayout.LabelField("Name", "Duration");
|
EditorGUILayout.LabelField("Name", "Duration");
|
||||||
foreach (Spine.Animation a in m_skeletonData.Animations) {
|
foreach (Spine.Animation a in m_skeletonData.Animations) {
|
||||||
GUILayout.BeginHorizontal();
|
using (new GUILayout.HorizontalScope()) {
|
||||||
|
if (m_skeletonAnimation != null && m_skeletonAnimation.state != null) {
|
||||||
if (m_skeletonAnimation != null && m_skeletonAnimation.state != null) {
|
if (m_skeletonAnimation.state.GetCurrent(0) != null && m_skeletonAnimation.state.GetCurrent(0).Animation == a) {
|
||||||
if (m_skeletonAnimation.state.GetCurrent(0) != null && m_skeletonAnimation.state.GetCurrent(0).Animation == a) {
|
GUI.contentColor = Color.red;
|
||||||
GUI.contentColor = Color.red;
|
if (GUILayout.Button("\u25BA", EditorStyles.toolbarButton, GUILayout.Width(24))) {
|
||||||
if (GUILayout.Button("\u25BA", EditorStyles.toolbarButton, GUILayout.Width(24))) {
|
StopAnimation();
|
||||||
StopAnimation();
|
}
|
||||||
|
GUI.contentColor = Color.white;
|
||||||
|
} else {
|
||||||
|
if (GUILayout.Button("\u25BA", EditorStyles.toolbarButton, GUILayout.Width(24))) {
|
||||||
|
PlayAnimation(a.Name, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GUI.contentColor = Color.white;
|
|
||||||
} else {
|
} else {
|
||||||
if (GUILayout.Button("\u25BA", EditorStyles.toolbarButton, GUILayout.Width(24))) {
|
GUILayout.Label("?", GUILayout.Width(24));
|
||||||
PlayAnimation(a.Name, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
EditorGUILayout.LabelField(new GUIContent(a.Name, SpineEditorUtilities.Icons.animation), new GUIContent(a.Duration.ToString("f3") + "s" + ("(" + (Mathf.RoundToInt(a.Duration * 30)) + ")").PadLeft(12, ' ')));
|
||||||
GUILayout.Label("?", GUILayout.Width(24));
|
|
||||||
}
|
}
|
||||||
EditorGUILayout.LabelField(new GUIContent(a.Name, SpineEditorUtilities.Icons.animation), new GUIContent(a.Duration.ToString("f3") + "s" + ("(" + (Mathf.RoundToInt(a.Duration * 30)) + ")").PadLeft(12, ' ')));
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -960,4 +954,4 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user