* Refactor: Collapse some multiple remove object paths
* Push some delete functionality into InnerScene to match what's already there for adding objects0.6.0-stable
parent
10564469c8
commit
0ee69707ea
|
@ -179,7 +179,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
|
|||
|
||||
if (Util.RandomClass.NextDouble() < killLikelyhood)
|
||||
{
|
||||
m_scene.RemoveSceneObject(selectedTree.ParentGroup);
|
||||
m_scene.DeleteSceneObject(selectedTree.ParentGroup);
|
||||
m_trees.Remove(selectedTree.ParentGroup.UUID);
|
||||
|
||||
m_scene.ForEachClient(delegate(IClientAPI controller)
|
||||
|
|
|
@ -204,18 +204,45 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// Add an object to the scene.
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
public void AddSceneObject(SceneObjectGroup sceneObject)
|
||||
/// <returns>true if the object was added, false if an object with the same uuid was already in the scene
|
||||
/// </returns>
|
||||
public bool AddSceneObject(SceneObjectGroup sceneObject)
|
||||
{
|
||||
if (!Entities.ContainsKey(sceneObject.UUID))
|
||||
lock (Entities)
|
||||
{
|
||||
// QuadTree.AddSceneObject(sceneObject);
|
||||
lock (Entities)
|
||||
if (!Entities.ContainsKey(sceneObject.UUID))
|
||||
{
|
||||
// QuadTree.AddSceneObject(sceneObject);
|
||||
Entities.Add(sceneObject.UUID, sceneObject);
|
||||
m_numPrim++;
|
||||
|
||||
return true;
|
||||
}
|
||||
m_numPrim++;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete an object from the scene
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <returns>true if the object was deleted, false if there was no object to delete</returns>
|
||||
public bool DeleteSceneObject(LLUUID uuid)
|
||||
{
|
||||
lock (Entities)
|
||||
{
|
||||
if (Entities.ContainsKey(uuid))
|
||||
{
|
||||
Entities.Remove(uuid);
|
||||
m_numPrim--;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an entity to the list of prims to process on the next update
|
||||
|
@ -376,7 +403,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID??
|
||||
public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient)
|
||||
{
|
||||
|
||||
if (itemID == LLUUID.Zero) // If this happened, someone made a mistake....
|
||||
return;
|
||||
|
||||
|
@ -392,11 +418,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
group.DetachToInventoryPrep();
|
||||
m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
|
||||
m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(),group.OwnerID);
|
||||
m_parentScene.DeleteSceneObjectGroup(group);
|
||||
m_parentScene.DeleteSceneObject(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos)
|
||||
|
|
|
@ -1251,14 +1251,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (permissionToDelete)
|
||||
{
|
||||
DeleteSceneObjectGroup(objectGroup);
|
||||
DeleteSceneObject(objectGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID)
|
||||
|
@ -1790,7 +1788,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
returnobjects[i] = null;
|
||||
|
||||
DeleteSceneObjectGroup(ObjectDeleting);
|
||||
DeleteSceneObject(ObjectDeleting);
|
||||
ObjectDeleting = null;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1335,22 +1335,40 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public void AddSceneObject(SceneObjectGroup sceneObject)
|
||||
{
|
||||
m_innerScene.AddSceneObject(sceneObject);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove an object from the scene
|
||||
/// Delete this object from the scene.
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
public void RemoveSceneObject(SceneObjectGroup sceneObject)
|
||||
/// <param name="group"></param>
|
||||
public void DeleteSceneObject(SceneObjectGroup group)
|
||||
{
|
||||
if (Entities.ContainsKey(sceneObject.UUID))
|
||||
SceneObjectPart rootPart = (group).GetChildPart(group.UUID);
|
||||
if (rootPart.PhysActor != null)
|
||||
{
|
||||
EventManager.TriggerObjectBeingRemovedFromScene(sceneObject);
|
||||
Entities.Remove(sceneObject.UUID);
|
||||
EventManager.TriggerParcelPrimCountTainted();
|
||||
m_innerScene.RemoveAPrimCount();
|
||||
PhysicsScene.RemovePrim(rootPart.PhysActor);
|
||||
rootPart.PhysActor = null;
|
||||
}
|
||||
}
|
||||
|
||||
m_storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID);
|
||||
group.DeleteGroup();
|
||||
|
||||
if (m_innerScene.DeleteSceneObject(group.UUID))
|
||||
{
|
||||
EventManager.TriggerObjectBeingRemovedFromScene(group);
|
||||
EventManager.TriggerParcelPrimCountTainted();
|
||||
}
|
||||
|
||||
group.DeleteParts();
|
||||
|
||||
// In case anybody else retains a reference to this group, signal deletion by changing the name
|
||||
// to null. We can't zero out the UUID because this is taken from the root part, which has already
|
||||
// been removed.
|
||||
// FIXME: This is a really poor temporary solution, since it still leaves plenty of scope for race
|
||||
// conditions where a user deletes an entity while it is being stored. Really, the update
|
||||
// code needs a redesign.
|
||||
group.Name = null;
|
||||
}
|
||||
|
||||
public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset)
|
||||
{
|
||||
|
@ -1411,7 +1429,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// We remove the object here
|
||||
try
|
||||
{
|
||||
DeleteSceneObjectGroup(grp);
|
||||
DeleteSceneObject(grp);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -1473,7 +1491,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// We remove the object here
|
||||
try
|
||||
{
|
||||
DeleteSceneObjectGroup(grp);
|
||||
DeleteSceneObject(grp);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -3141,37 +3159,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete this object from the scene.
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
public void DeleteSceneObjectGroup(SceneObjectGroup group)
|
||||
{
|
||||
SceneObjectPart rootPart = (group).GetChildPart(group.UUID);
|
||||
if (rootPart.PhysActor != null)
|
||||
{
|
||||
PhysicsScene.RemovePrim(rootPart.PhysActor);
|
||||
rootPart.PhysActor = null;
|
||||
}
|
||||
|
||||
m_storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID);
|
||||
group.DeleteGroup();
|
||||
|
||||
lock (Entities)
|
||||
{
|
||||
RemoveSceneObject(group);
|
||||
}
|
||||
group.DeleteParts();
|
||||
|
||||
// In case anybody else retains a reference to this group, signal deletion by changing the name
|
||||
// to null. We can't zero out the UUID because this is taken from the root part, which has already
|
||||
// been removed.
|
||||
// FIXME: This is a really poor temporary solution, since it still leaves plenty of scope for race
|
||||
// conditions where a user deletes an entity while it is being stored. Really, the update
|
||||
// code needs a redesign.
|
||||
group.Name = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
if (m_parts.Count == 1)
|
||||
{
|
||||
m_parts.Remove(m_rootPart.UUID);
|
||||
m_scene.RemoveSceneObject(this);
|
||||
m_scene.DeleteSceneObject(this);
|
||||
remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalId);
|
||||
remoteClient.AddMoney(50);
|
||||
remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero, (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully);
|
||||
|
|
|
@ -704,7 +704,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
public void llDie()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
World.DeleteSceneObjectGroup(m_host.ParentGroup);
|
||||
World.DeleteSceneObject(m_host.ParentGroup);
|
||||
}
|
||||
|
||||
public double llGround(LSL_Types.Vector3 offset)
|
||||
|
|
Loading…
Reference in New Issue