diff options
author | Justin Clark-Casey (justincc) | 2010-11-17 01:28:46 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-11-17 01:28:46 +0000 |
commit | b38a1594c1028ed39def8079043ae19ebc28b813 (patch) | |
tree | 962ee7f2584dead0ffa37cf1c8b3535a3626a26b /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
parent | Prevent leftover attachments from clogging up the pipes (diff) | |
download | opensim-SC-b38a1594c1028ed39def8079043ae19ebc28b813.zip opensim-SC-b38a1594c1028ed39def8079043ae19ebc28b813.tar.gz opensim-SC-b38a1594c1028ed39def8079043ae19ebc28b813.tar.bz2 opensim-SC-b38a1594c1028ed39def8079043ae19ebc28b813.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 18 |
2 files changed, 25 insertions, 27 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 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 7a175ea..ef21834 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -569,12 +569,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
569 | { | 569 | { |
570 | group.RootPart.Flags |= PrimFlags.Phantom; | 570 | group.RootPart.Flags |= PrimFlags.Phantom; |
571 | group.RootPart.IsAttachment = true; | 571 | group.RootPart.IsAttachment = true; |
572 | } | ||
573 | 572 | ||
574 | // If we're rezzing an attachment then don't ask AddNewSceneObject() to update the client since | 573 | // If we're rezzing an attachment then don't ask |
575 | // we'll be doing that later on. Scheduling more than one full update during the attachment | 574 | // AddNewSceneObject() to update the client since |
576 | // process causes some clients to fail to display the attachment properly. | 575 | // we'll be doing that later on. Scheduling more |
577 | m_Scene.AddNewSceneObject(group, true, false); | 576 | // than one full update during the attachment |
577 | // process causes some clients to fail to display | ||
578 | // the attachment properly. | ||
579 | // Also, don't persist attachments. | ||
580 | m_Scene.AddNewSceneObject(group, false, false); | ||
581 | } | ||
582 | else | ||
583 | { | ||
584 | m_Scene.AddNewSceneObject(group, true, false); | ||
585 | } | ||
578 | 586 | ||
579 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); | 587 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); |
580 | // if attachment we set it's asset id so object updates can reflect that | 588 | // if attachment we set it's asset id so object updates can reflect that |