Don't unnecessarily remove from backup objects that were not directly attached from the scene.
These are never in region backup in the first place since recent 11830c43
Extend regression test to check backup status.
ghosts
parent
11830c4363
commit
319c51b8a8
|
@ -387,7 +387,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append);
|
group.DetachFromBackup();
|
||||||
|
|
||||||
|
bool success = AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append);
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
group.AttachToBackup();
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -815,8 +822,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
"[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
|
"[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
|
||||||
so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||||
|
|
||||||
so.DetachFromBackup();
|
|
||||||
|
|
||||||
// Remove from database and parcel prim count
|
// Remove from database and parcel prim count
|
||||||
m_scene.DeleteFromStorage(so.UUID);
|
m_scene.DeleteFromStorage(so.UUID);
|
||||||
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
||||||
|
|
|
@ -199,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
string attName = "att";
|
string attName = "att";
|
||||||
|
|
||||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
|
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
|
||||||
|
Assert.That(so.Backup, Is.True);
|
||||||
|
|
||||||
m_numberOfAttachEventsFired = 0;
|
m_numberOfAttachEventsFired = 0;
|
||||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false);
|
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false);
|
||||||
|
@ -213,6 +214,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(attSo.IsAttachment);
|
Assert.That(attSo.IsAttachment);
|
||||||
Assert.That(attSo.UsesPhysics, Is.False);
|
Assert.That(attSo.UsesPhysics, Is.False);
|
||||||
Assert.That(attSo.IsTemporary, Is.False);
|
Assert.That(attSo.IsTemporary, Is.False);
|
||||||
|
Assert.That(attSo.Backup, Is.False);
|
||||||
|
|
||||||
// Check item status
|
// Check item status
|
||||||
Assert.That(
|
Assert.That(
|
||||||
|
@ -385,7 +387,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
public void TestRezAttachmentFromInventory()
|
public void TestRezAttachmentFromInventory()
|
||||||
{
|
{
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
Scene scene = CreateTestScene();
|
Scene scene = CreateTestScene();
|
||||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
|
@ -407,6 +409,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(attSo.IsAttachment);
|
Assert.That(attSo.IsAttachment);
|
||||||
Assert.That(attSo.UsesPhysics, Is.False);
|
Assert.That(attSo.UsesPhysics, Is.False);
|
||||||
Assert.That(attSo.IsTemporary, Is.False);
|
Assert.That(attSo.IsTemporary, Is.False);
|
||||||
|
Assert.IsFalse(attSo.Backup);
|
||||||
|
|
||||||
// Check appearance status
|
// Check appearance status
|
||||||
Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
|
Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
|
||||||
|
@ -601,7 +604,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
|
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
|
||||||
|
|
||||||
// Check object in scene
|
// Check object in scene
|
||||||
Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
|
SceneObjectGroup soInScene = scene.GetSceneObjectGroup("att");
|
||||||
|
Assert.That(soInScene, Is.Not.Null);
|
||||||
|
Assert.IsTrue(soInScene.Backup);
|
||||||
|
|
||||||
// Check events
|
// Check events
|
||||||
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
|
||||||
|
@ -755,6 +760,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(attSo.IsAttachment);
|
Assert.That(attSo.IsAttachment);
|
||||||
Assert.That(attSo.UsesPhysics, Is.False);
|
Assert.That(attSo.UsesPhysics, Is.False);
|
||||||
Assert.That(attSo.IsTemporary, Is.False);
|
Assert.That(attSo.IsTemporary, Is.False);
|
||||||
|
Assert.IsFalse(attSo.Backup);
|
||||||
|
|
||||||
// Check appearance status
|
// Check appearance status
|
||||||
List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments();
|
List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments();
|
||||||
|
@ -884,6 +890,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
|
SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
|
||||||
Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
|
Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
|
||||||
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
|
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
|
||||||
|
Assert.IsFalse(actualSceneBAtt.Backup);
|
||||||
|
|
||||||
Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
@ -994,6 +1001,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
|
SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
|
||||||
Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
|
Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
|
||||||
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
|
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
|
||||||
|
Assert.IsFalse(actualSceneBAtt.Backup);
|
||||||
|
|
||||||
Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
|
|
@ -611,7 +611,7 @@ namespace OpenSim.Tests.Common
|
||||||
//part.UpdatePrimFlags(false, false, true);
|
//part.UpdatePrimFlags(false, false, true);
|
||||||
//part.ObjectFlags |= (uint)PrimFlags.Phantom;
|
//part.ObjectFlags |= (uint)PrimFlags.Phantom;
|
||||||
|
|
||||||
scene.AddNewSceneObject(so, false);
|
scene.AddNewSceneObject(so, true);
|
||||||
|
|
||||||
return so;
|
return so;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue