diff --git a/spine-cocos2dx/src/spine/v4/SkeletonBatch.cpp b/spine-cocos2dx/src/spine/v4/SkeletonBatch.cpp index 62e39c192..34dc83cee 100644 --- a/spine-cocos2dx/src/spine/v4/SkeletonBatch.cpp +++ b/spine-cocos2dx/src/spine/v4/SkeletonBatch.cpp @@ -163,11 +163,10 @@ cocos2d::TrianglesCommand* SkeletonBatch::addCommand(cocos2d::Renderer* renderer CCASSERT(programState, "programState should not be null"); auto& pipelinePS = command->getPipelineDescriptor().programState; - if (pipelinePS != programState) + if (pipelinePS == nullptr || pipelinePS->getProgram() != programState->getProgram()) { CC_SAFE_RELEASE(pipelinePS); - pipelinePS = programState; - CC_SAFE_RETAIN(pipelinePS); + pipelinePS = programState->clone(); updateProgramStateLayout(pipelinePS); } @@ -175,8 +174,8 @@ cocos2d::TrianglesCommand* SkeletonBatch::addCommand(cocos2d::Renderer* renderer pipelinePS->setUniform(_locMVP, projectionMat.m, sizeof(projectionMat.m)); pipelinePS->setTexture(_locTexture, 0, texture->getBackendTexture()); - command->init(globalOrder, texture, blendType, triangles, mv, flags); - renderer->addCommand(command); + command->init(globalOrder, texture, blendType, triangles, mv, flags); + renderer->addCommand(command); return command; } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index 020e4883f..429266bf1 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -657,6 +657,9 @@ namespace Spine.Unity { go.transform.localPosition = Vector3.zero; var canvasRenderer = go.AddComponent(); canvasRenderers.Add(canvasRenderer); + var rawImage = go.AddComponent(); + rawImage.maskable = this.maskable; + rawImage.raycastTarget = false; } } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateClip.cs b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateClip.cs index efa194f09..0ab9b18f4 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateClip.cs +++ b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateClip.cs @@ -47,7 +47,7 @@ namespace Spine.Unity.Playables { public override double duration { get { - if (template.animationReference == null) + if (template.animationReference == null || template.animationReference.Animation == null) return 0; return template.animationReference.Animation.Duration; } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs index d8051497b..17c998c95 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs +++ b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs @@ -141,7 +141,7 @@ namespace Spine.Unity.Playables { var skeleton = skeletonComponent.Skeleton; - bool skeletonDataMismatch = clipData.animationReference != null && + bool skeletonDataMismatch = clipData.animationReference != null && clipData.animationReference.SkeletonDataAsset && skeletonComponent.SkeletonDataAsset.GetSkeletonData(true) != clipData.animationReference.SkeletonDataAsset.GetSkeletonData(true); if (skeletonDataMismatch) { Debug.LogWarningFormat("SpineAnimationStateMixerBehaviour tried to apply an animation for the wrong skeleton. Expected {0}. Was {1}", diff --git a/spine-xna/src/ShapeRenderer.cs b/spine-xna/src/ShapeRenderer.cs index 604b7172c..08258fd2b 100644 --- a/spine-xna/src/ShapeRenderer.cs +++ b/spine-xna/src/ShapeRenderer.cs @@ -119,13 +119,12 @@ namespace Spine { if (count< 3) throw new ArgumentException("Polygon must contain at least 3 vertices"); offset <<= 1; - count <<= 1; var firstX = polygonVertices[offset]; var firstY = polygonVertices[offset + 1]; var last = offset + count; - for (int i = offset, n = offset + count - 2; i