diff options
author | Tom Grimshaw | 2010-07-03 06:10:55 -0700 |
---|---|---|
committer | Tom Grimshaw | 2010-07-03 06:10:55 -0700 |
commit | fe2b044d38f3bd3aa669334d34567fd991a67b3e (patch) | |
tree | bb94a343716c2620e043ac070a8cb269564f3a9c /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Re-implement the Undo stack as a List; the old implementation was buggy (diff) | |
download | opensim-SC-fe2b044d38f3bd3aa669334d34567fd991a67b3e.zip opensim-SC-fe2b044d38f3bd3aa669334d34567fd991a67b3e.tar.gz opensim-SC-fe2b044d38f3bd3aa669334d34567fd991a67b3e.tar.bz2 opensim-SC-fe2b044d38f3bd3aa669334d34567fd991a67b3e.tar.xz |
Fix Undo! Made a lot of changes to Undo state saving; it now considers that groups of objects can be moved and not just individual prims..
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c48ce3b..da664da 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -349,7 +349,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
349 | public virtual Quaternion Rotation | 349 | public virtual Quaternion Rotation |
350 | { | 350 | { |
351 | get { return m_rotation; } | 351 | get { return m_rotation; } |
352 | set { m_rotation = value; } | 352 | set { |
353 | lockPartsForRead(true); | ||
354 | try | ||
355 | { | ||
356 | foreach(SceneObjectPart p in m_parts.Values) | ||
357 | { | ||
358 | p.StoreUndoState(true); | ||
359 | } | ||
360 | } | ||
361 | finally | ||
362 | { | ||
363 | lockPartsForRead(false); | ||
364 | } | ||
365 | m_rotation = value; | ||
366 | } | ||
353 | } | 367 | } |
354 | 368 | ||
355 | public Quaternion GroupRotation | 369 | public Quaternion GroupRotation |
@@ -421,6 +435,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
421 | get { return m_rootPart.GroupPosition; } | 435 | get { return m_rootPart.GroupPosition; } |
422 | set | 436 | set |
423 | { | 437 | { |
438 | |||
424 | Vector3 val = value; | 439 | Vector3 val = value; |
425 | 440 | ||
426 | if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) | 441 | if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) |
@@ -431,7 +446,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
431 | } | 446 | } |
432 | 447 | ||
433 | lockPartsForRead(true); | 448 | lockPartsForRead(true); |
434 | 449 | foreach (SceneObjectPart part in m_parts.Values) | |
450 | { | ||
451 | part.IgnoreUndoUpdate = true; | ||
452 | } | ||
435 | if (RootPart.GetStatusSandbox()) | 453 | if (RootPart.GetStatusSandbox()) |
436 | { | 454 | { |
437 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) | 455 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) |
@@ -443,12 +461,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
443 | return; | 461 | return; |
444 | } | 462 | } |
445 | } | 463 | } |
446 | |||
447 | foreach (SceneObjectPart part in m_parts.Values) | 464 | foreach (SceneObjectPart part in m_parts.Values) |
448 | { | 465 | { |
466 | part.IgnoreUndoUpdate = false; | ||
467 | part.StoreUndoState(true); | ||
449 | part.GroupPosition = val; | 468 | part.GroupPosition = val; |
450 | } | 469 | } |
451 | |||
452 | lockPartsForRead(false); | 470 | lockPartsForRead(false); |
453 | 471 | ||
454 | //if (m_rootPart.PhysActor != null) | 472 | //if (m_rootPart.PhysActor != null) |
@@ -724,7 +742,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
724 | { | 742 | { |
725 | foreach (SceneObjectPart part in m_parts.Values) | 743 | foreach (SceneObjectPart part in m_parts.Values) |
726 | { | 744 | { |
727 | |||
728 | Vector3 partscale = part.Scale; | 745 | Vector3 partscale = part.Scale; |
729 | Vector3 partoffset = part.OffsetPosition; | 746 | Vector3 partoffset = part.OffsetPosition; |
730 | 747 | ||
@@ -3132,7 +3149,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3132 | SceneObjectPart part = GetChildPart(localID); | 3149 | SceneObjectPart part = GetChildPart(localID); |
3133 | if (part != null) | 3150 | if (part != null) |
3134 | { | 3151 | { |
3135 | part.IgnoreUndoUpdate = true; | ||
3136 | if (scale.X > m_scene.m_maxNonphys) | 3152 | if (scale.X > m_scene.m_maxNonphys) |
3137 | scale.X = m_scene.m_maxNonphys; | 3153 | scale.X = m_scene.m_maxNonphys; |
3138 | if (scale.Y > m_scene.m_maxNonphys) | 3154 | if (scale.Y > m_scene.m_maxNonphys) |
@@ -3218,8 +3234,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3218 | y *= a; | 3234 | y *= a; |
3219 | z *= a; | 3235 | z *= a; |
3220 | } | 3236 | } |
3221 | obPart.IgnoreUndoUpdate = false; | 3237 | |
3222 | obPart.StoreUndoState(); | ||
3223 | } | 3238 | } |
3224 | } | 3239 | } |
3225 | } | 3240 | } |
@@ -3229,13 +3244,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3229 | Vector3 prevScale = part.Scale; | 3244 | Vector3 prevScale = part.Scale; |
3230 | prevScale.X *= x; | 3245 | prevScale.X *= x; |
3231 | prevScale.Y *= y; | 3246 | prevScale.Y *= y; |
3232 | prevScale.Z *= z; | 3247 | prevScale.Z *= z;; |
3248 | part.IgnoreUndoUpdate = true; | ||
3233 | part.Resize(prevScale); | 3249 | part.Resize(prevScale); |
3250 | part.IgnoreUndoUpdate = false; | ||
3234 | 3251 | ||
3235 | lockPartsForRead(true); | 3252 | lockPartsForRead(true); |
3236 | { | 3253 | { |
3237 | foreach (SceneObjectPart obPart in m_parts.Values) | 3254 | foreach (SceneObjectPart obPart in m_parts.Values) |
3238 | { | 3255 | { |
3256 | obPart.IgnoreUndoUpdate = false; | ||
3257 | obPart.StoreUndoState(true); | ||
3239 | obPart.IgnoreUndoUpdate = true; | 3258 | obPart.IgnoreUndoUpdate = true; |
3240 | if (obPart.UUID != m_rootPart.UUID) | 3259 | if (obPart.UUID != m_rootPart.UUID) |
3241 | { | 3260 | { |
@@ -3251,7 +3270,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3251 | obPart.UpdateOffSet(currentpos); | 3270 | obPart.UpdateOffSet(currentpos); |
3252 | } | 3271 | } |
3253 | obPart.IgnoreUndoUpdate = false; | 3272 | obPart.IgnoreUndoUpdate = false; |
3254 | obPart.StoreUndoState(); | ||
3255 | } | 3273 | } |
3256 | } | 3274 | } |
3257 | lockPartsForRead(false); | 3275 | lockPartsForRead(false); |
@@ -3263,7 +3281,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3263 | } | 3281 | } |
3264 | 3282 | ||
3265 | part.IgnoreUndoUpdate = false; | 3283 | part.IgnoreUndoUpdate = false; |
3266 | part.StoreUndoState(); | ||
3267 | HasGroupChanged = true; | 3284 | HasGroupChanged = true; |
3268 | ScheduleGroupForTerseUpdate(); | 3285 | ScheduleGroupForTerseUpdate(); |
3269 | } | 3286 | } |