diff options
author | Melanie | 2010-08-26 23:39:20 +0100 |
---|---|---|
committer | Melanie | 2010-08-26 23:39:20 +0100 |
commit | 1f1d72eba5ca2b1e4115e93af1ed88950dce585a (patch) | |
tree | 2dfcb626f9eb5fc6244b9fe7dac4b46a9c587703 /OpenSim/Region/CoreModules/Avatar | |
parent | Send a null result search packet when no results are passsed in (diff) | |
parent | More on mantis #4985 (diff) | |
download | opensim-SC_OLD-1f1d72eba5ca2b1e4115e93af1ed88950dce585a.zip opensim-SC_OLD-1f1d72eba5ca2b1e4115e93af1ed88950dce585a.tar.gz opensim-SC_OLD-1f1d72eba5ca2b1e4115e93af1ed88950dce585a.tar.bz2 opensim-SC_OLD-1f1d72eba5ca2b1e4115e93af1ed88950dce585a.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 79 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 2 |
2 files changed, 78 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 847a999..d56145a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Region.Framework; | 37 | using OpenSim.Region.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 42 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
42 | { | 43 | { |
@@ -448,12 +449,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
448 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 449 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
449 | group.DetachToInventoryPrep(); | 450 | group.DetachToInventoryPrep(); |
450 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 451 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
451 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); | 452 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); |
452 | m_scene.DeleteSceneObject(group, false); | 453 | m_scene.DeleteSceneObject(group, false); |
453 | return; | 454 | return; |
454 | } | 455 | } |
455 | } | 456 | } |
456 | } | 457 | } |
457 | } | 458 | } |
459 | |||
460 | public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos) | ||
461 | { | ||
462 | // If this is an attachment, then we need to save the modified | ||
463 | // object back into the avatar's inventory. First we save the | ||
464 | // attachment point information, then we update the relative | ||
465 | // positioning (which caused this method to get driven in the | ||
466 | // first place. Then we have to mark the object as NOT an | ||
467 | // attachment. This is necessary in order to correctly save | ||
468 | // and retrieve GroupPosition information for the attachment. | ||
469 | // Then we save the asset back into the appropriate inventory | ||
470 | // entry. Finally, we restore the object's attachment status. | ||
471 | byte attachmentPoint = sog.GetAttachmentPoint(); | ||
472 | sog.UpdateGroupPosition(pos); | ||
473 | sog.RootPart.IsAttachment = false; | ||
474 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
475 | UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); | ||
476 | sog.SetAttachmentPoint(attachmentPoint); | ||
477 | } | ||
478 | |||
479 | /// <summary> | ||
480 | /// Update the attachment asset for the new sog details if they have changed. | ||
481 | /// </summary> | ||
482 | /// | ||
483 | /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects, | ||
484 | /// these details are not stored on the region. | ||
485 | /// | ||
486 | /// <param name="remoteClient"></param> | ||
487 | /// <param name="grp"></param> | ||
488 | /// <param name="itemID"></param> | ||
489 | /// <param name="agentID"></param> | ||
490 | protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) | ||
491 | { | ||
492 | if (grp != null) | ||
493 | { | ||
494 | if (!grp.HasGroupChanged) | ||
495 | { | ||
496 | m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID); | ||
497 | return; | ||
498 | } | ||
499 | |||
500 | m_log.DebugFormat( | ||
501 | "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", | ||
502 | grp.UUID, grp.GetAttachmentPoint()); | ||
503 | |||
504 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
505 | |||
506 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
507 | item = m_scene.InventoryService.GetItem(item); | ||
508 | |||
509 | if (item != null) | ||
510 | { | ||
511 | AssetBase asset = m_scene.CreateAsset( | ||
512 | grp.GetPartName(grp.LocalId), | ||
513 | grp.GetPartDescription(grp.LocalId), | ||
514 | (sbyte)AssetType.Object, | ||
515 | Utils.StringToBytes(sceneObjectXml), | ||
516 | remoteClient.AgentId); | ||
517 | m_scene.AssetService.Store(asset); | ||
518 | |||
519 | item.AssetID = asset.FullID; | ||
520 | item.Description = asset.Description; | ||
521 | item.Name = asset.Name; | ||
522 | item.AssetType = asset.Type; | ||
523 | item.InvType = (int)InventoryType.Object; | ||
524 | |||
525 | m_scene.InventoryService.UpdateItem(item); | ||
526 | |||
527 | // this gets called when the agent logs off! | ||
528 | if (remoteClient != null) | ||
529 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
530 | } | ||
531 | } | ||
532 | } | ||
458 | } | 533 | } |
459 | } | 534 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 4117e86..d1274e9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
159 | 159 | ||
160 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 160 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
161 | { | 161 | { |
162 | m_log.InfoFormat( | 162 | m_log.DebugFormat( |
163 | "[INVENTORY TRANSFER]: {0} IM type received from {1}", | 163 | "[INVENTORY TRANSFER]: {0} IM type received from {1}", |
164 | (InstantMessageDialog)im.dialog, client.Name); | 164 | (InstantMessageDialog)im.dialog, client.Name); |
165 | 165 | ||