mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 18:26:12 +08:00
Fix for unexpected huge skeleton render scale when using SPINE_TK2D
This commit is contained in:
parent
69e724a1da
commit
4551a62d4b
@ -38,7 +38,7 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
private bool needToSerialize;
|
private bool needToSerialize;
|
||||||
|
|
||||||
List<string> warnings = new List<string>();
|
List<string> warnings = new List<string>();
|
||||||
|
|
||||||
void OnEnable () {
|
void OnEnable () {
|
||||||
|
|
||||||
SpineEditorUtilities.ConfirmInitialization();
|
SpineEditorUtilities.ConfirmInitialization();
|
||||||
@ -117,7 +117,7 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
DrawAnimationList();
|
DrawAnimationList();
|
||||||
DrawSlotList();
|
DrawSlotList();
|
||||||
DrawUnityTools();
|
DrawUnityTools();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DrawReimportButton();
|
DrawReimportButton();
|
||||||
@ -131,8 +131,8 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawMecanim () {
|
void DrawMecanim () {
|
||||||
|
|
||||||
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();
|
GUILayout.BeginHorizontal();
|
||||||
GUILayout.Space(32);
|
GUILayout.Space(32);
|
||||||
@ -142,7 +142,7 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
EditorGUILayout.LabelField("Alternative to SkeletonAnimation, not required", EditorStyles.miniLabel);
|
EditorGUILayout.LabelField("Alternative to SkeletonAnimation, not required", EditorStyles.miniLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawUnityTools () {
|
void DrawUnityTools () {
|
||||||
@ -292,7 +292,7 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
serializedObject.ApplyModifiedProperties();
|
serializedObject.ApplyModifiedProperties();
|
||||||
needToSerialize = true;
|
needToSerialize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void DrawAnimationList () {
|
void DrawAnimationList () {
|
||||||
showAnimationList = EditorGUILayout.Foldout(showAnimationList, new GUIContent("Animations", SpineEditorUtilities.Icons.animationRoot));
|
showAnimationList = EditorGUILayout.Foldout(showAnimationList, new GUIContent("Animations", SpineEditorUtilities.Icons.animationRoot));
|
||||||
@ -648,7 +648,7 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
this.m_previewUtility.m_Camera.orthographicSize = orthoSet;
|
this.m_previewUtility.m_Camera.orthographicSize = orthoSet;
|
||||||
|
|
||||||
float dist = Vector3.Distance(m_previewUtility.m_Camera.transform.position, m_posGoal);
|
float dist = Vector3.Distance(m_previewUtility.m_Camera.transform.position, m_posGoal);
|
||||||
if (dist > 60f * ((SkeletonDataAsset)target).scale) {
|
if(dist > 0f) {
|
||||||
Vector3 pos = Vector3.Lerp(this.m_previewUtility.m_Camera.transform.position, m_posGoal, 0.1f);
|
Vector3 pos = Vector3.Lerp(this.m_previewUtility.m_Camera.transform.position, m_posGoal, 0.1f);
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
this.m_previewUtility.m_Camera.transform.position = pos;
|
this.m_previewUtility.m_Camera.transform.position = pos;
|
||||||
@ -676,7 +676,7 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (drawHandles) {
|
if (drawHandles) {
|
||||||
Handles.SetCamera(m_previewUtility.m_Camera);
|
Handles.SetCamera(m_previewUtility.m_Camera);
|
||||||
Handles.color = m_originColor;
|
Handles.color = m_originColor;
|
||||||
|
|
||||||
@ -724,8 +724,8 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
|
|
||||||
Handles.DrawLine(lastVert, firstVert);
|
Handles.DrawLine(lastVert, firstVert);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update () {
|
void Update () {
|
||||||
@ -857,7 +857,7 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
case EventType.ScrollWheel:
|
case EventType.ScrollWheel:
|
||||||
if (position.Contains(current.mousePosition)) {
|
if (position.Contains(current.mousePosition)) {
|
||||||
|
|
||||||
m_orthoGoal += current.delta.y * ((SkeletonDataAsset)target).scale * 10;
|
m_orthoGoal += current.delta.y;
|
||||||
GUIUtility.hotControl = controlID;
|
GUIUtility.hotControl = controlID;
|
||||||
current.Use();
|
current.Use();
|
||||||
}
|
}
|
||||||
@ -882,7 +882,7 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
EditorGUIUtility.SetWantsMouseJumping(1);
|
EditorGUIUtility.SetWantsMouseJumping(1);
|
||||||
}
|
}
|
||||||
return scrollPosition;
|
return scrollPosition;
|
||||||
|
|
||||||
case EventType.MouseUp:
|
case EventType.MouseUp:
|
||||||
if (GUIUtility.hotControl == controlID)
|
if (GUIUtility.hotControl == controlID)
|
||||||
{
|
{
|
||||||
@ -890,10 +890,10 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
}
|
}
|
||||||
EditorGUIUtility.SetWantsMouseJumping(0);
|
EditorGUIUtility.SetWantsMouseJumping(0);
|
||||||
return scrollPosition;
|
return scrollPosition;
|
||||||
|
|
||||||
case EventType.MouseMove:
|
case EventType.MouseMove:
|
||||||
return scrollPosition;
|
return scrollPosition;
|
||||||
|
|
||||||
case EventType.MouseDrag:
|
case EventType.MouseDrag:
|
||||||
if (GUIUtility.hotControl == controlID)
|
if (GUIUtility.hotControl == controlID)
|
||||||
{
|
{
|
||||||
@ -956,4 +956,4 @@ public class SkeletonDataAssetInspector : Editor {
|
|||||||
tex = this.m_previewUtility.EndStaticPreview();
|
tex = this.m_previewUtility.EndStaticPreview();
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes Software License
|
* Spine Runtimes Software License
|
||||||
* Version 2.3
|
* Version 2.3
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2015, Esoteric Software
|
* Copyright (c) 2013-2015, Esoteric Software
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* You are granted a perpetual, non-exclusive, non-sublicensable and
|
* You are granted a perpetual, non-exclusive, non-sublicensable and
|
||||||
* non-transferable license to use, install, execute and perform the Spine
|
* non-transferable license to use, install, execute and perform the Spine
|
||||||
* Runtimes Software (the "Software") and derivative works solely for personal
|
* Runtimes Software (the "Software") and derivative works solely for personal
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* or other intellectual property or proprietary rights notices on or in the
|
* or other intellectual property or proprietary rights notices on or in the
|
||||||
* Software, including any copy thereof. Redistributions in binary or source
|
* Software, including any copy thereof. Redistributions in binary or source
|
||||||
* form must include this license and terms.
|
* form must include this license and terms.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
@ -98,7 +98,7 @@ public class SkeletonDataAsset : ScriptableObject {
|
|||||||
|
|
||||||
if (skeletonData != null)
|
if (skeletonData != null)
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
|
|
||||||
AttachmentLoader attachmentLoader;
|
AttachmentLoader attachmentLoader;
|
||||||
float skeletonDataScale;
|
float skeletonDataScale;
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public class SkeletonDataAsset : ScriptableObject {
|
|||||||
#else
|
#else
|
||||||
if (spriteCollection != null) {
|
if (spriteCollection != null) {
|
||||||
attachmentLoader = new SpriteCollectionAttachmentLoader(spriteCollection);
|
attachmentLoader = new SpriteCollectionAttachmentLoader(spriteCollection);
|
||||||
skeletonDataScale = (1.0f / (spriteCollection.invOrthoSize * spriteCollection.halfTargetHeight) * scale) * 100f;
|
skeletonDataScale = (1.0f / (spriteCollection.invOrthoSize * spriteCollection.halfTargetHeight) * scale);
|
||||||
} else {
|
} else {
|
||||||
if (atlasArr.Length == 0) {
|
if (atlasArr.Length == 0) {
|
||||||
Reset();
|
Reset();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user