diff options
author | Mic Bowman | 2011-04-18 11:29:43 -0700 |
---|---|---|
committer | Mic Bowman | 2011-04-18 11:29:43 -0700 |
commit | 452ae375f0fdd62ba16fb170869ea470c6906cfe (patch) | |
tree | b5a7d364e509f2ff7f1b9086e2ba5658f4ee99ac /OpenSim/Region | |
parent | Remove the call to remove tokens from the parent. Under heavy load (diff) | |
parent | Mantis #5442: Add admin_save_heightmap (diff) | |
download | opensim-SC-452ae375f0fdd62ba16fb170869ea470c6906cfe.zip opensim-SC-452ae375f0fdd62ba16fb170869ea470c6906cfe.tar.gz opensim-SC-452ae375f0fdd62ba16fb170869ea470c6906cfe.tar.bz2 opensim-SC-452ae375f0fdd62ba16fb170869ea470c6906cfe.tar.xz |
Merge branch 'master' into test-merge0418
Diffstat (limited to 'OpenSim/Region')
14 files changed, 398 insertions, 340 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 01170aa..f3d2f26 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -471,16 +471,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
471 | if (m_creatorIdForAssetId.ContainsKey(assetId)) | 471 | if (m_creatorIdForAssetId.ContainsKey(assetId)) |
472 | { | 472 | { |
473 | string xmlData = Utils.BytesToString(data); | 473 | string xmlData = Utils.BytesToString(data); |
474 | SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 474 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); |
475 | foreach (SceneObjectPart sop in sog.Parts) | 475 | |
476 | CoalescedSceneObjects coa = null; | ||
477 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | ||
478 | { | ||
479 | // m_log.DebugFormat( | ||
480 | // "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | ||
481 | |||
482 | sceneObjects.AddRange(coa.Objects); | ||
483 | } | ||
484 | else | ||
476 | { | 485 | { |
477 | if (sop.CreatorData == null || sop.CreatorData == "") | 486 | sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData)); |
478 | { | ||
479 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
480 | } | ||
481 | } | 487 | } |
482 | 488 | ||
483 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)); | 489 | foreach (SceneObjectGroup sog in sceneObjects) |
490 | foreach (SceneObjectPart sop in sog.Parts) | ||
491 | if (sop.CreatorData == null || sop.CreatorData == "") | ||
492 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
493 | |||
494 | if (coa != null) | ||
495 | data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa)); | ||
496 | else | ||
497 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0])); | ||
484 | } | 498 | } |
485 | } | 499 | } |
486 | 500 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index e5127a0..5ba08ee 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -68,17 +68,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
68 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), | 68 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), |
69 | FirstName = "Mr", | 69 | FirstName = "Mr", |
70 | LastName = "Tiddles" }; | 70 | LastName = "Tiddles" }; |
71 | |||
71 | protected UserAccount m_uaLL1 | 72 | protected UserAccount m_uaLL1 |
72 | = new UserAccount { | 73 | = new UserAccount { |
73 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), | 74 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), |
74 | FirstName = "Lord", | 75 | FirstName = "Lord", |
75 | LastName = "Lucan" }; | 76 | LastName = "Lucan" }; |
77 | |||
76 | protected UserAccount m_uaLL2 | 78 | protected UserAccount m_uaLL2 |
77 | = new UserAccount { | 79 | = new UserAccount { |
78 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), | 80 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), |
79 | FirstName = "Lord", | 81 | FirstName = "Lord", |
80 | LastName = "Lucan" }; | 82 | LastName = "Lucan" }; |
83 | |||
81 | protected string m_item1Name = "Ray Gun Item"; | 84 | protected string m_item1Name = "Ray Gun Item"; |
85 | protected string m_coaItemName = "Coalesced Item"; | ||
82 | 86 | ||
83 | [SetUp] | 87 | [SetUp] |
84 | public virtual void SetUp() | 88 | public virtual void SetUp() |
@@ -97,38 +101,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
97 | // log4net.Config.XmlConfigurator.Configure(); | 101 | // log4net.Config.XmlConfigurator.Configure(); |
98 | 102 | ||
99 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 103 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
100 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 104 | Scene scene = SceneSetupHelpers.SetupScene(); |
101 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 105 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
102 | 106 | ||
103 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 107 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
104 | 108 | ||
105 | MemoryStream archiveWriteStream = new MemoryStream(); | 109 | MemoryStream archiveWriteStream = new MemoryStream(); |
106 | 110 | ||
107 | // Create asset | 111 | // Create scene object asset |
108 | SceneObjectGroup object1; | 112 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
109 | SceneObjectPart part1; | 113 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); |
110 | { | ||
111 | string partName = "Ray Gun Object"; | ||
112 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | ||
113 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | ||
114 | Vector3 groupPosition = new Vector3(10, 20, 30); | ||
115 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | ||
116 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
117 | |||
118 | part1 | ||
119 | = new SceneObjectPart( | ||
120 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
121 | part1.Name = partName; | ||
122 | |||
123 | object1 = new SceneObjectGroup(part1); | ||
124 | scene.AddNewSceneObject(object1, false); | ||
125 | } | ||
126 | 114 | ||
127 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 115 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
128 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 116 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
129 | scene.AssetService.Store(asset1); | 117 | scene.AssetService.Store(asset1); |
130 | 118 | ||
131 | // Create item | 119 | // Create scene object item |
132 | InventoryItemBase item1 = new InventoryItemBase(); | 120 | InventoryItemBase item1 = new InventoryItemBase(); |
133 | item1.Name = m_item1Name; | 121 | item1.Name = m_item1Name; |
134 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 122 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
@@ -139,8 +127,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
139 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 127 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
140 | scene.AddInventoryItem(item1); | 128 | scene.AddInventoryItem(item1); |
141 | 129 | ||
130 | // Create coalesced objects asset | ||
131 | SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); | ||
132 | cobj1.AbsolutePosition = new Vector3(15, 30, 45); | ||
133 | |||
134 | SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); | ||
135 | cobj2.AbsolutePosition = new Vector3(25, 50, 75); | ||
136 | |||
137 | CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); | ||
138 | |||
139 | AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa); | ||
140 | scene.AssetService.Store(coaAsset); | ||
141 | |||
142 | // Create coalesced objects inventory item | ||
143 | InventoryItemBase coaItem = new InventoryItemBase(); | ||
144 | coaItem.Name = m_coaItemName; | ||
145 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); | ||
146 | coaItem.AssetID = coaAsset.FullID; | ||
147 | coaItem.GroupID = UUID.Random(); | ||
148 | coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; | ||
149 | coaItem.Owner = m_uaLL1.PrincipalID; | ||
150 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | ||
151 | scene.AddInventoryItem(coaItem); | ||
152 | |||
142 | archiverModule.ArchiveInventory( | 153 | archiverModule.ArchiveInventory( |
143 | Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream); | 154 | Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); |
144 | 155 | ||
145 | m_iarStreamBytes = archiveWriteStream.ToArray(); | 156 | m_iarStreamBytes = archiveWriteStream.ToArray(); |
146 | } | 157 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 7f156f8..d03f6da 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -62,9 +62,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
62 | SerialiserModule serialiserModule = new SerialiserModule(); | 62 | SerialiserModule serialiserModule = new SerialiserModule(); |
63 | m_archiverModule = new InventoryArchiverModule(); | 63 | m_archiverModule = new InventoryArchiverModule(); |
64 | 64 | ||
65 | m_scene = SceneSetupHelpers.SetupScene("Inventory"); | 65 | m_scene = SceneSetupHelpers.SetupScene(); |
66 | SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | 66 | SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); |
67 | } | 67 | } |
68 | |||
69 | [Test] | ||
70 | public void TestLoadCoalesecedItem() | ||
71 | { | ||
72 | TestHelper.InMethod(); | ||
73 | // log4net.Config.XmlConfigurator.Configure(); | ||
74 | |||
75 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | ||
76 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | ||
77 | |||
78 | InventoryItemBase coaItem | ||
79 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | ||
80 | |||
81 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); | ||
82 | |||
83 | string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); | ||
84 | |||
85 | CoalescedSceneObjects coa; | ||
86 | bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); | ||
87 | |||
88 | Assert.That(readResult, Is.True); | ||
89 | Assert.That(coa.Count, Is.EqualTo(2)); | ||
90 | |||
91 | List<SceneObjectGroup> coaObjects = coa.Objects; | ||
92 | Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120"))); | ||
93 | Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45))); | ||
94 | |||
95 | Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); | ||
96 | Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); | ||
97 | } | ||
68 | 98 | ||
69 | /// <summary> | 99 | /// <summary> |
70 | /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive | 100 | /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive |
@@ -84,24 +114,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
84 | UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); | 114 | UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); |
85 | 115 | ||
86 | // Create asset | 116 | // Create asset |
87 | SceneObjectGroup object1; | 117 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
88 | SceneObjectPart part1; | 118 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); |
89 | { | ||
90 | string partName = "My Little Dog Object"; | ||
91 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | ||
92 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | ||
93 | Vector3 groupPosition = new Vector3(10, 20, 30); | ||
94 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | ||
95 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
96 | |||
97 | part1 | ||
98 | = new SceneObjectPart( | ||
99 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
100 | part1.Name = partName; | ||
101 | |||
102 | object1 = new SceneObjectGroup(part1); | ||
103 | m_scene.AddNewSceneObject(object1, false); | ||
104 | } | ||
105 | 119 | ||
106 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 120 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
107 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 121 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 0e8f647..c7dae52 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
63 | 63 | ||
64 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 64 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
65 | 65 | ||
66 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 66 | Scene scene = SceneSetupHelpers.SetupScene(); |
67 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 67 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
68 | 68 | ||
69 | // Create user | 69 | // Create user |
@@ -180,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
180 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 180 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
181 | 181 | ||
182 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 182 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
183 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 183 | Scene scene = SceneSetupHelpers.SetupScene(); |
184 | 184 | ||
185 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 185 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
186 | 186 | ||
@@ -223,7 +223,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
223 | 223 | ||
224 | SerialiserModule serialiserModule = new SerialiserModule(); | 224 | SerialiserModule serialiserModule = new SerialiserModule(); |
225 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 225 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
226 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 226 | Scene scene = SceneSetupHelpers.SetupScene(); |
227 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 227 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
228 | 228 | ||
229 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password"); | 229 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password"); |
@@ -248,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
248 | 248 | ||
249 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 249 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
250 | 250 | ||
251 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 251 | Scene scene = SceneSetupHelpers.SetupScene(); |
252 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 252 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
253 | 253 | ||
254 | // Create user | 254 | // Create user |
@@ -327,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
327 | TestHelper.InMethod(); | 327 | TestHelper.InMethod(); |
328 | // log4net.Config.XmlConfigurator.Configure(); | 328 | // log4net.Config.XmlConfigurator.Configure(); |
329 | 329 | ||
330 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 330 | Scene scene = SceneSetupHelpers.SetupScene(); |
331 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 331 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); |
332 | 332 | ||
333 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); | 333 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); |
@@ -394,7 +394,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
394 | TestHelper.InMethod(); | 394 | TestHelper.InMethod(); |
395 | //log4net.Config.XmlConfigurator.Configure(); | 395 | //log4net.Config.XmlConfigurator.Configure(); |
396 | 396 | ||
397 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 397 | Scene scene = SceneSetupHelpers.SetupScene(); |
398 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 398 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); |
399 | 399 | ||
400 | string folder1ExistingName = "a"; | 400 | string folder1ExistingName = "a"; |
@@ -445,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
445 | TestHelper.InMethod(); | 445 | TestHelper.InMethod(); |
446 | // log4net.Config.XmlConfigurator.Configure(); | 446 | // log4net.Config.XmlConfigurator.Configure(); |
447 | 447 | ||
448 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 448 | Scene scene = SceneSetupHelpers.SetupScene(); |
449 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 449 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); |
450 | 450 | ||
451 | string folder1ExistingName = "a"; | 451 | string folder1ExistingName = "a"; |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 4565d10..8c99983 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -129,35 +129,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
129 | } | 129 | } |
130 | 130 | ||
131 | /// | 131 | /// |
132 | /// DeleteToInventory | 132 | /// Used in DeleteToInventory |
133 | /// | 133 | /// |
134 | public override UUID DeleteToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) | 134 | protected override void ExportAsset(UUID agentID, UUID assetID) |
135 | { | 135 | { |
136 | UUID ret = UUID.Zero; | ||
137 | |||
138 | // HACK: Only works for lists of length one. | ||
139 | // Intermediate version, just to make things compile | ||
140 | foreach (SceneObjectGroup g in objectGroups) | ||
141 | ret = DeleteToInventory(action, folderID, g, remoteClient); | ||
142 | |||
143 | return ret; | ||
144 | } | ||
145 | |||
146 | // DO NOT OVERRIDE THE BASE METHOD | ||
147 | public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | ||
148 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | ||
149 | { | ||
150 | UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient); | ||
151 | |||
152 | if (!assetID.Equals(UUID.Zero)) | 136 | if (!assetID.Equals(UUID.Zero)) |
153 | { | 137 | UploadInventoryItem(agentID, assetID, "", 0); |
154 | if (remoteClient != null) | ||
155 | UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); | ||
156 | } | ||
157 | else | 138 | else |
158 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); | 139 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); |
159 | |||
160 | return assetID; | ||
161 | } | 140 | } |
162 | 141 | ||
163 | /// | 142 | /// |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index c0946f4..a716326 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -274,238 +274,278 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
274 | foreach (SceneObjectGroup objectGroup in objlist) | 274 | foreach (SceneObjectGroup objectGroup in objlist) |
275 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; | 275 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; |
276 | 276 | ||
277 | // Get the user info of the item destination | 277 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); |
278 | // | 278 | if (item == null) |
279 | UUID userID = UUID.Zero; | 279 | return UUID.Zero; |
280 | 280 | ||
281 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | 281 | // Can't know creator is the same, so null it in inventory |
282 | action == DeRezAction.SaveToExistingUserInventoryItem) | 282 | if (objlist.Count > 1) |
283 | { | 283 | { |
284 | // Take or take copy require a taker | 284 | item.CreatorId = UUID.Zero.ToString(); |
285 | // Saving changes requires a local user | 285 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; |
286 | // | ||
287 | if (remoteClient == null) | ||
288 | return UUID.Zero; | ||
289 | |||
290 | userID = remoteClient.AgentId; | ||
291 | } | 286 | } |
292 | else | 287 | else |
293 | { | 288 | { |
294 | // All returns / deletes go to the object owner | 289 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); |
295 | // | 290 | item.SaleType = objlist[0].RootPart.ObjectSaleType; |
296 | userID = objlist[0].RootPart.OwnerID; | 291 | item.SalePrice = objlist[0].RootPart.SalePrice; |
297 | } | 292 | } |
298 | 293 | ||
299 | if (userID == UUID.Zero) // Can't proceed | 294 | AssetBase asset = CreateAsset( |
300 | { | 295 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), |
301 | return UUID.Zero; | 296 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), |
302 | } | 297 | (sbyte)AssetType.Object, |
303 | 298 | Utils.StringToBytes(itemXml), | |
304 | // If we're returning someone's item, it goes back to the | 299 | objlist[0].OwnerID.ToString()); |
305 | // owner's Lost And Found folder. | 300 | m_Scene.AssetService.Store(asset); |
306 | // Delete is treated like return in this case | ||
307 | // Deleting your own items makes them go to trash | ||
308 | // | ||
309 | 301 | ||
310 | InventoryFolderBase folder = null; | 302 | item.AssetID = asset.FullID; |
311 | InventoryItemBase item = null; | 303 | assetID = asset.FullID; |
312 | 304 | ||
313 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 305 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
314 | { | 306 | { |
315 | item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); | 307 | m_Scene.InventoryService.UpdateItem(item); |
316 | item = m_Scene.InventoryService.GetItem(item); | ||
317 | |||
318 | //item = userInfo.RootFolder.FindItem( | ||
319 | // objectGroup.RootPart.FromUserInventoryItemID); | ||
320 | |||
321 | if (null == item) | ||
322 | { | ||
323 | m_log.DebugFormat( | ||
324 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
325 | objlist[0].Name, objlist[0].UUID); | ||
326 | return UUID.Zero; | ||
327 | } | ||
328 | } | 308 | } |
329 | else | 309 | else |
330 | { | 310 | { |
331 | // Folder magic | 311 | AddPermissions(item, objlist[0], objlist, remoteClient); |
332 | // | ||
333 | if (action == DeRezAction.Delete) | ||
334 | { | ||
335 | // Deleting someone else's item | ||
336 | // | ||
337 | if (remoteClient == null || | ||
338 | objlist[0].OwnerID != remoteClient.AgentId) | ||
339 | { | ||
340 | 312 | ||
341 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 313 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
342 | } | 314 | item.Description = asset.Description; |
343 | else | 315 | item.Name = asset.Name; |
344 | { | 316 | item.AssetType = asset.Type; |
345 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
346 | } | ||
347 | } | ||
348 | else if (action == DeRezAction.Return) | ||
349 | { | ||
350 | 317 | ||
351 | // Dump to lost + found unconditionally | 318 | m_Scene.AddInventoryItem(item); |
352 | // | ||
353 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
354 | } | ||
355 | 319 | ||
356 | if (folderID == UUID.Zero && folder == null) | 320 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
357 | { | 321 | { |
358 | if (action == DeRezAction.Delete) | 322 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
359 | { | ||
360 | // Deletes go to trash by default | ||
361 | // | ||
362 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
363 | } | ||
364 | else | ||
365 | { | ||
366 | if (remoteClient == null || | ||
367 | objlist[0].OwnerID != remoteClient.AgentId) | ||
368 | { | ||
369 | // Taking copy of another person's item. Take to | ||
370 | // Objects folder. | ||
371 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
372 | } | ||
373 | else | ||
374 | { | ||
375 | // Catch all. Use lost & found | ||
376 | // | ||
377 | |||
378 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
379 | } | ||
380 | } | ||
381 | } | 323 | } |
382 | 324 | else | |
383 | // Override and put into where it came from, if it came | ||
384 | // from anywhere in inventory | ||
385 | // | ||
386 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | ||
387 | { | 325 | { |
388 | if (objlist[0].RootPart.FromFolderID != UUID.Zero) | 326 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); |
327 | if (notifyUser != null) | ||
389 | { | 328 | { |
390 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); | 329 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); |
391 | folder = m_Scene.InventoryService.GetFolder(f); | ||
392 | } | 330 | } |
393 | } | 331 | } |
332 | } | ||
394 | 333 | ||
395 | if (folder == null) // None of the above | 334 | // This is a hook to do some per-asset post-processing for subclasses that need that |
396 | { | 335 | ExportAsset(remoteClient.AgentId, assetID); |
397 | folder = new InventoryFolderBase(folderID); | 336 | } |
337 | |||
338 | return assetID; | ||
339 | } | ||
398 | 340 | ||
399 | if (folder == null) // Nowhere to put it | 341 | protected virtual void ExportAsset(UUID agentID, UUID assetID) |
400 | { | 342 | { |
401 | return UUID.Zero; | 343 | // nothing to do here |
402 | } | 344 | } |
403 | } | ||
404 | 345 | ||
405 | item = new InventoryItemBase(); | 346 | /// <summary> |
406 | // Can't know creator is the same, so null it in inventory | 347 | /// Add relevant permissions for an object to the item. |
407 | if (objlist.Count > 1) | 348 | /// </summary> |
408 | item.CreatorId = UUID.Zero.ToString(); | 349 | /// <param name="item"></param> |
409 | else | 350 | /// <param name="so"></param> |
410 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | 351 | /// <param name="objsForEffectivePermissions"></param> |
411 | item.ID = UUID.Random(); | 352 | /// <param name="remoteClient"></param> |
412 | item.InvType = (int)InventoryType.Object; | 353 | /// <returns></returns> |
413 | item.Folder = folder.ID; | 354 | protected InventoryItemBase AddPermissions( |
414 | item.Owner = userID; | 355 | InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions, |
415 | if (objlist.Count > 1) | 356 | IClientAPI remoteClient) |
357 | { | ||
358 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | ||
359 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | ||
360 | effectivePerms &= grp.GetEffectivePermissions(); | ||
361 | effectivePerms |= (uint)PermissionMask.Move; | ||
362 | |||
363 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | ||
364 | { | ||
365 | uint perms = effectivePerms; | ||
366 | uint nextPerms = (perms & 7) << 13; | ||
367 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
368 | perms &= ~(uint)PermissionMask.Copy; | ||
369 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
370 | perms &= ~(uint)PermissionMask.Transfer; | ||
371 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
372 | perms &= ~(uint)PermissionMask.Modify; | ||
373 | |||
374 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | ||
375 | item.CurrentPermissions = item.BasePermissions; | ||
376 | item.NextPermissions = perms & so.RootPart.NextOwnerMask; | ||
377 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | ||
378 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | ||
379 | |||
380 | // Magic number badness. Maybe this deserves an enum. | ||
381 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
382 | // and apply next owner perms on rez | ||
383 | item.CurrentPermissions |= 16; // Slam! | ||
384 | } | ||
385 | else | ||
386 | { | ||
387 | item.BasePermissions = effectivePerms; | ||
388 | item.CurrentPermissions = effectivePerms; | ||
389 | item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; | ||
390 | item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; | ||
391 | item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; | ||
392 | |||
393 | item.CurrentPermissions &= | ||
394 | ((uint)PermissionMask.Copy | | ||
395 | (uint)PermissionMask.Transfer | | ||
396 | (uint)PermissionMask.Modify | | ||
397 | (uint)PermissionMask.Move | | ||
398 | 7); // Preserve folded permissions | ||
399 | } | ||
400 | |||
401 | return item; | ||
402 | } | ||
403 | |||
404 | /// <summary> | ||
405 | /// Create an item using details for the given scene object. | ||
406 | /// </summary> | ||
407 | /// <param name="action"></param> | ||
408 | /// <param name="remoteClient"></param> | ||
409 | /// <param name="so"></param> | ||
410 | /// <param name="folderID"></param> | ||
411 | /// <returns></returns> | ||
412 | protected InventoryItemBase CreateItemForObject( | ||
413 | DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) | ||
414 | { | ||
415 | // Get the user info of the item destination | ||
416 | // | ||
417 | UUID userID = UUID.Zero; | ||
418 | |||
419 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | ||
420 | action == DeRezAction.SaveToExistingUserInventoryItem) | ||
421 | { | ||
422 | // Take or take copy require a taker | ||
423 | // Saving changes requires a local user | ||
424 | // | ||
425 | if (remoteClient == null) | ||
426 | return null; | ||
427 | |||
428 | userID = remoteClient.AgentId; | ||
429 | } | ||
430 | else | ||
431 | { | ||
432 | // All returns / deletes go to the object owner | ||
433 | // | ||
434 | userID = so.RootPart.OwnerID; | ||
435 | } | ||
436 | |||
437 | if (userID == UUID.Zero) // Can't proceed | ||
438 | { | ||
439 | return null; | ||
440 | } | ||
441 | |||
442 | // If we're returning someone's item, it goes back to the | ||
443 | // owner's Lost And Found folder. | ||
444 | // Delete is treated like return in this case | ||
445 | // Deleting your own items makes them go to trash | ||
446 | // | ||
447 | |||
448 | InventoryFolderBase folder = null; | ||
449 | InventoryItemBase item = null; | ||
450 | |||
451 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
452 | { | ||
453 | item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID); | ||
454 | item = m_Scene.InventoryService.GetItem(item); | ||
455 | |||
456 | //item = userInfo.RootFolder.FindItem( | ||
457 | // objectGroup.RootPart.FromUserInventoryItemID); | ||
458 | |||
459 | if (null == item) | ||
460 | { | ||
461 | m_log.DebugFormat( | ||
462 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
463 | so.Name, so.UUID); | ||
464 | |||
465 | return null; | ||
466 | } | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | // Folder magic | ||
471 | // | ||
472 | if (action == DeRezAction.Delete) | ||
473 | { | ||
474 | // Deleting someone else's item | ||
475 | // | ||
476 | if (remoteClient == null || | ||
477 | so.OwnerID != remoteClient.AgentId) | ||
416 | { | 478 | { |
417 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | 479 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
418 | } | 480 | } |
419 | else | 481 | else |
420 | { | 482 | { |
421 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | 483 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
422 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
423 | } | 484 | } |
424 | } | 485 | } |
425 | 486 | else if (action == DeRezAction.Return) | |
426 | AssetBase asset = CreateAsset( | ||
427 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), | ||
428 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), | ||
429 | (sbyte)AssetType.Object, | ||
430 | Utils.StringToBytes(itemXml), | ||
431 | objlist[0].OwnerID.ToString()); | ||
432 | m_Scene.AssetService.Store(asset); | ||
433 | assetID = asset.FullID; | ||
434 | |||
435 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
436 | { | 487 | { |
437 | item.AssetID = asset.FullID; | 488 | // Dump to lost + found unconditionally |
438 | m_Scene.InventoryService.UpdateItem(item); | 489 | // |
490 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
439 | } | 491 | } |
440 | else | ||
441 | { | ||
442 | item.AssetID = asset.FullID; | ||
443 | 492 | ||
444 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | 493 | if (folderID == UUID.Zero && folder == null) |
445 | foreach (SceneObjectGroup grp in objlist) | 494 | { |
446 | effectivePerms &= grp.GetEffectivePermissions(); | 495 | if (action == DeRezAction.Delete) |
447 | effectivePerms |= (uint)PermissionMask.Move; | ||
448 | |||
449 | if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | ||
450 | { | 496 | { |
451 | uint perms = effectivePerms; | 497 | // Deletes go to trash by default |
452 | uint nextPerms = (perms & 7) << 13; | 498 | // |
453 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | 499 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
454 | perms &= ~(uint)PermissionMask.Copy; | ||
455 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
456 | perms &= ~(uint)PermissionMask.Transfer; | ||
457 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
458 | perms &= ~(uint)PermissionMask.Modify; | ||
459 | |||
460 | item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
461 | item.CurrentPermissions = item.BasePermissions; | ||
462 | item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
463 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; | ||
464 | item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; | ||
465 | |||
466 | // Magic number badness. Maybe this deserves an enum. | ||
467 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
468 | // and apply next owner perms on rez | ||
469 | item.CurrentPermissions |= 16; // Slam! | ||
470 | } | 500 | } |
471 | else | 501 | else |
472 | { | 502 | { |
473 | item.BasePermissions = effectivePerms; | 503 | if (remoteClient == null || so.OwnerID != remoteClient.AgentId) |
474 | item.CurrentPermissions = effectivePerms; | 504 | { |
475 | item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; | 505 | // Taking copy of another person's item. Take to |
476 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; | 506 | // Objects folder. |
477 | item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; | 507 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); |
478 | 508 | } | |
479 | item.CurrentPermissions &= | 509 | else |
480 | ((uint)PermissionMask.Copy | | 510 | { |
481 | (uint)PermissionMask.Transfer | | 511 | // Catch all. Use lost & found |
482 | (uint)PermissionMask.Modify | | 512 | // |
483 | (uint)PermissionMask.Move | | ||
484 | 7); // Preserve folded permissions | ||
485 | } | ||
486 | |||
487 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
488 | item.Description = asset.Description; | ||
489 | item.Name = asset.Name; | ||
490 | item.AssetType = asset.Type; | ||
491 | 513 | ||
492 | m_Scene.AddInventoryItem(item); | 514 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
515 | } | ||
516 | } | ||
517 | } | ||
493 | 518 | ||
494 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 519 | // Override and put into where it came from, if it came |
520 | // from anywhere in inventory | ||
521 | // | ||
522 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | ||
523 | { | ||
524 | if (so.RootPart.FromFolderID != UUID.Zero) | ||
495 | { | 525 | { |
496 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | 526 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); |
527 | folder = m_Scene.InventoryService.GetFolder(f); | ||
497 | } | 528 | } |
498 | else | 529 | } |
530 | |||
531 | if (folder == null) // None of the above | ||
532 | { | ||
533 | folder = new InventoryFolderBase(folderID); | ||
534 | |||
535 | if (folder == null) // Nowhere to put it | ||
499 | { | 536 | { |
500 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | 537 | return null; |
501 | if (notifyUser != null) | ||
502 | { | ||
503 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
504 | } | ||
505 | } | 538 | } |
506 | } | 539 | } |
507 | } | 540 | |
508 | return assetID; | 541 | item = new InventoryItemBase(); |
542 | item.ID = UUID.Random(); | ||
543 | item.InvType = (int)InventoryType.Object; | ||
544 | item.Folder = folder.ID; | ||
545 | item.Owner = userID; | ||
546 | } | ||
547 | |||
548 | return item; | ||
509 | } | 549 | } |
510 | 550 | ||
511 | /// <summary> | 551 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index c76a30a..8d53cf1 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
66 | config.AddConfig("Modules"); | 66 | config.AddConfig("Modules"); |
67 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 67 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
68 | 68 | ||
69 | m_scene = SceneSetupHelpers.SetupScene("Inventory"); | 69 | m_scene = SceneSetupHelpers.SetupScene(); |
70 | SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam); | 70 | SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam); |
71 | 71 | ||
72 | // Create user | 72 | // Create user |
@@ -87,41 +87,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
87 | // log4net.Config.XmlConfigurator.Configure(); | 87 | // log4net.Config.XmlConfigurator.Configure(); |
88 | 88 | ||
89 | // Create asset | 89 | // Create asset |
90 | SceneObjectGroup object1; | 90 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); |
91 | { | 91 | object1.AbsolutePosition = new Vector3(15, 30, 45); |
92 | string partName = "Object1"; | 92 | |
93 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 93 | SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); |
94 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 94 | object2.AbsolutePosition = new Vector3(25, 50, 75); |
95 | Vector3 groupPosition = new Vector3(10, 20, 30); | ||
96 | Quaternion rotationOffset = Quaternion.Identity; | ||
97 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
98 | |||
99 | SceneObjectPart part1 | ||
100 | = new SceneObjectPart( | ||
101 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
102 | part1.Scale = new Vector3(1, 1, 1); | ||
103 | part1.Name = partName; | ||
104 | |||
105 | object1 = new SceneObjectGroup(part1); | ||
106 | } | ||
107 | |||
108 | SceneObjectGroup object2; | ||
109 | { | ||
110 | string partName = "Object2"; | ||
111 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | ||
112 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | ||
113 | Vector3 groupPosition = new Vector3(20, 40, 60); | ||
114 | Quaternion rotationOffset = Quaternion.Identity; | ||
115 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
116 | |||
117 | SceneObjectPart part1 | ||
118 | = new SceneObjectPart( | ||
119 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
120 | part1.Scale = new Vector3(1, 1, 1); | ||
121 | part1.Name = partName; | ||
122 | |||
123 | object2 = new SceneObjectGroup(part1); | ||
124 | } | ||
125 | 95 | ||
126 | CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); | 96 | CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); |
127 | 97 | ||
@@ -173,23 +143,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
173 | // log4net.Config.XmlConfigurator.Configure(); | 143 | // log4net.Config.XmlConfigurator.Configure(); |
174 | 144 | ||
175 | // Create asset | 145 | // Create asset |
176 | SceneObjectGroup object1; | 146 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40); |
177 | SceneObjectPart part1; | ||
178 | { | ||
179 | string partName = "My Little Dog Object"; | ||
180 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | ||
181 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | ||
182 | Vector3 groupPosition = new Vector3(10, 20, 30); | ||
183 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | ||
184 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
185 | |||
186 | part1 | ||
187 | = new SceneObjectPart( | ||
188 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
189 | part1.Name = partName; | ||
190 | |||
191 | object1 = new SceneObjectGroup(part1); | ||
192 | } | ||
193 | 147 | ||
194 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 148 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
195 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 149 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 1b3419d..51d1d59 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -195,6 +195,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
195 | 195 | ||
196 | public byte[] GetData(string id) | 196 | public byte[] GetData(string id) |
197 | { | 197 | { |
198 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Requesting data for asset {0}", id); | ||
199 | |||
198 | AssetBase asset = m_Cache.Get(id); | 200 | AssetBase asset = m_Cache.Get(id); |
199 | 201 | ||
200 | if (asset != null) | 202 | if (asset != null) |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index dafaa0c..a866fd9 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
237 | public void Init() | 237 | public void Init() |
238 | { | 238 | { |
239 | m_serialiserModule = new SerialiserModule(); | 239 | m_serialiserModule = new SerialiserModule(); |
240 | m_scene = SceneSetupHelpers.SetupScene(""); | 240 | m_scene = SceneSetupHelpers.SetupScene(); |
241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); | 241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); |
242 | } | 242 | } |
243 | 243 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 30563d4..19a9506 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -296,11 +296,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
296 | { | 296 | { |
297 | Vector3 val = value; | 297 | Vector3 val = value; |
298 | 298 | ||
299 | if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) | 299 | if (Scene != null) |
300 | || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | ||
301 | && !IsAttachmentCheckFull() && (!m_scene.LoadingPrims)) | ||
302 | { | 300 | { |
303 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | 301 | if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) |
302 | || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | ||
303 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | ||
304 | { | ||
305 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | ||
306 | } | ||
304 | } | 307 | } |
305 | 308 | ||
306 | if (RootPart.GetStatusSandbox()) | 309 | if (RootPart.GetStatusSandbox()) |
@@ -308,8 +311,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
308 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) | 311 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) |
309 | { | 312 | { |
310 | RootPart.ScriptSetPhysicsStatus(false); | 313 | RootPart.ScriptSetPhysicsStatus(false); |
311 | Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), | 314 | |
312 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); | 315 | if (Scene != null) |
316 | Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), | ||
317 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); | ||
318 | |||
313 | return; | 319 | return; |
314 | } | 320 | } |
315 | } | 321 | } |
@@ -326,7 +332,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
326 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 332 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); |
327 | //} | 333 | //} |
328 | 334 | ||
329 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | 335 | if (Scene != null) |
336 | Scene.EventManager.TriggerParcelPrimCountTainted(); | ||
330 | } | 337 | } |
331 | } | 338 | } |
332 | 339 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index a0e120a..babcb54 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -55,11 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
55 | /// <param name="coa"></param> | 55 | /// <param name="coa"></param> |
56 | /// <returns></returns> | 56 | /// <returns></returns> |
57 | public static string ToXml(CoalescedSceneObjects coa) | 57 | public static string ToXml(CoalescedSceneObjects coa) |
58 | { | 58 | { |
59 | // TODO: Should probably return an empty xml serialization rather than a blank string | ||
60 | if (!coa.HasObjects) | ||
61 | return ""; | ||
62 | |||
63 | using (StringWriter sw = new StringWriter()) | 59 | using (StringWriter sw = new StringWriter()) |
64 | { | 60 | { |
65 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | 61 | using (XmlTextWriter writer = new XmlTextWriter(sw)) |
@@ -105,10 +101,49 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
105 | 101 | ||
106 | string output = sw.ToString(); | 102 | string output = sw.ToString(); |
107 | 103 | ||
108 | // m_log.Debug(output); | 104 | // Console.WriteLine(output); |
109 | 105 | ||
110 | return output; | 106 | return output; |
111 | } | 107 | } |
112 | } | 108 | } |
109 | |||
110 | public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) | ||
111 | { | ||
112 | // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); | ||
113 | |||
114 | coa = null; | ||
115 | |||
116 | using (StringReader sr = new StringReader(xml)) | ||
117 | { | ||
118 | using (XmlTextReader reader = new XmlTextReader(sr)) | ||
119 | { | ||
120 | reader.Read(); | ||
121 | if (reader.Name != "CoalescedObject") | ||
122 | { | ||
123 | // m_log.DebugFormat( | ||
124 | // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", | ||
125 | // reader.Name); | ||
126 | |||
127 | return false; | ||
128 | } | ||
129 | |||
130 | coa = new CoalescedSceneObjects(UUID.Zero); | ||
131 | reader.Read(); | ||
132 | |||
133 | while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject") | ||
134 | { | ||
135 | if (reader.Name == "SceneObjectGroup") | ||
136 | { | ||
137 | string soXml = reader.ReadOuterXml(); | ||
138 | coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml)); | ||
139 | } | ||
140 | } | ||
141 | |||
142 | reader.ReadEndElement(); // CoalescedObject | ||
143 | } | ||
144 | } | ||
145 | |||
146 | return true; | ||
147 | } | ||
113 | } | 148 | } |
114 | } \ No newline at end of file | 149 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index 8588f7f..dd28416 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs | |||
@@ -117,11 +117,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
117 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 117 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); |
118 | 118 | ||
119 | 119 | ||
120 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, "grid"); | 120 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); |
121 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); | 121 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); |
122 | sceneB.RegisterRegionWithGrid(); | 122 | sceneB.RegisterRegionWithGrid(); |
123 | 123 | ||
124 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, "grid"); | 124 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); |
125 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); | 125 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); |
126 | sceneA.RegisterRegionWithGrid(); | 126 | sceneA.RegisterRegionWithGrid(); |
127 | 127 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 8138bcc..2aef4b0 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Tests | |||
101 | TestHelper.InMethod(); | 101 | TestHelper.InMethod(); |
102 | // log4net.Config.XmlConfigurator.Configure(); | 102 | // log4net.Config.XmlConfigurator.Configure(); |
103 | 103 | ||
104 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 104 | Scene scene = SceneSetupHelpers.SetupScene(); |
105 | UserAccount user1 = CreateUser(scene); | 105 | UserAccount user1 = CreateUser(scene); |
106 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); | 106 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); |
107 | SceneObjectPart sop1 = sog1.RootPart; | 107 | SceneObjectPart sop1 = sog1.RootPart; |
@@ -127,7 +127,7 @@ namespace OpenSim.Region.Framework.Tests | |||
127 | TestHelper.InMethod(); | 127 | TestHelper.InMethod(); |
128 | // log4net.Config.XmlConfigurator.Configure(); | 128 | // log4net.Config.XmlConfigurator.Configure(); |
129 | 129 | ||
130 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 130 | Scene scene = SceneSetupHelpers.SetupScene(); |
131 | UserAccount user1 = CreateUser(scene); | 131 | UserAccount user1 = CreateUser(scene); |
132 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); | 132 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); |
133 | SceneObjectPart sop1 = sog1.RootPart; | 133 | SceneObjectPart sop1 = sog1.RootPart; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 6b70865..dbf9e0f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -47,7 +47,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
47 | [SetUp] | 47 | [SetUp] |
48 | public void Init() | 48 | public void Init() |
49 | { | 49 | { |
50 | m_assetService = new MockAssetService(); | 50 | // FIXME: We don't need a full scene here - it would be enough to set up the asset service. |
51 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
52 | m_assetService = scene.AssetService; | ||
51 | m_uuidGatherer = new UuidGatherer(m_assetService); | 53 | m_uuidGatherer = new UuidGatherer(m_assetService); |
52 | } | 54 | } |
53 | 55 | ||