Skip to content

Commit

Permalink
Merge branch '4.2' into spine-android
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed May 7, 2024
2 parents ffeb650 + 126a8f0 commit 9cc57ee
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
4 changes: 4 additions & 0 deletions spine-csharp/src/MathUtils.cs
Expand Up @@ -78,6 +78,10 @@ public static class MathUtils {
return sin[(int)((degrees + 90) * DegToIndex) & SIN_MASK];
}

static public float Atan2Deg (float y, float x) {
return Atan2(y, x) * RadDeg;
}

/// <summary>Returns atan2 in radians, faster but less accurate than Math.Atan2. Average error of 0.00231 radians (0.1323
/// degrees), largest error of 0.00488 radians (0.2796 degrees).</summary>
static public float Atan2 (float y, float x) {
Expand Down
2 changes: 1 addition & 1 deletion spine-csharp/src/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-csharp",
"displayName": "spine-csharp Runtime",
"description": "This plugin provides the spine-csharp core runtime.",
"version": "4.2.22",
"version": "4.2.23",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",
Expand Down
Expand Up @@ -73,6 +73,7 @@ public class SkeletonRenderSeparator : MonoBehaviour {
[Tooltip("Copies MeshRenderer flags into each parts renderer")]
public bool copyMeshRendererFlags = true;
public List<Spine.Unity.SkeletonPartsRenderer> partsRenderers = new List<SkeletonPartsRenderer>();
[System.NonSerialized] public bool isVisible = true;

#if UNITY_EDITOR
void Reset () {
Expand Down Expand Up @@ -197,6 +198,10 @@ public class SkeletonRenderSeparator : MonoBehaviour {
skeletonRenderer.LateUpdateMesh();
}

public void Update () {
UpdateVisibility();
}

public void OnDisable () {
if (skeletonRenderer == null) return;
#if SPINE_OPTIONAL_RENDEROVERRIDE
Expand All @@ -206,6 +211,24 @@ public class SkeletonRenderSeparator : MonoBehaviour {
ClearPartsRendererMeshes();
}

public void UpdateVisibility () {
foreach (SkeletonPartsRenderer partsRenderer in partsRenderers) {
if (partsRenderer == null) continue;

if (partsRenderer.MeshRenderer.isVisible) {
if (!isVisible) {
skeletonRenderer.OnBecameVisible();
isVisible = true;
}
return;
}
}
if (isVisible) {
isVisible = false;
skeletonRenderer.OnBecameInvisible();
}
}

MaterialPropertyBlock copiedBlock;

void HandleRender (SkeletonRendererInstruction instruction) {
Expand Down
Expand Up @@ -239,6 +239,7 @@ public class SpriteMaskInteractionMaterials {
Initialize(false);
if (meshRenderer)
meshRenderer.enabled = false;
updateMode = UpdateMode.FullUpdate;
}
}
remove {
Expand Down Expand Up @@ -405,7 +406,8 @@ public class SpriteMaskInteractionMaterials {

public virtual void Awake () {
Initialize(false);
updateMode = updateWhenInvisible;
if (generateMeshOverride == null || !disableRenderingOnOverride)
updateMode = updateWhenInvisible;
}

#if UNITY_EDITOR && CONFIGURABLE_ENTER_PLAY_MODE
Expand Down
2 changes: 1 addition & 1 deletion spine-unity/Assets/Spine/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core.",
"version": "4.2.62",
"version": "4.2.63",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",
Expand Down

0 comments on commit 9cc57ee

Please sign in to comment.