aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2011-04-17 18:48:53 +0100
committerMelanie2011-04-17 18:48:53 +0100
commit474910c9d624b53c010232ddb32b4002f58f1de0 (patch)
tree45ddab37c6afa0b095ffa0503640b9fe235bc400 /OpenSim/Region
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentMore descriptive debug msg for ServiceOSDRequest failures. (diff)
downloadopensim-SC_OLD-474910c9d624b53c010232ddb32b4002f58f1de0.zip
opensim-SC_OLD-474910c9d624b53c010232ddb32b4002f58f1de0.tar.gz
opensim-SC_OLD-474910c9d624b53c010232ddb32b4002f58f1de0.tar.bz2
opensim-SC_OLD-474910c9d624b53c010232ddb32b4002f58f1de0.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs57
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs52
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs174
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs46
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs54
-rw-r--r--OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs154
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs68
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs149
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs4
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs3
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
45 files changed, 882 insertions, 131 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 5b2484d..bdb73ad 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4394,6 +4394,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4394 4394
4395 public void SendEstateCovenantInformation(UUID covenant) 4395 public void SendEstateCovenantInformation(UUID covenant)
4396 { 4396 {
4397// m_log.DebugFormat("[LLCLIENTVIEW]: Sending estate covenant asset id of {0} to {1}", covenant, Name);
4398
4397 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); 4399 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
4398 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); 4400 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
4399 edata.CovenantID = covenant; 4401 edata.CovenantID = covenant;
@@ -4404,8 +4406,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4404 OutPacket(einfopack, ThrottleOutPacketType.Task); 4406 OutPacket(einfopack, ThrottleOutPacketType.Task);
4405 } 4407 }
4406 4408
4407 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) 4409 public void SendDetailedEstateData(
4410 UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition,
4411 UUID covenant, string abuseEmail, UUID estateOwner)
4408 { 4412 {
4413// m_log.DebugFormat(
4414// "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant);
4415
4409 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 4416 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
4410 packet.MethodData.Invoice = invoice; 4417 packet.MethodData.Invoice = invoice;
4411 packet.AgentData.TransactionID = UUID.Random(); 4418 packet.AgentData.TransactionID = UUID.Random();
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
index 878242a..d2278bc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
54 54
55 private Scene m_scene; 55 private Scene m_scene;
56 private IAssetService m_assetService; 56 private IAssetService m_assetService;
57 private bool m_enabled = true;
57 58
58 #region IRegionModuleBase Members 59 #region IRegionModuleBase Members
59 60
@@ -65,7 +66,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
65 66
66 public void Initialise(IConfigSource source) 67 public void Initialise(IConfigSource source)
67 { 68 {
68 69 IConfig startupConfig = source.Configs["Startup"];
70 if (startupConfig == null)
71 return;
72
73 if (!startupConfig.GetBoolean("ColladaMesh",true))
74 m_enabled = false;
69 } 75 }
70 76
71 public void AddRegion(Scene pScene) 77 public void AddRegion(Scene pScene)
@@ -101,16 +107,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
101 107
102 public void RegisterCaps(UUID agentID, Caps caps) 108 public void RegisterCaps(UUID agentID, Caps caps)
103 { 109 {
110 if(!m_enabled)
111 return;
112
104 UUID capID = UUID.Random(); 113 UUID capID = UUID.Random();
105 114
106// m_log.Info("[GETMESH]: /CAPS/" + capID); 115// m_log.Info("[GETMESH]: /CAPS/" + capID);
116
107 caps.RegisterHandler("GetMesh", 117 caps.RegisterHandler("GetMesh",
108 new RestHTTPHandler("GET", "/CAPS/" + capID, 118 new RestHTTPHandler("GET", "/CAPS/" + capID,
109 delegate(Hashtable m_dhttpMethod) 119 delegate(Hashtable m_dhttpMethod)
110 { 120 {
111 return ProcessGetMesh(m_dhttpMethod, agentID, caps); 121 return ProcessGetMesh(m_dhttpMethod, agentID, caps);
112 })); 122 }));
113
114 } 123 }
115 124
116 #endregion 125 #endregion
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
index 4a42c93..fb07cc9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
@@ -56,6 +56,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
56 private Scene m_scene; 56 private Scene m_scene;
57// private IAssetService m_assetService; 57// private IAssetService m_assetService;
58 private bool m_dumpAssetsToFile = false; 58 private bool m_dumpAssetsToFile = false;
59 private bool m_enabled = true;
59 60
60 #region IRegionModuleBase Members 61 #region IRegionModuleBase Members
61 62
@@ -67,7 +68,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
67 68
68 public void Initialise(IConfigSource source) 69 public void Initialise(IConfigSource source)
69 { 70 {
70 71 IConfig startupConfig = source.Configs["Startup"];
72 if (startupConfig == null)
73 return;
74
75 if (!startupConfig.GetBoolean("ColladaMesh",true))
76 m_enabled = false;
71 } 77 }
72 78
73 public void AddRegion(Scene pScene) 79 public void AddRegion(Scene pScene)
@@ -103,6 +109,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
103 109
104 public void RegisterCaps(UUID agentID, Caps caps) 110 public void RegisterCaps(UUID agentID, Caps caps)
105 { 111 {
112 if(!m_enabled)
113 return;
114
106 UUID capID = UUID.Random(); 115 UUID capID = UUID.Random();
107 116
108// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); 117// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID);
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 3148871..0cd05e3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -34,13 +34,13 @@ using Nini.Config;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
41using OpenSim.Services.Connectors.Friends; 42using OpenSim.Services.Connectors.Friends;
42using OpenSim.Server.Base; 43using OpenSim.Server.Base;
43using OpenSim.Framework.Servers.HttpServer;
44using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 44using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
45using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; 45using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
46using GridRegion = OpenSim.Services.Interfaces.GridRegion; 46using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 164ae50..1a0b914 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -33,7 +33,6 @@ using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Framework.Client; 36using OpenSim.Framework.Client;
38using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 9b98de3..2fff533 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -466,16 +466,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
466 if (m_creatorIdForAssetId.ContainsKey(assetId)) 466 if (m_creatorIdForAssetId.ContainsKey(assetId))
467 { 467 {
468 string xmlData = Utils.BytesToString(data); 468 string xmlData = Utils.BytesToString(data);
469 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); 469 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
470 foreach (SceneObjectPart sop in sog.Parts) 470
471 CoalescedSceneObjects coa = null;
472 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
473 {
474// m_log.DebugFormat(
475// "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
476
477 sceneObjects.AddRange(coa.Objects);
478 }
479 else
471 { 480 {
472 if (sop.CreatorData == null || sop.CreatorData == "") 481 sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData));
473 {
474 sop.CreatorID = m_creatorIdForAssetId[assetId];
475 }
476 } 482 }
477 483
478 data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)); 484 foreach (SceneObjectGroup sog in sceneObjects)
485 foreach (SceneObjectPart sop in sog.Parts)
486 if (sop.CreatorData == null || sop.CreatorData == "")
487 sop.CreatorID = m_creatorIdForAssetId[assetId];
488
489 if (coa != null)
490 data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
491 else
492 data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0]));
479 } 493 }
480 } 494 }
481 495
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 0fbd5e7..c91c0b2 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
279 float minX, minY, minZ; 279 float minX, minY, minZ;
280 float maxX, maxY, maxZ; 280 float maxX, maxY, maxZ;
281 281
282 Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist, 282 Vector3[] offsets = Scene.GetCombinedBoundingBox(objlist,
283 out minX, out maxX, out minY, out maxY, 283 out minX, out maxX, out minY, out maxY,
284 out minZ, out maxZ); 284 out minZ, out maxZ);
285 285
@@ -785,8 +785,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
785 // affect the name stored in the serialization, transfer 785 // affect the name stored in the serialization, transfer
786 // the correct name from the inventory to the 786 // the correct name from the inventory to the
787 // object itself before we rez. 787 // object itself before we rez.
788 // On coalesced objects, this has no effect. 788 // On coalesced objects, do the first one
789 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) 789 if (((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) || i == 0)
790 { 790 {
791 rootPart.Name = item.Name; 791 rootPart.Name = item.Name;
792 rootPart.Description = item.Description; 792 rootPart.Description = item.Description;
@@ -984,5 +984,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
984 } 984 }
985 985
986 #endregion 986 #endregion
987
988 protected virtual void ExportAsset(UUID agentID, UUID assetID)
989 {
990 }
987 } 991 }
988} 992}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
new file mode 100644
index 0000000..8d53cf1
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -0,0 +1,174 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Threading;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenSim.Data;
37using OpenSim.Framework;
38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External;
40using OpenSim.Framework.Communications;
41using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
42using OpenSim.Region.CoreModules.Framework.InventoryAccess;
43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48using OpenSim.Tests.Common.Setup;
49
50namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
51{
52 [TestFixture]
53 public class InventoryAccessModuleTests
54 {
55 protected TestScene m_scene;
56 protected BasicInventoryAccessModule m_iam;
57 protected UUID m_userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
58 protected TestClient m_tc;
59
60 [SetUp]
61 public void SetUp()
62 {
63 m_iam = new BasicInventoryAccessModule();
64
65 IConfigSource config = new IniConfigSource();
66 config.AddConfig("Modules");
67 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
68
69 m_scene = SceneSetupHelpers.SetupScene();
70 SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam);
71
72 // Create user
73 string userFirstName = "Jock";
74 string userLastName = "Stirrup";
75 string userPassword = "troll";
76 UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);
77
78 AgentCircuitData acd = new AgentCircuitData();
79 acd.AgentID = m_userId;
80 m_tc = new TestClient(acd, m_scene);
81 }
82
83 [Test]
84 public void TestRezCoalescedObject()
85 {
86 TestHelper.InMethod();
87// log4net.Config.XmlConfigurator.Configure();
88
89 // Create asset
90 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20);
91 object1.AbsolutePosition = new Vector3(15, 30, 45);
92
93 SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40);
94 object2.AbsolutePosition = new Vector3(25, 50, 75);
95
96 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);
97
98 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
99 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, coa);
100 m_scene.AssetService.Store(asset1);
101
102 // Create item
103 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
104 string item1Name = "My Little Dog";
105 InventoryItemBase item1 = new InventoryItemBase();
106 item1.Name = item1Name;
107 item1.AssetID = asset1.FullID;
108 item1.ID = item1Id;
109 InventoryFolderBase objsFolder
110 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
111 item1.Folder = objsFolder.ID;
112 m_scene.AddInventoryItem(item1);
113
114 SceneObjectGroup so
115 = m_iam.RezObject(
116 m_tc, item1Id, new Vector3(100, 100, 100), Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
117
118 Assert.That(so, Is.Not.Null);
119
120 Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(2));
121
122 SceneObjectPart retrievedObj1Part = m_scene.GetSceneObjectPart(object1.Name);
123 Assert.That(retrievedObj1Part, Is.Null);
124
125 retrievedObj1Part = m_scene.GetSceneObjectPart(item1.Name);
126 Assert.That(retrievedObj1Part, Is.Not.Null);
127 Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name));
128
129 // Bottom of coalescence is placed on ground, hence we end up with 100.5 rather than 85 since the bottom
130 // object is unit square.
131 Assert.That(retrievedObj1Part.AbsolutePosition, Is.EqualTo(new Vector3(95, 90, 100.5f)));
132
133 SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name);
134 Assert.That(retrievedObj2Part, Is.Not.Null);
135 Assert.That(retrievedObj2Part.Name, Is.EqualTo(object2.Name));
136 Assert.That(retrievedObj2Part.AbsolutePosition, Is.EqualTo(new Vector3(105, 110, 130.5f)));
137 }
138
139 [Test]
140 public void TestRezObject()
141 {
142 TestHelper.InMethod();
143// log4net.Config.XmlConfigurator.Configure();
144
145 // Create asset
146 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40);
147
148 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
149 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
150 m_scene.AssetService.Store(asset1);
151
152 // Create item
153 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
154 string item1Name = "My Little Dog";
155 InventoryItemBase item1 = new InventoryItemBase();
156 item1.Name = item1Name;
157 item1.AssetID = asset1.FullID;
158 item1.ID = item1Id;
159 InventoryFolderBase objsFolder
160 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
161 item1.Folder = objsFolder.ID;
162 m_scene.AddInventoryItem(item1);
163
164 SceneObjectGroup so
165 = m_iam.RezObject(
166 m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
167
168 Assert.That(so, Is.Not.Null);
169
170 SceneObjectPart retrievedPart = m_scene.GetSceneObjectPart(so.UUID);
171 Assert.That(retrievedPart, Is.Not.Null);
172 }
173 }
174} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
index e25700d..422f394 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs
index 02acddc..2b5beba 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs
index 6d975af..f29c074 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
index 2f96bcb..d2343c9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
index 209cf0d..53a8ace 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
@@ -31,9 +31,8 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
38using OpenSim.Server.Handlers.Base; 37using OpenSim.Server.Handlers.Base;
39 38
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index fcc69e9..fc64203 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs
index 2a9366c..f759470 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
index 35518d5..5c32632 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
index 5ee1c97..86b4926 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
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/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 6d9cb7f..598948a 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -261,6 +261,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
261 261
262 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) 262 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
263 { 263 {
264// m_log.DebugFormat(
265// "[ESTATE MANAGEMENT MODULE]: Handling request from {0} to change estate covenant to {1}",
266// remoteClient.Name, estateCovenantID);
267
264 Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; 268 Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
265 Scene.RegionInfo.RegionSettings.Save(); 269 Scene.RegionInfo.RegionSettings.Save();
266 TriggerRegionInfoChange(); 270 TriggerRegionInfoChange();
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/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
index d6fa093..21a9999 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
@@ -124,6 +124,52 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
124 colours.Save(stream, ImageFormat.Png); 124 colours.Save(stream, ImageFormat.Png);
125 } 125 }
126 126
127 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
128 int offsetX, int offsetY,
129 int fileWidth, int fileHeight,
130 int regionSizeX, int regionSizeY)
131
132 {
133 // We need to do this because:
134 // "Saving the image to the same file it was constructed from is not allowed and throws an exception."
135 string tempName = offsetX + "_ " + offsetY + "_" + filename;
136
137 Bitmap entireBitmap = null;
138 Bitmap thisBitmap = null;
139 if (File.Exists(filename))
140 {
141 File.Copy(filename, tempName);
142 entireBitmap = new Bitmap(tempName);
143 if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY)
144 {
145 // old file, let's overwrite it
146 entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
147 }
148 }
149 else
150 {
151 entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
152 }
153
154 thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
155 Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
156 for (int x = 0; x < regionSizeX; x++)
157 for (int y = 0; y < regionSizeY; y++)
158 entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
159
160 Save(entireBitmap, filename);
161 thisBitmap.Dispose();
162 entireBitmap.Dispose();
163
164 if (File.Exists(tempName))
165 File.Delete(tempName);
166 }
167
168 protected virtual void Save(Bitmap bmp, string filename)
169 {
170 bmp.Save(filename, ImageFormat.Png);
171 }
172
127 #endregion 173 #endregion
128 174
129 public override string ToString() 175 public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs
index 8667607..1a0d8ec 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs
@@ -76,6 +76,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
76 colours.Save(stream, ImageFormat.Jpeg); 76 colours.Save(stream, ImageFormat.Jpeg);
77 } 77 }
78 78
79 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
80 int offsetX, int offsetY,
81 int fileWidth, int fileHeight,
82 int regionSizeX, int regionSizeY)
83 {
84 throw new System.Exception("Not Implemented");
85 }
86
79 #endregion 87 #endregion
80 88
81 public override string ToString() 89 public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
index a70ef13..fad7641 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
@@ -240,6 +240,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
240 get { return ".raw"; } 240 get { return ".raw"; }
241 } 241 }
242 242
243 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
244 int offsetX, int offsetY,
245 int fileWidth, int fileHeight,
246 int regionSizeX, int regionSizeY)
247 {
248 throw new System.Exception("Not Implemented");
249 }
250
243 #endregion 251 #endregion
244 252
245 public override string ToString() 253 public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
index 3c76665..ba073ca 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
@@ -160,6 +160,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
160 bs.Close(); 160 bs.Close();
161 } 161 }
162 162
163 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
164 int offsetX, int offsetY,
165 int fileWidth, int fileHeight,
166 int regionSizeX, int regionSizeY)
167 {
168 throw new System.Exception("Not Implemented");
169 }
163 #endregion 170 #endregion
164 171
165 public override string ToString() 172 public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
index 2919897..2f37d9d 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
@@ -308,6 +308,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
308 get { return ".ter"; } 308 get { return ".ter"; }
309 } 309 }
310 310
311 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
312 int offsetX, int offsetY,
313 int fileWidth, int fileHeight,
314 int regionSizeX, int regionSizeY)
315 {
316 throw new System.Exception("Not Implemented");
317 }
318
311 #endregion 319 #endregion
312 320
313 public override string ToString() 321 public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
index 7403281..7237f90 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
@@ -38,5 +38,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
38 ITerrainChannel LoadStream(Stream stream); 38 ITerrainChannel LoadStream(Stream stream);
39 void SaveFile(string filename, ITerrainChannel map); 39 void SaveFile(string filename, ITerrainChannel map);
40 void SaveStream(Stream stream, ITerrainChannel map); 40 void SaveStream(Stream stream, ITerrainChannel map);
41 void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY);
41 } 42 }
42} \ No newline at end of file 43} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 9d968e7..2da6458 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -541,6 +541,39 @@ namespace OpenSim.Region.CoreModules.World.Terrain
541 } 541 }
542 542
543 /// <summary> 543 /// <summary>
544 /// Saves the terrain to a larger terrain file.
545 /// </summary>
546 /// <param name="filename">The terrain file to save</param>
547 /// <param name="fileWidth">The width of the file in units</param>
548 /// <param name="fileHeight">The height of the file in units</param>
549 /// <param name="fileStartX">Where to begin our slice</param>
550 /// <param name="fileStartY">Where to begin our slice</param>
551 public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY)
552 {
553 int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX;
554 int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY;
555
556 if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight)
557 {
558 // this region is included in the tile request
559 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
560 {
561 if (filename.EndsWith(loader.Key))
562 {
563 lock (m_scene)
564 {
565 loader.Value.SaveFile(m_channel, filename, offsetX, offsetY,
566 fileWidth, fileHeight,
567 (int)Constants.RegionSize,
568 (int)Constants.RegionSize);
569 }
570 return;
571 }
572 }
573 }
574 }
575
576 /// <summary>
544 /// Performs updates to the region periodically, synchronising physics and other heightmap aware sections 577 /// Performs updates to the region periodically, synchronising physics and other heightmap aware sections
545 /// </summary> 578 /// </summary>
546 private void EventManager_OnTerrainTick() 579 private void EventManager_OnTerrainTick()
@@ -862,6 +895,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
862 SaveToFile((string) args[0]); 895 SaveToFile((string) args[0]);
863 } 896 }
864 897
898 private void InterfaceSaveTileFile(Object[] args)
899 {
900 SaveToFile((string)args[0],
901 (int)args[1],
902 (int)args[2],
903 (int)args[3],
904 (int)args[4]);
905 }
906
865 private void InterfaceBakeTerrain(Object[] args) 907 private void InterfaceBakeTerrain(Object[] args)
866 { 908 {
867 UpdateRevertMap(); 909 UpdateRevertMap();
@@ -1117,6 +1159,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1117 loadFromTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file", 1159 loadFromTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file",
1118 "Integer"); 1160 "Integer");
1119 1161
1162 Command saveToTileCommand =
1163 new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file.");
1164 saveToTileCommand.AddArgument("filename",
1165 "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " +
1166 supportedFileExtensions, "String");
1167 saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
1168 saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
1169 saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",
1170 "Integer");
1171 saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file",
1172 "Integer");
1120 // Terrain adjustments 1173 // Terrain adjustments
1121 Command fillRegionCommand = 1174 Command fillRegionCommand =
1122 new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value."); 1175 new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value.");
@@ -1168,6 +1221,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1168 m_commander.RegisterCommand("load", loadFromFileCommand); 1221 m_commander.RegisterCommand("load", loadFromFileCommand);
1169 m_commander.RegisterCommand("load-tile", loadFromTileCommand); 1222 m_commander.RegisterCommand("load-tile", loadFromTileCommand);
1170 m_commander.RegisterCommand("save", saveToFileCommand); 1223 m_commander.RegisterCommand("save", saveToFileCommand);
1224 m_commander.RegisterCommand("save-tile", saveToTileCommand);
1171 m_commander.RegisterCommand("fill", fillRegionCommand); 1225 m_commander.RegisterCommand("fill", fillRegionCommand);
1172 m_commander.RegisterCommand("elevate", elevateCommand); 1226 m_commander.RegisterCommand("elevate", elevateCommand);
1173 m_commander.RegisterCommand("lower", lowerCommand); 1227 m_commander.RegisterCommand("lower", lowerCommand);
diff --git a/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs b/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs
new file mode 100644
index 0000000..af8ccda
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs
@@ -0,0 +1,154 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using OpenMetaverse;
32
33namespace OpenSim.Region.Framework.Scenes
34{
35 /// <summary>
36 /// Represents a coalescene of scene objects. A coalescence occurs when objects that are not in the same linkset
37 /// are grouped together.
38 /// </summary>
39 public class CoalescedSceneObjects
40 {
41 /// <summary>
42 /// The creator of this coalesence, though not necessarily the objects within it.
43 /// </summary>
44 public UUID CreatorId { get; set; }
45
46 /// <summary>
47 /// The number of objects in this coalesence
48 /// </summary>
49 public int Count
50 {
51 get
52 {
53 lock (m_memberObjects)
54 return m_memberObjects.Count;
55 }
56 }
57
58 /// <summary>
59 /// Does this coalesence have any member objects?
60 /// </summary>
61 public bool HasObjects { get { return Count > 0; } }
62
63 /// <summary>
64 /// Get the objects currently in this coalescence
65 /// </summary>
66 public List<SceneObjectGroup> Objects
67 {
68 get
69 {
70 lock (m_memberObjects)
71 return new List<SceneObjectGroup>(m_memberObjects);
72 }
73 }
74
75 /// <summary>
76 /// Get the scene that contains the objects in this coalescence. If there are no objects then null is returned.
77 /// </summary>
78 public Scene Scene
79 {
80 get
81 {
82 if (!HasObjects)
83 return null;
84 else
85 return Objects[0].Scene;
86 }
87 }
88
89 /// <summary>
90 /// At this point, we need to preserve the order of objects added to the coalescence, since the first
91 /// one will end up matching the item name when rerezzed.
92 /// </summary>
93 protected List<SceneObjectGroup> m_memberObjects = new List<SceneObjectGroup>();
94
95 public CoalescedSceneObjects(UUID creatorId)
96 {
97 CreatorId = creatorId;
98 }
99
100 public CoalescedSceneObjects(UUID creatorId, params SceneObjectGroup[] objs) : this(creatorId)
101 {
102 foreach (SceneObjectGroup obj in objs)
103 Add(obj);
104 }
105
106 /// <summary>
107 /// Add an object to the coalescence.
108 /// </summary>
109 /// <param name="obj"></param>
110 /// <param name="offset">The offset of the object within the group</param>
111 public void Add(SceneObjectGroup obj)
112 {
113 lock (m_memberObjects)
114 m_memberObjects.Add(obj);
115 }
116
117 /// <summary>
118 /// Removes a scene object from the coalescene
119 /// </summary>
120 /// <param name="sceneObjectId"></param>
121 /// <returns>true if the object was there to be removed, false if not.</returns>
122 public bool Remove(SceneObjectGroup obj)
123 {
124 lock (m_memberObjects)
125 return m_memberObjects.Remove(obj);
126 }
127
128 /// <summary>
129 /// Get the total size of the coalescence (the size required to cover all the objects within it) and the
130 /// offsets of each of those objects.
131 /// </summary>
132 /// <param name="size"></param>
133 /// <returns>
134 /// An array of offsets. The order of objects is the same as returned from the Objects property
135 /// </returns>
136 public Vector3[] GetSizeAndOffsets(out Vector3 size)
137 {
138 float minX, minY, minZ;
139 float maxX, maxY, maxZ;
140
141 Vector3[] offsets
142 = Scene.GetCombinedBoundingBox(
143 Objects, out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
144
145 float sizeX = maxX - minX;
146 float sizeY = maxY - minY;
147 float sizeZ = maxZ - minZ;
148
149 size = new Vector3(sizeX, sizeY, sizeZ);
150
151 return offsets;
152 }
153 }
154} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index cd6dc95..e4b0323 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -174,7 +174,11 @@ namespace OpenSim.Region.Framework.Scenes
174 ScenePresence presence = m_scene.GetScenePresence(client.AgentId); 174 ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
175 if (presence == null) 175 if (presence == null)
176 { 176 {
177 m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); 177 // this shouldn't happen, it basically means that we are prioritizing
178 // updates to send to a client that doesn't have a presence in the scene
179 // seems like there's race condition here...
180
181 // m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId);
178 // throw new InvalidOperationException("Prioritization agent not defined"); 182 // throw new InvalidOperationException("Prioritization agent not defined");
179 return Int32.MaxValue; 183 return Int32.MaxValue;
180 } 184 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0748954..f41c6b9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2005,11 +2005,49 @@ namespace OpenSim.Region.Framework.Scenes
2005 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 2005 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
2006 bool RezSelected, bool RemoveItem, UUID fromTaskID) 2006 bool RezSelected, bool RemoveItem, UUID fromTaskID)
2007 { 2007 {
2008 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 2008// m_log.DebugFormat(
2009 if (invAccess != null) 2009// "[PRIM INVENTORY]: RezObject from {0} for item {1} from task id {2}",
2010 invAccess.RezObject( 2010// remoteClient.Name, itemID, fromTaskID);
2011 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 2011
2012 RezSelected, RemoveItem, fromTaskID, false); 2012 if (fromTaskID == UUID.Zero)
2013 {
2014 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
2015 if (invAccess != null)
2016 invAccess.RezObject(
2017 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
2018 RezSelected, RemoveItem, fromTaskID, false);
2019 }
2020 else
2021 {
2022 SceneObjectPart part = GetSceneObjectPart(fromTaskID);
2023 if (part == null)
2024 {
2025 m_log.ErrorFormat(
2026 "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object",
2027 remoteClient.Name, itemID, fromTaskID);
2028
2029 return;
2030 }
2031
2032 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
2033 if (item == null)
2034 {
2035 m_log.ErrorFormat(
2036 "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item",
2037 remoteClient.Name, itemID, fromTaskID);
2038
2039 return;
2040 }
2041
2042 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
2043 Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
2044 Vector3 pos
2045 = GetNewRezLocation(
2046 RayStart, RayEnd, RayTargetID, Quaternion.Identity,
2047 BypassRayCast, bRayEndIsIntersection, true, scale, false);
2048
2049 RezObject(part, item, pos, null, Vector3.Zero, 0);
2050 }
2013 } 2051 }
2014 2052
2015 /// <summary> 2053 /// <summary>
@@ -2017,14 +2055,14 @@ namespace OpenSim.Region.Framework.Scenes
2017 /// </summary> 2055 /// </summary>
2018 /// <param name="sourcePart"></param> 2056 /// <param name="sourcePart"></param>
2019 /// <param name="item"></param> 2057 /// <param name="item"></param>
2020 /// <param name="pos"></param> 2058 /// <param name="pos">The position of the rezzed object.</param>
2021 /// <param name="rot"></param> 2059 /// <param name="rot">The rotation of the rezzed object. If null, then the rotation stored with the object
2022 /// <param name="vel"></param> 2060 /// will be used if it exists.</param>
2061 /// <param name="vel">The velocity of the rezzed object.</param>
2023 /// <param name="param"></param> 2062 /// <param name="param"></param>
2024 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns> 2063 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns>
2025 public virtual SceneObjectGroup RezObject( 2064 public virtual SceneObjectGroup RezObject(
2026 SceneObjectPart sourcePart, TaskInventoryItem item, 2065 SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param)
2027 Vector3 pos, Quaternion rot, Vector3 vel, int param)
2028 { 2066 {
2029 if (null == item) 2067 if (null == item)
2030 return null; 2068 return null;
@@ -2042,8 +2080,14 @@ namespace OpenSim.Region.Framework.Scenes
2042 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 2080 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
2043 sourcePart.Inventory.RemoveInventoryItem(item.ItemID); 2081 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2044 } 2082 }
2045 2083
2046 AddNewSceneObject(group, true, pos, rot, vel); 2084 AddNewSceneObject(group, true);
2085
2086 group.AbsolutePosition = pos;
2087 group.Velocity = vel;
2088
2089 if (rot != null)
2090 group.UpdateGroupRotationR((Quaternion)rot);
2047 2091
2048 // We can only call this after adding the scene object, since the scene object references the scene 2092 // We can only call this after adding the scene object, since the scene object references the scene
2049 // to find out if scripts should be activated at all. 2093 // to find out if scripts should be activated at all.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0e3cffb..eed5ebc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5038,7 +5038,20 @@ namespace OpenSim.Region.Framework.Scenes
5038 } 5038 }
5039 } 5039 }
5040 5040
5041 public Vector3[] GetCombinedBoundingBox(List<SceneObjectGroup> objects, out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) 5041 /// <summary>
5042 /// Get the volume of space that will encompass all the given objects.
5043 /// </summary>
5044 /// <param name="objects"></param>
5045 /// <param name="minX"></param>
5046 /// <param name="maxX"></param>
5047 /// <param name="minY"></param>
5048 /// <param name="maxY"></param>
5049 /// <param name="minZ"></param>
5050 /// <param name="maxZ"></param>
5051 /// <returns></returns>
5052 public static Vector3[] GetCombinedBoundingBox(
5053 List<SceneObjectGroup> objects,
5054 out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
5042 { 5055 {
5043 minX = 256; 5056 minX = 256;
5044 maxX = -256; 5057 maxX = -256;
@@ -5056,6 +5069,10 @@ namespace OpenSim.Region.Framework.Scenes
5056 Vector3 vec = g.AbsolutePosition; 5069 Vector3 vec = g.AbsolutePosition;
5057 5070
5058 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); 5071 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
5072
5073// m_log.DebugFormat(
5074// "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}",
5075// g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ));
5059 5076
5060 ominX += vec.X; 5077 ominX += vec.X;
5061 omaxX += vec.X; 5078 omaxX += vec.X;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 6773e08..3d6057b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1077,6 +1077,8 @@ namespace OpenSim.Region.Framework.Scenes
1077 { 1077 {
1078 foreach (SceneObjectPart p in ((SceneObjectGroup)entity).Parts) 1078 foreach (SceneObjectPart p in ((SceneObjectGroup)entity).Parts)
1079 { 1079 {
1080// m_log.DebugFormat("[SCENE GRAPH]: Part {0} has name {1}", p.UUID, p.Name);
1081
1080 if (p.Name == name) 1082 if (p.Name == name)
1081 { 1083 {
1082 sop = p; 1084 sop = p;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 759fc23..69bfb9a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -365,11 +365,14 @@ namespace OpenSim.Region.Framework.Scenes
365 { 365 {
366 Vector3 val = value; 366 Vector3 val = value;
367 367
368 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) 368 if (Scene != null)
369 || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
370 && !IsAttachmentCheckFull() && (!m_scene.LoadingPrims))
371 { 369 {
372 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 370 if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
371 || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
372 && !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
373 {
374 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
375 }
373 } 376 }
374 377
375 foreach (SceneObjectPart part in m_parts.GetArray()) 378 foreach (SceneObjectPart part in m_parts.GetArray())
@@ -381,8 +384,11 @@ namespace OpenSim.Region.Framework.Scenes
381 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) 384 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
382 { 385 {
383 RootPart.ScriptSetPhysicsStatus(false); 386 RootPart.ScriptSetPhysicsStatus(false);
384 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), 387
385 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); 388 if (Scene != null)
389 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
390 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
391
386 return; 392 return;
387 } 393 }
388 } 394 }
@@ -420,7 +426,8 @@ namespace OpenSim.Region.Framework.Scenes
420 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 426 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
421 //} 427 //}
422 428
423 m_scene.EventManager.TriggerParcelPrimCountTainted(); 429 if (Scene != null)
430 Scene.EventManager.TriggerParcelPrimCountTainted();
424 } 431 }
425 } 432 }
426 433
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
new file mode 100644
index 0000000..babcb54
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -0,0 +1,149 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Drawing;
31using System.IO;
32using System.Reflection;
33using System.Xml;
34using log4net;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39
40namespace OpenSim.Region.Framework.Scenes.Serialization
41{
42 /// <summary>
43 /// Serialize and deserialize coalesced scene objects.
44 /// </summary>
45 /// <remarks>
46 /// Deserialization not yet here.
47 /// </remarks>
48 public class CoalescedSceneObjectsSerializer
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 /// <summary>
53 /// Serialize coalesced objects to Xml
54 /// </summary>
55 /// <param name="coa"></param>
56 /// <returns></returns>
57 public static string ToXml(CoalescedSceneObjects coa)
58 {
59 using (StringWriter sw = new StringWriter())
60 {
61 using (XmlTextWriter writer = new XmlTextWriter(sw))
62 {
63 Vector3 size;
64
65 List<SceneObjectGroup> coaObjects = coa.Objects;
66
67// m_log.DebugFormat(
68// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object",
69// coaObjects.Count);
70
71 // This is weak - we're relying on the set of coalesced objects still being identical
72 Vector3[] offsets = coa.GetSizeAndOffsets(out size);
73
74 writer.WriteStartElement("CoalescedObject");
75
76 writer.WriteAttributeString("x", size.X.ToString());
77 writer.WriteAttributeString("y", size.Y.ToString());
78 writer.WriteAttributeString("z", size.Z.ToString());
79
80 // Embed the offsets into the group XML
81 for (int i = 0; i < coaObjects.Count; i++)
82 {
83 SceneObjectGroup obj = coaObjects[i];
84
85// m_log.DebugFormat(
86// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}",
87// i, obj.Name);
88
89 writer.WriteStartElement("SceneObjectGroup");
90 writer.WriteAttributeString("offsetx", offsets[i].X.ToString());
91 writer.WriteAttributeString("offsety", offsets[i].Y.ToString());
92 writer.WriteAttributeString("offsetz", offsets[i].Z.ToString());
93
94 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true);
95
96 writer.WriteEndElement(); // SceneObjectGroup
97 }
98
99 writer.WriteEndElement(); // CoalescedObject
100 }
101
102 string output = sw.ToString();
103
104// Console.WriteLine(output);
105
106 return output;
107 }
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 }
148 }
149} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index b2b3ad9..769d8a5 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -139,6 +139,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
139 return sw.ToString(); 139 return sw.ToString();
140 } 140 }
141 } 141 }
142
142 143
143 /// <summary> 144 /// <summary>
144 /// Serialize a scene object to the original xml format 145 /// Serialize a scene object to the original xml format
@@ -147,10 +148,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
147 /// <returns></returns> 148 /// <returns></returns>
148 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer) 149 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer)
149 { 150 {
151 ToOriginalXmlFormat(sceneObject, writer, false);
152 }
153
154 /// <summary>
155 /// Serialize a scene object to the original xml format
156 /// </summary>
157 /// <param name="sceneObject"></param>
158 /// <param name="writer"></param>
159 /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param>
160 /// <returns></returns>
161 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement)
162 {
150 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name); 163 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name);
151 //int time = System.Environment.TickCount; 164 //int time = System.Environment.TickCount;
152 165
153 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); 166 if (!noRootElement)
167 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
168
154 writer.WriteStartElement(String.Empty, "RootPart", String.Empty); 169 writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
155 ToXmlFormat(sceneObject.RootPart, writer); 170 ToXmlFormat(sceneObject.RootPart, writer);
156 writer.WriteEndElement(); 171 writer.WriteEndElement();
@@ -170,10 +185,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
170 185
171 writer.WriteEndElement(); // OtherParts 186 writer.WriteEndElement(); // OtherParts
172 sceneObject.SaveScriptedState(writer); 187 sceneObject.SaveScriptedState(writer);
173 writer.WriteEndElement(); // SceneObjectGroup 188
189 if (!noRootElement)
190 writer.WriteEndElement(); // SceneObjectGroup
174 191
175 //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); 192 //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
176 } 193 }
177 194
178 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) 195 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer)
179 { 196 {
@@ -1318,7 +1335,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1318 writer.WriteStartElement("SculptData"); 1335 writer.WriteStartElement("SculptData");
1319 byte[] sd; 1336 byte[] sd;
1320 if (shp.SculptData != null) 1337 if (shp.SculptData != null)
1321 sd = shp.ExtraParams; 1338 sd = shp.SculptData;
1322 else 1339 else
1323 sd = Utils.EmptyBytes; 1340 sd = Utils.EmptyBytes;
1324 writer.WriteBase64(sd, 0, sd.Length); 1341 writer.WriteBase64(sd, 0, sd.Length);
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
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
index 85e34c1..6df213d 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
@@ -648,6 +648,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
648 if (pbs.ProfileHollow != 0) 648 if (pbs.ProfileHollow != 0)
649 iPropertiesNotSupportedDefault++; 649 iPropertiesNotSupportedDefault++;
650 650
651 if ((pbs.PathBegin != 0) || pbs.PathEnd != 0)
652 iPropertiesNotSupportedDefault++;
653
651 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) 654 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
652 iPropertiesNotSupportedDefault++; 655 iPropertiesNotSupportedDefault++;
653 656
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index eb97f41..a0101af 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -2528,6 +2528,9 @@ namespace OpenSim.Region.Physics.OdePlugin
2528 if (pbs.ProfileHollow != 0) 2528 if (pbs.ProfileHollow != 0)
2529 iPropertiesNotSupportedDefault++; 2529 iPropertiesNotSupportedDefault++;
2530 2530
2531 if ((pbs.PathBegin != 0) || pbs.PathEnd != 0)
2532 iPropertiesNotSupportedDefault++;
2533
2531 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) 2534 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
2532 iPropertiesNotSupportedDefault++; 2535 iPropertiesNotSupportedDefault++;
2533 2536
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index cda8adb..f4aefac 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8052,7 +8052,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8052 8052
8053 // This BBox is in sim coordinates, with the offset being 8053 // This BBox is in sim coordinates, with the offset being
8054 // a contained point. 8054 // a contained point.
8055 Vector3[] offsets = World.GetCombinedBoundingBox(new List<SceneObjectGroup> { part.ParentGroup }, 8055 Vector3[] offsets = Scene.GetCombinedBoundingBox(new List<SceneObjectGroup> { part.ParentGroup },
8056 out minX, out maxX, out minY, out maxY, out minZ, out maxZ); 8056 out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
8057 8057
8058 minX -= offsets[0].X; 8058 minX -= offsets[0].X;