Kaynağa Gözat

Compute scale using sprite collection's target ortho size. Removed scale from skeletondata asset.

NathanSweet 12 yıl önce
ebeveyn
işleme
b096766fe5

+ 3 - 5
spine-tk2d/Code/tk2dSpineSkeletonDataAsset.cs

@@ -8,9 +8,7 @@ public class tk2dSpineSkeletonDataAsset : ScriptableObject {
 	public tk2dSpriteCollection.NormalGenerationMode normalGenerationMode = tk2dSpriteCollection.NormalGenerationMode.None;
 
 	public TextAsset skeletonJSON;
-	
-	public float scale = 1;
-	
+
 	public string[] fromAnimation;
 	public string[] toAnimation;
 	public float[] duration;
@@ -44,8 +42,8 @@ public class tk2dSpineSkeletonDataAsset : ScriptableObject {
 		}
 		
 		SkeletonJson json = new SkeletonJson(new tk2dSpineAttachmentLoader(spritesData));
-		json.Scale = scale;
-		
+		json.Scale = 1.0f / (spritesData.invOrthoSize * spritesData.halfTargetHeight);
+
 		try {
 			skeletonData = json.ReadSkeletonData(new StringReader(skeletonJSON.text));
 		} catch (Exception ex) {

+ 0 - 3
spine-tk2d/Editor/tk2dSpineSkeletonDataAssetInspector.cs

@@ -11,7 +11,6 @@ public class tk2dSpineSkeletonDataAssetInspector : Editor {
 	/*
 	 */
 	private SerializedProperty skeletonJSON;
-	private SerializedProperty scale;
 	private SerializedProperty fromAnimation;
 	private SerializedProperty toAnimation;
 	private SerializedProperty duration;
@@ -34,7 +33,6 @@ public class tk2dSpineSkeletonDataAssetInspector : Editor {
 		}
 		
 		skeletonJSON = serializedObject.FindProperty("skeletonJSON");
-		scale = serializedObject.FindProperty("scale");
 		fromAnimation = serializedObject.FindProperty("fromAnimation");
 		toAnimation = serializedObject.FindProperty("toAnimation");
 		duration = serializedObject.FindProperty("duration");
@@ -65,7 +63,6 @@ public class tk2dSpineSkeletonDataAssetInspector : Editor {
 		}
 		
 		EditorGUILayout.PropertyField(skeletonJSON);
-		EditorGUILayout.PropertyField(scale);
 		
 		SkeletonData skeletonData = asset.GetSkeletonData();
 		if(skeletonData != null) {

BIN
spine-tk2d/Example/Example.unity


BIN
spine-tk2d/Example/Spineboy/Atlas/SpineboyAtlas Data/SpineboyAtlas.prefab


BIN
spine-tk2d/Example/Spineboy/Atlas/SpineboyAtlas.prefab


BIN
spine-tk2d/Example/Spineboy/Skeleton/SpineboySkeletonAsset.asset