From 937c06db54f8152486d37a4ba604ffb3bcdccbb4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Dec 2011 21:57:22 +0000 Subject: Code cleanup related to ScenePresence.PhysicsActor and OdeScene/OdeCharacter Stop hiding RemoveAvatar failure, add log messages when characters are removed through defects or re-added unexpectedly. Add commented out log lines for future use. Use automatic property for PhysicsActor for better code readability and simplicity --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 59 +++++++++++++----------- 1 file changed, 32 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index beff239..6f5b6fe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -285,16 +285,10 @@ namespace OpenSim.Region.Framework.Scenes #region Properties - protected PhysicsActor m_physicsActor; - /// /// Physical scene representation of this Avatar. /// - public PhysicsActor PhysicsActor - { - set { m_physicsActor = value; } - get { return m_physicsActor; } - } + public PhysicsActor PhysicsActor { get; private set; } private byte m_movementflag; @@ -1032,18 +1026,19 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysicsActor != null) { - try - { - PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; - PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; - m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); - PhysicsActor.UnSubscribeEvents(); - PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; - PhysicsActor = null; - } - catch - { } +// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; + PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; + m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); + PhysicsActor.UnSubscribeEvents(); + PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; + PhysicsActor = null; } +// else +// { +// m_log.ErrorFormat( +// "[SCENE PRESENCE]: Attempt to remove physics actor for {0} on {1} but this scene presence has no physics actor", +// Name, Scene.RegionInfo.RegionName); +// } } /// @@ -1925,7 +1920,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); if (PhysicsActor != null) - m_sitAvatarHeight = m_physicsActor.Size.Z; + m_sitAvatarHeight = PhysicsActor.Size.Z; bool canSit = false; pos = part.AbsolutePosition + offset; @@ -2570,7 +2565,10 @@ namespace OpenSim.Region.Framework.Scenes // only send update from root agents to other clients; children are only "listening posts" if (IsChildAgent) { - m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); + m_log.WarnFormat( + "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", + Name, Scene.RegionInfo.RegionName); + return; } @@ -2628,7 +2626,10 @@ namespace OpenSim.Region.Framework.Scenes // only send update from root agents to other clients; children are only "listening posts" if (IsChildAgent) { - m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); + m_log.WarnFormat( + "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", + Name, Scene.RegionInfo.RegionName); + return; } @@ -3039,8 +3040,6 @@ namespace OpenSim.Region.Framework.Scenes CameraPosition = cAgentData.Center + offset; - //SetHeight(cAgentData.AVHeight); - if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); @@ -3251,6 +3250,13 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", // Name, isFlying, Scene.RegionInfo.RegionName); + if (PhysicsActor != null) + { + m_log.ErrorFormat( + "[SCENE PRESENCE]: Adding physics actor for {0} to {1} but this scene presence already has a physics actor", + Name, Scene.RegionInfo.RegionName); + } + if (Appearance.AvatarHeight == 0) Appearance.SetHeight(); @@ -3258,11 +3264,10 @@ namespace OpenSim.Region.Framework.Scenes Vector3 pVec = AbsolutePosition; - // Old bug where the height was in centimeters instead of meters - PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, - new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); + PhysicsActor = scene.AddAvatar( + LocalId, Firstname + "." + Lastname, pVec, + new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); - scene.AddPhysicsActorTaint(PhysicsActor); //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong -- cgit v1.1 From c0ba99e5ada0b734b932091befce69dbd53d149a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Dec 2011 22:29:36 +0000 Subject: Stop having to call SetHeight again in ScenePresence.AddToPhysicalScene() when we've already passed size information to the avatar at PhysicsScene.AddAvatar() Eliminate some copypasta for height setting in OdeCharacter --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6f5b6fe..ac58dae 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1149,13 +1149,11 @@ namespace OpenSim.Region.Framework.Scenes /// /// Sets avatar height in the physics plugin /// + /// New height of avatar public void SetHeight(float height) { if (PhysicsActor != null && !IsChildAgent) - { - Vector3 SetSize = new Vector3(0.45f, 0.6f, height); - PhysicsActor.Size = SetSize; - } + PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); } /// @@ -3273,8 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong PhysicsActor.SubscribeEvents(500); PhysicsActor.LocalID = LocalId; - - SetHeight(Appearance.AvatarHeight); } private void OutOfBoundsCall(Vector3 pos) -- cgit v1.1 From 3bf699ad36081c9c53ee6845a5c85a3a1856b923 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 16 Dec 2011 08:59:33 -0800 Subject: No functional changes. Changed the prefix of that log message [CONNECTION BEGIN] to [SCENE] because that's where the message happens. Also changed the instantiation of a vector object to be done only once instead of every time we receive a position update. --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++------ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4ab6fe4..b43b227 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2512,7 +2512,7 @@ namespace OpenSim.Region.Framework.Scenes if (sp == null) { m_log.DebugFormat( - "[SCENE]: Adding new child scene presence {0} to scene {1}", client.Name, RegionInfo.RegionName); + "[SCENE]: Adding new child scene presence {0} to scene {1} at pos {2}", client.Name, RegionInfo.RegionName, client.StartPos); m_clientManager.Add(client); SubscribeToClientEvents(client); @@ -3249,9 +3249,9 @@ namespace OpenSim.Region.Framework.Scenes // Don't disable this log message - it's too helpful m_log.DebugFormat( - "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", + "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6}, position {7})", RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, - agent.AgentID, agent.circuitcode, teleportFlags); + agent.AgentID, agent.circuitcode, teleportFlags, agent.startpos); if (LoginsDisabled) { @@ -3294,7 +3294,7 @@ namespace OpenSim.Region.Framework.Scenes catch (Exception e) { m_log.ErrorFormat( - "[CONNECTION BEGIN]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); + "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); return false; } } @@ -3307,12 +3307,12 @@ namespace OpenSim.Region.Framework.Scenes catch (Exception e) { m_log.ErrorFormat( - "[CONNECTION BEGIN]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); + "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); return false; } m_log.InfoFormat( - "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", + "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ac58dae..800b7e0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -502,9 +502,9 @@ namespace OpenSim.Region.Framework.Scenes { m_pos = PhysicsActor.Position; -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", -// m_pos, Name, Scene.RegionInfo.RegionName); + //m_log.DebugFormat( + // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", + // m_pos, Name, Scene.RegionInfo.RegionName); } else { @@ -534,7 +534,6 @@ namespace OpenSim.Region.Framework.Scenes } } } - return m_pos; } set @@ -554,9 +553,9 @@ namespace OpenSim.Region.Framework.Scenes m_pos = value; ParentPosition = Vector3.Zero; -// m_log.DebugFormat( -// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", -// Scene.RegionInfo.RegionName, Name, m_pos); + //m_log.DebugFormat( + // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", + // Scene.RegionInfo.RegionName, Name, m_pos); } } @@ -3006,6 +3005,7 @@ namespace OpenSim.Region.Framework.Scenes CopyFrom(cAgentData); } + private static Vector3 marker = new Vector3(-1f, -1f, -1f); /// /// This updates important decision making data about a child agent /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region @@ -3026,8 +3026,8 @@ namespace OpenSim.Region.Framework.Scenes // region's draw distance. // DrawDistance = cAgentData.Far; DrawDistance = Scene.DefaultDrawDistance; - - if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! + + if (cAgentData.Position != marker) // UGH!! m_pos = cAgentData.Position + offset; if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance) -- cgit v1.1 From 5c4056660fe7678315716e52cfe57da0ba448efe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Dec 2011 21:16:01 +0000 Subject: Don't pass on ChaneWaterHeight event from EventManager is new water height is less than 0 This is to stop bad values and subsequent viewer crashes. Thanks to Michelle Argus for this patch. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4a4d98f..4f71915 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -1564,6 +1564,12 @@ namespace OpenSim.Region.Framework.Scenes public void TriggerRequestChangeWaterHeight(float height) { + if (height < 0) + { + // ignore negative water height + return; + } + RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; if (handlerRequestChangeWaterHeight != null) { -- cgit v1.1 From a3a17e929e7a39566a677672572433fe35d25849 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Dec 2011 23:20:12 +0000 Subject: Stop generating client flags when we send out full object updates. These were entirely unused. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 5 ++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 26 +++++++--------------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ----- 3 files changed, 10 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f9e0b83..20ef8c9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1377,15 +1377,14 @@ namespace OpenSim.Region.Framework.Scenes // Used when the client initially connects and when client sends RequestPrim packet public void SendFullUpdateToClient(IClientAPI remoteClient) { - RootPart.SendFullUpdate( - remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); + RootPart.SendFullUpdate(remoteClient); SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; if (part != RootPart) - part.SendFullUpdate(remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID)); + part.SendFullUpdate(remoteClient); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f5a00d7..598b310 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2836,8 +2836,7 @@ namespace OpenSim.Region.Framework.Scenes /// Send a full update to the client for the given part /// /// - /// - protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) + protected internal void SendFullUpdate(IClientAPI remoteClient) { if (ParentGroup == null) return; @@ -2849,16 +2848,16 @@ namespace OpenSim.Region.Framework.Scenes { if (ParentGroup.IsAttachment) { - SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags); + SendFullUpdateToClient(remoteClient, AttachedPos); } else { - SendFullUpdateToClient(remoteClient, AbsolutePosition, clientFlags); + SendFullUpdateToClient(remoteClient, AbsolutePosition); } } else { - SendFullUpdateToClient(remoteClient, clientFlags); + SendFullUpdateToClient(remoteClient); } } @@ -2872,7 +2871,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) { - SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID)); + SendFullUpdate(avatar.ControllingClient); }); } @@ -2880,12 +2879,9 @@ namespace OpenSim.Region.Framework.Scenes /// Sends a full update to the client /// /// - /// - public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags) + public void SendFullUpdateToClient(IClientAPI remoteClient) { - Vector3 lPos; - lPos = OffsetPosition; - SendFullUpdateToClient(remoteClient, lPos, clientflags); + SendFullUpdateToClient(remoteClient, OffsetPosition); } /// @@ -2893,8 +2889,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - /// - public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags) + public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos) { if (ParentGroup == null) return; @@ -2911,15 +2906,10 @@ namespace OpenSim.Region.Framework.Scenes (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38)) return; - clientFlags &= ~(uint) PrimFlags.CreateSelected; - if (remoteClient.AgentId == OwnerID) { if ((Flags & PrimFlags.CreateSelected) != 0) - { - clientFlags |= (uint) PrimFlags.CreateSelected; Flags &= ~PrimFlags.CreateSelected; - } } //bool isattachment = IsAttachment; //if (LocalId != ParentGroup.RootPart.LocalId) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 800b7e0..7be95cd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -784,7 +784,6 @@ namespace OpenSim.Region.Framework.Scenes public void RegisterToEvents() { ControllingClient.OnCompleteMovementToRegion += CompleteMovement; - //ControllingClient.OnCompleteMovementToRegion += SendInitialData; ControllingClient.OnAgentUpdate += HandleAgentUpdate; ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; ControllingClient.OnAgentSit += HandleAgentSit; @@ -832,11 +831,6 @@ namespace OpenSim.Region.Framework.Scenes #endregion - public uint GenerateClientFlags(UUID ObjectID) - { - return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID); - } - #region Status Methods /// -- cgit v1.1 From 1bf05fbb1f8cc4832d8c8963556d8082181f810a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 17 Dec 2011 00:11:17 +0000 Subject: refactor: simplify methods in Scene.PacketHandlers.cs by using GetGroupByPrim() rather than retrieving GetEntities() and inspecting the entire list --- .../Framework/Scenes/Scene.PacketHandlers.cs | 209 +++++++-------------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 14 +- 2 files changed, 81 insertions(+), 142 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 6ba74c7..f9d0e0a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -116,18 +116,10 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestPrim(uint primLocalID, IClientAPI remoteClient) { - EntityBase[] entityList = GetEntities(); - foreach (EntityBase ent in entityList) - { - if (ent is SceneObjectGroup) - { - if (((SceneObjectGroup)ent).LocalId == primLocalID) - { - ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient); - return; - } - } - } + SceneObjectGroup sog = GetGroupByPrim(primLocalID); + + if (sog != null) + sog.SendFullUpdateToClient(remoteClient); } /// @@ -137,47 +129,28 @@ namespace OpenSim.Region.Framework.Scenes /// public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { - EntityBase[] entityList = GetEntities(); - foreach (EntityBase ent in entityList) + SceneObjectPart part = GetSceneObjectPart(primLocalID); + + if (null == part) + return; + + if (part.IsRoot) { - if (ent is SceneObjectGroup) + SceneObjectGroup sog = part.ParentGroup; + sog.SendPropertiesToClient(remoteClient); + sog.IsSelected = true; + + // A prim is only tainted if it's allowed to be edited by the person clicking it. + if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) + || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) { - if (((SceneObjectGroup) ent).LocalId == primLocalID) - { - ((SceneObjectGroup) ent).SendPropertiesToClient(remoteClient); - ((SceneObjectGroup) ent).IsSelected = true; - // A prim is only tainted if it's allowed to be edited by the person clicking it. - if (Permissions.CanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) - || Permissions.CanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) - { - EventManager.TriggerParcelPrimCountTainted(); - } - break; - } - else - { - // We also need to check the children of this prim as they - // can be selected as well and send property information - bool foundPrim = false; - - SceneObjectGroup sog = ent as SceneObjectGroup; - - SceneObjectPart[] partList = sog.Parts; - foreach (SceneObjectPart part in partList) - { - if (part.LocalId == primLocalID) - { - part.SendPropertiesToClient(remoteClient); - foundPrim = true; - break; - } - } - - if (foundPrim) - break; - } + EventManager.TriggerParcelPrimCountTainted(); } } + else + { + part.SendPropertiesToClient(remoteClient); + } } /// @@ -250,121 +223,81 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List surfaceArgs) { - EntityBase[] EntityList = GetEntities(); + SceneObjectPart part = GetSceneObjectPart(localID); + + if (part == null) + return; + + SceneObjectGroup obj = part.ParentGroup; SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) surfaceArg = surfaceArgs[0]; - foreach (EntityBase ent in EntityList) + // Currently only grab/touch for the single prim + // the client handles rez correctly + obj.ObjectGrabHandler(localID, offsetPos, remoteClient); + + // If the touched prim handles touches, deliver it + // If not, deliver to root prim + if ((part.ScriptEvents & scriptEvents.touch_start) != 0) + EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); + + // Deliver to the root prim if the touched prim doesn't handle touches + // or if we're meant to pass on touches anyway. Don't send to root prim + // if prim touched is the root prim as we just did it + if (((part.ScriptEvents & scriptEvents.touch_start) == 0) || + (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) { - if (ent is SceneObjectGroup) - { - SceneObjectGroup obj = ent as SceneObjectGroup; - if (obj != null) - { - // Is this prim part of the group - if (obj.HasChildPrim(localID)) - { - // Currently only grab/touch for the single prim - // the client handles rez correctly - obj.ObjectGrabHandler(localID, offsetPos, remoteClient); - - SceneObjectPart part = obj.GetChildPart(localID); - - // If the touched prim handles touches, deliver it - // If not, deliver to root prim - if ((part.ScriptEvents & scriptEvents.touch_start) != 0) - EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); - // Deliver to the root prim if the touched prim doesn't handle touches - // or if we're meant to pass on touches anyway. Don't send to root prim - // if prim touched is the root prim as we just did it - if (((part.ScriptEvents & scriptEvents.touch_start) == 0) || - (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) - { - EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); - } - - return; - } - } - } + EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); } } - public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs) + public virtual void ProcessObjectGrabUpdate( + UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs) { - EntityBase[] EntityList = GetEntities(); + SceneObjectPart part = GetSceneObjectPart(objectID); + if (part == null) + return; + + SceneObjectGroup obj = part.ParentGroup; SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) surfaceArg = surfaceArgs[0]; - foreach (EntityBase ent in EntityList) + // If the touched prim handles touches, deliver it + // If not, deliver to root prim + if ((part.ScriptEvents & scriptEvents.touch) != 0) + EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); + // Deliver to the root prim if the touched prim doesn't handle touches + // or if we're meant to pass on touches anyway. Don't send to root prim + // if prim touched is the root prim as we just did it + if (((part.ScriptEvents & scriptEvents.touch) == 0) || + (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) { - if (ent is SceneObjectGroup) - { - SceneObjectGroup obj = ent as SceneObjectGroup; - if (obj != null) - { - // Is this prim part of the group - if (obj.HasChildPrim(objectID)) - { - SceneObjectPart part = obj.GetChildPart(objectID); - - // If the touched prim handles touches, deliver it - // If not, deliver to root prim - if ((part.ScriptEvents & scriptEvents.touch) != 0) - EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); - // Deliver to the root prim if the touched prim doesn't handle touches - // or if we're meant to pass on touches anyway. Don't send to root prim - // if prim touched is the root prim as we just did it - if (((part.ScriptEvents & scriptEvents.touch) == 0) || - (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) - { - EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); - } - - return; - } - } - } + EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); } } public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs) { - EntityBase[] EntityList = GetEntities(); + SceneObjectPart part = GetSceneObjectPart(localID); + if (part == null) + return; + + SceneObjectGroup obj = part.ParentGroup; SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) surfaceArg = surfaceArgs[0]; - foreach (EntityBase ent in EntityList) - { - if (ent is SceneObjectGroup) - { - SceneObjectGroup obj = ent as SceneObjectGroup; - - // Is this prim part of the group - if (obj.HasChildPrim(localID)) - { - SceneObjectPart part=obj.GetChildPart(localID); - if (part != null) - { - // If the touched prim handles touches, deliver it - // If not, deliver to root prim - if ((part.ScriptEvents & scriptEvents.touch_end) != 0) - EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg); - else - EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); - - return; - } - return; - } - } - } + // If the touched prim handles touches, deliver it + // If not, deliver to root prim + if ((part.ScriptEvents & scriptEvents.touch_end) != 0) + EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg); + else + EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); } public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 20ef8c9..7bf8c34 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1373,8 +1373,13 @@ namespace OpenSim.Region.Framework.Scenes #endregion - // Send the parts of this SOG to a single client - // Used when the client initially connects and when client sends RequestPrim packet + /// + /// Send the parts of this SOG to a single client + /// + /// + /// Used when the client initially connects and when client sends RequestPrim packet + /// + /// public void SendFullUpdateToClient(IClientAPI remoteClient) { RootPart.SendFullUpdate(remoteClient); @@ -1678,10 +1683,11 @@ namespace OpenSim.Region.Framework.Scenes /// /// Reset the UUIDs for all the prims that make up this group. - /// + /// + /// /// This is called by methods which want to add a new group to an existing scene, in order /// to ensure that there are no clashes with groups already present. - /// + /// public void ResetIDs() { lock (m_parts.SyncRoot) -- cgit v1.1 From 964ec57ffe5ce2e9feac4295ade9cc4a5a223d69 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 16 Dec 2011 17:24:50 -0800 Subject: Changed the async approach on close child agents. This may improve crossings a little bit. --- OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 9 +++------ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++++- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index d76ed3e..58a7b20 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -204,13 +204,10 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendCloseChildAgentConnections(UUID agentID, List regionslst) { - Util.FireAndForget(delegate + foreach (ulong handle in regionslst) { - foreach (ulong handle in regionslst) - { - SendCloseChildAgent(agentID, handle); - } - }); + SendCloseChildAgent(agentID, handle); + } } public List RequestNamedRegions(string name, int maxNumber) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 800b7e0..b16eaba 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2955,7 +2955,10 @@ namespace OpenSim.Region.Framework.Scenes if (byebyeRegions.Count > 0) { m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); - m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); + Util.FireAndForget(delegate + { + m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); + }); } foreach (ulong handle in byebyeRegions) -- cgit v1.1 From f9137c923bcdc952efe37c7dd328c2d0d8323317 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 17 Dec 2011 02:23:24 +0000 Subject: Fix bug where objects could not be set to a new group if the group had been created in that client session, or if no other action has been performed on the object. There were two problems here: 1) On object group update, we looked for the group is the IClientAPI group cache rather than in the groups service. This fails to groups created newly in that session 2) On object group update, we weren't setting the HasGroupChanged flag. This meant that the change was not persisted unless some other action set this flag. This commit fixes these issues and hopefully addresses http://opensimulator.org/mantis/view.php?id=5588 This commit also moves HandleObjectGroupUpdate() to the GroupsModule from the Scene.PacketHandlers.cs file --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +--- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 14 -------------- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 ++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++++ 4 files changed, 8 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b43b227..4914d65 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2776,7 +2776,6 @@ namespace OpenSim.Region.Framework.Scenes public virtual void SubscribeToClientParcelEvents(IClientAPI client) { - client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate; client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime; client.OnParcelBuy += ProcessParcelBuy; @@ -2903,7 +2902,6 @@ namespace OpenSim.Region.Framework.Scenes public virtual void UnSubscribeToClientParcelEvents(IClientAPI client) { - client.OnObjectGroupRequest -= m_sceneGraph.HandleObjectGroupUpdate; client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel; client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime; client.OnParcelBuy -= ProcessParcelBuy; @@ -4287,7 +4285,7 @@ namespace OpenSim.Region.Framework.Scenes /// Get a scene object group that contains the prim with the given local id /// /// - /// null if no scene object group containing that prim is found + /// null if no scene object group containing that prim is found public SceneObjectGroup GetGroupByPrim(uint localID) { return m_sceneGraph.GetGroupByPrim(localID); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index af95c28..a3e4b46 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -575,20 +575,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected internal void HandleObjectGroupUpdate( - IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage) - { - if (!remoteClient.IsGroupMember(GroupID)) - return; - - SceneObjectGroup group = GetGroupByPrim(objectLocalID); - if (group != null) - { - if (group.OwnerID == remoteClient.AgentId) - group.SetGroup(GroupID, remoteClient); - } - } - protected internal ScenePresence CreateAndAddChildScenePresence( IClientAPI client, AvatarAppearance appearance, PresenceType type) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7bf8c34..abea788 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3211,6 +3211,8 @@ namespace OpenSim.Region.Framework.Scenes part.Inventory.ChangeInventoryGroup(GroupID); } + HasGroupChanged = true; + // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled // for the same object with very different properties. The caller must schedule the update. //ScheduleGroupForFullUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 598b310..b29ecc6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3344,6 +3344,11 @@ namespace OpenSim.Region.Framework.Scenes public void SetGroup(UUID groupID, IClientAPI client) { + // Scene.AddNewPrims() calls with client == null so can't use this. +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Setting group for {0} to {1} for {2}", +// Name, groupID, OwnerID); + GroupID = groupID; if (client != null) SendPropertiesToClient(client); -- cgit v1.1 From 0b91ec8dd2b78461cb0fcdec567a83e88a76ac87 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 18:58:05 +0000 Subject: Migrate detailed "appearance show" report generation up to AvatarFactoryModule from AppearanceInfoModule so that it can be used in debug (inactive). Further filters "debug packet " to exclused [Request]ObjectPropertiesFamily if level is below 25. Adjust some method doc Minor changes to some logging messages. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7be95cd..f2e2ce7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2667,7 +2667,7 @@ namespace OpenSim.Region.Framework.Scenes public void SendAppearanceToAgent(ScenePresence avatar) { // m_log.DebugFormat( -// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); +// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); avatar.ControllingClient.SendAppearance( UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); -- cgit v1.1 From 92039f295d7fe66bf1a09b29483f9057e395839e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 20:13:48 +0000 Subject: Stop sending the viewer its own AvatarAppearance packet. The viewer warns in the log if it receives this. Stopping this doesn't appear to have adverse effects on viewer 1 or viewer 3 - the viewer gets its own appearance from body parts/clothes and self-baked textures. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f2e2ce7..9cad3fe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2532,7 +2532,10 @@ namespace OpenSim.Region.Framework.Scenes // again here... this comes after the cached appearance check because the avatars // appearance goes into the avatar update packet SendAvatarDataToAllAgents(); - SendAppearanceToAgent(this); + + // Sending us our own appearance does not seem to be necessary, and the viewer warns in the log if you do + // this. +// SendAppearanceToAgent(this); // If we are using the the cached appearance then send it out to everyone if (cachedappearance) -- cgit v1.1 From 87a2d8d51b66db12a487014deb8447fb2432e2a3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 23:03:45 +0000 Subject: Move HandleObjectGroupUpdate() from GroupsModule to Scene.PacketHandlers.cs as this is updating SOG/SOP.GroupID, which is arguably generic. --- .../Framework/Scenes/Scene.PacketHandlers.cs | 39 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 11 +++--- 2 files changed, 44 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index f9d0e0a..3355ebe 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -154,6 +154,45 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Handle the update of an object's user group. + /// + /// + /// + /// + /// + private void HandleObjectGroupUpdate( + IClientAPI remoteClient, UUID groupID, uint objectLocalID, UUID Garbage) + { + if (m_groupsModule == null) + return; + + // XXX: Might be better to get rid of this special casing and have GetMembershipData return something + // reasonable for a UUID.Zero group. + if (groupID != UUID.Zero) + { + GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, remoteClient.AgentId); + + if (gmd == null) + { +// m_log.WarnFormat( +// "[GROUPS]: User {0} is not a member of group {1} so they can't update {2} to this group", +// remoteClient.Name, GroupID, objectLocalID); + + return; + } + } + + SceneObjectGroup so = ((Scene)remoteClient.Scene).GetGroupByPrim(objectLocalID); + if (so != null) + { + if (so.OwnerID == remoteClient.AgentId) + { + so.SetGroup(groupID, remoteClient); + } + } + } + + /// /// Handle the deselection of a prim from the client. /// /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4914d65..6666328 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -139,6 +139,7 @@ namespace OpenSim.Region.Framework.Scenes protected IDialogModule m_dialogModule; protected IEntityTransferModule m_teleportModule; protected ICapabilitiesModule m_capsModule; + protected IGroupsModule m_groupsModule; /// /// Current scene frame number @@ -1164,6 +1165,7 @@ namespace OpenSim.Region.Framework.Scenes m_dialogModule = RequestModuleInterface(); m_capsModule = RequestModuleInterface(); m_teleportModule = RequestModuleInterface(); + m_groupsModule = RequestModuleInterface(); } #endregion @@ -2733,6 +2735,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnObjectDescription += m_sceneGraph.PrimDescription; client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner += ObjectOwner; + client.OnObjectGroupRequest += HandleObjectGroupUpdate; } public virtual void SubscribeToClientPrimRezEvents(IClientAPI client) @@ -3520,15 +3523,11 @@ namespace OpenSim.Region.Framework.Scenes m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!"); } - IGroupsModule groupsModule = - RequestModuleInterface(); - List agentGroups = new List(); - if (groupsModule != null) + if (m_groupsModule != null) { - GroupMembershipData[] GroupMembership = - groupsModule.GetMembershipData(agent.AgentID); + GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID); if (GroupMembership != null) { -- cgit v1.1 From fa0a71253f0c824b6fc952c1a8927c8f189892b9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Dec 2011 18:54:15 +0000 Subject: Though the viewer warns about receiving this, not sending appears to break baked texture caching when crossing region boundaries. Needs further investigation. Revert "Stop sending the viewer its own AvatarAppearance packet." This reverts commit 92039f295d7fe66bf1a09b29483f9057e395839e. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 36d8c0b..b8ae553 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2532,10 +2532,7 @@ namespace OpenSim.Region.Framework.Scenes // again here... this comes after the cached appearance check because the avatars // appearance goes into the avatar update packet SendAvatarDataToAllAgents(); - - // Sending us our own appearance does not seem to be necessary, and the viewer warns in the log if you do - // this. -// SendAppearanceToAgent(this); + SendAppearanceToAgent(this); // If we are using the the cached appearance then send it out to everyone if (cachedappearance) -- cgit v1.1