aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs79
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs2
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;
37using OpenSim.Region.Framework; 37using OpenSim.Region.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization;
40 41
41namespace OpenSim.Region.CoreModules.Avatar.Attachments 42namespace 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