From 2f3d0e209ff5c3028e3e29179b67504be9b2f887 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Jul 2011 03:13:59 +0100 Subject: When a sculpt/mesh texture is received by a part on a callback request, don't do the unnecessary work of copying the base shape. Just setting the new base shape is enough to reinsert the sculpt data and set the taint. Also cleans up a few more left-in debugging messages. --- OpenSim/Region/Framework/Scenes/Scene.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ec6044b..8195a0d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1726,6 +1726,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Loads the World's objects /// + /// public virtual void LoadPrimsFromStorage(UUID regionID) { LoadingPrims = true; -- cgit v1.1 From df0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 02:33:09 +0100 Subject: When a mesh object is added to a scene, delay adding the physics actor until the sculpt data has been added to the shape (possibly via an async asset service request) This prevents spurious 'no asset data' for meshes added on startup. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8195a0d..0104a96 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1751,8 +1751,9 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart rootPart = group.GetChildPart(group.UUID); rootPart.Flags &= ~PrimFlags.Scripted; rootPart.TrimPermissions(); - group.CheckSculptAndLoad(); - //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); + + // Don't do this here - it will get done later on when sculpt data is loaded. +// group.CheckSculptAndLoad(); } m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); -- cgit v1.1 From 4b9ef4f39c420b99568b853b627ad83d253ac2c9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 03:44:49 +0100 Subject: Rename UpdatePrimRotation() to UpdatePrimGroupRotation() since this is what it actually does and is more consistent with other method names. --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0104a96..2c71c70 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2718,10 +2718,12 @@ namespace OpenSim.Region.Framework.Scenes { client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; - client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; - client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimRotation; + + client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; + client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; + client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; @@ -2845,10 +2847,12 @@ namespace OpenSim.Region.Framework.Scenes { client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; - client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimRotation; - client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimRotation; + + client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; + client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; + client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; -- cgit v1.1 From 0ef29da9b2844e567928fe6fe5e13da3ee1a37ad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:20:04 +0100 Subject: refactor: rename UpdatePrimPosition() to UpdatePrimGroupPosition() for consistency --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2c71c70..6e66632 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2716,7 +2716,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void SubscribeToClientPrimEvents(IClientAPI client) { - client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; + client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; @@ -2845,7 +2845,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) { - client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; + client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; -- cgit v1.1 From 02e54c57c4901167779f07ed3e89fb1d24ffc22a Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Fri, 22 Jul 2011 11:33:00 +0300 Subject: Generate the initial maptile asynchronously Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/Scene.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6e66632..32a2887 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1672,20 +1672,20 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGridService.SetScene(this); - // If we generate maptiles internally at all, the maptile generator - // will register the region. If not, do it here - if (m_generateMaptiles) + GridRegion region = new GridRegion(RegionInfo); + string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); + if (error != String.Empty) { - RegenerateMaptile(null, null); + throw new Exception(error); } - else + + // Generate the maptile asynchronously, because sometimes it can be very slow and we + // don't want this to delay starting the region. + if (m_generateMaptiles) { - GridRegion region = new GridRegion(RegionInfo); - string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); - if (error != String.Empty) - { - throw new Exception(error); - } + Util.FireAndForget(delegate { + RegenerateMaptile(null, null); + }); } } -- cgit v1.1 From 504de8bc4792eda165d71a2c7481cb43cb92759a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 23 Jul 2011 03:46:55 +0100 Subject: Pass the first name and last name from the agent circuit data to the authorization service rather than from the account. This is to accomodate situations where the authorization service is being used by the hypergrid, where visitors have no user account. See http://opensimulator.org/mantis/view.php?id=5517, this code is somewhat adapted/cleaned up from Michelle's patch I'm a little ambivalent about this since visitors could put anything in firstname/lastname so it's not much of an auth measure. It's up to the auth service to decide which data it actually uses. Possibly we should be passing through other info such as agent circuit ip --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 32a2887..1a32510 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3553,11 +3553,12 @@ namespace OpenSim.Region.Framework.Scenes if (AuthorizationService != null) { - if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString(),out reason)) + if (!AuthorizationService.IsAuthorizedForRegion( + agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) { m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); - //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName); + return false; } } -- cgit v1.1 From 8c3eb324c4b666e7abadef4a714d1bd8d5f71ac2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 29 Jul 2011 00:00:35 +0100 Subject: When using osTeleportAgent() and osTeleportAvatar(), only teleport if the region name exactly matches (not near matches) This is to prevent situations where the first name returned by GridService.GetRegionsByName is not one that exactly matches the given region name, even when there is an exact match later on in the list. Only the above two functions call this teleport method (the map uses a different routine) so this seems safe to change. Addresses http://opensimulator.org/mantis/view.php?id=5606 --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1a32510..b84c3d5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3881,8 +3881,11 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Tries to teleport agent to other region. + /// Tries to teleport agent to another region. /// + /// + /// The region name must exactly match that given. + /// /// /// /// @@ -3891,15 +3894,16 @@ namespace OpenSim.Region.Framework.Scenes public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, Vector3 lookat, uint teleportFlags) { - List regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1); - if (regions == null || regions.Count == 0) + GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); + + if (region == null) { // can't find the region: Tell viewer and abort remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); return; } - RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags); + RequestTeleportLocation(remoteClient, region.RegionHandle, position, lookat, teleportFlags); } /// -- cgit v1.1 From b6ac1c46cd473b129b70344f0001f1e8f97d8860 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Aug 2011 00:13:04 +0100 Subject: Get rid of AvatarAppearance.Owner to simplify the code. This is not used for anything - appearances are always properties of objects with ids (ScenePresence, AgentCircuitData) and just has the potential to get out of sync when the appearance is cloned. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b84c3d5..b3b6cbc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3079,7 +3079,7 @@ namespace OpenSim.Region.Framework.Scenes if (aCircuit == null) { m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance."); - appearance = new AvatarAppearance(client.AgentId); + appearance = new AvatarAppearance(); return; } @@ -3087,7 +3087,7 @@ namespace OpenSim.Region.Framework.Scenes if (appearance == null) { m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); - appearance = new AvatarAppearance(client.AgentId); + appearance = new AvatarAppearance(); } } -- cgit v1.1 From 4cb8d6379ddb39cfb8b30a63475e154a00a78110 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Aug 2011 00:59:31 +0100 Subject: Stop trying to deregister caps or close child agents when an NPC is removed --- OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b3b6cbc..9aa9bf5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3091,11 +3091,7 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Remove the given client from the scene. - /// - /// - public override void RemoveClient(UUID agentID) + public override void RemoveClient(UUID agentID, bool closeChildAgents) { CheckHeartbeat(); bool childagentYN = false; @@ -3116,15 +3112,17 @@ namespace OpenSim.Region.Framework.Scenes (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); m_sceneGraph.removeUserCount(!childagentYN); - - if (CapsModule != null) + + // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop + // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI + if (closeChildAgents && CapsModule != null) CapsModule.RemoveCaps(agentID); // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever // this method is doing is HORRIBLE!!! avatar.Scene.NeedSceneCacheClear(avatar.UUID); - if (!avatar.IsChildAgent) + if (closeChildAgents && !avatar.IsChildAgent) { //List childknownRegions = new List(); //List ckn = avatar.KnownChildRegionHandles; @@ -3136,6 +3134,7 @@ namespace OpenSim.Region.Framework.Scenes regions.Remove(RegionInfo.RegionHandle); m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); } + m_eventManager.TriggerClientClosed(agentID, this); } catch (NullReferenceException) -- cgit v1.1 From 9a6ad1535e83a4d1b216ae879173ab8c524da60b Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Mon, 15 Aug 2011 17:46:51 +0200 Subject: Added console command "delete object outside" to delete all objects outside region boundaries. This is especiyll useful in cases where physical objects outside regions boundaries cause much physics engine lag. --- OpenSim/Region/Framework/Scenes/Scene.cs | 39 ++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9aa9bf5..13b4cbc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes "delete object name ", "Delete object by name", HandleDeleteObject); + MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", + "delete object outside", + "Delete all objects outside boundaries", HandleDeleteObject); + //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(simDataService.StoreLandObject); @@ -4941,11 +4945,19 @@ namespace OpenSim.Region.Framework.Scenes private void HandleDeleteObject(string module, string[] cmd) { - if (cmd.Length < 4) + if (cmd.Length < 3) return; string mode = cmd[2]; - string o = cmd[3]; + string o = ""; + + if (mode != "outside") + { + if (cmd.Length < 4) + return; + + o = cmd[3]; + } List deletes = new List(); @@ -4987,10 +4999,33 @@ namespace OpenSim.Region.Framework.Scenes deletes.Add(g); }); break; + case "outside": + ForEachSOG(delegate (SceneObjectGroup g) + { + SceneObjectPart rootPart = g.RootPart; + bool delete = false; + + if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) + { + delete = true; + } else { + ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); + + if (parcel == null || parcel.LandData.Name == "NO LAND") + delete = true; + } + + if (delete && !rootPart.IsAttachment && !deletes.Contains(g)) + deletes.Add(g); + }); + break; } foreach (SceneObjectGroup g in deletes) + { + m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID); DeleteSceneObject(g, false); + } } private void HandleReloadEstate(string module, string[] cmd) -- cgit v1.1 From c1a34cd8da293e63d3cba70b5271c9a297789db2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 18 Aug 2011 00:53:05 +0100 Subject: Don't try to save changed attachment states when an NPC with attachments is removed from the scene. This is done by introducing a PresenceType enum into ScenePresence which currently has two values, User and Npc. This seems better than a SaveAttachments flag in terms of code comprehension, though I'm still slightly uneasy about introducing these semantics to core objects --- OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 13b4cbc..ae88a87 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2543,10 +2543,11 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Avatar Methods /// - /// Adding a New Client and Create a Presence for it. + /// Add a new client and create a child agent for it. /// /// - public override void AddNewClient(IClientAPI client) + /// The type of agent to add. + public override void AddNewClient(IClientAPI client, PresenceType type) { AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); bool vialogin = false; @@ -2566,7 +2567,7 @@ namespace OpenSim.Region.Framework.Scenes m_clientManager.Add(client); SubscribeToClientEvents(client); - ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); + ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); m_eventManager.TriggerOnNewPresence(sp); sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; @@ -3149,7 +3150,7 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnRemovePresence(agentID); - if (avatar != null && (!avatar.IsChildAgent)) + if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc) avatar.SaveChangedAttachments(); ForEachClient( -- cgit v1.1 From c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 19 Aug 2011 00:45:22 +0100 Subject: Stop NPC's getting hypergrid like names in some circumstances. This meant punching in another AddUser() method in IUserManagement to do a direct name to UUID associated without the account check (since NPCs don't have accounts). May address http://opensimulator.org/mantis/view.php?id=5645 --- OpenSim/Region/Framework/Scenes/Scene.cs | 42 +++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ae88a87..513c0ea 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2582,12 +2582,13 @@ namespace OpenSim.Region.Framework.Scenes } } - if (GetScenePresence(client.AgentId) != null) + ScenePresence createdSp = GetScenePresence(client.AgentId); + if (createdSp != null) { m_LastLogin = Util.EnvironmentTickCount(); // Cache the user's name - CacheUserName(aCircuit); + CacheUserName(createdSp, aCircuit); EventManager.TriggerOnNewClient(client); if (vialogin) @@ -2595,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes } } - private void CacheUserName(AgentCircuitData aCircuit) + /// + /// Cache the user name for later use. + /// + /// + /// + private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) { IUserManagement uMan = RequestModuleInterface(); if (uMan != null) { - string homeURL = string.Empty; string first = aCircuit.firstname, last = aCircuit.lastname; - if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) - homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); - - if (aCircuit.lastname.StartsWith("@")) + if (sp.PresenceType == PresenceType.Npc) + { + uMan.AddUser(aCircuit.AgentID, first, last); + } + else { - string[] parts = aCircuit.firstname.Split('.'); - if (parts.Length >= 2) + string homeURL = string.Empty; + + if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) + homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); + + if (aCircuit.lastname.StartsWith("@")) { - first = parts[0]; - last = parts[1]; + string[] parts = aCircuit.firstname.Split('.'); + if (parts.Length >= 2) + { + first = parts[0]; + last = parts[1]; + } } - } - uMan.AddUser(aCircuit.AgentID, first, last, homeURL); + uMan.AddUser(aCircuit.AgentID, first, last, homeURL); + } } } -- cgit v1.1 From 33a894f3d2cc95a7a512b86f39f3c6a6afabb015 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 27 Aug 2011 00:15:21 +0100 Subject: refactor: move SOP.IsAttachment and AttachmentPoint up into SOG to avoid pointless duplication of identical values --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 513c0ea..45d1a0e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4223,7 +4223,7 @@ namespace OpenSim.Region.Framework.Scenes // their scripts will actually run. // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 SceneObjectPart parent = part.ParentGroup.RootPart; - if (parent != null && parent.IsAttachment) + if (parent != null && part.ParentGroup.IsAttachment) return ScriptDanger(parent, parent.GetWorldPosition()); else return ScriptDanger(part, part.GetWorldPosition()); @@ -5030,7 +5030,7 @@ namespace OpenSim.Region.Framework.Scenes delete = true; } - if (delete && !rootPart.IsAttachment && !deletes.Contains(g)) + if (delete && !g.IsAttachment && !deletes.Contains(g)) deletes.Add(g); }); break; -- cgit v1.1 From 1de68b34d959570c6dc5de42e8dac5e36f960273 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Aug 2011 22:25:38 +0100 Subject: refactor: migrate DropObject handling fully into AttachmentsModule from Scene --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 45d1a0e..e0250de 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2772,7 +2772,6 @@ namespace OpenSim.Region.Framework.Scenes client.OnUndo += m_sceneGraph.HandleUndo; client.OnRedo += m_sceneGraph.HandleRedo; client.OnObjectDescription += m_sceneGraph.PrimDescription; - client.OnObjectDrop += m_sceneGraph.DropObject; client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner += ObjectOwner; } @@ -2899,7 +2898,6 @@ namespace OpenSim.Region.Framework.Scenes client.OnUndo -= m_sceneGraph.HandleUndo; client.OnRedo -= m_sceneGraph.HandleRedo; client.OnObjectDescription -= m_sceneGraph.PrimDescription; - client.OnObjectDrop -= m_sceneGraph.DropObject; client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner -= ObjectOwner; } -- cgit v1.1 From 04bafd21221a789b83b039efd1c52e141944cde0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Aug 2011 23:05:43 +0100 Subject: refactor: Move ScenePresence.RezAttachments() into AttachmentsModule This adds an incomplete IScenePresence to match ISceneEntity --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e0250de..e7fe8df 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2578,7 +2578,7 @@ namespace OpenSim.Region.Framework.Scenes if (aCircuit.child == false) { sp.IsChildAgent = false; - Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); + Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); } } -- cgit v1.1 From ddc733cd3d940a4357eb0d235562050eb6f206bf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Aug 2011 23:32:30 +0100 Subject: refactor: move SP.SaveChangedAttachments() fully into AttachmentsModule --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e7fe8df..e0e3884 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3162,8 +3162,8 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnRemovePresence(agentID); - if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc) - avatar.SaveChangedAttachments(); + if (AttachmentsModule != null && avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc) + AttachmentsModule.SaveChangedAttachments(avatar); ForEachClient( delegate(IClientAPI client) -- cgit v1.1 From 1809aaf74c3594ec40df8688a2dcc42074ddeec4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Aug 2011 23:36:45 +0100 Subject: minor: remove already processed avatar null check in Scene.RemoveClient() remove some now duplicated method doc --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e0e3884..9368285 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3162,7 +3162,7 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnRemovePresence(agentID); - if (AttachmentsModule != null && avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc) + if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) AttachmentsModule.SaveChangedAttachments(avatar); ForEachClient( -- cgit v1.1 From 095b3e5756bb3160b30c9c5670ba008fa13d2e66 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 1 Sep 2011 01:22:28 +0100 Subject: Remove pointless cluttering SOP.ParentGroup != null checks. The only times when ParentGroup might be null is during regression tests (which might not be a valid thing) and when scene objects are being constructed from the database. At all other times it's not possible for a SOP not to have a SOG parent. --- OpenSim/Region/Framework/Scenes/Scene.cs | 82 +++++++++++++++----------------- 1 file changed, 38 insertions(+), 44 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9368285..7f5aea7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3012,58 +3012,51 @@ namespace OpenSim.Region.Framework.Scenes Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); - if (target2.ParentGroup != null) - { - pos = target2.AbsolutePosition; - //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); + pos = target2.AbsolutePosition; + //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); - // TODO: Raytrace better here + // TODO: Raytrace better here - //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); - Ray NewRay = new Ray(AXOrigin, AXdirection); + //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); + Ray NewRay = new Ray(AXOrigin, AXdirection); - // Ray Trace against target here - EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); + // Ray Trace against target here + EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); - // Un-comment out the following line to Get Raytrace results printed to the console. - //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); - float ScaleOffset = 0.5f; + // Un-comment out the following line to Get Raytrace results printed to the console. + //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); + float ScaleOffset = 0.5f; - // If we hit something - if (ei.HitTF) + // If we hit something + if (ei.HitTF) + { + Vector3 scale = target.Scale; + Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); + if (scaleComponent.X != 0) ScaleOffset = scale.X; + if (scaleComponent.Y != 0) ScaleOffset = scale.Y; + if (scaleComponent.Z != 0) ScaleOffset = scale.Z; + ScaleOffset = Math.Abs(ScaleOffset); + Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); + Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); + Vector3 offset = normal * (ScaleOffset / 2f); + pos = intersectionpoint + offset; + + // stick in offset format from the original prim + pos = pos - target.ParentGroup.AbsolutePosition; + if (CopyRotates) { - Vector3 scale = target.Scale; - Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); - if (scaleComponent.X != 0) ScaleOffset = scale.X; - if (scaleComponent.Y != 0) ScaleOffset = scale.Y; - if (scaleComponent.Z != 0) ScaleOffset = scale.Z; - ScaleOffset = Math.Abs(ScaleOffset); - Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); - Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); - Vector3 offset = normal * (ScaleOffset / 2f); - pos = intersectionpoint + offset; - - // stick in offset format from the original prim - pos = pos - target.ParentGroup.AbsolutePosition; - if (CopyRotates) - { - Quaternion worldRot = target2.GetWorldRotation(); + Quaternion worldRot = target2.GetWorldRotation(); - // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); - m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); - //obj.Rotation = worldRot; - //obj.UpdateGroupRotationR(worldRot); - } - else - { - m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); - } + // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); + m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); + //obj.Rotation = worldRot; + //obj.UpdateGroupRotationR(worldRot); + } + else + { + m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); } - - return; } - - return; } } @@ -3233,12 +3226,13 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetSceneObjectPart(localID); if (part != null) // It is a prim { - if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid + if (!part.ParentGroup.IsDeleted) // Valid { if (part.ParentGroup.RootPart != part) // Child part return; } } + ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); } -- cgit v1.1 From 7eca929686bd2db1cb42f5c9740fd1d186cdc8b1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 1 Sep 2011 02:09:41 +0100 Subject: Eliminate pointless checks of SOG.RootPart != null It's never possible for SOG to have no RootPart, except in the first few picosends of the big bang when it's pulled from region persistence or deserialized --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7f5aea7..9794a34 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1743,14 +1743,6 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectGroup group in PrimsFromDB) { EventManager.TriggerOnSceneObjectLoaded(group); - - if (group.RootPart == null) - { - m_log.ErrorFormat( - "[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", - group.Parts == null ? 0 : group.PrimCount); - } - AddRestoredSceneObject(group, true, true); SceneObjectPart rootPart = group.GetChildPart(group.UUID); rootPart.Flags &= ~PrimFlags.Scripted; @@ -4215,7 +4207,7 @@ namespace OpenSim.Region.Framework.Scenes // their scripts will actually run. // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 SceneObjectPart parent = part.ParentGroup.RootPart; - if (parent != null && part.ParentGroup.IsAttachment) + if (part.ParentGroup.IsAttachment) return ScriptDanger(parent, parent.GetWorldPosition()); else return ScriptDanger(part, part.GetWorldPosition()); @@ -5015,7 +5007,9 @@ namespace OpenSim.Region.Framework.Scenes if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) { delete = true; - } else { + } + else + { ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); if (parcel == null || parcel.LandData.Name == "NO LAND") -- cgit v1.1 From e6eb0d9a6f2c0e792e3c1a77990fe18e153e454d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Sep 2011 23:19:27 +0100 Subject: Comment out Scene.CleanDroppedAttachments() and calls. This method wasn't actually doing anything since dropped attachments retain a PCode of 9. Also, behaviour of dropped attachments in other places appears to be that they persist after avatar logout rather than get deleted. --- OpenSim/Region/Framework/Scenes/Scene.cs | 72 ++++++++++++++++---------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9794a34..d3de37d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3182,7 +3182,7 @@ namespace OpenSim.Region.Framework.Scenes } m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); - CleanDroppedAttachments(); +// CleanDroppedAttachments(); //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); } @@ -3406,7 +3406,7 @@ namespace OpenSim.Region.Framework.Scenes if (vialogin) { - CleanDroppedAttachments(); +// CleanDroppedAttachments(); if (TestBorderCross(agent.startpos, Cardinals.E)) { @@ -5123,40 +5123,40 @@ namespace OpenSim.Region.Framework.Scenes } } - public void CleanDroppedAttachments() - { - List objectsToDelete = - new List(); - - lock (m_cleaningAttachments) - { - ForEachSOG(delegate (SceneObjectGroup grp) - { - if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) - { - UUID agentID = grp.OwnerID; - if (agentID == UUID.Zero) - { - objectsToDelete.Add(grp); - return; - } - - ScenePresence sp = GetScenePresence(agentID); - if (sp == null) - { - objectsToDelete.Add(grp); - return; - } - } - }); - } - - foreach (SceneObjectGroup grp in objectsToDelete) - { - m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); - DeleteSceneObject(grp, true); - } - } +// public void CleanDroppedAttachments() +// { +// List objectsToDelete = +// new List(); +// +// lock (m_cleaningAttachments) +// { +// ForEachSOG(delegate (SceneObjectGroup grp) +// { +// if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) +// { +// UUID agentID = grp.OwnerID; +// if (agentID == UUID.Zero) +// { +// objectsToDelete.Add(grp); +// return; +// } +// +// ScenePresence sp = GetScenePresence(agentID); +// if (sp == null) +// { +// objectsToDelete.Add(grp); +// return; +// } +// } +// }); +// } +// +// foreach (SceneObjectGroup grp in objectsToDelete) +// { +// m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); +// DeleteSceneObject(grp, true); +// } +// } // This method is called across the simulation connector to // determine if a given agent is allowed in this region -- cgit v1.1