aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-26 21:50:19 +0100
committerJustin Clark-Casey (justincc)2010-08-26 21:50:19 +0100
commitf3f4428700f2c63901e6f068957f879143ba0bd5 (patch)
treee21512a10f418319b32517ead136f12c7b59b2ef /OpenSim/Region/Framework
parentminor: change log message from info to debug (diff)
downloadopensim-SC_OLD-f3f4428700f2c63901e6f068957f879143ba0bd5.zip
opensim-SC_OLD-f3f4428700f2c63901e6f068957f879143ba0bd5.tar.gz
opensim-SC_OLD-f3f4428700f2c63901e6f068957f879143ba0bd5.tar.bz2
opensim-SC_OLD-f3f4428700f2c63901e6f068957f879143ba0bd5.tar.xz
refactor: break out attachment position change code in Scene.UpdatePrimPosition() and move into AttachmentsModule
This allows region modules to change attachment positions.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs37
2 files changed, 21 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 2af2548..05c1e00 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -131,5 +131,13 @@ namespace OpenSim.Region.Framework.Interfaces
131 /// A <see cref="IClientAPI"/> 131 /// A <see cref="IClientAPI"/>
132 /// </param> 132 /// </param>
133 void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); 133 void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
134
135 /// <summary>
136 /// Update the position of an attachment
137 /// </summary>
138 /// <param name="client"></param>
139 /// <param name="sog"></param>
140 /// <param name="pos"></param>
141 void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos);
134 } 142 }
135} \ No newline at end of file 143} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 5b4ec3b..9db2691 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1289,37 +1289,21 @@ namespace OpenSim.Region.Framework.Scenes
1289 /// <param name="localID"></param> 1289 /// <param name="localID"></param>
1290 /// <param name="pos"></param> 1290 /// <param name="pos"></param>
1291 /// <param name="remoteClient"></param> 1291 /// <param name="remoteClient"></param>
1292 protected internal void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) 1292 public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
1293 { 1293 {
1294 SceneObjectGroup group = GetGroupByPrim(localID); 1294 SceneObjectGroup group = GetGroupByPrim(localID);
1295
1295 if (group != null) 1296 if (group != null)
1296 { 1297 {
1297
1298 // Vector3 oldPos = group.AbsolutePosition;
1299 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) 1298 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
1300 { 1299 {
1301 1300 if (m_parentScene.AttachmentsModule != null)
1302 // If this is an attachment, then we need to save the modified 1301 m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos);
1303 // object back into the avatar's inventory. First we save the
1304 // attachment point information, then we update the relative
1305 // positioning (which caused this method to get driven in the
1306 // first place. Then we have to mark the object as NOT an
1307 // attachment. This is necessary in order to correctly save
1308 // and retrieve GroupPosition information for the attachment.
1309 // Then we save the asset back into the appropriate inventory
1310 // entry. Finally, we restore the object's attachment status.
1311
1312 byte attachmentPoint = group.GetAttachmentPoint();
1313 group.UpdateGroupPosition(pos);
1314 group.RootPart.IsAttachment = false;
1315 group.AbsolutePosition = group.RootPart.AttachedPos;
1316 m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
1317 group.SetAttachmentPoint(attachmentPoint);
1318
1319 } 1302 }
1320 else 1303 else
1321 { 1304 {
1322 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) 1305 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)
1306 && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
1323 { 1307 {
1324 group.UpdateGroupPosition(pos); 1308 group.UpdateGroupPosition(pos);
1325 } 1309 }
@@ -1328,14 +1312,19 @@ namespace OpenSim.Region.Framework.Scenes
1328 } 1312 }
1329 1313
1330 /// <summary> 1314 /// <summary>
1331 /// 1315 /// Update the texture entry of the given prim.
1332 /// </summary> 1316 /// </summary>
1317 ///
1318 /// A texture entry is an object that contains details of all the textures of the prim's face. In this case,
1319 /// the texture is given in its byte serialized form.
1320 ///
1333 /// <param name="localID"></param> 1321 /// <param name="localID"></param>
1334 /// <param name="texture"></param> 1322 /// <param name="texture"></param>
1335 /// <param name="remoteClient"></param> 1323 /// <param name="remoteClient"></param>
1336 protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) 1324 protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
1337 { 1325 {
1338 SceneObjectGroup group = GetGroupByPrim(localID); 1326 SceneObjectGroup group = GetGroupByPrim(localID);
1327
1339 if (group != null) 1328 if (group != null)
1340 { 1329 {
1341 if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) 1330 if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))