aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs68
1 files changed, 66 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 8b4f0ed..c5994b2 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{
@@ -722,6 +723,70 @@ namespace OpenSim.Region.Framework.Scenes
722 return items; 723 return items;
723 } 724 }
724 725
726 public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item)
727 {
728 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
729
730 if (null == rezAsset)
731 {
732 m_log.WarnFormat(
733 "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}",
734 item.AssetID, item.Name, m_part.Name);
735 return null;
736 }
737
738 string xmlData = Utils.BytesToString(rezAsset.Data);
739 SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
740
741 group.ResetIDs();
742
743 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
744
745 // Since renaming the item in the inventory does not affect the name stored
746 // in the serialization, transfer the correct name from the inventory to the
747 // object itself before we rez.
748 rootPart.Name = item.Name;
749 rootPart.Description = item.Description;
750
751 List<SceneObjectPart> partList = null;
752
753 lock (group.Children)
754 partList = new List<SceneObjectPart>(group.Children.Values);
755
756 group.SetGroup(m_part.GroupID, null);
757
758 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
759 {
760 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
761 {
762 foreach (SceneObjectPart part in partList)
763 {
764 part.EveryoneMask = item.EveryonePermissions;
765 part.NextOwnerMask = item.NextPermissions;
766 }
767
768 group.ApplyNextOwnerPermissions();
769 }
770 }
771
772 foreach (SceneObjectPart part in partList)
773 {
774 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
775 {
776 part.LastOwnerID = part.OwnerID;
777 part.OwnerID = item.OwnerID;
778 part.Inventory.ChangeInventoryOwner(item.OwnerID);
779 }
780
781 part.EveryoneMask = item.EveryonePermissions;
782 part.NextOwnerMask = item.NextPermissions;
783 }
784
785 rootPart.TrimPermissions();
786
787 return group;
788 }
789
725 /// <summary> 790 /// <summary>
726 /// Update an existing inventory item. 791 /// Update an existing inventory item.
727 /// </summary> 792 /// </summary>
@@ -1197,6 +1262,5 @@ namespace OpenSim.Region.Framework.Scenes
1197 1262
1198 Items.LockItemsForRead(false); 1263 Items.LockItemsForRead(false);
1199 } 1264 }
1200
1201 } 1265 }
1202} 1266} \ No newline at end of file