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.
connector_plugin
Justin Clark-Casey (justincc) 2012-09-27 00:12:34 +01:00
parent b9934fc4db
commit 2bf42f30af
7 changed files with 20 additions and 19 deletions

View File

@ -742,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);
@ -932,9 +934,6 @@ namespace OpenSim.Region.Framework.Scenes
WestBorders.Add(westBorder); WestBorders.Add(westBorder);
BordersLocked = false; BordersLocked = false;
// TODO: At some point this should be made configurable.
MaxUndoCount = 5;
m_eventManager = new EventManager(); m_eventManager = new EventManager();
m_permissions = new ScenePermissions(this); m_permissions = new ScenePermissions(this);

View File

@ -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.

View File

@ -3209,13 +3209,13 @@ namespace OpenSim.Region.Framework.Scenes
// "[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.Add(nUndo); m_undo.Add(nUndo);
if (m_undo.Count > ParentGroup.GetSceneMaxUndo()) if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
m_undo.RemoveAt(0); m_undo.RemoveAt(0);
if (m_redo.Count > 0) if (m_redo.Count > 0)
@ -3255,7 +3255,7 @@ namespace OpenSim.Region.Framework.Scenes
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);
} }
@ -3266,7 +3266,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_redo.Add(nUndo); m_redo.Add(nUndo);
if (m_redo.Count > ParentGroup.GetSceneMaxUndo()) if (m_redo.Count > ParentGroup.Scene.MaxUndoCount)
m_redo.RemoveAt(0); m_redo.RemoveAt(0);
} }
} }
@ -3290,13 +3290,13 @@ namespace OpenSim.Region.Framework.Scenes
UndoState gofwd = m_redo[m_redo.Count - 1]; UndoState gofwd = m_redo[m_redo.Count - 1];
m_redo.RemoveAt(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); UndoState nUndo = new UndoState(this, gofwd.ForGroup);
m_undo.Add(nUndo); m_undo.Add(nUndo);
if (m_undo.Count > ParentGroup.GetSceneMaxUndo()) if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
m_undo.RemoveAt(0); 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.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>

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Vector3 secondSize = new Vector3(5, 6, 7); Vector3 secondSize = new Vector3(5, 6, 7);
Scene scene = new SceneHelpers().SetupScene(); Scene scene = new SceneHelpers().SetupScene();
scene.MaxUndoCount = 20;
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); 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, // 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); Vector3 fourthSize = new Vector3(11, 12, 13);
Scene scene = new SceneHelpers().SetupScene(); Scene scene = new SceneHelpers().SetupScene();
scene.MaxUndoCount = 20;
SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
g1.GroupResize(firstSize); g1.GroupResize(firstSize);
@ -133,6 +135,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Vector3 newSize = new Vector3(2, 3, 4); Vector3 newSize = new Vector3(2, 3, 4);
Scene scene = new SceneHelpers().SetupScene(); Scene scene = new SceneHelpers().SetupScene();
scene.MaxUndoCount = 20;
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
Vector3 originalSize = g1.GroupScale; Vector3 originalSize = g1.GroupScale;
@ -160,6 +163,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Vector3 newSize = new Vector3(2, 3, 4); Vector3 newSize = new Vector3(2, 3, 4);
Scene scene = new SceneHelpers().SetupScene(); Scene scene = new SceneHelpers().SetupScene();
scene.MaxUndoCount = 20;
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
Vector3 originalSize = g1.GroupScale; Vector3 originalSize = g1.GroupScale;

View File

@ -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

View File

@ -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