From 9f9693dab825c7753af49c6838a484653047d4ae Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 3 May 2012 01:18:51 +0200 Subject: [PATCH 01/11] Clear permissions given to the object we stand up from --- OpenSim/Framework/ChildAgentDataUpdate.cs | 7 ++++- .../Region/Framework/Scenes/ScenePresence.cs | 26 ++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index fe128744bf..abff44a445 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -229,12 +229,14 @@ namespace OpenSim.Framework public class ControllerData { + public UUID ObjectID; public UUID ItemID; public uint IgnoreControls; public uint EventControls; - public ControllerData(UUID item, uint ignore, uint ev) + public ControllerData(UUID obj, UUID item, uint ignore, uint ev) { + ObjectID = obj; ItemID = item; IgnoreControls = ignore; EventControls = ev; @@ -248,6 +250,7 @@ namespace OpenSim.Framework public OSDMap PackUpdateMessage() { OSDMap controldata = new OSDMap(); + controldata["object"] = OSD.FromUUID(ObjectID); controldata["item"] = OSD.FromUUID(ItemID); controldata["ignore"] = OSD.FromInteger(IgnoreControls); controldata["event"] = OSD.FromInteger(EventControls); @@ -258,6 +261,8 @@ namespace OpenSim.Framework public void UnpackUpdateMessage(OSDMap args) { + if (args["object"] != null) + ObjectID = args["object"].AsUUID(); if (args["item"] != null) ItemID = args["item"].AsUUID(); if (args["ignore"] != null) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 80f21cea18..b0147f2939 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -62,6 +62,7 @@ namespace OpenSim.Region.Framework.Scenes struct ScriptControllers { + public UUID objectID; public UUID itemID; public ScriptControlled ignoreControls; public ScriptControlled eventControls; @@ -1890,6 +1891,8 @@ namespace OpenSim.Region.Framework.Scenes if (ParentID != 0) { SceneObjectPart part = ParentPart; + UnRegisterSeatControls(part.ParentGroup.UUID); + TaskInventoryDictionary taskIDict = part.TaskInventory; if (taskIDict != null) { @@ -3217,7 +3220,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScriptControllers c in scriptedcontrols.Values) { - controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); + controls[i++] = new ControllerData(c.objectID, c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); } cAgent.Controllers = controls; } @@ -3307,6 +3310,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (ControllerData c in cAgent.Controllers) { ScriptControllers sc = new ScriptControllers(); + sc.objectID = c.ObjectID; sc.itemID = c.ItemID; sc.ignoreControls = (ScriptControlled)c.IgnoreControls; sc.eventControls = (ScriptControlled)c.EventControls; @@ -3702,10 +3706,15 @@ namespace OpenSim.Region.Framework.Scenes public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) { + SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID); + if (p == null) + return; + ScriptControllers obj = new ScriptControllers(); obj.ignoreControls = ScriptControlled.CONTROL_ZERO; obj.eventControls = ScriptControlled.CONTROL_ZERO; + obj.objectID = p.ParentGroup.UUID; obj.itemID = Script_item_UUID; if (pass_on == 0 && accept == 0) { @@ -3754,6 +3763,21 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendTakeControls(int.MaxValue, false, false); } + private void UnRegisterSeatControls(UUID obj) + { + List takers = new List(); + + foreach (ScriptControllers c in scriptedcontrols.Values) + { + if (c.objectID == obj) + takers.Add(c.itemID); + } + foreach (UUID t in takers) + { + UnRegisterControlEventsToScript(0, t); + } + } + public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) { ScriptControllers takecontrols; From 2af7f50f26271129a2265f0cae7a5515cc7ba315 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 3 May 2012 02:07:55 +0200 Subject: [PATCH 02/11] Stabilize sit position on region crossing --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b0147f2939..7136cfcaef 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -756,7 +756,13 @@ namespace OpenSim.Region.Framework.Scenes m_movementAnimationUpdateCounter = 0; if (Animator != null) { - if(ParentID == 0 && !SitGround) // skip it if sitting + // If the parentID == 0 we are not sitting + // if !SitGournd then we are not sitting on the ground + // Fairly straightforward, now here comes the twist + // if ParentUUID is NOT UUID.Zero, we are looking to + // be sat on an object that isn't there yet. Should + // be treated as if sat. + if(ParentID == 0 && !SitGround && ParentUUID == UUID.Zero) // skip it if sitting Animator.UpdateMovementAnimations(); } else From 58a1a0710c971b83142bf21fa6259c95aa9d99dd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 4 May 2012 11:32:37 +0100 Subject: [PATCH 03/11] SOG copy bug fix, now new group has own empty list of sitted avatars. Also changed crossing code to restore sitting avas in case of group cross fail --- .../Framework/Scenes/SceneObjectGroup.cs | 62 ++++++++++++++++--- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8e1f447823..7e6b0777e2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -465,7 +465,15 @@ namespace OpenSim.Region.Framework.Scenes { return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); } - + + + + private struct avtocrossInfo + { + public ScenePresence av; + public uint ParentID; + } + /// /// The absolute position of this scene object in the scene /// @@ -517,15 +525,24 @@ namespace OpenSim.Region.Framework.Scenes { // We unparent the SP quietly so that it won't // be made to stand up + + List avsToCross = new List(); + foreach (ScenePresence av in m_linkedAvatars) { + avtocrossInfo avinfo = new avtocrossInfo(); SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID); if (parentPart != null) av.ParentUUID = parentPart.UUID; + avinfo.av = av; + avinfo.ParentID = av.ParentID; + avsToCross.Add(avinfo); + av.ParentID = 0; } +// m_linkedAvatars.Clear(); m_scene.CrossPrimGroupIntoNewRegion(val, this, true); // Normalize @@ -541,18 +558,37 @@ namespace OpenSim.Region.Framework.Scenes // If it's deleted, crossing was successful if (IsDeleted) { - foreach (ScenePresence av in m_linkedAvatars) + // foreach (ScenePresence av in m_linkedAvatars) + foreach (avtocrossInfo avinfo in avsToCross) { - m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); + ScenePresence av = avinfo.av; + if (!av.IsInTransit) // just in case... + { + m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); - av.IsInTransit = true; + av.IsInTransit = true; - CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; - d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); + CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; + d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); + } + else + m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val); } - + avsToCross.Clear(); return; } + else // cross failed, put avas back ?? + { + foreach (avtocrossInfo avinfo in avsToCross) + { + ScenePresence av = avinfo.av; + av.ParentUUID = UUID.Zero; + av.ParentID = avinfo.ParentID; +// m_linkedAvatars.Add(av); + } + } + avsToCross.Clear(); + } else if (RootPart.PhysActor != null) { @@ -565,6 +601,7 @@ namespace OpenSim.Region.Framework.Scenes val.Z = Util.Clamp(oldp.Z, 0.5f, 4096.0f); } } + /* don't see the need but worse don't see where is restored to false if things stay in foreach (SceneObjectPart part in m_parts.GetArray()) { @@ -640,9 +677,12 @@ namespace OpenSim.Region.Framework.Scenes { agent.ParentPart = null; agent.ParentPosition = Vector3.Zero; + // agent.ParentUUID = UUID.Zero; } } + agent.ParentUUID = UUID.Zero; + // agent.Reset(); // else // Not successful // agent.RestoreInCurrentScene(); @@ -1779,15 +1819,14 @@ namespace OpenSim.Region.Framework.Scenes part.ClearUpdateSchedule(); if (part == m_rootPart) { - if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || + if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || (AttachmentPoint < 31) || (AttachmentPoint > 38)) avatar.ControllingClient.SendKillObject(m_regionHandle, new List { part.LocalId }); } } }); } - - + } public void AddScriptLPS(int count) @@ -2069,6 +2108,9 @@ namespace OpenSim.Region.Framework.Scenes dupe.m_isBackedUp = false; dupe.m_parts = new MapAndArray(); + // new group as no sitting avatars + dupe.m_linkedAvatars = new List(); + // Warning, The following code related to previousAttachmentStatus is needed so that clones of // attachments do not bordercross while they're being duplicated. This is hacktastic! // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! From 12c9916193bbb87aaa95407f798c241cbe5e23cb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 4 May 2012 19:19:54 +0100 Subject: [PATCH 04/11] *TO TEST/REVIEW* added current default animation in animationSet.cs to/fromArray in array element 0. This may cause compatibilities issues, but think this information is needed for proper crossings. OSG regions did survived tps in/out with this. ALso added velocity in crossings cases, for now detected by Teleport flag equal to Default (0); --- .../Scenes/Animation/AnimationSet.cs | 13 ++++++++--- .../Region/Framework/Scenes/ScenePresence.cs | 23 +++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 33041e9ac7..da1b9e00b7 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -168,10 +168,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation public OpenSim.Framework.Animation[] ToArray() { - OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count]; + OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count + 1]; uint i = 0; try { + theArray[i++] = m_defaultAnimation; foreach (OpenSim.Framework.Animation anim in m_animations) theArray[i++] = anim; } @@ -184,8 +185,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation public void FromArray(OpenSim.Framework.Animation[] theArray) { - foreach (OpenSim.Framework.Animation anim in theArray) - m_animations.Add(anim); +// foreach (OpenSim.Framework.Animation anim in theArray) +// m_animations.Add(anim); + if (theArray.Length > 0) + { + m_defaultAnimation = theArray[0]; + for (int i = 1; i < theArray.Length; i++) + m_animations.Add(theArray[i]); + } } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7136cfcaef..991074b98e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -866,7 +866,7 @@ namespace OpenSim.Region.Framework.Scenes IsChildAgent = false; - Animator.TrySetMovementAnimation("SIT"); +// Animator.TryFixMovementAnimation("SIT"); } else { @@ -929,7 +929,15 @@ namespace OpenSim.Region.Framework.Scenes } AbsolutePosition = pos; - AddToPhysicalScene(isFlying); + if (m_teleportFlags == TeleportFlags.Default) + { + Vector3 vel = Velocity; + AddToPhysicalScene(isFlying); + if (PhysicsActor != null) + PhysicsActor.SetMomentum(vel); + } + else + AddToPhysicalScene(isFlying); if (ForceFly) { @@ -943,7 +951,8 @@ namespace OpenSim.Region.Framework.Scenes // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying // avatar to return to the standing position in mid-air. On login it looks like this is being sent // elsewhere anyway - // Animator.SendAnimPack(); +// Animator.SendAnimPack(); + m_scene.SwapRootAgentCount(false); @@ -980,6 +989,7 @@ namespace OpenSim.Region.Framework.Scenes // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will // stall on the border crossing since the existing child agent will still have the last movement // recorded, which stops the input from being processed. + MovementFlag = 0; m_scene.EventManager.TriggerOnMakeRootAgent(this); @@ -1020,6 +1030,8 @@ namespace OpenSim.Region.Framework.Scenes // as teleporting back TeleportFlags = TeleportFlags.Default; + MovementFlag = 0; + // It looks like Animator is set to null somewhere, and MakeChild // is called after that. Probably in aborted teleports. if (Animator == null) @@ -1027,6 +1039,7 @@ namespace OpenSim.Region.Framework.Scenes else Animator.ResetAnimations(); + // m_log.DebugFormat( // "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", // Name, UUID, m_scene.RegionInfo.RegionName); @@ -1053,9 +1066,9 @@ namespace OpenSim.Region.Framework.Scenes { // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; - m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); - PhysicsActor.UnSubscribeEvents(); PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; + PhysicsActor.UnSubscribeEvents(); + m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); PhysicsActor = null; } // else From 88c4c7283f7b867aa27b344061c7c9be965db9aa Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 4 May 2012 20:02:14 +0200 Subject: [PATCH 05/11] Revert "*TO TEST/REVIEW* added current default animation in animationSet.cs to/fromArray in array element 0. This may cause compatibilities issues, but think this information is needed for proper crossings. OSG regions did survived tps in/out with this. ALso added velocity in crossings cases, for now detected by Teleport flag equal to Default (0);" This reverts commit 12c9916193bbb87aaa95407f798c241cbe5e23cb. --- .../Scenes/Animation/AnimationSet.cs | 13 +++-------- .../Region/Framework/Scenes/ScenePresence.cs | 23 ++++--------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index da1b9e00b7..33041e9ac7 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -168,11 +168,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation public OpenSim.Framework.Animation[] ToArray() { - OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count + 1]; + OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count]; uint i = 0; try { - theArray[i++] = m_defaultAnimation; foreach (OpenSim.Framework.Animation anim in m_animations) theArray[i++] = anim; } @@ -185,14 +184,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation public void FromArray(OpenSim.Framework.Animation[] theArray) { -// foreach (OpenSim.Framework.Animation anim in theArray) -// m_animations.Add(anim); - if (theArray.Length > 0) - { - m_defaultAnimation = theArray[0]; - for (int i = 1; i < theArray.Length; i++) - m_animations.Add(theArray[i]); - } + foreach (OpenSim.Framework.Animation anim in theArray) + m_animations.Add(anim); } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 991074b98e..7136cfcaef 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -866,7 +866,7 @@ namespace OpenSim.Region.Framework.Scenes IsChildAgent = false; -// Animator.TryFixMovementAnimation("SIT"); + Animator.TrySetMovementAnimation("SIT"); } else { @@ -929,15 +929,7 @@ namespace OpenSim.Region.Framework.Scenes } AbsolutePosition = pos; - if (m_teleportFlags == TeleportFlags.Default) - { - Vector3 vel = Velocity; - AddToPhysicalScene(isFlying); - if (PhysicsActor != null) - PhysicsActor.SetMomentum(vel); - } - else - AddToPhysicalScene(isFlying); + AddToPhysicalScene(isFlying); if (ForceFly) { @@ -951,8 +943,7 @@ namespace OpenSim.Region.Framework.Scenes // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying // avatar to return to the standing position in mid-air. On login it looks like this is being sent // elsewhere anyway -// Animator.SendAnimPack(); - + // Animator.SendAnimPack(); m_scene.SwapRootAgentCount(false); @@ -989,7 +980,6 @@ namespace OpenSim.Region.Framework.Scenes // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will // stall on the border crossing since the existing child agent will still have the last movement // recorded, which stops the input from being processed. - MovementFlag = 0; m_scene.EventManager.TriggerOnMakeRootAgent(this); @@ -1030,8 +1020,6 @@ namespace OpenSim.Region.Framework.Scenes // as teleporting back TeleportFlags = TeleportFlags.Default; - MovementFlag = 0; - // It looks like Animator is set to null somewhere, and MakeChild // is called after that. Probably in aborted teleports. if (Animator == null) @@ -1039,7 +1027,6 @@ namespace OpenSim.Region.Framework.Scenes else Animator.ResetAnimations(); - // m_log.DebugFormat( // "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", // Name, UUID, m_scene.RegionInfo.RegionName); @@ -1066,9 +1053,9 @@ namespace OpenSim.Region.Framework.Scenes { // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; - PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; - PhysicsActor.UnSubscribeEvents(); m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); + PhysicsActor.UnSubscribeEvents(); + PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; PhysicsActor = null; } // else From 1183310a05ed3232c5b73374e72a6695517d63e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 4 May 2012 20:05:51 +0200 Subject: [PATCH 06/11] Retain velocity on walking crossing - adapted from Ubit's reverted patch --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7136cfcaef..43b87464d9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -929,7 +929,15 @@ namespace OpenSim.Region.Framework.Scenes } AbsolutePosition = pos; - AddToPhysicalScene(isFlying); + if (m_teleportFlags == TeleportFlags.Default) + { + Vector3 vel = Velocity; + AddToPhysicalScene(isFlying); + if (PhysicsActor != null) + PhysicsActor.SetMomentum(vel); + } + else + AddToPhysicalScene(isFlying); if (ForceFly) { @@ -980,6 +988,7 @@ namespace OpenSim.Region.Framework.Scenes // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will // stall on the border crossing since the existing child agent will still have the last movement // recorded, which stops the input from being processed. + MovementFlag = 0; m_scene.EventManager.TriggerOnMakeRootAgent(this); @@ -1020,6 +1029,8 @@ namespace OpenSim.Region.Framework.Scenes // as teleporting back TeleportFlags = TeleportFlags.Default; + MovementFlag = 0; + // It looks like Animator is set to null somewhere, and MakeChild // is called after that. Probably in aborted teleports. if (Animator == null) @@ -1027,6 +1038,7 @@ namespace OpenSim.Region.Framework.Scenes else Animator.ResetAnimations(); + // m_log.DebugFormat( // "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", // Name, UUID, m_scene.RegionInfo.RegionName); From b5b21013da0663db2aacac3c2361e9904bb7a457 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 4 May 2012 20:06:42 +0200 Subject: [PATCH 07/11] Reverse the order of physics event unsubscription to allow GC. Adapted from Unit's reverted patch --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 43b87464d9..ad6679e9f8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1065,9 +1065,9 @@ namespace OpenSim.Region.Framework.Scenes { // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; - m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); - PhysicsActor.UnSubscribeEvents(); PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; + PhysicsActor.UnSubscribeEvents(); + m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); PhysicsActor = null; } // else From 333d013b5c34d7ed8c016251e50b80b62500aa3f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 4 May 2012 20:33:48 +0200 Subject: [PATCH 08/11] Add the default animation to the child agent data update --- OpenSim/Framework/ChildAgentDataUpdate.cs | 11 +++++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +++ 2 files changed, 14 insertions(+) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index abff44a445..7962ff482e 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -311,6 +311,7 @@ namespace OpenSim.Framework public AgentGroupData[] Groups; public Animation[] Anims; + public Animation DefaultAnim = null; public UUID GranterID; public UUID ParentPart; @@ -397,6 +398,11 @@ namespace OpenSim.Framework args["animations"] = anims; } + if (DefaultAnim != null) + { + args["default_animation"] = DefaultAnim.PackUpdateMessage(); + } + if (Appearance != null) args["packed_appearance"] = Appearance.Pack(); @@ -594,6 +600,11 @@ namespace OpenSim.Framework } } + if (args["default_animation"] != null) + { + DefaultAnim = new Animation((OSDMap)args["default_animation"]); + } + //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) //{ // OSDArray textures = (OSDArray)(args["agent_textures"]); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ad6679e9f8..212720e62b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3249,6 +3249,7 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Anims = Animator.Animations.ToArray(); } catch { } + cAgent.DefaultAnim = Animator.Animations.DefaultAnimation; // Attachment objects List attachments = GetAttachments(); @@ -3343,6 +3344,8 @@ namespace OpenSim.Region.Framework.Scenes // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? if (cAgent.Anims != null) Animator.Animations.FromArray(cAgent.Anims); + if (cAgent.DefaultAnim != null) + Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) { From 197163e12a265af66a9393bc6753c7a50520c5b1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 4 May 2012 21:00:41 +0200 Subject: [PATCH 09/11] Fix teleporting from older to newer regions --- OpenSim/Framework/ChildAgentDataUpdate.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 7962ff482e..e718aa6c47 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -602,7 +602,14 @@ namespace OpenSim.Framework if (args["default_animation"] != null) { - DefaultAnim = new Animation((OSDMap)args["default_animation"]); + try + { + DefaultAnim = new Animation((OSDMap)args["default_animation"]); + } + catch + { + DefaultAnim = null; + } } //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) From 6b3135aa4dcdcd469054ed0af5eba3b30ae5cd3c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 4 May 2012 22:24:04 +0100 Subject: [PATCH 10/11] UbitODE: leave avatar 'freemove' state (entered on setmomentum) on any significant change like new 'velocity' or new position, etc, requests --- OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 326fe97a77..672b9e0175 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -1184,7 +1184,7 @@ namespace OpenSim.Region.Physics.OdePlugin // destroy avatar capsule and related ODE data AvatarGeomAndBodyDestroy(); } - + m_freemove = false; m_isPhysical = NewStatus; } } @@ -1236,7 +1236,7 @@ namespace OpenSim.Region.Physics.OdePlugin + (Amotor == IntPtr.Zero ? "Amotor " : "")); } } - + m_freemove = false; m_pidControllerActive = true; } else @@ -1250,6 +1250,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (Body != IntPtr.Zero) d.BodySetPosition(Body, newPos.X, newPos.Y, newPos.Z); _position = newPos; + m_freemove = false; m_pidControllerActive = true; } @@ -1260,6 +1261,7 @@ namespace OpenSim.Region.Physics.OdePlugin private void changeVelocity(Vector3 newVel) { m_pidControllerActive = true; + m_freemove = false; _target_velocity = newVel; } From 163a86517ada9ae7f9f1c161192682e02e287e45 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 5 May 2012 03:28:35 +0100 Subject: [PATCH 11/11] force lower avatar density for testing --- OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 672b9e0175..b884b623b7 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -168,6 +168,10 @@ namespace OpenSim.Region.Physics.OdePlugin m_density = density; m_mass = 80f; // sure we have a default + // force lower density for testing + m_density = 3.0f; + + mu = parent_scene.AvatarFriction; walkDivisor = walk_divisor;