diff options
author | Melanie | 2012-03-08 19:09:11 +0000 |
---|---|---|
committer | Melanie | 2012-03-08 19:09:11 +0000 |
commit | 3089344114fec1c171f674223a0dd35b97115d04 (patch) | |
tree | 57b813fddbfb7c7ca79483fa6179a88f2871b85f /OpenSim/Region | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Hold a ref to the prim we're sat on rather than querying scene each time (diff) | |
download | opensim-SC_OLD-3089344114fec1c171f674223a0dd35b97115d04.zip opensim-SC_OLD-3089344114fec1c171f674223a0dd35b97115d04.tar.gz opensim-SC_OLD-3089344114fec1c171f674223a0dd35b97115d04.tar.bz2 opensim-SC_OLD-3089344114fec1c171f674223a0dd35b97115d04.tar.xz |
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 72 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UndoState.cs | 139 |
4 files changed, 96 insertions, 180 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8809cd0..038eaa4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -549,11 +549,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
549 | val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); | 549 | val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); |
550 | } | 550 | } |
551 | } | 551 | } |
552 | 552 | /* don't see the need but worse don't see where is restored to false if things stay in | |
553 | foreach (SceneObjectPart part in m_parts.GetArray()) | 553 | foreach (SceneObjectPart part in m_parts.GetArray()) |
554 | { | 554 | { |
555 | part.IgnoreUndoUpdate = true; | 555 | part.IgnoreUndoUpdate = true; |
556 | } | 556 | } |
557 | */ | ||
557 | if (RootPart.GetStatusSandbox()) | 558 | if (RootPart.GetStatusSandbox()) |
558 | { | 559 | { |
559 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) | 560 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) |
@@ -3519,7 +3520,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3519 | if (part.UUID == m_rootPart.UUID) | 3520 | if (part.UUID == m_rootPart.UUID) |
3520 | { | 3521 | { |
3521 | UpdateRootRotation(rot); | 3522 | UpdateRootRotation(rot); |
3522 | if (!m_rootPart.Undoing) | 3523 | /* if (!m_rootPart.Undoing) |
3523 | { | 3524 | { |
3524 | m_rootPart.Undoing = true; | 3525 | m_rootPart.Undoing = true; |
3525 | AbsolutePosition = pos; | 3526 | AbsolutePosition = pos; |
@@ -3527,8 +3528,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3527 | } | 3528 | } |
3528 | else | 3529 | else |
3529 | { | 3530 | { |
3531 | */ | ||
3530 | AbsolutePosition = pos; | 3532 | AbsolutePosition = pos; |
3531 | } | 3533 | // } |
3532 | } | 3534 | } |
3533 | else | 3535 | else |
3534 | { | 3536 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0760808..cce606a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -263,8 +263,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
263 | private bool m_occupied; // KF if any av is sitting on this prim | 263 | private bool m_occupied; // KF if any av is sitting on this prim |
264 | private string m_text = String.Empty; | 264 | private string m_text = String.Empty; |
265 | private string m_touchName = String.Empty; | 265 | private string m_touchName = String.Empty; |
266 | private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5); | 266 | private Stack<UndoState> m_undo = new Stack<UndoState>(5); |
267 | private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5); | 267 | private Stack<UndoState> m_redo = new Stack<UndoState>(5); |
268 | 268 | ||
269 | private bool m_passTouches; | 269 | private bool m_passTouches; |
270 | 270 | ||
@@ -1709,6 +1709,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1709 | dupe.Category = Category; | 1709 | dupe.Category = Category; |
1710 | dupe.m_rezzed = m_rezzed; | 1710 | dupe.m_rezzed = m_rezzed; |
1711 | 1711 | ||
1712 | dupe.m_undo = new Stack<UndoState>(5); | ||
1713 | dupe.m_redo = new Stack<UndoState>(5); | ||
1714 | dupe.IgnoreUndoUpdate = false; | ||
1715 | dupe.Undoing = false; | ||
1716 | |||
1712 | dupe.m_inventory = new SceneObjectPartInventory(dupe); | 1717 | dupe.m_inventory = new SceneObjectPartInventory(dupe); |
1713 | dupe.m_inventory.Items = (TaskInventoryDictionary)m_inventory.Items.Clone(); | 1718 | dupe.m_inventory.Items = (TaskInventoryDictionary)m_inventory.Items.Clone(); |
1714 | 1719 | ||
@@ -3659,61 +3664,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
3659 | 3664 | ||
3660 | public void StoreUndoState(bool forGroup) | 3665 | public void StoreUndoState(bool forGroup) |
3661 | { | 3666 | { |
3662 | if (!Undoing) | 3667 | if (!Undoing && !IgnoreUndoUpdate) // just to read better - undo is in progress, or suspended |
3663 | { | 3668 | { |
3664 | if (!IgnoreUndoUpdate) | 3669 | if (ParentGroup != null) |
3665 | { | 3670 | { |
3666 | if (ParentGroup != null) | 3671 | lock (m_undo) |
3667 | { | 3672 | { |
3668 | lock (m_undo) | 3673 | if (m_undo.Count > 0) |
3669 | { | 3674 | { |
3670 | if (m_undo.Count > 0) | 3675 | // see if we had a change |
3671 | { | ||
3672 | UndoState last = m_undo.Peek(); | ||
3673 | if (last != null) | ||
3674 | { | ||
3675 | // TODO: May need to fix for group comparison | ||
3676 | if (last.Compare(this)) | ||
3677 | { | ||
3678 | // m_log.DebugFormat( | ||
3679 | // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", | ||
3680 | // Name, LocalId, m_undo.Count); | ||
3681 | 3676 | ||
3682 | return; | 3677 | UndoState last = m_undo.Peek(); |
3683 | } | 3678 | if (last != null) |
3679 | { | ||
3680 | if (last.Compare(this, forGroup)) | ||
3681 | { | ||
3682 | return; | ||
3684 | } | 3683 | } |
3685 | } | 3684 | } |
3686 | 3685 | } | |
3687 | // m_log.DebugFormat( | ||
3688 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", | ||
3689 | // Name, LocalId, forGroup, m_undo.Count); | ||
3690 | |||
3691 | if (ParentGroup.GetSceneMaxUndo() > 0) | ||
3692 | { | ||
3693 | UndoState nUndo = new UndoState(this, forGroup); | ||
3694 | 3686 | ||
3695 | m_undo.Push(nUndo); | 3687 | if (ParentGroup.GetSceneMaxUndo() > 0) |
3688 | { | ||
3689 | UndoState nUndo = new UndoState(this, forGroup); | ||
3696 | 3690 | ||
3697 | if (m_redo.Count > 0) | 3691 | m_undo.Push(nUndo); |
3698 | m_redo.Clear(); | ||
3699 | 3692 | ||
3700 | // m_log.DebugFormat( | 3693 | if (m_redo.Count > 0) |
3701 | // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", | 3694 | m_redo.Clear(); |
3702 | // Name, LocalId, forGroup, m_undo.Count); | ||
3703 | } | ||
3704 | } | 3695 | } |
3705 | } | 3696 | } |
3706 | } | 3697 | } |
3707 | // else | ||
3708 | // { | ||
3709 | // m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); | ||
3710 | // } | ||
3711 | } | 3698 | } |
3712 | // else | ||
3713 | // { | ||
3714 | // m_log.DebugFormat( | ||
3715 | // "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); | ||
3716 | // } | ||
3717 | } | 3699 | } |
3718 | 3700 | ||
3719 | /// <summary> | 3701 | /// <summary> |
@@ -3749,7 +3731,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3749 | nUndo = new UndoState(this, goback.ForGroup); | 3731 | nUndo = new UndoState(this, goback.ForGroup); |
3750 | } | 3732 | } |
3751 | 3733 | ||
3752 | goback.PlaybackState(this); | 3734 | goback.PlayState(this); |
3753 | 3735 | ||
3754 | if (nUndo != null) | 3736 | if (nUndo != null) |
3755 | m_redo.Push(nUndo); | 3737 | m_redo.Push(nUndo); |
@@ -3783,7 +3765,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3783 | m_undo.Push(nUndo); | 3765 | m_undo.Push(nUndo); |
3784 | } | 3766 | } |
3785 | 3767 | ||
3786 | gofwd.PlayfwdState(this); | 3768 | gofwd.PlayState(this); |
3787 | } | 3769 | } |
3788 | 3770 | ||
3789 | // m_log.DebugFormat( | 3771 | // m_log.DebugFormat( |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2efb0d2..4190cf6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -463,15 +463,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
463 | // without the parent rotation applied. | 463 | // without the parent rotation applied. |
464 | if (ParentID != 0) | 464 | if (ParentID != 0) |
465 | { | 465 | { |
466 | SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); | 466 | SceneObjectPart part = ParentPart; |
467 | if (part != null) | ||
468 | { | ||
469 | return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); | 467 | return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); |
470 | } | ||
471 | else | ||
472 | { | ||
473 | return ParentPosition + m_pos; | ||
474 | } | ||
475 | } | 468 | } |
476 | } | 469 | } |
477 | return m_pos; | 470 | return m_pos; |
@@ -589,6 +582,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
589 | } | 582 | } |
590 | private UUID m_parentUUID = UUID.Zero; | 583 | private UUID m_parentUUID = UUID.Zero; |
591 | 584 | ||
585 | public SceneObjectPart ParentPart | ||
586 | { | ||
587 | get { return m_parentPart; } | ||
588 | set { m_parentPart = value; } | ||
589 | } | ||
590 | private SceneObjectPart m_parentPart = null; | ||
591 | |||
592 | public float Health | 592 | public float Health |
593 | { | 593 | { |
594 | get { return m_health; } | 594 | get { return m_health; } |
@@ -827,6 +827,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
827 | part.SitTargetAvatar = UUID; | 827 | part.SitTargetAvatar = UUID; |
828 | ParentPosition = part.GetWorldPosition(); | 828 | ParentPosition = part.GetWorldPosition(); |
829 | ParentID = part.LocalId; | 829 | ParentID = part.LocalId; |
830 | ParentPart = part; | ||
830 | m_pos = m_prevSitOffset; | 831 | m_pos = m_prevSitOffset; |
831 | pos = ParentPosition; | 832 | pos = ParentPosition; |
832 | } | 833 | } |
@@ -1801,37 +1802,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
1801 | 1802 | ||
1802 | if (ParentID != 0) | 1803 | if (ParentID != 0) |
1803 | { | 1804 | { |
1804 | SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); | 1805 | SceneObjectPart part = ParentPart; |
1805 | if (part != null) | 1806 | TaskInventoryDictionary taskIDict = part.TaskInventory; |
1807 | if (taskIDict != null) | ||
1806 | { | 1808 | { |
1807 | TaskInventoryDictionary taskIDict = part.TaskInventory; | 1809 | lock (taskIDict) |
1808 | if (taskIDict != null) | ||
1809 | { | 1810 | { |
1810 | lock (taskIDict) | 1811 | foreach (UUID taskID in taskIDict.Keys) |
1811 | { | 1812 | { |
1812 | foreach (UUID taskID in taskIDict.Keys) | 1813 | UnRegisterControlEventsToScript(LocalId, taskID); |
1813 | { | 1814 | taskIDict[taskID].PermsMask &= ~( |
1814 | UnRegisterControlEventsToScript(LocalId, taskID); | 1815 | 2048 | //PERMISSION_CONTROL_CAMERA |
1815 | taskIDict[taskID].PermsMask &= ~( | 1816 | 4); // PERMISSION_TAKE_CONTROLS |
1816 | 2048 | //PERMISSION_CONTROL_CAMERA | ||
1817 | 4); // PERMISSION_TAKE_CONTROLS | ||
1818 | } | ||
1819 | } | 1817 | } |
1820 | } | 1818 | } |
1819 | } | ||
1821 | 1820 | ||
1822 | // Reset sit target. | 1821 | // Reset sit target. |
1823 | if (part.SitTargetAvatar == UUID) | 1822 | if (part.SitTargetAvatar == UUID) |
1824 | part.SitTargetAvatar = UUID.Zero; | 1823 | part.SitTargetAvatar = UUID.Zero; |
1825 | 1824 | ||
1826 | part.ParentGroup.DeleteAvatar(UUID); | 1825 | part.ParentGroup.DeleteAvatar(UUID); |
1827 | ParentPosition = part.GetWorldPosition(); | 1826 | ParentPosition = part.GetWorldPosition(); |
1828 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); | 1827 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); |
1829 | } | ||
1830 | 1828 | ||
1831 | m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); | 1829 | m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); |
1832 | ParentPosition = Vector3.Zero; | 1830 | ParentPosition = Vector3.Zero; |
1833 | 1831 | ||
1834 | ParentID = 0; | 1832 | ParentID = 0; |
1833 | ParentPart = null; | ||
1835 | 1834 | ||
1836 | if (PhysicsActor == null) | 1835 | if (PhysicsActor == null) |
1837 | AddToPhysicalScene(false); | 1836 | AddToPhysicalScene(false); |
@@ -2292,6 +2291,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2292 | return; | 2291 | return; |
2293 | } | 2292 | } |
2294 | 2293 | ||
2294 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | ||
2295 | if (ParentPart == null) | ||
2296 | return; | ||
2297 | |||
2295 | ParentID = m_requestedSitTargetID; | 2298 | ParentID = m_requestedSitTargetID; |
2296 | 2299 | ||
2297 | Velocity = Vector3.Zero; | 2300 | Velocity = Vector3.Zero; |
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 5ed3c79..029c828 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs | |||
@@ -66,43 +66,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
66 | /// </summary> | 66 | /// </summary> |
67 | /// <param name="part"></param> | 67 | /// <param name="part"></param> |
68 | /// <param name="forGroup">True if the undo is for an entire group</param> | 68 | /// <param name="forGroup">True if the undo is for an entire group</param> |
69 | /// only for root parts ???? | ||
69 | public UndoState(SceneObjectPart part, bool forGroup) | 70 | public UndoState(SceneObjectPart part, bool forGroup) |
70 | { | 71 | { |
71 | if (part.ParentID == 0) | 72 | if (part.ParentID == 0) |
72 | { | 73 | { |
73 | ForGroup = forGroup; | 74 | ForGroup = forGroup; |
74 | |||
75 | // if (ForGroup) | ||
76 | Position = part.ParentGroup.AbsolutePosition; | 75 | Position = part.ParentGroup.AbsolutePosition; |
77 | // else | ||
78 | // Position = part.OffsetPosition; | ||
79 | |||
80 | // m_log.DebugFormat( | ||
81 | // "[UNDO STATE]: Storing undo position {0} for root part", Position); | ||
82 | |||
83 | Rotation = part.RotationOffset; | 76 | Rotation = part.RotationOffset; |
84 | 77 | if (!forGroup) | |
85 | // m_log.DebugFormat( | 78 | Scale = part.Shape.Scale; |
86 | // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); | 79 | else |
87 | 80 | Scale = Vector3.Zero; // until we fix it | |
88 | Scale = part.Shape.Scale; | ||
89 | |||
90 | // m_log.DebugFormat( | ||
91 | // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); | ||
92 | } | 81 | } |
93 | else | 82 | else |
94 | { | 83 | { |
84 | ForGroup = false; // previus code implies only root parts can undo grp | ||
95 | Position = part.OffsetPosition; | 85 | Position = part.OffsetPosition; |
96 | // m_log.DebugFormat( | ||
97 | // "[UNDO STATE]: Storing undo position {0} for child part", Position); | ||
98 | |||
99 | Rotation = part.RotationOffset; | 86 | Rotation = part.RotationOffset; |
100 | // m_log.DebugFormat( | ||
101 | // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); | ||
102 | |||
103 | Scale = part.Shape.Scale; | 87 | Scale = part.Shape.Scale; |
104 | // m_log.DebugFormat( | ||
105 | // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); | ||
106 | } | 88 | } |
107 | } | 89 | } |
108 | 90 | ||
@@ -111,35 +93,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
111 | /// </summary> | 93 | /// </summary> |
112 | /// <param name="part"></param> | 94 | /// <param name="part"></param> |
113 | /// <returns>true if both the part's position, rotation and scale match those in this undo state. False otherwise.</returns> | 95 | /// <returns>true if both the part's position, rotation and scale match those in this undo state. False otherwise.</returns> |
114 | public bool Compare(SceneObjectPart part) | 96 | public bool Compare(SceneObjectPart part, bool forgrp) |
115 | { | 97 | { |
98 | if (ForGroup != forgrp) // if diferent targets, then they are diferent | ||
99 | return false; | ||
100 | |||
116 | if (part != null) | 101 | if (part != null) |
117 | { | 102 | { |
118 | if (part.ParentID == 0) | 103 | if (part.ParentID == 0) |
119 | return | 104 | { |
120 | Position == part.ParentGroup.AbsolutePosition | 105 | // root part |
121 | && Rotation == part.RotationOffset | 106 | // grp position is same as part |
122 | && Scale == part.Shape.Scale; | 107 | if (Position != part.ParentGroup.AbsolutePosition) |
108 | return false; | ||
109 | if (Rotation != part.RotationOffset) | ||
110 | return false; | ||
111 | if (ForGroup) | ||
112 | return true; // for now don't do grp scale | ||
113 | return (Scale == part.Shape.Scale); | ||
114 | } | ||
123 | else | 115 | else |
124 | return | 116 | { |
125 | Position == part.OffsetPosition | 117 | return (Position == part.OffsetPosition |
126 | && Rotation == part.RotationOffset | 118 | && Rotation == part.RotationOffset |
127 | && Scale == part.Shape.Scale; | 119 | && Scale == part.Shape.Scale); |
120 | } | ||
128 | } | 121 | } |
129 | 122 | ||
130 | return false; | 123 | return false; |
131 | } | 124 | } |
132 | 125 | ||
133 | public void PlaybackState(SceneObjectPart part) | 126 | public void PlayState(SceneObjectPart part) |
134 | { | 127 | { |
135 | part.Undoing = true; | 128 | part.Undoing = true; |
136 | 129 | ||
137 | if (part.ParentID == 0) | 130 | if (part.ParentID == 0) |
138 | { | 131 | { |
139 | // m_log.DebugFormat( | ||
140 | // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", | ||
141 | // Position, part.Name, part.LocalId); | ||
142 | |||
143 | if (Position != Vector3.Zero) | 132 | if (Position != Vector3.Zero) |
144 | { | 133 | { |
145 | if (ForGroup) | 134 | if (ForGroup) |
@@ -148,10 +137,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
148 | part.ParentGroup.UpdateRootPosition(Position); | 137 | part.ParentGroup.UpdateRootPosition(Position); |
149 | } | 138 | } |
150 | 139 | ||
151 | // m_log.DebugFormat( | ||
152 | // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", | ||
153 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | ||
154 | |||
155 | if (ForGroup) | 140 | if (ForGroup) |
156 | part.UpdateRotation(Rotation); | 141 | part.UpdateRotation(Rotation); |
157 | else | 142 | else |
@@ -159,86 +144,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
159 | 144 | ||
160 | if (Scale != Vector3.Zero) | 145 | if (Scale != Vector3.Zero) |
161 | { | 146 | { |
162 | // m_log.DebugFormat( | 147 | // if (ForGroup) |
163 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", | 148 | // part.ParentGroup.GroupResize(Scale); |
164 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | 149 | // else |
165 | 150 | if (!ForGroup) // we don't have grp scale for now | |
166 | if (ForGroup) | ||
167 | part.ParentGroup.GroupResize(Scale); | ||
168 | else | ||
169 | part.Resize(Scale); | 151 | part.Resize(Scale); |
170 | } | 152 | } |
171 | |||
172 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | 153 | part.ParentGroup.ScheduleGroupForTerseUpdate(); |
173 | } | 154 | } |
174 | else | 155 | else |
175 | { | 156 | { |
176 | // Note: Updating these properties on sop automatically schedules an update if needed | 157 | if (ForGroup) // trap for group since seems parts can't do it |
177 | if (Position != Vector3.Zero) | 158 | return; |
178 | { | ||
179 | // m_log.DebugFormat( | ||
180 | // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", | ||
181 | // part.OffsetPosition, Position, part.Name, part.LocalId); | ||
182 | |||
183 | part.OffsetPosition = Position; | ||
184 | } | ||
185 | |||
186 | // m_log.DebugFormat( | ||
187 | // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", | ||
188 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | ||
189 | 159 | ||
160 | // Note: Updating these properties on sop automatically schedules an update if needed | ||
161 | part.OffsetPosition = Position; | ||
190 | part.UpdateRotation(Rotation); | 162 | part.UpdateRotation(Rotation); |
191 | |||
192 | if (Scale != Vector3.Zero) | 163 | if (Scale != Vector3.Zero) |
193 | { | 164 | { |
194 | // m_log.DebugFormat( | ||
195 | // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", | ||
196 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | ||
197 | |||
198 | part.Resize(Scale); | 165 | part.Resize(Scale); |
199 | } | 166 | } |
200 | } | 167 | } |
201 | 168 | ||
202 | part.Undoing = false; | 169 | part.Undoing = false; |
203 | } | 170 | } |
204 | |||
205 | public void PlayfwdState(SceneObjectPart part) | ||
206 | { | ||
207 | part.Undoing = true; | ||
208 | |||
209 | if (part.ParentID == 0) | ||
210 | { | ||
211 | if (Position != Vector3.Zero) | ||
212 | part.ParentGroup.AbsolutePosition = Position; | ||
213 | |||
214 | if (Rotation != Quaternion.Identity) | ||
215 | part.UpdateRotation(Rotation); | ||
216 | |||
217 | if (Scale != Vector3.Zero) | ||
218 | { | ||
219 | if (ForGroup) | ||
220 | part.ParentGroup.GroupResize(Scale); | ||
221 | else | ||
222 | part.Resize(Scale); | ||
223 | } | ||
224 | |||
225 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | ||
226 | } | ||
227 | else | ||
228 | { | ||
229 | // Note: Updating these properties on sop automatically schedules an update if needed | ||
230 | if (Position != Vector3.Zero) | ||
231 | part.OffsetPosition = Position; | ||
232 | |||
233 | if (Rotation != Quaternion.Identity) | ||
234 | part.UpdateRotation(Rotation); | ||
235 | |||
236 | if (Scale != Vector3.Zero) | ||
237 | part.Resize(Scale); | ||
238 | } | ||
239 | |||
240 | part.Undoing = false; | ||
241 | } | ||
242 | } | 171 | } |
243 | 172 | ||
244 | public class LandUndoState | 173 | public class LandUndoState |