diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 107 |
1 files changed, 58 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3be0623..b4fc472 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -881,8 +881,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
881 | 881 | ||
882 | return items; | 882 | return items; |
883 | } | 883 | } |
884 | 884 | ||
885 | public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) | 885 | public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist) |
886 | { | 886 | { |
887 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); | 887 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); |
888 | 888 | ||
@@ -891,70 +891,79 @@ namespace OpenSim.Region.Framework.Scenes | |||
891 | m_log.WarnFormat( | 891 | m_log.WarnFormat( |
892 | "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", | 892 | "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", |
893 | item.AssetID, item.Name, m_part.Name); | 893 | item.AssetID, item.Name, m_part.Name); |
894 | return null; | 894 | objlist = null; |
895 | veclist = null; | ||
896 | return false; | ||
895 | } | 897 | } |
896 | 898 | ||
897 | string xmlData = Utils.BytesToString(rezAsset.Data); | 899 | Vector3 bbox; |
898 | SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 900 | float offsetHeight; |
899 | 901 | ||
900 | group.RootPart.AttachPoint = group.RootPart.Shape.State; | 902 | bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); |
901 | group.RootPart.AttachOffset = group.AbsolutePosition; | ||
902 | group.RootPart.AttachRotation = group.GroupRotation; | ||
903 | 903 | ||
904 | group.ResetIDs(); | 904 | for (int i = 0; i < objlist.Count; i++) |
905 | { | ||
906 | SceneObjectGroup group = objlist[i]; | ||
905 | 907 | ||
906 | SceneObjectPart rootPart = group.GetPart(group.UUID); | 908 | group.RootPart.AttachPoint = group.RootPart.Shape.State; |
909 | group.RootPart.AttachOffset = group.AbsolutePosition; | ||
910 | group.RootPart.AttachRotation = group.GroupRotation; | ||
907 | 911 | ||
908 | // Since renaming the item in the inventory does not affect the name stored | 912 | group.ResetIDs(); |
909 | // in the serialization, transfer the correct name from the inventory to the | ||
910 | // object itself before we rez. | ||
911 | rootPart.Name = item.Name; | ||
912 | rootPart.Description = item.Description; | ||
913 | 913 | ||
914 | SceneObjectPart[] partList = group.Parts; | 914 | SceneObjectPart rootPart = group.GetPart(group.UUID); |
915 | 915 | ||
916 | group.SetGroup(m_part.GroupID, null); | 916 | // Since renaming the item in the inventory does not affect the name stored |
917 | // in the serialization, transfer the correct name from the inventory to the | ||
918 | // object itself before we rez. | ||
919 | rootPart.Name = item.Name; | ||
920 | rootPart.Description = item.Description; | ||
917 | 921 | ||
918 | // TODO: Remove magic number badness | 922 | SceneObjectPart[] partList = group.Parts; |
919 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | 923 | |
920 | { | 924 | group.SetGroup(m_part.GroupID, null); |
921 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | 925 | |
926 | // TODO: Remove magic number badness | ||
927 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
922 | { | 928 | { |
923 | foreach (SceneObjectPart part in partList) | 929 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) |
924 | { | 930 | { |
925 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 931 | foreach (SceneObjectPart part in partList) |
926 | part.EveryoneMask = item.EveryonePermissions; | 932 | { |
927 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | 933 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
928 | part.NextOwnerMask = item.NextPermissions; | 934 | part.EveryoneMask = item.EveryonePermissions; |
929 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 935 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) |
930 | part.GroupMask = item.GroupPermissions; | 936 | part.NextOwnerMask = item.NextPermissions; |
937 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
938 | part.GroupMask = item.GroupPermissions; | ||
939 | } | ||
940 | |||
941 | group.ApplyNextOwnerPermissions(); | ||
931 | } | 942 | } |
932 | |||
933 | group.ApplyNextOwnerPermissions(); | ||
934 | } | 943 | } |
935 | } | ||
936 | 944 | ||
937 | foreach (SceneObjectPart part in partList) | 945 | foreach (SceneObjectPart part in partList) |
938 | { | ||
939 | // TODO: Remove magic number badness | ||
940 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
941 | { | 946 | { |
942 | part.LastOwnerID = part.OwnerID; | 947 | // TODO: Remove magic number badness |
943 | part.OwnerID = item.OwnerID; | 948 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number |
944 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | 949 | { |
950 | part.LastOwnerID = part.OwnerID; | ||
951 | part.OwnerID = item.OwnerID; | ||
952 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
953 | } | ||
954 | |||
955 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
956 | part.EveryoneMask = item.EveryonePermissions; | ||
957 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
958 | part.NextOwnerMask = item.NextPermissions; | ||
959 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
960 | part.GroupMask = item.GroupPermissions; | ||
945 | } | 961 | } |
946 | 962 | ||
947 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 963 | rootPart.TrimPermissions(); |
948 | part.EveryoneMask = item.EveryonePermissions; | ||
949 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
950 | part.NextOwnerMask = item.NextPermissions; | ||
951 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
952 | part.GroupMask = item.GroupPermissions; | ||
953 | } | 964 | } |
954 | 965 | ||
955 | rootPart.TrimPermissions(); | 966 | return true; |
956 | |||
957 | return group; | ||
958 | } | 967 | } |
959 | 968 | ||
960 | /// <summary> | 969 | /// <summary> |