Fix undo of prim group rotation.

This isn't that great since I think I broke it a few commits earlier.
Undo of rotation of individual prims in a linkset is still broken
bulletsim
Justin Clark-Casey (justincc) 2011-07-19 04:15:27 +01:00
parent 4b9ef4f39c
commit 97f1edfd95
3 changed files with 34 additions and 24 deletions

View File

@ -2895,9 +2895,11 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].StoreUndoState();
// SceneObjectPart[] parts = m_parts.GetArray();
// for (int i = 0; i < parts.Length; i++)
// parts[i].StoreUndoState();
m_rootPart.StoreUndoState(true);
m_rootPart.UpdateRotation(rot);
@ -2922,9 +2924,12 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].StoreUndoState();
// SceneObjectPart[] parts = m_parts.GetArray();
// for (int i = 0; i < parts.Length; i++)
// parts[i].StoreUndoState();
RootPart.StoreUndoState(true);
RootPart.IgnoreUndoUpdate = true;
m_rootPart.UpdateRotation(rot);
@ -2939,6 +2944,8 @@ namespace OpenSim.Region.Framework.Scenes
HasGroupChanged = true;
ScheduleGroupForTerseUpdate();
RootPart.IgnoreUndoUpdate = false;
}
/// <summary>

View File

@ -3706,8 +3706,8 @@ namespace OpenSim.Region.Framework.Scenes
m_undo.Push(nUndo);
m_log.DebugFormat(
"[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}",
Name, LocalId, m_undo.Count);
"[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
Name, LocalId, forGroup, m_undo.Count);
}
}
}

View File

@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Scenes
{
public class UndoState
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Vector3 Position = Vector3.Zero;
public Vector3 Scale = Vector3.Zero;
@ -57,23 +57,25 @@ namespace OpenSim.Region.Framework.Scenes
{
if (part.ParentID == 0)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo position {0} for root part", part.ParentGroup.AbsolutePosition);
ForGroup = forGroup;
if (ForGroup)
Position = part.ParentGroup.AbsolutePosition;
else
Position = part.OffsetPosition;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for root part", part.RotationOffset);
m_log.DebugFormat(
"[UNDO STATE]: Storing undo position {0} for root part", Position);
Rotation = part.RotationOffset;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale);
m_log.DebugFormat(
"[UNDO STATE]: Storing undo rotation {0} for root part", Rotation);
Scale = part.Shape.Scale;
ForGroup = forGroup;
m_log.DebugFormat(
"[UNDO STATE]: Storing undo scale {0} for root part", Scale);
}
else
{
@ -132,23 +134,24 @@ namespace OpenSim.Region.Framework.Scenes
if (part.ParentID == 0)
{
m_log.DebugFormat(
"[UNDO STATE]: Undoing position to {0} for root part {1} {2}",
Position, part.Name, part.LocalId);
if (Position != Vector3.Zero)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing position {0} to {1} for root part {2} {3}",
// part.ParentGroup.AbsolutePosition, Position, part.Name, part.LocalId);
if (ForGroup)
part.ParentGroup.AbsolutePosition = Position;
else
part.OffsetPosition = Position;
}
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId);
m_log.DebugFormat(
"[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
part.RotationOffset, Rotation, part.Name, part.LocalId);
part.RotationOffset = Rotation;
part.UpdateRotation(Rotation);
//part.RotationOffset = Rotation;
if (Scale != Vector3.Zero)
{