When an object is duplicated, add the dupe to the uuid/local id indexes as well as the basic entities list.
Added a prim counts test to reinforce this - shift-copy was no incrementing prim count. This will sometime become a basic scene test. New code needs to be refactored so we just call SceneGraph.AddSceneObject(). This will happen in the near future. With this, basic owner prim counts on a single parcel appear to be working fine (with the same previous existing taint calls as used by the land management module). More work to do.0.7.1-dev
parent
3d0e072d50
commit
bfd9cc44b4
|
@ -104,6 +104,29 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
||||||
Assert.That(pc.Simulator, Is.EqualTo(5));
|
Assert.That(pc.Simulator, Is.EqualTo(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test count after a parcel owner owned copied object is added.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestCopiedOwnerObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
|
||||||
|
m_scene.AddNewSceneObject(sog, false);
|
||||||
|
m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(6));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(6));
|
||||||
|
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(6));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test count after a parcel owner owned object is removed.
|
/// Test count after a parcel owner owned object is removed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -363,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (Entities.ContainsKey(sceneObject.UUID))
|
if (Entities.ContainsKey(sceneObject.UUID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
|
||||||
|
// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
|
||||||
|
|
||||||
SceneObjectPart[] children = sceneObject.Parts;
|
SceneObjectPart[] children = sceneObject.Parts;
|
||||||
|
|
||||||
|
@ -1798,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="rot"></param>
|
/// <param name="rot"></param>
|
||||||
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
|
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
|
||||||
|
// originalPrimID, offset, AgentID);
|
||||||
|
|
||||||
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
||||||
if (original != null)
|
if (original != null)
|
||||||
{
|
{
|
||||||
|
@ -1829,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
copy.RootPart.SalePrice = 10;
|
copy.RootPart.SalePrice = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: This section needs to be refactored so that it just calls AddSceneObject()
|
||||||
Entities.Add(copy);
|
Entities.Add(copy);
|
||||||
|
|
||||||
|
lock (SceneObjectGroupsByFullID)
|
||||||
|
SceneObjectGroupsByFullID[copy.UUID] = copy;
|
||||||
|
|
||||||
|
SceneObjectPart[] children = copy.Parts;
|
||||||
|
|
||||||
|
lock (SceneObjectGroupsByFullPartID)
|
||||||
|
{
|
||||||
|
SceneObjectGroupsByFullPartID[copy.UUID] = copy;
|
||||||
|
foreach (SceneObjectPart part in children)
|
||||||
|
SceneObjectGroupsByFullPartID[part.UUID] = copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (SceneObjectGroupsByLocalPartID)
|
||||||
|
{
|
||||||
|
SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
|
||||||
|
foreach (SceneObjectPart part in children)
|
||||||
|
SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
|
||||||
|
}
|
||||||
|
// PROBABLE END OF FIXME
|
||||||
|
|
||||||
// Since we copy from a source group that is in selected
|
// Since we copy from a source group that is in selected
|
||||||
// state, but the copy is shown deselected in the viewer,
|
// state, but the copy is shown deselected in the viewer,
|
||||||
|
|
Loading…
Reference in New Issue