diff options
author | Justin Clark-Casey (justincc) | 2011-07-19 05:51:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-19 05:51:19 +0100 |
commit | 9dd5a2449575d671075c673e5e39ef3e1a108a76 (patch) | |
tree | f64e176bb315b70676baaaf52bed55011a421125 /OpenSim | |
parent | Fix undo when changing just the root prim's position in a linkset. (diff) | |
download | opensim-SC-9dd5a2449575d671075c673e5e39ef3e1a108a76.zip opensim-SC-9dd5a2449575d671075c673e5e39ef3e1a108a76.tar.gz opensim-SC-9dd5a2449575d671075c673e5e39ef3e1a108a76.tar.bz2 opensim-SC-9dd5a2449575d671075c673e5e39ef3e1a108a76.tar.xz |
rip out pointless null checks in UndoState where part can never be null
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UndoState.cs | 153 |
1 files changed, 72 insertions, 81 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 6bf89c5..f7bed5a 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs | |||
@@ -53,44 +53,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
53 | /// <param name="forGroup">True if the undo is for an entire group</param> | 53 | /// <param name="forGroup">True if the undo is for an entire group</param> |
54 | public UndoState(SceneObjectPart part, bool forGroup) | 54 | public UndoState(SceneObjectPart part, bool forGroup) |
55 | { | 55 | { |
56 | if (part != null) | 56 | if (part.ParentID == 0) |
57 | { | 57 | { |
58 | if (part.ParentID == 0) | 58 | ForGroup = forGroup; |
59 | { | ||
60 | ForGroup = forGroup; | ||
61 | 59 | ||
62 | // if (ForGroup) | 60 | // if (ForGroup) |
63 | Position = part.ParentGroup.AbsolutePosition; | 61 | Position = part.ParentGroup.AbsolutePosition; |
64 | // else | 62 | // else |
65 | // Position = part.OffsetPosition; | 63 | // Position = part.OffsetPosition; |
66 | 64 | ||
67 | // m_log.DebugFormat( | 65 | // m_log.DebugFormat( |
68 | // "[UNDO STATE]: Storing undo position {0} for root part", Position); | 66 | // "[UNDO STATE]: Storing undo position {0} for root part", Position); |
69 | 67 | ||
70 | Rotation = part.RotationOffset; | 68 | Rotation = part.RotationOffset; |
71 | 69 | ||
72 | // m_log.DebugFormat( | 70 | // m_log.DebugFormat( |
73 | // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); | 71 | // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); |
74 | 72 | ||
75 | Scale = part.Shape.Scale; | 73 | Scale = part.Shape.Scale; |
76 | 74 | ||
77 | // m_log.DebugFormat( | 75 | // m_log.DebugFormat( |
78 | // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); | 76 | // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); |
79 | } | 77 | } |
80 | else | 78 | else |
81 | { | 79 | { |
82 | Position = part.OffsetPosition; | 80 | Position = part.OffsetPosition; |
83 | // m_log.DebugFormat( | 81 | // m_log.DebugFormat( |
84 | // "[UNDO STATE]: Storing undo position {0} for child part", Position); | 82 | // "[UNDO STATE]: Storing undo position {0} for child part", Position); |
85 | 83 | ||
86 | Rotation = part.RotationOffset; | 84 | Rotation = part.RotationOffset; |
87 | // m_log.DebugFormat( | 85 | // m_log.DebugFormat( |
88 | // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); | 86 | // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); |
89 | 87 | ||
90 | Scale = part.Shape.Scale; | 88 | Scale = part.Shape.Scale; |
91 | // m_log.DebugFormat( | 89 | // m_log.DebugFormat( |
92 | // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); | 90 | // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); |
93 | } | ||
94 | } | 91 | } |
95 | } | 92 | } |
96 | 93 | ||
@@ -128,120 +125,114 @@ namespace OpenSim.Region.Framework.Scenes | |||
128 | 125 | ||
129 | public void PlaybackState(SceneObjectPart part) | 126 | public void PlaybackState(SceneObjectPart part) |
130 | { | 127 | { |
131 | if (part != null) | 128 | part.Undoing = true; |
132 | { | ||
133 | part.Undoing = true; | ||
134 | 129 | ||
135 | if (part.ParentID == 0) | 130 | if (part.ParentID == 0) |
136 | { | 131 | { |
137 | // m_log.DebugFormat( | 132 | // m_log.DebugFormat( |
138 | // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", | 133 | // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", |
139 | // Position, part.Name, part.LocalId); | 134 | // Position, part.Name, part.LocalId); |
140 | 135 | ||
141 | if (Position != Vector3.Zero) | 136 | if (Position != Vector3.Zero) |
142 | { | 137 | { |
143 | if (ForGroup) | 138 | if (ForGroup) |
144 | part.ParentGroup.AbsolutePosition = Position; | 139 | part.ParentGroup.AbsolutePosition = Position; |
145 | else | 140 | else |
146 | part.ParentGroup.UpdateRootPosition(Position); | 141 | part.ParentGroup.UpdateRootPosition(Position); |
147 | } | 142 | } |
148 | 143 | ||
149 | // m_log.DebugFormat( | 144 | // m_log.DebugFormat( |
150 | // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", | 145 | // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", |
151 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | 146 | // part.RotationOffset, Rotation, part.Name, part.LocalId); |
152 | 147 | ||
153 | if (ForGroup) | 148 | if (ForGroup) |
154 | part.UpdateRotation(Rotation); | 149 | part.UpdateRotation(Rotation); |
155 | else | 150 | else |
156 | part.ParentGroup.UpdateRootRotation(Rotation); | 151 | part.ParentGroup.UpdateRootRotation(Rotation); |
157 | 152 | ||
158 | if (Scale != Vector3.Zero) | 153 | if (Scale != Vector3.Zero) |
159 | { | 154 | { |
160 | // m_log.DebugFormat( | 155 | // m_log.DebugFormat( |
161 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", | 156 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", |
162 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | 157 | // part.Shape.Scale, Scale, part.Name, part.LocalId); |
163 | 158 | ||
164 | if (ForGroup) | 159 | if (ForGroup) |
165 | part.ParentGroup.GroupResize(Scale); | 160 | part.ParentGroup.GroupResize(Scale); |
166 | else | 161 | else |
167 | part.Resize(Scale); | 162 | part.Resize(Scale); |
168 | } | ||
169 | |||
170 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | ||
171 | } | 163 | } |
172 | else | 164 | |
165 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | ||
166 | } | ||
167 | else | ||
168 | { | ||
169 | if (Position != Vector3.Zero) | ||
173 | { | 170 | { |
174 | if (Position != Vector3.Zero) | ||
175 | { | ||
176 | // m_log.DebugFormat( | 171 | // m_log.DebugFormat( |
177 | // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", | 172 | // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", |
178 | // part.OffsetPosition, Position, part.Name, part.LocalId); | 173 | // part.OffsetPosition, Position, part.Name, part.LocalId); |
179 | 174 | ||
180 | part.OffsetPosition = Position; | 175 | part.OffsetPosition = Position; |
181 | } | 176 | } |
182 | 177 | ||
183 | // m_log.DebugFormat( | 178 | // m_log.DebugFormat( |
184 | // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", | 179 | // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", |
185 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | 180 | // part.RotationOffset, Rotation, part.Name, part.LocalId); |
186 | 181 | ||
187 | part.UpdateRotation(Rotation); | 182 | part.UpdateRotation(Rotation); |
188 | 183 | ||
189 | if (Scale != Vector3.Zero) | 184 | if (Scale != Vector3.Zero) |
190 | { | 185 | { |
191 | // m_log.DebugFormat( | 186 | // m_log.DebugFormat( |
192 | // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", | 187 | // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", |
193 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | 188 | // part.Shape.Scale, Scale, part.Name, part.LocalId); |
194 | 189 | ||
195 | part.Resize(Scale); | 190 | part.Resize(Scale); |
196 | } | ||
197 | |||
198 | part.ScheduleTerseUpdate(); | ||
199 | } | 191 | } |
200 | 192 | ||
201 | part.Undoing = false; | 193 | part.ScheduleTerseUpdate(); |
202 | } | 194 | } |
195 | |||
196 | part.Undoing = false; | ||
203 | } | 197 | } |
204 | 198 | ||
205 | public void PlayfwdState(SceneObjectPart part) | 199 | public void PlayfwdState(SceneObjectPart part) |
206 | { | 200 | { |
207 | if (part != null) | 201 | part.Undoing = true; |
208 | { | ||
209 | part.Undoing = true; | ||
210 | |||
211 | if (part.ParentID == 0) | ||
212 | { | ||
213 | if (Position != Vector3.Zero) | ||
214 | part.ParentGroup.AbsolutePosition = Position; | ||
215 | 202 | ||
216 | if (Rotation != Quaternion.Identity) | 203 | if (part.ParentID == 0) |
217 | part.UpdateRotation(Rotation); | 204 | { |
205 | if (Position != Vector3.Zero) | ||
206 | part.ParentGroup.AbsolutePosition = Position; | ||
218 | 207 | ||
219 | if (Scale != Vector3.Zero) | 208 | if (Rotation != Quaternion.Identity) |
220 | { | 209 | part.UpdateRotation(Rotation); |
221 | if (ForGroup) | ||
222 | part.ParentGroup.GroupResize(Scale); | ||
223 | else | ||
224 | part.Resize(Scale); | ||
225 | } | ||
226 | 210 | ||
227 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | 211 | if (Scale != Vector3.Zero) |
228 | } | ||
229 | else | ||
230 | { | 212 | { |
231 | if (Position != Vector3.Zero) | 213 | if (ForGroup) |
232 | part.OffsetPosition = Position; | 214 | part.ParentGroup.GroupResize(Scale); |
215 | else | ||
216 | part.Resize(Scale); | ||
217 | } | ||
233 | 218 | ||
234 | if (Rotation != Quaternion.Identity) | 219 | part.ParentGroup.ScheduleGroupForTerseUpdate(); |
235 | part.UpdateRotation(Rotation); | 220 | } |
221 | else | ||
222 | { | ||
223 | if (Position != Vector3.Zero) | ||
224 | part.OffsetPosition = Position; | ||
236 | 225 | ||
237 | if (Scale != Vector3.Zero) | 226 | if (Rotation != Quaternion.Identity) |
238 | part.Resize(Scale); | 227 | part.UpdateRotation(Rotation); |
239 | 228 | ||
240 | part.ScheduleTerseUpdate(); | 229 | if (Scale != Vector3.Zero) |
241 | } | 230 | part.Resize(Scale); |
242 | 231 | ||
243 | part.Undoing = false; | 232 | part.ScheduleTerseUpdate(); |
244 | } | 233 | } |
234 | |||
235 | part.Undoing = false; | ||
245 | } | 236 | } |
246 | } | 237 | } |
247 | 238 | ||