From 70953dbfcdf70b24fb939252775fa5e2a7ac2316 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Sep 2014 00:34:39 +0100 Subject: [PATCH] Fix issues where setting llSetTextureAnim(FALSE... did not work properly). I ended up amalgamating patches from http://opensimulator.org/mantis/view.php?id=7313 and http://opensimulator.org/mantis/view.php?id=7318 Thanks a lot to both bobshaffer2 and cinderblocks. --- .../Framework/Scenes/SceneObjectPart.cs | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8785ca97d8..c587b2aff4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1589,20 +1589,29 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - byte[] data = new byte[16]; - int pos = 0; + byte[] data; - // The flags don't like conversion from uint to byte, so we have to do - // it the crappy way. See the above function :( + if (pTexAnim.Flags == Primitive.TextureAnimMode.ANIM_OFF) + { + data = Utils.EmptyBytes; + } + else + { + data = new byte[16]; + int pos = 0; - data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; - data[pos] = (byte)pTexAnim.Face; pos++; - data[pos] = (byte)pTexAnim.SizeX; pos++; - data[pos] = (byte)pTexAnim.SizeY; pos++; + // The flags don't like conversion from uint to byte, so we have to do + // it the crappy way. See the above function :( - Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); - Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); - Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); + data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; + data[pos] = (byte)pTexAnim.Face; pos++; + data[pos] = (byte)pTexAnim.SizeX; pos++; + data[pos] = (byte)pTexAnim.SizeY; pos++; + + Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); + Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); + Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); + } m_TextureAnimation = data; }