diff options
author | Justin Clark-Casey (justincc) | 2011-08-27 00:15:21 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-27 00:15:21 +0100 |
commit | 33a894f3d2cc95a7a512b86f39f3c6a6afabb015 (patch) | |
tree | 064edbd623ea0bd7bb85c29dc28d2348feb8454b /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | refactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar (diff) | |
download | opensim-SC_OLD-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.zip opensim-SC_OLD-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.gz opensim-SC_OLD-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.bz2 opensim-SC_OLD-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.xz |
refactor: move SOP.IsAttachment and AttachmentPoint up into SOG to avoid pointless duplication of identical values
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 44 |
1 files changed, 19 insertions, 25 deletions
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 | |||
146 | return true; | 146 | return true; |
147 | return false; | 147 | return false; |
148 | } | 148 | } |
149 | 149 | ||
150 | /// <summary> | 150 | /// <summary> |
151 | /// Is this scene object acting as an attachment? | 151 | /// Is this scene object acting as an attachment? |
152 | /// </summary> | 152 | /// </summary> |
153 | /// <remarks> | 153 | public bool IsAttachment { get; set; } |
154 | /// We return false if the group has already been deleted. | ||
155 | /// | ||
156 | /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I | ||
157 | /// presume either all or no parts in a linkset can be part of an attachment (in which | ||
158 | /// case the value would get proprogated down into all the descendent parts). | ||
159 | /// </remarks> | ||
160 | public bool IsAttachment | ||
161 | { | ||
162 | get | ||
163 | { | ||
164 | if (!IsDeleted) | ||
165 | return m_rootPart.IsAttachment; | ||
166 | |||
167 | return false; | ||
168 | } | ||
169 | } | ||
170 | 154 | ||
171 | /// <summary> | 155 | /// <summary> |
172 | /// The avatar to which this scene object is attached. | 156 | /// The avatar to which this scene object is attached. |
@@ -177,6 +161,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
177 | public UUID AttachedAvatar { get; set; } | 161 | public UUID AttachedAvatar { get; set; } |
178 | 162 | ||
179 | /// <summary> | 163 | /// <summary> |
164 | /// Attachment point of this scene object to an avatar. | ||
165 | /// </summary> | ||
166 | /// <remarks> | ||
167 | /// 0 if we're not attached to anything | ||
168 | /// </remarks> | ||
169 | public uint AttachmentPoint; | ||
170 | |||
171 | /// <summary> | ||
180 | /// Is this scene object phantom? | 172 | /// Is this scene object phantom? |
181 | /// </summary> | 173 | /// </summary> |
182 | /// <remarks> | 174 | /// <remarks> |
@@ -354,11 +346,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
354 | /// <summary> | 346 | /// <summary> |
355 | /// Check both the attachment property and the relevant properties of the underlying root part. | 347 | /// Check both the attachment property and the relevant properties of the underlying root part. |
356 | /// </summary> | 348 | /// </summary> |
349 | /// <remarks> | ||
357 | /// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't | 350 | /// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't |
358 | /// have the IsAttachment property yet checked. | 351 | /// have the IsAttachment property yet checked. |
359 | /// | 352 | /// |
360 | /// FIXME: However, this should be fixed so that this property | 353 | /// FIXME: However, this should be fixed so that this property |
361 | /// propertly reflects the underlying status. | 354 | /// propertly reflects the underlying status. |
355 | /// </remarks> | ||
362 | /// <returns></returns> | 356 | /// <returns></returns> |
363 | public bool IsAttachmentCheckFull() | 357 | public bool IsAttachmentCheckFull() |
364 | { | 358 | { |
@@ -987,11 +981,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
987 | return m_rootPart.Shape.State; | 981 | return m_rootPart.Shape.State; |
988 | } | 982 | } |
989 | 983 | ||
990 | public void SetAttachmentPoint(byte point) | 984 | public void SetAttachmentPoint(uint point) |
991 | { | 985 | { |
992 | SceneObjectPart[] parts = m_parts.GetArray(); | 986 | AttachmentPoint = point; |
993 | for (int i = 0; i < parts.Length; i++) | 987 | IsAttachment = point != 0; |
994 | parts[i].SetAttachmentPoint(point); | 988 | m_rootPart.Shape.State = (byte)point; |
995 | } | 989 | } |
996 | 990 | ||
997 | public void ClearPartAttachmentData() | 991 | public void ClearPartAttachmentData() |
@@ -1424,16 +1418,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1424 | 1418 | ||
1425 | // This is only necessary when userExposed is false! | 1419 | // This is only necessary when userExposed is false! |
1426 | 1420 | ||
1427 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; | 1421 | bool previousAttachmentStatus = dupe.IsAttachment; |
1428 | 1422 | ||
1429 | if (!userExposed) | 1423 | if (!userExposed) |
1430 | dupe.RootPart.IsAttachment = true; | 1424 | dupe.IsAttachment = true; |
1431 | 1425 | ||
1432 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 1426 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
1433 | 1427 | ||
1434 | if (!userExposed) | 1428 | if (!userExposed) |
1435 | { | 1429 | { |
1436 | dupe.RootPart.IsAttachment = previousAttachmentStatus; | 1430 | dupe.IsAttachment = previousAttachmentStatus; |
1437 | } | 1431 | } |
1438 | 1432 | ||
1439 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 1433 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |