aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTom Grimshaw2010-07-05 05:44:35 -0700
committerTom Grimshaw2010-07-05 05:44:35 -0700
commite947d04038f7b42929368d9f7b6d440be139e675 (patch)
tree4aa09d4b727307a7cf50f10ee2e93511af1a62c9 /OpenSim/Region
parentBring "Redo" up to date with "Undo" so it works too (diff)
downloadopensim-SC_OLD-e947d04038f7b42929368d9f7b6d440be139e675.zip
opensim-SC_OLD-e947d04038f7b42929368d9f7b6d440be139e675.tar.gz
opensim-SC_OLD-e947d04038f7b42929368d9f7b6d440be139e675.tar.bz2
opensim-SC_OLD-e947d04038f7b42929368d9f7b6d440be139e675.tar.xz
Undo fix is now complete. This commit repairs the special case of the root prim moving or rotating independently of the rest of the group.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs5
3 files changed, 41 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 7492601..f85d3d9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3386,10 +3386,27 @@ namespace OpenSim.Region.Framework.Scenes
3386 } 3386 }
3387 lockPartsForRead(false); 3387 lockPartsForRead(false);
3388 3388
3389 AbsolutePosition = newPos; 3389 //We have to set undoing here because otherwise an undo state will be saved
3390 if (!m_rootPart.Undoing)
3391 {
3392 m_rootPart.Undoing = true;
3393 AbsolutePosition = newPos;
3394 m_rootPart.Undoing = false;
3395 }
3396 else
3397 {
3398 AbsolutePosition = newPos;
3399 }
3390 3400
3391 HasGroupChanged = true; 3401 HasGroupChanged = true;
3392 ScheduleGroupForTerseUpdate(); 3402 if (m_rootPart.Undoing)
3403 {
3404 ScheduleGroupForFullUpdate();
3405 }
3406 else
3407 {
3408 ScheduleGroupForTerseUpdate();
3409 }
3393 } 3410 }
3394 3411
3395 public void OffsetForNewRegion(Vector3 offset) 3412 public void OffsetForNewRegion(Vector3 offset)
@@ -3488,7 +3505,16 @@ namespace OpenSim.Region.Framework.Scenes
3488 if (part.UUID == m_rootPart.UUID) 3505 if (part.UUID == m_rootPart.UUID)
3489 { 3506 {
3490 UpdateRootRotation(rot); 3507 UpdateRootRotation(rot);
3491 AbsolutePosition = pos; 3508 if (!m_rootPart.Undoing)
3509 {
3510 m_rootPart.Undoing = true;
3511 AbsolutePosition = pos;
3512 m_rootPart.Undoing = false;
3513 }
3514 else
3515 {
3516 AbsolutePosition = pos;
3517 }
3492 } 3518 }
3493 else 3519 else
3494 { 3520 {
@@ -3511,6 +3537,12 @@ namespace OpenSim.Region.Framework.Scenes
3511 Quaternion oldParentRot = m_rootPart.RotationOffset; 3537 Quaternion oldParentRot = m_rootPart.RotationOffset;
3512 3538
3513 m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION); 3539 m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3540 bool cancelUndo = false;
3541 if (!m_rootPart.Undoing)
3542 {
3543 m_rootPart.Undoing = true;
3544 cancelUndo = true;
3545 }
3514 m_rootPart.UpdateRotation(rot); 3546 m_rootPart.UpdateRotation(rot);
3515 if (m_rootPart.PhysActor != null) 3547 if (m_rootPart.PhysActor != null)
3516 { 3548 {
@@ -3534,18 +3566,13 @@ namespace OpenSim.Region.Framework.Scenes
3534 newRot *= Quaternion.Inverse(axRot); 3566 newRot *= Quaternion.Inverse(axRot);
3535 prim.RotationOffset = newRot; 3567 prim.RotationOffset = newRot;
3536 prim.ScheduleTerseUpdate(); 3568 prim.ScheduleTerseUpdate();
3569 prim.IgnoreUndoUpdate = false;
3537 } 3570 }
3538 } 3571 }
3539 3572 if (cancelUndo == true)
3540 foreach (SceneObjectPart childpart in Children.Values)
3541 { 3573 {
3542 if (childpart != m_rootPart) 3574 m_rootPart.Undoing = false;
3543 {
3544 childpart.IgnoreUndoUpdate = false;
3545 childpart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3546 }
3547 } 3575 }
3548
3549 lockPartsForRead(false); 3576 lockPartsForRead(false);
3550 3577
3551 m_rootPart.ScheduleTerseUpdate(); 3578 m_rootPart.ScheduleTerseUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 93a23ca..3327b1e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3506,8 +3506,6 @@ namespace OpenSim.Region.Framework.Scenes
3506 } 3506 }
3507 public void StoreUndoState(UndoType type) 3507 public void StoreUndoState(UndoType type)
3508 { 3508 {
3509
3510
3511 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) 3509 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3512 { 3510 {
3513 if (!IgnoreUndoUpdate) 3511 if (!IgnoreUndoUpdate)
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 2af3316..f71b507 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -172,8 +172,9 @@ namespace OpenSim.Region.Framework.Scenes
172 if (part.ParentID == 0 && GroupChange == false) 172 if (part.ParentID == 0 && GroupChange == false)
173 { 173 {
174 if (Position != Vector3.Zero) 174 if (Position != Vector3.Zero)
175 part.ParentGroup.AbsolutePosition = Position; 175
176 part.RotationOffset = Rotation; 176 part.ParentGroup.UpdateSinglePosition(Position, part.LocalId);
177 part.ParentGroup.UpdateSingleRotation(Rotation, part.LocalId);
177 if (Scale != Vector3.Zero) 178 if (Scale != Vector3.Zero)
178 part.Resize(Scale); 179 part.Resize(Scale);
179 part.ParentGroup.ScheduleGroupForTerseUpdate(); 180 part.ParentGroup.ScheduleGroupForTerseUpdate();