Comment out attachments code in Scene.IncomingCreateObject(UUID userID, UUID itemID) for now

As far as I can see, this is only invoked by a PUT request to ObjectHandlers, which is not being used anyway.
Invoking attachments code at this point is probably inappropriate since it would still be invoked when the client entered the scene.
Being commented to simplify analysis of attachments issues.  Can be uncommented when in use.
Also, small tweak to lock and log removal of a SOG from the SceneObjectGroupsByLocalPartID collection in SceneGraph.GetGroupByPrim() if an inconsistency is found.
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-13 20:25:32 +01:00
parent df73833a2c
commit 618277e797
3 changed files with 47 additions and 13 deletions

View File

@ -143,6 +143,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void SaveChangedAttachments(IScenePresence sp) public void SaveChangedAttachments(IScenePresence sp)
{ {
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
foreach (SceneObjectGroup grp in sp.GetAttachments()) foreach (SceneObjectGroup grp in sp.GetAttachments())
{ {
if (grp.HasGroupChanged) // Resizer scripts? if (grp.HasGroupChanged) // Resizer scripts?
@ -242,9 +244,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
lock (sp.AttachmentsSyncLock) lock (sp.AttachmentsSyncLock)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
// group.Name, group.LocalId, sp.Name, attachmentPt, silent); // group.Name, group.LocalId, sp.Name, attachmentPt, silent);
if (sp.GetAttachments(attachmentPt).Contains(group)) if (sp.GetAttachments(attachmentPt).Contains(group))
{ {
@ -365,6 +367,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt) public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt)
{ {
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}",
// (AttachmentPoint)AttachmentPt, itemID, sp.Name);
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
// be removed when that functionality is implemented in opensim // be removed when that functionality is implemented in opensim
AttachmentPt &= 0x7f; AttachmentPt &= 0x7f;
@ -485,6 +491,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void DetachObject(uint objectLocalID, IClientAPI remoteClient) public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
{ {
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: DetachObject() for object {0} on {1}", objectLocalID, remoteClient.Name);
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
if (group != null) if (group != null)
{ {
@ -588,6 +597,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// To LocalId or UUID, *THAT* is the question. How now Brown UUID?? // To LocalId or UUID, *THAT* is the question. How now Brown UUID??
private void DetachSingleAttachmentToInv(UUID itemID, IScenePresence sp) private void DetachSingleAttachmentToInv(UUID itemID, IScenePresence sp)
{ {
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name);
if (itemID == UUID.Zero) // If this happened, someone made a mistake.... if (itemID == UUID.Zero) // If this happened, someone made a mistake....
return; return;

View File

@ -2461,14 +2461,16 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>False</returns> /// <returns>False</returns>
public virtual bool IncomingCreateObject(UUID userID, UUID itemID) public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
{ {
//m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
ScenePresence sp = GetScenePresence(userID); // Commented out since this is as yet unused and is arguably not the appropriate place to do this, as
if (sp != null && AttachmentsModule != null) // attachments are being rezzed elsewhere in AddNewClient()
{ // ScenePresence sp = GetScenePresence(userID);
uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); // if (sp != null && AttachmentsModule != null)
AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); // {
} // uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
// AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
// }
return false; return false;
} }

View File

@ -431,6 +431,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>true if the object was deleted, false if there was no object to delete</returns> /// <returns>true if the object was deleted, false if there was no object to delete</returns>
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
{ {
// m_log.DebugFormat(
// "[SCENE GRAPH]: Deleting scene object with uuid {0}, resultOfObjectLinked = {1}",
// uuid, resultOfObjectLinked);
EntityBase entity; EntityBase entity;
if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup))) if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
return false; return false;
@ -878,7 +882,8 @@ namespace OpenSim.Region.Framework.Scenes
if (Entities.TryGetValue(localID, out entity)) if (Entities.TryGetValue(localID, out entity))
return entity as SceneObjectGroup; return entity as SceneObjectGroup;
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); // m_log.DebugFormat("[SCENE GRAPH]: Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog; SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalPartID) lock (SceneObjectGroupsByLocalPartID)
SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog); SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
@ -886,9 +891,25 @@ namespace OpenSim.Region.Framework.Scenes
if (sog != null) if (sog != null)
{ {
if (sog.HasChildPrim(localID)) if (sog.HasChildPrim(localID))
{
// m_log.DebugFormat(
// "[SCENE GRAPH]: Found scene object {0} {1} {2} containing part with local id {3} in {4}. Returning.",
// sog.Name, sog.UUID, sog.LocalId, localID, m_parentScene.RegionInfo.RegionName);
return sog; return sog;
}
else
{
lock (SceneObjectGroupsByLocalPartID)
{
m_log.WarnFormat(
"[SCENE GRAPH]: Found scene object {0} {1} {2} via SceneObjectGroupsByLocalPartID index but it doesn't contain part with local id {3}. Removing from entry from index in {4}.",
sog.Name, sog.UUID, sog.LocalId, localID, m_parentScene.RegionInfo.RegionName);
SceneObjectGroupsByLocalPartID.Remove(localID); SceneObjectGroupsByLocalPartID.Remove(localID);
} }
}
}
EntityBase[] entityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList) foreach (EntityBase ent in entityList)