mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-27 12:11:22 +08:00
Merge branch '3.7-beta' of https://github.com/esotericsoftware/spine-runtimes into 3.7-beta
This commit is contained in:
commit
ae58c8232f
@ -47,16 +47,16 @@ namespace Spine {
|
|||||||
public float DefaultMix { get { return defaultMix; } set { defaultMix = value; } }
|
public float DefaultMix { get { return defaultMix; } set { defaultMix = value; } }
|
||||||
|
|
||||||
public AnimationStateData (SkeletonData skeletonData) {
|
public AnimationStateData (SkeletonData skeletonData) {
|
||||||
if (skeletonData == null) throw new ArgumentException ("skeletonData cannot be null.");
|
if (skeletonData == null) throw new ArgumentException("skeletonData cannot be null.", "skeletonData");
|
||||||
this.skeletonData = skeletonData;
|
this.skeletonData = skeletonData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Sets a mix duration by animation names.</summary>
|
/// <summary>Sets a mix duration by animation names.</summary>
|
||||||
public void SetMix (string fromName, string toName, float duration) {
|
public void SetMix (string fromName, string toName, float duration) {
|
||||||
Animation from = skeletonData.FindAnimation(fromName);
|
Animation from = skeletonData.FindAnimation(fromName);
|
||||||
if (from == null) throw new ArgumentException("Animation not found: " + fromName);
|
if (from == null) throw new ArgumentException("Animation not found: " + fromName, "fromName");
|
||||||
Animation to = skeletonData.FindAnimation(toName);
|
Animation to = skeletonData.FindAnimation(toName);
|
||||||
if (to == null) throw new ArgumentException("Animation not found: " + toName);
|
if (to == null) throw new ArgumentException("Animation not found: " + toName, "toName");
|
||||||
SetMix(from, to, duration);
|
SetMix(from, to, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ namespace Spine {
|
|||||||
return defaultMix;
|
return defaultMix;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AnimationPair {
|
public struct AnimationPair {
|
||||||
public readonly Animation a1;
|
public readonly Animation a1;
|
||||||
public readonly Animation a2;
|
public readonly Animation a2;
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Avoids boxing in the dictionary.
|
// Avoids boxing in the dictionary.
|
||||||
class AnimationPairComparer : IEqualityComparer<AnimationPair> {
|
public class AnimationPairComparer : IEqualityComparer<AnimationPair> {
|
||||||
internal static readonly AnimationPairComparer Instance = new AnimationPairComparer();
|
public static readonly AnimationPairComparer Instance = new AnimationPairComparer();
|
||||||
|
|
||||||
bool IEqualityComparer<AnimationPair>.Equals (AnimationPair x, AnimationPair y) {
|
bool IEqualityComparer<AnimationPair>.Equals (AnimationPair x, AnimationPair y) {
|
||||||
return ReferenceEquals(x.a1, y.a1) && ReferenceEquals(x.a2, y.a2);
|
return ReferenceEquals(x.a1, y.a1) && ReferenceEquals(x.a2, y.a2);
|
||||||
|
|||||||
@ -173,16 +173,12 @@ namespace Spine {
|
|||||||
d = ld;
|
d = ld;
|
||||||
worldX = x + skeleton.x;
|
worldX = x + skeleton.x;
|
||||||
worldY = y + skeleton.y;
|
worldY = y + skeleton.y;
|
||||||
// worldSignX = Math.Sign(scaleX);
|
|
||||||
// worldSignY = Math.Sign(scaleY);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
float pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
||||||
worldX = pa * x + pb * y + parent.worldX;
|
worldX = pa * x + pb * y + parent.worldX;
|
||||||
worldY = pc * x + pd * y + parent.worldY;
|
worldY = pc * x + pd * y + parent.worldY;
|
||||||
// worldSignX = parent.worldSignX * Math.Sign(scaleX);
|
|
||||||
// worldSignY = parent.worldSignY * Math.Sign(scaleY);
|
|
||||||
|
|
||||||
switch (data.transformMode) {
|
switch (data.transformMode) {
|
||||||
case TransformMode.Normal: {
|
case TransformMode.Normal: {
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace Spine.Unity.Examples {
|
|||||||
|
|
||||||
hipBone = skeleton.FindBone(hip);
|
hipBone = skeleton.FindBone(hip);
|
||||||
headBone = skeleton.FindBone(head);
|
headBone = skeleton.FindBone(head);
|
||||||
baseHeadRotation = headBone.rotation;
|
baseHeadRotation = headBone.Rotation;
|
||||||
|
|
||||||
skeletonAnimation.UpdateLocal += UpdateLocal;
|
skeletonAnimation.UpdateLocal += UpdateLocal;
|
||||||
}
|
}
|
||||||
@ -35,8 +35,8 @@ namespace Spine.Unity.Examples {
|
|||||||
private void UpdateLocal (ISkeletonAnimation animated) {
|
private void UpdateLocal (ISkeletonAnimation animated) {
|
||||||
hipRotationTarget = planter.Balance * hipTiltScale;
|
hipRotationTarget = planter.Balance * hipTiltScale;
|
||||||
hipRotationSmoothed = Mathf.MoveTowards(hipRotationSmoothed, hipRotationTarget, Time.deltaTime * hipRotationMoveScale * Mathf.Abs(2f * planter.Balance / planter.offBalanceThreshold));
|
hipRotationSmoothed = Mathf.MoveTowards(hipRotationSmoothed, hipRotationTarget, Time.deltaTime * hipRotationMoveScale * Mathf.Abs(2f * planter.Balance / planter.offBalanceThreshold));
|
||||||
hipBone.rotation = hipRotationSmoothed;
|
hipBone.Rotation = hipRotationSmoothed;
|
||||||
headBone.rotation = baseHeadRotation + (-hipRotationSmoothed * headTiltScale);
|
headBone.Rotation = baseHeadRotation + (-hipRotationSmoothed * headTiltScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,11 +48,11 @@ namespace Spine.Unity.Examples {
|
|||||||
shockTimer -= Time.deltaTime;
|
shockTimer -= Time.deltaTime;
|
||||||
|
|
||||||
if (shockTimer > 0) {
|
if (shockTimer > 0) {
|
||||||
eyeSlot.attachment = shockEye;
|
eyeSlot.Attachment = shockEye;
|
||||||
mouthSlot.attachment = shockMouth;
|
mouthSlot.Attachment = shockMouth;
|
||||||
} else {
|
} else {
|
||||||
eyeSlot.attachment = normalEye;
|
eyeSlot.Attachment = normalEye;
|
||||||
mouthSlot.attachment = normalMouth;
|
mouthSlot.Attachment = normalMouth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
spine-unity/Assets/spine-unity/Editor/GUI/icon-point.png
Normal file
BIN
spine-unity/Assets/spine-unity/Editor/GUI/icon-point.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 687 B |
@ -0,0 +1,92 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d7a76922e4dd9fa429da15c018ff127f
|
||||||
|
timeCreated: 1524196821
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapMode: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 1024
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 1024
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: Android
|
||||||
|
maxTextureSize: 1024
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: WebGL
|
||||||
|
maxTextureSize: 1024
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -238,6 +238,12 @@ namespace Spine.Unity.Editor {
|
|||||||
AssetDatabase.CreateAsset(newAsset, assetPath);
|
AssetDatabase.CreateAsset(newAsset, assetPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var folderObject = AssetDatabase.LoadAssetAtPath(dataPath, typeof(UnityEngine.Object));
|
||||||
|
if (folderObject != null) {
|
||||||
|
Selection.activeObject = folderObject;
|
||||||
|
EditorGUIUtility.PingObject(folderObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnInspectorGUIMulti () {
|
void OnInspectorGUIMulti () {
|
||||||
|
|||||||
@ -75,6 +75,7 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SerializedProperty dataField = property.FindBaseOrSiblingProperty(TargetAttribute.dataField);
|
SerializedProperty dataField = property.FindBaseOrSiblingProperty(TargetAttribute.dataField);
|
||||||
|
|
||||||
if (dataField != null) {
|
if (dataField != null) {
|
||||||
var objectReferenceValue = dataField.objectReferenceValue;
|
var objectReferenceValue = dataField.objectReferenceValue;
|
||||||
if (objectReferenceValue is SkeletonDataAsset) {
|
if (objectReferenceValue is SkeletonDataAsset) {
|
||||||
|
|||||||
@ -61,6 +61,7 @@ namespace Spine.Unity.Editor {
|
|||||||
public static Texture2D image;
|
public static Texture2D image;
|
||||||
public static Texture2D genericAttachment;
|
public static Texture2D genericAttachment;
|
||||||
public static Texture2D boundingBox;
|
public static Texture2D boundingBox;
|
||||||
|
public static Texture2D point;
|
||||||
public static Texture2D mesh;
|
public static Texture2D mesh;
|
||||||
public static Texture2D weights;
|
public static Texture2D weights;
|
||||||
public static Texture2D path;
|
public static Texture2D path;
|
||||||
@ -102,6 +103,7 @@ namespace Spine.Unity.Editor {
|
|||||||
genericAttachment = LoadIcon("icon-attachment.png");
|
genericAttachment = LoadIcon("icon-attachment.png");
|
||||||
image = LoadIcon("icon-image.png");
|
image = LoadIcon("icon-image.png");
|
||||||
boundingBox = LoadIcon("icon-boundingBox.png");
|
boundingBox = LoadIcon("icon-boundingBox.png");
|
||||||
|
point = LoadIcon("icon-point.png");
|
||||||
mesh = LoadIcon("icon-mesh.png");
|
mesh = LoadIcon("icon-mesh.png");
|
||||||
weights = LoadIcon("icon-weights.png");
|
weights = LoadIcon("icon-weights.png");
|
||||||
path = LoadIcon("icon-path.png");
|
path = LoadIcon("icon-path.png");
|
||||||
@ -140,6 +142,8 @@ namespace Spine.Unity.Editor {
|
|||||||
return ((MeshAttachment)attachment).IsWeighted() ? Icons.weights : Icons.mesh;
|
return ((MeshAttachment)attachment).IsWeighted() ? Icons.weights : Icons.mesh;
|
||||||
else if (attachment is BoundingBoxAttachment)
|
else if (attachment is BoundingBoxAttachment)
|
||||||
return Icons.boundingBox;
|
return Icons.boundingBox;
|
||||||
|
else if (attachment is PointAttachment)
|
||||||
|
return Icons.point;
|
||||||
else if (attachment is PathAttachment)
|
else if (attachment is PathAttachment)
|
||||||
return Icons.path;
|
return Icons.path;
|
||||||
else if (attachment is ClippingAttachment)
|
else if (attachment is ClippingAttachment)
|
||||||
@ -284,7 +288,6 @@ namespace Spine.Unity.Editor {
|
|||||||
defaultShader = shader != null ? shader.name : DEFAULT_DEFAULT_SHADER;
|
defaultShader = shader != null ? shader.name : DEFAULT_DEFAULT_SHADER;
|
||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader);
|
EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader);
|
||||||
EditorGUILayout.Space();
|
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
setTextureImporterSettings = EditorGUILayout.Toggle(new GUIContent("Apply Atlas Texture Settings", "Apply the recommended settings for Texture Importers."), showHierarchyIcons);
|
setTextureImporterSettings = EditorGUILayout.Toggle(new GUIContent("Apply Atlas Texture Settings", "Apply the recommended settings for Texture Importers."), showHierarchyIcons);
|
||||||
@ -292,6 +295,8 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorPrefs.SetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, showHierarchyIcons);
|
EditorPrefs.SetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, showHierarchyIcons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
EditorGUILayout.LabelField("Editor Instantiation", EditorStyles.boldLabel);
|
EditorGUILayout.LabelField("Editor Instantiation", EditorStyles.boldLabel);
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
defaultZSpacing = EditorGUILayout.Slider("Default Slot Z-Spacing", defaultZSpacing, -0.1f, 0f);
|
defaultZSpacing = EditorGUILayout.Slider("Default Slot Z-Spacing", defaultZSpacing, -0.1f, 0f);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user