From 48d2300b8a762f6fba1e6741c69e975b358bbc36 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 10 Nov 2011 20:26:14 +0100 Subject: [PATCH 1/2] Fix misaligned sit animation on scripted sit caused by the default sit animation being run after the scripted one. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 99be46d638..fc5141f8eb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2013,8 +2013,6 @@ namespace OpenSim.Region.Framework.Scenes sitOrientation = avSitOrientation; autopilot = false; } - part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); - pos = part.AbsolutePosition + offset; //if (Math.Abs(part.AbsolutePosition.Z - AbsolutePosition.Z) > 1) //{ @@ -2060,6 +2058,12 @@ namespace OpenSim.Region.Framework.Scenes m_sitAtAutoTarget = autopilot; if (!autopilot) HandleAgentSit(remoteClient, UUID); + + // Moved here to avoid a race with default sit anim + // The script event needs to be raised after the default sit anim is set. + if (part != null) + part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); + } // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) From 18c625bda669509fc9aae330703fe09ff7a6c72e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 10 Nov 2011 14:09:35 -0800 Subject: [PATCH 2/2] When updating SOG, a physics taint should not override a full update with a terse update --- .../Framework/Scenes/SceneObjectGroup.cs | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 339cf0f13e..f6bfc9ba79 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1731,18 +1731,23 @@ namespace OpenSim.Region.Framework.Scenes //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) // return; - bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); - - if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) + // If we somehow got here to updating the SOG and its root part is not scheduled for update, + // check to see if the physical position or rotation warrant an update. + if (m_rootPart.UpdateFlag == UpdateRequired.NONE) { - m_rootPart.UpdateFlag = UpdateRequired.TERSE; - lastPhysGroupPos = AbsolutePosition; - } + bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); - if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) - { - m_rootPart.UpdateFlag = UpdateRequired.TERSE; - lastPhysGroupRot = GroupRotation; + if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) + { + m_rootPart.UpdateFlag = UpdateRequired.TERSE; + lastPhysGroupPos = AbsolutePosition; + } + + if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) + { + m_rootPart.UpdateFlag = UpdateRequired.TERSE; + lastPhysGroupRot = GroupRotation; + } } SceneObjectPart[] parts = m_parts.GetArray();