mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Merge remote-tracking branch 'origin/master'
Conflicts: spine-tk2d/Code/tk2dSpineSkeleton.cs
This commit is contained in:
commit
a0b29a2719
@ -63,8 +63,8 @@ typedef struct tagResource {
|
||||
|
||||
static Resource smallResource = {cocos2d::CCSizeMake(480, 320), "iphone"};
|
||||
static Resource mediumResource = {cocos2d::CCSizeMake(960, 640), "iphone-retina"};
|
||||
static Resource largeResource = {cocos2d::CCSizeMake(1024, 768), "ipad"};
|
||||
static Resource extralargeResource = {cocos2d::CCSizeMake(2048, 1536), "ipadhd"};
|
||||
static Resource largeResource = {cocos2d::CCSizeMake(1024, 768), "iphone"};
|
||||
static Resource extralargeResource = {cocos2d::CCSizeMake(2048, 1536), "iphone-retina"};
|
||||
|
||||
#if (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_480X320)
|
||||
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(480, 320);
|
||||
|
||||
@ -124,6 +124,11 @@ public class tk2dSpineSkeleton : MonoBehaviour, tk2dRuntime.ISpriteCollectionFor
|
||||
mesh.tangents = tangents;
|
||||
}
|
||||
}
|
||||
|
||||
renderer.sharedMaterial = skeletonDataAsset.spritesData.inst.materials[0];
|
||||
#if UNITY_EDITOR
|
||||
UpdateEditorGizmo();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void UpdateCache() {
|
||||
@ -200,4 +205,30 @@ public class tk2dSpineSkeleton : MonoBehaviour, tk2dRuntime.ISpriteCollectionFor
|
||||
UpdateSubmeshCache();
|
||||
UpdateMesh();
|
||||
}
|
||||
|
||||
#region Unity Editor
|
||||
#if UNITY_EDITOR
|
||||
Vector3 gizmosCenter = new Vector3();
|
||||
Vector3 gizmosSize = new Vector3();
|
||||
Vector3 min = new Vector3(float.MaxValue, float.MaxValue, 0f);
|
||||
Vector3 max = new Vector3(float.MinValue, float.MinValue, 0f);
|
||||
|
||||
void UpdateEditorGizmo() {
|
||||
//determine the minimums and maximums
|
||||
foreach (Vector3 vert in vertices) {
|
||||
min = Vector3.Min(min, vert);
|
||||
max = Vector3.Max(max, vert);
|
||||
}
|
||||
float width = max.x - min.x;
|
||||
float height = max.y - min.y;
|
||||
gizmosCenter = new Vector3(min.x + (width / 2f), min.y + (height / 2f), 0f);
|
||||
gizmosSize = new Vector3(width, height, 1f);
|
||||
}
|
||||
void OnDrawGizmos() {
|
||||
Gizmos.color = Color.clear;
|
||||
Gizmos.matrix = transform.localToWorldMatrix;
|
||||
Gizmos.DrawCube(gizmosCenter, gizmosSize);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -165,6 +165,9 @@ public class SkeletonComponent : MonoBehaviour {
|
||||
mesh.colors32 = colors;
|
||||
mesh.uv = uvs;
|
||||
if (newTriangles) mesh.triangles = triangles;
|
||||
#if UNITY_EDITOR
|
||||
UpdateEditorGizmo();
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual void OnEnable () {
|
||||
@ -179,4 +182,30 @@ public class SkeletonComponent : MonoBehaviour {
|
||||
public virtual void Reset () {
|
||||
Update();
|
||||
}
|
||||
|
||||
#region Unity Editor
|
||||
#if UNITY_EDITOR
|
||||
Vector3 gizmosCenter = new Vector3();
|
||||
Vector3 gizmosSize = new Vector3();
|
||||
Vector3 min = new Vector3(float.MaxValue, float.MaxValue, 0f);
|
||||
Vector3 max = new Vector3(float.MinValue, float.MinValue, 0f);
|
||||
|
||||
void UpdateEditorGizmo() {
|
||||
//determine the minimums and maximums
|
||||
foreach (Vector3 vert in vertices) {
|
||||
min = Vector3.Min(min, vert);
|
||||
max = Vector3.Max(max, vert);
|
||||
}
|
||||
float width = max.x - min.x;
|
||||
float height = max.y - min.y;
|
||||
gizmosCenter = new Vector3(min.x + (width / 2f), min.y + (height / 2f), 0f);
|
||||
gizmosSize = new Vector3(width, height, 1f);
|
||||
}
|
||||
void OnDrawGizmos() {
|
||||
Gizmos.color = Color.clear;
|
||||
Gizmos.matrix = transform.localToWorldMatrix;
|
||||
Gizmos.DrawCube(gizmosCenter, gizmosSize);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user