diff options
author | Melanie | 2010-11-16 21:01:56 +0000 |
---|---|---|
committer | Melanie | 2010-11-16 21:01:56 +0000 |
commit | 7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b (patch) | |
tree | b73a2aa9f04e9c34281fb38512da3eb800396769 /OpenSim/Region/CoreModules/Avatar | |
parent | Fix osTeleportAgent for hypergrid destinations. (diff) | |
download | opensim-SC_OLD-7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b.zip opensim-SC_OLD-7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b.tar.gz opensim-SC_OLD-7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b.tar.bz2 opensim-SC_OLD-7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b.tar.xz |
Change the way attachments are persisted. Editing a worn attachment will now
save properly, as will the results of a resizer script working. Attachment
positions are no longer saved on each move, but instead are saved once on
logout. Attachment script states are saved as part of the attachment now
when detaching.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 348b8b9..1744fb3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -273,6 +273,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
273 | 273 | ||
274 | if (objatt != null) | 274 | if (objatt != null) |
275 | { | 275 | { |
276 | // Loading the inventory from XML will have set this, but | ||
277 | // there is no way the object could have changed yet, | ||
278 | // since scripts aren't running yet. So, clear it here. | ||
279 | objatt.HasGroupChanged = false; | ||
276 | bool tainted = false; | 280 | bool tainted = false; |
277 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | 281 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) |
278 | tainted = true; | 282 | tainted = true; |
@@ -470,6 +474,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
470 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 474 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
471 | group.DetachToInventoryPrep(); | 475 | group.DetachToInventoryPrep(); |
472 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 476 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
477 | |||
478 | // If an item contains scripts, it's always changed. | ||
479 | // This ensures script state is saved on detach | ||
480 | foreach (SceneObjectPart p in group.Parts) | ||
481 | if (p.Inventory.ContainsScripts()) | ||
482 | group.HasGroupChanged = true; | ||
483 | |||
473 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); | 484 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); |
474 | m_scene.DeleteSceneObject(group, false); | 485 | m_scene.DeleteSceneObject(group, false); |
475 | return; | 486 | return; |
@@ -478,25 +489,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
478 | } | 489 | } |
479 | } | 490 | } |
480 | 491 | ||
481 | public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos) | ||
482 | { | ||
483 | // If this is an attachment, then we need to save the modified | ||
484 | // object back into the avatar's inventory. First we save the | ||
485 | // attachment point information, then we update the relative | ||
486 | // positioning (which caused this method to get driven in the | ||
487 | // first place. Then we have to mark the object as NOT an | ||
488 | // attachment. This is necessary in order to correctly save | ||
489 | // and retrieve GroupPosition information for the attachment. | ||
490 | // Then we save the asset back into the appropriate inventory | ||
491 | // entry. Finally, we restore the object's attachment status. | ||
492 | byte attachmentPoint = sog.GetAttachmentPoint(); | ||
493 | sog.UpdateGroupPosition(pos); | ||
494 | sog.RootPart.IsAttachment = false; | ||
495 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
496 | UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); | ||
497 | sog.SetAttachmentPoint(attachmentPoint); | ||
498 | } | ||
499 | |||
500 | /// <summary> | 492 | /// <summary> |
501 | /// Update the attachment asset for the new sog details if they have changed. | 493 | /// Update the attachment asset for the new sog details if they have changed. |
502 | /// </summary> | 494 | /// </summary> |
@@ -508,7 +500,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
508 | /// <param name="grp"></param> | 500 | /// <param name="grp"></param> |
509 | /// <param name="itemID"></param> | 501 | /// <param name="itemID"></param> |
510 | /// <param name="agentID"></param> | 502 | /// <param name="agentID"></param> |
511 | protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) | 503 | public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) |
512 | { | 504 | { |
513 | if (grp != null) | 505 | if (grp != null) |
514 | { | 506 | { |
@@ -523,7 +515,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
523 | grp.UUID, grp.GetAttachmentPoint()); | 515 | grp.UUID, grp.GetAttachmentPoint()); |
524 | 516 | ||
525 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | 517 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); |
526 | |||
527 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 518 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
528 | item = m_scene.InventoryService.GetItem(item); | 519 | item = m_scene.InventoryService.GetItem(item); |
529 | 520 | ||
@@ -617,7 +608,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
617 | // In case it is later dropped again, don't let | 608 | // In case it is later dropped again, don't let |
618 | // it get cleaned up | 609 | // it get cleaned up |
619 | so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | 610 | so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); |
620 | so.HasGroupChanged = false; | ||
621 | } | 611 | } |
622 | } | 612 | } |
623 | } | 613 | } |