From 4e4db749eb74bf02ae956c4a9461499988f0f0ec Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 27 May 2011 20:59:35 +0100 Subject: If parsing fails in the primitive base shape (which prints out a debug log message), also print out the name and uuid of the part containing this shape. This is to help in diagnosing parsing failures. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 872816c..47af0dd 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -570,7 +570,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) { - obj.Shape = ReadShape(reader, "Shape"); + bool errors = false; + obj.Shape = ReadShape(reader, "Shape", out errors); + + if (errors) + m_log.DebugFormat( + "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors. Please see earlier log entries.", + obj.Name, obj.UUID); } private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) @@ -1470,7 +1476,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } catch (Exception e) { - m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing {0}: {1}", nodeName, e); + m_log.DebugFormat( + "[SceneObjectSerializer]: exception while parsing {0} in object {1} {2}: {3}{4}", + obj.Name, obj.UUID, nodeName, e.Message, e.StackTrace); if (reader.NodeType == XmlNodeType.EndElement) reader.Read(); } @@ -1528,8 +1536,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization return tinv; } - static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name) + /// + /// Read a shape from xml input + /// + /// + /// The name of the xml element containing the shape + /// true if any errors were encountered during parsing, false otherwise + /// The shape parsed + static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) { + errors = false; + PrimitiveBaseShape shape = new PrimitiveBaseShape(); if (reader.IsEmptyElement) @@ -1554,7 +1571,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } catch (Exception e) { - m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing Shape {0}: {1}", nodeName, e); + errors = true; + m_log.DebugFormat( + "[SceneObjectSerializer]: exception while parsing Shape property {0}: {1}{2}", + nodeName, e.Message, e.StackTrace); + if (reader.NodeType == XmlNodeType.EndElement) reader.Read(); } -- cgit v1.1 From e9988a3728706e346dfb869de554a24e6a3b0a79 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 27 May 2011 21:19:20 +0100 Subject: Make sure culture is en-US when saving archive related xml. This might resolve http://opensimulator.org/mantis/view.php?id=5475 --- OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 47af0dd..6ae4f38 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -121,7 +121,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - /// /// Serialize a scene object to the original xml format /// -- cgit v1.1 From 99f42c0a6ec064d7b625c9b33e185a5e153d6be8 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 27 May 2011 19:05:16 -0400 Subject: Add option to disable logins This just covers script loading for now. More to come. --- OpenSim/Region/Framework/Scenes/Scene.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4aae13c..e9f5f9e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -94,7 +94,10 @@ namespace OpenSim.Region.Framework.Scenes // root agents when ACL denies access to root agent public bool m_strictAccessControl = true; public int MaxUndoCount = 5; + // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; + public bool LoginLock = false; public bool LoginsDisabled = true; + public bool StartDisabled = false; public bool LoadingPrims; public IXfer XferManager; @@ -1373,10 +1376,23 @@ namespace OpenSim.Region.Framework.Scenes IConfig startupConfig = m_config.Configs["Startup"]; if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) { + if (m_sceneGraph.GetActiveScriptsCount() == 0) + { + LoginLock = false; + } m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); - LoginsDisabled = false; + // For RegionReady lockouts + if( LoginLock == false) + { + LoginsDisabled = false; + } m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); } + else + { + StartDisabled = true; + LoginsDisabled = true; + } } } catch (NotImplementedException) -- cgit v1.1 From c7e18f9017302991f7a4411293ef2fbb20cc9b5a Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 28 May 2011 11:11:01 -0400 Subject: Adding an event to signal that logins are enabled Added an event to signal the eabling of logins and added an alert to send to a configured service. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 24 ++++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 3 +++ 2 files changed, 27 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index e04317b..b43d5f0 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -389,6 +389,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void RegionUp(GridRegion region); public event RegionUp OnRegionUp; + public delegate void LoginsEnabled(string regionName); + public event LoginsEnabled OnLoginsEnabled; + public class MoneyTransferArgs : EventArgs { public UUID sender; @@ -2218,5 +2221,26 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerLoginsEnabled (string regionName) + { + LoginsEnabled handler = OnLoginsEnabled; + + if ( handler != null) + { + foreach (LoginsEnabled d in handler.GetInvocationList()) + { + try + { + d(regionName); + } + catch (Exception e) + { + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for LoginsEnabled failed - continuing {0} - {1}", + e.Message, e.StackTrace); + } + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e9f5f9e..1d562fd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1376,9 +1376,12 @@ namespace OpenSim.Region.Framework.Scenes IConfig startupConfig = m_config.Configs["Startup"]; if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) { + // This handles a case of a region having no scripts for the RegionReady module if (m_sceneGraph.GetActiveScriptsCount() == 0) { + // need to be able to tell these have changed in RegionReady LoginLock = false; + EventManager.TriggerLoginsEnabled(RegionInfo.RegionName); } m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); // For RegionReady lockouts -- cgit v1.1 From 76c60f1f99ca8aa7c1a336918aa0ef5f83b1ae04 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Jun 2011 08:27:01 -0700 Subject: Moved CreateNewInventoryItem to the InventoryAccessModule in preparation for supporting HG landmarks. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 74 +--------------------- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +- 2 files changed, 3 insertions(+), 75 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 3c47873..b70e1c3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -778,7 +778,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, + public void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) { CreateNewInventoryItem( @@ -833,78 +833,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Create a new inventory item. Called when the client creates a new item directly within their - /// inventory (e.g. by selecting a context inventory menu option). - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public void CreateNewInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID folderID, - uint callbackID, string description, string name, sbyte invType, - sbyte assetType, - byte wearableType, uint nextOwnerMask, int creationDate) - { - m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID); - - if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) - return; - - InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId); - InventoryFolderBase folder = InventoryService.GetFolder(f); - - if (folder == null || folder.Owner != remoteClient.AgentId) - return; - - if (transactionID == UUID.Zero) - { - ScenePresence presence; - if (TryGetScenePresence(remoteClient.AgentId, out presence)) - { - byte[] data = null; - - if (invType == (sbyte)InventoryType.Landmark && presence != null) - { - Vector3 pos = presence.AbsolutePosition; - string strdata = String.Format( - "Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n", - presence.Scene.RegionInfo.RegionID, - pos.X, pos.Y, pos.Z, - presence.RegionHandle); - data = Encoding.ASCII.GetBytes(strdata); - } - - AssetBase asset = CreateAsset(name, description, assetType, data, remoteClient.AgentId); - AssetService.Store(asset); - - CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); - } - else - { - m_log.ErrorFormat( - "ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", - remoteClient.AgentId); - } - } - else - { - IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); - if (agentTransactions != null) - { - agentTransactions.HandleItemCreationFromTransaction( - remoteClient, transactionID, folderID, callbackID, description, - name, invType, assetType, wearableType, nextOwnerMask); - } - } - } - - /// /// Link an inventory item to an existing item. /// /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1d562fd..b179683 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2726,7 +2726,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void SubscribeToClientInventoryEvents(IClientAPI client) { - client.OnCreateNewInventoryItem += CreateNewInventoryItem; + client.OnLinkInventoryItem += HandleLinkInventoryItem; client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; @@ -2853,7 +2853,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client) { - client.OnCreateNewInventoryItem -= CreateNewInventoryItem; + client.OnCreateNewInventoryFolder -= HandleCreateInventoryFolder; client.OnUpdateInventoryFolder -= HandleUpdateInventoryFolder; client.OnMoveInventoryFolder -= HandleMoveInventoryFolder; // 2; //!! -- cgit v1.1 From e33cedfd427779a3df844150869eb07b664849df Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Jun 2011 10:26:58 -0700 Subject: HG Landmarks now working. --- OpenSim/Region/Framework/Scenes/Scene.cs | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b179683..77301d8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2749,7 +2749,6 @@ namespace OpenSim.Region.Framework.Scenes public virtual void SubscribeToClientTeleportEvents(IClientAPI client) { client.OnTeleportLocationRequest += RequestTeleportLocation; - client.OnTeleportLandmarkRequest += RequestTeleportLandmark; } public virtual void SubscribeToClientScriptEvents(IClientAPI client) @@ -2875,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) { client.OnTeleportLocationRequest -= RequestTeleportLocation; - client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; + //client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; //client.OnTeleportHomeRequest -= TeleportClientHome; } @@ -3925,26 +3924,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Tries to teleport agent to landmark. - /// - /// - /// - /// - public void RequestTeleportLandmark(IClientAPI remoteClient, UUID regionID, Vector3 position) - { - GridRegion info = GridService.GetRegionByUUID(UUID.Zero, regionID); - - if (info == null) - { - // can't find the region: Tell viewer and abort - remoteClient.SendTeleportFailed("The teleport destination could not be found."); - return; - } - - RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); - } - public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) { if (m_teleportModule != null) -- cgit v1.1 From 527e10a04e9108bebe5de76541d47409dd6ce4f4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Jun 2011 23:13:05 +0100 Subject: add stub UserInventoryTests.GiveInventoryFolder(). Not yet complete --- .../Framework/Scenes/Tests/UserInventoryTests.cs | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs new file mode 100644 index 0000000..b82ddb4 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Timers; +using Timer=System.Timers.Timer; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenMetaverse.Assets; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; +using OpenSim.Region.CoreModules.World.Serialiser; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Services.Interfaces; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.Framework.Tests +{ + [TestFixture] + public class UserInventoryTests + { + [Test] + public void TestGiveInventoryFolder() + { + Scene scene = SceneSetupHelpers.SetupScene(); + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene); + InventoryFolderBase folder1 + = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); + + scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); + +// InventoryFolderBase receivedFolder1Template = new InventoryFolderBase( +// InventoryFolderBase receivedFolder1 = scene.InventoryService.GetFolder + } + } +} \ No newline at end of file -- cgit v1.1 From d09210da869ad2a91c9578225a1ca4843d565e05 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Jun 2011 23:15:31 +0100 Subject: minor: add in method print out to new test --- OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index b82ddb4..651df3e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -55,6 +55,9 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestGiveInventoryFolder() { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + Scene scene = SceneSetupHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene); -- cgit v1.1 From 1543fd7fff3b3f3a7ce07caa3ed19846b6587df7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 00:20:54 +0100 Subject: extend TestGiveInventoryFolder() to check for the receipt by user 2 --- OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 651df3e..c6bd296 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -66,8 +66,10 @@ namespace OpenSim.Region.Framework.Tests scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); -// InventoryFolderBase receivedFolder1Template = new InventoryFolderBase( -// InventoryFolderBase receivedFolder1 = scene.InventoryService.GetFolder + InventoryFolderBase retrievedFolder1 + = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); + + Assert.That(retrievedFolder1, Is.Not.Null); } } } \ No newline at end of file -- cgit v1.1 From 896f039513398a46458b18ef49f52a9a3ac43659 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 00:51:49 +0100 Subject: create TestGetInventoryItem() --- .../Framework/Scenes/Tests/UserInventoryTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index c6bd296..bacf7c1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -53,6 +53,25 @@ namespace OpenSim.Region.Framework.Tests public class UserInventoryTests { [Test] + public void TestGiveInventoryItem() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + Scene scene = SceneSetupHelpers.SetupScene(); + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene); + InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); + + scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); + + InventoryItemBase retrievedItem1 + = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Objects/item1"); + + Assert.That(retrievedItem1, Is.Not.Null); + } + + [Test] public void TestGiveInventoryFolder() { TestHelper.InMethod(); -- cgit v1.1 From fe890554fbf47cafda2a41e04b400d971f1242ad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 01:37:01 +0100 Subject: insert an InventoryArchiveUtils.FindItemsByPath() to return multiple items rather than just the first one --- OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index bacf7c1..83f0686 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -69,6 +69,9 @@ namespace OpenSim.Region.Framework.Tests = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Objects/item1"); Assert.That(retrievedItem1, Is.Not.Null); + + // Try giving back the freshly received item + //scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID); } [Test] -- cgit v1.1 From 12b1cbf8bfc559e4da40abf518e8e99fac793870 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 02:39:26 +0100 Subject: Fix give inventory tests to use different users rather than (accidentally) the same user. Extend TestGiveInventoryItem() to test giving back the same item. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 328 +++++++++++---------- .../Framework/Scenes/Tests/UserInventoryTests.cs | 17 +- 2 files changed, 178 insertions(+), 167 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b70e1c3..f37f94a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -425,192 +425,198 @@ namespace OpenSim.Region.Framework.Scenes InventoryItemBase item = new InventoryItemBase(itemId, senderId); item = InventoryService.GetItem(item); - if ((item != null) && (item.Owner == senderId)) + if (item == null) { - IUserManagement uman = RequestModuleInterface(); - if (uman != null) - uman.AddUser(item.CreatorIdAsUuid, item.CreatorData); + m_log.WarnFormat( + "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); + return null; + } - if (!Permissions.BypassPermissions()) - { - if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) - return null; - } + if (item.Owner != senderId) + { + m_log.WarnFormat( + "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", + item.Name, item.ID, recipient, senderId, item.Owner); + return null; + } + + IUserManagement uman = RequestModuleInterface(); + if (uman != null) + uman.AddUser(item.CreatorIdAsUuid, item.CreatorData); + + if (!Permissions.BypassPermissions()) + { + if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) + return null; + } - // Insert a copy of the item into the recipient - InventoryItemBase itemCopy = new InventoryItemBase(); - itemCopy.Owner = recipient; - itemCopy.CreatorId = item.CreatorId; - itemCopy.CreatorData = item.CreatorData; - itemCopy.ID = UUID.Random(); - itemCopy.AssetID = item.AssetID; - itemCopy.Description = item.Description; - itemCopy.Name = item.Name; - itemCopy.AssetType = item.AssetType; - itemCopy.InvType = item.InvType; - itemCopy.Folder = recipientFolderId; - - if (Permissions.PropagatePermissions() && recipient != senderId) + // Insert a copy of the item into the recipient + InventoryItemBase itemCopy = new InventoryItemBase(); + itemCopy.Owner = recipient; + itemCopy.CreatorId = item.CreatorId; + itemCopy.CreatorData = item.CreatorData; + itemCopy.ID = UUID.Random(); + itemCopy.AssetID = item.AssetID; + itemCopy.Description = item.Description; + itemCopy.Name = item.Name; + itemCopy.AssetType = item.AssetType; + itemCopy.InvType = item.InvType; + itemCopy.Folder = recipientFolderId; + + if (Permissions.PropagatePermissions() && recipient != senderId) + { + // Trying to do this right this time. This is evil. If + // you believe in Good, go elsewhere. Vampires and other + // evil creatores only beyond this point. You have been + // warned. + + // We're going to mask a lot of things by the next perms + // Tweak the next perms to be nicer to our data + // + // In this mask, all the bits we do NOT want to mess + // with are set. These are: + // + // Transfer + // Copy + // Modufy + uint permsMask = ~ ((uint)PermissionMask.Copy | + (uint)PermissionMask.Transfer | + (uint)PermissionMask.Modify); + + // Now, reduce the next perms to the mask bits + // relevant to the operation + uint nextPerms = permsMask | (item.NextPermissions & + ((uint)PermissionMask.Copy | + (uint)PermissionMask.Transfer | + (uint)PermissionMask.Modify)); + + // nextPerms now has all bits set, except for the actual + // next permission bits. + + // This checks for no mod, no copy, no trans. + // This indicates an error or messed up item. Do it like + // SL and assume trans + if (nextPerms == permsMask) + nextPerms |= (uint)PermissionMask.Transfer; + + // Inventory owner perms are the logical AND of the + // folded perms and the root prim perms, however, if + // the root prim is mod, the inventory perms will be + // mod. This happens on "take" and is of little concern + // here, save for preventing escalation + + // This hack ensures that items previously permalocked + // get unlocked when they're passed or rezzed + uint basePerms = item.BasePermissions | + (uint)PermissionMask.Move; + uint ownerPerms = item.CurrentPermissions; + + // If this is an object, root prim perms may be more + // permissive than folded perms. Use folded perms as + // a mask + if (item.InvType == (int)InventoryType.Object) { - // Trying to do this right this time. This is evil. If - // you believe in Good, go elsewhere. Vampires and other - // evil creatores only beyond this point. You have been - // warned. - - // We're going to mask a lot of things by the next perms - // Tweak the next perms to be nicer to our data - // - // In this mask, all the bits we do NOT want to mess - // with are set. These are: - // - // Transfer - // Copy - // Modufy - uint permsMask = ~ ((uint)PermissionMask.Copy | - (uint)PermissionMask.Transfer | - (uint)PermissionMask.Modify); - - // Now, reduce the next perms to the mask bits - // relevant to the operation - uint nextPerms = permsMask | (item.NextPermissions & - ((uint)PermissionMask.Copy | - (uint)PermissionMask.Transfer | - (uint)PermissionMask.Modify)); - - // nextPerms now has all bits set, except for the actual - // next permission bits. - - // This checks for no mod, no copy, no trans. - // This indicates an error or messed up item. Do it like - // SL and assume trans - if (nextPerms == permsMask) - nextPerms |= (uint)PermissionMask.Transfer; - - // Inventory owner perms are the logical AND of the - // folded perms and the root prim perms, however, if - // the root prim is mod, the inventory perms will be - // mod. This happens on "take" and is of little concern - // here, save for preventing escalation - - // This hack ensures that items previously permalocked - // get unlocked when they're passed or rezzed - uint basePerms = item.BasePermissions | - (uint)PermissionMask.Move; - uint ownerPerms = item.CurrentPermissions; - - // If this is an object, root prim perms may be more - // permissive than folded perms. Use folded perms as - // a mask - if (item.InvType == (int)InventoryType.Object) + // Create a safe mask for the current perms + uint foldedPerms = (item.CurrentPermissions & 7) << 13; + foldedPerms |= permsMask; + + bool isRootMod = (item.CurrentPermissions & + (uint)PermissionMask.Modify) != 0 ? + true : false; + + // Mask the owner perms to the folded perms + ownerPerms &= foldedPerms; + basePerms &= foldedPerms; + + // If the root was mod, let the mask reflect that + // We also need to adjust the base here, because + // we should be able to edit in-inventory perms + // for the root prim, if it's mod. + if (isRootMod) { - // Create a safe mask for the current perms - uint foldedPerms = (item.CurrentPermissions & 7) << 13; - foldedPerms |= permsMask; - - bool isRootMod = (item.CurrentPermissions & - (uint)PermissionMask.Modify) != 0 ? - true : false; - - // Mask the owner perms to the folded perms - ownerPerms &= foldedPerms; - basePerms &= foldedPerms; - - // If the root was mod, let the mask reflect that - // We also need to adjust the base here, because - // we should be able to edit in-inventory perms - // for the root prim, if it's mod. - if (isRootMod) - { - ownerPerms |= (uint)PermissionMask.Modify; - basePerms |= (uint)PermissionMask.Modify; - } + ownerPerms |= (uint)PermissionMask.Modify; + basePerms |= (uint)PermissionMask.Modify; } + } - // These will be applied to the root prim at next rez. - // The slam bit (bit 3) and folded permission (bits 0-2) - // are preserved due to the above mangling - ownerPerms &= nextPerms; + // These will be applied to the root prim at next rez. + // The slam bit (bit 3) and folded permission (bits 0-2) + // are preserved due to the above mangling + ownerPerms &= nextPerms; - // Mask the base permissions. This is a conservative - // approach altering only the three main perms - basePerms &= nextPerms; + // Mask the base permissions. This is a conservative + // approach altering only the three main perms + basePerms &= nextPerms; - // Assign to the actual item. Make sure the slam bit is - // set, if it wasn't set before. - itemCopy.BasePermissions = basePerms; - itemCopy.CurrentPermissions = ownerPerms; - itemCopy.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; + // Assign to the actual item. Make sure the slam bit is + // set, if it wasn't set before. + itemCopy.BasePermissions = basePerms; + itemCopy.CurrentPermissions = ownerPerms; + itemCopy.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; - itemCopy.NextPermissions = item.NextPermissions; + itemCopy.NextPermissions = item.NextPermissions; - // This preserves "everyone can move" - itemCopy.EveryOnePermissions = item.EveryOnePermissions & - nextPerms; + // This preserves "everyone can move" + itemCopy.EveryOnePermissions = item.EveryOnePermissions & + nextPerms; - // Intentionally killing "share with group" here, as - // the recipient will not have the group this is - // set to - itemCopy.GroupPermissions = 0; - } - else + // Intentionally killing "share with group" here, as + // the recipient will not have the group this is + // set to + itemCopy.GroupPermissions = 0; + } + else + { + itemCopy.CurrentPermissions = item.CurrentPermissions; + itemCopy.NextPermissions = item.NextPermissions; + itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; + itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; + itemCopy.BasePermissions = item.BasePermissions; + } + + if (itemCopy.Folder == UUID.Zero) + { + InventoryFolderBase folder = InventoryService.GetFolderForType(recipient, (AssetType)itemCopy.AssetType); + + if (folder != null) { - itemCopy.CurrentPermissions = item.CurrentPermissions; - itemCopy.NextPermissions = item.NextPermissions; - itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; - itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; - itemCopy.BasePermissions = item.BasePermissions; + itemCopy.Folder = folder.ID; } - - if (itemCopy.Folder == UUID.Zero) + else { - InventoryFolderBase folder = InventoryService.GetFolderForType(recipient, (AssetType)itemCopy.AssetType); + InventoryFolderBase root = InventoryService.GetRootFolder(recipient); - if (folder != null) - { - itemCopy.Folder = folder.ID; - } + if (root != null) + itemCopy.Folder = root.ID; else - { - InventoryFolderBase root = InventoryService.GetRootFolder(recipient); - - if (root != null) - itemCopy.Folder = root.ID; - else - return null; // No destination - } + return null; // No destination } + } - itemCopy.GroupID = UUID.Zero; - itemCopy.GroupOwned = false; - itemCopy.Flags = item.Flags; - itemCopy.SalePrice = item.SalePrice; - itemCopy.SaleType = item.SaleType; + itemCopy.GroupID = UUID.Zero; + itemCopy.GroupOwned = false; + itemCopy.Flags = item.Flags; + itemCopy.SalePrice = item.SalePrice; + itemCopy.SaleType = item.SaleType; - if (AddInventoryItem(itemCopy)) - { - IInventoryAccessModule invAccess = RequestModuleInterface(); - if (invAccess != null) - invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); - } + if (AddInventoryItem(itemCopy)) + { + IInventoryAccessModule invAccess = RequestModuleInterface(); + if (invAccess != null) + invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); + } - if (!Permissions.BypassPermissions()) + if (!Permissions.BypassPermissions()) + { + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) { - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - { - List items = new List(); - items.Add(itemId); - InventoryService.DeleteItems(senderId, items); - } + List items = new List(); + items.Add(itemId); + InventoryService.DeleteItems(senderId, items); } - - return itemCopy; - } - else - { - m_log.WarnFormat("[AGENT INVENTORY]: Failed to find item {0} or item does not belong to giver ", itemId); - return null; } + return itemCopy; } /// diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 83f0686..10c275e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -59,19 +59,24 @@ namespace OpenSim.Region.Framework.Tests // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneSetupHelpers.SetupScene(); - UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); - UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene); + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); InventoryItemBase retrievedItem1 - = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Objects/item1"); + = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1"); Assert.That(retrievedItem1, Is.Not.Null); // Try giving back the freshly received item - //scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID); + scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID); + + List reretrievedItems + = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1"); + + Assert.That(reretrievedItems.Count, Is.EqualTo(2)); } [Test] @@ -81,8 +86,8 @@ namespace OpenSim.Region.Framework.Tests // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneSetupHelpers.SetupScene(); - UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); - UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene); + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); InventoryFolderBase folder1 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); -- cgit v1.1 From fe471b64245f99a895d661a8952fc3c226ba6bfe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 02:44:53 +0100 Subject: Extend TestGiveInventoryFolder() to test giving back the freshly received folder --- OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 10c275e..abca792 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -97,6 +97,14 @@ namespace OpenSim.Region.Framework.Tests = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); Assert.That(retrievedFolder1, Is.Not.Null); + + // Try giving back the freshly received folder + scene.GiveInventoryFolder(user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); + + List reretrievedFolders + = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); + + Assert.That(reretrievedFolders.Count, Is.EqualTo(2)); } } } \ No newline at end of file -- cgit v1.1 From 02b40670be7d6c42de7235285f2e136aa6109fd3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 7 Jun 2011 12:10:57 -0700 Subject: This makes the display names work better for foreigners --- OpenSim/Region/Framework/Scenes/Scene.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 77301d8..588d627 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2571,12 +2571,38 @@ namespace OpenSim.Region.Framework.Scenes if (GetScenePresence(client.AgentId) != null) { m_LastLogin = Util.EnvironmentTickCount(); + + // Cache the user's name + CacheUserName(aCircuit); + EventManager.TriggerOnNewClient(client); if (vialogin) EventManager.TriggerOnClientLogin(client); } } + private void CacheUserName(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("@")) + { + string[] parts = aCircuit.firstname.Split('.'); + if (parts.Length >= 2) + { + first = parts[0]; + last = parts[1]; + } + } + uMan.AddUser(aCircuit.AgentID, first, last, homeURL); + } + } + private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) { vialogin = false; -- cgit v1.1 From 9759b2a4bb5e5e2bed4c74cea05be58640c8e7c3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Jun 2011 15:18:14 -0700 Subject: Added EventManager.OnPrimsLoaded, an event that modules can hook up onto so that they know when the scene's objects have been loaded from the DB. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 24 ++++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 1 + 2 files changed, 25 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index b43d5f0..b67937d 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -392,6 +392,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void LoginsEnabled(string regionName); public event LoginsEnabled OnLoginsEnabled; + public delegate void PrimsLoaded(Scene s); + public event PrimsLoaded OnPrimsLoaded; + public class MoneyTransferArgs : EventArgs { public UUID sender; @@ -2242,5 +2245,26 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerPrimsLoaded(Scene s) + { + PrimsLoaded handler = OnPrimsLoaded; + + if (handler != null) + { + foreach (PrimsLoaded d in handler.GetInvocationList()) + { + try + { + d(s); + } + catch (Exception e) + { + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for PrimsLoaded failed - continuing {0} - {1}", + e.Message, e.StackTrace); + } + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 588d627..f122b58 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1754,6 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); LoadingPrims = false; + EventManager.TriggerPrimsLoaded(this); } -- cgit v1.1 From 80fc607d7536d4f375da4d01280a00fe656654c4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Jun 2011 16:01:33 -0700 Subject: Fixed "Unknown User" listed as creator/owner on prims created with the Build button by foreign visitors. Added command to the UserManagementModule to list all the known bindings between user UUIDs and their names: show user-names. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f122b58..bdf3d1d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1910,6 +1910,10 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.SetGroup(groupID, null); } + IUserManagement uman = RequestModuleInterface(); + if (uman != null) + sceneObject.RootPart.CreatorIdentification = uman.GetUserUUI(ownerID); + sceneObject.ScheduleGroupForFullUpdate(); return sceneObject; -- cgit v1.1 From 2bc8dcfdbd987ca4a47270c62b77a7eb9ac0f851 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 10 Jun 2011 02:27:45 +0100 Subject: minor: add method doc to make it clear that click action is fired when the click action is changed, not when a prim is clicked --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index cdb4e41..a078291 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1504,7 +1504,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Handle a prim description set request from a viewer. /// /// /// @@ -1521,8 +1521,17 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Set a click action for the prim. + /// + /// + /// + /// protected internal void PrimClickAction(IClientAPI remoteClient, uint primLocalID, string clickAction) { +// m_log.DebugFormat( +// "[SCENEGRAPH]: User {0} set click action for {1} to {2}", remoteClient.Name, primLocalID, clickAction); + SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { -- cgit v1.1 From b5518dc90631014a4aa3dbb6c27fd5d4c9f612c9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 10 Jun 2011 20:40:14 +0100 Subject: minor: Add some commented out destructor logging messages for potential future use. At the moment, client and scene objects are being garbage collected as expected, at least in simple scenarios. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 5 +++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 +++++++ 2 files changed, 12 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9b9374b..79660a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -469,6 +469,11 @@ namespace OpenSim.Region.Framework.Scenes #endregion +// ~SceneObjectGroup() +// { +// m_log.DebugFormat("[SCENE OBJECT GROUP]: Destructor called for {0}, local id {1}", Name, LocalId); +// } + #region Constructors /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 331abb2..a215b20 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -346,6 +346,13 @@ namespace OpenSim.Region.Framework.Scenes #endregion Fields +// ~SceneObjectPart() +// { +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", +// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); +// } + #region Constructors /// -- cgit v1.1 From fc7e17baf74a4b3ce4c47480f24266180dd4353d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 10 Jun 2011 21:49:25 +0100 Subject: When serializing objects, stop accidentally using the green text colour value for alpha This addresses http://opensimulator.org/mantis/view.php?id=5111 --- OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 6ae4f38..fcf7e0c 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1171,7 +1171,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture)); writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture)); writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture)); - writer.WriteElementString("A", sop.Color.G.ToString(Utils.EnUsCulture)); + writer.WriteElementString("A", sop.Color.A.ToString(Utils.EnUsCulture)); writer.WriteEndElement(); writer.WriteElementString("Text", sop.Text); -- cgit v1.1 From 29da57e3802948bbffce43c071e6c97742cabf84 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Wed, 15 Jun 2011 11:26:45 -0700 Subject: Add the PhysActor to the correct SOP when duplicating a physical prim. Thanks, MisterBlue --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 79660a3..f745169 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1449,18 +1449,23 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart part in partList) { + SceneObjectPart newPart; if (part.UUID != m_rootPart.UUID) { - SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); + newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); newPart.LinkNum = part.LinkNum; } + else + { + newPart = dupe.m_rootPart; + } // Need to duplicate the physics actor as well if (part.PhysActor != null && userExposed) { PrimitiveBaseShape pbs = part.Shape; - part.PhysActor + newPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( string.Format("{0}/{1}", part.Name, part.UUID), pbs, @@ -1469,8 +1474,8 @@ namespace OpenSim.Region.Framework.Scenes part.RotationOffset, part.PhysActor.IsPhysical); - part.PhysActor.LocalID = part.LocalId; - part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); + newPart.PhysActor.LocalID = part.LocalId; + newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); } } -- cgit v1.1 From ad84728aba1ea5efe0d237c89e1578657e6d8288 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Wed, 15 Jun 2011 11:31:32 -0700 Subject: Add localID to physical object creation functions. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f745169..42ac9aa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1467,6 +1467,7 @@ namespace OpenSim.Region.Framework.Scenes newPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( + part.LocalId, string.Format("{0}/{1}", part.Name, part.UUID), pbs, part.AbsolutePosition, @@ -1474,7 +1475,6 @@ namespace OpenSim.Region.Framework.Scenes part.RotationOffset, part.PhysActor.IsPhysical); - newPart.PhysActor.LocalID = part.LocalId; newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a215b20..c6d8c73 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1582,6 +1582,7 @@ namespace OpenSim.Region.Framework.Scenes if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) { PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( + LocalId, string.Format("{0}/{1}", Name, UUID), Shape, AbsolutePosition, @@ -1594,7 +1595,6 @@ namespace OpenSim.Region.Framework.Scenes { PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info PhysActor.SOPDescription = this.Description; - PhysActor.LocalID = LocalId; DoPhysicsPropertyUpdate(RigidBody, true); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); } @@ -4410,6 +4410,7 @@ namespace OpenSim.Region.Framework.Scenes { // It's not phantom anymore. So make sure the physics engine get's knowledge of it PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( + LocalId, string.Format("{0}/{1}", Name, UUID), Shape, AbsolutePosition, @@ -4420,7 +4421,6 @@ namespace OpenSim.Region.Framework.Scenes pa = PhysActor; if (pa != null) { - pa.LocalID = LocalId; DoPhysicsPropertyUpdate(UsePhysics, true); if (m_parentGroup != null) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f6295b1..80aafd0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3295,7 +3295,7 @@ namespace OpenSim.Region.Framework.Scenes Vector3 pVec = AbsolutePosition; // Old bug where the height was in centimeters instead of meters - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, + m_physicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); scene.AddPhysicsActorTaint(m_physicsActor); -- cgit v1.1