diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 101 |
1 files changed, 55 insertions, 46 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3f223a3..380e402 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -733,8 +733,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
733 | 733 | ||
734 | return items; | 734 | return items; |
735 | } | 735 | } |
736 | 736 | ||
737 | public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) | 737 | public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist) |
738 | { | 738 | { |
739 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); | 739 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); |
740 | 740 | ||
@@ -743,66 +743,75 @@ namespace OpenSim.Region.Framework.Scenes | |||
743 | m_log.WarnFormat( | 743 | m_log.WarnFormat( |
744 | "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", | 744 | "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", |
745 | item.AssetID, item.Name, m_part.Name); | 745 | item.AssetID, item.Name, m_part.Name); |
746 | return null; | 746 | objlist = null; |
747 | veclist = null; | ||
748 | return false; | ||
747 | } | 749 | } |
748 | 750 | ||
749 | string xmlData = Utils.BytesToString(rezAsset.Data); | 751 | Vector3 bbox; |
750 | SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 752 | float offsetHeight; |
751 | 753 | ||
752 | group.ResetIDs(); | 754 | bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); |
753 | 755 | ||
754 | SceneObjectPart rootPart = group.GetPart(group.UUID); | 756 | for (int i = 0; i < objlist.Count; i++) |
757 | { | ||
758 | SceneObjectGroup group = objlist[i]; | ||
755 | 759 | ||
756 | // Since renaming the item in the inventory does not affect the name stored | 760 | group.ResetIDs(); |
757 | // in the serialization, transfer the correct name from the inventory to the | ||
758 | // object itself before we rez. | ||
759 | rootPart.Name = item.Name; | ||
760 | rootPart.Description = item.Description; | ||
761 | 761 | ||
762 | SceneObjectPart[] partList = group.Parts; | 762 | SceneObjectPart rootPart = group.GetPart(group.UUID); |
763 | 763 | ||
764 | group.SetGroup(m_part.GroupID, null); | 764 | // Since renaming the item in the inventory does not affect the name stored |
765 | // in the serialization, transfer the correct name from the inventory to the | ||
766 | // object itself before we rez. | ||
767 | rootPart.Name = item.Name; | ||
768 | rootPart.Description = item.Description; | ||
765 | 769 | ||
766 | // TODO: Remove magic number badness | 770 | SceneObjectPart[] partList = group.Parts; |
767 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | 771 | |
768 | { | 772 | group.SetGroup(m_part.GroupID, null); |
769 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | 773 | |
774 | // TODO: Remove magic number badness | ||
775 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
770 | { | 776 | { |
771 | foreach (SceneObjectPart part in partList) | 777 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) |
772 | { | 778 | { |
773 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 779 | foreach (SceneObjectPart part in partList) |
774 | part.EveryoneMask = item.EveryonePermissions; | 780 | { |
775 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | 781 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
776 | part.NextOwnerMask = item.NextPermissions; | 782 | part.EveryoneMask = item.EveryonePermissions; |
777 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 783 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) |
778 | part.GroupMask = item.GroupPermissions; | 784 | part.NextOwnerMask = item.NextPermissions; |
785 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
786 | part.GroupMask = item.GroupPermissions; | ||
787 | } | ||
788 | |||
789 | group.ApplyNextOwnerPermissions(); | ||
779 | } | 790 | } |
780 | |||
781 | group.ApplyNextOwnerPermissions(); | ||
782 | } | 791 | } |
783 | } | ||
784 | 792 | ||
785 | foreach (SceneObjectPart part in partList) | 793 | foreach (SceneObjectPart part in partList) |
786 | { | ||
787 | // TODO: Remove magic number badness | ||
788 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
789 | { | 794 | { |
790 | part.LastOwnerID = part.OwnerID; | 795 | // TODO: Remove magic number badness |
791 | part.OwnerID = item.OwnerID; | 796 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number |
792 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | 797 | { |
798 | part.LastOwnerID = part.OwnerID; | ||
799 | part.OwnerID = item.OwnerID; | ||
800 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
801 | } | ||
802 | |||
803 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
804 | part.EveryoneMask = item.EveryonePermissions; | ||
805 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
806 | part.NextOwnerMask = item.NextPermissions; | ||
807 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
808 | part.GroupMask = item.GroupPermissions; | ||
793 | } | 809 | } |
794 | 810 | ||
795 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 811 | rootPart.TrimPermissions(); |
796 | part.EveryoneMask = item.EveryonePermissions; | ||
797 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
798 | part.NextOwnerMask = item.NextPermissions; | ||
799 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
800 | part.GroupMask = item.GroupPermissions; | ||
801 | } | 812 | } |
802 | 813 | ||
803 | rootPart.TrimPermissions(); | 814 | return true; |
804 | |||
805 | return group; | ||
806 | } | 815 | } |
807 | 816 | ||
808 | /// <summary> | 817 | /// <summary> |