aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs66
1 files changed, 64 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 4ae53a2..84b7365 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -37,6 +37,7 @@ using log4net;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes.Scripting; 39using OpenSim.Region.Framework.Scenes.Scripting;
40using OpenSim.Region.Framework.Scenes.Serialization;
40 41
41namespace OpenSim.Region.Framework.Scenes 42namespace OpenSim.Region.Framework.Scenes
42{ 43{
@@ -574,6 +575,68 @@ namespace OpenSim.Region.Framework.Scenes
574 return items; 575 return items;
575 } 576 }
576 577
578 public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item)
579 {
580 UUID ownerID = item.OwnerID;
581 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
582
583 if (null == rezAsset)
584 {
585 m_log.WarnFormat(
586 "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}",
587 item.AssetID, item.Name, m_part.Name);
588 return null;
589 }
590
591 string xmlData = Utils.BytesToString(rezAsset.Data);
592 SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
593
594 group.ResetIDs();
595
596 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
597
598 // Since renaming the item in the inventory does not affect the name stored
599 // in the serialization, transfer the correct name from the inventory to the
600 // object itself before we rez.
601 rootPart.Name = item.Name;
602 rootPart.Description = item.Description;
603
604 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
605
606 group.SetGroup(m_part.GroupID, null);
607
608 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
609 {
610 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
611 {
612 foreach (SceneObjectPart part in partList)
613 {
614 part.EveryoneMask = item.EveryonePermissions;
615 part.NextOwnerMask = item.NextPermissions;
616 }
617
618 group.ApplyNextOwnerPermissions();
619 }
620 }
621
622 foreach (SceneObjectPart part in partList)
623 {
624 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
625 {
626 part.LastOwnerID = part.OwnerID;
627 part.OwnerID = item.OwnerID;
628 part.Inventory.ChangeInventoryOwner(item.OwnerID);
629 }
630
631 part.EveryoneMask = item.EveryonePermissions;
632 part.NextOwnerMask = item.NextPermissions;
633 }
634
635 rootPart.TrimPermissions();
636
637 return group;
638 }
639
577 /// <summary> 640 /// <summary>
578 /// Update an existing inventory item. 641 /// Update an existing inventory item.
579 /// </summary> 642 /// </summary>
@@ -1029,6 +1092,5 @@ namespace OpenSim.Region.Framework.Scenes
1029 } 1092 }
1030 } 1093 }
1031 } 1094 }
1032
1033 } 1095 }
1034} 1096} \ No newline at end of file