aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-27 00:15:21 +0100
committerJustin Clark-Casey (justincc)2011-08-27 00:15:21 +0100
commit33a894f3d2cc95a7a512b86f39f3c6a6afabb015 (patch)
tree064edbd623ea0bd7bb85c29dc28d2348feb8454b /OpenSim/Region/Framework/Scenes
parentrefactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar (diff)
downloadopensim-SC-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.zip
opensim-SC-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.gz
opensim-SC-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.bz2
opensim-SC-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')
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs3
7 files changed, 42 insertions, 73 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 2a76755..33407ec 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes
122 if (entity is SceneObjectPart) 122 if (entity is SceneObjectPart)
123 { 123 {
124 SceneObjectPart sop = (SceneObjectPart)entity; 124 SceneObjectPart sop = (SceneObjectPart)entity;
125 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) 125 if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
126 return 1; 126 return 1;
127 } 127 }
128 128
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes
135 if (entity is SceneObjectPart) 135 if (entity is SceneObjectPart)
136 { 136 {
137 SceneObjectPart sop = (SceneObjectPart)entity; 137 SceneObjectPart sop = (SceneObjectPart)entity;
138 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) 138 if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
139 return 1; 139 return 1;
140 } 140 }
141 141
@@ -148,7 +148,7 @@ namespace OpenSim.Region.Framework.Scenes
148 if (entity is SceneObjectPart) 148 if (entity is SceneObjectPart)
149 { 149 {
150 SceneObjectPart sop = (SceneObjectPart)entity; 150 SceneObjectPart sop = (SceneObjectPart)entity;
151 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) 151 if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
152 return 1; 152 return 1;
153 } 153 }
154 154
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes
171 if (entity is SceneObjectPart) 171 if (entity is SceneObjectPart)
172 { 172 {
173 // Attachments are high priority, 173 // Attachments are high priority,
174 if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) 174 if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
175 return 1; 175 return 1;
176 176
177 // Non physical prims are lower priority than physical prims 177 // Non physical prims are lower priority than physical prims
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 513c0ea..45d1a0e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4223,7 +4223,7 @@ namespace OpenSim.Region.Framework.Scenes
4223 // their scripts will actually run. 4223 // their scripts will actually run.
4224 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 4224 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008
4225 SceneObjectPart parent = part.ParentGroup.RootPart; 4225 SceneObjectPart parent = part.ParentGroup.RootPart;
4226 if (parent != null && parent.IsAttachment) 4226 if (parent != null && part.ParentGroup.IsAttachment)
4227 return ScriptDanger(parent, parent.GetWorldPosition()); 4227 return ScriptDanger(parent, parent.GetWorldPosition());
4228 else 4228 else
4229 return ScriptDanger(part, part.GetWorldPosition()); 4229 return ScriptDanger(part, part.GetWorldPosition());
@@ -5030,7 +5030,7 @@ namespace OpenSim.Region.Framework.Scenes
5030 delete = true; 5030 delete = true;
5031 } 5031 }
5032 5032
5033 if (delete && !rootPart.IsAttachment && !deletes.Contains(g)) 5033 if (delete && !g.IsAttachment && !deletes.Contains(g))
5034 deletes.Add(g); 5034 deletes.Add(g);
5035 }); 5035 });
5036 break; 5036 break;
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);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e510611..71023a9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -213,10 +213,7 @@ namespace OpenSim.Region.Framework.Scenes
213 { 213 {
214 get { return m_fromUserInventoryItemID; } 214 get { return m_fromUserInventoryItemID; }
215 } 215 }
216
217 216
218 public bool IsAttachment;
219
220 217
221 public scriptEvents AggregateScriptEvents; 218 public scriptEvents AggregateScriptEvents;
222 219
@@ -224,9 +221,6 @@ namespace OpenSim.Region.Framework.Scenes
224 public Vector3 AttachedPos; 221 public Vector3 AttachedPos;
225 222
226 223
227 public uint AttachmentPoint;
228
229
230 public Vector3 RotationAxis = Vector3.One; 224 public Vector3 RotationAxis = Vector3.One;
231 225
232 226
@@ -723,7 +717,7 @@ namespace OpenSim.Region.Framework.Scenes
723 m_groupPosition = actor.Position; 717 m_groupPosition = actor.Position;
724 } 718 }
725 719
726 if (IsAttachment) 720 if (m_parentGroup.IsAttachment)
727 { 721 {
728 ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); 722 ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
729 if (sp != null) 723 if (sp != null)
@@ -807,7 +801,7 @@ namespace OpenSim.Region.Framework.Scenes
807 { 801 {
808 if (IsRoot) 802 if (IsRoot)
809 { 803 {
810 if (IsAttachment) 804 if (m_parentGroup.IsAttachment)
811 return AttachedPos; 805 return AttachedPos;
812 else 806 else
813 return AbsolutePosition; 807 return AbsolutePosition;
@@ -1090,7 +1084,7 @@ namespace OpenSim.Region.Framework.Scenes
1090 { 1084 {
1091 get 1085 get
1092 { 1086 {
1093 if (IsAttachment) 1087 if (m_parentGroup.IsAttachment)
1094 return GroupPosition; 1088 return GroupPosition;
1095 1089
1096 return m_offsetPosition + m_groupPosition; 1090 return m_offsetPosition + m_groupPosition;
@@ -1588,7 +1582,7 @@ namespace OpenSim.Region.Framework.Scenes
1588 1582
1589 // The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition 1583 // The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
1590 // or flexible 1584 // or flexible
1591 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) 1585 if (!isPhantom && !m_parentGroup.IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
1592 { 1586 {
1593 try 1587 try
1594 { 1588 {
@@ -2880,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes
2880 2874
2881 public void rotLookAt(Quaternion target, float strength, float damping) 2875 public void rotLookAt(Quaternion target, float strength, float damping)
2882 { 2876 {
2883 if (IsAttachment) 2877 if (m_parentGroup.IsAttachment)
2884 { 2878 {
2885 /* 2879 /*
2886 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); 2880 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
@@ -3014,7 +3008,7 @@ namespace OpenSim.Region.Framework.Scenes
3014 3008
3015 if (IsRoot) 3009 if (IsRoot)
3016 { 3010 {
3017 if (IsAttachment) 3011 if (m_parentGroup.IsAttachment)
3018 { 3012 {
3019 SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags); 3013 SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags);
3020 } 3014 }
@@ -3076,7 +3070,7 @@ namespace OpenSim.Region.Framework.Scenes
3076 { 3070 {
3077 // Suppress full updates during attachment editing 3071 // Suppress full updates during attachment editing
3078 // 3072 //
3079 if (ParentGroup.IsSelected && IsAttachment) 3073 if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
3080 return; 3074 return;
3081 3075
3082 if (ParentGroup.IsDeleted) 3076 if (ParentGroup.IsDeleted)
@@ -3254,26 +3248,6 @@ namespace OpenSim.Region.Framework.Scenes
3254 }); 3248 });
3255 } 3249 }
3256 3250
3257 public void SetAttachmentPoint(uint AttachmentPoint)
3258 {
3259 this.AttachmentPoint = AttachmentPoint;
3260
3261 if (AttachmentPoint != 0)
3262 {
3263 IsAttachment = true;
3264 }
3265 else
3266 {
3267 IsAttachment = false;
3268 }
3269
3270 // save the attachment point.
3271 //if (AttachmentPoint != 0)
3272 //{
3273 m_shape.State = (byte)AttachmentPoint;
3274 //}
3275 }
3276
3277 public void SetAxisRotation(int axis, int rotate) 3251 public void SetAxisRotation(int axis, int rotate)
3278 { 3252 {
3279 if (m_parentGroup != null) 3253 if (m_parentGroup != null)
@@ -4497,7 +4471,9 @@ namespace OpenSim.Region.Framework.Scenes
4497 } 4471 }
4498 } 4472 }
4499 4473
4500 if (SetPhantom || IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints 4474 if (SetPhantom
4475 || ParentGroup.IsAttachment
4476 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
4501 { 4477 {
4502 AddFlag(PrimFlags.Phantom); 4478 AddFlag(PrimFlags.Phantom);
4503 if (PhysActor != null) 4479 if (PhysActor != null)
@@ -4928,7 +4904,7 @@ namespace OpenSim.Region.Framework.Scenes
4928 if (ParentGroup == null || ParentGroup.IsDeleted) 4904 if (ParentGroup == null || ParentGroup.IsDeleted)
4929 return; 4905 return;
4930 4906
4931 if (IsAttachment && ParentGroup.RootPart != this) 4907 if (ParentGroup.IsAttachment && ParentGroup.RootPart != this)
4932 return; 4908 return;
4933 4909
4934 // Causes this thread to dig into the Client Thread Data. 4910 // Causes this thread to dig into the Client Thread Data.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3b60f8c..108089e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -201,7 +201,7 @@ namespace OpenSim.Region.Framework.Scenes
201 // Don't let this set the HasGroupChanged flag for attachments 201 // Don't let this set the HasGroupChanged flag for attachments
202 // as this happens during rez and we don't want a new asset 202 // as this happens during rez and we don't want a new asset
203 // for each attachment each time 203 // for each attachment each time
204 if (!m_part.ParentGroup.RootPart.IsAttachment) 204 if (!m_part.ParentGroup.IsAttachment)
205 { 205 {
206 HasInventoryChanged = true; 206 HasInventoryChanged = true;
207 m_part.ParentGroup.HasGroupChanged = true; 207 m_part.ParentGroup.HasGroupChanged = true;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fc89473..93782ce 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3178,7 +3178,7 @@ namespace OpenSim.Region.Framework.Scenes
3178 ISceneObject clone = sog.CloneForNewScene(); 3178 ISceneObject clone = sog.CloneForNewScene();
3179 // Attachment module assumes that GroupPosition holds the offsets...! 3179 // Attachment module assumes that GroupPosition holds the offsets...!
3180 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; 3180 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
3181 ((SceneObjectGroup)clone).RootPart.IsAttachment = false; 3181 ((SceneObjectGroup)clone).IsAttachment = false;
3182 cAgent.AttachmentObjects.Add(clone); 3182 cAgent.AttachmentObjects.Add(clone);
3183 string state = sog.GetStateSnapshot(); 3183 string state = sog.GetStateSnapshot();
3184 cAgent.AttachmentObjectStates.Add(state); 3184 cAgent.AttachmentObjectStates.Add(state);
@@ -3477,7 +3477,7 @@ namespace OpenSim.Region.Framework.Scenes
3477 { 3477 {
3478 foreach (SceneObjectGroup so in m_attachments) 3478 foreach (SceneObjectGroup so in m_attachments)
3479 { 3479 {
3480 if (attachmentPoint == so.RootPart.AttachmentPoint) 3480 if (attachmentPoint == so.AttachmentPoint)
3481 attachments.Add(so); 3481 attachments.Add(so);
3482 } 3482 }
3483 } 3483 }
@@ -3869,12 +3869,12 @@ namespace OpenSim.Region.Framework.Scenes
3869 { 3869 {
3870 if (grp.HasGroupChanged) // Resizer scripts? 3870 if (grp.HasGroupChanged) // Resizer scripts?
3871 { 3871 {
3872 grp.RootPart.IsAttachment = false; 3872 grp.IsAttachment = false;
3873 grp.AbsolutePosition = grp.RootPart.AttachedPos; 3873 grp.AbsolutePosition = grp.RootPart.AttachedPos;
3874// grp.DetachToInventoryPrep(); 3874// grp.DetachToInventoryPrep();
3875 attachmentsModule.UpdateKnownItem(ControllingClient, 3875 attachmentsModule.UpdateKnownItem(ControllingClient,
3876 grp, grp.GetFromItemID(), grp.OwnerID); 3876 grp, grp.GetFromItemID(), grp.OwnerID);
3877 grp.RootPart.IsAttachment = true; 3877 grp.IsAttachment = true;
3878 } 3878 }
3879 } 3879 }
3880 } 3880 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index 7c067ca..997845b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -120,8 +120,7 @@ namespace OpenSim.Region.Framework.Scenes
120 // We deal with the possibility that two updates occur at 120 // We deal with the possibility that two updates occur at
121 // the same unix time at the update point itself. 121 // the same unix time at the update point itself.
122 122
123 if ((update.LastFullUpdateTime < part.TimeStampFull) || 123 if ((update.LastFullUpdateTime < part.TimeStampFull) || part.ParentGroup.IsAttachment)
124 part.IsAttachment)
125 { 124 {
126 // m_log.DebugFormat( 125 // m_log.DebugFormat(
127 // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", 126 // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}",