diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 137 |
1 files changed, 85 insertions, 52 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index d04d87b..a6a963b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -696,7 +696,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
696 | /// </param> | 696 | /// </param> |
697 | public void StopScriptInstance(TaskInventoryItem item) | 697 | public void StopScriptInstance(TaskInventoryItem item) |
698 | { | 698 | { |
699 | m_part.ParentGroup.Scene.EventManager.TriggerStopScript(m_part.LocalId, item.ItemID); | 699 | if (m_part.ParentGroup.Scene != null) |
700 | m_part.ParentGroup.Scene.EventManager.TriggerStopScript(m_part.LocalId, item.ItemID); | ||
700 | 701 | ||
701 | // At the moment, even stopped scripts are counted as active, which is probably wrong. | 702 | // At the moment, even stopped scripts are counted as active, which is probably wrong. |
702 | // m_part.ParentGroup.AddActiveScriptCount(-1); | 703 | // m_part.ParentGroup.AddActiveScriptCount(-1); |
@@ -880,8 +881,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
880 | 881 | ||
881 | return items; | 882 | return items; |
882 | } | 883 | } |
883 | 884 | ||
884 | public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) | 885 | public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist) |
885 | { | 886 | { |
886 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); | 887 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); |
887 | 888 | ||
@@ -890,70 +891,102 @@ namespace OpenSim.Region.Framework.Scenes | |||
890 | m_log.WarnFormat( | 891 | m_log.WarnFormat( |
891 | "[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}", |
892 | item.AssetID, item.Name, m_part.Name); | 893 | item.AssetID, item.Name, m_part.Name); |
893 | return null; | 894 | objlist = null; |
895 | veclist = null; | ||
896 | return false; | ||
894 | } | 897 | } |
895 | 898 | ||
896 | string xmlData = Utils.BytesToString(rezAsset.Data); | 899 | Vector3 bbox; |
897 | SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 900 | float offsetHeight; |
898 | |||
899 | group.RootPart.AttachPoint = group.RootPart.Shape.State; | ||
900 | group.RootPart.AttachOffset = group.AbsolutePosition; | ||
901 | group.RootPart.AttachRotation = group.GroupRotation; | ||
902 | 901 | ||
903 | group.ResetIDs(); | 902 | bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); |
904 | 903 | ||
905 | SceneObjectPart rootPart = group.GetPart(group.UUID); | 904 | for (int i = 0; i < objlist.Count; i++) |
906 | 905 | { | |
907 | // Since renaming the item in the inventory does not affect the name stored | 906 | SceneObjectGroup group = objlist[i]; |
908 | // in the serialization, transfer the correct name from the inventory to the | 907 | /* |
909 | // object itself before we rez. | 908 | group.RootPart.AttachPoint = group.RootPart.Shape.State; |
910 | rootPart.Name = item.Name; | 909 | group.RootPart.AttachedPos = group.AbsolutePosition; |
911 | rootPart.Description = item.Description; | 910 | group.RootPart.AttachRotation = group.GroupRotation; |
911 | */ | ||
912 | group.ResetIDs(); | ||
913 | |||
914 | SceneObjectPart rootPart = group.GetPart(group.UUID); | ||
915 | |||
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 | // Only do these for the first object if we are rezzing a coalescence. | ||
920 | // nahh dont mess with coalescence objects, | ||
921 | // the name in inventory can be change for inventory purpuses only | ||
922 | if (objlist.Count == 1) | ||
923 | { | ||
924 | rootPart.Name = item.Name; | ||
925 | rootPart.Description = item.Description; | ||
926 | } | ||
927 | /* reverted to old code till part.ApplyPermissionsOnRez is better reviewed/fixed | ||
928 | group.SetGroup(m_part.GroupID, null); | ||
912 | 929 | ||
913 | SceneObjectPart[] partList = group.Parts; | 930 | foreach (SceneObjectPart part in group.Parts) |
931 | { | ||
932 | // Convert between InventoryItem classes. You can never have too many similar but slightly different classes :) | ||
933 | InventoryItemBase dest = new InventoryItemBase(item.ItemID, item.OwnerID); | ||
934 | dest.BasePermissions = item.BasePermissions; | ||
935 | dest.CurrentPermissions = item.CurrentPermissions; | ||
936 | dest.EveryOnePermissions = item.EveryonePermissions; | ||
937 | dest.GroupPermissions = item.GroupPermissions; | ||
938 | dest.NextPermissions = item.NextPermissions; | ||
939 | dest.Flags = item.Flags; | ||
940 | |||
941 | part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene); | ||
942 | } | ||
943 | */ | ||
944 | // old code start | ||
945 | SceneObjectPart[] partList = group.Parts; | ||
914 | 946 | ||
915 | group.SetGroup(m_part.GroupID, null); | 947 | group.SetGroup(m_part.GroupID, null); |
916 | 948 | ||
917 | // TODO: Remove magic number badness | 949 | // TODO: Remove magic number badness |
918 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | 950 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number |
919 | { | ||
920 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | ||
921 | { | 951 | { |
922 | foreach (SceneObjectPart part in partList) | 952 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) |
923 | { | 953 | { |
924 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 954 | foreach (SceneObjectPart part in partList) |
925 | part.EveryoneMask = item.EveryonePermissions; | 955 | { |
926 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | 956 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
927 | part.NextOwnerMask = item.NextPermissions; | 957 | part.EveryoneMask = item.EveryonePermissions; |
928 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 958 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) |
929 | part.GroupMask = item.GroupPermissions; | 959 | part.NextOwnerMask = item.NextPermissions; |
960 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
961 | part.GroupMask = item.GroupPermissions; | ||
962 | } | ||
963 | |||
964 | group.ApplyNextOwnerPermissions(); | ||
930 | } | 965 | } |
931 | |||
932 | group.ApplyNextOwnerPermissions(); | ||
933 | } | 966 | } |
934 | } | ||
935 | 967 | ||
936 | foreach (SceneObjectPart part in partList) | 968 | foreach (SceneObjectPart part in partList) |
937 | { | ||
938 | // TODO: Remove magic number badness | ||
939 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
940 | { | 969 | { |
941 | part.LastOwnerID = part.OwnerID; | 970 | // TODO: Remove magic number badness |
942 | part.OwnerID = item.OwnerID; | 971 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number |
943 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | 972 | { |
973 | part.LastOwnerID = part.OwnerID; | ||
974 | part.OwnerID = item.OwnerID; | ||
975 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
976 | } | ||
977 | |||
978 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
979 | part.EveryoneMask = item.EveryonePermissions; | ||
980 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
981 | part.NextOwnerMask = item.NextPermissions; | ||
982 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
983 | part.GroupMask = item.GroupPermissions; | ||
944 | } | 984 | } |
945 | 985 | // old code end | |
946 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 986 | rootPart.TrimPermissions(); |
947 | part.EveryoneMask = item.EveryonePermissions; | ||
948 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
949 | part.NextOwnerMask = item.NextPermissions; | ||
950 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
951 | part.GroupMask = item.GroupPermissions; | ||
952 | } | 987 | } |
953 | 988 | ||
954 | rootPart.TrimPermissions(); | 989 | return true; |
955 | |||
956 | return group; | ||
957 | } | 990 | } |
958 | 991 | ||
959 | /// <summary> | 992 | /// <summary> |