Added AttachObjectBySync and calling it from AddNewSceneObjectBySync to

link avatar and attachments, and to update viewers properly.
dsg
Huaiyu (Kitty) Liu 2011-05-20 16:30:19 -07:00
parent f1800824eb
commit 41317dda8e
4 changed files with 86 additions and 26 deletions

View File

@ -475,6 +475,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
group.HasGroupChanged = true; group.HasGroupChanged = true;
UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
m_scene.DeleteSceneObject(group, false); m_scene.DeleteSceneObject(group, false);
return; return;
} }

View File

@ -448,6 +448,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
if (m_scene.TryGetScenePresence(agentID, out presence)) if (m_scene.TryGetScenePresence(agentID, out presence))
{ {
string name = presence.Name; string name = presence.Name;
m_scene.SceneGraph.DeleteSceneObject(UUID.Zero, true); m_scene.SceneGraph.DeleteSceneObject(UUID.Zero, true);
m_scene.RemoveClient(agentID); m_scene.RemoveClient(agentID);
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Agent \"{0}\" was removed from scene.", name)); RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Agent \"{0}\" was removed from scene.", name));

View File

@ -331,6 +331,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["actorID"] = OSD.FromString(m_actorID); data["actorID"] = OSD.FromString(m_actorID);
data["softDelete"] = OSD.FromBoolean(softDelete); data["softDelete"] = OSD.FromBoolean(softDelete);
//m_log.DebugFormat("{0}: Send DeleteObject out for {1},{2}", m_scene.RegionInfo.RegionName, sog.Name, sog.UUID);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data)); SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data));
SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, rsm); SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, rsm);
} }
@ -882,7 +884,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SceneObjectGroup sog = (SceneObjectGroup)e; SceneObjectGroup sog = (SceneObjectGroup)e;
if (sog.RootPart.AttachedAvatar == avatar.UUID) if (sog.RootPart.AttachedAvatar == avatar.UUID)
{ {
sog.RootPart.SetParentLocalId(avatar.LocalId); m_scene.AttachObjectBySync(avatar, sog);
} }
} }
} }
@ -1078,7 +1080,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
primCount += sog.Parts.Length; primCount += sog.Parts.Length;
} }
m_log.WarnFormat("SyncStateReport -- Object count: {0}, Prim Count {1} ", sogList.Count, primCount); m_log.WarnFormat("SyncStateReport {0} -- Object count: {1}, Prim Count {2} ", m_scene.RegionInfo.RegionName, sogList.Count, primCount);
foreach (SceneObjectGroup sog in sogList) foreach (SceneObjectGroup sog in sogList)
{ {
m_log.WarnFormat("SyncStateReport -- SOG: name {0}, UUID {1}, position {2}", sog.Name, sog.UUID, sog.AbsolutePosition); m_log.WarnFormat("SyncStateReport -- SOG: name {0}, UUID {1}, position {2}", sog.Name, sog.UUID, sog.AbsolutePosition);
@ -1091,15 +1093,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
string debugMsg = "Part " + part.Name + "," + part.UUID+", LocalID "+part.LocalId; string debugMsg = "Part " + part.Name + "," + part.UUID+", LocalID "+part.LocalId;
if (part.ParentGroup.RootPart.UUID == part.UUID) if (part.ParentGroup.RootPart.UUID == part.UUID)
{
debugMsg += ", RootPart, "; debugMsg += ", RootPart, ";
else //else
debugMsg += ", ChildPart, "; // debugMsg += ", ChildPart, ";
debugMsg += "ParentId = " + part.ParentID; debugMsg += "ParentId = " + part.ParentID;
debugMsg += ", GroupPos " + part.GroupPosition + ", offset-position " + part.OffsetPosition; debugMsg += ", GroupPos " + part.GroupPosition + ", offset-position " + part.OffsetPosition;
debugMsg += ", AttachedAvatar="+part.AttachedAvatar+", AttachmentPoint = "+part.AttachmentPoint; debugMsg += ", AttachedAvatar=" + part.AttachedAvatar + ", AttachmentPoint = " + part.AttachmentPoint;
debugMsg += ", AttachedPos = " + part.AttachedPos;
ScenePresence sp = m_scene.GetScenePresence(part.AttachedAvatar);
if (sp != null)
{
debugMsg += ", attached avatar's localID = "+sp.LocalId;
}
m_log.WarnFormat(debugMsg); m_log.WarnFormat(debugMsg);
} }
} }
}
if (m_isSyncRelay) if (m_isSyncRelay)
{ {
@ -2652,6 +2663,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_primSyncInfoManager.SetSOPPhyscActorProperties(part); m_primSyncInfoManager.SetSOPPhyscActorProperties(part);
part.aggregateScriptEventSubscriptions(); part.aggregateScriptEventSubscriptions();
} }
group.ScheduleGroupForFullUpdate(null);
} }
/// <summary> /// <summary>

View File

@ -732,12 +732,71 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup); m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup);
} }
public ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup group) public ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup sceneObject)
{ {
//if(attachToBackup) //if(attachToBackup)
// group.HasGroupChanged = true; // group.HasGroupChanged = true;
return m_sceneGraph.AddNewSceneObjectBySync(group); if (sceneObject.IsAttachmentCheckFull()) // Attachment
{
//sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
//sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
m_sceneGraph.AddNewSceneObjectBySync(sceneObject);
// Handle attachment special case
SceneObjectPart RootPrim = sceneObject.RootPart;
// Fix up attachment Parent Local ID
ScenePresence sp = GetScenePresence(RootPrim.AttachedAvatar);
if (sp != null)
{
//RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
AttachObjectBySync(sp, sceneObject);
}
else
{
//RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
//RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
sceneObject.ScheduleGroupForFullUpdate(null);
}
return Scene.ObjectUpdateResult.New;
}
else
{
return m_sceneGraph.AddNewSceneObjectBySync(sceneObject);
}
//return m_sceneGraph.AddNewSceneObjectBySync(group);
}
//Link the attachments to avatar. Assumption: attachments properties,
//including AttachedAvatar, AttachedPos, etc have already been sync'ed
//by sync messages such as NewObject or UpdatePrimProperties. Here we only
//need to set the parentID and add attachments to avatar's list.
public void AttachObjectBySync(ScenePresence sp, SceneObjectGroup group)
{
//group.DetachFromBackup();
// Remove from database and parcel prim count
//DeleteFromStorage(group.UUID);
//EventManager.TriggerParcelPrimCountTainted();
//ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
sp.AddAttachment(group);
group.RootPart.SetParentLocalId(sp.LocalId);
// In case it is later dropped again, don't let
// it get cleaned up
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
group.ScheduleGroupForFullUpdate(null);
} }
public void DebugSceneObjectGroups() public void DebugSceneObjectGroups()
@ -815,21 +874,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.LinkObjectsBySync(root, children); m_sceneGraph.LinkObjectsBySync(root, children);
//KittyL 04/19/2011: no longer update properties here, caller will do it
//Set the property values as in the incoming copy of the object group
//SceneObjectGroup localGroup = root.ParentGroup;
//localGroup.UpdateObjectGroupBySync(linkedGroup);
//DSG DEBUG
/*
m_log.Debug("after SceneGraph.LinkObjectsBySync, the newly linked group is \n" + root.ParentGroup.DebugObjectUpdateResult());
m_log.Debug("parts before linking now have properties: ");
foreach (SceneObjectPart part in children)
{
m_log.Debug(part.DebugObjectPartProperties());
}
* */
} }
/// <summary> /// <summary>
@ -879,6 +923,7 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
#endregion //DSG SYNC #endregion //DSG SYNC
public ICapabilitiesModule CapsModule public ICapabilitiesModule CapsModule
@ -2626,7 +2671,7 @@ namespace OpenSim.Region.Framework.Scenes
group.DeleteGroupFromScene(silent); group.DeleteGroupFromScene(silent);
// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); //m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}, slient? {2}", group.Name, group.UUID, silent);
} }