aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs107
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs61
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs55
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainCompressor.cs2
6 files changed, 157 insertions, 83 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 91f1b63..542d454 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -125,13 +125,18 @@ namespace OpenSim.Region.Framework.Scenes
125 125
126 return false; 126 return false;
127 } 127 }
128 }
129
130 public bool AddInventoryItem(InventoryItemBase item)
131 {
132 return AddInventoryItem(item, true);
128 } 133 }
129 134
130 /// <summary> 135 /// <summary>
131 /// Add the given inventory item to a user's inventory. 136 /// Add the given inventory item to a user's inventory.
132 /// </summary> 137 /// </summary>
133 /// <param name="item"></param> 138 /// <param name="item"></param>
134 public bool AddInventoryItem(InventoryItemBase item) 139 public bool AddInventoryItem(InventoryItemBase item, bool trigger)
135 { 140 {
136 if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) 141 if (item.Folder != UUID.Zero && InventoryService.AddItem(item))
137 { 142 {
@@ -140,7 +145,8 @@ namespace OpenSim.Region.Framework.Scenes
140 { 145 {
141 userlevel = 1; 146 userlevel = 1;
142 } 147 }
143 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); 148 if (trigger)
149 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
144 150
145 return true; 151 return true;
146 } 152 }
@@ -179,7 +185,8 @@ namespace OpenSim.Region.Framework.Scenes
179 { 185 {
180 userlevel = 1; 186 userlevel = 1;
181 } 187 }
182 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); 188 if (trigger)
189 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
183 190
184 if (originalFolder != UUID.Zero) 191 if (originalFolder != UUID.Zero)
185 { 192 {
@@ -764,7 +771,7 @@ namespace OpenSim.Region.Framework.Scenes
764 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 771 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
765 if (invAccess != null) 772 if (invAccess != null)
766 invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); 773 invAccess.TransferInventoryAssets(itemCopy, senderId, recipient);
767 AddInventoryItem(itemCopy); 774 AddInventoryItem(itemCopy, false);
768 775
769 if (!Permissions.BypassPermissions()) 776 if (!Permissions.BypassPermissions())
770 { 777 {
@@ -872,51 +879,34 @@ namespace OpenSim.Region.Framework.Scenes
872 return; 879 return;
873 } 880 }
874 881
875 AssetBase asset = AssetService.Get(item.AssetID.ToString()); 882 if (newName == String.Empty)
883 newName = item.Name;
876 884
877 if (asset != null) 885 if (remoteClient.AgentId == oldAgentID
886 || (LibraryService != null
887 && LibraryService.LibraryRootFolder != null
888 && oldAgentID == LibraryService.LibraryRootFolder.Owner))
878 { 889 {
879 if (newName != String.Empty) 890 CreateNewInventoryItem(
880 { 891 remoteClient, item.CreatorId, item.CreatorData, newFolderID,
881 asset.Name = newName; 892 newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
882 } 893 item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
883 else 894 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
884 { 895 }
885 newName = item.Name; 896 else
886 } 897 {
887 898 // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
888 if (remoteClient.AgentId == oldAgentID 899 if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
889 || (LibraryService != null 900 && (m_permissions.BypassPermissions()
890 && LibraryService.LibraryRootFolder != null 901 || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
891 && oldAgentID == LibraryService.LibraryRootFolder.Owner))
892 { 902 {
893 CreateNewInventoryItem( 903 CreateNewInventoryItem(
894 remoteClient, item.CreatorId, item.CreatorData, newFolderID, 904 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
895 newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType, 905 item.AssetID, (sbyte)item.AssetType, (sbyte) item.InvType,
896 item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, 906 item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
897 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); 907 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
898 }
899 else
900 {
901 // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
902 if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
903 && (m_permissions.BypassPermissions()
904 || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
905 {
906 CreateNewInventoryItem(
907 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
908 asset, (sbyte) item.InvType,
909 item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
910 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
911 }
912 } 908 }
913 } 909 }
914 else
915 {
916 m_log.ErrorFormat(
917 "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found",
918 item.Name, item.AssetID);
919 }
920 } 910 }
921 911
922 /// <summary> 912 /// <summary>
@@ -966,11 +956,12 @@ namespace OpenSim.Region.Framework.Scenes
966 public void CreateNewInventoryItem( 956 public void CreateNewInventoryItem(
967 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 957 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
968 string name, string description, uint flags, uint callbackID, 958 string name, string description, uint flags, uint callbackID,
969 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) 959 UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate)
970 { 960 {
971 CreateNewInventoryItem( 961 CreateNewInventoryItem(
972 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, 962 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType,
973 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); 963 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0,
964 creationDate, true);
974 } 965 }
975 966
976 /// <summary> 967 /// <summary>
@@ -994,19 +985,20 @@ namespace OpenSim.Region.Framework.Scenes
994 /// <param name="creationDate">Unix timestamp at which this item was created.</param> 985 /// <param name="creationDate">Unix timestamp at which this item was created.</param>
995 private void CreateNewInventoryItem( 986 private void CreateNewInventoryItem(
996 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 987 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
997 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, 988 string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
998 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) 989 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,
990 bool assetUpload)
999 { 991 {
1000 InventoryItemBase item = new InventoryItemBase(); 992 InventoryItemBase item = new InventoryItemBase();
1001 item.Owner = remoteClient.AgentId; 993 item.Owner = remoteClient.AgentId;
1002 item.CreatorId = creatorID; 994 item.CreatorId = creatorID;
1003 item.CreatorData = creatorData; 995 item.CreatorData = creatorData;
1004 item.ID = UUID.Random(); 996 item.ID = UUID.Random();
1005 item.AssetID = asset.FullID; 997 item.AssetID = assetID;
1006 item.Name = name; 998 item.Name = name;
1007 item.Description = description; 999 item.Description = description;
1008 item.Flags = flags; 1000 item.Flags = flags;
1009 item.AssetType = asset.Type; 1001 item.AssetType = assetType;
1010 item.InvType = invType; 1002 item.InvType = invType;
1011 item.Folder = folderID; 1003 item.Folder = folderID;
1012 item.CurrentPermissions = currentMask; 1004 item.CurrentPermissions = currentMask;
@@ -1016,7 +1008,7 @@ namespace OpenSim.Region.Framework.Scenes
1016 item.BasePermissions = baseMask; 1008 item.BasePermissions = baseMask;
1017 item.CreationDate = creationDate; 1009 item.CreationDate = creationDate;
1018 1010
1019 if (AddInventoryItem(item)) 1011 if (AddInventoryItem(item, assetUpload))
1020 { 1012 {
1021 remoteClient.SendInventoryItemCreateUpdate(item, callbackID); 1013 remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
1022 } 1014 }
@@ -1079,17 +1071,12 @@ namespace OpenSim.Region.Framework.Scenes
1079// return; 1071// return;
1080// } 1072// }
1081 1073
1082 AssetBase asset = new AssetBase();
1083 asset.FullID = olditemID;
1084 asset.Type = type;
1085 asset.Name = name;
1086 asset.Description = description;
1087
1088 CreateNewInventoryItem( 1074 CreateNewInventoryItem(
1089 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, 1075 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
1090 name, description, 0, callbackID, asset, invType, 1076 name, description, 0, callbackID, olditemID, type, invType,
1091 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All, 1077 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All,
1092 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch()); 1078 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch(),
1079 false);
1093 } 1080 }
1094 else 1081 else
1095 { 1082 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e6887b4..eff24f8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3751,6 +3751,13 @@ namespace OpenSim.Region.Framework.Scenes
3751 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); 3751 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
3752 } 3752 }
3753 3753
3754 // Final permissions check; this time we don't allow changing the position
3755 if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason))
3756 {
3757 m_authenticateHandler.RemoveCircuit(acd.circuitcode);
3758 return false;
3759 }
3760
3754 return true; 3761 return true;
3755 } 3762 }
3756 3763
@@ -3760,6 +3767,13 @@ namespace OpenSim.Region.Framework.Scenes
3760 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3767 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
3761 { 3768 {
3762 acd.startpos = land.LandData.UserLocation; 3769 acd.startpos = land.LandData.UserLocation;
3770
3771 // Final permissions check; this time we don't allow changing the position
3772 if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason))
3773 {
3774 m_authenticateHandler.RemoveCircuit(acd.circuitcode);
3775 return false;
3776 }
3763 } 3777 }
3764 } 3778 }
3765 } 3779 }
@@ -3767,6 +3781,21 @@ namespace OpenSim.Region.Framework.Scenes
3767 return true; 3781 return true;
3768 } 3782 }
3769 3783
3784 private bool IsPositionAllowed(UUID agentID, Vector3 pos, ref string reason)
3785 {
3786 ILandObject land = LandChannel.GetLandObject(pos);
3787 if (land == null)
3788 return true;
3789
3790 if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID))
3791 {
3792 reason = "You are banned from the region.";
3793 return false;
3794 }
3795
3796 return true;
3797 }
3798
3770 public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) 3799 public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
3771 { 3800 {
3772 if (posX < 0) 3801 if (posX < 0)
@@ -3865,7 +3894,7 @@ namespace OpenSim.Region.Framework.Scenes
3865 if (!AuthorizationService.IsAuthorizedForRegion( 3894 if (!AuthorizationService.IsAuthorizedForRegion(
3866 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) 3895 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
3867 { 3896 {
3868 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}", 3897 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}",
3869 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); 3898 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
3870 3899
3871 return false; 3900 return false;
@@ -4133,7 +4162,10 @@ namespace OpenSim.Region.Framework.Scenes
4133 /// <returns>true if we handled it.</returns> 4162 /// <returns>true if we handled it.</returns>
4134 public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) 4163 public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData)
4135 { 4164 {
4136 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); 4165// m_log.DebugFormat(
4166// "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}",
4167// cAgentData.AgentID, Name, cAgentData.Position);
4168
4137 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 4169 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
4138 if (childAgentUpdate != null) 4170 if (childAgentUpdate != null)
4139 { 4171 {
@@ -5150,7 +5182,7 @@ namespace OpenSim.Region.Framework.Scenes
5150 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 5182 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
5151 if (nearestPoint != null) 5183 if (nearestPoint != null)
5152 { 5184 {
5153 Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); 5185 m_log.Debug("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString());
5154 return nearestPoint.Value; 5186 return nearestPoint.Value;
5155 } 5187 }
5156 5188
@@ -5160,7 +5192,7 @@ namespace OpenSim.Region.Framework.Scenes
5160 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 5192 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
5161 if (nearestPoint != null) 5193 if (nearestPoint != null)
5162 { 5194 {
5163 Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); 5195 m_log.Debug("They had a zero velocity, sending them to: " + nearestPoint.ToString());
5164 return nearestPoint.Value; 5196 return nearestPoint.Value;
5165 } 5197 }
5166 5198
@@ -5169,7 +5201,7 @@ namespace OpenSim.Region.Framework.Scenes
5169 { 5201 {
5170 // Ultimate backup if we have no idea where they are and 5202 // Ultimate backup if we have no idea where they are and
5171 // the last allowed position was in another parcel 5203 // the last allowed position was in another parcel
5172 Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); 5204 m_log.Debug("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
5173 return avatar.lastKnownAllowedPosition; 5205 return avatar.lastKnownAllowedPosition;
5174 } 5206 }
5175 5207
@@ -5179,7 +5211,7 @@ namespace OpenSim.Region.Framework.Scenes
5179 //Go to the edge, this happens in teleporting to a region with no available parcels 5211 //Go to the edge, this happens in teleporting to a region with no available parcels
5180 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); 5212 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
5181 5213
5182 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); 5214 //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
5183 5215
5184 return nearestRegionEdgePoint; 5216 return nearestRegionEdgePoint;
5185 } 5217 }
@@ -5463,9 +5495,9 @@ namespace OpenSim.Region.Framework.Scenes
5463 /// <param name='position'></param> 5495 /// <param name='position'></param>
5464 /// <param name='reason'></param> 5496 /// <param name='reason'></param>
5465 /// <returns></returns> 5497 /// <returns></returns>
5466 public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason) 5498 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason)
5467 { 5499 {
5468 reason = "You are banned from the region"; 5500 reason = string.Empty;
5469 5501
5470 if (Permissions.IsGod(agentID)) 5502 if (Permissions.IsGod(agentID))
5471 { 5503 {
@@ -5525,10 +5557,11 @@ namespace OpenSim.Region.Framework.Scenes
5525 catch (Exception e) 5557 catch (Exception e)
5526 { 5558 {
5527 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); 5559 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message);
5560 reason = "Error authorizing agent: " + e.Message;
5528 return false; 5561 return false;
5529 } 5562 }
5530 5563
5531 if (position == Vector3.Zero) // Teleport 5564 if (viaTeleport)
5532 { 5565 {
5533 if (!RegionInfo.EstateSettings.AllowDirectTeleport) 5566 if (!RegionInfo.EstateSettings.AllowDirectTeleport)
5534 { 5567 {
@@ -5568,6 +5601,7 @@ namespace OpenSim.Region.Framework.Scenes
5568 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) 5601 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
5569 { 5602 {
5570 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); 5603 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
5604 reason = "You are banned from the region on all parcels";
5571 return false; 5605 return false;
5572 } 5606 }
5573 } 5607 }
@@ -5575,13 +5609,22 @@ namespace OpenSim.Region.Framework.Scenes
5575 { 5609 {
5576 ILandObject land = LandChannel.GetLandObject(position.X, position.Y); 5610 ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
5577 if (land == null) 5611 if (land == null)
5612 {
5613 reason = "No parcel found";
5578 return false; 5614 return false;
5615 }
5579 5616
5580 bool banned = land.IsBannedFromLand(agentID); 5617 bool banned = land.IsBannedFromLand(agentID);
5581 bool restricted = land.IsRestrictedFromLand(agentID); 5618 bool restricted = land.IsRestrictedFromLand(agentID);
5582 5619
5583 if (banned || restricted) 5620 if (banned || restricted)
5621 {
5622 if (banned)
5623 reason = "You are banned from the parcel";
5624 else
5625 reason = "The parcel is restricted";
5584 return false; 5626 return false;
5627 }
5585 } 5628 }
5586 5629
5587 reason = String.Empty; 5630 reason = String.Empty;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index fb8ecd5..75e1cbb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -751,7 +751,7 @@ namespace OpenSim.Region.Framework.Scenes
751 Vector3 bbox; 751 Vector3 bbox;
752 float offsetHeight; 752 float offsetHeight;
753 753
754 bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); 754 m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
755 755
756 for (int i = 0; i < objlist.Count; i++) 756 for (int i = 0; i < objlist.Count; i++)
757 { 757 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 8c56975..17f54c2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -208,7 +208,6 @@ namespace OpenSim.Region.Framework.Scenes
208// private int m_lastColCount = -1; //KF: Look for Collision chnages 208// private int m_lastColCount = -1; //KF: Look for Collision chnages
209// private int m_updateCount = 0; //KF: Update Anims for a while 209// private int m_updateCount = 0; //KF: Update Anims for a while
210// private static readonly int UPDATE_COUNT = 10; // how many frames to update for 210// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
211 private List<uint> m_lastColliders = new List<uint>();
212 211
213 private TeleportFlags m_teleportFlags; 212 private TeleportFlags m_teleportFlags;
214 public TeleportFlags TeleportFlags 213 public TeleportFlags TeleportFlags
@@ -271,8 +270,6 @@ namespace OpenSim.Region.Framework.Scenes
271 //private int m_moveToPositionStateStatus; 270 //private int m_moveToPositionStateStatus;
272 //***************************************************** 271 //*****************************************************
273 272
274 private object m_collisionEventLock = new Object();
275
276 private int m_movementAnimationUpdateCounter = 0; 273 private int m_movementAnimationUpdateCounter = 0;
277 274
278 public Vector3 PrevSitOffset { get; set; } 275 public Vector3 PrevSitOffset { get; set; }
@@ -1328,6 +1325,11 @@ namespace OpenSim.Region.Framework.Scenes
1328 1325
1329 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); 1326 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
1330 1327
1328 // Reset the m_originRegionID as it has dual use as a flag to signal that the UpdateAgent() call orignating
1329 // from the source simulator has completed on a V2 teleport.
1330 lock (m_originRegionIDAccessLock)
1331 m_originRegionID = UUID.Zero;
1332
1331 // Reset these so that teleporting in and walking out isn't seen 1333 // Reset these so that teleporting in and walking out isn't seen
1332 // as teleporting back 1334 // as teleporting back
1333 TeleportFlags = TeleportFlags.Default; 1335 TeleportFlags = TeleportFlags.Default;
@@ -2752,7 +2754,34 @@ namespace OpenSim.Region.Framework.Scenes
2752 part.AddSittingAvatar(this); 2754 part.AddSittingAvatar(this);
2753 2755
2754 cameraAtOffset = part.GetCameraAtOffset(); 2756 cameraAtOffset = part.GetCameraAtOffset();
2757
2758 if (!part.IsRoot && cameraAtOffset == Vector3.Zero)
2759 cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
2760
2761 bool cameraEyeOffsetFromRootForChild = false;
2755 cameraEyeOffset = part.GetCameraEyeOffset(); 2762 cameraEyeOffset = part.GetCameraEyeOffset();
2763
2764 if (!part.IsRoot && cameraEyeOffset == Vector3.Zero)
2765 {
2766 cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
2767 cameraEyeOffsetFromRootForChild = true;
2768 }
2769
2770 if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero)
2771 {
2772 if (!part.IsRoot)
2773 {
2774 cameraEyeOffset = cameraEyeOffset * part.RotationOffset;
2775 cameraAtOffset += part.OffsetPosition;
2776 }
2777
2778 cameraEyeOffset += part.OffsetPosition;
2779 }
2780
2781// m_log.DebugFormat(
2782// "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}",
2783// cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name);
2784
2756 forceMouselook = part.GetForceMouselook(); 2785 forceMouselook = part.GetForceMouselook();
2757 2786
2758 // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is 2787 // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
@@ -3772,10 +3801,15 @@ namespace OpenSim.Region.Framework.Scenes
3772 if (!IsChildAgent) 3801 if (!IsChildAgent)
3773 return; 3802 return;
3774 3803
3775 //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); 3804// m_log.DebugFormat(
3805// "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}",
3806// Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position);
3807
3776 // Find the distance (in meters) between the two regions 3808 // Find the distance (in meters) between the two regions
3777 uint shiftx = Util.RegionToWorldLoc(rRegionX - tRegionX); 3809 // XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the
3778 uint shifty = Util.RegionToWorldLoc(rRegionY - tRegionY); 3810 // uint
3811 int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize);
3812 int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize);
3779 3813
3780 Vector3 offset = new Vector3(shiftx, shifty, 0f); 3814 Vector3 offset = new Vector3(shiftx, shifty, 0f);
3781 3815
@@ -3876,9 +3910,6 @@ namespace OpenSim.Region.Framework.Scenes
3876 3910
3877 private void CopyFrom(AgentData cAgent) 3911 private void CopyFrom(AgentData cAgent)
3878 { 3912 {
3879 lock (m_originRegionIDAccessLock)
3880 m_originRegionID = cAgent.RegionID;
3881
3882 m_callbackURI = cAgent.CallbackURI; 3913 m_callbackURI = cAgent.CallbackURI;
3883// m_log.DebugFormat( 3914// m_log.DebugFormat(
3884// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", 3915// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
@@ -3951,6 +3982,12 @@ namespace OpenSim.Region.Framework.Scenes
3951 3982
3952 if (Scene.AttachmentsModule != null) 3983 if (Scene.AttachmentsModule != null)
3953 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 3984 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
3985
3986 // This must occur after attachments are copied, as it releases the CompleteMovement() calling thread
3987 // originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart
3988 // script attachments can outrace this thread.
3989 lock (m_originRegionIDAccessLock)
3990 m_originRegionID = cAgent.RegionID;
3954 } 3991 }
3955 3992
3956 public bool CopyAgent(out IAgentData agent) 3993 public bool CopyAgent(out IAgentData agent)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 85650d6..e68f954 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1343,7 +1343,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1343 writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); 1343 writer.WriteElementString("SalePrice", sop.SalePrice.ToString());
1344 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); 1344 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
1345 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); 1345 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
1346 WriteUUID(writer, "GroupID", sop.GroupID, options); 1346
1347 UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.GroupID;
1348 WriteUUID(writer, "GroupID", groupID, options);
1347 1349
1348 UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; 1350 UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
1349 WriteUUID(writer, "OwnerID", ownerID, options); 1351 WriteUUID(writer, "OwnerID", ownerID, options);
@@ -1469,7 +1471,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1469 writer.WriteElementString("Description", item.Description); 1471 writer.WriteElementString("Description", item.Description);
1470 writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); 1472 writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString());
1471 writer.WriteElementString("Flags", item.Flags.ToString()); 1473 writer.WriteElementString("Flags", item.Flags.ToString());
1472 WriteUUID(writer, "GroupID", item.GroupID, options); 1474
1475 UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.GroupID;
1476 WriteUUID(writer, "GroupID", groupID, options);
1477
1473 writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString()); 1478 writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString());
1474 writer.WriteElementString("InvType", item.InvType.ToString()); 1479 writer.WriteElementString("InvType", item.InvType.ToString());
1475 WriteUUID(writer, "ItemID", item.ItemID, options); 1480 WriteUUID(writer, "ItemID", item.ItemID, options);
@@ -1490,7 +1495,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1490 WriteUUID(writer, "PermsGranter", item.PermsGranter, options); 1495 WriteUUID(writer, "PermsGranter", item.PermsGranter, options);
1491 writer.WriteElementString("PermsMask", item.PermsMask.ToString()); 1496 writer.WriteElementString("PermsMask", item.PermsMask.ToString());
1492 writer.WriteElementString("Type", item.Type.ToString()); 1497 writer.WriteElementString("Type", item.Type.ToString());
1493 writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower()); 1498
1499 bool ownerChanged = options.ContainsKey("wipe-owners") ? false : item.OwnerChanged;
1500 writer.WriteElementString("OwnerChanged", ownerChanged.ToString().ToLower());
1494 1501
1495 writer.WriteEndElement(); // TaskInventoryItem 1502 writer.WriteEndElement(); // TaskInventoryItem
1496 } 1503 }
diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs
index e797207..396f1e8 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
45{ 45{
46 public static class OpenSimTerrainCompressor 46 public static class OpenSimTerrainCompressor
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50#pragma warning disable 414 50#pragma warning disable 414
51 private static string LogHeader = "[TERRAIN COMPRESSOR]"; 51 private static string LogHeader = "[TERRAIN COMPRESSOR]";