diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 129 |
1 files changed, 100 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8b34c28..9a56f42 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -360,6 +360,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
360 | 360 | ||
361 | foreach (SceneObjectGroup objectGroup in objlist) | 361 | foreach (SceneObjectGroup objectGroup in objlist) |
362 | { | 362 | { |
363 | if (objectGroup.RootPart.KeyframeMotion != null) | ||
364 | objectGroup.RootPart.KeyframeMotion.Stop(); | ||
365 | objectGroup.RootPart.SetForce(Vector3.Zero); | ||
366 | objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); | ||
367 | objectGroup.RootPart.KeyframeMotion = null; | ||
368 | |||
363 | Vector3 inventoryStoredPosition = new Vector3 | 369 | Vector3 inventoryStoredPosition = new Vector3 |
364 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | 370 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) |
365 | ? 250 | 371 | ? 250 |
@@ -370,9 +376,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
370 | : objectGroup.AbsolutePosition.Y, | 376 | : objectGroup.AbsolutePosition.Y, |
371 | objectGroup.AbsolutePosition.Z); | 377 | objectGroup.AbsolutePosition.Z); |
372 | 378 | ||
379 | Quaternion inventoryStoredRotation = objectGroup.GroupRotation; | ||
373 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; | 380 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; |
374 | 381 | ||
382 | // Restore attachment data after trip through the sim | ||
383 | if (objectGroup.RootPart.AttachPoint > 0) | ||
384 | { | ||
385 | inventoryStoredPosition = objectGroup.RootPart.AttachOffset; | ||
386 | inventoryStoredRotation = objectGroup.RootPart.AttachRotation; | ||
387 | } | ||
388 | objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; | ||
389 | |||
375 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 390 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
391 | objectGroup.RootPart.RotationOffset = inventoryStoredRotation; | ||
376 | 392 | ||
377 | // Make sure all bits but the ones we want are clear | 393 | // Make sure all bits but the ones we want are clear |
378 | // on take. | 394 | // on take. |
@@ -490,8 +506,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
490 | IClientAPI remoteClient) | 506 | IClientAPI remoteClient) |
491 | { | 507 | { |
492 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | 508 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
509 | // For the porposes of inventory, an object is modify if the prims | ||
510 | // are modify. This allows renaming an object that contains no | ||
511 | // mod items. | ||
493 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | 512 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) |
494 | effectivePerms &= grp.GetEffectivePermissions(); | 513 | { |
514 | uint groupPerms = grp.GetEffectivePermissions(true); | ||
515 | if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0) | ||
516 | groupPerms |= (uint)PermissionMask.Modify; | ||
517 | |||
518 | effectivePerms &= groupPerms; | ||
519 | } | ||
495 | effectivePerms |= (uint)PermissionMask.Move; | 520 | effectivePerms |= (uint)PermissionMask.Move; |
496 | 521 | ||
497 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 522 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
@@ -670,7 +695,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
670 | if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) | 695 | if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) |
671 | { | 696 | { |
672 | InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); | 697 | InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); |
673 | folder = m_Scene.InventoryService.GetFolder(f); | 698 | if (f != null) |
699 | folder = m_Scene.InventoryService.GetFolder(f); | ||
674 | } | 700 | } |
675 | } | 701 | } |
676 | 702 | ||
@@ -700,16 +726,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
700 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 726 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
701 | { | 727 | { |
702 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); | 728 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); |
703 | |||
704 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 729 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
705 | item = m_Scene.InventoryService.GetItem(item); | 730 | item = m_Scene.InventoryService.GetItem(item); |
706 | 731 | ||
707 | if (item == null) | 732 | if (item == null) |
708 | { | 733 | { |
709 | m_log.WarnFormat( | ||
710 | "[INVENTORY ACCESS MODULE]: Could not find item {0} for {1} in RezObject()", | ||
711 | itemID, remoteClient.Name); | ||
712 | |||
713 | return null; | 734 | return null; |
714 | } | 735 | } |
715 | 736 | ||
@@ -760,6 +781,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
760 | if (e == null || attachment) // Single | 781 | if (e == null || attachment) // Single |
761 | { | 782 | { |
762 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 783 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
784 | if (!attachment) | ||
785 | { | ||
786 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
787 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
788 | g.RootPart.AttachRotation = g.GroupRotation; | ||
789 | g.RootPart.Shape.State = 0; | ||
790 | } | ||
763 | 791 | ||
764 | objlist.Add(g); | 792 | objlist.Add(g); |
765 | veclist.Add(new Vector3(0, 0, 0)); | 793 | veclist.Add(new Vector3(0, 0, 0)); |
@@ -789,6 +817,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
789 | foreach (XmlNode n in groups) | 817 | foreach (XmlNode n in groups) |
790 | { | 818 | { |
791 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | 819 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); |
820 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
821 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
822 | g.RootPart.AttachRotation = g.GroupRotation; | ||
823 | g.RootPart.Shape.State = 0; | ||
792 | 824 | ||
793 | objlist.Add(g); | 825 | objlist.Add(g); |
794 | XmlElement el = (XmlElement)n; | 826 | XmlElement el = (XmlElement)n; |
@@ -808,12 +840,35 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
808 | } | 840 | } |
809 | } | 841 | } |
810 | 842 | ||
843 | int primcount = 0; | ||
844 | foreach (SceneObjectGroup g in objlist) | ||
845 | primcount += g.PrimCount; | ||
846 | |||
847 | if (!m_Scene.Permissions.CanRezObject( | ||
848 | primcount, remoteClient.AgentId, pos) | ||
849 | && !attachment) | ||
850 | { | ||
851 | // The client operates in no fail mode. It will | ||
852 | // have already removed the item from the folder | ||
853 | // if it's no copy. | ||
854 | // Put it back if it's not an attachment | ||
855 | // | ||
856 | if (item != null) | ||
857 | { | ||
858 | if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment)) | ||
859 | remoteClient.SendBulkUpdateInventory(item); | ||
860 | } | ||
861 | |||
862 | return null; | ||
863 | } | ||
864 | |||
811 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) | 865 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) |
812 | return null; | 866 | return null; |
813 | 867 | ||
814 | for (int i = 0; i < objlist.Count; i++) | 868 | for (int i = 0; i < objlist.Count; i++) |
815 | { | 869 | { |
816 | group = objlist[i]; | 870 | group = objlist[i]; |
871 | SceneObjectPart rootPart = group.RootPart; | ||
817 | 872 | ||
818 | // m_log.DebugFormat( | 873 | // m_log.DebugFormat( |
819 | // "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", | 874 | // "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", |
@@ -874,8 +929,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
874 | 929 | ||
875 | if (!attachment) | 930 | if (!attachment) |
876 | { | 931 | { |
877 | SceneObjectPart rootPart = group.RootPart; | ||
878 | |||
879 | if (rootPart.Shape.PCode == (byte)PCode.Prim) | 932 | if (rootPart.Shape.PCode == (byte)PCode.Prim) |
880 | group.ClearPartAttachmentData(); | 933 | group.ClearPartAttachmentData(); |
881 | 934 | ||
@@ -893,6 +946,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
893 | // remoteClient.Name); | 946 | // remoteClient.Name); |
894 | } | 947 | } |
895 | 948 | ||
949 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
950 | |||
896 | if (item != null) | 951 | if (item != null) |
897 | DoPostRezWhenFromItem(item, attachment); | 952 | DoPostRezWhenFromItem(item, attachment); |
898 | 953 | ||
@@ -971,8 +1026,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
971 | { | 1026 | { |
972 | rootPart.Name = item.Name; | 1027 | rootPart.Name = item.Name; |
973 | rootPart.Description = item.Description; | 1028 | rootPart.Description = item.Description; |
974 | rootPart.ObjectSaleType = item.SaleType; | 1029 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) |
975 | rootPart.SalePrice = item.SalePrice; | 1030 | { |
1031 | rootPart.ObjectSaleType = item.SaleType; | ||
1032 | rootPart.SalePrice = item.SalePrice; | ||
1033 | } | ||
976 | } | 1034 | } |
977 | 1035 | ||
978 | so.FromFolderID = item.Folder; | 1036 | so.FromFolderID = item.Folder; |
@@ -982,7 +1040,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
982 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); | 1040 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); |
983 | 1041 | ||
984 | if ((rootPart.OwnerID != item.Owner) || | 1042 | if ((rootPart.OwnerID != item.Owner) || |
985 | (item.CurrentPermissions & 16) != 0) | 1043 | (item.CurrentPermissions & 16) != 0 || |
1044 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
986 | { | 1045 | { |
987 | //Need to kill the for sale here | 1046 | //Need to kill the for sale here |
988 | rootPart.ObjectSaleType = 0; | 1047 | rootPart.ObjectSaleType = 0; |
@@ -992,31 +1051,43 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
992 | { | 1051 | { |
993 | foreach (SceneObjectPart part in so.Parts) | 1052 | foreach (SceneObjectPart part in so.Parts) |
994 | { | 1053 | { |
995 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
996 | { | ||
997 | part.EveryoneMask = item.EveryOnePermissions; | ||
998 | part.NextOwnerMask = item.NextPermissions; | ||
999 | } | ||
1000 | part.GroupMask = 0; // DO NOT propagate here | 1054 | part.GroupMask = 0; // DO NOT propagate here |
1055 | |||
1056 | part.LastOwnerID = part.OwnerID; | ||
1057 | part.OwnerID = item.Owner; | ||
1058 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
1001 | } | 1059 | } |
1002 | 1060 | ||
1003 | so.ApplyNextOwnerPermissions(); | 1061 | so.ApplyNextOwnerPermissions(); |
1062 | |||
1063 | // In case the user has changed flags on a received item | ||
1064 | // we have to apply those changes after the slam. Else we | ||
1065 | // get a net loss of permissions | ||
1066 | foreach (SceneObjectPart part in so.Parts) | ||
1067 | { | ||
1068 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
1069 | { | ||
1070 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
1071 | part.EveryoneMask = item.EveryOnePermissions & part.BaseMask; | ||
1072 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
1073 | part.NextOwnerMask = item.NextPermissions & part.BaseMask; | ||
1074 | } | ||
1075 | } | ||
1004 | } | 1076 | } |
1005 | } | 1077 | } |
1006 | 1078 | else | |
1007 | foreach (SceneObjectPart part in so.Parts) | ||
1008 | { | 1079 | { |
1009 | part.FromUserInventoryItemID = fromUserInventoryItemId; | 1080 | foreach (SceneObjectPart part in so.Parts) |
1010 | |||
1011 | if ((part.OwnerID != item.Owner) || | ||
1012 | (item.CurrentPermissions & 16) != 0) | ||
1013 | { | 1081 | { |
1014 | part.Inventory.ChangeInventoryOwner(item.Owner); | 1082 | part.FromUserInventoryItemID = fromUserInventoryItemId; |
1015 | part.GroupMask = 0; // DO NOT propagate here | 1083 | |
1084 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
1085 | part.EveryoneMask = item.EveryOnePermissions; | ||
1086 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
1087 | part.NextOwnerMask = item.NextPermissions; | ||
1088 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
1089 | part.GroupMask = item.GroupPermissions; | ||
1016 | } | 1090 | } |
1017 | |||
1018 | part.EveryoneMask = item.EveryOnePermissions; | ||
1019 | part.NextOwnerMask = item.NextPermissions; | ||
1020 | } | 1091 | } |
1021 | 1092 | ||
1022 | rootPart.TrimPermissions(); | 1093 | rootPart.TrimPermissions(); |
@@ -1154,4 +1225,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1154 | 1225 | ||
1155 | #endregion | 1226 | #endregion |
1156 | } | 1227 | } |
1157 | } \ No newline at end of file | 1228 | } |