aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2014-01-11 08:52:23 -0800
committerRobert Adams2014-01-11 08:52:23 -0800
commit1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f (patch)
tree125392101f83c8e7cb239848ae7a6cc12595b1a2 /OpenSim/Region
parentMerge branch 'master' into varregion (diff)
parentFix crash in BulletSim which sometimes happens making a linkset physical (diff)
downloadopensim-SC_OLD-1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f.zip
opensim-SC_OLD-1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f.tar.gz
opensim-SC_OLD-1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f.tar.bz2
opensim-SC_OLD-1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f.tar.xz
Merge branch 'master' into varregion
Conflicts: OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs OpenSim/Region/Framework/Scenes/SceneBase.cs OpenSim/Services/Interfaces/IGridService.cs OpenSim/Services/LLLoginService/LLLoginResponse.cs (conflicts were debug statements that are commented out in master branch)
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs27
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs115
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs58
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs85
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapes.cs39
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
10 files changed, 206 insertions, 160 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 739e202..6861f5b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3606,7 +3606,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3606 3606
3607 AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); 3607 AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
3608 // TODO: don't create new blocks if recycling an old packet 3608 // TODO: don't create new blocks if recycling an old packet
3609 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; 3609 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length];
3610 avp.ObjectData.TextureEntry = textureEntry; 3610 avp.ObjectData.TextureEntry = textureEntry;
3611 3611
3612 AvatarAppearancePacket.VisualParamBlock avblock = null; 3612 AvatarAppearancePacket.VisualParamBlock avblock = null;
@@ -5070,11 +5070,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5070 // excessive up and down movements of the camera when looking up and down. 5070 // excessive up and down movements of the camera when looking up and down.
5071 // See http://opensimulator.org/mantis/view.php?id=3274 5071 // See http://opensimulator.org/mantis/view.php?id=3274
5072 // This does not affect head movement, since this is controlled entirely by camera movement rather than 5072 // This does not affect head movement, since this is controlled entirely by camera movement rather than
5073 // body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes 5073 // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
5074 // effect, not the avatar rotation. 5074 // the rotation in this case.
5075 rotation = presence.Rotation; 5075 rotation = presence.Rotation;
5076 rotation.X = 0; 5076
5077 rotation.Y = 0; 5077 if (!presence.IsSatOnObject)
5078 {
5079 rotation.X = 0;
5080 rotation.Y = 0;
5081 }
5078 5082
5079 if (sendTexture) 5083 if (sendTexture)
5080 textureEntry = presence.Appearance.Texture.GetBytes(); 5084 textureEntry = presence.Appearance.Texture.GetBytes();
@@ -5197,11 +5201,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5197 // excessive up and down movements of the camera when looking up and down. 5201 // excessive up and down movements of the camera when looking up and down.
5198 // See http://opensimulator.org/mantis/view.php?id=3274 5202 // See http://opensimulator.org/mantis/view.php?id=3274
5199 // This does not affect head movement, since this is controlled entirely by camera movement rather than 5203 // This does not affect head movement, since this is controlled entirely by camera movement rather than
5200 // body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes 5204 // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
5201 // effect, not the avatar rotation. 5205 // the rotation in this case.
5202 Quaternion rot = data.Rotation; 5206 Quaternion rot = data.Rotation;
5203 rot.X = 0; 5207
5204 rot.Y = 0; 5208 if (!data.IsSatOnObject)
5209 {
5210 rot.X = 0;
5211 rot.Y = 0;
5212 }
5213
5205 rot.ToBytes(objectData, 52); 5214 rot.ToBytes(objectData, 52);
5206 //data.AngularVelocity.ToBytes(objectData, 64); 5215 //data.AngularVelocity.ToBytes(objectData, 64);
5207 5216
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 831922e..781cc69 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -412,17 +412,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
412 412
413 if (item == null) 413 if (item == null)
414 return null; 414 return null;
415
416 item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
417 item.CreatorData = objlist[0].RootPart.CreatorData;
415 418
416 // Can't know creator is the same, so null it in inventory
417 if (objlist.Count > 1) 419 if (objlist.Count > 1)
418 { 420 {
419 item.CreatorId = UUID.Zero.ToString();
420 item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; 421 item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
422
423 // If the objects have different creators then don't specify a creator at all
424 foreach (SceneObjectGroup objectGroup in objlist)
425 {
426 if ((objectGroup.RootPart.CreatorID.ToString() != item.CreatorId)
427 || (objectGroup.RootPart.CreatorData.ToString() != item.CreatorData))
428 {
429 item.CreatorId = UUID.Zero.ToString();
430 item.CreatorData = string.Empty;
431 break;
432 }
433 }
421 } 434 }
422 else 435 else
423 { 436 {
424 item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
425 item.CreatorData = objlist[0].RootPart.CreatorData;
426 item.SaleType = objlist[0].RootPart.ObjectSaleType; 437 item.SaleType = objlist[0].RootPart.ObjectSaleType;
427 item.SalePrice = objlist[0].RootPart.SalePrice; 438 item.SalePrice = objlist[0].RootPart.SalePrice;
428 } 439 }
@@ -443,13 +454,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
443 } 454 }
444 else 455 else
445 { 456 {
446 AddPermissions(item, objlist[0], objlist, remoteClient);
447
448 item.CreationDate = Util.UnixTimeSinceEpoch(); 457 item.CreationDate = Util.UnixTimeSinceEpoch();
449 item.Description = asset.Description; 458 item.Description = asset.Description;
450 item.Name = asset.Name; 459 item.Name = asset.Name;
451 item.AssetType = asset.Type; 460 item.AssetType = asset.Type;
452 461
462 AddPermissions(item, objlist[0], objlist, remoteClient);
463
453 m_Scene.AddInventoryItem(item); 464 m_Scene.AddInventoryItem(item);
454 465
455 if (remoteClient != null && item.Owner == remoteClient.AgentId) 466 if (remoteClient != null && item.Owner == remoteClient.AgentId)
@@ -491,39 +502,42 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
491 IClientAPI remoteClient) 502 IClientAPI remoteClient)
492 { 503 {
493 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; 504 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
505 uint allObjectsNextOwnerPerms = 0x7fffffff;
506 uint allObjectsEveryOnePerms = 0x7fffffff;
507 uint allObjectsGroupPerms = 0x7fffffff;
508
494 foreach (SceneObjectGroup grp in objsForEffectivePermissions) 509 foreach (SceneObjectGroup grp in objsForEffectivePermissions)
510 {
495 effectivePerms &= grp.GetEffectivePermissions(); 511 effectivePerms &= grp.GetEffectivePermissions();
512 allObjectsNextOwnerPerms &= grp.RootPart.NextOwnerMask;
513 allObjectsEveryOnePerms &= grp.RootPart.EveryoneMask;
514 allObjectsGroupPerms &= grp.RootPart.GroupMask;
515 }
496 effectivePerms |= (uint)PermissionMask.Move; 516 effectivePerms |= (uint)PermissionMask.Move;
497 517
518 //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions);
519
498 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) 520 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
499 { 521 {
500 uint perms = effectivePerms; 522 uint perms = effectivePerms;
501 uint nextPerms = (perms & 7) << 13; 523 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms);
502 if ((nextPerms & (uint)PermissionMask.Copy) == 0) 524
503 perms &= ~(uint)PermissionMask.Copy; 525 item.BasePermissions = perms & allObjectsNextOwnerPerms;
504 if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
505 perms &= ~(uint)PermissionMask.Transfer;
506 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
507 perms &= ~(uint)PermissionMask.Modify;
508
509 item.BasePermissions = perms & so.RootPart.NextOwnerMask;
510 item.CurrentPermissions = item.BasePermissions; 526 item.CurrentPermissions = item.BasePermissions;
511 item.NextPermissions = perms & so.RootPart.NextOwnerMask; 527 item.NextPermissions = perms & allObjectsNextOwnerPerms;
512 item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; 528 item.EveryOnePermissions = allObjectsEveryOnePerms & allObjectsNextOwnerPerms;
513 item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; 529 item.GroupPermissions = allObjectsGroupPerms & allObjectsNextOwnerPerms;
514 530
515 // Magic number badness. Maybe this deserves an enum. 531 // apply next owner perms on rez
516 // bit 4 (16) is the "Slam" bit, it means treat as passed 532 item.CurrentPermissions |= SceneObjectGroup.SLAM;
517 // and apply next owner perms on rez
518 item.CurrentPermissions |= 16; // Slam!
519 } 533 }
520 else 534 else
521 { 535 {
522 item.BasePermissions = effectivePerms; 536 item.BasePermissions = effectivePerms;
523 item.CurrentPermissions = effectivePerms; 537 item.CurrentPermissions = effectivePerms;
524 item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; 538 item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms;
525 item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; 539 item.EveryOnePermissions = allObjectsEveryOnePerms & effectivePerms;
526 item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; 540 item.GroupPermissions = allObjectsGroupPerms & effectivePerms;
527 541
528 item.CurrentPermissions &= 542 item.CurrentPermissions &=
529 ((uint)PermissionMask.Copy | 543 ((uint)PermissionMask.Copy |
@@ -532,8 +546,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
532 (uint)PermissionMask.Move | 546 (uint)PermissionMask.Move |
533 (uint)PermissionMask.Export | 547 (uint)PermissionMask.Export |
534 7); // Preserve folded permissions 548 7); // Preserve folded permissions
535 } 549 }
536 550
551 //PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions);
552
537 return item; 553 return item;
538 } 554 }
539 555
@@ -809,11 +825,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
809 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; 825 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
810 } 826 }
811 827
812 foreach (SceneObjectPart part in group.Parts) 828 if (item == null)
813 { 829 {
814 // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. 830 // Change ownership. Normally this is done in DoPreRezWhenFromItem(), but in this case we must do it here.
815 part.LastOwnerID = part.OwnerID; 831 foreach (SceneObjectPart part in group.Parts)
816 part.OwnerID = remoteClient.AgentId; 832 {
833 // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset.
834 part.LastOwnerID = part.OwnerID;
835 part.OwnerID = remoteClient.AgentId;
836 }
817 } 837 }
818 838
819 if (!attachment) 839 if (!attachment)
@@ -969,44 +989,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
969// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", 989// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
970// rootPart.OwnerID, item.Owner, item.CurrentPermissions); 990// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
971 991
972 if ((rootPart.OwnerID != item.Owner) || 992 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & SceneObjectGroup.SLAM) != 0)
973 (item.CurrentPermissions & 16) != 0)
974 { 993 {
975 //Need to kill the for sale here 994 //Need to kill the for sale here
976 rootPart.ObjectSaleType = 0; 995 rootPart.ObjectSaleType = 0;
977 rootPart.SalePrice = 10; 996 rootPart.SalePrice = 10;
978
979 if (m_Scene.Permissions.PropagatePermissions())
980 {
981 foreach (SceneObjectPart part in so.Parts)
982 {
983 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
984 {
985 part.EveryoneMask = item.EveryOnePermissions;
986 part.NextOwnerMask = item.NextPermissions;
987 }
988 part.GroupMask = 0; // DO NOT propagate here
989 }
990
991 so.ApplyNextOwnerPermissions();
992 }
993 } 997 }
994 998
995 foreach (SceneObjectPart part in so.Parts) 999 foreach (SceneObjectPart part in so.Parts)
996 { 1000 {
997 part.FromUserInventoryItemID = fromUserInventoryItemId; 1001 part.FromUserInventoryItemID = fromUserInventoryItemId;
998 1002 part.ApplyPermissionsOnRez(item, true, m_Scene);
999 if ((part.OwnerID != item.Owner) ||
1000 (item.CurrentPermissions & 16) != 0)
1001 {
1002 part.Inventory.ChangeInventoryOwner(item.Owner);
1003 part.GroupMask = 0; // DO NOT propagate here
1004 }
1005
1006 part.EveryoneMask = item.EveryOnePermissions;
1007 part.NextOwnerMask = item.NextPermissions;
1008 } 1003 }
1009 1004
1010 rootPart.TrimPermissions(); 1005 rootPart.TrimPermissions();
1011 1006
1012 if (isAttachment) 1007 if (isAttachment)
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index e8eaeb7..b8d4855 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -193,13 +193,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
193 item.InvType = (int)InventoryType.Object; 193 item.InvType = (int)InventoryType.Object;
194 item.Folder = categoryID; 194 item.Folder = categoryID;
195 195
196 uint nextPerms=(perms & 7) << 13; 196 PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
197 if ((nextPerms & (uint)PermissionMask.Copy) == 0)
198 perms &= ~(uint)PermissionMask.Copy;
199 if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
200 perms &= ~(uint)PermissionMask.Transfer;
201 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
202 perms &= ~(uint)PermissionMask.Modify;
203 197
204 item.BasePermissions = perms & part.NextOwnerMask; 198 item.BasePermissions = perms & part.NextOwnerMask;
205 item.CurrentPermissions = perms & part.NextOwnerMask; 199 item.CurrentPermissions = perms & part.NextOwnerMask;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9ae8612..b86f349 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -669,17 +669,13 @@ namespace OpenSim.Region.Framework.Scenes
669 // a mask 669 // a mask
670 if (item.InvType == (int)InventoryType.Object) 670 if (item.InvType == (int)InventoryType.Object)
671 { 671 {
672 // Create a safe mask for the current perms
673 uint foldedPerms = (item.CurrentPermissions & 7) << 13;
674 foldedPerms |= permsMask;
675
676 bool isRootMod = (item.CurrentPermissions & 672 bool isRootMod = (item.CurrentPermissions &
677 (uint)PermissionMask.Modify) != 0 ? 673 (uint)PermissionMask.Modify) != 0 ?
678 true : false; 674 true : false;
679 675
680 // Mask the owner perms to the folded perms 676 // Mask the owner perms to the folded perms
681 ownerPerms &= foldedPerms; 677 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms);
682 basePerms &= foldedPerms; 678 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms);
683 679
684 // If the root was mod, let the mask reflect that 680 // If the root was mod, let the mask reflect that
685 // We also need to adjust the base here, because 681 // We also need to adjust the base here, because
@@ -1209,9 +1205,16 @@ namespace OpenSim.Region.Framework.Scenes
1209 { 1205 {
1210 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 1206 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
1211 if (taskItem.InvType == (int)InventoryType.Object) 1207 if (taskItem.InvType == (int)InventoryType.Object)
1212 agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); 1208 {
1209 uint perms = taskItem.CurrentPermissions;
1210 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
1211 agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
1212 agentItem.CurrentPermissions = agentItem.BasePermissions;
1213 }
1213 else 1214 else
1215 {
1214 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 1216 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
1217 }
1215 1218
1216 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; 1219 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1217 agentItem.NextPermissions = taskItem.NextPermissions; 1220 agentItem.NextPermissions = taskItem.NextPermissions;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 44c476c..c6b98ca 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -109,6 +109,9 @@ namespace OpenSim.Region.Framework.Scenes
109 STATUS_ROTATE_Z = 0x008, 109 STATUS_ROTATE_Z = 0x008,
110 } 110 }
111 111
112 // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm
113 public static readonly uint SLAM = 16;
114
112 // private PrimCountTaintedDelegate handlerPrimCountTainted = null; 115 // private PrimCountTaintedDelegate handlerPrimCountTainted = null;
113 116
114 /// <summary> 117 /// <summary>
@@ -3230,13 +3233,10 @@ namespace OpenSim.Region.Framework.Scenes
3230 3233
3231 Vector3 oldPos; 3234 Vector3 oldPos;
3232 3235
3233 // FIXME: This improves the situation where editing just the root prim of an attached object would send
3234 // all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim
3235 // still ends up in the wrong position on reattach.
3236 if (IsAttachment) 3236 if (IsAttachment)
3237 oldPos = RootPart.OffsetPosition; 3237 oldPos = m_rootPart.AttachedPos + m_rootPart.OffsetPosition; // OffsetPosition should always be 0 in an attachments's root prim
3238 else 3238 else
3239 oldPos = AbsolutePosition + RootPart.OffsetPosition; 3239 oldPos = AbsolutePosition + m_rootPart.OffsetPosition;
3240 3240
3241 Vector3 diff = oldPos - newPos; 3241 Vector3 diff = oldPos - newPos;
3242 Quaternion partRotation = m_rootPart.RotationOffset; 3242 Quaternion partRotation = m_rootPart.RotationOffset;
@@ -3251,6 +3251,9 @@ namespace OpenSim.Region.Framework.Scenes
3251 } 3251 }
3252 3252
3253 AbsolutePosition = newPos; 3253 AbsolutePosition = newPos;
3254
3255 if (IsAttachment)
3256 m_rootPart.AttachedPos = newPos;
3254 3257
3255 HasGroupChanged = true; 3258 HasGroupChanged = true;
3256 ScheduleGroupForTerseUpdate(); 3259 ScheduleGroupForTerseUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ea9d0d8..1cf7726 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4800,6 +4800,64 @@ namespace OpenSim.Region.Framework.Scenes
4800 { 4800 {
4801 ParentGroup.AddScriptLPS(count); 4801 ParentGroup.AddScriptLPS(count);
4802 } 4802 }
4803
4804 /// <summary>
4805 /// Sets a prim's owner and permissions when it's rezzed.
4806 /// </summary>
4807 /// <param name="item">The inventory item from which the item was rezzed</param>
4808 /// <param name="userInventory">True: the item is being rezzed from the user's inventory. False: from a prim's inventory.</param>
4809 /// <param name="scene">The scene the prim is being rezzed into</param>
4810 public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
4811 {
4812 if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
4813 {
4814 if (scene.Permissions.PropagatePermissions())
4815 {
4816 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
4817 {
4818 // Apply the item's permissions to the object
4819 //LogPermissions("Before applying item permissions");
4820 if (userInventory)
4821 {
4822 EveryoneMask = item.EveryOnePermissions;
4823 NextOwnerMask = item.NextPermissions;
4824 }
4825 else
4826 {
4827 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
4828 EveryoneMask = item.EveryOnePermissions;
4829 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
4830 NextOwnerMask = item.NextPermissions;
4831 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
4832 GroupMask = item.GroupPermissions;
4833 }
4834 //LogPermissions("After applying item permissions");
4835 }
4836 }
4837
4838 GroupMask = 0; // DO NOT propagate here
4839 }
4840
4841 if (OwnerID != item.Owner)
4842 {
4843 //LogPermissions("Before ApplyNextOwnerPermissions");
4844 ApplyNextOwnerPermissions();
4845 //LogPermissions("After ApplyNextOwnerPermissions");
4846
4847 LastOwnerID = OwnerID;
4848 OwnerID = item.Owner;
4849 Inventory.ChangeInventoryOwner(item.Owner);
4850 }
4851 }
4852
4853 /// <summary>
4854 /// Logs the prim's permissions. Useful when debugging permission problems.
4855 /// </summary>
4856 /// <param name="message"></param>
4857 private void LogPermissions(String message)
4858 {
4859 PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask);
4860 }
4803 4861
4804 public void ApplyNextOwnerPermissions() 4862 public void ApplyNextOwnerPermissions()
4805 { 4863 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 380e402..fb8ecd5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -764,48 +764,27 @@ namespace OpenSim.Region.Framework.Scenes
764 // Since renaming the item in the inventory does not affect the name stored 764 // Since renaming the item in the inventory does not affect the name stored
765 // in the serialization, transfer the correct name from the inventory to the 765 // in the serialization, transfer the correct name from the inventory to the
766 // object itself before we rez. 766 // object itself before we rez.
767 rootPart.Name = item.Name; 767 // Only do these for the first object if we are rezzing a coalescence.
768 rootPart.Description = item.Description; 768 if (i == 0)
769
770 SceneObjectPart[] partList = group.Parts;
771
772 group.SetGroup(m_part.GroupID, null);
773
774 // TODO: Remove magic number badness
775 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
776 { 769 {
777 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) 770 rootPart.Name = item.Name;
778 { 771 rootPart.Description = item.Description;
779 foreach (SceneObjectPart part in partList)
780 {
781 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
782 part.EveryoneMask = item.EveryonePermissions;
783 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
784 part.NextOwnerMask = item.NextPermissions;
785 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
786 part.GroupMask = item.GroupPermissions;
787 }
788
789 group.ApplyNextOwnerPermissions();
790 }
791 } 772 }
792 773
793 foreach (SceneObjectPart part in partList) 774 group.SetGroup(m_part.GroupID, null);
794 {
795 // TODO: Remove magic number badness
796 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
797 {
798 part.LastOwnerID = part.OwnerID;
799 part.OwnerID = item.OwnerID;
800 part.Inventory.ChangeInventoryOwner(item.OwnerID);
801 }
802 775
803 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) 776 foreach (SceneObjectPart part in group.Parts)
804 part.EveryoneMask = item.EveryonePermissions; 777 {
805 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) 778 // Convert between InventoryItem classes. You can never have too many similar but slightly different classes :)
806 part.NextOwnerMask = item.NextPermissions; 779 InventoryItemBase dest = new InventoryItemBase(item.ItemID, item.OwnerID);
807 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) 780 dest.BasePermissions = item.BasePermissions;
808 part.GroupMask = item.GroupPermissions; 781 dest.CurrentPermissions = item.CurrentPermissions;
782 dest.EveryOnePermissions = item.EveryonePermissions;
783 dest.GroupPermissions = item.GroupPermissions;
784 dest.NextPermissions = item.NextPermissions;
785 dest.Flags = item.Flags;
786
787 part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene);
809 } 788 }
810 789
811 rootPart.TrimPermissions(); 790 rootPart.TrimPermissions();
@@ -1130,25 +1109,6 @@ namespace OpenSim.Region.Framework.Scenes
1130 mask &= ~((uint)PermissionMask.Transfer >> 13); 1109 mask &= ~((uint)PermissionMask.Transfer >> 13);
1131 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) 1110 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
1132 mask &= ~((uint)PermissionMask.Modify >> 13); 1111 mask &= ~((uint)PermissionMask.Modify >> 13);
1133
1134 if (item.InvType != (int)InventoryType.Object)
1135 {
1136 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
1137 mask &= ~((uint)PermissionMask.Copy >> 13);
1138 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
1139 mask &= ~((uint)PermissionMask.Transfer >> 13);
1140 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
1141 mask &= ~((uint)PermissionMask.Modify >> 13);
1142 }
1143 else
1144 {
1145 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
1146 mask &= ~((uint)PermissionMask.Copy >> 13);
1147 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
1148 mask &= ~((uint)PermissionMask.Transfer >> 13);
1149 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1150 mask &= ~((uint)PermissionMask.Modify >> 13);
1151 }
1152 1112
1153 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1113 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1154 mask &= ~(uint)PermissionMask.Copy; 1114 mask &= ~(uint)PermissionMask.Copy;
@@ -1172,14 +1132,11 @@ namespace OpenSim.Region.Framework.Scenes
1172// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", 1132// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}",
1173// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); 1133// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions);
1174 1134
1175 if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) 1135 if (item.InvType == (int)InventoryType.Object)
1176 { 1136 {
1177 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) 1137 uint perms = item.CurrentPermissions;
1178 item.CurrentPermissions &= ~(uint)PermissionMask.Copy; 1138 PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
1179 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) 1139 item.CurrentPermissions = perms;
1180 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
1181 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1182 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
1183 } 1140 }
1184 1141
1185 item.CurrentPermissions &= item.NextPermissions; 1142 item.CurrentPermissions &= item.NextPermissions;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a98baea..b52f48c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1900,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes
1900 ControllingClient.SendAgentTerseUpdate(this); 1900 ControllingClient.SendAgentTerseUpdate(this);
1901 1901
1902 PhysicsActor actor = PhysicsActor; 1902 PhysicsActor actor = PhysicsActor;
1903
1904 // This will be the case if the agent is sitting on the groudn or on an object.
1903 if (actor == null) 1905 if (actor == null)
1904 { 1906 {
1905 SendControlsToScripts(flagsForScripts); 1907 SendControlsToScripts(flagsForScripts);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
index 006a9c1..fbe320b 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--;
@@ -866,6 +866,8 @@ public class BSShapeHull : BSShape
866public class BSShapeCompound : BSShape 866public class BSShapeCompound : BSShape
867{ 867{
868 private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; 868 private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]";
869 public static Dictionary<string, BSShapeCompound> CompoundShapes = new Dictionary<string, BSShapeCompound>();
870
869 public BSShapeCompound(BulletShape pShape) : base(pShape) 871 public BSShapeCompound(BulletShape pShape) : base(pShape)
870 { 872 {
871 } 873 }
@@ -873,7 +875,9 @@ public class BSShapeCompound : BSShape
873 { 875 {
874 // Base compound shapes are not shared so this returns a raw shape. 876 // Base compound shapes are not shared so this returns a raw shape.
875 // A built compound shape can be reused in linksets. 877 // A built compound shape can be reused in linksets.
876 return new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); 878 BSShapeCompound ret = new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene));
879 CompoundShapes.Add(ret.AddrString, ret);
880 return ret;
877 } 881 }
878 public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) 882 public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim)
879 { 883 {
@@ -911,10 +915,21 @@ public class BSShapeCompound : BSShape
911 BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); 915 BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii);
912 DereferenceAnonCollisionShape(physicsScene, childShape); 916 DereferenceAnonCollisionShape(physicsScene, childShape);
913 } 917 }
918
919 lock (CompoundShapes)
920 CompoundShapes.Remove(physShapeInfo.AddrString);
914 physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); 921 physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo);
915 } 922 }
916 } 923 }
917 } 924 }
925 public static bool TryGetCompoundByPtr(BulletShape pShape, out BSShapeCompound outCompound)
926 {
927 lock (CompoundShapes)
928 {
929 string addr = pShape.AddrString;
930 return CompoundShapes.TryGetValue(addr, out outCompound);
931 }
932 }
918 private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) 933 private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene)
919 { 934 {
920 BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); 935 BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false);
@@ -926,10 +941,13 @@ public class BSShapeCompound : BSShape
926 private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) 941 private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape)
927 { 942 {
928 // TODO: figure a better way to go through all the shape types and find a possible instance. 943 // TODO: figure a better way to go through all the shape types and find a possible instance.
944 physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,shape={1}",
945 BSScene.DetailLogZero, pShape);
929 BSShapeMesh meshDesc; 946 BSShapeMesh meshDesc;
930 if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) 947 if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc))
931 { 948 {
932 meshDesc.Dereference(physicsScene); 949 meshDesc.Dereference(physicsScene);
950 // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundMesh,shape={1}", BSScene.DetailLogZero, pShape);
933 } 951 }
934 else 952 else
935 { 953 {
@@ -937,13 +955,15 @@ public class BSShapeCompound : BSShape
937 if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) 955 if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc))
938 { 956 {
939 hullDesc.Dereference(physicsScene); 957 hullDesc.Dereference(physicsScene);
958 // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundHull,shape={1}", BSScene.DetailLogZero, pShape);
940 } 959 }
941 else 960 else
942 { 961 {
943 BSShapeConvexHull chullDesc; 962 BSShapeConvexHull chullDesc;
944 if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc)) 963 if (BSShapeConvexHull.TryGetConvexHullByPtr(pShape, out chullDesc))
945 { 964 {
946 chullDesc.Dereference(physicsScene); 965 chullDesc.Dereference(physicsScene);
966 // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundConvexHull,shape={1}", BSScene.DetailLogZero, pShape);
947 } 967 }
948 else 968 else
949 { 969 {
@@ -951,20 +971,23 @@ public class BSShapeCompound : BSShape
951 if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) 971 if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc))
952 { 972 {
953 gImpactDesc.Dereference(physicsScene); 973 gImpactDesc.Dereference(physicsScene);
974 // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundgImpact,shape={1}", BSScene.DetailLogZero, pShape);
954 } 975 }
955 else 976 else
956 { 977 {
957 // Didn't find it in the lists of specific types. It could be compound. 978 // Didn't find it in the lists of specific types. It could be compound.
958 if (physicsScene.PE.IsCompound(pShape)) 979 BSShapeCompound compoundDesc;
980 if (BSShapeCompound.TryGetCompoundByPtr(pShape, out compoundDesc))
959 { 981 {
960 BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); 982 compoundDesc.Dereference(physicsScene);
961 recursiveCompound.Dereference(physicsScene); 983 // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,recursiveCompoundShape,shape={1}", BSScene.DetailLogZero, pShape);
962 } 984 }
963 else 985 else
964 { 986 {
965 // If none of the above, maybe it is a simple native shape. 987 // If none of the above, maybe it is a simple native shape.
966 if (physicsScene.PE.IsNativeShape(pShape)) 988 if (physicsScene.PE.IsNativeShape(pShape))
967 { 989 {
990 // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,assumingNative,shape={1}", BSScene.DetailLogZero, pShape);
968 BSShapeNative nativeShape = new BSShapeNative(pShape); 991 BSShapeNative nativeShape = new BSShapeNative(pShape);
969 nativeShape.Dereference(physicsScene); 992 nativeShape.Dereference(physicsScene);
970 } 993 }
@@ -1021,6 +1044,8 @@ public class BSShapeConvexHull : BSShape
1021 convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); 1044 convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo);
1022 convexShape.shapeKey = newMeshKey; 1045 convexShape.shapeKey = newMeshKey;
1023 ConvexHulls.Add(convexShape.shapeKey, retConvexHull); 1046 ConvexHulls.Add(convexShape.shapeKey, retConvexHull);
1047 physicsScene.DetailLog("{0},BSShapeConvexHull.GetReference,addingNewlyCreatedShape,shape={1}",
1048 BSScene.DetailLogZero, convexShape);
1024 } 1049 }
1025 1050
1026 // Done with the base mesh 1051 // Done with the base mesh
@@ -1049,7 +1074,7 @@ public class BSShapeConvexHull : BSShape
1049 } 1074 }
1050 } 1075 }
1051 // Loop through all the known hulls and return the description based on the physical address. 1076 // Loop through all the known hulls and return the description based on the physical address.
1052 public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) 1077 public static bool TryGetConvexHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull)
1053 { 1078 {
1054 bool ret = false; 1079 bool ret = false;
1055 BSShapeConvexHull foundDesc = null; 1080 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 674885c..7b56abf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4394,7 +4394,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4394 UUID av = new UUID(); 4394 UUID av = new UUID();
4395 if (!UUID.TryParse(agent,out av)) 4395 if (!UUID.TryParse(agent,out av))
4396 { 4396 {
4397 LSLError("First parameter to llDialog needs to be a key"); 4397 LSLError("First parameter to llTextBox needs to be a key");
4398 return; 4398 return;
4399 } 4399 }
4400 4400