Add MaxPrimsUndo config setting to [Startup] section of OpenSim.ini.

This controls how many undo steps the simulator will store for each prim.
Default is now 20 rather than 5 as it briefly was.
The default number could be increased through this is a memory tradeoff which will scale with the number of prims in the sim and level of activity.
0.7.4-extended
Justin Clark-Casey (justincc) 2012-09-27 00:12:34 +01:00
parent d5c999553e
commit ac03b1b82f
7 changed files with 22 additions and 21 deletions

View File

@ -715,6 +715,8 @@ namespace OpenSim.Region.Framework.Scenes
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20);
PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
@ -888,9 +890,6 @@ namespace OpenSim.Region.Framework.Scenes
WestBorders.Add(westBorder);
BordersLocked = false;
// TODO: At some point this should be made configurable.
MaxUndoCount = 5;
m_eventManager = new EventManager();
m_permissions = new ScenePermissions(this);

View File

@ -1119,14 +1119,6 @@ namespace OpenSim.Region.Framework.Scenes
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
// parts of set AbsolutePosition were already commented out. By changing HasGroupChanged to false
// this method was preventing proper reload of scene objects.

View File

@ -3189,13 +3189,13 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
// Name, LocalId, forGroup, m_undo.Count);
if (ParentGroup.GetSceneMaxUndo() > 0)
if (ParentGroup.Scene.MaxUndoCount > 0)
{
UndoState nUndo = new UndoState(this, forGroup);
m_undo.Add(nUndo);
if (m_undo.Count > ParentGroup.GetSceneMaxUndo())
if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
m_undo.RemoveAt(0);
if (m_redo.Count > 0)
@ -3235,7 +3235,7 @@ namespace OpenSim.Region.Framework.Scenes
UndoState nUndo = null;
if (ParentGroup.GetSceneMaxUndo() > 0)
if (ParentGroup.Scene.MaxUndoCount > 0)
{
nUndo = new UndoState(this, goback.ForGroup);
}
@ -3246,7 +3246,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_redo.Add(nUndo);
if (m_redo.Count > ParentGroup.GetSceneMaxUndo())
if (m_redo.Count > ParentGroup.Scene.MaxUndoCount)
m_redo.RemoveAt(0);
}
}
@ -3270,13 +3270,13 @@ namespace OpenSim.Region.Framework.Scenes
UndoState gofwd = m_redo[m_redo.Count - 1];
m_redo.RemoveAt(m_redo.Count - 1);
if (ParentGroup.GetSceneMaxUndo() > 0)
if (ParentGroup.Scene.MaxUndoCount > 0)
{
UndoState nUndo = new UndoState(this, gofwd.ForGroup);
m_undo.Add(nUndo);
if (m_undo.Count > ParentGroup.GetSceneMaxUndo())
if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
m_undo.RemoveAt(0);
}

View File

@ -62,8 +62,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2));
Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3));
Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4));
Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1));
}
/// <summary>

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
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,
@ -113,6 +114,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
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);
@ -133,6 +135,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Vector3 newSize = new Vector3(2, 3, 4);
Scene scene = new SceneHelpers().SetupScene();
scene.MaxUndoCount = 20;
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
Vector3 originalSize = g1.GroupScale;
@ -160,6 +163,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Vector3 newSize = new Vector3(2, 3, 4);
Scene scene = new SceneHelpers().SetupScene();
scene.MaxUndoCount = 20;
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
Vector3 originalSize = g1.GroupScale;

View File

@ -87,6 +87,10 @@
;; from the selected region_info_source.
; 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
;# {NonPhysicalPrimMax} {} {Maximum size of nonphysical prims?} {} 256
;; Maximum size for non-physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!).
; NonphysicalPrimMax = 256

View File

@ -85,8 +85,12 @@
;; from the selected region_info_source.
allow_regionless = false
; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!).
NonphysicalPrimMax = 256
; 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!).
NonPhysicalPrimMax = 256
; Maximum size of physical prims. Affects resizing of existing prims. This can be overriden in the region config file.
PhysicalPrimMax = 10