diff --git a/spine-csharp/src/AnimationStateData.cs b/spine-csharp/src/AnimationStateData.cs index 5282d894c..f3ad87183 100644 --- a/spine-csharp/src/AnimationStateData.cs +++ b/spine-csharp/src/AnimationStateData.cs @@ -47,16 +47,16 @@ namespace Spine { public float DefaultMix { get { return defaultMix; } set { defaultMix = value; } } 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; } /// Sets a mix duration by animation names. public void SetMix (string fromName, string toName, float duration) { 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); - 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); } @@ -83,7 +83,7 @@ namespace Spine { return defaultMix; } - struct AnimationPair { + public struct AnimationPair { public readonly Animation a1; public readonly Animation a2; @@ -98,8 +98,8 @@ namespace Spine { } // Avoids boxing in the dictionary. - class AnimationPairComparer : IEqualityComparer { - internal static readonly AnimationPairComparer Instance = new AnimationPairComparer(); + public class AnimationPairComparer : IEqualityComparer { + public static readonly AnimationPairComparer Instance = new AnimationPairComparer(); bool IEqualityComparer.Equals (AnimationPair x, AnimationPair y) { return ReferenceEquals(x.a1, y.a1) && ReferenceEquals(x.a2, y.a2); diff --git a/spine-csharp/src/Bone.cs b/spine-csharp/src/Bone.cs index 8a68cc203..3357ec3c0 100644 --- a/spine-csharp/src/Bone.cs +++ b/spine-csharp/src/Bone.cs @@ -173,16 +173,12 @@ namespace Spine { d = ld; worldX = x + skeleton.x; worldY = y + skeleton.y; -// worldSignX = Math.Sign(scaleX); -// worldSignY = Math.Sign(scaleY); return; } float pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d; worldX = pa * x + pb * y + parent.worldX; worldY = pc * x + pd * y + parent.worldY; -// worldSignX = parent.worldSignX * Math.Sign(scaleX); -// worldSignY = parent.worldSignY * Math.Sign(scaleY); switch (data.transformMode) { case TransformMode.Normal: { diff --git a/spine-unity/Assets/Spine Examples/Scripts/SpineboyBodyTilt.cs b/spine-unity/Assets/Spine Examples/Scripts/SpineboyBodyTilt.cs index 82c984ea2..878d5dfcb 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/SpineboyBodyTilt.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/SpineboyBodyTilt.cs @@ -27,7 +27,7 @@ namespace Spine.Unity.Examples { hipBone = skeleton.FindBone(hip); headBone = skeleton.FindBone(head); - baseHeadRotation = headBone.rotation; + baseHeadRotation = headBone.Rotation; skeletonAnimation.UpdateLocal += UpdateLocal; } @@ -35,8 +35,8 @@ namespace Spine.Unity.Examples { private void UpdateLocal (ISkeletonAnimation animated) { hipRotationTarget = planter.Balance * hipTiltScale; hipRotationSmoothed = Mathf.MoveTowards(hipRotationSmoothed, hipRotationTarget, Time.deltaTime * hipRotationMoveScale * Mathf.Abs(2f * planter.Balance / planter.offBalanceThreshold)); - hipBone.rotation = hipRotationSmoothed; - headBone.rotation = baseHeadRotation + (-hipRotationSmoothed * headTiltScale); + hipBone.Rotation = hipRotationSmoothed; + headBone.Rotation = baseHeadRotation + (-hipRotationSmoothed * headTiltScale); } } diff --git a/spine-unity/Assets/Spine Examples/Scripts/SpineboyFacialExpression.cs b/spine-unity/Assets/Spine Examples/Scripts/SpineboyFacialExpression.cs index 6a0ed3fd6..48b2b7dc0 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/SpineboyFacialExpression.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/SpineboyFacialExpression.cs @@ -48,11 +48,11 @@ namespace Spine.Unity.Examples { shockTimer -= Time.deltaTime; if (shockTimer > 0) { - eyeSlot.attachment = shockEye; - mouthSlot.attachment = shockMouth; + eyeSlot.Attachment = shockEye; + mouthSlot.Attachment = shockMouth; } else { - eyeSlot.attachment = normalEye; - mouthSlot.attachment = normalMouth; + eyeSlot.Attachment = normalEye; + mouthSlot.Attachment = normalMouth; } } } diff --git a/spine-unity/Assets/spine-unity/Editor/GUI/icon-point.png b/spine-unity/Assets/spine-unity/Editor/GUI/icon-point.png new file mode 100644 index 000000000..0e5099f4d Binary files /dev/null and b/spine-unity/Assets/spine-unity/Editor/GUI/icon-point.png differ diff --git a/spine-unity/Assets/spine-unity/Editor/GUI/icon-point.png.meta b/spine-unity/Assets/spine-unity/Editor/GUI/icon-point.png.meta new file mode 100644 index 000000000..9df5c2a5d --- /dev/null +++ b/spine-unity/Assets/spine-unity/Editor/GUI/icon-point.png.meta @@ -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: diff --git a/spine-unity/Assets/spine-unity/Editor/SkeletonDataAssetInspector.cs b/spine-unity/Assets/spine-unity/Editor/SkeletonDataAssetInspector.cs index 34892081b..4219b27ab 100644 --- a/spine-unity/Assets/spine-unity/Editor/SkeletonDataAssetInspector.cs +++ b/spine-unity/Assets/spine-unity/Editor/SkeletonDataAssetInspector.cs @@ -238,6 +238,12 @@ namespace Spine.Unity.Editor { AssetDatabase.CreateAsset(newAsset, assetPath); } } + + var folderObject = AssetDatabase.LoadAssetAtPath(dataPath, typeof(UnityEngine.Object)); + if (folderObject != null) { + Selection.activeObject = folderObject; + EditorGUIUtility.PingObject(folderObject); + } } void OnInspectorGUIMulti () { diff --git a/spine-unity/Assets/spine-unity/Editor/SpineAttributeDrawers.cs b/spine-unity/Assets/spine-unity/Editor/SpineAttributeDrawers.cs index 846113088..3eafcd243 100644 --- a/spine-unity/Assets/spine-unity/Editor/SpineAttributeDrawers.cs +++ b/spine-unity/Assets/spine-unity/Editor/SpineAttributeDrawers.cs @@ -75,6 +75,7 @@ namespace Spine.Unity.Editor { } SerializedProperty dataField = property.FindBaseOrSiblingProperty(TargetAttribute.dataField); + if (dataField != null) { var objectReferenceValue = dataField.objectReferenceValue; if (objectReferenceValue is SkeletonDataAsset) { diff --git a/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs b/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs index 98c284945..351c0d07a 100644 --- a/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs +++ b/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs @@ -61,6 +61,7 @@ namespace Spine.Unity.Editor { public static Texture2D image; public static Texture2D genericAttachment; public static Texture2D boundingBox; + public static Texture2D point; public static Texture2D mesh; public static Texture2D weights; public static Texture2D path; @@ -102,6 +103,7 @@ namespace Spine.Unity.Editor { genericAttachment = LoadIcon("icon-attachment.png"); image = LoadIcon("icon-image.png"); boundingBox = LoadIcon("icon-boundingBox.png"); + point = LoadIcon("icon-point.png"); mesh = LoadIcon("icon-mesh.png"); weights = LoadIcon("icon-weights.png"); path = LoadIcon("icon-path.png"); @@ -140,6 +142,8 @@ namespace Spine.Unity.Editor { return ((MeshAttachment)attachment).IsWeighted() ? Icons.weights : Icons.mesh; else if (attachment is BoundingBoxAttachment) return Icons.boundingBox; + else if (attachment is PointAttachment) + return Icons.point; else if (attachment is PathAttachment) return Icons.path; else if (attachment is ClippingAttachment) @@ -284,7 +288,6 @@ namespace Spine.Unity.Editor { defaultShader = shader != null ? shader.name : DEFAULT_DEFAULT_SHADER; if (EditorGUI.EndChangeCheck()) EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader); - EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); 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); } + EditorGUILayout.Space(); + EditorGUILayout.LabelField("Editor Instantiation", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); defaultZSpacing = EditorGUILayout.Slider("Default Slot Z-Spacing", defaultZSpacing, -0.1f, 0f);