From b151e2e6109bf6a2f28e1993d0a06352b89e7fd8 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 9 Aug 2019 17:32:30 +0200 Subject: [PATCH 1/2] [unity] Fixed SkeletonData asset inspector animation playback preview for Unity 2018 and 2019. Closes #1440. --- .../Editor/Asset Types/SkeletonDataAssetInspector.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs index cbd2e7ed8..3817aab83 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs @@ -696,11 +696,8 @@ namespace Spine.Unity.Editor { SkeletonAnimation skeletonAnimation; GameObject previewGameObject; internal bool requiresRefresh; - - #if !SPINE_UNITY_2018_PREVIEW_API float animationLastTime; - #endif - + static float CurrentTime { get { return (float)EditorApplication.timeSinceStartup; } } Action Repaint; @@ -793,10 +790,8 @@ namespace Spine.Unity.Editor { if (previewRenderUtility == null) { previewRenderUtility = new PreviewRenderUtility(true); - #if !SPINE_UNITY_2018_PREVIEW_API animationLastTime = CurrentTime; - #endif - + const int PreviewLayer = 30; const int PreviewCameraCullingMask = 1 << PreviewLayer; @@ -885,12 +880,10 @@ namespace Spine.Unity.Editor { if (!EditorApplication.isPlaying) { - #if !SPINE_UNITY_2018_PREVIEW_API float current = CurrentTime; float deltaTime = (current - animationLastTime); skeletonAnimation.Update(deltaTime); animationLastTime = current; - #endif skeletonAnimation.LateUpdate(); } From 40d4cad434f203f67cd512de73167d65a7f170db Mon Sep 17 00:00:00 2001 From: badlogic Date: Mon, 12 Aug 2019 14:02:05 +0200 Subject: [PATCH 2/2] [cocos2dx] Properly retain/release textures in attachemnt vertices. Closes #1442. --- spine-cocos2dx/src/spine/AttachmentVertices.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spine-cocos2dx/src/spine/AttachmentVertices.cpp b/spine-cocos2dx/src/spine/AttachmentVertices.cpp index 698b3118b..0340f3a7f 100644 --- a/spine-cocos2dx/src/spine/AttachmentVertices.cpp +++ b/spine-cocos2dx/src/spine/AttachmentVertices.cpp @@ -35,6 +35,7 @@ namespace spine { AttachmentVertices::AttachmentVertices (Texture2D* texture, int verticesCount, unsigned short* triangles, int trianglesCount) { _texture = texture; + if (_texture) _texture->retain(); _triangles = new TrianglesCommand::Triangles(); _triangles->verts = new V3F_C4B_T2F[verticesCount]; @@ -46,6 +47,7 @@ AttachmentVertices::AttachmentVertices (Texture2D* texture, int verticesCount, u AttachmentVertices::~AttachmentVertices () { delete [] _triangles->verts; delete _triangles; + if (_texture) _texture->release(); } }