aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs167
1 files changed, 88 insertions, 79 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 411dcc7..3f10b34 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -266,8 +266,8 @@ namespace OpenSim.Region.Framework.Scenes
266 private string m_sitAnimation = "SIT"; 266 private string m_sitAnimation = "SIT";
267 private string m_text = String.Empty; 267 private string m_text = String.Empty;
268 private string m_touchName = String.Empty; 268 private string m_touchName = String.Empty;
269 private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5); 269 private readonly List<UndoState> m_undo = new List<UndoState>(5);
270 private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5); 270 private readonly List<UndoState> m_redo = new List<UndoState>(5);
271 271
272 private bool m_passTouches = false; 272 private bool m_passTouches = false;
273 private bool m_passCollisions = false; 273 private bool m_passCollisions = false;
@@ -2368,16 +2368,20 @@ namespace OpenSim.Region.Framework.Scenes
2368 /// <param name="scale"></param> 2368 /// <param name="scale"></param>
2369 public void Resize(Vector3 scale) 2369 public void Resize(Vector3 scale)
2370 { 2370 {
2371 scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
2372 scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
2373 scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
2374
2375 PhysicsActor pa = PhysActor; 2371 PhysicsActor pa = PhysActor;
2376 if (pa != null && pa.IsPhysical) 2372
2373 if (ParentGroup.Scene != null)
2377 { 2374 {
2378 scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); 2375 scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
2379 scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); 2376 scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
2380 scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); 2377 scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
2378
2379 if (pa != null && pa.IsPhysical)
2380 {
2381 scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X));
2382 scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y));
2383 scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z));
2384 }
2381 } 2385 }
2382 2386
2383// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); 2387// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
@@ -3166,61 +3170,62 @@ namespace OpenSim.Region.Framework.Scenes
3166 3170
3167 public void StoreUndoState(bool forGroup) 3171 public void StoreUndoState(bool forGroup)
3168 { 3172 {
3169 if (!Undoing) 3173 if (ParentGroup == null || ParentGroup.Scene == null)
3174 return;
3175
3176 if (Undoing)
3170 { 3177 {
3171 if (!IgnoreUndoUpdate) 3178// m_log.DebugFormat(
3179// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
3180 return;
3181 }
3182
3183 if (IgnoreUndoUpdate)
3184 {
3185// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId);
3186 return;
3187 }
3188
3189 lock (m_undo)
3190 {
3191 if (m_undo.Count > 0)
3172 { 3192 {
3173 if (ParentGroup != null) 3193 UndoState last = m_undo[m_undo.Count - 1];
3194 if (last != null)
3174 { 3195 {
3175 lock (m_undo) 3196 // TODO: May need to fix for group comparison
3197 if (last.Compare(this))
3176 { 3198 {
3177 if (m_undo.Count > 0) 3199// m_log.DebugFormat(
3178 { 3200// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
3179 UndoState last = m_undo.Peek(); 3201// Name, LocalId, m_undo.Count);
3180 if (last != null) 3202
3181 { 3203 return;
3182 // TODO: May need to fix for group comparison
3183 if (last.Compare(this))
3184 {
3185 // m_log.DebugFormat(
3186 // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
3187 // Name, LocalId, m_undo.Count);
3188
3189 return;
3190 }
3191 }
3192 }
3193
3194 // m_log.DebugFormat(
3195 // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
3196 // Name, LocalId, forGroup, m_undo.Count);
3197
3198 if (ParentGroup.GetSceneMaxUndo() > 0)
3199 {
3200 UndoState nUndo = new UndoState(this, forGroup);
3201
3202 m_undo.Push(nUndo);
3203
3204 if (m_redo.Count > 0)
3205 m_redo.Clear();
3206
3207 // m_log.DebugFormat(
3208 // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
3209 // Name, LocalId, forGroup, m_undo.Count);
3210 }
3211 } 3204 }
3212 } 3205 }
3213 } 3206 }
3214// else 3207
3215// { 3208// m_log.DebugFormat(
3216// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); 3209// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
3217// } 3210// Name, LocalId, forGroup, m_undo.Count);
3211
3212 if (ParentGroup.Scene.MaxUndoCount > 0)
3213 {
3214 UndoState nUndo = new UndoState(this, forGroup);
3215
3216 m_undo.Add(nUndo);
3217
3218 if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
3219 m_undo.RemoveAt(0);
3220
3221 if (m_redo.Count > 0)
3222 m_redo.Clear();
3223
3224// m_log.DebugFormat(
3225// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
3226// Name, LocalId, forGroup, m_undo.Count);
3227 }
3218 } 3228 }
3219// else
3220// {
3221// m_log.DebugFormat(
3222// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
3223// }
3224 } 3229 }
3225 3230
3226 /// <summary> 3231 /// <summary>
@@ -3245,21 +3250,24 @@ namespace OpenSim.Region.Framework.Scenes
3245 3250
3246 if (m_undo.Count > 0) 3251 if (m_undo.Count > 0)
3247 { 3252 {
3248 UndoState goback = m_undo.Pop(); 3253 UndoState goback = m_undo[m_undo.Count - 1];
3254 m_undo.RemoveAt(m_undo.Count - 1);
3249 3255
3250 if (goback != null) 3256 UndoState nUndo = null;
3257
3258 if (ParentGroup.Scene.MaxUndoCount > 0)
3251 { 3259 {
3252 UndoState nUndo = null; 3260 nUndo = new UndoState(this, goback.ForGroup);
3253 3261 }
3254 if (ParentGroup.GetSceneMaxUndo() > 0) 3262
3255 { 3263 goback.PlaybackState(this);
3256 nUndo = new UndoState(this, goback.ForGroup);
3257 }
3258 3264
3259 goback.PlaybackState(this); 3265 if (nUndo != null)
3266 {
3267 m_redo.Add(nUndo);
3260 3268
3261 if (nUndo != null) 3269 if (m_redo.Count > ParentGroup.Scene.MaxUndoCount)
3262 m_redo.Push(nUndo); 3270 m_redo.RemoveAt(0);
3263 } 3271 }
3264 } 3272 }
3265 3273
@@ -3279,20 +3287,21 @@ namespace OpenSim.Region.Framework.Scenes
3279 3287
3280 if (m_redo.Count > 0) 3288 if (m_redo.Count > 0)
3281 { 3289 {
3282 UndoState gofwd = m_redo.Pop(); 3290 UndoState gofwd = m_redo[m_redo.Count - 1];
3283 3291 m_redo.RemoveAt(m_redo.Count - 1);
3284 if (gofwd != null) 3292
3293 if (ParentGroup.Scene.MaxUndoCount > 0)
3285 { 3294 {
3286 if (ParentGroup.GetSceneMaxUndo() > 0) 3295 UndoState nUndo = new UndoState(this, gofwd.ForGroup);
3287 { 3296
3288 UndoState nUndo = new UndoState(this, gofwd.ForGroup); 3297 m_undo.Add(nUndo);
3289 3298
3290 m_undo.Push(nUndo); 3299 if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
3291 } 3300 m_undo.RemoveAt(0);
3292
3293 gofwd.PlayfwdState(this);
3294 } 3301 }
3295 3302
3303 gofwd.PlayfwdState(this);
3304
3296// m_log.DebugFormat( 3305// m_log.DebugFormat(
3297// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", 3306// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
3298// Name, LocalId, m_redo.Count); 3307// Name, LocalId, m_redo.Count);