Undo fix is now complete. This commit repairs the special case of the root prim moving or rotating independently of the rest of the group.

avinationmerge
Tom Grimshaw 2010-07-05 05:44:35 -07:00
parent be5dd04150
commit e947d04038
3 changed files with 41 additions and 15 deletions

View File

@ -3386,10 +3386,27 @@ namespace OpenSim.Region.Framework.Scenes
}
lockPartsForRead(false);
AbsolutePosition = newPos;
//We have to set undoing here because otherwise an undo state will be saved
if (!m_rootPart.Undoing)
{
m_rootPart.Undoing = true;
AbsolutePosition = newPos;
m_rootPart.Undoing = false;
}
else
{
AbsolutePosition = newPos;
}
HasGroupChanged = true;
ScheduleGroupForTerseUpdate();
if (m_rootPart.Undoing)
{
ScheduleGroupForFullUpdate();
}
else
{
ScheduleGroupForTerseUpdate();
}
}
public void OffsetForNewRegion(Vector3 offset)
@ -3488,7 +3505,16 @@ namespace OpenSim.Region.Framework.Scenes
if (part.UUID == m_rootPart.UUID)
{
UpdateRootRotation(rot);
AbsolutePosition = pos;
if (!m_rootPart.Undoing)
{
m_rootPart.Undoing = true;
AbsolutePosition = pos;
m_rootPart.Undoing = false;
}
else
{
AbsolutePosition = pos;
}
}
else
{
@ -3511,6 +3537,12 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion oldParentRot = m_rootPart.RotationOffset;
m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
bool cancelUndo = false;
if (!m_rootPart.Undoing)
{
m_rootPart.Undoing = true;
cancelUndo = true;
}
m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
@ -3534,18 +3566,13 @@ namespace OpenSim.Region.Framework.Scenes
newRot *= Quaternion.Inverse(axRot);
prim.RotationOffset = newRot;
prim.ScheduleTerseUpdate();
prim.IgnoreUndoUpdate = false;
}
}
foreach (SceneObjectPart childpart in Children.Values)
if (cancelUndo == true)
{
if (childpart != m_rootPart)
{
childpart.IgnoreUndoUpdate = false;
childpart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
}
m_rootPart.Undoing = false;
}
lockPartsForRead(false);
m_rootPart.ScheduleTerseUpdate();

View File

@ -3506,8 +3506,6 @@ namespace OpenSim.Region.Framework.Scenes
}
public void StoreUndoState(UndoType type)
{
if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
{
if (!IgnoreUndoUpdate)

View File

@ -172,8 +172,9 @@ namespace OpenSim.Region.Framework.Scenes
if (part.ParentID == 0 && GroupChange == false)
{
if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
part.RotationOffset = Rotation;
part.ParentGroup.UpdateSinglePosition(Position, part.LocalId);
part.ParentGroup.UpdateSingleRotation(Rotation, part.LocalId);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate();