From f5ddf37112d4881243e3350d5df898c6b2bb02ae Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 05:23:21 +0100 Subject: Replace ifs in SOG.GroupResize() with Math.Min() Also fiddle a bit with undo. This is not currently working properly, though to be fair it also didn't appear to work in 0.7.1.1 either (at least for resize). Will get some more attention soon. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 1 + OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 20 +++++++------------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 00d25c2..bdb7f95 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -569,6 +569,7 @@ namespace OpenSim.Region.Framework.Scenes if (primId != UUID.Zero) { SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); + if (part != null) part.Redo(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7662874..ce5db5f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2623,21 +2623,15 @@ namespace OpenSim.Region.Framework.Scenes RootPart.IgnoreUndoUpdate = true; - if (scale.X > m_scene.m_maxNonphys) - scale.X = m_scene.m_maxNonphys; - if (scale.Y > m_scene.m_maxNonphys) - scale.Y = m_scene.m_maxNonphys; - if (scale.Z > m_scene.m_maxNonphys) - scale.Z = m_scene.m_maxNonphys; + scale.X = Math.Min(scale.X, Scene.m_maxNonphys); + scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); + scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) { - if (scale.X > m_scene.m_maxPhys) - scale.X = m_scene.m_maxPhys; - if (scale.Y > m_scene.m_maxPhys) - scale.Y = m_scene.m_maxPhys; - if (scale.Z > m_scene.m_maxPhys) - scale.Z = m_scene.m_maxPhys; + scale.X = Math.Min(scale.X, Scene.m_maxPhys); + scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); + scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); } float x = (scale.X / RootPart.Scale.X); @@ -2715,7 +2709,6 @@ namespace OpenSim.Region.Framework.Scenes } obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); } } } @@ -2753,6 +2746,7 @@ namespace OpenSim.Region.Framework.Scenes } RootPart.IgnoreUndoUpdate = false; + RootPart.StoreUndoState(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f5b8daf..6b9607c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3687,6 +3687,8 @@ namespace OpenSim.Region.Framework.Scenes { if (m_parentGroup != null) { +// m_log.DebugFormat("[SCENE OBJECT PART]: Storing undo state for {0} {1}", Name, LocalId); + lock (m_undo) { if (m_undo.Count > 0) @@ -3705,11 +3707,18 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); } - } } } +// else +// { +// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); +// } } +// else +// { +// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); +// } } public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) @@ -4179,11 +4188,14 @@ namespace OpenSim.Region.Framework.Scenes if (m_undo.Count > 0) { UndoState nUndo = null; + if (m_parentGroup.GetSceneMaxUndo() > 0) { nUndo = new UndoState(this); } + UndoState goback = m_undo.Pop(); + if (goback != null) { goback.PlaybackState(this); @@ -4196,6 +4208,8 @@ namespace OpenSim.Region.Framework.Scenes public void Redo() { +// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId); + lock (m_redo) { if (m_parentGroup.GetSceneMaxUndo() > 0) @@ -4204,7 +4218,9 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); } + UndoState gofwd = m_redo.Pop(); + if (gofwd != null) gofwd.PlayfwdState(this); } -- cgit v1.1