diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 128 |
1 files changed, 100 insertions, 28 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8171487..ee9961f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -355,6 +355,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
355 | 355 | ||
356 | foreach (SceneObjectGroup objectGroup in objlist) | 356 | foreach (SceneObjectGroup objectGroup in objlist) |
357 | { | 357 | { |
358 | if (objectGroup.RootPart.KeyframeMotion != null) | ||
359 | objectGroup.RootPart.KeyframeMotion.Stop(); | ||
360 | objectGroup.RootPart.SetForce(Vector3.Zero); | ||
361 | objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); | ||
362 | objectGroup.RootPart.KeyframeMotion = null; | ||
363 | |||
358 | Vector3 inventoryStoredPosition = new Vector3 | 364 | Vector3 inventoryStoredPosition = new Vector3 |
359 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | 365 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) |
360 | ? 250 | 366 | ? 250 |
@@ -365,9 +371,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
365 | : objectGroup.AbsolutePosition.Y, | 371 | : objectGroup.AbsolutePosition.Y, |
366 | objectGroup.AbsolutePosition.Z); | 372 | objectGroup.AbsolutePosition.Z); |
367 | 373 | ||
374 | Quaternion inventoryStoredRotation = objectGroup.GroupRotation; | ||
368 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; | 375 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; |
369 | 376 | ||
377 | // Restore attachment data after trip through the sim | ||
378 | if (objectGroup.RootPart.AttachPoint > 0) | ||
379 | { | ||
380 | inventoryStoredPosition = objectGroup.RootPart.AttachOffset; | ||
381 | inventoryStoredRotation = objectGroup.RootPart.AttachRotation; | ||
382 | } | ||
383 | objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; | ||
384 | |||
370 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 385 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
386 | objectGroup.RootPart.RotationOffset = inventoryStoredRotation; | ||
371 | 387 | ||
372 | // Make sure all bits but the ones we want are clear | 388 | // Make sure all bits but the ones we want are clear |
373 | // on take. | 389 | // on take. |
@@ -476,8 +492,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
476 | IClientAPI remoteClient) | 492 | IClientAPI remoteClient) |
477 | { | 493 | { |
478 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | 494 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
495 | // For the porposes of inventory, an object is modify if the prims | ||
496 | // are modify. This allows renaming an object that contains no | ||
497 | // mod items. | ||
479 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | 498 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) |
480 | effectivePerms &= grp.GetEffectivePermissions(); | 499 | { |
500 | uint groupPerms = grp.GetEffectivePermissions(true); | ||
501 | if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0) | ||
502 | groupPerms |= (uint)PermissionMask.Modify; | ||
503 | |||
504 | effectivePerms &= groupPerms; | ||
505 | } | ||
481 | effectivePerms |= (uint)PermissionMask.Move; | 506 | effectivePerms |= (uint)PermissionMask.Move; |
482 | 507 | ||
483 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 508 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
@@ -657,7 +682,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
657 | if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) | 682 | if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) |
658 | { | 683 | { |
659 | InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); | 684 | InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); |
660 | folder = m_Scene.InventoryService.GetFolder(f); | 685 | if (f != null) |
686 | folder = m_Scene.InventoryService.GetFolder(f); | ||
661 | } | 687 | } |
662 | } | 688 | } |
663 | 689 | ||
@@ -687,15 +713,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
687 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 713 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
688 | { | 714 | { |
689 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); | 715 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); |
690 | |||
691 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 716 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
692 | item = m_Scene.InventoryService.GetItem(item); | 717 | item = m_Scene.InventoryService.GetItem(item); |
693 | 718 | ||
694 | if (item == null) | 719 | if (item == null) |
695 | { | 720 | { |
696 | m_log.WarnFormat( | ||
697 | "[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()", | ||
698 | itemID, remoteClient.Name); | ||
699 | 721 | ||
700 | return null; | 722 | return null; |
701 | } | 723 | } |
@@ -747,6 +769,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
747 | if (e == null || attachment) // Single | 769 | if (e == null || attachment) // Single |
748 | { | 770 | { |
749 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 771 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
772 | if (!attachment) | ||
773 | { | ||
774 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
775 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
776 | g.RootPart.AttachRotation = g.GroupRotation; | ||
777 | g.RootPart.Shape.State = 0; | ||
778 | } | ||
750 | 779 | ||
751 | objlist.Add(g); | 780 | objlist.Add(g); |
752 | veclist.Add(new Vector3(0, 0, 0)); | 781 | veclist.Add(new Vector3(0, 0, 0)); |
@@ -776,6 +805,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
776 | foreach (XmlNode n in groups) | 805 | foreach (XmlNode n in groups) |
777 | { | 806 | { |
778 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | 807 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); |
808 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
809 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
810 | g.RootPart.AttachRotation = g.GroupRotation; | ||
811 | g.RootPart.Shape.State = 0; | ||
779 | 812 | ||
780 | objlist.Add(g); | 813 | objlist.Add(g); |
781 | XmlElement el = (XmlElement)n; | 814 | XmlElement el = (XmlElement)n; |
@@ -795,12 +828,35 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
795 | } | 828 | } |
796 | } | 829 | } |
797 | 830 | ||
831 | int primcount = 0; | ||
832 | foreach (SceneObjectGroup g in objlist) | ||
833 | primcount += g.PrimCount; | ||
834 | |||
835 | if (!m_Scene.Permissions.CanRezObject( | ||
836 | primcount, remoteClient.AgentId, pos) | ||
837 | && !attachment) | ||
838 | { | ||
839 | // The client operates in no fail mode. It will | ||
840 | // have already removed the item from the folder | ||
841 | // if it's no copy. | ||
842 | // Put it back if it's not an attachment | ||
843 | // | ||
844 | if (item != null) | ||
845 | { | ||
846 | if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment)) | ||
847 | remoteClient.SendBulkUpdateInventory(item); | ||
848 | } | ||
849 | |||
850 | return null; | ||
851 | } | ||
852 | |||
798 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) | 853 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) |
799 | return null; | 854 | return null; |
800 | 855 | ||
801 | for (int i = 0; i < objlist.Count; i++) | 856 | for (int i = 0; i < objlist.Count; i++) |
802 | { | 857 | { |
803 | group = objlist[i]; | 858 | group = objlist[i]; |
859 | SceneObjectPart rootPart = group.RootPart; | ||
804 | 860 | ||
805 | // m_log.DebugFormat( | 861 | // m_log.DebugFormat( |
806 | // "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", | 862 | // "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", |
@@ -861,8 +917,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
861 | 917 | ||
862 | if (!attachment) | 918 | if (!attachment) |
863 | { | 919 | { |
864 | SceneObjectPart rootPart = group.RootPart; | ||
865 | |||
866 | if (rootPart.Shape.PCode == (byte)PCode.Prim) | 920 | if (rootPart.Shape.PCode == (byte)PCode.Prim) |
867 | group.ClearPartAttachmentData(); | 921 | group.ClearPartAttachmentData(); |
868 | 922 | ||
@@ -880,6 +934,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
880 | // remoteClient.Name); | 934 | // remoteClient.Name); |
881 | } | 935 | } |
882 | 936 | ||
937 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
938 | |||
883 | if (item != null) | 939 | if (item != null) |
884 | DoPostRezWhenFromItem(item, attachment); | 940 | DoPostRezWhenFromItem(item, attachment); |
885 | 941 | ||
@@ -958,8 +1014,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
958 | { | 1014 | { |
959 | rootPart.Name = item.Name; | 1015 | rootPart.Name = item.Name; |
960 | rootPart.Description = item.Description; | 1016 | rootPart.Description = item.Description; |
961 | rootPart.ObjectSaleType = item.SaleType; | 1017 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) |
962 | rootPart.SalePrice = item.SalePrice; | 1018 | { |
1019 | rootPart.ObjectSaleType = item.SaleType; | ||
1020 | rootPart.SalePrice = item.SalePrice; | ||
1021 | } | ||
963 | } | 1022 | } |
964 | 1023 | ||
965 | so.FromFolderID = item.Folder; | 1024 | so.FromFolderID = item.Folder; |
@@ -968,7 +1027,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
968 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); | 1027 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); |
969 | 1028 | ||
970 | if ((rootPart.OwnerID != item.Owner) || | 1029 | if ((rootPart.OwnerID != item.Owner) || |
971 | (item.CurrentPermissions & 16) != 0) | 1030 | (item.CurrentPermissions & 16) != 0 || |
1031 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
972 | { | 1032 | { |
973 | //Need to kill the for sale here | 1033 | //Need to kill the for sale here |
974 | rootPart.ObjectSaleType = 0; | 1034 | rootPart.ObjectSaleType = 0; |
@@ -978,31 +1038,43 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
978 | { | 1038 | { |
979 | foreach (SceneObjectPart part in so.Parts) | 1039 | foreach (SceneObjectPart part in so.Parts) |
980 | { | 1040 | { |
981 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
982 | { | ||
983 | part.EveryoneMask = item.EveryOnePermissions; | ||
984 | part.NextOwnerMask = item.NextPermissions; | ||
985 | } | ||
986 | part.GroupMask = 0; // DO NOT propagate here | 1041 | part.GroupMask = 0; // DO NOT propagate here |
1042 | |||
1043 | part.LastOwnerID = part.OwnerID; | ||
1044 | part.OwnerID = item.Owner; | ||
1045 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
987 | } | 1046 | } |
988 | 1047 | ||
989 | so.ApplyNextOwnerPermissions(); | 1048 | so.ApplyNextOwnerPermissions(); |
1049 | |||
1050 | // In case the user has changed flags on a received item | ||
1051 | // we have to apply those changes after the slam. Else we | ||
1052 | // get a net loss of permissions | ||
1053 | foreach (SceneObjectPart part in so.Parts) | ||
1054 | { | ||
1055 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
1056 | { | ||
1057 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
1058 | part.EveryoneMask = item.EveryOnePermissions & part.BaseMask; | ||
1059 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
1060 | part.NextOwnerMask = item.NextPermissions & part.BaseMask; | ||
1061 | } | ||
1062 | } | ||
990 | } | 1063 | } |
991 | } | 1064 | } |
992 | 1065 | else | |
993 | foreach (SceneObjectPart part in so.Parts) | ||
994 | { | 1066 | { |
995 | part.FromUserInventoryItemID = fromUserInventoryItemId; | 1067 | foreach (SceneObjectPart part in so.Parts) |
996 | |||
997 | if ((part.OwnerID != item.Owner) || | ||
998 | (item.CurrentPermissions & 16) != 0) | ||
999 | { | 1068 | { |
1000 | part.Inventory.ChangeInventoryOwner(item.Owner); | 1069 | part.FromUserInventoryItemID = fromUserInventoryItemId; |
1001 | part.GroupMask = 0; // DO NOT propagate here | 1070 | |
1071 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
1072 | part.EveryoneMask = item.EveryOnePermissions; | ||
1073 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
1074 | part.NextOwnerMask = item.NextPermissions; | ||
1075 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
1076 | part.GroupMask = item.GroupPermissions; | ||
1002 | } | 1077 | } |
1003 | |||
1004 | part.EveryoneMask = item.EveryOnePermissions; | ||
1005 | part.NextOwnerMask = item.NextPermissions; | ||
1006 | } | 1078 | } |
1007 | 1079 | ||
1008 | rootPart.TrimPermissions(); | 1080 | rootPart.TrimPermissions(); |
@@ -1140,4 +1212,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1140 | 1212 | ||
1141 | #endregion | 1213 | #endregion |
1142 | } | 1214 | } |
1143 | } \ No newline at end of file | 1215 | } |