From 8cdc115c91bd074539c5fbae719313d4dc616355 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Feb 2012 14:30:24 +0100 Subject: Fix deserialization of Buoyancy, Force and Torque. Remove debug from the new code. --- OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 1 - OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- .../Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 5 ----- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 5 files changed, 9 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 73db25b..7f651aa 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -245,7 +245,6 @@ namespace OpenSim.Region.Framework.Scenes } } - m_log.DebugFormat("[KEYFRAME]: Angle {0} aabb {1}", angle, aa_bb); k.AngularVelocity = (new Vector3(0, 0, 1) * (Quaternion)k.Rotation) * (angle / (k.TimeMS / 1000)); k.TimeTotal = k.TimeMS; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d488189..ac2fe82 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -896,6 +896,10 @@ namespace OpenSim.Region.Framework.Scenes ApplyPhysics(); if (RootPart.PhysActor != null) + RootPart.Force = RootPart.Force; + if (RootPart.PhysActor != null) + RootPart.Torque = RootPart.Torque; + if (RootPart.PhysActor != null) RootPart.Buoyancy = RootPart.Buoyancy; // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3ab7e5a..0728042 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1313,7 +1313,7 @@ namespace OpenSim.Region.Framework.Scenes } set { - if (ParentGroup.RootPart != this) + if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this) { ParentGroup.RootPart.Buoyancy = value; return; @@ -1336,7 +1336,7 @@ namespace OpenSim.Region.Framework.Scenes set { - if (ParentGroup.RootPart != this) + if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this) { ParentGroup.RootPart.Force = value; return; @@ -1359,7 +1359,7 @@ namespace OpenSim.Region.Framework.Scenes set { - if (ParentGroup.RootPart != this) + if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this) { ParentGroup.RootPart.Torque = value; return; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index a9f3e84..118a63a 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -246,14 +246,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); if (keymotion.Count > 0) - { - m_log.DebugFormat("[SERIALIZER]: Deserialized KeyframeMotion"); sceneObject.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText)); - } else - { sceneObject.KeyframeMotion = null; - } // Script state may, or may not, exist. Not having any, is NOT // ever a problem. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9090311..e4ab14f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2484,13 +2484,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llApplyRotationalImpulse(LSL_Vector force, int local) { m_host.AddScriptLPS(1); - m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); + m_host.ParentGroup.RootPart.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); } public void llSetTorque(LSL_Vector torque, int local) { m_host.AddScriptLPS(1); - m_host.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0); + m_host.ParentGroup.RootPart.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0); } public LSL_Vector llGetTorque() -- cgit v1.1