From 33a894f3d2cc95a7a512b86f39f3c6a6afabb015 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 27 Aug 2011 00:15:21 +0100
Subject: refactor: move SOP.IsAttachment and AttachmentPoint up into SOG to
avoid pointless duplication of identical values
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 44 ++++++++++------------
1 file changed, 19 insertions(+), 25 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index fada688..34f484d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -146,27 +146,11 @@ namespace OpenSim.Region.Framework.Scenes
return true;
return false;
}
-
+
///
/// Is this scene object acting as an attachment?
///
- ///
- /// We return false if the group has already been deleted.
- ///
- /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I
- /// presume either all or no parts in a linkset can be part of an attachment (in which
- /// case the value would get proprogated down into all the descendent parts).
- ///
- public bool IsAttachment
- {
- get
- {
- if (!IsDeleted)
- return m_rootPart.IsAttachment;
-
- return false;
- }
- }
+ public bool IsAttachment { get; set; }
///
/// The avatar to which this scene object is attached.
@@ -177,6 +161,14 @@ namespace OpenSim.Region.Framework.Scenes
public UUID AttachedAvatar { get; set; }
///
+ /// Attachment point of this scene object to an avatar.
+ ///
+ ///
+ /// 0 if we're not attached to anything
+ ///
+ public uint AttachmentPoint;
+
+ ///
/// Is this scene object phantom?
///
///
@@ -354,11 +346,13 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Check both the attachment property and the relevant properties of the underlying root part.
///
+ ///
/// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't
/// have the IsAttachment property yet checked.
///
/// FIXME: However, this should be fixed so that this property
/// propertly reflects the underlying status.
+ ///
///
public bool IsAttachmentCheckFull()
{
@@ -987,11 +981,11 @@ namespace OpenSim.Region.Framework.Scenes
return m_rootPart.Shape.State;
}
- public void SetAttachmentPoint(byte point)
+ public void SetAttachmentPoint(uint point)
{
- SceneObjectPart[] parts = m_parts.GetArray();
- for (int i = 0; i < parts.Length; i++)
- parts[i].SetAttachmentPoint(point);
+ AttachmentPoint = point;
+ IsAttachment = point != 0;
+ m_rootPart.Shape.State = (byte)point;
}
public void ClearPartAttachmentData()
@@ -1424,16 +1418,16 @@ namespace OpenSim.Region.Framework.Scenes
// This is only necessary when userExposed is false!
- bool previousAttachmentStatus = dupe.RootPart.IsAttachment;
+ bool previousAttachmentStatus = dupe.IsAttachment;
if (!userExposed)
- dupe.RootPart.IsAttachment = true;
+ dupe.IsAttachment = true;
dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
if (!userExposed)
{
- dupe.RootPart.IsAttachment = previousAttachmentStatus;
+ dupe.IsAttachment = previousAttachmentStatus;
}
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
--
cgit v1.1
From 1615e7d29fb6961a3ffe791fde4318f819c1a4b7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 27 Aug 2011 00:33:24 +0100
Subject: Eliminate duplicate AttachmentPoint properties by always using the
one stored in the root part's state field.
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 36 +++++++++++-----------
1 file changed, 18 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 34f484d..c453366 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -166,7 +166,24 @@ namespace OpenSim.Region.Framework.Scenes
///
/// 0 if we're not attached to anything
///
- public uint AttachmentPoint;
+ public uint AttachmentPoint
+ {
+ get
+ {
+ return m_rootPart.Shape.State;
+ }
+
+ set
+ {
+ IsAttachment = value != 0;
+ m_rootPart.Shape.State = (byte)value;
+ }
+ }
+
+ public void ClearPartAttachmentData()
+ {
+ AttachmentPoint = 0;
+ }
///
/// Is this scene object phantom?
@@ -976,23 +993,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public byte GetAttachmentPoint()
- {
- return m_rootPart.Shape.State;
- }
-
- public void SetAttachmentPoint(uint point)
- {
- AttachmentPoint = point;
- IsAttachment = point != 0;
- m_rootPart.Shape.State = (byte)point;
- }
-
- public void ClearPartAttachmentData()
- {
- SetAttachmentPoint((Byte)0);
- }
-
///
///
///
--
cgit v1.1