The majority of the Undo fix. There is still an issue with Rotation which i'll address next; however position undo and scale undo should be working just fine now. Also removed some residual debug logging.
parent
7665013ad8
commit
5b68343361
|
@ -87,9 +87,16 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Peek()
|
public T Peek()
|
||||||
|
{
|
||||||
|
if (m_undolist.Count > 0)
|
||||||
{
|
{
|
||||||
return m_undolist[m_undolist.Count - 1];
|
return m_undolist[m_undolist.Count - 1];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return default(T);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
|
|
|
@ -355,7 +355,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach(SceneObjectPart p in m_parts.Values)
|
foreach(SceneObjectPart p in m_parts.Values)
|
||||||
{
|
{
|
||||||
p.StoreUndoState(true);
|
p.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -435,7 +435,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_rootPart.GroupPosition; }
|
get { return m_rootPart.GroupPosition; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector3 val = value;
|
Vector3 val = value;
|
||||||
|
|
||||||
if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|
if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|
||||||
|
@ -464,7 +463,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
part.IgnoreUndoUpdate = false;
|
part.IgnoreUndoUpdate = false;
|
||||||
part.StoreUndoState(true);
|
part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
|
||||||
part.GroupPosition = val;
|
part.GroupPosition = val;
|
||||||
}
|
}
|
||||||
lockPartsForRead(false);
|
lockPartsForRead(false);
|
||||||
|
@ -1488,7 +1487,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
|
public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
part.StoreUndoState();
|
part.StoreUndoState(UndoType.STATE_PRIM_ALL);
|
||||||
part.OnGrab(offsetPos, remoteClient);
|
part.OnGrab(offsetPos, remoteClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3245,6 +3244,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
prevScale.X *= x;
|
prevScale.X *= x;
|
||||||
prevScale.Y *= y;
|
prevScale.Y *= y;
|
||||||
prevScale.Z *= z;;
|
prevScale.Z *= z;;
|
||||||
|
|
||||||
|
part.IgnoreUndoUpdate = false;
|
||||||
|
part.StoreUndoState(UndoType.STATE_GROUP_SCALE);
|
||||||
part.IgnoreUndoUpdate = true;
|
part.IgnoreUndoUpdate = true;
|
||||||
part.Resize(prevScale);
|
part.Resize(prevScale);
|
||||||
part.IgnoreUndoUpdate = false;
|
part.IgnoreUndoUpdate = false;
|
||||||
|
@ -3253,11 +3255,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart obPart in m_parts.Values)
|
foreach (SceneObjectPart obPart in m_parts.Values)
|
||||||
{
|
{
|
||||||
obPart.IgnoreUndoUpdate = false;
|
|
||||||
obPart.StoreUndoState(true);
|
|
||||||
obPart.IgnoreUndoUpdate = true;
|
|
||||||
if (obPart.UUID != m_rootPart.UUID)
|
if (obPart.UUID != m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
|
obPart.IgnoreUndoUpdate = false;
|
||||||
|
obPart.StoreUndoState(UndoType.STATE_GROUP_SCALE);
|
||||||
|
obPart.IgnoreUndoUpdate = true;
|
||||||
|
|
||||||
Vector3 currentpos = new Vector3(obPart.OffsetPosition);
|
Vector3 currentpos = new Vector3(obPart.OffsetPosition);
|
||||||
currentpos.X *= x;
|
currentpos.X *= x;
|
||||||
currentpos.Y *= y;
|
currentpos.Y *= y;
|
||||||
|
@ -3296,14 +3299,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
public void UpdateGroupPosition(Vector3 pos)
|
public void UpdateGroupPosition(Vector3 pos)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in Children.Values)
|
|
||||||
{
|
|
||||||
part.StoreUndoState();
|
|
||||||
}
|
|
||||||
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
||||||
{
|
{
|
||||||
if (IsAttachment)
|
if (IsAttachment)
|
||||||
{
|
{
|
||||||
|
m_rootPart.StoreUndoState(UndoType.STATE_GROUP_POSITION);
|
||||||
m_rootPart.AttachedPos = pos;
|
m_rootPart.AttachedPos = pos;
|
||||||
}
|
}
|
||||||
if (RootPart.GetStatusSandbox())
|
if (RootPart.GetStatusSandbox())
|
||||||
|
@ -3336,7 +3336,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectPart part = GetChildPart(localID);
|
SceneObjectPart part = GetChildPart(localID);
|
||||||
foreach (SceneObjectPart parts in Children.Values)
|
foreach (SceneObjectPart parts in Children.Values)
|
||||||
{
|
{
|
||||||
parts.StoreUndoState();
|
parts.StoreUndoState(UndoType.STATE_PRIM_POSITION);
|
||||||
}
|
}
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
|
@ -3361,7 +3361,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in Children.Values)
|
foreach (SceneObjectPart part in Children.Values)
|
||||||
{
|
{
|
||||||
part.StoreUndoState();
|
part.StoreUndoState(UndoType.STATE_PRIM_POSITION);
|
||||||
}
|
}
|
||||||
Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
|
Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
|
||||||
Vector3 oldPos =
|
Vector3 oldPos =
|
||||||
|
@ -3409,7 +3409,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart parts in Children.Values)
|
foreach (SceneObjectPart parts in Children.Values)
|
||||||
{
|
{
|
||||||
parts.StoreUndoState();
|
parts.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
|
||||||
}
|
}
|
||||||
m_rootPart.UpdateRotation(rot);
|
m_rootPart.UpdateRotation(rot);
|
||||||
|
|
||||||
|
@ -3433,7 +3433,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart parts in Children.Values)
|
foreach (SceneObjectPart parts in Children.Values)
|
||||||
{
|
{
|
||||||
parts.StoreUndoState();
|
parts.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
|
||||||
}
|
}
|
||||||
m_rootPart.UpdateRotation(rot);
|
m_rootPart.UpdateRotation(rot);
|
||||||
|
|
||||||
|
@ -3460,7 +3460,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectPart part = GetChildPart(localID);
|
SceneObjectPart part = GetChildPart(localID);
|
||||||
foreach (SceneObjectPart parts in Children.Values)
|
foreach (SceneObjectPart parts in Children.Values)
|
||||||
{
|
{
|
||||||
parts.StoreUndoState();
|
parts.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
|
||||||
}
|
}
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
|
@ -3496,7 +3496,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.UpdateRotation(rot);
|
part.UpdateRotation(rot);
|
||||||
part.OffsetPosition = pos;
|
part.OffsetPosition = pos;
|
||||||
part.IgnoreUndoUpdate = false;
|
part.IgnoreUndoUpdate = false;
|
||||||
part.StoreUndoState();
|
part.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3510,7 +3510,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Quaternion axRot = rot;
|
Quaternion axRot = rot;
|
||||||
Quaternion oldParentRot = m_rootPart.RotationOffset;
|
Quaternion oldParentRot = m_rootPart.RotationOffset;
|
||||||
|
|
||||||
m_rootPart.StoreUndoState();
|
m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
|
||||||
m_rootPart.UpdateRotation(rot);
|
m_rootPart.UpdateRotation(rot);
|
||||||
if (m_rootPart.PhysActor != null)
|
if (m_rootPart.PhysActor != null)
|
||||||
{
|
{
|
||||||
|
@ -3542,7 +3542,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (childpart != m_rootPart)
|
if (childpart != m_rootPart)
|
||||||
{
|
{
|
||||||
childpart.IgnoreUndoUpdate = false;
|
childpart.IgnoreUndoUpdate = false;
|
||||||
childpart.StoreUndoState();
|
childpart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -697,7 +697,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_offsetPosition; }
|
get { return m_offsetPosition; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
StoreUndoState();
|
StoreUndoState(UndoType.STATE_PRIM_POSITION);
|
||||||
m_offsetPosition = value;
|
m_offsetPosition = value;
|
||||||
|
|
||||||
if (ParentGroup != null && !ParentGroup.IsDeleted)
|
if (ParentGroup != null && !ParentGroup.IsDeleted)
|
||||||
|
@ -759,7 +759,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
StoreUndoState();
|
StoreUndoState(UndoType.STATE_PRIM_ROTATION);
|
||||||
m_rotationOffset = value;
|
m_rotationOffset = value;
|
||||||
|
|
||||||
PhysicsActor actor = PhysActor;
|
PhysicsActor actor = PhysActor;
|
||||||
|
@ -958,7 +958,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_shape.Scale; }
|
get { return m_shape.Scale; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
StoreUndoState();
|
StoreUndoState(UndoType.STATE_PRIM_SCALE);
|
||||||
if (m_shape != null)
|
if (m_shape != null)
|
||||||
{
|
{
|
||||||
m_shape.Scale = value;
|
m_shape.Scale = value;
|
||||||
|
@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_redo.Clear();
|
m_redo.Clear();
|
||||||
}
|
}
|
||||||
StoreUndoState();
|
StoreUndoState(UndoType.STATE_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte ConvertScriptUintToByte(uint indata)
|
public byte ConvertScriptUintToByte(uint indata)
|
||||||
|
@ -2721,7 +2721,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="scale"></param>
|
/// <param name="scale"></param>
|
||||||
public void Resize(Vector3 scale)
|
public void Resize(Vector3 scale)
|
||||||
{
|
{
|
||||||
StoreUndoState();
|
StoreUndoState(UndoType.STATE_PRIM_SCALE);
|
||||||
m_shape.Scale = scale;
|
m_shape.Scale = scale;
|
||||||
|
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
|
@ -3504,13 +3504,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_parentGroup.ScheduleGroupForTerseUpdate();
|
m_parentGroup.ScheduleGroupForTerseUpdate();
|
||||||
//m_parentGroup.ScheduleGroupForFullUpdate();
|
//m_parentGroup.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
public void StoreUndoState()
|
public void StoreUndoState(UndoType type)
|
||||||
{
|
{
|
||||||
StoreUndoState(false);
|
|
||||||
}
|
|
||||||
public void StoreUndoState(bool group)
|
if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
|
||||||
{
|
|
||||||
if (!Undoing)
|
|
||||||
{
|
{
|
||||||
if (!IgnoreUndoUpdate)
|
if (!IgnoreUndoUpdate)
|
||||||
{
|
{
|
||||||
|
@ -3521,17 +3519,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_undo.Count > 0)
|
if (m_undo.Count > 0)
|
||||||
{
|
{
|
||||||
UndoState last = m_undo.Peek();
|
UndoState last = m_undo.Peek();
|
||||||
if (last != null)
|
|
||||||
{
|
|
||||||
if (last.Compare(this))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
||||||
{
|
{
|
||||||
UndoState nUndo = new UndoState(this);
|
UndoState lastUndo = m_undo.Peek();
|
||||||
nUndo.GroupChange = group;
|
|
||||||
|
UndoState nUndo = new UndoState(this, type);
|
||||||
|
|
||||||
|
if (lastUndo != null)
|
||||||
|
{
|
||||||
|
TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
|
||||||
|
if (ts.TotalMilliseconds < 500)
|
||||||
|
{
|
||||||
|
//Delete the last entry since it was less than 500 milliseconds ago
|
||||||
|
nUndo.Merge(lastUndo);
|
||||||
|
m_undo.Pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
m_undo.Push(nUndo);
|
m_undo.Push(nUndo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4008,20 +4014,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_undo.Count > 0)
|
if (m_undo.Count > 0)
|
||||||
{
|
{
|
||||||
UndoState nUndo = null;
|
UndoState nUndo = null;
|
||||||
|
UndoState goback = m_undo.Pop();
|
||||||
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
||||||
{
|
{
|
||||||
nUndo = new UndoState(this);
|
nUndo = new UndoState(this, goback.Type);
|
||||||
}
|
|
||||||
UndoState goback = m_undo.Pop();
|
|
||||||
m_log.Debug("Got goback");
|
|
||||||
if (goback == null)
|
|
||||||
{
|
|
||||||
m_log.Debug("it's null");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Debug(goback.GroupPosition.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (goback != null)
|
if (goback != null)
|
||||||
{
|
{
|
||||||
goback.PlaybackState(this);
|
goback.PlaybackState(this);
|
||||||
|
@ -4036,13 +4035,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
lock (m_redo)
|
lock (m_redo)
|
||||||
{
|
{
|
||||||
|
UndoState gofwd = m_redo.Pop();
|
||||||
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
||||||
{
|
{
|
||||||
UndoState nUndo = new UndoState(this);
|
UndoState nUndo = new UndoState(this, gofwd.Type);
|
||||||
|
|
||||||
m_undo.Push(nUndo);
|
m_undo.Push(nUndo);
|
||||||
}
|
}
|
||||||
UndoState gofwd = m_redo.Pop();
|
|
||||||
if (gofwd != null)
|
if (gofwd != null)
|
||||||
gofwd.PlayfwdState(this);
|
gofwd.PlayfwdState(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
sceneObject.AddPart(part);
|
sceneObject.AddPart(part);
|
||||||
part.LinkNum = linkNum;
|
part.LinkNum = linkNum;
|
||||||
part.TrimPermissions();
|
part.TrimPermissions();
|
||||||
part.StoreUndoState();
|
part.StoreUndoState(UndoType.STATE_ALL);
|
||||||
reader.Close();
|
reader.Close();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
if (originalLinkNum != 0)
|
if (originalLinkNum != 0)
|
||||||
part.LinkNum = originalLinkNum;
|
part.LinkNum = originalLinkNum;
|
||||||
|
|
||||||
part.StoreUndoState();
|
part.StoreUndoState(UndoType.STATE_ALL);
|
||||||
reader.Close();
|
reader.Close();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,26 +27,43 @@
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
|
[Flags]
|
||||||
|
public enum UndoType
|
||||||
|
{
|
||||||
|
STATE_PRIM_POSITION = 1,
|
||||||
|
STATE_PRIM_ROTATION = 2,
|
||||||
|
STATE_PRIM_SCALE = 4,
|
||||||
|
STATE_PRIM_ALL = 7,
|
||||||
|
STATE_GROUP_POSITION = 8,
|
||||||
|
STATE_GROUP_ROTATION = 16,
|
||||||
|
STATE_GROUP_SCALE = 32,
|
||||||
|
STATE_GROUP_ALL = 56,
|
||||||
|
STATE_ALL = 63
|
||||||
|
}
|
||||||
|
|
||||||
public class UndoState
|
public class UndoState
|
||||||
{
|
{
|
||||||
public Vector3 Position = Vector3.Zero;
|
public Vector3 Position = Vector3.Zero;
|
||||||
public Vector3 Scale = Vector3.Zero;
|
public Vector3 Scale = Vector3.Zero;
|
||||||
public Quaternion Rotation = Quaternion.Identity;
|
public Quaternion Rotation = Quaternion.Identity;
|
||||||
public bool GroupChange = false;
|
|
||||||
public Vector3 GroupPosition = Vector3.Zero;
|
public Vector3 GroupPosition = Vector3.Zero;
|
||||||
public Quaternion GroupRotation = Quaternion.Identity;
|
public Quaternion GroupRotation = Quaternion.Identity;
|
||||||
public Vector3 GroupScale = Vector3.Zero;
|
public Vector3 GroupScale = Vector3.Zero;
|
||||||
|
public DateTime LastUpdated = DateTime.Now;
|
||||||
|
public UndoType Type;
|
||||||
|
|
||||||
public UndoState(SceneObjectPart part)
|
public UndoState(SceneObjectPart part, UndoType type)
|
||||||
{
|
{
|
||||||
|
Type = type;
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
if (part.ParentID == 0)
|
if (part.ParentID == 0)
|
||||||
{
|
{
|
||||||
GroupScale = part.Shape.Scale;
|
GroupScale = part.ParentGroup.RootPart.Shape.Scale;
|
||||||
|
|
||||||
//FUBAR WARNING: Do NOT get the group's absoluteposition here
|
//FUBAR WARNING: Do NOT get the group's absoluteposition here
|
||||||
//or you'll experience a loop and/or a stack issue
|
//or you'll experience a loop and/or a stack issue
|
||||||
|
@ -55,6 +72,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Position = part.ParentGroup.RootPart.AbsolutePosition;
|
Position = part.ParentGroup.RootPart.AbsolutePosition;
|
||||||
Rotation = part.RotationOffset;
|
Rotation = part.RotationOffset;
|
||||||
Scale = part.Shape.Scale;
|
Scale = part.Shape.Scale;
|
||||||
|
LastUpdated = DateTime.Now;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -67,10 +85,54 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Position = part.OffsetPosition;
|
Position = part.OffsetPosition;
|
||||||
Rotation = part.RotationOffset;
|
Rotation = part.RotationOffset;
|
||||||
Scale = part.Shape.Scale;
|
Scale = part.Shape.Scale;
|
||||||
|
LastUpdated = DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void Merge(UndoState last)
|
||||||
|
{
|
||||||
|
if ((Type & UndoType.STATE_GROUP_POSITION) == 0 || ((last.Type & UndoType.STATE_GROUP_POSITION) >= (Type & UndoType.STATE_GROUP_POSITION)))
|
||||||
|
{
|
||||||
|
GroupPosition = last.GroupPosition;
|
||||||
|
Position = last.Position;
|
||||||
|
}
|
||||||
|
if ((Type & UndoType.STATE_GROUP_SCALE) == 0 || ((last.Type & UndoType.STATE_GROUP_SCALE) >= (Type & UndoType.STATE_GROUP_SCALE)))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Setting groupscale to " + last.GroupScale.ToString());
|
||||||
|
GroupScale = last.GroupScale;
|
||||||
|
Scale = last.Scale;
|
||||||
|
}
|
||||||
|
if ((Type & UndoType.STATE_GROUP_ROTATION) == 0 || ((last.Type & UndoType.STATE_GROUP_ROTATION) >= (Type & UndoType.STATE_GROUP_ROTATION)))
|
||||||
|
{
|
||||||
|
GroupRotation = last.GroupRotation;
|
||||||
|
Rotation = last.Rotation;
|
||||||
|
}
|
||||||
|
if ((Type & UndoType.STATE_PRIM_POSITION) == 0 || ((last.Type & UndoType.STATE_PRIM_POSITION) >= (Type & UndoType.STATE_PRIM_POSITION)))
|
||||||
|
{
|
||||||
|
Position = last.Position;
|
||||||
|
}
|
||||||
|
if ((Type & UndoType.STATE_PRIM_SCALE) == 0 || ((last.Type & UndoType.STATE_PRIM_SCALE) >= (Type & UndoType.STATE_PRIM_SCALE)))
|
||||||
|
{
|
||||||
|
Scale = last.Scale;
|
||||||
|
}
|
||||||
|
if ((Type & UndoType.STATE_PRIM_ROTATION) == 0 || ((last.Type & UndoType.STATE_PRIM_ROTATION) >= (Type & UndoType.STATE_PRIM_ROTATION)))
|
||||||
|
{
|
||||||
|
Rotation = last.Rotation;
|
||||||
|
}
|
||||||
|
Type = Type | last.Type;
|
||||||
|
}
|
||||||
|
public bool Compare(UndoState undo)
|
||||||
|
{
|
||||||
|
if (undo == null || Position == null) return false;
|
||||||
|
if (undo.Position == Position && undo.Rotation == Rotation && undo.Scale == Scale && undo.GroupPosition == GroupPosition && undo.GroupScale == GroupScale && undo.GroupRotation == GroupRotation)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
public bool Compare(SceneObjectPart part)
|
public bool Compare(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
if (part != null)
|
if (part != null)
|
||||||
|
@ -96,6 +158,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void PlaybackState(SceneObjectPart part)
|
public void PlaybackState(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
|
bool GroupChange = false;
|
||||||
|
if ((Type & UndoType.STATE_GROUP_POSITION) != 0
|
||||||
|
|| (Type & UndoType.STATE_GROUP_ROTATION) != 0
|
||||||
|
|| (Type & UndoType.STATE_GROUP_SCALE) != 0)
|
||||||
|
{
|
||||||
|
GroupChange = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
part.Undoing = true;
|
part.Undoing = true;
|
||||||
|
@ -113,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (GroupChange)
|
if (GroupChange)
|
||||||
{
|
{
|
||||||
|
part.ParentGroup.RootPart.Undoing = true;
|
||||||
if (Position != Vector3.Zero)
|
if (Position != Vector3.Zero)
|
||||||
{
|
{
|
||||||
//Calculate the scale...
|
//Calculate the scale...
|
||||||
|
@ -125,6 +196,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.ParentGroup.Rotation = GroupRotation;
|
part.ParentGroup.Rotation = GroupRotation;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
part.ParentGroup.RootPart.Undoing = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue