aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs76
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs55
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs53
8 files changed, 204 insertions, 126 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 6df25d6..5f3cd8c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1842,9 +1842,18 @@ namespace OpenSim.Region.Framework.Scenes
1842 EventManager.TriggerOnAttach(localID, itemID, avatarID); 1842 EventManager.TriggerOnAttach(localID, itemID, avatarID);
1843 } 1843 }
1844 1844
1845 public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, 1845 /// <summary>
1846 uint AttachmentPt) 1846 /// Called when the client receives a request to rez a single attachment on to the avatar from inventory
1847 /// (RezSingleAttachmentFromInv packet).
1848 /// </summary>
1849 /// <param name="remoteClient"></param>
1850 /// <param name="itemID"></param>
1851 /// <param name="AttachmentPt"></param>
1852 /// <returns></returns>
1853 public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
1847 { 1854 {
1855 m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
1856
1848 SceneObjectGroup att = m_sceneGraph.RezSingleAttachment(remoteClient, itemID, AttachmentPt); 1857 SceneObjectGroup att = m_sceneGraph.RezSingleAttachment(remoteClient, itemID, AttachmentPt);
1849 1858
1850 if (att == null) 1859 if (att == null)
@@ -1856,9 +1865,20 @@ namespace OpenSim.Region.Framework.Scenes
1856 return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt); 1865 return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt);
1857 } 1866 }
1858 1867
1859 public UUID RezSingleAttachment(SceneObjectGroup att, 1868 /// <summary>
1860 IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 1869 /// Update the user inventory to reflect an attachment
1870 /// </summary>
1871 /// <param name="att"></param>
1872 /// <param name="remoteClient"></param>
1873 /// <param name="itemID"></param>
1874 /// <param name="AttachmentPt"></param>
1875 /// <returns></returns>
1876 public UUID RezSingleAttachment(SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
1861 { 1877 {
1878 m_log.DebugFormat(
1879 "[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
1880 remoteClient.Name, att.Name, itemID);
1881
1862 if (!att.IsDeleted) 1882 if (!att.IsDeleted)
1863 AttachmentPt = att.RootPart.AttachmentPoint; 1883 AttachmentPt = att.RootPart.AttachmentPoint;
1864 1884
@@ -1897,8 +1917,19 @@ namespace OpenSim.Region.Framework.Scenes
1897 return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); 1917 return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
1898 } 1918 }
1899 1919
1920 /// <summary>
1921 /// This registers the item as attached in a user's inventory
1922 /// </summary>
1923 /// <param name="remoteClient"></param>
1924 /// <param name="AttachmentPt"></param>
1925 /// <param name="itemID"></param>
1926 /// <param name="att"></param>
1900 public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) 1927 public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
1901 { 1928 {
1929// m_log.DebugFormat(
1930// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
1931// att.Name, remoteClient.Name, AttachmentPt, itemID);
1932
1902 if (UUID.Zero == itemID) 1933 if (UUID.Zero == itemID)
1903 { 1934 {
1904 m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID."); 1935 m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID.");
@@ -1926,10 +1957,7 @@ namespace OpenSim.Region.Framework.Scenes
1926 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); 1957 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
1927 1958
1928 if (m_AvatarFactory != null) 1959 if (m_AvatarFactory != null)
1929 {
1930 m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 1960 m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
1931 }
1932
1933 } 1961 }
1934 } 1962 }
1935 1963
@@ -2012,6 +2040,7 @@ namespace OpenSim.Region.Framework.Scenes
2012 { 2040 {
2013 sog.SetOwnerId(ownerID); 2041 sog.SetOwnerId(ownerID);
2014 sog.SetGroup(groupID, remoteClient); 2042 sog.SetGroup(groupID, remoteClient);
2043 sog.ScheduleGroupForFullUpdate();
2015 2044
2016 foreach (SceneObjectPart child in sog.Children.Values) 2045 foreach (SceneObjectPart child in sog.Children.Values)
2017 child.Inventory.ChangeInventoryOwner(ownerID); 2046 child.Inventory.ChangeInventoryOwner(ownerID);
@@ -2033,6 +2062,7 @@ namespace OpenSim.Region.Framework.Scenes
2033 sog.SetOwnerId(groupID); 2062 sog.SetOwnerId(groupID);
2034 sog.ApplyNextOwnerPermissions(); 2063 sog.ApplyNextOwnerPermissions();
2035 } 2064 }
2065
2036 } 2066 }
2037 2067
2038 foreach (uint localID in localIDs) 2068 foreach (uint localID in localIDs)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 5e5a52e..a880fe7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1906,14 +1906,22 @@ namespace OpenSim.Region.Framework.Scenes
1906 //m_log.DebugFormat( 1906 //m_log.DebugFormat(
1907 // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); 1907 // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName);
1908 1908
1909 SceneObjectGroup sceneObject = null;
1910
1909 // If an entity creator has been registered for this prim type then use that 1911 // If an entity creator has been registered for this prim type then use that
1910 if (m_entityCreators.ContainsKey((PCode)shape.PCode)) 1912 if (m_entityCreators.ContainsKey((PCode)shape.PCode))
1911 return m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape); 1913 {
1914 sceneObject = m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape);
1915 }
1916 else
1917 {
1918 // Otherwise, use this default creation code;
1919 sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
1920 AddNewSceneObject(sceneObject, true);
1921 sceneObject.SetGroup(groupID, null);
1922 }
1912 1923
1913 // Otherwise, use this default creation code; 1924 sceneObject.ScheduleGroupForFullUpdate();
1914 SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
1915 AddNewSceneObject(sceneObject, true);
1916 sceneObject.SetGroup(groupID, null);
1917 1925
1918 return sceneObject; 1926 return sceneObject;
1919 } 1927 }
@@ -1941,7 +1949,7 @@ namespace OpenSim.Region.Framework.Scenes
1941 } 1949 }
1942 1950
1943 /// <summary> 1951 /// <summary>
1944 /// Add a newly created object to the scene 1952 /// Add a newly created object to the scene. Updates are also sent to viewers.
1945 /// </summary> 1953 /// </summary>
1946 /// <param name="sceneObject"></param> 1954 /// <param name="sceneObject"></param>
1947 /// <param name="attachToBackup"> 1955 /// <param name="attachToBackup">
@@ -1950,8 +1958,25 @@ namespace OpenSim.Region.Framework.Scenes
1950 /// </param> 1958 /// </param>
1951 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 1959 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
1952 { 1960 {
1953 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup); 1961 return AddNewSceneObject(sceneObject, attachToBackup, true);
1954 } 1962 }
1963
1964 /// <summary>
1965 /// Add a newly created object to the scene
1966 /// </summary>
1967 /// <param name="sceneObject"></param>
1968 /// <param name="attachToBackup">
1969 /// If true, the object is made persistent into the scene.
1970 /// If false, the object will not persist over server restarts
1971 /// </param>
1972 /// <param name="sendClientUpdates">
1973 /// If true, updates for the new scene object are sent to all viewers in range.
1974 /// If false, it is left to the caller to schedule the update
1975 /// </param>
1976 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
1977 {
1978 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
1979 }
1955 1980
1956 /// <summary> 1981 /// <summary>
1957 /// Delete every object from the scene 1982 /// Delete every object from the scene
@@ -3143,7 +3168,6 @@ namespace OpenSim.Region.Framework.Scenes
3143 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; 3168 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
3144 m_sceneGridService.KiPrimitive += SendKillObject; 3169 m_sceneGridService.KiPrimitive += SendKillObject;
3145 m_sceneGridService.OnGetLandData += GetLandData; 3170 m_sceneGridService.OnGetLandData += GetLandData;
3146
3147 } 3171 }
3148 3172
3149 /// <summary> 3173 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index e87f7ca..bd8ccce 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -103,15 +103,15 @@ namespace OpenSim.Region.Framework.Scenes
103 /// </summary> 103 /// </summary>
104 public event GetLandData OnGetLandData; 104 public event GetLandData OnGetLandData;
105 105
106 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; 106// private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
107 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; 107// private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
108 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; 108// private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
109 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; 109// private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
110 //private RegionUp handlerRegionUp = null; // OnRegionUp; 110 //private RegionUp handlerRegionUp = null; // OnRegionUp;
111 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; 111// private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
112 //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; 112 //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
113 private LogOffUser handlerLogOffUser = null; 113// private LogOffUser handlerLogOffUser = null;
114 private GetLandData handlerGetLandData = null; // OnGetLandData 114// private GetLandData handlerGetLandData = null; // OnGetLandData
115 115
116 public KiPrimitiveDelegate KiPrimitive; 116 public KiPrimitiveDelegate KiPrimitive;
117 117
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 369552f..22613e9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -229,7 +229,7 @@ namespace OpenSim.Region.Framework.Scenes
229 sceneObject.HasGroupChanged = true; 229 sceneObject.HasGroupChanged = true;
230 } 230 }
231 231
232 return AddSceneObject(sceneObject, attachToBackup); 232 return AddSceneObject(sceneObject, attachToBackup, true);
233 } 233 }
234 234
235 /// <summary> 235 /// <summary>
@@ -244,12 +244,12 @@ namespace OpenSim.Region.Framework.Scenes
244 /// <returns> 244 /// <returns>
245 /// true if the object was added, false if an object with the same uuid was already in the scene 245 /// true if the object was added, false if an object with the same uuid was already in the scene
246 /// </returns> 246 /// </returns>
247 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 247 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
248 { 248 {
249 // Ensure that we persist this new scene object 249 // Ensure that we persist this new scene object
250 sceneObject.HasGroupChanged = true; 250 sceneObject.HasGroupChanged = true;
251 251
252 return AddSceneObject(sceneObject, attachToBackup); 252 return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
253 } 253 }
254 254
255 /// <summary> 255 /// <summary>
@@ -261,12 +261,19 @@ namespace OpenSim.Region.Framework.Scenes
261 /// If true, the object is made persistent into the scene. 261 /// If true, the object is made persistent into the scene.
262 /// If false, the object will not persist over server restarts 262 /// If false, the object will not persist over server restarts
263 /// </param> 263 /// </param>
264 /// <returns>true if the object was added, false if an object with the same uuid was already in the scene 264 /// <param name="sendClientUpdates">
265 /// If true, updates for the new scene object are sent to all viewers in range.
266 /// If false, it is left to the caller to schedule the update
267 /// </param>
268 /// <returns>
269 /// true if the object was added, false if an object with the same uuid was already in the scene
265 /// </returns> 270 /// </returns>
266 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 271 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
267 { 272 {
268 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) 273 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
269 return false; 274 return false;
275
276 bool alreadyExisted = false;
270 277
271 if (m_parentScene.m_clampPrimSize) 278 if (m_parentScene.m_clampPrimSize)
272 { 279 {
@@ -287,6 +294,9 @@ namespace OpenSim.Region.Framework.Scenes
287 294
288 sceneObject.AttachToScene(m_parentScene); 295 sceneObject.AttachToScene(m_parentScene);
289 296
297 if (sendClientUpdates)
298 sceneObject.ScheduleGroupForFullUpdate();
299
290 lock (sceneObject) 300 lock (sceneObject)
291 { 301 {
292 if (!Entities.ContainsKey(sceneObject.UUID)) 302 if (!Entities.ContainsKey(sceneObject.UUID))
@@ -310,12 +320,14 @@ namespace OpenSim.Region.Framework.Scenes
310 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 320 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
311 } 321 }
312 } 322 }
313 323 }
314 return true; 324 else
325 {
326 alreadyExisted = true;
315 } 327 }
316 } 328 }
317 329
318 return false; 330 return alreadyExisted;
319 } 331 }
320 332
321 /// <summary> 333 /// <summary>
@@ -525,7 +537,10 @@ namespace OpenSim.Region.Framework.Scenes
525 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, 537 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
526 false, false, remoteClient.AgentId, true); 538 false, false, remoteClient.AgentId, true);
527 539
528 540// m_log.DebugFormat(
541// "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}",
542// objatt.Name, remoteClient.Name, AttachmentPt);
543
529 if (objatt != null) 544 if (objatt != null)
530 { 545 {
531 bool tainted = false; 546 bool tainted = false;
@@ -533,16 +548,27 @@ namespace OpenSim.Region.Framework.Scenes
533 tainted = true; 548 tainted = true;
534 549
535 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); 550 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
536 objatt.ScheduleGroupForFullUpdate(); 551 //objatt.ScheduleGroupForFullUpdate();
537 if (tainted) 552 if (tainted)
538 objatt.HasGroupChanged = true; 553 objatt.HasGroupChanged = true;
539 554
540 // Fire after attach, so we don't get messy perms dialogs 555 // Fire after attach, so we don't get messy perms dialogs
541 // 3 == AttachedRez 556 // 3 == AttachedRez
542 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); 557 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
558
559 // Do this last so that event listeners have access to all the effects of the attachment
560 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
543 } 561 }
562 else
563 {
564 m_log.WarnFormat(
565 "[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
566 itemID, remoteClient.Name, AttachmentPt);
567 }
568
544 return objatt; 569 return objatt;
545 } 570 }
571
546 return null; 572 return null;
547 } 573 }
548 574
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 6395d98..680c39a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -422,7 +422,7 @@ namespace OpenSim.Region.Framework.Scenes
422 422
423 if (!scenePresence.IsChildAgent) 423 if (!scenePresence.IsChildAgent)
424 { 424 {
425 m_log.ErrorFormat("Packet debug for {0} {1} set to {2}", 425 m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
426 scenePresence.Firstname, 426 scenePresence.Firstname,
427 scenePresence.Lastname, 427 scenePresence.Lastname,
428 newDebug); 428 newDebug);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index c5a6171..37b4fd6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -417,8 +417,8 @@ namespace OpenSim.Region.Framework.Scenes
417 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>(); 417 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
418 public List<SceneObjectPart> PlaySoundSlavePrims 418 public List<SceneObjectPart> PlaySoundSlavePrims
419 { 419 {
420 get { return m_LoopSoundSlavePrims; } 420 get { return m_PlaySoundSlavePrims; }
421 set { m_LoopSoundSlavePrims = value; } 421 set { m_PlaySoundSlavePrims = value; }
422 } 422 }
423 423
424 private SceneObjectPart m_LoopSoundMasterPrim = null; 424 private SceneObjectPart m_LoopSoundMasterPrim = null;
@@ -567,8 +567,10 @@ namespace OpenSim.Region.Framework.Scenes
567 } 567 }
568 568
569 ApplyPhysics(m_scene.m_physicalPrim); 569 ApplyPhysics(m_scene.m_physicalPrim);
570 570
571 ScheduleGroupForFullUpdate(); 571 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
572 // for the same object with very different properties. The caller must schedule the update.
573 //ScheduleGroupForFullUpdate();
572 } 574 }
573 575
574 public Vector3 GroupScale() 576 public Vector3 GroupScale()
@@ -956,10 +958,11 @@ namespace OpenSim.Region.Framework.Scenes
956 // don't attach attachments to child agents 958 // don't attach attachments to child agents
957 if (avatar.IsChildAgent) return; 959 if (avatar.IsChildAgent) return;
958 960
961// m_log.DebugFormat("[SOG]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
962
959 DetachFromBackup(); 963 DetachFromBackup();
960 964
961 // Remove from database and parcel prim count 965 // Remove from database and parcel prim count
962 //
963 m_scene.DeleteFromStorage(UUID); 966 m_scene.DeleteFromStorage(UUID);
964 m_scene.EventManager.TriggerParcelPrimCountTainted(); 967 m_scene.EventManager.TriggerParcelPrimCountTainted();
965 968
@@ -985,7 +988,6 @@ namespace OpenSim.Region.Framework.Scenes
985 SetAttachmentPoint(Convert.ToByte(attachmentpoint)); 988 SetAttachmentPoint(Convert.ToByte(attachmentpoint));
986 989
987 avatar.AddAttachment(this); 990 avatar.AddAttachment(this);
988 m_log.Debug("[SOG]: Added attachment " + UUID + " to avatar " + avatar.UUID);
989 991
990 if (!silent) 992 if (!silent)
991 { 993 {
@@ -1002,6 +1004,12 @@ namespace OpenSim.Region.Framework.Scenes
1002 ScheduleGroupForFullUpdate(); 1004 ScheduleGroupForFullUpdate();
1003 } 1005 }
1004 } 1006 }
1007 else
1008 {
1009 m_log.WarnFormat(
1010 "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present",
1011 UUID, agentID, Scene.RegionInfo.RegionName);
1012 }
1005 } 1013 }
1006 1014
1007 public byte GetAttachmentPoint() 1015 public byte GetAttachmentPoint()
@@ -1482,51 +1490,22 @@ namespace OpenSim.Region.Framework.Scenes
1482 1490
1483 #endregion 1491 #endregion
1484 1492
1485 #region Client Updating
1486
1487 public void SendFullUpdateToClient(IClientAPI remoteClient) 1493 public void SendFullUpdateToClient(IClientAPI remoteClient)
1488 { 1494 {
1489 SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); 1495 RootPart.SendFullUpdate(
1496 remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
1490 1497
1491 lock (m_parts) 1498 lock (m_parts)
1492 { 1499 {
1493 foreach (SceneObjectPart part in m_parts.Values) 1500 foreach (SceneObjectPart part in m_parts.Values)
1494 { 1501 {
1495 if (part != RootPart) 1502 if (part != RootPart)
1496 SendPartFullUpdate(remoteClient, part, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID)); 1503 part.SendFullUpdate(
1497 } 1504 remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID));
1498 }
1499 }
1500
1501 /// <summary>
1502 /// Send a full update to the client for the given part
1503 /// </summary>
1504 /// <param name="remoteClient"></param>
1505 /// <param name="part"></param>
1506 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
1507 {
1508// m_log.DebugFormat(
1509// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
1510
1511 if (m_rootPart.UUID == part.UUID)
1512 {
1513 if (IsAttachment)
1514 {
1515 part.SendFullUpdateToClient(remoteClient, m_rootPart.AttachedPos, clientFlags);
1516 }
1517 else
1518 {
1519 part.SendFullUpdateToClient(remoteClient, AbsolutePosition, clientFlags);
1520 } 1505 }
1521 } 1506 }
1522 else
1523 {
1524 part.SendFullUpdateToClient(remoteClient, clientFlags);
1525 }
1526 } 1507 }
1527 1508
1528 #endregion
1529
1530 #region Copying 1509 #region Copying
1531 1510
1532 /// <summary> 1511 /// <summary>
@@ -1986,6 +1965,8 @@ namespace OpenSim.Region.Framework.Scenes
1986 1965
1987 public void ScheduleFullUpdateToAvatar(ScenePresence presence) 1966 public void ScheduleFullUpdateToAvatar(ScenePresence presence)
1988 { 1967 {
1968// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name);
1969
1989 RootPart.AddFullUpdateToAvatar(presence); 1970 RootPart.AddFullUpdateToAvatar(presence);
1990 1971
1991 lock (m_parts) 1972 lock (m_parts)
@@ -2000,6 +1981,8 @@ namespace OpenSim.Region.Framework.Scenes
2000 1981
2001 public void ScheduleTerseUpdateToAvatar(ScenePresence presence) 1982 public void ScheduleTerseUpdateToAvatar(ScenePresence presence)
2002 { 1983 {
1984// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1} just to avatar {2}", Name, UUID, presence.Name);
1985
2003 lock (m_parts) 1986 lock (m_parts)
2004 { 1987 {
2005 foreach (SceneObjectPart part in m_parts.Values) 1988 foreach (SceneObjectPart part in m_parts.Values)
@@ -2014,6 +1997,8 @@ namespace OpenSim.Region.Framework.Scenes
2014 /// </summary> 1997 /// </summary>
2015 public void ScheduleGroupForFullUpdate() 1998 public void ScheduleGroupForFullUpdate()
2016 { 1999 {
2000// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID);
2001
2017 checkAtTargets(); 2002 checkAtTargets();
2018 RootPart.ScheduleFullUpdate(); 2003 RootPart.ScheduleFullUpdate();
2019 2004
@@ -2032,6 +2017,8 @@ namespace OpenSim.Region.Framework.Scenes
2032 /// </summary> 2017 /// </summary>
2033 public void ScheduleGroupForTerseUpdate() 2018 public void ScheduleGroupForTerseUpdate()
2034 { 2019 {
2020// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID);
2021
2035 lock (m_parts) 2022 lock (m_parts)
2036 { 2023 {
2037 foreach (SceneObjectPart part in m_parts.Values) 2024 foreach (SceneObjectPart part in m_parts.Values)
@@ -2045,9 +2032,11 @@ namespace OpenSim.Region.Framework.Scenes
2045 /// Immediately send a full update for this scene object. 2032 /// Immediately send a full update for this scene object.
2046 /// </summary> 2033 /// </summary>
2047 public void SendGroupFullUpdate() 2034 public void SendGroupFullUpdate()
2048 { 2035 {
2049 if (IsDeleted) 2036 if (IsDeleted)
2050 return; 2037 return;
2038
2039// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID);
2051 2040
2052 RootPart.SendFullUpdateToAllClients(); 2041 RootPart.SendFullUpdateToAllClients();
2053 2042
@@ -2064,7 +2053,7 @@ namespace OpenSim.Region.Framework.Scenes
2064 /// <summary> 2053 /// <summary>
2065 /// Immediately send an update for this scene object's root prim only. 2054 /// Immediately send an update for this scene object's root prim only.
2066 /// This is for updates regarding the object as a whole, and none of its parts in particular. 2055 /// This is for updates regarding the object as a whole, and none of its parts in particular.
2067 /// Note: this may not be cused by opensim (it probably should) but it's used by 2056 /// Note: this may not be used by opensim (it probably should) but it's used by
2068 /// external modules. 2057 /// external modules.
2069 /// </summary> 2058 /// </summary>
2070 public void SendGroupRootTerseUpdate() 2059 public void SendGroupRootTerseUpdate()
@@ -2079,6 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes
2079 { 2068 {
2080 if (m_scene == null) // Need to check here as it's null during object creation 2069 if (m_scene == null) // Need to check here as it's null during object creation
2081 return; 2070 return;
2071
2082 m_scene.SceneGraph.AddToUpdateList(this); 2072 m_scene.SceneGraph.AddToUpdateList(this);
2083 } 2073 }
2084 2074
@@ -3557,7 +3547,9 @@ namespace OpenSim.Region.Framework.Scenes
3557 HasGroupChanged = true; 3547 HasGroupChanged = true;
3558 } 3548 }
3559 3549
3560 ScheduleGroupForFullUpdate(); 3550 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
3551 // for the same object with very different properties. The caller must schedule the update.
3552 //ScheduleGroupForFullUpdate();
3561 } 3553 }
3562 3554
3563 public void TriggerScriptChangedEvent(Changed val) 3555 public void TriggerScriptChangedEvent(Changed val)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 5c283bc..10a186e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -568,8 +568,8 @@ namespace OpenSim.Region.Framework.Scenes
568 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>(); 568 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
569 public List<SceneObjectPart> PlaySoundSlavePrims 569 public List<SceneObjectPart> PlaySoundSlavePrims
570 { 570 {
571 get { return m_LoopSoundSlavePrims; } 571 get { return m_PlaySoundSlavePrims; }
572 set { m_LoopSoundSlavePrims = value; } 572 set { m_PlaySoundSlavePrims = value; }
573 } 573 }
574 574
575 private SceneObjectPart m_LoopSoundMasterPrim = null; 575 private SceneObjectPart m_LoopSoundMasterPrim = null;
@@ -2834,29 +2834,59 @@ namespace OpenSim.Region.Framework.Scenes
2834 } 2834 }
2835 } 2835 }
2836 2836
2837// /// <summary>
2838// ///
2839// /// </summary>
2840// /// <param name="remoteClient"></param>
2841// public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
2842// {
2843// m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags);
2844// }
2845
2846
2837 /// <summary> 2847 /// <summary>
2838 /// 2848 /// Send a full update to the client for the given part
2839 /// </summary> 2849 /// </summary>
2840 /// <param name="remoteClient"></param> 2850 /// <param name="remoteClient"></param>
2841 public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) 2851 /// <param name="clientFlags"></param>
2852 protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
2842 { 2853 {
2843 m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); 2854// m_log.DebugFormat(
2844 } 2855// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
2856
2857 if (IsRoot)
2858 {
2859 if (IsAttachment)
2860 {
2861 SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags);
2862 }
2863 else
2864 {
2865 SendFullUpdateToClient(remoteClient, AbsolutePosition, clientFlags);
2866 }
2867 }
2868 else
2869 {
2870 SendFullUpdateToClient(remoteClient, clientFlags);
2871 }
2872 }
2845 2873
2846 /// <summary> 2874 /// <summary>
2847 /// 2875 /// Send a full update for this part to all clients.
2848 /// </summary> 2876 /// </summary>
2849 public void SendFullUpdateToAllClients() 2877 public void SendFullUpdateToAllClients()
2850 { 2878 {
2851 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 2879 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
2852 for (int i = 0; i < avatars.Length; i++) 2880 for (int i = 0; i < avatars.Length; i++)
2853 { 2881 {
2854 // Ugly reference :( 2882 SendFullUpdate(avatars[i].ControllingClient, avatars[i].GenerateClientFlags(UUID));
2855 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
2856 avatars[i].GenerateClientFlags(UUID));
2857 } 2883 }
2858 } 2884 }
2859 2885
2886 /// <summary>
2887 /// Send a full update to all clients except the one nominated.
2888 /// </summary>
2889 /// <param name="agentID"></param>
2860 public void SendFullUpdateToAllClientsExcept(UUID agentID) 2890 public void SendFullUpdateToAllClientsExcept(UUID agentID)
2861 { 2891 {
2862 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 2892 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
@@ -2864,10 +2894,7 @@ namespace OpenSim.Region.Framework.Scenes
2864 { 2894 {
2865 // Ugly reference :( 2895 // Ugly reference :(
2866 if (avatars[i].UUID != agentID) 2896 if (avatars[i].UUID != agentID)
2867 { 2897 SendFullUpdate(avatars[i].ControllingClient, avatars[i].GenerateClientFlags(UUID));
2868 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
2869 avatars[i].GenerateClientFlags(UUID));
2870 }
2871 } 2898 }
2872 } 2899 }
2873 2900
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f83a4d2..465e916 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -830,41 +830,15 @@ namespace OpenSim.Region.Framework.Scenes
830 pos.Y = crossedBorder.BorderLine.Z - 1; 830 pos.Y = crossedBorder.BorderLine.Z - 1;
831 } 831 }
832 832
833 833 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
834 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
835 { 834 {
836 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
837
838 if (pos.X < 0)
839 {
840 emergencyPos.X = (int)Constants.RegionSize + pos.X;
841 if (!(pos.Y < 0))
842 emergencyPos.Y = pos.Y;
843 if (!(pos.Z < 0))
844 emergencyPos.X = pos.X;
845 }
846 if (pos.Y < 0)
847 {
848 emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
849 if (!(pos.X < 0))
850 emergencyPos.X = pos.X;
851 if (!(pos.Z < 0))
852 emergencyPos.Z = pos.Z;
853 }
854 if (pos.Z < 0)
855 {
856 if (!(pos.X < 0))
857 emergencyPos.X = pos.X;
858 if (!(pos.Y < 0))
859 emergencyPos.Y = pos.Y;
860 //Leave as 128
861 }
862
863 m_log.WarnFormat( 835 m_log.WarnFormat(
864 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 836 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping",
865 pos, Name, UUID, emergencyPos); 837 pos, Name, UUID);
866 838
867 pos = emergencyPos; 839 if (pos.X < 0f) pos.X = 0f;
840 if (pos.Y < 0f) pos.Y = 0f;
841 if (pos.Z < 0f) pos.Z = 0f;
868 } 842 }
869 843
870 float localAVHeight = 1.56f; 844 float localAVHeight = 1.56f;
@@ -875,7 +849,7 @@ namespace OpenSim.Region.Framework.Scenes
875 849
876 float posZLimit = 0; 850 float posZLimit = 0;
877 851
878 if (pos.X <Constants.RegionSize && pos.Y < Constants.RegionSize) 852 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize)
879 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 853 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
880 854
881 float newPosZ = posZLimit + localAVHeight / 2; 855 float newPosZ = posZLimit + localAVHeight / 2;
@@ -2685,7 +2659,12 @@ namespace OpenSim.Region.Framework.Scenes
2685 /// </summary> 2659 /// </summary>
2686 protected void CheckForSignificantMovement() 2660 protected void CheckForSignificantMovement()
2687 { 2661 {
2688 if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > 0.5) 2662 // Movement updates for agents in neighboring regions are sent directly to clients.
2663 // This value only affects how often agent positions are sent to neighbor regions
2664 // for things such as distance-based update prioritization
2665 const float SIGNIFICANT_MOVEMENT = 2.0f;
2666
2667 if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT)
2689 { 2668 {
2690 posLastSignificantMove = AbsolutePosition; 2669 posLastSignificantMove = AbsolutePosition;
2691 m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient); 2670 m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
@@ -2701,13 +2680,13 @@ namespace OpenSim.Region.Framework.Scenes
2701 cadu.AgentID = UUID.Guid; 2680 cadu.AgentID = UUID.Guid;
2702 cadu.alwaysrun = m_setAlwaysRun; 2681 cadu.alwaysrun = m_setAlwaysRun;
2703 cadu.AVHeight = m_avHeight; 2682 cadu.AVHeight = m_avHeight;
2704 sLLVector3 tempCameraCenter = new sLLVector3(new Vector3(m_CameraCenter.X, m_CameraCenter.Y, m_CameraCenter.Z)); 2683 Vector3 tempCameraCenter = m_CameraCenter;
2705 cadu.cameraPosition = tempCameraCenter; 2684 cadu.cameraPosition = tempCameraCenter;
2706 cadu.drawdistance = m_DrawDistance; 2685 cadu.drawdistance = m_DrawDistance;
2707 if (m_scene.Permissions.IsGod(new UUID(cadu.AgentID))) 2686 if (m_scene.Permissions.IsGod(new UUID(cadu.AgentID)))
2708 cadu.godlevel = m_godlevel; 2687 cadu.godlevel = m_godlevel;
2709 cadu.GroupAccess = 0; 2688 cadu.GroupAccess = 0;
2710 cadu.Position = new sLLVector3(AbsolutePosition); 2689 cadu.Position = AbsolutePosition;
2711 cadu.regionHandle = m_rootRegionHandle; 2690 cadu.regionHandle = m_rootRegionHandle;
2712 float multiplier = 1; 2691 float multiplier = 1;
2713 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount(); 2692 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
@@ -2722,7 +2701,7 @@ namespace OpenSim.Region.Framework.Scenes
2722 2701
2723 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString()); 2702 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
2724 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); 2703 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
2725 cadu.Velocity = new sLLVector3(Velocity); 2704 cadu.Velocity = Velocity;
2726 2705
2727 AgentPosition agentpos = new AgentPosition(); 2706 AgentPosition agentpos = new AgentPosition();
2728 agentpos.CopyFrom(cadu); 2707 agentpos.CopyFrom(cadu);