diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 402 |
1 files changed, 226 insertions, 176 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 99f1900..3182204 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1,17 +1,16 @@ | |||
1 | using System; | ||
1 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | ||
2 | using System.Text; | 4 | using System.Text; |
3 | using System.Xml; | 5 | using System.Xml; |
4 | using System.Xml.Serialization; | ||
5 | using System.IO; | ||
6 | using System; | ||
7 | using Axiom.Math; | 6 | using Axiom.Math; |
8 | using libsecondlife; | 7 | using libsecondlife; |
9 | using libsecondlife.Packets; | 8 | using libsecondlife.Packets; |
9 | using OpenSim.Framework.Data; | ||
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Types; | 11 | using OpenSim.Framework.Types; |
12 | using OpenSim.Region.Physics.Manager; | ||
13 | using OpenSim.Framework.Data; | ||
14 | using OpenSim.Region.Environment.Interfaces; | 12 | using OpenSim.Region.Environment.Interfaces; |
13 | using OpenSim.Region.Physics.Manager; | ||
15 | 14 | ||
16 | namespace OpenSim.Region.Environment.Scenes | 15 | namespace OpenSim.Region.Environment.Scenes |
17 | { | 16 | { |
@@ -31,6 +30,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
31 | public bool HasChanged = false; | 30 | public bool HasChanged = false; |
32 | 31 | ||
33 | #region Properties | 32 | #region Properties |
33 | |||
34 | /// <summary> | 34 | /// <summary> |
35 | /// | 35 | /// |
36 | /// </summary> | 36 | /// </summary> |
@@ -54,13 +54,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
54 | 54 | ||
55 | public Dictionary<LLUUID, SceneObjectPart> Children | 55 | public Dictionary<LLUUID, SceneObjectPart> Children |
56 | { | 56 | { |
57 | get { return this.m_parts; } | 57 | get { return m_parts; } |
58 | set { m_parts = value; } | 58 | set { m_parts = value; } |
59 | } | 59 | } |
60 | 60 | ||
61 | public SceneObjectPart RootPart | 61 | public SceneObjectPart RootPart |
62 | { | 62 | { |
63 | get { return this.m_rootPart; } | 63 | get { return m_rootPart; } |
64 | set { m_rootPart = value; } | 64 | set { m_rootPart = value; } |
65 | } | 65 | } |
66 | 66 | ||
@@ -70,9 +70,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
70 | set | 70 | set |
71 | { | 71 | { |
72 | m_regionHandle = value; | 72 | m_regionHandle = value; |
73 | lock (this.m_parts) | 73 | lock (m_parts) |
74 | { | 74 | { |
75 | foreach (SceneObjectPart part in this.m_parts.Values) | 75 | foreach (SceneObjectPart part in m_parts.Values) |
76 | { | 76 | { |
77 | part.RegionHandle = m_regionHandle; | 77 | part.RegionHandle = m_regionHandle; |
78 | } | 78 | } |
@@ -104,16 +104,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
104 | val.Y = 0.4f; | 104 | val.Y = 0.4f; |
105 | } | 105 | } |
106 | 106 | ||
107 | lock (this.m_parts) | 107 | lock (m_parts) |
108 | { | 108 | { |
109 | foreach (SceneObjectPart part in this.m_parts.Values) | 109 | foreach (SceneObjectPart part in m_parts.Values) |
110 | { | 110 | { |
111 | part.GroupPosition = val; | 111 | part.GroupPosition = val; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | if (m_rootPart.PhysActor != null) | 114 | if (m_rootPart.PhysActor != null) |
115 | { | 115 | { |
116 | m_rootPart.PhysActor.Position = new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, m_rootPart.GroupPosition.Z); | 116 | m_rootPart.PhysActor.Position = |
117 | new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, | ||
118 | m_rootPart.GroupPosition.Z); | ||
117 | } | 119 | } |
118 | } | 120 | } |
119 | } | 121 | } |
@@ -152,10 +154,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
152 | 154 | ||
153 | protected virtual bool InSceneBackup | 155 | protected virtual bool InSceneBackup |
154 | { | 156 | { |
155 | get | 157 | get { return true; } |
156 | { | ||
157 | return true; | ||
158 | } | ||
159 | } | 158 | } |
160 | 159 | ||
161 | public bool IsSelected | 160 | public bool IsSelected |
@@ -170,19 +169,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
170 | get | 169 | get |
171 | { | 170 | { |
172 | if (m_scene != null) | 171 | if (m_scene != null) |
173 | { return m_scene.RegionInfo.SimUUID; } | 172 | { |
173 | return m_scene.RegionInfo.SimUUID; | ||
174 | } | ||
174 | return LLUUID.Zero; | 175 | return LLUUID.Zero; |
175 | } | 176 | } |
176 | } | 177 | } |
178 | |||
177 | #endregion | 179 | #endregion |
178 | 180 | ||
179 | #region Constructors | 181 | #region Constructors |
182 | |||
180 | /// <summary> | 183 | /// <summary> |
181 | /// | 184 | /// |
182 | /// </summary> | 185 | /// </summary> |
183 | public SceneObjectGroup() | 186 | public SceneObjectGroup() |
184 | { | 187 | { |
185 | |||
186 | } | 188 | } |
187 | 189 | ||
188 | /// <summary> | 190 | /// <summary> |
@@ -198,7 +200,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
198 | reader.Read(); | 200 | reader.Read(); |
199 | reader.ReadStartElement("SceneObjectGroup"); | 201 | reader.ReadStartElement("SceneObjectGroup"); |
200 | reader.ReadStartElement("RootPart"); | 202 | reader.ReadStartElement("RootPart"); |
201 | this.m_rootPart = SceneObjectPart.FromXml(reader); | 203 | m_rootPart = SceneObjectPart.FromXml(reader); |
202 | reader.ReadEndElement(); | 204 | reader.ReadEndElement(); |
203 | 205 | ||
204 | while (reader.Read()) | 206 | while (reader.Read()) |
@@ -211,7 +213,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
211 | reader.Read(); | 213 | reader.Read(); |
212 | SceneObjectPart Part = SceneObjectPart.FromXml(reader); | 214 | SceneObjectPart Part = SceneObjectPart.FromXml(reader); |
213 | Part.LocalID = m_scene.PrimIDAllocate(); | 215 | Part.LocalID = m_scene.PrimIDAllocate(); |
214 | this.AddPart(Part); | 216 | AddPart(Part); |
215 | Part.RegionHandle = m_regionHandle; | 217 | Part.RegionHandle = m_regionHandle; |
216 | } | 218 | } |
217 | break; | 219 | break; |
@@ -221,23 +223,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
221 | } | 223 | } |
222 | reader.Close(); | 224 | reader.Close(); |
223 | sr.Close(); | 225 | sr.Close(); |
224 | this.m_rootPart.SetParent(this); | 226 | m_rootPart.SetParent(this); |
225 | this.m_parts.Add(m_rootPart.UUID, m_rootPart); | 227 | m_parts.Add(m_rootPart.UUID, m_rootPart); |
226 | this.m_rootPart.LocalID = m_scene.PrimIDAllocate(); | 228 | m_rootPart.LocalID = m_scene.PrimIDAllocate(); |
227 | this.m_rootPart.ParentID = 0; | 229 | m_rootPart.ParentID = 0; |
228 | this.m_rootPart.RegionHandle = m_regionHandle; | 230 | m_rootPart.RegionHandle = m_regionHandle; |
229 | this.UpdateParentIDs(); | 231 | UpdateParentIDs(); |
230 | 232 | ||
231 | AttachToBackup(); | 233 | AttachToBackup(); |
232 | 234 | ||
233 | this.ScheduleGroupForFullUpdate(); | 235 | ScheduleGroupForFullUpdate(); |
234 | } | 236 | } |
235 | 237 | ||
236 | private void AttachToBackup() | 238 | private void AttachToBackup() |
237 | { | 239 | { |
238 | if (InSceneBackup) | 240 | if (InSceneBackup) |
239 | { | 241 | { |
240 | m_scene.EventManager.OnBackup += this.ProcessBackup; | 242 | m_scene.EventManager.OnBackup += ProcessBackup; |
241 | } | 243 | } |
242 | } | 244 | } |
243 | 245 | ||
@@ -246,25 +248,27 @@ namespace OpenSim.Region.Environment.Scenes | |||
246 | /// </summary> | 248 | /// </summary> |
247 | public SceneObjectGroup(byte[] data) | 249 | public SceneObjectGroup(byte[] data) |
248 | { | 250 | { |
249 | |||
250 | } | 251 | } |
251 | 252 | ||
252 | /// <summary> | 253 | /// <summary> |
253 | /// | 254 | /// |
254 | /// </summary> | 255 | /// </summary> |
255 | public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) | 256 | public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, |
257 | PrimitiveBaseShape shape) | ||
256 | { | 258 | { |
257 | m_regionHandle = regionHandle; | 259 | m_regionHandle = regionHandle; |
258 | m_scene = scene; | 260 | m_scene = scene; |
259 | 261 | ||
260 | // this.Pos = pos; | 262 | // this.Pos = pos; |
261 | LLVector3 rootOffset = new LLVector3(0, 0, 0); | 263 | LLVector3 rootOffset = new LLVector3(0, 0, 0); |
262 | SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); | 264 | SceneObjectPart newPart = |
263 | this.m_parts.Add(newPart.UUID, newPart); | 265 | new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); |
264 | this.SetPartAsRoot(newPart); | 266 | m_parts.Add(newPart.UUID, newPart); |
267 | SetPartAsRoot(newPart); | ||
265 | 268 | ||
266 | AttachToBackup(); | 269 | AttachToBackup(); |
267 | } | 270 | } |
271 | |||
268 | #endregion | 272 | #endregion |
269 | 273 | ||
270 | public string ToXmlString() | 274 | public string ToXmlString() |
@@ -276,9 +280,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
276 | m_rootPart.ToXml(writer); | 280 | m_rootPart.ToXml(writer); |
277 | writer.WriteEndElement(); | 281 | writer.WriteEndElement(); |
278 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); | 282 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); |
279 | foreach (SceneObjectPart part in this.m_parts.Values) | 283 | foreach (SceneObjectPart part in m_parts.Values) |
280 | { | 284 | { |
281 | if (part.UUID != this.m_rootPart.UUID) | 285 | if (part.UUID != m_rootPart.UUID) |
282 | { | 286 | { |
283 | writer.WriteStartElement(String.Empty, "Part", String.Empty); | 287 | writer.WriteStartElement(String.Empty, "Part", String.Empty); |
284 | part.ToXml(writer); | 288 | part.ToXml(writer); |
@@ -292,35 +296,36 @@ namespace OpenSim.Region.Environment.Scenes | |||
292 | } | 296 | } |
293 | 297 | ||
294 | #region Copying | 298 | #region Copying |
299 | |||
295 | /// <summary> | 300 | /// <summary> |
296 | /// | 301 | /// |
297 | /// </summary> | 302 | /// </summary> |
298 | /// <returns></returns> | 303 | /// <returns></returns> |
299 | public new SceneObjectGroup Copy() | 304 | public new SceneObjectGroup Copy() |
300 | { | 305 | { |
301 | SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); | 306 | SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone(); |
302 | dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>(); | 307 | dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>(); |
303 | dupe.m_parts.Clear(); | 308 | dupe.m_parts.Clear(); |
304 | dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 309 | dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
305 | dupe.m_scene = m_scene; | 310 | dupe.m_scene = m_scene; |
306 | dupe.m_regionHandle = this.m_regionHandle; | 311 | dupe.m_regionHandle = m_regionHandle; |
307 | dupe.CopyRootPart(this.m_rootPart); | 312 | dupe.CopyRootPart(m_rootPart); |
308 | 313 | ||
309 | /// may need to create a new Physics actor. | 314 | /// may need to create a new Physics actor. |
310 | if (dupe.RootPart.PhysActor != null) | 315 | if (dupe.RootPart.PhysActor != null) |
311 | { | 316 | { |
312 | dupe.RootPart.PhysActor = m_scene.phyScene.AddPrim( | 317 | dupe.RootPart.PhysActor = m_scene.phyScene.AddPrim( |
313 | new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z), | 318 | new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, |
314 | new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), | 319 | dupe.RootPart.AbsolutePosition.Z), |
315 | new Axiom.Math.Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, | 320 | new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), |
316 | dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z)); | 321 | new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, |
317 | 322 | dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z)); | |
318 | } | 323 | } |
319 | 324 | ||
320 | List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values); | 325 | List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values); |
321 | foreach (SceneObjectPart part in partList) | 326 | foreach (SceneObjectPart part in partList) |
322 | { | 327 | { |
323 | if (part.UUID != this.m_rootPart.UUID) | 328 | if (part.UUID != m_rootPart.UUID) |
324 | { | 329 | { |
325 | dupe.CopyPart(part); | 330 | dupe.CopyPart(part); |
326 | } | 331 | } |
@@ -328,7 +333,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
328 | dupe.UpdateParentIDs(); | 333 | dupe.UpdateParentIDs(); |
329 | 334 | ||
330 | dupe.AttachToBackup(); | 335 | dupe.AttachToBackup(); |
331 | 336 | ||
332 | return dupe; | 337 | return dupe; |
333 | } | 338 | } |
334 | 339 | ||
@@ -340,8 +345,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
340 | { | 345 | { |
341 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); | 346 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); |
342 | newPart.SetParent(this); | 347 | newPart.SetParent(this); |
343 | this.m_parts.Add(newPart.UUID, newPart); | 348 | m_parts.Add(newPart.UUID, newPart); |
344 | this.SetPartAsRoot(newPart); | 349 | SetPartAsRoot(newPart); |
345 | } | 350 | } |
346 | 351 | ||
347 | /// <summary> | 352 | /// <summary> |
@@ -352,18 +357,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
352 | { | 357 | { |
353 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); | 358 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); |
354 | newPart.SetParent(this); | 359 | newPart.SetParent(this); |
355 | this.m_parts.Add(newPart.UUID, newPart); | 360 | m_parts.Add(newPart.UUID, newPart); |
356 | this.SetPartAsNonRoot(newPart); | 361 | SetPartAsNonRoot(newPart); |
357 | } | 362 | } |
363 | |||
358 | #endregion | 364 | #endregion |
359 | 365 | ||
360 | #region Scheduling | 366 | #region Scheduling |
367 | |||
361 | /// <summary> | 368 | /// <summary> |
362 | /// | 369 | /// |
363 | /// </summary> | 370 | /// </summary> |
364 | public override void Update() | 371 | public override void Update() |
365 | { | 372 | { |
366 | foreach (SceneObjectPart part in this.m_parts.Values) | 373 | foreach (SceneObjectPart part in m_parts.Values) |
367 | { | 374 | { |
368 | part.SendScheduledUpdates(); | 375 | part.SendScheduledUpdates(); |
369 | } | 376 | } |
@@ -371,7 +378,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
371 | 378 | ||
372 | public void ScheduleFullUpdateToAvatar(ScenePresence presence) | 379 | public void ScheduleFullUpdateToAvatar(ScenePresence presence) |
373 | { | 380 | { |
374 | foreach (SceneObjectPart part in this.m_parts.Values) | 381 | foreach (SceneObjectPart part in m_parts.Values) |
375 | { | 382 | { |
376 | part.AddFullUpdateToAvatar(presence); | 383 | part.AddFullUpdateToAvatar(presence); |
377 | } | 384 | } |
@@ -379,7 +386,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
379 | 386 | ||
380 | public void ScheduleTerseUpdateToAvatar(ScenePresence presence) | 387 | public void ScheduleTerseUpdateToAvatar(ScenePresence presence) |
381 | { | 388 | { |
382 | foreach (SceneObjectPart part in this.m_parts.Values) | 389 | foreach (SceneObjectPart part in m_parts.Values) |
383 | { | 390 | { |
384 | part.AddTerseUpdateToAvatar(presence); | 391 | part.AddTerseUpdateToAvatar(presence); |
385 | } | 392 | } |
@@ -391,7 +398,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
391 | public void ScheduleGroupForFullUpdate() | 398 | public void ScheduleGroupForFullUpdate() |
392 | { | 399 | { |
393 | HasChanged = true; | 400 | HasChanged = true; |
394 | foreach (SceneObjectPart part in this.m_parts.Values) | 401 | foreach (SceneObjectPart part in m_parts.Values) |
395 | { | 402 | { |
396 | part.ScheduleFullUpdate(); | 403 | part.ScheduleFullUpdate(); |
397 | } | 404 | } |
@@ -403,7 +410,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
403 | public void ScheduleGroupForTerseUpdate() | 410 | public void ScheduleGroupForTerseUpdate() |
404 | { | 411 | { |
405 | HasChanged = true; | 412 | HasChanged = true; |
406 | foreach (SceneObjectPart part in this.m_parts.Values) | 413 | foreach (SceneObjectPart part in m_parts.Values) |
407 | { | 414 | { |
408 | part.ScheduleTerseUpdate(); | 415 | part.ScheduleTerseUpdate(); |
409 | } | 416 | } |
@@ -415,7 +422,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
415 | public void SendGroupFullUpdate() | 422 | public void SendGroupFullUpdate() |
416 | { | 423 | { |
417 | HasChanged = true; | 424 | HasChanged = true; |
418 | foreach (SceneObjectPart part in this.m_parts.Values) | 425 | foreach (SceneObjectPart part in m_parts.Values) |
419 | { | 426 | { |
420 | part.SendFullUpdateToAllClients(); | 427 | part.SendFullUpdateToAllClients(); |
421 | } | 428 | } |
@@ -427,7 +434,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
427 | public void SendGroupTerseUpdate() | 434 | public void SendGroupTerseUpdate() |
428 | { | 435 | { |
429 | HasChanged = true; | 436 | HasChanged = true; |
430 | foreach (SceneObjectPart part in this.m_parts.Values) | 437 | foreach (SceneObjectPart part in m_parts.Values) |
431 | { | 438 | { |
432 | part.SendTerseUpdateToAllClients(); | 439 | part.SendTerseUpdateToAllClients(); |
433 | } | 440 | } |
@@ -436,6 +443,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
436 | #endregion | 443 | #endregion |
437 | 444 | ||
438 | #region SceneGroupPart Methods | 445 | #region SceneGroupPart Methods |
446 | |||
439 | /// <summary> | 447 | /// <summary> |
440 | /// | 448 | /// |
441 | /// </summary> | 449 | /// </summary> |
@@ -444,9 +452,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
444 | public SceneObjectPart GetChildPart(LLUUID primID) | 452 | public SceneObjectPart GetChildPart(LLUUID primID) |
445 | { | 453 | { |
446 | SceneObjectPart childPart = null; | 454 | SceneObjectPart childPart = null; |
447 | if (this.m_parts.ContainsKey(primID)) | 455 | if (m_parts.ContainsKey(primID)) |
448 | { | 456 | { |
449 | childPart = this.m_parts[primID]; | 457 | childPart = m_parts[primID]; |
450 | } | 458 | } |
451 | return childPart; | 459 | return childPart; |
452 | } | 460 | } |
@@ -458,7 +466,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
458 | /// <returns></returns> | 466 | /// <returns></returns> |
459 | public SceneObjectPart GetChildPart(uint localID) | 467 | public SceneObjectPart GetChildPart(uint localID) |
460 | { | 468 | { |
461 | foreach (SceneObjectPart part in this.m_parts.Values) | 469 | foreach (SceneObjectPart part in m_parts.Values) |
462 | { | 470 | { |
463 | if (part.LocalID == localID) | 471 | if (part.LocalID == localID) |
464 | { | 472 | { |
@@ -477,9 +485,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
477 | public bool HasChildPrim(LLUUID primID) | 485 | public bool HasChildPrim(LLUUID primID) |
478 | { | 486 | { |
479 | SceneObjectPart childPart = null; | 487 | SceneObjectPart childPart = null; |
480 | if (this.m_parts.ContainsKey(primID)) | 488 | if (m_parts.ContainsKey(primID)) |
481 | { | 489 | { |
482 | childPart = this.m_parts[primID]; | 490 | childPart = m_parts[primID]; |
483 | return true; | 491 | return true; |
484 | } | 492 | } |
485 | return false; | 493 | return false; |
@@ -493,7 +501,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
493 | /// <returns></returns> | 501 | /// <returns></returns> |
494 | public bool HasChildPrim(uint localID) | 502 | public bool HasChildPrim(uint localID) |
495 | { | 503 | { |
496 | foreach (SceneObjectPart part in this.m_parts.Values) | 504 | foreach (SceneObjectPart part in m_parts.Values) |
497 | { | 505 | { |
498 | if (part.LocalID == localID) | 506 | if (part.LocalID == localID) |
499 | { | 507 | { |
@@ -502,9 +510,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
502 | } | 510 | } |
503 | return false; | 511 | return false; |
504 | } | 512 | } |
513 | |||
505 | #endregion | 514 | #endregion |
506 | 515 | ||
507 | #region Packet Handlers | 516 | #region Packet Handlers |
517 | |||
508 | /// <summary> | 518 | /// <summary> |
509 | /// | 519 | /// |
510 | /// </summary> | 520 | /// </summary> |
@@ -512,21 +522,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
512 | public void LinkToGroup(SceneObjectGroup objectGroup) | 522 | public void LinkToGroup(SceneObjectGroup objectGroup) |
513 | { | 523 | { |
514 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 524 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
515 | Axiom.Math.Vector3 oldGroupPosition = new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z); | 525 | Vector3 oldGroupPosition = |
516 | Axiom.Math.Quaternion oldRootRotation = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z); | 526 | new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z); |
527 | Quaternion oldRootRotation = | ||
528 | new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, | ||
529 | linkPart.RotationOffset.Z); | ||
517 | 530 | ||
518 | linkPart.OffsetPosition = linkPart.GroupPosition - this.AbsolutePosition; | 531 | linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition; |
519 | linkPart.GroupPosition = this.AbsolutePosition; | 532 | linkPart.GroupPosition = AbsolutePosition; |
520 | 533 | ||
521 | Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); | 534 | Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); |
522 | Quaternion parentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); | 535 | Quaternion parentRot = |
523 | axPos = parentRot.Inverse() * axPos; | 536 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, |
537 | m_rootPart.RotationOffset.Z); | ||
538 | axPos = parentRot.Inverse()*axPos; | ||
524 | linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); | 539 | linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); |
525 | Quaternion oldRot = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z); | 540 | Quaternion oldRot = |
526 | Quaternion newRot = parentRot.Inverse() * oldRot; | 541 | new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, |
542 | linkPart.RotationOffset.Z); | ||
543 | Quaternion newRot = parentRot.Inverse()*oldRot; | ||
527 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | 544 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); |
528 | linkPart.ParentID = this.m_rootPart.LocalID; | 545 | linkPart.ParentID = m_rootPart.LocalID; |
529 | this.m_parts.Add(linkPart.UUID, linkPart); | 546 | m_parts.Add(linkPart.UUID, linkPart); |
530 | linkPart.SetParent(this); | 547 | linkPart.SetParent(this); |
531 | 548 | ||
532 | if (linkPart.PhysActor != null) | 549 | if (linkPart.PhysActor != null) |
@@ -540,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
540 | { | 557 | { |
541 | if (part.UUID != objectGroup.m_rootPart.UUID) | 558 | if (part.UUID != objectGroup.m_rootPart.UUID) |
542 | { | 559 | { |
543 | this.LinkNonRootPart(part, oldGroupPosition, oldRootRotation); | 560 | LinkNonRootPart(part, oldGroupPosition, oldRootRotation); |
544 | } | 561 | } |
545 | } | 562 | } |
546 | 563 | ||
@@ -549,7 +566,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
549 | m_scene.DeleteEntity(objectGroup.UUID); | 566 | m_scene.DeleteEntity(objectGroup.UUID); |
550 | 567 | ||
551 | objectGroup.DeleteParts(); | 568 | objectGroup.DeleteParts(); |
552 | this.ScheduleGroupForFullUpdate(); | 569 | ScheduleGroupForFullUpdate(); |
553 | } | 570 | } |
554 | 571 | ||
555 | private void DetachFromBackup(SceneObjectGroup objectGroup) | 572 | private void DetachFromBackup(SceneObjectGroup objectGroup) |
@@ -561,26 +578,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
561 | private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) | 578 | private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) |
562 | { | 579 | { |
563 | part.SetParent(this); | 580 | part.SetParent(this); |
564 | part.ParentID = this.m_rootPart.LocalID; | 581 | part.ParentID = m_rootPart.LocalID; |
565 | this.m_parts.Add(part.UUID, part); | 582 | m_parts.Add(part.UUID, part); |
566 | 583 | ||
567 | Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); | 584 | Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); |
568 | axiomOldPos = oldGroupRotation * axiomOldPos; | 585 | axiomOldPos = oldGroupRotation*axiomOldPos; |
569 | axiomOldPos += oldGroupPosition; | 586 | axiomOldPos += oldGroupPosition; |
570 | LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z); | 587 | LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z); |
571 | part.OffsetPosition = oldAbsolutePosition - this.AbsolutePosition; | 588 | part.OffsetPosition = oldAbsolutePosition - AbsolutePosition; |
572 | 589 | ||
573 | Quaternion axiomRootRotation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); | 590 | Quaternion axiomRootRotation = |
591 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, | ||
592 | m_rootPart.RotationOffset.Z); | ||
574 | 593 | ||
575 | Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); | 594 | Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); |
576 | axiomPos = axiomRootRotation.Inverse() * axiomPos; | 595 | axiomPos = axiomRootRotation.Inverse()*axiomPos; |
577 | part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z); | 596 | part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z); |
578 | 597 | ||
579 | Quaternion axiomPartRotation = new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z); | 598 | Quaternion axiomPartRotation = |
599 | new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y, | ||
600 | part.RotationOffset.Z); | ||
580 | 601 | ||
581 | axiomPartRotation = oldGroupRotation * axiomPartRotation; | 602 | axiomPartRotation = oldGroupRotation*axiomPartRotation; |
582 | axiomPartRotation = axiomRootRotation.Inverse() * axiomPartRotation; | 603 | axiomPartRotation = axiomRootRotation.Inverse()*axiomPartRotation; |
583 | part.RotationOffset = new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); | 604 | part.RotationOffset = |
605 | new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); | ||
584 | } | 606 | } |
585 | 607 | ||
586 | /// <summary> | 608 | /// <summary> |
@@ -591,8 +613,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
591 | /// <param name="remoteClient"></param> | 613 | /// <param name="remoteClient"></param> |
592 | public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | 614 | public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) |
593 | { | 615 | { |
594 | this.AbsolutePosition = pos; | 616 | AbsolutePosition = pos; |
595 | this.m_rootPart.SendTerseUpdateToAllClients(); | 617 | m_rootPart.SendTerseUpdateToAllClients(); |
596 | } | 618 | } |
597 | 619 | ||
598 | /// <summary> | 620 | /// <summary> |
@@ -605,25 +627,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
605 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | 627 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; |
606 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | 628 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); |
607 | proper.ObjectData[0].ItemID = LLUUID.Zero; | 629 | proper.ObjectData[0].ItemID = LLUUID.Zero; |
608 | proper.ObjectData[0].CreationDate = (ulong)this.m_rootPart.CreationDate; | 630 | proper.ObjectData[0].CreationDate = (ulong) m_rootPart.CreationDate; |
609 | proper.ObjectData[0].CreatorID = this.m_rootPart.CreatorID; | 631 | proper.ObjectData[0].CreatorID = m_rootPart.CreatorID; |
610 | proper.ObjectData[0].FolderID = LLUUID.Zero; | 632 | proper.ObjectData[0].FolderID = LLUUID.Zero; |
611 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | 633 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; |
612 | proper.ObjectData[0].GroupID = LLUUID.Zero; | 634 | proper.ObjectData[0].GroupID = LLUUID.Zero; |
613 | proper.ObjectData[0].InventorySerial = (short)this.m_rootPart.InventorySerial; | 635 | proper.ObjectData[0].InventorySerial = (short) m_rootPart.InventorySerial; |
614 | proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; | 636 | proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID; |
615 | proper.ObjectData[0].ObjectID = this.UUID; | 637 | proper.ObjectData[0].ObjectID = UUID; |
616 | proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; | 638 | proper.ObjectData[0].OwnerID = m_rootPart.OwnerID; |
617 | proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0"); | 639 | proper.ObjectData[0].TouchName = enc.GetBytes(m_rootPart.TouchName + "\0"); |
618 | proper.ObjectData[0].TextureID = new byte[0]; | 640 | proper.ObjectData[0].TextureID = new byte[0]; |
619 | proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0"); | 641 | proper.ObjectData[0].SitName = enc.GetBytes(m_rootPart.SitName + "\0"); |
620 | proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0"); | 642 | proper.ObjectData[0].Name = enc.GetBytes(m_rootPart.Name + "\0"); |
621 | proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0"); | 643 | proper.ObjectData[0].Description = enc.GetBytes(m_rootPart.Description + "\0"); |
622 | proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask; | 644 | proper.ObjectData[0].OwnerMask = m_rootPart.OwnerMask; |
623 | proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask; | 645 | proper.ObjectData[0].NextOwnerMask = m_rootPart.NextOwnerMask; |
624 | proper.ObjectData[0].GroupMask = this.m_rootPart.GroupMask; | 646 | proper.ObjectData[0].GroupMask = m_rootPart.GroupMask; |
625 | proper.ObjectData[0].EveryoneMask = this.m_rootPart.EveryoneMask; | 647 | proper.ObjectData[0].EveryoneMask = m_rootPart.EveryoneMask; |
626 | proper.ObjectData[0].BaseMask = this.m_rootPart.BaseMask; | 648 | proper.ObjectData[0].BaseMask = m_rootPart.BaseMask; |
627 | 649 | ||
628 | client.OutPacket(proper); | 650 | client.OutPacket(proper); |
629 | } | 651 | } |
@@ -635,7 +657,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
635 | public void SetPartName(string name, uint localID) | 657 | public void SetPartName(string name, uint localID) |
636 | { | 658 | { |
637 | name = name.Remove(name.Length - 1, 1); | 659 | name = name.Remove(name.Length - 1, 1); |
638 | SceneObjectPart part = this.GetChildPart(localID); | 660 | SceneObjectPart part = GetChildPart(localID); |
639 | if (part != null) | 661 | if (part != null) |
640 | { | 662 | { |
641 | part.Name = name; | 663 | part.Name = name; |
@@ -644,7 +666,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
644 | 666 | ||
645 | public void SetPartDescription(string des, uint localID) | 667 | public void SetPartDescription(string des, uint localID) |
646 | { | 668 | { |
647 | SceneObjectPart part = this.GetChildPart(localID); | 669 | SceneObjectPart part = GetChildPart(localID); |
648 | if (part != null) | 670 | if (part != null) |
649 | { | 671 | { |
650 | part.Description = des; | 672 | part.Description = des; |
@@ -653,7 +675,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
653 | 675 | ||
654 | public void SetPartText(string text, uint localID) | 676 | public void SetPartText(string text, uint localID) |
655 | { | 677 | { |
656 | SceneObjectPart part = this.GetChildPart(localID); | 678 | SceneObjectPart part = GetChildPart(localID); |
657 | if (part != null) | 679 | if (part != null) |
658 | { | 680 | { |
659 | part.Text = text; | 681 | part.Text = text; |
@@ -662,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
662 | 684 | ||
663 | public void SetPartText(string text, LLUUID partID) | 685 | public void SetPartText(string text, LLUUID partID) |
664 | { | 686 | { |
665 | SceneObjectPart part = this.GetChildPart(partID); | 687 | SceneObjectPart part = GetChildPart(partID); |
666 | if (part != null) | 688 | if (part != null) |
667 | { | 689 | { |
668 | part.Text = text; | 690 | part.Text = text; |
@@ -671,7 +693,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
671 | 693 | ||
672 | public string GetPartName(uint localID) | 694 | public string GetPartName(uint localID) |
673 | { | 695 | { |
674 | SceneObjectPart part = this.GetChildPart(localID); | 696 | SceneObjectPart part = GetChildPart(localID); |
675 | if (part != null) | 697 | if (part != null) |
676 | { | 698 | { |
677 | return part.Name; | 699 | return part.Name; |
@@ -681,7 +703,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
681 | 703 | ||
682 | public string GetPartDescription(uint localID) | 704 | public string GetPartDescription(uint localID) |
683 | { | 705 | { |
684 | SceneObjectPart part = this.GetChildPart(localID); | 706 | SceneObjectPart part = GetChildPart(localID); |
685 | if (part != null) | 707 | if (part != null) |
686 | { | 708 | { |
687 | return part.Description; | 709 | return part.Description; |
@@ -696,7 +718,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
696 | /// <param name="localID"></param> | 718 | /// <param name="localID"></param> |
697 | public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) | 719 | public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) |
698 | { | 720 | { |
699 | SceneObjectPart part = this.GetChildPart(localID); | 721 | SceneObjectPart part = GetChildPart(localID); |
700 | if (part != null) | 722 | if (part != null) |
701 | { | 723 | { |
702 | return part.GetInventoryFileName(remoteClient, localID); | 724 | return part.GetInventoryFileName(remoteClient, localID); |
@@ -706,7 +728,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
706 | 728 | ||
707 | public string RequestInventoryFile(uint localID, IXfer xferManager) | 729 | public string RequestInventoryFile(uint localID, IXfer xferManager) |
708 | { | 730 | { |
709 | SceneObjectPart part = this.GetChildPart(localID); | 731 | SceneObjectPart part = GetChildPart(localID); |
710 | if (part != null) | 732 | if (part != null) |
711 | { | 733 | { |
712 | part.RequestInventoryFile(xferManager); | 734 | part.RequestInventoryFile(xferManager); |
@@ -716,7 +738,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
716 | 738 | ||
717 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) | 739 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) |
718 | { | 740 | { |
719 | SceneObjectPart part = this.GetChildPart(localID); | 741 | SceneObjectPart part = GetChildPart(localID); |
720 | if (part != null) | 742 | if (part != null) |
721 | { | 743 | { |
722 | SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); | 744 | SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); |
@@ -732,14 +754,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
732 | return true; | 754 | return true; |
733 | } | 755 | } |
734 | return false; | 756 | return false; |
735 | |||
736 | } | 757 | } |
737 | 758 | ||
738 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) | 759 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) |
739 | { | 760 | { |
740 | if (copyItemID != LLUUID.Zero) | 761 | if (copyItemID != LLUUID.Zero) |
741 | { | 762 | { |
742 | SceneObjectPart part = this.GetChildPart(localID); | 763 | SceneObjectPart part = GetChildPart(localID); |
743 | if (part != null) | 764 | if (part != null) |
744 | { | 765 | { |
745 | SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); | 766 | SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); |
@@ -764,7 +785,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
764 | 785 | ||
765 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) | 786 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) |
766 | { | 787 | { |
767 | SceneObjectPart part = this.GetChildPart(localID); | 788 | SceneObjectPart part = GetChildPart(localID); |
768 | if (part != null) | 789 | if (part != null) |
769 | { | 790 | { |
770 | return part.RemoveInventoryItem(remoteClient, localID, itemID); | 791 | return part.RemoveInventoryItem(remoteClient, localID, itemID); |
@@ -781,7 +802,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
781 | /// <param name="data"></param> | 802 | /// <param name="data"></param> |
782 | public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) | 803 | public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) |
783 | { | 804 | { |
784 | SceneObjectPart part = this.GetChildPart(localID); | 805 | SceneObjectPart part = GetChildPart(localID); |
785 | if (part != null) | 806 | if (part != null) |
786 | { | 807 | { |
787 | part.UpdateExtraParam(type, inUse, data); | 808 | part.UpdateExtraParam(type, inUse, data); |
@@ -795,30 +816,34 @@ namespace OpenSim.Region.Environment.Scenes | |||
795 | /// <param name="textureEntry"></param> | 816 | /// <param name="textureEntry"></param> |
796 | public void UpdateTextureEntry(uint localID, byte[] textureEntry) | 817 | public void UpdateTextureEntry(uint localID, byte[] textureEntry) |
797 | { | 818 | { |
798 | SceneObjectPart part = this.GetChildPart(localID); | 819 | SceneObjectPart part = GetChildPart(localID); |
799 | if (part != null) | 820 | if (part != null) |
800 | { | 821 | { |
801 | part.UpdateTextureEntry(textureEntry); | 822 | part.UpdateTextureEntry(textureEntry); |
802 | } | 823 | } |
803 | } | 824 | } |
825 | |||
804 | #endregion | 826 | #endregion |
805 | 827 | ||
806 | #region Shape | 828 | #region Shape |
829 | |||
807 | /// <summary> | 830 | /// <summary> |
808 | /// | 831 | /// |
809 | /// </summary> | 832 | /// </summary> |
810 | /// <param name="shapeBlock"></param> | 833 | /// <param name="shapeBlock"></param> |
811 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID) | 834 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID) |
812 | { | 835 | { |
813 | SceneObjectPart part = this.GetChildPart(localID); | 836 | SceneObjectPart part = GetChildPart(localID); |
814 | if (part != null) | 837 | if (part != null) |
815 | { | 838 | { |
816 | part.UpdateShape(shapeBlock); | 839 | part.UpdateShape(shapeBlock); |
817 | } | 840 | } |
818 | } | 841 | } |
842 | |||
819 | #endregion | 843 | #endregion |
820 | 844 | ||
821 | #region Resize | 845 | #region Resize |
846 | |||
822 | /// <summary> | 847 | /// <summary> |
823 | /// | 848 | /// |
824 | /// </summary> | 849 | /// </summary> |
@@ -826,30 +851,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
826 | /// <param name="localID"></param> | 851 | /// <param name="localID"></param> |
827 | public void Resize(LLVector3 scale, uint localID) | 852 | public void Resize(LLVector3 scale, uint localID) |
828 | { | 853 | { |
829 | SceneObjectPart part = this.GetChildPart(localID); | 854 | SceneObjectPart part = GetChildPart(localID); |
830 | if (part != null) | 855 | if (part != null) |
831 | { | 856 | { |
832 | part.Resize(scale); | 857 | part.Resize(scale); |
833 | if (part.UUID == this.m_rootPart.UUID) | 858 | if (part.UUID == m_rootPart.UUID) |
834 | { | 859 | { |
835 | if (m_rootPart.PhysActor != null) | 860 | if (m_rootPart.PhysActor != null) |
836 | { | 861 | { |
837 | m_rootPart.PhysActor.Size = new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); | 862 | m_rootPart.PhysActor.Size = |
863 | new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); | ||
838 | } | 864 | } |
839 | } | 865 | } |
840 | } | 866 | } |
841 | } | 867 | } |
868 | |||
842 | #endregion | 869 | #endregion |
843 | 870 | ||
844 | #region Position | 871 | #region Position |
872 | |||
845 | /// <summary> | 873 | /// <summary> |
846 | /// | 874 | /// |
847 | /// </summary> | 875 | /// </summary> |
848 | /// <param name="pos"></param> | 876 | /// <param name="pos"></param> |
849 | public void UpdateGroupPosition(LLVector3 pos) | 877 | public void UpdateGroupPosition(LLVector3 pos) |
850 | { | 878 | { |
851 | this.AbsolutePosition = pos; | 879 | AbsolutePosition = pos; |
852 | this.ScheduleGroupForTerseUpdate(); | 880 | ScheduleGroupForTerseUpdate(); |
853 | } | 881 | } |
854 | 882 | ||
855 | /// <summary> | 883 | /// <summary> |
@@ -859,12 +887,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
859 | /// <param name="localID"></param> | 887 | /// <param name="localID"></param> |
860 | public void UpdateSinglePosition(LLVector3 pos, uint localID) | 888 | public void UpdateSinglePosition(LLVector3 pos, uint localID) |
861 | { | 889 | { |
862 | SceneObjectPart part = this.GetChildPart(localID); | 890 | SceneObjectPart part = GetChildPart(localID); |
863 | if (part != null) | 891 | if (part != null) |
864 | { | 892 | { |
865 | if (part.UUID == this.m_rootPart.UUID) | 893 | if (part.UUID == m_rootPart.UUID) |
866 | { | 894 | { |
867 | this.UpdateRootPosition(pos); | 895 | UpdateRootPosition(pos); |
868 | } | 896 | } |
869 | else | 897 | else |
870 | { | 898 | { |
@@ -880,40 +908,49 @@ namespace OpenSim.Region.Environment.Scenes | |||
880 | private void UpdateRootPosition(LLVector3 pos) | 908 | private void UpdateRootPosition(LLVector3 pos) |
881 | { | 909 | { |
882 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | 910 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); |
883 | LLVector3 oldPos = new LLVector3(this.AbsolutePosition.X + this.m_rootPart.OffsetPosition.X, this.AbsolutePosition.Y + this.m_rootPart.OffsetPosition.Y, this.AbsolutePosition.Z + this.m_rootPart.OffsetPosition.Z); | 911 | LLVector3 oldPos = |
912 | new LLVector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, | ||
913 | AbsolutePosition.Y + m_rootPart.OffsetPosition.Y, | ||
914 | AbsolutePosition.Z + m_rootPart.OffsetPosition.Z); | ||
884 | LLVector3 diff = oldPos - newPos; | 915 | LLVector3 diff = oldPos - newPos; |
885 | Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); | 916 | Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); |
886 | Axiom.Math.Quaternion partRotation = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); | 917 | Quaternion partRotation = |
887 | axDiff = partRotation.Inverse() * axDiff; | 918 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, |
919 | m_rootPart.RotationOffset.Z); | ||
920 | axDiff = partRotation.Inverse()*axDiff; | ||
888 | diff.X = axDiff.x; | 921 | diff.X = axDiff.x; |
889 | diff.Y = axDiff.y; | 922 | diff.Y = axDiff.y; |
890 | diff.Z = axDiff.z; | 923 | diff.Z = axDiff.z; |
891 | 924 | ||
892 | foreach (SceneObjectPart obPart in this.m_parts.Values) | 925 | foreach (SceneObjectPart obPart in m_parts.Values) |
893 | { | 926 | { |
894 | if (obPart.UUID != this.m_rootPart.UUID) | 927 | if (obPart.UUID != m_rootPart.UUID) |
895 | { | 928 | { |
896 | obPart.OffsetPosition = obPart.OffsetPosition + diff; | 929 | obPart.OffsetPosition = obPart.OffsetPosition + diff; |
897 | } | 930 | } |
898 | } | 931 | } |
899 | this.AbsolutePosition = newPos; | 932 | AbsolutePosition = newPos; |
900 | this.ScheduleGroupForTerseUpdate(); | 933 | ScheduleGroupForTerseUpdate(); |
901 | } | 934 | } |
935 | |||
902 | #endregion | 936 | #endregion |
903 | 937 | ||
904 | #region Rotation | 938 | #region Rotation |
939 | |||
905 | /// <summary> | 940 | /// <summary> |
906 | /// | 941 | /// |
907 | /// </summary> | 942 | /// </summary> |
908 | /// <param name="rot"></param> | 943 | /// <param name="rot"></param> |
909 | public void UpdateGroupRotation(LLQuaternion rot) | 944 | public void UpdateGroupRotation(LLQuaternion rot) |
910 | { | 945 | { |
911 | this.m_rootPart.UpdateRotation(rot); | 946 | m_rootPart.UpdateRotation(rot); |
912 | if (m_rootPart.PhysActor != null) | 947 | if (m_rootPart.PhysActor != null) |
913 | { | 948 | { |
914 | m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); | 949 | m_rootPart.PhysActor.Orientation = |
950 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, | ||
951 | m_rootPart.RotationOffset.Z); | ||
915 | } | 952 | } |
916 | this.ScheduleGroupForTerseUpdate(); | 953 | ScheduleGroupForTerseUpdate(); |
917 | } | 954 | } |
918 | 955 | ||
919 | /// <summary> | 956 | /// <summary> |
@@ -923,13 +960,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
923 | /// <param name="rot"></param> | 960 | /// <param name="rot"></param> |
924 | public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) | 961 | public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) |
925 | { | 962 | { |
926 | this.m_rootPart.UpdateRotation(rot); | 963 | m_rootPart.UpdateRotation(rot); |
927 | if (m_rootPart.PhysActor != null) | 964 | if (m_rootPart.PhysActor != null) |
928 | { | 965 | { |
929 | m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); | 966 | m_rootPart.PhysActor.Orientation = |
967 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, | ||
968 | m_rootPart.RotationOffset.Z); | ||
930 | } | 969 | } |
931 | this.AbsolutePosition = pos; | 970 | AbsolutePosition = pos; |
932 | this.ScheduleGroupForTerseUpdate(); | 971 | ScheduleGroupForTerseUpdate(); |
933 | } | 972 | } |
934 | 973 | ||
935 | /// <summary> | 974 | /// <summary> |
@@ -939,12 +978,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
939 | /// <param name="localID"></param> | 978 | /// <param name="localID"></param> |
940 | public void UpdateSingleRotation(LLQuaternion rot, uint localID) | 979 | public void UpdateSingleRotation(LLQuaternion rot, uint localID) |
941 | { | 980 | { |
942 | SceneObjectPart part = this.GetChildPart(localID); | 981 | SceneObjectPart part = GetChildPart(localID); |
943 | if (part != null) | 982 | if (part != null) |
944 | { | 983 | { |
945 | if (part.UUID == this.m_rootPart.UUID) | 984 | if (part.UUID == m_rootPart.UUID) |
946 | { | 985 | { |
947 | this.UpdateRootRotation(rot); | 986 | UpdateRootRotation(rot); |
948 | } | 987 | } |
949 | else | 988 | else |
950 | { | 989 | { |
@@ -959,40 +998,48 @@ namespace OpenSim.Region.Environment.Scenes | |||
959 | /// <param name="rot"></param> | 998 | /// <param name="rot"></param> |
960 | private void UpdateRootRotation(LLQuaternion rot) | 999 | private void UpdateRootRotation(LLQuaternion rot) |
961 | { | 1000 | { |
962 | Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); | 1001 | Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); |
963 | Axiom.Math.Quaternion oldParentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); | 1002 | Quaternion oldParentRot = |
1003 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, | ||
1004 | m_rootPart.RotationOffset.Z); | ||
964 | 1005 | ||
965 | this.m_rootPart.UpdateRotation(rot); | 1006 | m_rootPart.UpdateRotation(rot); |
966 | if (m_rootPart.PhysActor != null) | 1007 | if (m_rootPart.PhysActor != null) |
967 | { | 1008 | { |
968 | m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); | 1009 | m_rootPart.PhysActor.Orientation = |
1010 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, | ||
1011 | m_rootPart.RotationOffset.Z); | ||
969 | } | 1012 | } |
970 | 1013 | ||
971 | foreach (SceneObjectPart prim in this.m_parts.Values) | 1014 | foreach (SceneObjectPart prim in m_parts.Values) |
972 | { | 1015 | { |
973 | if (prim.UUID != this.m_rootPart.UUID) | 1016 | if (prim.UUID != m_rootPart.UUID) |
974 | { | 1017 | { |
975 | Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); | 1018 | Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); |
976 | axPos = oldParentRot * axPos; | 1019 | axPos = oldParentRot*axPos; |
977 | axPos = axRot.Inverse() * axPos; | 1020 | axPos = axRot.Inverse()*axPos; |
978 | prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); | 1021 | prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); |
979 | Axiom.Math.Quaternion primsRot = new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y, prim.RotationOffset.Z); | 1022 | Quaternion primsRot = |
980 | Axiom.Math.Quaternion newRot = oldParentRot * primsRot; | 1023 | new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y, |
981 | newRot = axRot.Inverse() * newRot; | 1024 | prim.RotationOffset.Z); |
1025 | Quaternion newRot = oldParentRot*primsRot; | ||
1026 | newRot = axRot.Inverse()*newRot; | ||
982 | prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | 1027 | prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); |
983 | prim.ScheduleTerseUpdate(); | 1028 | prim.ScheduleTerseUpdate(); |
984 | } | 1029 | } |
985 | } | 1030 | } |
986 | this.m_rootPart.ScheduleTerseUpdate(); | 1031 | m_rootPart.ScheduleTerseUpdate(); |
987 | } | 1032 | } |
1033 | |||
988 | #endregion | 1034 | #endregion |
1035 | |||
989 | /// <summary> | 1036 | /// <summary> |
990 | /// | 1037 | /// |
991 | /// </summary> | 1038 | /// </summary> |
992 | /// <param name="part"></param> | 1039 | /// <param name="part"></param> |
993 | private void SetPartAsRoot(SceneObjectPart part) | 1040 | private void SetPartAsRoot(SceneObjectPart part) |
994 | { | 1041 | { |
995 | this.m_rootPart = part; | 1042 | m_rootPart = part; |
996 | } | 1043 | } |
997 | 1044 | ||
998 | /// <summary> | 1045 | /// <summary> |
@@ -1001,7 +1048,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1001 | /// <param name="part"></param> | 1048 | /// <param name="part"></param> |
1002 | private void SetPartAsNonRoot(SceneObjectPart part) | 1049 | private void SetPartAsNonRoot(SceneObjectPart part) |
1003 | { | 1050 | { |
1004 | part.ParentID = this.m_rootPart.LocalID; | 1051 | part.ParentID = m_rootPart.LocalID; |
1005 | } | 1052 | } |
1006 | 1053 | ||
1007 | /// <summary> | 1054 | /// <summary> |
@@ -1014,6 +1061,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1014 | } | 1061 | } |
1015 | 1062 | ||
1016 | #region Events | 1063 | #region Events |
1064 | |||
1017 | /// <summary> | 1065 | /// <summary> |
1018 | /// | 1066 | /// |
1019 | /// </summary> | 1067 | /// </summary> |
@@ -1021,7 +1069,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1021 | { | 1069 | { |
1022 | if (OnPrimCountTainted != null) | 1070 | if (OnPrimCountTainted != null) |
1023 | { | 1071 | { |
1024 | this.OnPrimCountTainted(); | 1072 | OnPrimCountTainted(); |
1025 | } | 1073 | } |
1026 | } | 1074 | } |
1027 | 1075 | ||
@@ -1029,7 +1077,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1029 | /// Processes backup | 1077 | /// Processes backup |
1030 | /// </summary> | 1078 | /// </summary> |
1031 | /// <param name="datastore"></param> | 1079 | /// <param name="datastore"></param> |
1032 | public void ProcessBackup(OpenSim.Region.Environment.Interfaces.IRegionDataStore datastore) | 1080 | public void ProcessBackup(IRegionDataStore datastore) |
1033 | { | 1081 | { |
1034 | if (HasChanged) | 1082 | if (HasChanged) |
1035 | { | 1083 | { |
@@ -1037,16 +1085,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1037 | HasChanged = false; | 1085 | HasChanged = false; |
1038 | } | 1086 | } |
1039 | } | 1087 | } |
1088 | |||
1040 | #endregion | 1089 | #endregion |
1041 | 1090 | ||
1042 | #region Client Updating | 1091 | #region Client Updating |
1092 | |||
1043 | public void SendFullUpdateToClient(IClientAPI remoteClient) | 1093 | public void SendFullUpdateToClient(IClientAPI remoteClient) |
1044 | { | 1094 | { |
1045 | lock (this.m_parts) | 1095 | lock (m_parts) |
1046 | { | 1096 | { |
1047 | foreach (SceneObjectPart part in this.m_parts.Values) | 1097 | foreach (SceneObjectPart part in m_parts.Values) |
1048 | { | 1098 | { |
1049 | this.SendPartFullUpdate(remoteClient, part); | 1099 | SendPartFullUpdate(remoteClient, part); |
1050 | } | 1100 | } |
1051 | } | 1101 | } |
1052 | } | 1102 | } |
@@ -1084,6 +1134,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1084 | part.SendTerseUpdateToClient(remoteClient); | 1134 | part.SendTerseUpdateToClient(remoteClient); |
1085 | } | 1135 | } |
1086 | } | 1136 | } |
1137 | |||
1087 | #endregion | 1138 | #endregion |
1088 | 1139 | ||
1089 | public override void UpdateMovement() | 1140 | public override void UpdateMovement() |
@@ -1114,7 +1165,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1114 | public void AddPart(SceneObjectPart part) | 1165 | public void AddPart(SceneObjectPart part) |
1115 | { | 1166 | { |
1116 | part.SetParent(this); | 1167 | part.SetParent(this); |
1117 | this.m_parts.Add(part.UUID, part); | 1168 | m_parts.Add(part.UUID, part); |
1118 | } | 1169 | } |
1119 | 1170 | ||
1120 | /// <summary> | 1171 | /// <summary> |
@@ -1122,18 +1173,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1122 | /// </summary> | 1173 | /// </summary> |
1123 | public void UpdateParentIDs() | 1174 | public void UpdateParentIDs() |
1124 | { | 1175 | { |
1125 | foreach (SceneObjectPart part in this.m_parts.Values) | 1176 | foreach (SceneObjectPart part in m_parts.Values) |
1126 | { | 1177 | { |
1127 | if (part.UUID != this.m_rootPart.UUID) | 1178 | if (part.UUID != m_rootPart.UUID) |
1128 | { | 1179 | { |
1129 | part.ParentID = this.m_rootPart.LocalID; | 1180 | part.ParentID = m_rootPart.LocalID; |
1130 | } | 1181 | } |
1131 | } | 1182 | } |
1132 | } | 1183 | } |
1133 | 1184 | ||
1134 | public void RegenerateFullIDs() | 1185 | public void RegenerateFullIDs() |
1135 | { | 1186 | { |
1136 | foreach (SceneObjectPart part in this.m_parts.Values) | 1187 | foreach (SceneObjectPart part in m_parts.Values) |
1137 | { | 1188 | { |
1138 | part.UUID = LLUUID.Random(); | 1189 | part.UUID = LLUUID.Random(); |
1139 | } | 1190 | } |
@@ -1141,7 +1192,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1141 | 1192 | ||
1142 | public LLUUID GetPartsFullID(uint localID) | 1193 | public LLUUID GetPartsFullID(uint localID) |
1143 | { | 1194 | { |
1144 | SceneObjectPart part = this.GetChildPart(localID); | 1195 | SceneObjectPart part = GetChildPart(localID); |
1145 | if (part != null) | 1196 | if (part != null) |
1146 | { | 1197 | { |
1147 | return part.UUID; | 1198 | return part.UUID; |
@@ -1175,26 +1226,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1175 | 1226 | ||
1176 | public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) | 1227 | public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) |
1177 | { | 1228 | { |
1178 | |||
1179 | } | 1229 | } |
1180 | 1230 | ||
1181 | public void DeleteGroup() | 1231 | public void DeleteGroup() |
1182 | { | 1232 | { |
1183 | DetachFromBackup( this ); | 1233 | DetachFromBackup(this); |
1184 | foreach (SceneObjectPart part in this.m_parts.Values) | 1234 | foreach (SceneObjectPart part in m_parts.Values) |
1185 | { | 1235 | { |
1186 | List<ScenePresence> avatars = this.RequestSceneAvatars(); | 1236 | List<ScenePresence> avatars = RequestSceneAvatars(); |
1187 | for (int i = 0; i < avatars.Count; i++) | 1237 | for (int i = 0; i < avatars.Count; i++) |
1188 | { | 1238 | { |
1189 | avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, part.LocalID); | 1239 | avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalID); |
1190 | } | 1240 | } |
1191 | } | 1241 | } |
1192 | } | 1242 | } |
1193 | 1243 | ||
1194 | public void DeleteParts() | 1244 | public void DeleteParts() |
1195 | { | 1245 | { |
1196 | this.m_rootPart = null; | 1246 | m_rootPart = null; |
1197 | this.m_parts.Clear(); | 1247 | m_parts.Clear(); |
1198 | } | 1248 | } |
1199 | 1249 | ||
1200 | public override void SetText(string text, Vector3 color, double alpha) | 1250 | public override void SetText(string text, Vector3 color, double alpha) |
@@ -1202,4 +1252,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
1202 | Text = text; | 1252 | Text = text; |
1203 | } | 1253 | } |
1204 | } | 1254 | } |
1205 | } | 1255 | } \ No newline at end of file |