diff options
Diffstat (limited to 'OpenSim')
13 files changed, 260 insertions, 97 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 5453420..cf2e037 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -2942,15 +2942,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2942 | /// </summary> | 2942 | /// </summary> |
2943 | private void ApplyNextOwnerPermissions(InventoryItemBase item) | 2943 | private void ApplyNextOwnerPermissions(InventoryItemBase item) |
2944 | { | 2944 | { |
2945 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 2945 | if (item.InvType == (int)InventoryType.Object) |
2946 | { | 2946 | { |
2947 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 2947 | uint perms = item.CurrentPermissions; |
2948 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | 2948 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms); |
2949 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 2949 | item.CurrentPermissions = perms; |
2950 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | ||
2951 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
2952 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
2953 | } | 2950 | } |
2951 | |||
2954 | item.CurrentPermissions &= item.NextPermissions; | 2952 | item.CurrentPermissions &= item.NextPermissions; |
2955 | item.BasePermissions &= item.NextPermissions; | 2953 | item.BasePermissions &= item.NextPermissions; |
2956 | item.EveryOnePermissions &= item.NextPermissions; | 2954 | item.EveryOnePermissions &= item.NextPermissions; |
diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs new file mode 100644 index 0000000..d785a78 --- /dev/null +++ b/OpenSim/Framework/PermissionsUtil.cs | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using log4net; | ||
33 | |||
34 | namespace OpenSim.Framework | ||
35 | { | ||
36 | public static class PermissionsUtil | ||
37 | { | ||
38 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
39 | |||
40 | /// <summary> | ||
41 | /// Logs permissions flags. Useful when debugging permission problems. | ||
42 | /// </summary> | ||
43 | /// <param name="message"></param> | ||
44 | public static void LogPermissions(String name, String message, uint basePerm, uint curPerm, uint nextPerm) | ||
45 | { | ||
46 | m_log.DebugFormat("Permissions of \"{0}\" at \"{1}\": Base {2} ({3:X4}), Current {4} ({5:X4}), NextOwner {6} ({7:X4})", | ||
47 | name, message, | ||
48 | PermissionsToString(basePerm), basePerm, PermissionsToString(curPerm), curPerm, PermissionsToString(nextPerm), nextPerm); | ||
49 | } | ||
50 | |||
51 | /// <summary> | ||
52 | /// Converts a permissions bit-mask to a string (e.g., "MCT"). | ||
53 | /// </summary> | ||
54 | private static string PermissionsToString(uint perms) | ||
55 | { | ||
56 | string str = ""; | ||
57 | if ((perms & (int)PermissionMask.Modify) != 0) | ||
58 | str += "M"; | ||
59 | if ((perms & (int)PermissionMask.Copy) != 0) | ||
60 | str += "C"; | ||
61 | if ((perms & (int)PermissionMask.Transfer) != 0) | ||
62 | str += "T"; | ||
63 | if (str == "") | ||
64 | str = "."; | ||
65 | return str; | ||
66 | } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Applies an object's folded permissions to its regular permissions. | ||
70 | /// </summary> | ||
71 | /// <param name="foldedPerms">The folded permissions. Only the lowest 7 bits are examined.</param> | ||
72 | /// <param name="mainPerms">The permissions variable to modify.</param> | ||
73 | public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms) | ||
74 | { | ||
75 | if ((foldedPerms & 7) == 0) | ||
76 | return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded | ||
77 | |||
78 | if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0) | ||
79 | mainPerms &= ~(uint)PermissionMask.Copy; | ||
80 | if ((foldedPerms & ((uint)PermissionMask.Transfer >> 13)) == 0) | ||
81 | mainPerms &= ~(uint)PermissionMask.Transfer; | ||
82 | if ((foldedPerms & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
83 | mainPerms &= ~(uint)PermissionMask.Modify; | ||
84 | } | ||
85 | |||
86 | } | ||
87 | } | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 87a53ff..eefbde5 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -2084,8 +2084,10 @@ namespace OpenSim.Framework | |||
2084 | #region Xml Serialization Utilities | 2084 | #region Xml Serialization Utilities |
2085 | public static bool ReadBoolean(XmlTextReader reader) | 2085 | public static bool ReadBoolean(XmlTextReader reader) |
2086 | { | 2086 | { |
2087 | // AuroraSim uses "int" for some fields that are boolean in OpenSim, e.g. "PassCollisions". Don't fail because of this. | ||
2087 | reader.ReadStartElement(); | 2088 | reader.ReadStartElement(); |
2088 | bool result = Boolean.Parse(reader.ReadContentAsString().ToLower()); | 2089 | string val = reader.ReadContentAsString().ToLower(); |
2090 | bool result = val.Equals("true") || val.Equals("1"); | ||
2089 | reader.ReadEndElement(); | 2091 | reader.ReadEndElement(); |
2090 | 2092 | ||
2091 | return result; | 2093 | return result; |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 6251266..fadcd5e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -439,17 +439,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
439 | 439 | ||
440 | if (item == null) | 440 | if (item == null) |
441 | return null; | 441 | return null; |
442 | |||
443 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
444 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
442 | 445 | ||
443 | // Can't know creator is the same, so null it in inventory | ||
444 | if (objlist.Count > 1) | 446 | if (objlist.Count > 1) |
445 | { | 447 | { |
446 | item.CreatorId = UUID.Zero.ToString(); | ||
447 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | 448 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; |
449 | |||
450 | // If the objects have different creators then don't specify a creator at all | ||
451 | foreach (SceneObjectGroup objectGroup in objlist) | ||
452 | { | ||
453 | if ((objectGroup.RootPart.CreatorID.ToString() != item.CreatorId) | ||
454 | || (objectGroup.RootPart.CreatorData.ToString() != item.CreatorData)) | ||
455 | { | ||
456 | item.CreatorId = UUID.Zero.ToString(); | ||
457 | item.CreatorData = string.Empty; | ||
458 | break; | ||
459 | } | ||
460 | } | ||
448 | } | 461 | } |
449 | else | 462 | else |
450 | { | 463 | { |
451 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
452 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
453 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | 464 | item.SaleType = objlist[0].RootPart.ObjectSaleType; |
454 | item.SalePrice = objlist[0].RootPart.SalePrice; | 465 | item.SalePrice = objlist[0].RootPart.SalePrice; |
455 | } | 466 | } |
@@ -470,13 +481,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
470 | } | 481 | } |
471 | else | 482 | else |
472 | { | 483 | { |
473 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
474 | |||
475 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 484 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
476 | item.Description = asset.Description; | 485 | item.Description = asset.Description; |
477 | item.Name = asset.Name; | 486 | item.Name = asset.Name; |
478 | item.AssetType = asset.Type; | 487 | item.AssetType = asset.Type; |
479 | 488 | ||
489 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
490 | |||
480 | m_Scene.AddInventoryItem(item); | 491 | m_Scene.AddInventoryItem(item); |
481 | 492 | ||
482 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 493 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
@@ -531,16 +542,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
531 | } | 542 | } |
532 | effectivePerms |= (uint)PermissionMask.Move; | 543 | effectivePerms |= (uint)PermissionMask.Move; |
533 | 544 | ||
545 | //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
546 | |||
534 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 547 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
535 | { | 548 | { |
536 | uint perms = effectivePerms; | 549 | uint perms = effectivePerms; |
537 | uint nextPerms = (perms & 7) << 13; | 550 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); |
538 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
539 | perms &= ~(uint)PermissionMask.Copy; | ||
540 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
541 | perms &= ~(uint)PermissionMask.Transfer; | ||
542 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
543 | perms &= ~(uint)PermissionMask.Modify; | ||
544 | 551 | ||
545 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | 552 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; |
546 | item.CurrentPermissions = item.BasePermissions; | 553 | item.CurrentPermissions = item.BasePermissions; |
@@ -548,10 +555,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
548 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | 555 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; |
549 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | 556 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; |
550 | 557 | ||
551 | // Magic number badness. Maybe this deserves an enum. | 558 | // apply next owner perms on rez |
552 | // bit 4 (16) is the "Slam" bit, it means treat as passed | 559 | item.CurrentPermissions |= SceneObjectGroup.SLAM; |
553 | // and apply next owner perms on rez | ||
554 | item.CurrentPermissions |= 16; // Slam! | ||
555 | } | 560 | } |
556 | else | 561 | else |
557 | { | 562 | { |
@@ -568,8 +573,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
568 | (uint)PermissionMask.Move | | 573 | (uint)PermissionMask.Move | |
569 | (uint)PermissionMask.Export | | 574 | (uint)PermissionMask.Export | |
570 | 7); // Preserve folded permissions | 575 | 7); // Preserve folded permissions |
571 | } | 576 | } |
572 | 577 | ||
578 | //PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
579 | |||
573 | return item; | 580 | return item; |
574 | } | 581 | } |
575 | 582 | ||
@@ -864,11 +871,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
864 | group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; | 871 | group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; |
865 | } | 872 | } |
866 | 873 | ||
867 | foreach (SceneObjectPart part in group.Parts) | 874 | if (item == null) |
868 | { | 875 | { |
869 | // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. | 876 | // Change ownership. Normally this is done in DoPreRezWhenFromItem(), but in this case we must do it here. |
870 | part.LastOwnerID = part.OwnerID; | 877 | foreach (SceneObjectPart part in group.Parts) |
871 | part.OwnerID = remoteClient.AgentId; | 878 | { |
879 | // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. | ||
880 | part.LastOwnerID = part.OwnerID; | ||
881 | part.OwnerID = remoteClient.AgentId; | ||
882 | } | ||
872 | } | 883 | } |
873 | 884 | ||
874 | if (!attachment) | 885 | if (!attachment) |
@@ -1077,7 +1088,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1077 | part.GroupMask = item.GroupPermissions; | 1088 | part.GroupMask = item.GroupPermissions; |
1078 | } | 1089 | } |
1079 | } | 1090 | } |
1080 | 1091 | ||
1081 | rootPart.TrimPermissions(); | 1092 | rootPart.TrimPermissions(); |
1082 | 1093 | ||
1083 | if (isAttachment) | 1094 | if (isAttachment) |
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 28daf2f..d4e4c25 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -205,13 +205,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
205 | item.InvType = (int)InventoryType.Object; | 205 | item.InvType = (int)InventoryType.Object; |
206 | item.Folder = categoryID; | 206 | item.Folder = categoryID; |
207 | 207 | ||
208 | uint nextPerms=(perms & 7) << 13; | 208 | PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); |
209 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
210 | perms &= ~(uint)PermissionMask.Copy; | ||
211 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
212 | perms &= ~(uint)PermissionMask.Transfer; | ||
213 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
214 | perms &= ~(uint)PermissionMask.Modify; | ||
215 | 209 | ||
216 | item.BasePermissions = perms & part.NextOwnerMask; | 210 | item.BasePermissions = perms & part.NextOwnerMask; |
217 | item.CurrentPermissions = perms & part.NextOwnerMask; | 211 | item.CurrentPermissions = perms & part.NextOwnerMask; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f384462..cba75f1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -664,17 +664,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
664 | // a mask | 664 | // a mask |
665 | if (item.InvType == (int)InventoryType.Object) | 665 | if (item.InvType == (int)InventoryType.Object) |
666 | { | 666 | { |
667 | // Create a safe mask for the current perms | ||
668 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; | ||
669 | foldedPerms |= permsMask; | ||
670 | |||
671 | bool isRootMod = (item.CurrentPermissions & | 667 | bool isRootMod = (item.CurrentPermissions & |
672 | (uint)PermissionMask.Modify) != 0 ? | 668 | (uint)PermissionMask.Modify) != 0 ? |
673 | true : false; | 669 | true : false; |
674 | 670 | ||
675 | // Mask the owner perms to the folded perms | 671 | // Mask the owner perms to the folded perms |
676 | ownerPerms &= foldedPerms; | 672 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms); |
677 | basePerms &= foldedPerms; | 673 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms); |
678 | 674 | ||
679 | // If the root was mod, let the mask reflect that | 675 | // If the root was mod, let the mask reflect that |
680 | // We also need to adjust the base here, because | 676 | // We also need to adjust the base here, because |
@@ -1235,9 +1231,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1235 | { | 1231 | { |
1236 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 1232 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
1237 | if (taskItem.InvType == (int)InventoryType.Object) | 1233 | if (taskItem.InvType == (int)InventoryType.Object) |
1238 | agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); | 1234 | { |
1235 | uint perms = taskItem.CurrentPermissions; | ||
1236 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); | ||
1237 | agentItem.BasePermissions = perms | (uint)PermissionMask.Move; | ||
1238 | agentItem.CurrentPermissions = agentItem.BasePermissions; | ||
1239 | } | ||
1239 | else | 1240 | else |
1241 | { | ||
1240 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; | 1242 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; |
1243 | } | ||
1241 | 1244 | ||
1242 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 1245 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
1243 | agentItem.NextPermissions = taskItem.NextPermissions; | 1246 | agentItem.NextPermissions = taskItem.NextPermissions; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9db34fd..2420048 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -111,6 +111,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
111 | STATUS_ROTATE_Z = 0x008, | 111 | STATUS_ROTATE_Z = 0x008, |
112 | } | 112 | } |
113 | 113 | ||
114 | // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm | ||
115 | public static readonly uint SLAM = 16; | ||
116 | |||
114 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; | 117 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; |
115 | 118 | ||
116 | /// <summary> | 119 | /// <summary> |
@@ -3810,13 +3813,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3810 | // needs to be called with phys building true | 3813 | // needs to be called with phys building true |
3811 | Vector3 oldPos; | 3814 | Vector3 oldPos; |
3812 | 3815 | ||
3813 | // FIXME: This improves the situation where editing just the root prim of an attached object would send | ||
3814 | // all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim | ||
3815 | // still ends up in the wrong position on reattach. | ||
3816 | if (IsAttachment) | 3816 | if (IsAttachment) |
3817 | oldPos = RootPart.OffsetPosition; | 3817 | oldPos = m_rootPart.AttachedPos + m_rootPart.OffsetPosition; // OffsetPosition should always be 0 in an attachments's root prim |
3818 | else | 3818 | else |
3819 | oldPos = AbsolutePosition + RootPart.OffsetPosition; | 3819 | oldPos = AbsolutePosition + m_rootPart.OffsetPosition; |
3820 | 3820 | ||
3821 | Vector3 diff = oldPos - newPos; | 3821 | Vector3 diff = oldPos - newPos; |
3822 | Quaternion partRotation = m_rootPart.RotationOffset; | 3822 | Quaternion partRotation = m_rootPart.RotationOffset; |
@@ -3831,6 +3831,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3831 | } | 3831 | } |
3832 | 3832 | ||
3833 | AbsolutePosition = newPos; | 3833 | AbsolutePosition = newPos; |
3834 | |||
3835 | if (IsAttachment) | ||
3836 | m_rootPart.AttachedPos = newPos; | ||
3834 | 3837 | ||
3835 | HasGroupChanged = true; | 3838 | HasGroupChanged = true; |
3836 | if (m_rootPart.Undoing) | 3839 | if (m_rootPart.Undoing) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5851ec6..ce9baaa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -5293,6 +5293,64 @@ namespace OpenSim.Region.Framework.Scenes | |||
5293 | { | 5293 | { |
5294 | ParentGroup.AddScriptLPS(count); | 5294 | ParentGroup.AddScriptLPS(count); |
5295 | } | 5295 | } |
5296 | |||
5297 | /// <summary> | ||
5298 | /// Sets a prim's owner and permissions when it's rezzed. | ||
5299 | /// </summary> | ||
5300 | /// <param name="item">The inventory item from which the item was rezzed</param> | ||
5301 | /// <param name="userInventory">True: the item is being rezzed from the user's inventory. False: from a prim's inventory.</param> | ||
5302 | /// <param name="scene">The scene the prim is being rezzed into</param> | ||
5303 | public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene) | ||
5304 | { | ||
5305 | if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)) | ||
5306 | { | ||
5307 | if (scene.Permissions.PropagatePermissions()) | ||
5308 | { | ||
5309 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
5310 | { | ||
5311 | // Apply the item's permissions to the object | ||
5312 | //LogPermissions("Before applying item permissions"); | ||
5313 | if (userInventory) | ||
5314 | { | ||
5315 | EveryoneMask = item.EveryOnePermissions; | ||
5316 | NextOwnerMask = item.NextPermissions; | ||
5317 | } | ||
5318 | else | ||
5319 | { | ||
5320 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
5321 | EveryoneMask = item.EveryOnePermissions; | ||
5322 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
5323 | NextOwnerMask = item.NextPermissions; | ||
5324 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
5325 | GroupMask = item.GroupPermissions; | ||
5326 | } | ||
5327 | //LogPermissions("After applying item permissions"); | ||
5328 | } | ||
5329 | } | ||
5330 | |||
5331 | GroupMask = 0; // DO NOT propagate here | ||
5332 | } | ||
5333 | |||
5334 | if (OwnerID != item.Owner) | ||
5335 | { | ||
5336 | //LogPermissions("Before ApplyNextOwnerPermissions"); | ||
5337 | ApplyNextOwnerPermissions(); | ||
5338 | //LogPermissions("After ApplyNextOwnerPermissions"); | ||
5339 | |||
5340 | LastOwnerID = OwnerID; | ||
5341 | OwnerID = item.Owner; | ||
5342 | Inventory.ChangeInventoryOwner(item.Owner); | ||
5343 | } | ||
5344 | } | ||
5345 | |||
5346 | /// <summary> | ||
5347 | /// Logs the prim's permissions. Useful when debugging permission problems. | ||
5348 | /// </summary> | ||
5349 | /// <param name="message"></param> | ||
5350 | private void LogPermissions(String message) | ||
5351 | { | ||
5352 | PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask); | ||
5353 | } | ||
5296 | 5354 | ||
5297 | public void ApplyNextOwnerPermissions() | 5355 | public void ApplyNextOwnerPermissions() |
5298 | { | 5356 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b4fc472..8893cc0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -916,48 +916,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
916 | // Since renaming the item in the inventory does not affect the name stored | 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 | 917 | // in the serialization, transfer the correct name from the inventory to the |
918 | // object itself before we rez. | 918 | // object itself before we rez. |
919 | rootPart.Name = item.Name; | 919 | // Only do these for the first object if we are rezzing a coalescence. |
920 | rootPart.Description = item.Description; | 920 | if (i == 0) |
921 | |||
922 | SceneObjectPart[] partList = group.Parts; | ||
923 | |||
924 | group.SetGroup(m_part.GroupID, null); | ||
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 | ||
928 | { | 921 | { |
929 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | 922 | rootPart.Name = item.Name; |
930 | { | 923 | rootPart.Description = item.Description; |
931 | foreach (SceneObjectPart part in partList) | ||
932 | { | ||
933 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
934 | part.EveryoneMask = item.EveryonePermissions; | ||
935 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
936 | part.NextOwnerMask = item.NextPermissions; | ||
937 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
938 | part.GroupMask = item.GroupPermissions; | ||
939 | } | ||
940 | |||
941 | group.ApplyNextOwnerPermissions(); | ||
942 | } | ||
943 | } | 924 | } |
944 | 925 | ||
945 | foreach (SceneObjectPart part in partList) | 926 | group.SetGroup(m_part.GroupID, null); |
946 | { | ||
947 | // TODO: Remove magic number badness | ||
948 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
949 | { | ||
950 | part.LastOwnerID = part.OwnerID; | ||
951 | part.OwnerID = item.OwnerID; | ||
952 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
953 | } | ||
954 | 927 | ||
955 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 928 | foreach (SceneObjectPart part in group.Parts) |
956 | part.EveryoneMask = item.EveryonePermissions; | 929 | { |
957 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | 930 | // Convert between InventoryItem classes. You can never have too many similar but slightly different classes :) |
958 | part.NextOwnerMask = item.NextPermissions; | 931 | InventoryItemBase dest = new InventoryItemBase(item.ItemID, item.OwnerID); |
959 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 932 | dest.BasePermissions = item.BasePermissions; |
960 | part.GroupMask = item.GroupPermissions; | 933 | dest.CurrentPermissions = item.CurrentPermissions; |
934 | dest.EveryOnePermissions = item.EveryonePermissions; | ||
935 | dest.GroupPermissions = item.GroupPermissions; | ||
936 | dest.NextPermissions = item.NextPermissions; | ||
937 | dest.Flags = item.Flags; | ||
938 | |||
939 | part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene); | ||
961 | } | 940 | } |
962 | 941 | ||
963 | rootPart.TrimPermissions(); | 942 | rootPart.TrimPermissions(); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8ff17f6..252c72f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1903,6 +1903,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1903 | ControllingClient.SendAgentTerseUpdate(this); | 1903 | ControllingClient.SendAgentTerseUpdate(this); |
1904 | 1904 | ||
1905 | PhysicsActor actor = PhysicsActor; | 1905 | PhysicsActor actor = PhysicsActor; |
1906 | |||
1907 | // This will be the case if the agent is sitting on the groudn or on an object. | ||
1906 | if (actor == null) | 1908 | if (actor == null) |
1907 | { | 1909 | { |
1908 | SendControlsToScripts(flagsForScripts); | 1910 | SendControlsToScripts(flagsForScripts); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 5a0a14c..fe5ff6c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -71,7 +71,7 @@ public abstract class BSShape | |||
71 | lastReferenced = DateTime.Now; | 71 | lastReferenced = DateTime.Now; |
72 | } | 72 | } |
73 | 73 | ||
74 | // Called when this shape is being used again. | 74 | // Called when this shape is done being used. |
75 | protected virtual void DecrementReference() | 75 | protected virtual void DecrementReference() |
76 | { | 76 | { |
77 | referenceCount--; | 77 | referenceCount--; |
@@ -868,6 +868,8 @@ public class BSShapeHull : BSShape | |||
868 | public class BSShapeCompound : BSShape | 868 | public class BSShapeCompound : BSShape |
869 | { | 869 | { |
870 | private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; | 870 | private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; |
871 | public static Dictionary<string, BSShapeCompound> CompoundShapes = new Dictionary<string, BSShapeCompound>(); | ||
872 | |||
871 | public BSShapeCompound(BulletShape pShape) : base(pShape) | 873 | public BSShapeCompound(BulletShape pShape) : base(pShape) |
872 | { | 874 | { |
873 | } | 875 | } |
@@ -875,7 +877,9 @@ public class BSShapeCompound : BSShape | |||
875 | { | 877 | { |
876 | // Base compound shapes are not shared so this returns a raw shape. | 878 | // Base compound shapes are not shared so this returns a raw shape. |
877 | // A built compound shape can be reused in linksets. | 879 | // A built compound shape can be reused in linksets. |
878 | return new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); | 880 | BSShapeCompound ret = new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); |
881 | CompoundShapes.Add(ret.AddrString, ret); | ||
882 | return ret; | ||
879 | } | 883 | } |
880 | public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) | 884 | public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) |
881 | { | 885 | { |
@@ -913,10 +917,21 @@ public class BSShapeCompound : BSShape | |||
913 | BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); | 917 | BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); |
914 | DereferenceAnonCollisionShape(physicsScene, childShape); | 918 | DereferenceAnonCollisionShape(physicsScene, childShape); |
915 | } | 919 | } |
920 | |||
921 | lock (CompoundShapes) | ||
922 | CompoundShapes.Remove(physShapeInfo.AddrString); | ||
916 | physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); | 923 | physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); |
917 | } | 924 | } |
918 | } | 925 | } |
919 | } | 926 | } |
927 | public static bool TryGetCompoundByPtr(BulletShape pShape, out BSShapeCompound outCompound) | ||
928 | { | ||
929 | lock (CompoundShapes) | ||
930 | { | ||
931 | string addr = pShape.AddrString; | ||
932 | return CompoundShapes.TryGetValue(addr, out outCompound); | ||
933 | } | ||
934 | } | ||
920 | private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) | 935 | private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) |
921 | { | 936 | { |
922 | BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); | 937 | BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); |
@@ -928,10 +943,13 @@ public class BSShapeCompound : BSShape | |||
928 | private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) | 943 | private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) |
929 | { | 944 | { |
930 | // TODO: figure a better way to go through all the shape types and find a possible instance. | 945 | // TODO: figure a better way to go through all the shape types and find a possible instance. |
946 | physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,shape={1}", | ||
947 | BSScene.DetailLogZero, pShape); | ||
931 | BSShapeMesh meshDesc; | 948 | BSShapeMesh meshDesc; |
932 | if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) | 949 | if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) |
933 | { | 950 | { |
934 | meshDesc.Dereference(physicsScene); | 951 | meshDesc.Dereference(physicsScene); |
952 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundMesh,shape={1}", BSScene.DetailLogZero, pShape); | ||
935 | } | 953 | } |
936 | else | 954 | else |
937 | { | 955 | { |
@@ -939,13 +957,15 @@ public class BSShapeCompound : BSShape | |||
939 | if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) | 957 | if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) |
940 | { | 958 | { |
941 | hullDesc.Dereference(physicsScene); | 959 | hullDesc.Dereference(physicsScene); |
960 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundHull,shape={1}", BSScene.DetailLogZero, pShape); | ||
942 | } | 961 | } |
943 | else | 962 | else |
944 | { | 963 | { |
945 | BSShapeConvexHull chullDesc; | 964 | BSShapeConvexHull chullDesc; |
946 | if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc)) | 965 | if (BSShapeConvexHull.TryGetConvexHullByPtr(pShape, out chullDesc)) |
947 | { | 966 | { |
948 | chullDesc.Dereference(physicsScene); | 967 | chullDesc.Dereference(physicsScene); |
968 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundConvexHull,shape={1}", BSScene.DetailLogZero, pShape); | ||
949 | } | 969 | } |
950 | else | 970 | else |
951 | { | 971 | { |
@@ -953,20 +973,23 @@ public class BSShapeCompound : BSShape | |||
953 | if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) | 973 | if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) |
954 | { | 974 | { |
955 | gImpactDesc.Dereference(physicsScene); | 975 | gImpactDesc.Dereference(physicsScene); |
976 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundgImpact,shape={1}", BSScene.DetailLogZero, pShape); | ||
956 | } | 977 | } |
957 | else | 978 | else |
958 | { | 979 | { |
959 | // Didn't find it in the lists of specific types. It could be compound. | 980 | // Didn't find it in the lists of specific types. It could be compound. |
960 | if (physicsScene.PE.IsCompound(pShape)) | 981 | BSShapeCompound compoundDesc; |
982 | if (BSShapeCompound.TryGetCompoundByPtr(pShape, out compoundDesc)) | ||
961 | { | 983 | { |
962 | BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); | 984 | compoundDesc.Dereference(physicsScene); |
963 | recursiveCompound.Dereference(physicsScene); | 985 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,recursiveCompoundShape,shape={1}", BSScene.DetailLogZero, pShape); |
964 | } | 986 | } |
965 | else | 987 | else |
966 | { | 988 | { |
967 | // If none of the above, maybe it is a simple native shape. | 989 | // If none of the above, maybe it is a simple native shape. |
968 | if (physicsScene.PE.IsNativeShape(pShape)) | 990 | if (physicsScene.PE.IsNativeShape(pShape)) |
969 | { | 991 | { |
992 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,assumingNative,shape={1}", BSScene.DetailLogZero, pShape); | ||
970 | BSShapeNative nativeShape = new BSShapeNative(pShape); | 993 | BSShapeNative nativeShape = new BSShapeNative(pShape); |
971 | nativeShape.Dereference(physicsScene); | 994 | nativeShape.Dereference(physicsScene); |
972 | } | 995 | } |
@@ -1023,6 +1046,8 @@ public class BSShapeConvexHull : BSShape | |||
1023 | convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); | 1046 | convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); |
1024 | convexShape.shapeKey = newMeshKey; | 1047 | convexShape.shapeKey = newMeshKey; |
1025 | ConvexHulls.Add(convexShape.shapeKey, retConvexHull); | 1048 | ConvexHulls.Add(convexShape.shapeKey, retConvexHull); |
1049 | physicsScene.DetailLog("{0},BSShapeConvexHull.GetReference,addingNewlyCreatedShape,shape={1}", | ||
1050 | BSScene.DetailLogZero, convexShape); | ||
1026 | } | 1051 | } |
1027 | 1052 | ||
1028 | // Done with the base mesh | 1053 | // Done with the base mesh |
@@ -1051,7 +1076,7 @@ public class BSShapeConvexHull : BSShape | |||
1051 | } | 1076 | } |
1052 | } | 1077 | } |
1053 | // Loop through all the known hulls and return the description based on the physical address. | 1078 | // Loop through all the known hulls and return the description based on the physical address. |
1054 | public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) | 1079 | public static bool TryGetConvexHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) |
1055 | { | 1080 | { |
1056 | bool ret = false; | 1081 | bool ret = false; |
1057 | BSShapeConvexHull foundDesc = null; | 1082 | BSShapeConvexHull foundDesc = null; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 74f4f4b..cfec630 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4812,6 +4812,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4812 | UUID av = new UUID(); | 4812 | UUID av = new UUID(); |
4813 | if (!UUID.TryParse(agent,out av)) | 4813 | if (!UUID.TryParse(agent,out av)) |
4814 | { | 4814 | { |
4815 | LSLError("First parameter to llTextBox needs to be a key"); | ||
4815 | return; | 4816 | return; |
4816 | } | 4817 | } |
4817 | 4818 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 5f5b7a7..32ea4ee 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -555,7 +555,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
555 | } | 555 | } |
556 | catch | 556 | catch |
557 | { | 557 | { |
558 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs", m_ServerURL); | 558 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs for user {1}", m_ServerURL, userID); |
559 | // reason = "Exception: " + e.Message; | 559 | // reason = "Exception: " + e.Message; |
560 | return serverURLs; | 560 | return serverURLs; |
561 | } | 561 | } |