diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/UndoState.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UndoState.cs | 87 |
1 files changed, 51 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index d34d8e5..0a30f4b 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs | |||
@@ -30,12 +30,27 @@ using System.Reflection; | |||
30 | using log4net; | 30 | using log4net; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Region.Framework.Interfaces; | 32 | using OpenSim.Region.Framework.Interfaces; |
33 | using System; | ||
33 | 34 | ||
34 | namespace OpenSim.Region.Framework.Scenes | 35 | namespace OpenSim.Region.Framework.Scenes |
35 | { | 36 | { |
37 | [Flags] | ||
38 | public enum UndoType | ||
39 | { | ||
40 | STATE_PRIM_POSITION = 1, | ||
41 | STATE_PRIM_ROTATION = 2, | ||
42 | STATE_PRIM_SCALE = 4, | ||
43 | STATE_PRIM_ALL = 7, | ||
44 | STATE_GROUP_POSITION = 8, | ||
45 | STATE_GROUP_ROTATION = 16, | ||
46 | STATE_GROUP_SCALE = 32, | ||
47 | STATE_GROUP_ALL = 56, | ||
48 | STATE_ALL = 63 | ||
49 | } | ||
50 | |||
36 | public class UndoState | 51 | public class UndoState |
37 | { | 52 | { |
38 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
39 | 54 | ||
40 | public Vector3 Position = Vector3.Zero; | 55 | public Vector3 Position = Vector3.Zero; |
41 | public Vector3 Scale = Vector3.Zero; | 56 | public Vector3 Scale = Vector3.Zero; |
@@ -57,37 +72,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
57 | { | 72 | { |
58 | ForGroup = forGroup; | 73 | ForGroup = forGroup; |
59 | 74 | ||
60 | // if (ForGroup) | 75 | // if (ForGroup) |
61 | Position = part.ParentGroup.AbsolutePosition; | 76 | Position = part.ParentGroup.AbsolutePosition; |
62 | // else | 77 | // else |
63 | // Position = part.OffsetPosition; | 78 | // Position = part.OffsetPosition; |
64 | 79 | ||
65 | // m_log.DebugFormat( | 80 | // m_log.DebugFormat( |
66 | // "[UNDO STATE]: Storing undo position {0} for root part", Position); | 81 | // "[UNDO STATE]: Storing undo position {0} for root part", Position); |
67 | 82 | ||
68 | Rotation = part.RotationOffset; | 83 | Rotation = part.RotationOffset; |
69 | 84 | ||
70 | // m_log.DebugFormat( | 85 | // m_log.DebugFormat( |
71 | // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); | 86 | // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); |
72 | 87 | ||
73 | Scale = part.Shape.Scale; | 88 | Scale = part.Shape.Scale; |
74 | 89 | ||
75 | // m_log.DebugFormat( | 90 | // m_log.DebugFormat( |
76 | // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); | 91 | // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); |
77 | } | 92 | } |
78 | else | 93 | else |
79 | { | 94 | { |
80 | Position = part.OffsetPosition; | 95 | Position = part.OffsetPosition; |
81 | // m_log.DebugFormat( | 96 | // m_log.DebugFormat( |
82 | // "[UNDO STATE]: Storing undo position {0} for child part", Position); | 97 | // "[UNDO STATE]: Storing undo position {0} for child part", Position); |
83 | 98 | ||
84 | Rotation = part.RotationOffset; | 99 | Rotation = part.RotationOffset; |
85 | // m_log.DebugFormat( | 100 | // m_log.DebugFormat( |
86 | // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); | 101 | // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); |
87 | 102 | ||
88 | Scale = part.Shape.Scale; | 103 | Scale = part.Shape.Scale; |
89 | // m_log.DebugFormat( | 104 | // m_log.DebugFormat( |
90 | // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); | 105 | // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); |
91 | } | 106 | } |
92 | } | 107 | } |
93 | 108 | ||
@@ -121,9 +136,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
121 | 136 | ||
122 | if (part.ParentID == 0) | 137 | if (part.ParentID == 0) |
123 | { | 138 | { |
124 | // m_log.DebugFormat( | 139 | // m_log.DebugFormat( |
125 | // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", | 140 | // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", |
126 | // Position, part.Name, part.LocalId); | 141 | // Position, part.Name, part.LocalId); |
127 | 142 | ||
128 | if (Position != Vector3.Zero) | 143 | if (Position != Vector3.Zero) |
129 | { | 144 | { |
@@ -133,9 +148,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
133 | part.ParentGroup.UpdateRootPosition(Position); | 148 | part.ParentGroup.UpdateRootPosition(Position); |
134 | } | 149 | } |
135 | 150 | ||
136 | // m_log.DebugFormat( | 151 | // m_log.DebugFormat( |
137 | // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", | 152 | // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", |
138 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | 153 | // part.RotationOffset, Rotation, part.Name, part.LocalId); |
139 | 154 | ||
140 | if (ForGroup) | 155 | if (ForGroup) |
141 | part.UpdateRotation(Rotation); | 156 | part.UpdateRotation(Rotation); |
@@ -144,9 +159,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | 159 | ||
145 | if (Scale != Vector3.Zero) | 160 | if (Scale != Vector3.Zero) |
146 | { | 161 | { |
147 | // m_log.DebugFormat( | 162 | // m_log.DebugFormat( |
148 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", | 163 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", |
149 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | 164 | // part.Shape.Scale, Scale, part.Name, part.LocalId); |
150 | 165 | ||
151 | if (ForGroup) | 166 | if (ForGroup) |
152 | part.ParentGroup.GroupResize(Scale); | 167 | part.ParentGroup.GroupResize(Scale); |
@@ -160,24 +175,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
160 | { | 175 | { |
161 | if (Position != Vector3.Zero) | 176 | if (Position != Vector3.Zero) |
162 | { | 177 | { |
163 | // m_log.DebugFormat( | 178 | // m_log.DebugFormat( |
164 | // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", | 179 | // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", |
165 | // part.OffsetPosition, Position, part.Name, part.LocalId); | 180 | // part.OffsetPosition, Position, part.Name, part.LocalId); |
166 | 181 | ||
167 | part.OffsetPosition = Position; | 182 | part.OffsetPosition = Position; |
168 | } | 183 | } |
169 | 184 | ||
170 | // m_log.DebugFormat( | 185 | // m_log.DebugFormat( |
171 | // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", | 186 | // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", |
172 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | 187 | // part.RotationOffset, Rotation, part.Name, part.LocalId); |
173 | 188 | ||
174 | part.UpdateRotation(Rotation); | 189 | part.UpdateRotation(Rotation); |
175 | 190 | ||
176 | if (Scale != Vector3.Zero) | 191 | if (Scale != Vector3.Zero) |
177 | { | 192 | { |
178 | // m_log.DebugFormat( | 193 | // m_log.DebugFormat( |
179 | // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", | 194 | // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", |
180 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | 195 | // part.Shape.Scale, Scale, part.Name, part.LocalId); |
181 | 196 | ||
182 | part.Resize(Scale); | 197 | part.Resize(Scale); |
183 | } | 198 | } |
@@ -249,4 +264,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
249 | m_terrainModule.UndoTerrain(m_terrainChannel); | 264 | m_terrainModule.UndoTerrain(m_terrainChannel); |
250 | } | 265 | } |
251 | } | 266 | } |
252 | } \ No newline at end of file | 267 | } |