From dae8f78409081f7e86cd9aa08b317dd23f674e24 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 6 May 2019 17:15:42 +0200 Subject: [PATCH 1/4] [unity] Supressed 3rd warning in 3.7 branch in Unity 2019.1, fix only in 3.8 due to API changes. See #1336. --- .../Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs index f17fd139d..c05a7ef23 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs @@ -28,6 +28,7 @@ *****************************************************************************/ #pragma warning disable 0219 +#pragma warning disable 0618 // for 3.7 branch only. Avoids "PreferenceItem' is obsolete: '[PreferenceItem] is deprecated. Use [SettingsProvider] instead." // Original contribution by: Mitch Thompson From a8c0abc0c822457540d8db6764320928c18b429f Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 13 May 2019 16:45:52 +0200 Subject: [PATCH 2/4] [csharp] Fixed locale-based exception when parsing a Spine atlas. Closes #1354. --- spine-csharp/src/Atlas.cs | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/spine-csharp/src/Atlas.cs b/spine-csharp/src/Atlas.cs index 5ac14a00e..0bb0f4d95 100644 --- a/spine-csharp/src/Atlas.cs +++ b/spine-csharp/src/Atlas.cs @@ -33,6 +33,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Reflection; @@ -123,8 +124,8 @@ namespace Spine { page.name = line; if (ReadTuple(reader, tuple) == 2) { // size is only optional for an atlas packed with an old TexturePacker. - page.width = int.Parse(tuple[0]); - page.height = int.Parse(tuple[1]); + page.width = int.Parse(tuple[0], CultureInfo.InvariantCulture); + page.height = int.Parse(tuple[1], CultureInfo.InvariantCulture); ReadTuple(reader, tuple); } page.format = (Format)Enum.Parse(typeof(Format), tuple[0], false); @@ -155,12 +156,12 @@ namespace Spine { region.rotate = Boolean.Parse(ReadValue(reader)); ReadTuple(reader, tuple); - int x = int.Parse(tuple[0]); - int y = int.Parse(tuple[1]); + int x = int.Parse(tuple[0], CultureInfo.InvariantCulture); + int y = int.Parse(tuple[1], CultureInfo.InvariantCulture); ReadTuple(reader, tuple); - int width = int.Parse(tuple[0]); - int height = int.Parse(tuple[1]); + int width = int.Parse(tuple[0], CultureInfo.InvariantCulture); + int height = int.Parse(tuple[1], CultureInfo.InvariantCulture); region.u = x / (float)page.width; region.v = y / (float)page.height; @@ -177,25 +178,29 @@ namespace Spine { region.height = Math.Abs(height); if (ReadTuple(reader, tuple) == 4) { // split is optional - region.splits = new [] {int.Parse(tuple[0]), int.Parse(tuple[1]), - int.Parse(tuple[2]), int.Parse(tuple[3])}; + region.splits = new [] {int.Parse(tuple[0], CultureInfo.InvariantCulture), + int.Parse(tuple[1], CultureInfo.InvariantCulture), + int.Parse(tuple[2], CultureInfo.InvariantCulture), + int.Parse(tuple[3], CultureInfo.InvariantCulture)}; if (ReadTuple(reader, tuple) == 4) { // pad is optional, but only present with splits - region.pads = new [] {int.Parse(tuple[0]), int.Parse(tuple[1]), - int.Parse(tuple[2]), int.Parse(tuple[3])}; + region.pads = new [] {int.Parse(tuple[0], CultureInfo.InvariantCulture), + int.Parse(tuple[1], CultureInfo.InvariantCulture), + int.Parse(tuple[2], CultureInfo.InvariantCulture), + int.Parse(tuple[3], CultureInfo.InvariantCulture)}; ReadTuple(reader, tuple); } } - region.originalWidth = int.Parse(tuple[0]); - region.originalHeight = int.Parse(tuple[1]); + region.originalWidth = int.Parse(tuple[0], CultureInfo.InvariantCulture); + region.originalHeight = int.Parse(tuple[1], CultureInfo.InvariantCulture); ReadTuple(reader, tuple); - region.offsetX = int.Parse(tuple[0]); - region.offsetY = int.Parse(tuple[1]); + region.offsetX = int.Parse(tuple[0], CultureInfo.InvariantCulture); + region.offsetY = int.Parse(tuple[1], CultureInfo.InvariantCulture); - region.index = int.Parse(ReadValue(reader)); + region.index = int.Parse(ReadValue(reader), CultureInfo.InvariantCulture); regions.Add(region); } From e8eb894304eadb09338be549f913be794d82bd44 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 13 May 2019 16:49:07 +0200 Subject: [PATCH 3/4] [unity][csharp] Fixed one more potential locale-based parsing exception. See #1354. --- .../Editor/spine-unity/Editor/SpineEditorUtilities.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs index c05a7ef23..709254936 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs @@ -57,6 +57,7 @@ using System.IO; using System.Text; using System.Linq; using System.Reflection; +using System.Globalization; namespace Spine.Unity.Editor { using EventType = UnityEngine.EventType; @@ -1184,10 +1185,10 @@ namespace Spine.Unity.Editor { string[] versionSplit = rawVersion.Split('.'); bool match = false; foreach (var version in compatibleVersions) { - bool primaryMatch = version[0] == int.Parse(versionSplit[0]); - bool secondaryMatch = version[1] == int.Parse(versionSplit[1]); + bool primaryMatch = version[0] == int.Parse(versionSplit[0], CultureInfo.InvariantCulture); + bool secondaryMatch = version[1] == int.Parse(versionSplit[1], CultureInfo.InvariantCulture); - // if (isFixVersionRequired) secondaryMatch &= version[2] <= int.Parse(jsonVersionSplit[2]); + // if (isFixVersionRequired) secondaryMatch &= version[2] <= int.Parse(jsonVersionSplit[2], CultureInfo.InvariantCulture); if (primaryMatch && secondaryMatch) { match = true; From 4d2e81396750fec4f44894bc4b863df9501ef322 Mon Sep 17 00:00:00 2001 From: badlogic Date: Wed, 15 May 2019 17:04:28 +0200 Subject: [PATCH 4/4] [lua] IkConstraintTimeline.STRETCH was incorrect, resulting in ik timeline mixes not being properly set. Closes #1353. --- spine-lua/Animation.lua | 56 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/spine-lua/Animation.lua b/spine-lua/Animation.lua index 17efcf48c..4e40e9758 100644 --- a/spine-lua/Animation.lua +++ b/spine-lua/Animation.lua @@ -278,7 +278,7 @@ function Animation.RotateTimeline.new (frameCount) r = r - (16384 - math_floor(16384.499999999996 - r / 360)) * 360 -- Wrap within -180 and 180. bone.rotation = bone.rotation + r * alpha; elseif blend == MixBlend.add then - bone.rotation = bone.rotation + r * alpha; + bone.rotation = bone.rotation + r * alpha; end return; end @@ -318,7 +318,7 @@ function Animation.TranslateTimeline.new (frameCount) self.frames = utils.newNumberArrayZero(frameCount * ENTRIES) self.boneIndex = -1 self.type = TimelineType.translate - + function self:getPropertyId () return TimelineType.translate * SHL_24 + self.boneIndex end @@ -334,7 +334,7 @@ function Animation.TranslateTimeline.new (frameCount) local frames = self.frames local bone = skeleton.bones[self.boneIndex] - if time < frames[0] then + if time < frames[0] then if blend == MixBlend.setup then bone.x = bone.data.x bone.y = bone.data.y @@ -389,7 +389,7 @@ function Animation.ScaleTimeline.new (frameCount) local self = Animation.TranslateTimeline.new(frameCount) self.type = TimelineType.scale - + function self:getPropertyId () return TimelineType.scale * SHL_24 + self.boneIndex end @@ -437,7 +437,7 @@ function Animation.ScaleTimeline.new (frameCount) else local bx = 0 local by = 0 - if direction == MixDirection.out then + if direction == MixDirection.out then if blend == MixBlend.setup then bx = bone.data.scaleX by = bone.data.scaleY @@ -490,7 +490,7 @@ function Animation.ShearTimeline.new (frameCount) local self = Animation.TranslateTimeline.new(frameCount) self.type = TimelineType.shear - + function self:getPropertyId () return TimelineType.shear * SHL_24 + self.boneIndex end @@ -560,7 +560,7 @@ function Animation.ColorTimeline.new (frameCount) self.frames = utils.newNumberArrayZero(frameCount * ENTRIES) self.slotIndex = -1 self.type = TimelineType.color - + function self:getPropertyId () return TimelineType.color * SHL_24 + self.slotIndex end @@ -577,7 +577,7 @@ function Animation.ColorTimeline.new (frameCount) function self:apply (skeleton, lastTime, time, firedEvents, alpha, blend, direction) local frames = self.frames local slot = skeleton.slots[self.slotIndex] - if time < frames[0] then + if time < frames[0] then if blend == MixBlend.setup then slot.color:setFrom(slot.data.color) elseif blend == MixBlend.first then @@ -648,7 +648,7 @@ function Animation.TwoColorTimeline.new (frameCount) self.frames = utils.newNumberArrayZero(frameCount * ENTRIES) self.slotIndex = -1 self.type = TimelineType.twoColor - + function self:getPropertyId () return TimelineType.twoColor * SHL_24 + self.slotIndex end @@ -668,7 +668,7 @@ function Animation.TwoColorTimeline.new (frameCount) function self:apply (skeleton, lastTime, time, firedEvents, alpha, blend, direction) local frames = self.frames local slot = skeleton.slots[self.slotIndex] - if time < frames[0] then + if time < frames[0] then if blend == MixBlend.setup then slot.color:setFrom(slot.data.color) slot.darkColor:setFrom(slot.data.darkColor) @@ -722,7 +722,7 @@ function Animation.TwoColorTimeline.new (frameCount) else local light = slot.color local dark = slot.darkColor - if blend == MixBlend.setup then + if blend == MixBlend.setup then light:setFrom(slot.data.color) dark:setFrom(slot.data.darkColor) end @@ -751,7 +751,7 @@ function Animation.AttachmentTimeline.new (frameCount) self.frames[frameIndex] = time self.attachmentNames[frameIndex] = attachmentName end - + function self:getPropertyId () return TimelineType.attachment * SHL_24 + self.slotIndex end @@ -768,9 +768,9 @@ function Animation.AttachmentTimeline.new (frameCount) end return; end - + local frames = self.frames - if time < frames[0] then + if time < frames[0] then if blend == MixBlend.setup or blend == MixBlend.first then attachmentName = slot.data.attachmentName if not attachmentName then @@ -830,8 +830,8 @@ function Animation.DeformTimeline.new (frameCount) if #(verticesArray) == 0 then blend = MixBlend.setup end local frameVertices = self.frameVertices - local vertexCount = #(frameVertices[0]) - + local vertexCount = #(frameVertices[0]) + if time < frames[0] then local vertexAttachment = slotAttachment; if blend == MixBlend.setup then @@ -1054,7 +1054,7 @@ function Animation.EventTimeline.new (frameCount) events = {}, type = TimelineType.event } - + function self:getPropertyId () return TimelineType.event * SHL_24 end @@ -1111,7 +1111,7 @@ function Animation.DrawOrderTimeline.new (frameCount) drawOrders = {}, type = TimelineType.drawOrder } - + function self:getPropertyId () return TimelineType.drawOrder * SHL_24 end @@ -1134,9 +1134,9 @@ function Animation.DrawOrderTimeline.new (frameCount) end return; end - + local frames = self.frames - if time < frames[0] then + if time < frames[0] then if blend == MixBlend.setup or blend == MixBlend.first then for i,slot in ipairs(slots) do drawOrder[i] = slots[i] @@ -1179,13 +1179,13 @@ function Animation.IkConstraintTimeline.new (frameCount) local MIX = 1 local BEND_DIRECTION = 2 local COMPRESS = 3 - local STRETCH = 1 + local STRETCH = 4 local self = Animation.CurveTimeline.new(frameCount) self.frames = utils.newNumberArrayZero(frameCount * ENTRIES) -- time, mix, bendDirection, compress, stretch, ... self.ikConstraintIndex = -1 self.type = TimelineType.ikConstraint - + function self:getPropertyId () return TimelineType.ikConstraint * SHL_24 + self.ikConstraintIndex end @@ -1229,7 +1229,7 @@ function Animation.IkConstraintTimeline.new (frameCount) if time >= frames[zlen(frames) - ENTRIES] then -- Time is after last frame. if blend == MixBlend.setup then constraint.mix = constraint.data.mix + (frames[zlen(frames) + PREV_MIX] - constraint.data.mix) * alpha - if direction == MixDirection.out then + if direction == MixDirection.out then constraint.bendDirection = constraint.data.bendDirection constraint.compress = constraint.data.compress constraint.stretch = constraint.data.stretch @@ -1240,7 +1240,7 @@ function Animation.IkConstraintTimeline.new (frameCount) end else constraint.mix = constraint.mix + (frames[zlen(frames) + PREV_MIX] - constraint.mix) * alpha; - if direction == MixDirection._in then + if direction == MixDirection._in then constraint.bendDirection = math_floor(frames[zlen(frames) + PREV_BEND_DIRECTION]) if (math_floor(frames[zlen(frames) + PREV_COMPRESS]) == 1) then constraint.compress = true else constraint.compress = false end if (math_floor(frames[zlen(frames) + PREV_STRETCH]) == 1) then constraint.stretch = true else constraint.stretch = false end @@ -1269,7 +1269,7 @@ function Animation.IkConstraintTimeline.new (frameCount) end else constraint.mix = constraint.mix + (mix + (frames[frame + MIX] - mix) * percent - constraint.mix) * alpha; - if direction == MixDirection._in then + if direction == MixDirection._in then constraint.bendDirection = math_floor(frames[frame + PREV_BEND_DIRECTION]) if (math_floor(frames[frame + PREV_COMPRESS]) == 1) then constraint.compress = true else constraint.compress = false end if (math_floor(frames[frame + PREV_STRETCH]) == 1) then constraint.stretch = true else constraint.stretch = false end @@ -1298,7 +1298,7 @@ function Animation.TransformConstraintTimeline.new (frameCount) self.frames = utils.newNumberArrayZero(frameCount * ENTRIES) self.transformConstraintIndex = -1 self.type = TimelineType.transformConstraint - + function self:getPropertyId () return TimelineType.transformConstraint * SHL_24 + self.transformConstraintIndex end @@ -1404,7 +1404,7 @@ function Animation.PathConstraintPositionTimeline.new (frameCount) local constraint = skeleton.pathConstraints[self.pathConstraintIndex] if (time < frames[0]) then if blend == MixBlend.setup then - constraint.position = constraint.data.position + constraint.position = constraint.data.position elseif blend == MixBlend.first then constraint.position = constraint.position + (constraint.data.position - constraint.position) * alpha end @@ -1508,7 +1508,7 @@ function Animation.PathConstraintMixTimeline.new (frameCount) self.frames = utils.newNumberArrayZero(frameCount * ENTRIES) self.pathConstraintIndex = -1 self.type = TimelineType.pathConstraintMix - + function self:getPropertyId () return TimelineType.pathConstraintMix * SHL_24 + self.pathConstraintIndex end