Fix a rather nasty issue where the Backup() process causes objects and avatars sitting on them to be pushed to the corner of the sim.

avinationmerge
meta7 2010-08-07 16:52:03 -07:00
parent 8d3a73d126
commit 19ab4c9508
2 changed files with 120 additions and 104 deletions

View File

@ -318,7 +318,7 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_scriptListens_atRotTarget = false; private bool m_scriptListens_atRotTarget = false;
private bool m_scriptListens_notAtRotTarget = false; private bool m_scriptListens_notAtRotTarget = false;
public bool m_dupeInProgress = false;
internal Dictionary<UUID, string> m_savedScriptState = null; internal Dictionary<UUID, string> m_savedScriptState = null;
#region Properties #region Properties
@ -476,9 +476,13 @@ namespace OpenSim.Region.Framework.Scenes
part.IgnoreUndoUpdate = false; part.IgnoreUndoUpdate = false;
part.StoreUndoState(UndoType.STATE_GROUP_POSITION); part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
part.GroupPosition = val; part.GroupPosition = val;
if (!m_dupeInProgress)
{
part.TriggerScriptChangedEvent(Changed.POSITION); part.TriggerScriptChangedEvent(Changed.POSITION);
} }
}
if (!m_dupeInProgress)
{
foreach (ScenePresence av in m_linkedAvatars) foreach (ScenePresence av in m_linkedAvatars)
{ {
Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition; Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition;
@ -486,6 +490,7 @@ namespace OpenSim.Region.Framework.Scenes
av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition
av.SendFullUpdateToAllClients(); av.SendFullUpdateToAllClients();
} }
}
//if (m_rootPart.PhysActor != null) //if (m_rootPart.PhysActor != null)
//{ //{
@ -1801,7 +1806,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
public SceneObjectGroup Copy(bool userExposed) public SceneObjectGroup Copy(bool userExposed)
{ {
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); SceneObjectGroup dupe;
try
{
m_dupeInProgress = true;
dupe = (SceneObjectGroup)MemberwiseClone();
dupe.m_isBackedUp = false; dupe.m_isBackedUp = false;
dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); dupe.m_parts = new Dictionary<UUID, SceneObjectPart>();
@ -1881,7 +1890,11 @@ namespace OpenSim.Region.Framework.Scenes
ScheduleGroupForFullUpdate(); ScheduleGroupForFullUpdate();
} }
}
finally
{
m_dupeInProgress = false;
}
return dupe; return dupe;
} }

View File

@ -720,6 +720,8 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
} }
if (!m_parentGroup.m_dupeInProgress)
{
List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
foreach (ScenePresence av in avs) foreach (ScenePresence av in avs)
{ {
@ -731,6 +733,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
}
TriggerScriptChangedEvent(Changed.POSITION); TriggerScriptChangedEvent(Changed.POSITION);
} }
} }