Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
6511c3b5c6
|
@ -209,3 +209,4 @@ In addition, we would like to thank:
|
||||||
* The NANT Developers
|
* The NANT Developers
|
||||||
* Microsoft (.NET, MSSQL-Adapters)
|
* Microsoft (.NET, MSSQL-Adapters)
|
||||||
*x
|
*x
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// TODO: need to figure out how allow client agents but deny
|
// TODO: need to figure out how allow client agents but deny
|
||||||
// root agents when ACL denies access to root agent
|
// root agents when ACL denies access to root agent
|
||||||
public bool m_strictAccessControl = true;
|
public bool m_strictAccessControl = true;
|
||||||
public int MaxUndoCount = 5;
|
|
||||||
|
public int MaxUndoCount { get; set; }
|
||||||
|
|
||||||
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
|
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
|
||||||
public bool LoginLock = false;
|
public bool LoginLock = false;
|
||||||
|
@ -741,6 +742,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//Animation states
|
//Animation states
|
||||||
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
||||||
|
|
||||||
|
MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20);
|
||||||
|
|
||||||
PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
|
PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
|
||||||
CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
|
CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
|
||||||
|
|
||||||
|
|
|
@ -1119,14 +1119,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
parts[i].UUID = UUID.Random();
|
parts[i].UUID = UUID.Random();
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper provided for parts.
|
|
||||||
public int GetSceneMaxUndo()
|
|
||||||
{
|
|
||||||
if (m_scene != null)
|
|
||||||
return m_scene.MaxUndoCount;
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
// justincc: I don't believe this hack is needed any longer, especially since the physics
|
// justincc: I don't believe this hack is needed any longer, especially since the physics
|
||||||
// parts of set AbsolutePosition were already commented out. By changing HasGroupChanged to false
|
// parts of set AbsolutePosition were already commented out. By changing HasGroupChanged to false
|
||||||
// this method was preventing proper reload of scene objects.
|
// this method was preventing proper reload of scene objects.
|
||||||
|
@ -2703,29 +2695,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale);
|
// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale);
|
||||||
|
|
||||||
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
|
||||||
RootPart.StoreUndoState(true);
|
RootPart.StoreUndoState(true);
|
||||||
|
|
||||||
|
if (Scene != null)
|
||||||
|
{
|
||||||
scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
|
scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
|
||||||
scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
|
scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
|
||||||
scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z));
|
scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z));
|
||||||
|
|
||||||
PhysicsActor pa = m_rootPart.PhysActor;
|
|
||||||
|
|
||||||
if (pa != null && pa.IsPhysical)
|
if (pa != null && pa.IsPhysical)
|
||||||
{
|
{
|
||||||
scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X));
|
scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X));
|
||||||
scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y));
|
scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y));
|
||||||
scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z));
|
scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float x = (scale.X / RootPart.Scale.X);
|
float x = (scale.X / RootPart.Scale.X);
|
||||||
float y = (scale.Y / RootPart.Scale.Y);
|
float y = (scale.Y / RootPart.Scale.Y);
|
||||||
float z = (scale.Z / RootPart.Scale.Z);
|
float z = (scale.Z / RootPart.Scale.Z);
|
||||||
|
|
||||||
SceneObjectPart[] parts;
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
if (x > 1.0f || y > 1.0f || z > 1.0f)
|
|
||||||
|
if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f))
|
||||||
{
|
{
|
||||||
parts = m_parts.GetArray();
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart obPart = parts[i];
|
SceneObjectPart obPart = parts[i];
|
||||||
|
@ -2739,7 +2734,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (pa != null && pa.IsPhysical)
|
if (pa != null && pa.IsPhysical)
|
||||||
{
|
{
|
||||||
if (oldSize.X * x > m_scene.m_maxPhys)
|
if (oldSize.X * x > Scene.m_maxPhys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxPhys / oldSize.X;
|
f = m_scene.m_maxPhys / oldSize.X;
|
||||||
a = f / x;
|
a = f / x;
|
||||||
|
@ -2747,7 +2742,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
else if (oldSize.X * x < m_scene.m_minPhys)
|
else if (oldSize.X * x < Scene.m_minPhys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_minPhys / oldSize.X;
|
f = m_scene.m_minPhys / oldSize.X;
|
||||||
a = f / x;
|
a = f / x;
|
||||||
|
@ -2756,7 +2751,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSize.Y * y > m_scene.m_maxPhys)
|
if (oldSize.Y * y > Scene.m_maxPhys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxPhys / oldSize.Y;
|
f = m_scene.m_maxPhys / oldSize.Y;
|
||||||
a = f / y;
|
a = f / y;
|
||||||
|
@ -2764,7 +2759,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
else if (oldSize.Y * y < m_scene.m_minPhys)
|
else if (oldSize.Y * y < Scene.m_minPhys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_minPhys / oldSize.Y;
|
f = m_scene.m_minPhys / oldSize.Y;
|
||||||
a = f / y;
|
a = f / y;
|
||||||
|
@ -2773,7 +2768,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSize.Z * z > m_scene.m_maxPhys)
|
if (oldSize.Z * z > Scene.m_maxPhys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxPhys / oldSize.Z;
|
f = m_scene.m_maxPhys / oldSize.Z;
|
||||||
a = f / z;
|
a = f / z;
|
||||||
|
@ -2781,7 +2776,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
else if (oldSize.Z * z < m_scene.m_minPhys)
|
else if (oldSize.Z * z < Scene.m_minPhys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_minPhys / oldSize.Z;
|
f = m_scene.m_minPhys / oldSize.Z;
|
||||||
a = f / z;
|
a = f / z;
|
||||||
|
@ -2792,7 +2787,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (oldSize.X * x > m_scene.m_maxNonphys)
|
if (oldSize.X * x > Scene.m_maxNonphys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxNonphys / oldSize.X;
|
f = m_scene.m_maxNonphys / oldSize.X;
|
||||||
a = f / x;
|
a = f / x;
|
||||||
|
@ -2800,7 +2795,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
else if (oldSize.X * x < m_scene.m_minNonphys)
|
else if (oldSize.X * x < Scene.m_minNonphys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_minNonphys / oldSize.X;
|
f = m_scene.m_minNonphys / oldSize.X;
|
||||||
a = f / x;
|
a = f / x;
|
||||||
|
@ -2809,7 +2804,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSize.Y * y > m_scene.m_maxNonphys)
|
if (oldSize.Y * y > Scene.m_maxNonphys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxNonphys / oldSize.Y;
|
f = m_scene.m_maxNonphys / oldSize.Y;
|
||||||
a = f / y;
|
a = f / y;
|
||||||
|
@ -2817,7 +2812,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
else if (oldSize.Y * y < m_scene.m_minNonphys)
|
else if (oldSize.Y * y < Scene.m_minNonphys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_minNonphys / oldSize.Y;
|
f = m_scene.m_minNonphys / oldSize.Y;
|
||||||
a = f / y;
|
a = f / y;
|
||||||
|
@ -2826,7 +2821,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSize.Z * z > m_scene.m_maxNonphys)
|
if (oldSize.Z * z > Scene.m_maxNonphys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxNonphys / oldSize.Z;
|
f = m_scene.m_maxNonphys / oldSize.Z;
|
||||||
a = f / z;
|
a = f / z;
|
||||||
|
@ -2834,7 +2829,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
else if (oldSize.Z * z < m_scene.m_minNonphys)
|
else if (oldSize.Z * z < Scene.m_minNonphys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_minNonphys / oldSize.Z;
|
f = m_scene.m_minNonphys / oldSize.Z;
|
||||||
a = f / z;
|
a = f / z;
|
||||||
|
@ -2858,7 +2853,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
RootPart.Resize(prevScale);
|
RootPart.Resize(prevScale);
|
||||||
// RootPart.IgnoreUndoUpdate = false;
|
// RootPart.IgnoreUndoUpdate = false;
|
||||||
|
|
||||||
parts = m_parts.GetArray();
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart obPart = parts[i];
|
SceneObjectPart obPart = parts[i];
|
||||||
|
|
|
@ -266,8 +266,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private string m_sitAnimation = "SIT";
|
private string m_sitAnimation = "SIT";
|
||||||
private string m_text = String.Empty;
|
private string m_text = String.Empty;
|
||||||
private string m_touchName = String.Empty;
|
private string m_touchName = String.Empty;
|
||||||
private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5);
|
private readonly List<UndoState> m_undo = new List<UndoState>(5);
|
||||||
private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5);
|
private readonly List<UndoState> m_redo = new List<UndoState>(5);
|
||||||
|
|
||||||
private bool m_passTouches = false;
|
private bool m_passTouches = false;
|
||||||
private bool m_passCollisions = false;
|
private bool m_passCollisions = false;
|
||||||
|
@ -2367,18 +2367,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="scale"></param>
|
/// <param name="scale"></param>
|
||||||
public void Resize(Vector3 scale)
|
public void Resize(Vector3 scale)
|
||||||
|
{
|
||||||
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (ParentGroup.Scene != null)
|
||||||
{
|
{
|
||||||
scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
|
scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
|
||||||
scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
|
scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
|
||||||
scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
|
scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
|
||||||
|
|
||||||
PhysicsActor pa = PhysActor;
|
|
||||||
if (pa != null && pa.IsPhysical)
|
if (pa != null && pa.IsPhysical)
|
||||||
{
|
{
|
||||||
scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X));
|
scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X));
|
||||||
scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y));
|
scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y));
|
||||||
scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z));
|
scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
|
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
|
||||||
|
|
||||||
|
@ -3166,61 +3170,62 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void StoreUndoState(bool forGroup)
|
public void StoreUndoState(bool forGroup)
|
||||||
{
|
{
|
||||||
if (!Undoing)
|
if (ParentGroup == null || ParentGroup.Scene == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Undoing)
|
||||||
{
|
{
|
||||||
if (!IgnoreUndoUpdate)
|
// m_log.DebugFormat(
|
||||||
{
|
// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
|
||||||
if (ParentGroup != null)
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IgnoreUndoUpdate)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lock (m_undo)
|
lock (m_undo)
|
||||||
{
|
{
|
||||||
if (m_undo.Count > 0)
|
if (m_undo.Count > 0)
|
||||||
{
|
{
|
||||||
UndoState last = m_undo.Peek();
|
UndoState last = m_undo[m_undo.Count - 1];
|
||||||
if (last != null)
|
if (last != null)
|
||||||
{
|
{
|
||||||
// TODO: May need to fix for group comparison
|
// TODO: May need to fix for group comparison
|
||||||
if (last.Compare(this))
|
if (last.Compare(this))
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
|
// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
|
||||||
// Name, LocalId, m_undo.Count);
|
// Name, LocalId, m_undo.Count);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
|
// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
|
||||||
// Name, LocalId, forGroup, m_undo.Count);
|
// Name, LocalId, forGroup, m_undo.Count);
|
||||||
|
|
||||||
if (ParentGroup.GetSceneMaxUndo() > 0)
|
if (ParentGroup.Scene.MaxUndoCount > 0)
|
||||||
{
|
{
|
||||||
UndoState nUndo = new UndoState(this, forGroup);
|
UndoState nUndo = new UndoState(this, forGroup);
|
||||||
|
|
||||||
m_undo.Push(nUndo);
|
m_undo.Add(nUndo);
|
||||||
|
|
||||||
|
if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
|
||||||
|
m_undo.RemoveAt(0);
|
||||||
|
|
||||||
if (m_redo.Count > 0)
|
if (m_redo.Count > 0)
|
||||||
m_redo.Clear();
|
m_redo.Clear();
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
|
|
||||||
// Name, LocalId, forGroup, m_undo.Count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
|
// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
|
||||||
// }
|
// Name, LocalId, forGroup, m_undo.Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3245,13 +3250,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (m_undo.Count > 0)
|
if (m_undo.Count > 0)
|
||||||
{
|
{
|
||||||
UndoState goback = m_undo.Pop();
|
UndoState goback = m_undo[m_undo.Count - 1];
|
||||||
|
m_undo.RemoveAt(m_undo.Count - 1);
|
||||||
|
|
||||||
if (goback != null)
|
|
||||||
{
|
|
||||||
UndoState nUndo = null;
|
UndoState nUndo = null;
|
||||||
|
|
||||||
if (ParentGroup.GetSceneMaxUndo() > 0)
|
if (ParentGroup.Scene.MaxUndoCount > 0)
|
||||||
{
|
{
|
||||||
nUndo = new UndoState(this, goback.ForGroup);
|
nUndo = new UndoState(this, goback.ForGroup);
|
||||||
}
|
}
|
||||||
|
@ -3259,7 +3263,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
goback.PlaybackState(this);
|
goback.PlaybackState(this);
|
||||||
|
|
||||||
if (nUndo != null)
|
if (nUndo != null)
|
||||||
m_redo.Push(nUndo);
|
{
|
||||||
|
m_redo.Add(nUndo);
|
||||||
|
|
||||||
|
if (m_redo.Count > ParentGroup.Scene.MaxUndoCount)
|
||||||
|
m_redo.RemoveAt(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3279,19 +3287,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (m_redo.Count > 0)
|
if (m_redo.Count > 0)
|
||||||
{
|
{
|
||||||
UndoState gofwd = m_redo.Pop();
|
UndoState gofwd = m_redo[m_redo.Count - 1];
|
||||||
|
m_redo.RemoveAt(m_redo.Count - 1);
|
||||||
|
|
||||||
if (gofwd != null)
|
if (ParentGroup.Scene.MaxUndoCount > 0)
|
||||||
{
|
|
||||||
if (ParentGroup.GetSceneMaxUndo() > 0)
|
|
||||||
{
|
{
|
||||||
UndoState nUndo = new UndoState(this, gofwd.ForGroup);
|
UndoState nUndo = new UndoState(this, gofwd.ForGroup);
|
||||||
|
|
||||||
m_undo.Push(nUndo);
|
m_undo.Add(nUndo);
|
||||||
|
|
||||||
|
if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
|
||||||
|
m_undo.RemoveAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gofwd.PlayfwdState(this);
|
gofwd.PlayfwdState(this);
|
||||||
}
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
|
// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
|
||||||
|
|
|
@ -62,8 +62,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2));
|
Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2));
|
||||||
Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3));
|
Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3));
|
||||||
Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4));
|
Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4));
|
||||||
|
|
||||||
Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,184 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Communications;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using OpenSim.Tests.Common.Mock;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tests for undo/redo
|
||||||
|
/// </summary>
|
||||||
|
public class SceneObjectUndoRedoTests : OpenSimTestCase
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestUndoRedoResizeSceneObject()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
|
Vector3 firstSize = new Vector3(2, 3, 4);
|
||||||
|
Vector3 secondSize = new Vector3(5, 6, 7);
|
||||||
|
|
||||||
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
|
scene.MaxUndoCount = 20;
|
||||||
|
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||||
|
|
||||||
|
// TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG,
|
||||||
|
// which is the way that AddSceneObject() sets up the object (i.e. it creates the SOP first). However,
|
||||||
|
// this is somewhat by chance. Really, we shouldn't be storing undo states at all if the object is not
|
||||||
|
// in a scene.
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||||
|
|
||||||
|
g1.GroupResize(firstSize);
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
|
||||||
|
|
||||||
|
g1.GroupResize(secondSize);
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
|
||||||
|
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(firstSize));
|
||||||
|
|
||||||
|
g1.RootPart.Redo();
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUndoLimit()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
Vector3 firstSize = new Vector3(2, 3, 4);
|
||||||
|
Vector3 secondSize = new Vector3(5, 6, 7);
|
||||||
|
Vector3 thirdSize = new Vector3(8, 9, 10);
|
||||||
|
Vector3 fourthSize = new Vector3(11, 12, 13);
|
||||||
|
|
||||||
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
|
scene.MaxUndoCount = 2;
|
||||||
|
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||||
|
|
||||||
|
g1.GroupResize(firstSize);
|
||||||
|
g1.GroupResize(secondSize);
|
||||||
|
g1.GroupResize(thirdSize);
|
||||||
|
g1.GroupResize(fourthSize);
|
||||||
|
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNoUndoOnObjectsNotInScene()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
Vector3 firstSize = new Vector3(2, 3, 4);
|
||||||
|
Vector3 secondSize = new Vector3(5, 6, 7);
|
||||||
|
Vector3 thirdSize = new Vector3(8, 9, 10);
|
||||||
|
Vector3 fourthSize = new Vector3(11, 12, 13);
|
||||||
|
|
||||||
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
|
scene.MaxUndoCount = 20;
|
||||||
|
SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
|
||||||
|
|
||||||
|
g1.GroupResize(firstSize);
|
||||||
|
g1.GroupResize(secondSize);
|
||||||
|
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||||
|
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUndoBeyondAvailable()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
Vector3 newSize = new Vector3(2, 3, 4);
|
||||||
|
|
||||||
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
|
scene.MaxUndoCount = 20;
|
||||||
|
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||||
|
Vector3 originalSize = g1.GroupScale;
|
||||||
|
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
|
||||||
|
|
||||||
|
g1.GroupResize(newSize);
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(newSize));
|
||||||
|
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRedoBeyondAvailable()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
Vector3 newSize = new Vector3(2, 3, 4);
|
||||||
|
|
||||||
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
|
scene.MaxUndoCount = 20;
|
||||||
|
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||||
|
Vector3 originalSize = g1.GroupScale;
|
||||||
|
|
||||||
|
g1.RootPart.Redo();
|
||||||
|
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
|
||||||
|
|
||||||
|
g1.GroupResize(newSize);
|
||||||
|
g1.RootPart.Undo();
|
||||||
|
g1.RootPart.Redo();
|
||||||
|
g1.RootPart.Redo();
|
||||||
|
|
||||||
|
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
|
||||||
|
Assert.That(g1.GroupScale, Is.EqualTo(newSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,7 +44,7 @@ using OpenSim.Tests.Common.Mock;
|
||||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class SceneObjectUserGroupTests
|
public class SceneObjectUserGroupTests : OpenSimTestCase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test share with group object functionality
|
/// Test share with group object functionality
|
||||||
|
@ -54,7 +54,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
public void TestShareWithGroup()
|
public void TestShareWithGroup()
|
||||||
{
|
{
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
|
||||||
|
|
||||||
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,10 @@
|
||||||
;; from the selected region_info_source.
|
;; from the selected region_info_source.
|
||||||
; allow_regionless = false
|
; allow_regionless = false
|
||||||
|
|
||||||
|
;# {MaxPrimUndos} {} {Maximum number of undos avialable for position, rotation and scale changes of each prim} {} 20
|
||||||
|
;; Increasing the number of undos available number will increase memory usage.
|
||||||
|
MaxPrimUndos = 20
|
||||||
|
|
||||||
;# {NonPhysicalPrimMin} {} {Minimum size of nonphysical prims?} {} 0.001
|
;# {NonPhysicalPrimMin} {} {Minimum size of nonphysical prims?} {} 0.001
|
||||||
;; Minimum size for non-physical prims. Affects resizing of existing
|
;; Minimum size for non-physical prims. Affects resizing of existing
|
||||||
;; prims. This can be overriden in the region config file (as
|
;; prims. This can be overriden in the region config file (as
|
||||||
|
|
|
@ -85,6 +85,10 @@
|
||||||
;; from the selected region_info_source.
|
;; from the selected region_info_source.
|
||||||
allow_regionless = false
|
allow_regionless = false
|
||||||
|
|
||||||
|
; Maximum number of position, rotation and scale changes for each prim that the simulator will store for later undos
|
||||||
|
; Increasing this number will increase memory usage.
|
||||||
|
MaxPrimUndos = 20
|
||||||
|
|
||||||
; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonPhysicalPrimMax!).
|
; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonPhysicalPrimMax!).
|
||||||
NonPhysicalPrimMax = 256
|
NonPhysicalPrimMax = 256
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue