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;
UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
m_scene.DeleteSceneObject(group, false);
return;
}

View File

@ -448,6 +448,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
if (m_scene.TryGetScenePresence(agentID, out presence))
{
string name = presence.Name;
m_scene.SceneGraph.DeleteSceneObject(UUID.Zero, true);
m_scene.RemoveClient(agentID);
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["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));
SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, rsm);
}
@ -882,7 +884,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SceneObjectGroup sog = (SceneObjectGroup)e;
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;
}
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)
{
m_log.WarnFormat("SyncStateReport -- SOG: name {0}, UUID {1}, position {2}", sog.Name, sog.UUID, sog.AbsolutePosition);
@ -1091,13 +1093,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
string debugMsg = "Part " + part.Name + "," + part.UUID+", LocalID "+part.LocalId;
if (part.ParentGroup.RootPart.UUID == part.UUID)
{
debugMsg += ", RootPart, ";
else
debugMsg += ", ChildPart, ";
debugMsg += "ParentId = " + part.ParentID;
debugMsg += ", GroupPos " + part.GroupPosition + ", offset-position " + part.OffsetPosition;
debugMsg += ", AttachedAvatar="+part.AttachedAvatar+", AttachmentPoint = "+part.AttachmentPoint;
m_log.WarnFormat(debugMsg);
//else
// debugMsg += ", ChildPart, ";
debugMsg += "ParentId = " + part.ParentID;
debugMsg += ", GroupPos " + part.GroupPosition + ", offset-position " + part.OffsetPosition;
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);
}
}
}
@ -2652,6 +2663,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_primSyncInfoManager.SetSOPPhyscActorProperties(part);
part.aggregateScriptEventSubscriptions();
}
group.ScheduleGroupForFullUpdate(null);
}
/// <summary>

View File

@ -732,12 +732,71 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup);
}
public ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup group)
public ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup sceneObject)
{
//if(attachToBackup)
// 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()
@ -814,21 +873,6 @@ namespace OpenSim.Region.Framework.Scenes
//Leverage the LinkObject implementation to get the book keeping of Group and Parts relations right
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());
}
* */
}
@ -879,6 +923,7 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
#endregion //DSG SYNC
public ICapabilitiesModule CapsModule
@ -2626,7 +2671,7 @@ namespace OpenSim.Region.Framework.Scenes
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);
}