diff options
author | Justin Clark-Casey (justincc) | 2010-08-26 21:50:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-26 21:50:19 +0100 |
commit | f3f4428700f2c63901e6f068957f879143ba0bd5 (patch) | |
tree | e21512a10f418319b32517ead136f12c7b59b2ef /OpenSim/Region/CoreModules | |
parent | minor: change log message from info to debug (diff) | |
download | opensim-SC-f3f4428700f2c63901e6f068957f879143ba0bd5.zip opensim-SC-f3f4428700f2c63901e6f068957f879143ba0bd5.tar.gz opensim-SC-f3f4428700f2c63901e6f068957f879143ba0bd5.tar.bz2 opensim-SC-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/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 847a999..b3811bf 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -455,5 +455,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
455 | } | 455 | } |
456 | } | 456 | } |
457 | } | 457 | } |
458 | |||
459 | public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos) | ||
460 | { | ||
461 | // If this is an attachment, then we need to save the modified | ||
462 | // object back into the avatar's inventory. First we save the | ||
463 | // attachment point information, then we update the relative | ||
464 | // positioning (which caused this method to get driven in the | ||
465 | // first place. Then we have to mark the object as NOT an | ||
466 | // attachment. This is necessary in order to correctly save | ||
467 | // and retrieve GroupPosition information for the attachment. | ||
468 | // Then we save the asset back into the appropriate inventory | ||
469 | // entry. Finally, we restore the object's attachment status. | ||
470 | byte attachmentPoint = sog.GetAttachmentPoint(); | ||
471 | sog.UpdateGroupPosition(pos); | ||
472 | sog.RootPart.IsAttachment = false; | ||
473 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
474 | m_scene.UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); | ||
475 | sog.SetAttachmentPoint(attachmentPoint); | ||
476 | } | ||
458 | } | 477 | } |
459 | } | 478 | } \ No newline at end of file |