aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs110
1 files changed, 28 insertions, 82 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 6ba7e41..3c17bbe 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -250,16 +250,7 @@ namespace OpenSim.Region.Framework.Scenes
250 /// </summary> 250 /// </summary>
251 public override Vector3 AbsolutePosition 251 public override Vector3 AbsolutePosition
252 { 252 {
253 get 253 get { return m_rootPart.GroupPosition; }
254 {
255 if (m_rootPart == null)
256 {
257 throw new NullReferenceException(
258 string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid));
259 }
260
261 return m_rootPart.GroupPosition;
262 }
263 set 254 set
264 { 255 {
265 Vector3 val = value; 256 Vector3 val = value;
@@ -291,41 +282,19 @@ namespace OpenSim.Region.Framework.Scenes
291 282
292 public override uint LocalId 283 public override uint LocalId
293 { 284 {
294 get 285 get { return m_rootPart.LocalId; }
295 {
296 if (m_rootPart == null)
297 {
298 m_log.Error("[SCENE OBJECT GROUP]: Unable to find the rootpart for a LocalId Request!");
299 return 0;
300 }
301
302 return m_rootPart.LocalId;
303 }
304 set { m_rootPart.LocalId = value; } 286 set { m_rootPart.LocalId = value; }
305 } 287 }
306 288
307 public override UUID UUID 289 public override UUID UUID
308 { 290 {
309 get { 291 get { return m_rootPart.UUID; }
310 if (m_rootPart == null)
311 {
312 m_log.Error("Got a null rootpart while requesting UUID. Called from: ", new Exception());
313 return UUID.Zero;
314 }
315 else return m_rootPart.UUID;
316 }
317 set { m_rootPart.UUID = value; } 292 set { m_rootPart.UUID = value; }
318 } 293 }
319 294
320 public UUID OwnerID 295 public UUID OwnerID
321 { 296 {
322 get 297 get { return m_rootPart.OwnerID; }
323 {
324 if (m_rootPart == null)
325 return UUID.Zero;
326
327 return m_rootPart.OwnerID;
328 }
329 set { m_rootPart.OwnerID = value; } 298 set { m_rootPart.OwnerID = value; }
330 } 299 }
331 300
@@ -366,7 +335,7 @@ namespace OpenSim.Region.Framework.Scenes
366 { 335 {
367 m_isSelected = value; 336 m_isSelected = value;
368 // Tell physics engine that group is selected 337 // Tell physics engine that group is selected
369 if (m_rootPart != null && m_rootPart.PhysActor != null) 338 if (m_rootPart.PhysActor != null)
370 { 339 {
371 m_rootPart.PhysActor.Selected = value; 340 m_rootPart.PhysActor.Selected = value;
372 // Pass it on to the children. 341 // Pass it on to the children.
@@ -399,13 +368,6 @@ namespace OpenSim.Region.Framework.Scenes
399 #region Constructors 368 #region Constructors
400 369
401 /// <summary> 370 /// <summary>
402 /// Constructor
403 /// </summary>
404 public SceneObjectGroup()
405 {
406 }
407
408 /// <summary>
409 /// This constructor creates a SceneObjectGroup using a pre-existing SceneObjectPart. 371 /// This constructor creates a SceneObjectGroup using a pre-existing SceneObjectPart.
410 /// The original SceneObjectPart will be used rather than a copy, preserving 372 /// The original SceneObjectPart will be used rather than a copy, preserving
411 /// its existing localID and UUID. 373 /// its existing localID and UUID.
@@ -419,9 +381,8 @@ namespace OpenSim.Region.Framework.Scenes
419 /// Constructor. This object is added to the scene later via AttachToScene() 381 /// Constructor. This object is added to the scene later via AttachToScene()
420 /// </summary> 382 /// </summary>
421 public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) 383 public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
422 { 384 {
423 Vector3 rootOffset = new Vector3(0, 0, 0); 385 SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero));
424 SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, rootOffset));
425 } 386 }
426 387
427 /// <summary> 388 /// <summary>
@@ -462,11 +423,7 @@ namespace OpenSim.Region.Framework.Scenes
462 423
463 public UUID GetFromItemID() 424 public UUID GetFromItemID()
464 { 425 {
465 if (m_rootPart != null) 426 return m_rootPart.FromItemID;
466 {
467 return m_rootPart.FromItemID;
468 }
469 return UUID.Zero;
470 } 427 }
471 428
472 /// <summary> 429 /// <summary>
@@ -958,11 +915,7 @@ namespace OpenSim.Region.Framework.Scenes
958 915
959 public byte GetAttachmentPoint() 916 public byte GetAttachmentPoint()
960 { 917 {
961 if (m_rootPart != null) 918 return m_rootPart.Shape.State;
962 {
963 return m_rootPart.Shape.State;
964 }
965 return (byte)0;
966 } 919 }
967 920
968 public void ClearPartAttachmentData() 921 public void ClearPartAttachmentData()
@@ -1071,7 +1024,10 @@ namespace OpenSim.Region.Framework.Scenes
1071 /// </summary> 1024 /// </summary>
1072 /// <param name="part"></param> 1025 /// <param name="part"></param>
1073 public void SetRootPart(SceneObjectPart part) 1026 public void SetRootPart(SceneObjectPart part)
1074 { 1027 {
1028 if (part == null)
1029 throw new ArgumentNullException("Cannot give SceneObjectGroup a null root SceneObjectPart");
1030
1075 part.SetParent(this); 1031 part.SetParent(this);
1076 m_rootPart = part; 1032 m_rootPart = part;
1077 if (!IsAttachment) 1033 if (!IsAttachment)
@@ -1224,7 +1180,7 @@ namespace OpenSim.Region.Framework.Scenes
1224 1180
1225 if (!silent) 1181 if (!silent)
1226 { 1182 {
1227 if (m_rootPart != null && part == m_rootPart) 1183 if (part == m_rootPart)
1228 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); 1184 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId);
1229 } 1185 }
1230 } 1186 }
@@ -1447,7 +1403,7 @@ namespace OpenSim.Region.Framework.Scenes
1447 /// <param name="part"></param> 1403 /// <param name="part"></param>
1448 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) 1404 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
1449 { 1405 {
1450 if (m_rootPart != null && m_rootPart.UUID == part.UUID) 1406 if (m_rootPart.UUID == part.UUID)
1451 { 1407 {
1452 if (IsAttachment) 1408 if (IsAttachment)
1453 { 1409 {
@@ -1881,12 +1837,6 @@ namespace OpenSim.Region.Framework.Scenes
1881 if (m_isDeleted) 1837 if (m_isDeleted)
1882 return; 1838 return;
1883 1839
1884 // This is what happens when an orphanced link set child prim's
1885 // group was queued when it was linked
1886 //
1887 if (m_rootPart == null)
1888 return;
1889
1890 // Even temporary objects take part in physics (e.g. temp-on-rez bullets) 1840 // Even temporary objects take part in physics (e.g. temp-on-rez bullets)
1891 //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) 1841 //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
1892 // return; 1842 // return;
@@ -3129,26 +3079,22 @@ namespace OpenSim.Region.Framework.Scenes
3129 int yaxis = 4; 3079 int yaxis = 4;
3130 int zaxis = 8; 3080 int zaxis = 8;
3131 3081
3132 if (m_rootPart != null) 3082 setX = ((axis & xaxis) != 0) ? true : false;
3133 { 3083 setY = ((axis & yaxis) != 0) ? true : false;
3134 setX = ((axis & xaxis) != 0) ? true : false; 3084 setZ = ((axis & zaxis) != 0) ? true : false;
3135 setY = ((axis & yaxis) != 0) ? true : false;
3136 setZ = ((axis & zaxis) != 0) ? true : false;
3137 3085
3138 float setval = (rotate10 > 0) ? 1f : 0f; 3086 float setval = (rotate10 > 0) ? 1f : 0f;
3139 3087
3140 if (setX) 3088 if (setX)
3141 m_rootPart.RotationAxis.X = setval; 3089 m_rootPart.RotationAxis.X = setval;
3142 if (setY) 3090 if (setY)
3143 m_rootPart.RotationAxis.Y = setval; 3091 m_rootPart.RotationAxis.Y = setval;
3144 if (setZ) 3092 if (setZ)
3145 m_rootPart.RotationAxis.Z = setval; 3093 m_rootPart.RotationAxis.Z = setval;
3146
3147 if (setX || setY || setZ)
3148 {
3149 m_rootPart.SetPhysicsAxisRotation();
3150 }
3151 3094
3095 if (setX || setY || setZ)
3096 {
3097 m_rootPart.SetPhysicsAxisRotation();
3152 } 3098 }
3153 } 3099 }
3154 3100