aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs25
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs66
-rw-r--r--OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs136
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs59
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs89
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs71
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs36
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs11
20 files changed, 326 insertions, 229 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 6d3331b..5c3039d 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -982,7 +982,7 @@ namespace OpenSim
982 aCircuit.child ? "child" : "root", 982 aCircuit.child ? "child" : "root",
983 aCircuit.circuitcode.ToString(), 983 aCircuit.circuitcode.ToString(),
984 aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set", 984 aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set",
985 aCircuit.Viewer); 985 Util.GetViewerName(aCircuit));
986 }); 986 });
987 987
988 MainConsole.Instance.Output(cdt.ToString()); 988 MainConsole.Instance.Output(cdt.ToString());
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 0dc9306..9d36986 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -158,10 +158,27 @@ namespace OpenSim
158 158
159 protected virtual void LoadPlugins() 159 protected virtual void LoadPlugins()
160 { 160 {
161 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this))) 161 IConfig startupConfig = Config.Configs["Startup"];
162 string registryLocation = (startupConfig != null) ? startupConfig.GetString("RegistryLocation", String.Empty) : String.Empty;
163
164 // The location can also be specified in the environment. If there
165 // is no location in the configuration, we must call the constructor
166 // without a location parameter to allow that to happen.
167 if (registryLocation == String.Empty)
162 { 168 {
163 loader.Load("/OpenSim/Startup"); 169 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this)))
164 m_plugins = loader.Plugins; 170 {
171 loader.Load("/OpenSim/Startup");
172 m_plugins = loader.Plugins;
173 }
174 }
175 else
176 {
177 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this), registryLocation))
178 {
179 loader.Load("/OpenSim/Startup");
180 m_plugins = loader.Plugins;
181 }
165 } 182 }
166 } 183 }
167 184
@@ -1049,4 +1066,4 @@ namespace OpenSim
1049 { 1066 {
1050 public IConfigSource Source; 1067 public IConfigSource Source;
1051 } 1068 }
1052} \ No newline at end of file 1069}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 05dd764..86161c9 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -10387,7 +10387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10387 handlerDirFindQuery(this, 10387 handlerDirFindQuery(this,
10388 dirFindQueryPacket.QueryData.QueryID, 10388 dirFindQueryPacket.QueryData.QueryID,
10389 Utils.BytesToString( 10389 Utils.BytesToString(
10390 dirFindQueryPacket.QueryData.QueryText), 10390 dirFindQueryPacket.QueryData.QueryText).Trim(),
10391 dirFindQueryPacket.QueryData.QueryFlags, 10391 dirFindQueryPacket.QueryData.QueryFlags,
10392 dirFindQueryPacket.QueryData.QueryStart); 10392 dirFindQueryPacket.QueryData.QueryStart);
10393 } 10393 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 1ca142e..c3846d9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -245,8 +245,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
245 string state = sog.GetStateSnapshot(); 245 string state = sog.GetStateSnapshot();
246 ad.AttachmentObjectStates.Add(state); 246 ad.AttachmentObjectStates.Add(state);
247 sp.InTransitScriptStates.Add(state); 247 sp.InTransitScriptStates.Add(state);
248 // Let's remove the scripts of the original object here 248
249 sog.RemoveScriptInstances(true); 249 // Scripts of the originals will be removed when the Agent is successfully removed.
250 // sog.RemoveScriptInstances(true);
250 } 251 }
251 } 252 }
252 } 253 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index f7057fe..9963521 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -483,52 +483,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
483 { 483 {
484 if (m_creatorIdForAssetId.ContainsKey(assetId)) 484 if (m_creatorIdForAssetId.ContainsKey(assetId))
485 { 485 {
486 string xmlData = Utils.BytesToString(data); 486 data = SceneObjectSerializer.ModifySerializedObject(assetId, data,
487 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 487 sog => {
488 bool modified = false;
489
490 foreach (SceneObjectPart sop in sog.Parts)
491 {
492 if (string.IsNullOrEmpty(sop.CreatorData))
493 {
494 sop.CreatorID = m_creatorIdForAssetId[assetId];
495 modified = true;
496 }
497 }
498
499 return modified;
500 });
488 501
489 CoalescedSceneObjects coa = null; 502 if (data == null)
490 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) 503 return false;
491 {
492// m_log.DebugFormat(
493// "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
494
495 if (coa.Objects.Count == 0)
496 {
497 m_log.WarnFormat(
498 "[INVENTORY ARCHIVE READ REQUEST]: Aborting load of coalesced object from asset {0} as it has zero loaded components",
499 assetId);
500 return false;
501 }
502
503 sceneObjects.AddRange(coa.Objects);
504 }
505 else
506 {
507 SceneObjectGroup deserializedObject = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
508
509 if (deserializedObject != null)
510 {
511 sceneObjects.Add(deserializedObject);
512 }
513 else
514 {
515 m_log.WarnFormat(
516 "[INVENTORY ARCHIVE READ REQUEST]: Aborting load of object from asset {0} as deserialization failed",
517 assetId);
518
519 return false;
520 }
521 }
522
523 foreach (SceneObjectGroup sog in sceneObjects)
524 foreach (SceneObjectPart sop in sog.Parts)
525 if (string.IsNullOrEmpty(sop.CreatorData))
526 sop.CreatorID = m_creatorIdForAssetId[assetId];
527
528 if (coa != null)
529 data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
530 else
531 data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0]));
532 } 504 }
533 } 505 }
534 506
@@ -550,7 +522,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
550 return false; 522 return false;
551 } 523 }
552 } 524 }
553 525
554 /// <summary> 526 /// <summary>
555 /// Load control file 527 /// Load control file
556 /// </summary> 528 /// </summary>
@@ -656,4 +628,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
656 m_assetsLoaded = true; 628 m_assetsLoaded = true;
657 } 629 }
658 } 630 }
659} \ No newline at end of file 631}
diff --git a/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs b/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs
index 8838612..3849996 100644
--- a/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs
@@ -150,6 +150,8 @@ namespace OpenSim.Region.CoreModules.Framework.Search
150 150
151 void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) 151 void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
152 { 152 {
153 queryText = queryText.Trim();
154
153 if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People) 155 if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People)
154 { 156 {
155 if (string.IsNullOrEmpty(queryText)) 157 if (string.IsNullOrEmpty(queryText))
@@ -194,4 +196,4 @@ namespace OpenSim.Region.CoreModules.Framework.Search
194 196
195 } 197 }
196 198
197} \ No newline at end of file 199}
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 9f0a719..3455e2c 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -278,7 +278,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
278 { 278 {
279 foreach (UserData data in m_UserCache.Values) 279 foreach (UserData data in m_UserCache.Values)
280 { 280 {
281 if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null && 281 if (data.Id != UUID.Zero &&
282 users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
282 (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower()))) 283 (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
283 users.Add(data); 284 users.Add(data);
284 } 285 }
@@ -725,4 +726,4 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
725 726
726 } 727 }
727 728
728} \ No newline at end of file 729}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 2e638d4..7920748 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -189,8 +189,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
189 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] 189 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
190 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); 190 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
191 191
192 // Zero can never be a valid user id 192 // Zero can never be a valid user or group id
193 m_validUserUuids[UUID.Zero] = false; 193 m_validUserUuids[UUID.Zero] = false;
194 m_validGroupUuids[UUID.Zero] = false;
194 195
195 m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>(); 196 m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
196 m_assetService = m_rootScene.AssetService; 197 m_assetService = m_rootScene.AssetService;
@@ -523,58 +524,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
523 oldTelehubUUID = UUID.Zero; 524 oldTelehubUUID = UUID.Zero;
524 } 525 }
525 526
526 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid 527 ModifySceneObject(scene, sceneObject);
527 // or creator data is present. Otherwise, use the estate owner instead.
528 foreach (SceneObjectPart part in sceneObject.Parts)
529 {
530 if (string.IsNullOrEmpty(part.CreatorData))
531 {
532 if (!ResolveUserUuid(scene, part.CreatorID))
533 part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
534 }
535 if (UserManager != null)
536 UserManager.AddUser(part.CreatorID, part.CreatorData);
537
538 if (!ResolveUserUuid(scene, part.OwnerID))
539 part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
540
541 if (!ResolveUserUuid(scene, part.LastOwnerID))
542 part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
543
544 if (!ResolveGroupUuid(part.GroupID))
545 part.GroupID = UUID.Zero;
546
547 // And zap any troublesome sit target information
548// part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
549// part.SitTargetPosition = new Vector3(0, 0, 0);
550
551 // Fix ownership/creator of inventory items
552 // Not doing so results in inventory items
553 // being no copy/no mod for everyone
554 lock (part.TaskInventory)
555 {
556 TaskInventoryDictionary inv = part.TaskInventory;
557 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
558 {
559 if (!ResolveUserUuid(scene, kvp.Value.OwnerID))
560 {
561 kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
562 }
563
564 if (string.IsNullOrEmpty(kvp.Value.CreatorData))
565 {
566 if (!ResolveUserUuid(scene, kvp.Value.CreatorID))
567 kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
568 }
569
570 if (UserManager != null)
571 UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
572
573 if (!ResolveGroupUuid(kvp.Value.GroupID))
574 kvp.Value.GroupID = UUID.Zero;
575 }
576 }
577 }
578 528
579 if (scene.AddRestoredSceneObject(sceneObject, true, false)) 529 if (scene.AddRestoredSceneObject(sceneObject, true, false))
580 { 530 {
@@ -598,6 +548,67 @@ namespace OpenSim.Region.CoreModules.World.Archiver
598 scene.RegionInfo.RegionSettings.ClearSpawnPoints(); 548 scene.RegionInfo.RegionSettings.ClearSpawnPoints();
599 } 549 }
600 } 550 }
551
552 /// <summary>
553 /// Optionally modify a loaded SceneObjectGroup. Currently this just ensures that the
554 /// User IDs and Group IDs are valid, but other manipulations could be done as well.
555 /// </summary>
556 private void ModifySceneObject(Scene scene, SceneObjectGroup sceneObject)
557 {
558 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
559 // or creator data is present. Otherwise, use the estate owner instead.
560 foreach (SceneObjectPart part in sceneObject.Parts)
561 {
562 if (string.IsNullOrEmpty(part.CreatorData))
563 {
564 if (!ResolveUserUuid(scene, part.CreatorID))
565 part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
566 }
567 if (UserManager != null)
568 UserManager.AddUser(part.CreatorID, part.CreatorData);
569
570 if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID)))
571 part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
572
573 if (!(ResolveUserUuid(scene, part.LastOwnerID) || ResolveGroupUuid(part.LastOwnerID)))
574 part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
575
576 if (!ResolveGroupUuid(part.GroupID))
577 part.GroupID = UUID.Zero;
578
579 // And zap any troublesome sit target information
580 // part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
581 // part.SitTargetPosition = new Vector3(0, 0, 0);
582
583 // Fix ownership/creator of inventory items
584 // Not doing so results in inventory items
585 // being no copy/no mod for everyone
586 lock (part.TaskInventory)
587 {
588 TaskInventoryDictionary inv = part.TaskInventory;
589 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
590 {
591 if (!(ResolveUserUuid(scene, kvp.Value.OwnerID) || ResolveGroupUuid(kvp.Value.OwnerID)))
592 {
593 kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
594 }
595
596 if (string.IsNullOrEmpty(kvp.Value.CreatorData))
597 {
598 if (!ResolveUserUuid(scene, kvp.Value.CreatorID))
599 kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
600 }
601
602 if (UserManager != null)
603 UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
604
605 if (!ResolveGroupUuid(kvp.Value.GroupID))
606 kvp.Value.GroupID = UUID.Zero;
607 }
608 }
609 }
610 }
611
601 612
602 /// <summary> 613 /// <summary>
603 /// Load serialized parcels. 614 /// Load serialized parcels.
@@ -695,9 +706,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
695 /// <returns></returns> 706 /// <returns></returns>
696 private bool ResolveGroupUuid(UUID uuid) 707 private bool ResolveGroupUuid(UUID uuid)
697 { 708 {
698 if (uuid == UUID.Zero)
699 return true; // this means the object has no group
700
701 lock (m_validGroupUuids) 709 lock (m_validGroupUuids)
702 { 710 {
703 if (!m_validGroupUuids.ContainsKey(uuid)) 711 if (!m_validGroupUuids.ContainsKey(uuid))
@@ -754,7 +762,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
754 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; 762 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
755 763
756 if (assetType == (sbyte)AssetType.Unknown) 764 if (assetType == (sbyte)AssetType.Unknown)
765 {
757 m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid); 766 m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
767 }
768 else if (assetType == (sbyte)AssetType.Object)
769 {
770 data = SceneObjectSerializer.ModifySerializedObject(UUID.Parse(uuid), data,
771 sog =>
772 {
773 ModifySceneObject(m_rootScene, sog);
774 return true;
775 });
776
777 if (data == null)
778 return false;
779 }
758 780
759 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 781 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
760 782
@@ -977,4 +999,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver
977 return dearchivedScenes; 999 return dearchivedScenes;
978 } 1000 }
979 } 1001 }
980} \ No newline at end of file 1002}
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 3bd7b4a..cb9ad4a 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -1342,10 +1342,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1342 { 1342 {
1343 m_regionChangeTimer.Stop(); 1343 m_regionChangeTimer.Stop();
1344 m_regionChangeTimer.Start(); 1344 m_regionChangeTimer.Start();
1345 }
1346 1345
1347 protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
1348 {
1349 ChangeDelegate change = OnRegionInfoChange; 1346 ChangeDelegate change = OnRegionInfoChange;
1350 1347
1351 if (change != null) 1348 if (change != null)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 7f17aff..0ecf13b 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1340,6 +1340,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1340 1340
1341 m_scene.ForEachClient(SendParcelOverlay); 1341 m_scene.ForEachClient(SendParcelOverlay);
1342 land.SendLandUpdateToClient(true, remote_client); 1342 land.SendLandUpdateToClient(true, remote_client);
1343 UpdateLandObject(land.LandData.LocalID, land.LandData);
1343 } 1344 }
1344 } 1345 }
1345 } 1346 }
@@ -1360,8 +1361,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1360 land.LandData.GroupID = UUID.Zero; 1361 land.LandData.GroupID = UUID.Zero;
1361 land.LandData.IsGroupOwned = false; 1362 land.LandData.IsGroupOwned = false;
1362 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 1363 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1364
1363 m_scene.ForEachClient(SendParcelOverlay); 1365 m_scene.ForEachClient(SendParcelOverlay);
1364 land.SendLandUpdateToClient(true, remote_client); 1366 land.SendLandUpdateToClient(true, remote_client);
1367 UpdateLandObject(land.LandData.LocalID, land.LandData);
1365 } 1368 }
1366 } 1369 }
1367 } 1370 }
@@ -1388,6 +1391,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1388 1391
1389 m_scene.ForEachClient(SendParcelOverlay); 1392 m_scene.ForEachClient(SendParcelOverlay);
1390 land.SendLandUpdateToClient(true, remote_client); 1393 land.SendLandUpdateToClient(true, remote_client);
1394 UpdateLandObject(land.LandData.LocalID, land.LandData);
1391 } 1395 }
1392 } 1396 }
1393 } 1397 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d16b73b..51f6c5e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1757,6 +1757,7 @@ namespace OpenSim.Region.Framework.Scenes
1757 { 1757 {
1758 if (group != null) 1758 if (group != null)
1759 { 1759 {
1760 group.HasGroupChanged = true;
1760 group.ProcessBackup(SimulationDataService, true); 1761 group.ProcessBackup(SimulationDataService, true);
1761 } 1762 }
1762 } 1763 }
@@ -2345,13 +2346,12 @@ namespace OpenSim.Region.Framework.Scenes
2345 { 2346 {
2346 if (!softDelete) 2347 if (!softDelete)
2347 { 2348 {
2348 // Force a database update so that the scene object group ID is accurate. It's possible that the 2349 // If the group contains prims whose SceneGroupID is incorrect then force a
2349 // group has recently been delinked from another group but that this change has not been persisted 2350 // database update, because RemoveObject() works by searching on the SceneGroupID.
2350 // to the DB.
2351 // This is an expensive thing to do so only do it if absolutely necessary. 2351 // This is an expensive thing to do so only do it if absolutely necessary.
2352 if (so.HasGroupChangedDueToDelink) 2352 if (so.GroupContainsForeignPrims)
2353 ForceSceneObjectBackup(so); 2353 ForceSceneObjectBackup(so);
2354 2354
2355 so.DetachFromBackup(); 2355 so.DetachFromBackup();
2356 SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); 2356 SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID);
2357 } 2357 }
@@ -3413,6 +3413,7 @@ namespace OpenSim.Region.Framework.Scenes
3413 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport 3413 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
3414 3414
3415 // Don't disable this log message - it's too helpful 3415 // Don't disable this log message - it's too helpful
3416 string curViewer = Util.GetViewerName(acd);
3416 m_log.DebugFormat( 3417 m_log.DebugFormat(
3417 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", 3418 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})",
3418 RegionInfo.RegionName, 3419 RegionInfo.RegionName,
@@ -3422,7 +3423,7 @@ namespace OpenSim.Region.Framework.Scenes
3422 acd.AgentID, 3423 acd.AgentID,
3423 acd.circuitcode, 3424 acd.circuitcode,
3424 acd.IPAddress, 3425 acd.IPAddress,
3425 acd.Viewer, 3426 curViewer,
3426 ((TPFlags)teleportFlags).ToString(), 3427 ((TPFlags)teleportFlags).ToString(),
3427 acd.startpos 3428 acd.startpos
3428 ); 3429 );
@@ -3442,7 +3443,7 @@ namespace OpenSim.Region.Framework.Scenes
3442 { 3443 {
3443 foreach (string viewer in m_AllowedViewers) 3444 foreach (string viewer in m_AllowedViewers)
3444 { 3445 {
3445 if (viewer == acd.Viewer.Substring(0, viewer.Length).Trim().ToLower()) 3446 if (viewer == curViewer.Substring(0, viewer.Length).Trim().ToLower())
3446 { 3447 {
3447 ViewerDenied = false; 3448 ViewerDenied = false;
3448 break; 3449 break;
@@ -3459,7 +3460,7 @@ namespace OpenSim.Region.Framework.Scenes
3459 { 3460 {
3460 foreach (string viewer in m_BannedViewers) 3461 foreach (string viewer in m_BannedViewers)
3461 { 3462 {
3462 if (viewer == acd.Viewer.Substring(0, viewer.Length).Trim().ToLower()) 3463 if (viewer == curViewer.Substring(0, viewer.Length).Trim().ToLower())
3463 { 3464 {
3464 ViewerDenied = true; 3465 ViewerDenied = true;
3465 break; 3466 break;
@@ -3471,7 +3472,7 @@ namespace OpenSim.Region.Framework.Scenes
3471 { 3472 {
3472 m_log.DebugFormat( 3473 m_log.DebugFormat(
3473 "[SCENE]: Access denied for {0} {1} using {2}", 3474 "[SCENE]: Access denied for {0} {1} using {2}",
3474 acd.firstname, acd.lastname, acd.Viewer); 3475 acd.firstname, acd.lastname, curViewer);
3475 reason = "Access denied, your viewer is banned by the region owner"; 3476 reason = "Access denied, your viewer is banned by the region owner";
3476 return false; 3477 return false;
3477 } 3478 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 6f26176..b70e9df 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -150,12 +150,27 @@ namespace OpenSim.Region.Framework.Scenes
150 150
151 get { return m_hasGroupChanged; } 151 get { return m_hasGroupChanged; }
152 } 152 }
153
154 private bool m_groupContainsForeignPrims = false;
153 155
154 /// <summary> 156 /// <summary>
155 /// Has the group changed due to an unlink operation? We record this in order to optimize deletion, since 157 /// Whether the group contains prims that came from a different group. This happens when
156 /// an unlinked group currently has to be persisted to the database before we can perform an unlink operation. 158 /// linking or delinking groups. The implication is that until the group is persisted,
159 /// the prims in the database still use the old SceneGroupID. That's a problem if the group
160 /// is deleted, because we delete groups by searching for prims by their SceneGroupID.
157 /// </summary> 161 /// </summary>
158 public bool HasGroupChangedDueToDelink { get; private set; } 162 public bool GroupContainsForeignPrims
163 {
164 private set
165 {
166 m_groupContainsForeignPrims = value;
167 if (m_groupContainsForeignPrims)
168 HasGroupChanged = true;
169 }
170
171 get { return m_groupContainsForeignPrims; }
172 }
173
159 174
160 private bool isTimeToPersist() 175 private bool isTimeToPersist()
161 { 176 {
@@ -1624,7 +1639,7 @@ namespace OpenSim.Region.Framework.Scenes
1624 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 1639 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
1625 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; 1640 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
1626 HasGroupChanged = false; 1641 HasGroupChanged = false;
1627 HasGroupChangedDueToDelink = false; 1642 GroupContainsForeignPrims = false;
1628 1643
1629 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); 1644 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
1630 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); 1645 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
@@ -1686,28 +1701,7 @@ namespace OpenSim.Region.Framework.Scenes
1686 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 1701 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
1687 dupe.Backup = false; 1702 dupe.Backup = false;
1688 dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); 1703 dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
1689
1690 // Warning, The following code related to previousAttachmentStatus is needed so that clones of
1691 // attachments do not bordercross while they're being duplicated. This is hacktastic!
1692 // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region!
1693 // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state
1694 // (which should be false anyway) set it as an Attachment and then set it's Absolute Position,
1695 // then restore it's attachment state
1696
1697 // This is only necessary when userExposed is false!
1698
1699 bool previousAttachmentStatus = dupe.IsAttachment;
1700
1701 if (!userExposed)
1702 dupe.IsAttachment = true;
1703
1704 dupe.m_sittingAvatars = new List<UUID>(); 1704 dupe.m_sittingAvatars = new List<UUID>();
1705
1706 if (!userExposed)
1707 {
1708 dupe.IsAttachment = previousAttachmentStatus;
1709 }
1710
1711 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1705 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1712 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1706 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
1713 1707
@@ -2388,6 +2382,8 @@ namespace OpenSim.Region.Framework.Scenes
2388 // If linking prims with different permissions, fix them 2382 // If linking prims with different permissions, fix them
2389 AdjustChildPrimPermissions(); 2383 AdjustChildPrimPermissions();
2390 2384
2385 GroupContainsForeignPrims = true;
2386
2391 AttachToBackup(); 2387 AttachToBackup();
2392 2388
2393 // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the 2389 // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the
@@ -2531,9 +2527,16 @@ namespace OpenSim.Region.Framework.Scenes
2531 2527
2532 linkPart.Rezzed = RootPart.Rezzed; 2528 linkPart.Rezzed = RootPart.Rezzed;
2533 2529
2534 // When we delete a group, we currently have to force persist to the database if the object id has changed 2530 // We must persist the delinked group to the database immediately, for safety. The problem
2535 // (since delete works by deleting all rows which have a given object id) 2531 // is that although in memory the new group has a new SceneGroupID, in the database it
2536 objectGroup.HasGroupChangedDueToDelink = true; 2532 // still has the parent group's SceneGroupID (until the next backup). This means that if the
2533 // parent group is deleted then the delinked group will also be deleted from the database.
2534 // This problem will disappear if the region remains alive long enough for another backup,
2535 // since at that time the delinked group's new SceneGroupID will be written to the database.
2536 // But if the region crashes before that then the prims will be permanently gone, and this must
2537 // not happen. (We can't use a just-in-time trick like GroupContainsForeignPrims in this case
2538 // because the delinked group doesn't know when the source group is deleted.)
2539 m_scene.ForceSceneObjectBackup(objectGroup);
2537 2540
2538 return objectGroup; 2541 return objectGroup;
2539 } 2542 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 491d0bf..64c464d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes
848 848
849 public string Viewer 849 public string Viewer
850 { 850 {
851 get { return m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode).Viewer; } 851 get { return Util.GetViewerName(m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode)); }
852 } 852 }
853 853
854 #endregion 854 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
index 5cb271d..a556f9d 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -119,21 +119,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
119 return output; 119 return output;
120 } 120 }
121 } 121 }
122 122
123 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) 123 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa)
124 { 124 {
125// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); 125// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
126 126
127 coa = null; 127 coa = null;
128 int i = 0;
129 128
130 using (StringReader sr = new StringReader(xml)) 129 try
131 { 130 {
132 using (XmlTextReader reader = new XmlTextReader(sr)) 131 // Quickly check if this is a coalesced object, without fully parsing the XML
133 { 132 using (StringReader sr = new StringReader(xml))
134 try 133 {
134 using (XmlTextReader reader = new XmlTextReader(sr))
135 { 135 {
136 reader.Read(); 136 reader.MoveToContent(); // skip possible xml declaration
137
137 if (reader.Name != "CoalescedObject") 138 if (reader.Name != "CoalescedObject")
138 { 139 {
139 // m_log.DebugFormat( 140 // m_log.DebugFormat(
@@ -142,49 +143,49 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
142 143
143 return false; 144 return false;
144 } 145 }
145 146 }
146 coa = new CoalescedSceneObjects(UUID.Zero); 147 }
147 reader.Read();
148
149 while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject")
150 {
151 if (reader.Name == "SceneObjectGroup")
152 {
153 string soXml = reader.ReadOuterXml();
154
155 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(soXml);
156
157 if (so != null)
158 {
159 coa.Add(so);
160 }
161 else
162 {
163 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the
164 // coalesced object fails to load.
165 m_log.WarnFormat(
166 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
167 i);
168 }
169 148
170 i++; 149 XmlDocument doc = new XmlDocument();
171 } 150 doc.LoadXml(xml);
172 } 151 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
152 if (e == null)
153 return false;
173 154
174 reader.ReadEndElement(); // CoalescedObject 155 coa = new CoalescedSceneObjects(UUID.Zero);
156
157 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
158 int i = 0;
159
160 foreach (XmlNode n in groups)
161 {
162 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
163 if (so != null)
164 {
165 coa.Add(so);
175 } 166 }
176 catch (Exception e) 167 else
177 { 168 {
178 m_log.ErrorFormat( 169 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the
179 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed with {0} {1}", 170 // coalesced object fails to load.
180 e.Message, e.StackTrace); 171 m_log.WarnFormat(
181 172 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
182 return false; 173 i);
183 } 174 }
175
176 i++;
184 } 177 }
185 } 178 }
179 catch (Exception e)
180 {
181 m_log.Error(string.Format(
182 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed with {0} ",
183 e.Message), e);
184
185 return false;
186 }
186 187
187 return true; 188 return true;
188 } 189 }
189 } 190 }
190} \ No newline at end of file 191}
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index f07dee9..a93f3c8 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -299,6 +299,73 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
299 } 299 }
300 } 300 }
301 301
302
303 /// <summary>
304 /// Modifies a SceneObjectGroup.
305 /// </summary>
306 /// <param name="sog">The object</param>
307 /// <returns>Whether the object was actually modified</returns>
308 public delegate bool SceneObjectModifier(SceneObjectGroup sog);
309
310 /// <summary>
311 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing.
312 /// </summary>
313 /// <param name="assetId">The object's UUID</param>
314 /// <param name="data">Serialized data</param>
315 /// <param name="modifier">The function to run on each SceneObjectGroup</param>
316 /// <returns>The new serialized object's data, or null if an error occurred</returns>
317 public static byte[] ModifySerializedObject(UUID assetId, byte[] data, SceneObjectModifier modifier)
318 {
319 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
320 CoalescedSceneObjects coa = null;
321
322 string xmlData = Utils.BytesToString(data);
323
324 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
325 {
326 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
327
328 if (coa.Objects.Count == 0)
329 {
330 m_log.WarnFormat("[SERIALIZER]: Aborting load of coalesced object from asset {0} as it has zero loaded components", assetId);
331 return null;
332 }
333
334 sceneObjects.AddRange(coa.Objects);
335 }
336 else
337 {
338 SceneObjectGroup deserializedObject = FromOriginalXmlFormat(xmlData);
339
340 if (deserializedObject != null)
341 {
342 sceneObjects.Add(deserializedObject);
343 }
344 else
345 {
346 m_log.WarnFormat("[SERIALIZER]: Aborting load of object from asset {0} as deserialization failed", assetId);
347 return null;
348 }
349 }
350
351 bool modified = false;
352 foreach (SceneObjectGroup sog in sceneObjects)
353 {
354 if (modifier(sog))
355 modified = true;
356 }
357
358 if (modified)
359 {
360 if (coa != null)
361 data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
362 else
363 data = Utils.StringToBytes(ToOriginalXmlFormat(sceneObjects[0]));
364 }
365
366 return data;
367 }
368
302 369
303 #region manual serialization 370 #region manual serialization
304 371
@@ -1230,7 +1297,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1230 if (m_UserManagement == null) 1297 if (m_UserManagement == null)
1231 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); 1298 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
1232 string name = m_UserManagement.GetUserName(sop.CreatorID); 1299 string name = m_UserManagement.GetUserName(sop.CreatorID);
1233 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); 1300 writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name));
1234 } 1301 }
1235 1302
1236 WriteUUID(writer, "FolderID", sop.FolderID, options); 1303 WriteUUID(writer, "FolderID", sop.FolderID, options);
@@ -1403,7 +1470,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1403 if (m_UserManagement == null) 1470 if (m_UserManagement == null)
1404 m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); 1471 m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
1405 string name = m_UserManagement.GetUserName(item.CreatorID); 1472 string name = m_UserManagement.GetUserName(item.CreatorID);
1406 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); 1473 writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name));
1407 } 1474 }
1408 1475
1409 writer.WriteElementString("Description", item.Description); 1476 writer.WriteElementString("Description", item.Description);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 9378e20..c928b1e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -91,7 +91,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
91 grp2.RootPart.ClearUpdateSchedule(); 91 grp2.RootPart.ClearUpdateSchedule();
92 92
93 // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. 93 // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated.
94 Assert.IsFalse(grp1.GroupContainsForeignPrims);
94 grp1.LinkToGroup(grp2); 95 grp1.LinkToGroup(grp2);
96 Assert.IsTrue(grp1.GroupContainsForeignPrims);
97
98 scene.Backup(true);
99 Assert.IsFalse(grp1.GroupContainsForeignPrims);
95 100
96 // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since 101 // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since
97 // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. 102 // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed.
@@ -143,7 +148,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
143 148
144 Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink."); 149 Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
145 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero"); 150 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
146 Assert.That(grp3.HasGroupChangedDueToDelink, Is.True);
147 } 151 }
148 152
149 [Test] 153 [Test]
@@ -335,30 +339,34 @@ namespace OpenSim.Region.Framework.Scenes.Tests
335 SceneObjectPart rootPart 339 SceneObjectPart rootPart
336 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 340 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
337 { Name = rootPartName, UUID = rootPartUuid }; 341 { Name = rootPartName, UUID = rootPartUuid };
342
338 SceneObjectPart linkPart 343 SceneObjectPart linkPart
339 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 344 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
340 { Name = linkPartName, UUID = linkPartUuid }; 345 { Name = linkPartName, UUID = linkPartUuid };
346 SceneObjectGroup linkGroup = new SceneObjectGroup(linkPart);
347 scene.AddNewSceneObject(linkGroup, true);
341 348
342 SceneObjectGroup sog = new SceneObjectGroup(rootPart); 349 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
343 sog.AddPart(linkPart); 350 scene.AddNewSceneObject(sog, true);
344 scene.AddNewSceneObject(sog, true); 351
345 352 Assert.IsFalse(sog.GroupContainsForeignPrims);
346 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked 353 sog.LinkToGroup(linkGroup);
347 // scene backup thread. 354 Assert.IsTrue(sog.GroupContainsForeignPrims);
355
348 scene.Backup(true); 356 scene.Backup(true);
349 357 Assert.AreEqual(1, scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID).Count);
358
350 // These changes should occur immediately without waiting for a backup pass 359 // These changes should occur immediately without waiting for a backup pass
351 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); 360 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
352 361 Assert.IsFalse(groupToDelete.GroupContainsForeignPrims);
353 Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True); 362
354 scene.DeleteSceneObject(groupToDelete, false); 363 scene.DeleteSceneObject(groupToDelete, false);
355 Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False);
356 364
357 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); 365 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
358 366
359 Assert.That(storedObjects.Count, Is.EqualTo(1)); 367 Assert.AreEqual(1, storedObjects.Count);
360 Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(1)); 368 Assert.AreEqual(1, storedObjects[0].Parts.Length);
361 Assert.That(storedObjects[0].ContainsPart(rootPartUuid)); 369 Assert.IsTrue(storedObjects[0].ContainsPart(rootPartUuid));
362 } 370 }
363 } 371 }
364} 372}
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index ec18db0..44d4e93 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -669,7 +669,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
669 aCircuit = new AgentCircuitData(); 669 aCircuit = new AgentCircuitData();
670 670
671 if (!llClient.SceneAgent.IsChildAgent) 671 if (!llClient.SceneAgent.IsChildAgent)
672 m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, aCircuit.Viewer, aCircuit.Id0); 672 m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, Util.GetViewerName(aCircuit), aCircuit.Id0);
673 673
674 int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); 674 int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum();
675 avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); 675 avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1);
@@ -706,4 +706,4 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
706 m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum); 706 m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum);
707 } 707 }
708 } 708 }
709} \ No newline at end of file 709}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
index 8b0fdeb..7e61007 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -121,8 +121,10 @@ public class BSActorLockAxis : BSActor
121 // The constraint is tied to the world and oriented to the prim. 121 // The constraint is tied to the world and oriented to the prim.
122 122
123 // Free to move linearly in the region 123 // Free to move linearly in the region
124 OMV.Vector3 linearLow = OMV.Vector3.Zero; 124 // OMV.Vector3 linearLow = OMV.Vector3.Zero;
125 OMV.Vector3 linearHigh = m_physicsScene.TerrainManager.DefaultRegionSize; 125 // OMV.Vector3 linearHigh = m_physicsScene.TerrainManager.DefaultRegionSize;
126 OMV.Vector3 linearLow = new OMV.Vector3(-10000f, -10000f, -10000f);
127 OMV.Vector3 linearHigh = new OMV.Vector3(10000f, 10000f, 10000f);
126 if (m_controllingPrim.LockedLinearAxis.X != BSPhysObject.FreeAxis) 128 if (m_controllingPrim.LockedLinearAxis.X != BSPhysObject.FreeAxis)
127 { 129 {
128 linearLow.X = m_controllingPrim.RawPosition.X; 130 linearLow.X = m_controllingPrim.RawPosition.X;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index fc18960..c9b134c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -426,7 +426,7 @@ public sealed class BSCharacter : BSPhysObject
426 m_targetVelocity = value; 426 m_targetVelocity = value;
427 OMV.Vector3 targetVel = value; 427 OMV.Vector3 targetVel = value;
428 if (_setAlwaysRun && !_flying) 428 if (_setAlwaysRun && !_flying)
429 targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 0f); 429 targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 1f);
430 430
431 if (m_moveActor != null) 431 if (m_moveActor != null)
432 m_moveActor.SetVelocityAndTarget(RawVelocity, targetVel, false /* inTaintTime */); 432 m_moveActor.SetVelocityAndTarget(RawVelocity, targetVel, false /* inTaintTime */);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 6264f5d..978e567 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -897,15 +897,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
897 Part.Name, Part.UUID, false); 897 Part.Name, Part.UUID, false);
898 898
899 899
900 m_log.DebugFormat( 900 m_log.Debug(string.Format(
901 "[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}", 901 "[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4} ",
902 ScriptName, 902 ScriptName,
903 PrimName, 903 PrimName,
904 Part.UUID, 904 Part.UUID,
905 Part.AbsolutePosition, 905 Part.AbsolutePosition,
906 Part.ParentGroup.Scene.Name, 906 Part.ParentGroup.Scene.Name),
907 text.Replace("\n", "\\n"), 907 e);
908 e.InnerException);
909 } 908 }
910 catch (Exception) 909 catch (Exception)
911 { 910 {
@@ -1220,4 +1219,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1220 return null; 1219 return null;
1221 } 1220 }
1222 } 1221 }
1223} \ No newline at end of file 1222}