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

View File

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

View File

@ -172,8 +172,9 @@ namespace OpenSim.Region.Framework.Scenes
if (part.ParentID == 0 && GroupChange == false) if (part.ParentID == 0 && GroupChange == false)
{ {
if (Position != Vector3.Zero) 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) if (Scale != Vector3.Zero)
part.Resize(Scale); part.Resize(Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate(); part.ParentGroup.ScheduleGroupForTerseUpdate();