mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
afd4eb32a1
@ -73,6 +73,17 @@ namespace Spine.Unity.Examples {
|
|||||||
CreateQuadChild();
|
CreateQuadChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
protected void Reset () {
|
||||||
|
string[] folders = { "Assets", "Packages" };
|
||||||
|
string[] assets = UnityEditor.AssetDatabase.FindAssets("t:material RenderQuadMaterial", folders);
|
||||||
|
if (assets.Length > 0) {
|
||||||
|
string materialPath = UnityEditor.AssetDatabase.GUIDToAssetPath(assets[0]);
|
||||||
|
quadMaterial = UnityEditor.AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void CreateQuadChild () {
|
void CreateQuadChild () {
|
||||||
quad = new GameObject(this.name + " RenderTexture", typeof(MeshRenderer), typeof(MeshFilter));
|
quad = new GameObject(this.name + " RenderTexture", typeof(MeshRenderer), typeof(MeshFilter));
|
||||||
quad.transform.SetParent(this.transform.parent, false);
|
quad.transform.SetParent(this.transform.parent, false);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-unity-examples",
|
"name": "com.esotericsoftware.spine.spine-unity-examples",
|
||||||
"displayName": "spine-unity Runtime Examples",
|
"displayName": "spine-unity Runtime Examples",
|
||||||
"description": "This plugin provides example scenes and scripts for the spine-unity runtime.",
|
"description": "This plugin provides example scenes and scripts for the spine-unity runtime.",
|
||||||
"version": "4.2.12",
|
"version": "4.2.13",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
@ -43,5 +43,15 @@ namespace Spine.Unity {
|
|||||||
protected override void OnPopulateMesh (VertexHelper vh) {
|
protected override void OnPopulateMesh (VertexHelper vh) {
|
||||||
vh.Clear();
|
vh.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnDisable () {
|
||||||
|
base.OnDisable();
|
||||||
|
this.canvasRenderer.cull = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnEnable () {
|
||||||
|
base.OnEnable();
|
||||||
|
this.canvasRenderer.cull = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -588,6 +588,13 @@ namespace Spine.Unity {
|
|||||||
SetRectTransformSize(this, size);
|
SetRectTransformSize(this, size);
|
||||||
this.rectTransform.pivot = p;
|
this.rectTransform.pivot = p;
|
||||||
|
|
||||||
|
foreach (Transform separatorPart in separatorParts) {
|
||||||
|
RectTransform separatorTransform = separatorPart.GetComponent<RectTransform>();
|
||||||
|
if (separatorTransform) {
|
||||||
|
SetRectTransformSize(separatorTransform, size);
|
||||||
|
separatorTransform.pivot = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach (SkeletonSubmeshGraphic submeshGraphic in submeshGraphics) {
|
foreach (SkeletonSubmeshGraphic submeshGraphic in submeshGraphics) {
|
||||||
SetRectTransformSize(submeshGraphic, size);
|
SetRectTransformSize(submeshGraphic, size);
|
||||||
submeshGraphic.rectTransform.pivot = p;
|
submeshGraphic.rectTransform.pivot = p;
|
||||||
@ -595,14 +602,18 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void SetRectTransformSize (Graphic target, Vector2 size) {
|
public static void SetRectTransformSize (Graphic target, Vector2 size) {
|
||||||
|
SetRectTransformSize(target.rectTransform, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetRectTransformSize (RectTransform targetRectTransform, Vector2 size) {
|
||||||
Vector2 parentSize = Vector2.zero;
|
Vector2 parentSize = Vector2.zero;
|
||||||
if (target.rectTransform.parent != null) {
|
if (targetRectTransform.parent != null) {
|
||||||
RectTransform parentTransform = target.rectTransform.parent.GetComponent<RectTransform>();
|
RectTransform parentTransform = targetRectTransform.parent.GetComponent<RectTransform>();
|
||||||
if (parentTransform)
|
if (parentTransform)
|
||||||
parentSize = parentTransform.rect.size;
|
parentSize = parentTransform.rect.size;
|
||||||
}
|
}
|
||||||
Vector2 anchorAreaSize = Vector2.Scale(target.rectTransform.anchorMax - target.rectTransform.anchorMin, parentSize);
|
Vector2 anchorAreaSize = Vector2.Scale(targetRectTransform.anchorMax - targetRectTransform.anchorMin, parentSize);
|
||||||
target.rectTransform.sizeDelta = size - anchorAreaSize;
|
targetRectTransform.sizeDelta = size - anchorAreaSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>OnAnimationRebuild is raised after the SkeletonAnimation component is successfully initialized.</summary>
|
/// <summary>OnAnimationRebuild is raised after the SkeletonAnimation component is successfully initialized.</summary>
|
||||||
@ -970,7 +981,7 @@ namespace Spine.Unity {
|
|||||||
if (i >= usedRenderersCount)
|
if (i >= usedRenderersCount)
|
||||||
canvasRenderer.gameObject.SetActive(true);
|
canvasRenderer.gameObject.SetActive(true);
|
||||||
|
|
||||||
if (canvasRenderer.transform.parent != parent.transform)
|
if (canvasRenderer.transform.parent != parent.transform && !isInRebuild)
|
||||||
canvasRenderer.transform.SetParent(parent.transform, false);
|
canvasRenderer.transform.SetParent(parent.transform, false);
|
||||||
|
|
||||||
canvasRenderer.transform.SetSiblingIndex(targetSiblingIndex++);
|
canvasRenderer.transform.SetSiblingIndex(targetSiblingIndex++);
|
||||||
@ -1007,6 +1018,7 @@ namespace Spine.Unity {
|
|||||||
for (int i = canvasRenderers.Count - 1; i >= 0; --i) {
|
for (int i = canvasRenderers.Count - 1; i >= 0; --i) {
|
||||||
if (canvasRenderers[i] == null) {
|
if (canvasRenderers[i] == null) {
|
||||||
canvasRenderers.RemoveAt(i);
|
canvasRenderers.RemoveAt(i);
|
||||||
|
submeshGraphics.RemoveAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1074,7 +1086,14 @@ namespace Spine.Unity {
|
|||||||
for (int i = currentCount; i < targetCount; ++i) {
|
for (int i = currentCount; i < targetCount; ++i) {
|
||||||
GameObject go = new GameObject(string.Format("{0}[{1}]", SeparatorPartGameObjectName, i), typeof(RectTransform));
|
GameObject go = new GameObject(string.Format("{0}[{1}]", SeparatorPartGameObjectName, i), typeof(RectTransform));
|
||||||
go.transform.SetParent(this.transform, false);
|
go.transform.SetParent(this.transform, false);
|
||||||
go.transform.localPosition = Vector3.zero;
|
|
||||||
|
RectTransform dstTransform = go.transform.GetComponent<RectTransform>();
|
||||||
|
dstTransform.localPosition = Vector3.zero;
|
||||||
|
dstTransform.pivot = rectTransform.pivot;
|
||||||
|
dstTransform.anchorMin = Vector2.zero;
|
||||||
|
dstTransform.anchorMax = Vector2.one;
|
||||||
|
dstTransform.sizeDelta = Vector2.zero;
|
||||||
|
|
||||||
separatorParts.Add(go.transform);
|
separatorParts.Add(go.transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-unity",
|
"name": "com.esotericsoftware.spine.spine-unity",
|
||||||
"displayName": "spine-unity Runtime",
|
"displayName": "spine-unity Runtime",
|
||||||
"description": "This plugin provides the spine-unity runtime core.",
|
"description": "This plugin provides the spine-unity runtime core.",
|
||||||
"version": "4.2.15",
|
"version": "4.2.16",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user