From 052e4a060ceed35eeda623cee9a9826cc1e7b8f8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 3 Dec 2019 14:27:31 +0000 Subject: mantis 8632: stop trigering Changed on just scale checks --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 65 ++++++++++++++++------ .../Shared/Api/Implementation/LSL_Api.cs | 7 ++- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6cbdc43..1942dfe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2313,15 +2313,7 @@ namespace OpenSim.Region.Framework.Scenes if (pa != null) { if (UsePhysics != pa.IsPhysical) - { - float minsize = UsePhysics ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; - float maxsize = UsePhysics ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; - Vector3 scale = Scale; - scale.X = Util.Clamp(scale.X, minsize, maxsize); - scale.Y = Util.Clamp(scale.Y, minsize, maxsize); - scale.Z = Util.Clamp(scale.Z, minsize, maxsize); - Scale = scale; - } + ClampScale(UsePhysics); if (UsePhysics != pa.IsPhysical || isNew) { @@ -3042,6 +3034,51 @@ namespace OpenSim.Region.Framework.Scenes Inventory.ResetInventoryIDs(); } + + private void ClampScale(bool isPhysical) + { + float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; + float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; + Vector3 scale = Scale; + bool changed = false; + + if (scale.X < minsize) + { + scale.X = minsize; + changed = true; + } + else if (scale.X > maxsize) + { + scale.X = maxsize; + changed = true; + } + + if (scale.Y < minsize) + { + scale.Y = minsize; + changed = true; + } + else if (scale.Y > maxsize) + { + scale.Y = maxsize; + changed = true; + } + + if (scale.Z < minsize) + { + scale.Z = minsize; + changed = true; + } + else if (scale.Z > maxsize) + { + scale.Z = maxsize; + changed = true; + } + + if (changed) + Scale = scale; + } + /// /// Set the scale of this part. /// @@ -4777,15 +4814,7 @@ namespace OpenSim.Region.Framework.Scenes private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics) { if (ParentGroup.Scene != null) - { - float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; - float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; - Vector3 scale = Scale; - scale.X = Util.Clamp(scale.X, minsize, maxsize); - scale.Y = Util.Clamp(scale.Y, minsize, maxsize); - scale.Z = Util.Clamp(scale.Z, minsize, maxsize); - Scale = scale; - } + ClampScale(isPhysical); PhysicsActor pa; Vector3 velocity = Velocity; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1591cb1..8815a28 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8912,6 +8912,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api elemLength = 3; List keyframes = new List(); + bool hasTranslation = (data & KeyframeMotion.DataFormat.Translation) != 0; + bool hasRotation = (data & KeyframeMotion.DataFormat.Rotation) != 0; while (idx < frames.Data.Length) { int remain = frames.Data.Length - idx; @@ -8923,16 +8925,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api frame.Position = null; frame.Rotation = null; - if ((data & KeyframeMotion.DataFormat.Translation) != 0) + if (hasTranslation) { LSL_Types.Vector3 tempv = frames.GetVector3Item(idx++); frame.Position = new Vector3((float)tempv.x, (float)tempv.y, (float)tempv.z); } - if ((data & KeyframeMotion.DataFormat.Rotation) != 0) + if (hasRotation) { LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++); Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s); - q.Normalize(); frame.Rotation = q; } -- cgit v1.1