From f3f4428700f2c63901e6f068957f879143ba0bd5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 26 Aug 2010 21:50:19 +0100
Subject: refactor: break out attachment position change code in
Scene.UpdatePrimPosition() and move into AttachmentsModule
This allows region modules to change attachment positions.
---
.../Framework/Interfaces/IAttachmentsModule.cs | 8 +++++
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 37 ++++++++--------------
2 files changed, 21 insertions(+), 24 deletions(-)
(limited to 'OpenSim/Region/Framework')
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
/// A
///
void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
+
+ ///
+ /// Update the position of an attachment
+ ///
+ ///
+ ///
+ ///
+ void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos);
}
}
\ 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
///
///
///
- protected internal void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
+ public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(localID);
+
if (group != null)
- {
-
- // Vector3 oldPos = group.AbsolutePosition;
+ {
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{
-
- // If this is an attachment, then we need to save the modified
- // object back into the avatar's inventory. First we save the
- // attachment point information, then we update the relative
- // positioning (which caused this method to get driven in the
- // first place. Then we have to mark the object as NOT an
- // attachment. This is necessary in order to correctly save
- // and retrieve GroupPosition information for the attachment.
- // Then we save the asset back into the appropriate inventory
- // entry. Finally, we restore the object's attachment status.
-
- byte attachmentPoint = group.GetAttachmentPoint();
- group.UpdateGroupPosition(pos);
- group.RootPart.IsAttachment = false;
- group.AbsolutePosition = group.RootPart.AttachedPos;
- m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
- group.SetAttachmentPoint(attachmentPoint);
-
+ if (m_parentScene.AttachmentsModule != null)
+ m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos);
}
else
{
- if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
+ if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)
+ && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
{
group.UpdateGroupPosition(pos);
}
@@ -1328,14 +1312,19 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- ///
+ /// Update the texture entry of the given prim.
///
+ ///
+ /// A texture entry is an object that contains details of all the textures of the prim's face. In this case,
+ /// the texture is given in its byte serialized form.
+ ///
///
///
///
protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(localID);
+
if (group != null)
{
if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))
--
cgit v1.1