aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-07 05:48:44 +0000
committerMelanie Thielker2008-11-07 05:48:44 +0000
commit48c6d052d94a7ab57c5264f09e989fa717c730f5 (patch)
tree2af23487a496bc60c0ca3839783e57bfac1ce3de /OpenSim/Region
parent* Fix half of the issue behind the long standing 'UseCircuitCode' packet spam... (diff)
downloadopensim-SC-48c6d052d94a7ab57c5264f09e989fa717c730f5.zip
opensim-SC-48c6d052d94a7ab57c5264f09e989fa717c730f5.tar.gz
opensim-SC-48c6d052d94a7ab57c5264f09e989fa717c730f5.tar.bz2
opensim-SC-48c6d052d94a7ab57c5264f09e989fa717c730f5.tar.xz
Attachments, attachments, and, did I say attachments?
Too many fixes to list.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs3
-rw-r--r--OpenSim/Region/DataSnapshot/DataSnapshotManager.cs71
-rw-r--r--OpenSim/Region/DataSnapshot/ObjectSnapshot.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs17
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs25
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs60
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs99
-rw-r--r--OpenSim/Region/Examples/SimpleModule/ComplexObject.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs2
16 files changed, 177 insertions, 136 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index dee5d80..1a0fb29 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4293,7 +4293,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4293 { 4293 {
4294 if (att.ObjectData.Length > 0) 4294 if (att.ObjectData.Length > 0)
4295 { 4295 {
4296 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation); 4296 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false);
4297 } 4297 }
4298 } 4298 }
4299 } 4299 }
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index f51a5e2..c4c2ffd 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -1116,7 +1116,9 @@ namespace OpenSim.Region.Communications.OGS1
1116 1116
1117 if (remObject != null) 1117 if (remObject != null)
1118 { 1118 {
1119 m_log.DebugFormat("[INTERREGION]: Sending prim crossing message for prim {0}", primID.ToString());
1119 retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.Guid, objData, XMLMethod); 1120 retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.Guid, objData, XMLMethod);
1121 m_log.DebugFormat("[INTERREGION]: Return from prim crossing message for prim {0}: {1}", primID.ToString(), retValue.ToString());
1120 } 1122 }
1121 else 1123 else
1122 { 1124 {
@@ -1497,6 +1499,7 @@ namespace OpenSim.Region.Communications.OGS1
1497 /// <returns></returns> 1499 /// <returns></returns>
1498 public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) 1500 public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod)
1499 { 1501 {
1502 m_log.DebugFormat("[INTERREGION]: Got prim crosssing request for {0}", primID);
1500 m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); 1503 m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod);
1501 1504
1502 return true; 1505 return true;
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
index 3f934c9..782b431 100644
--- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
+++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
@@ -32,7 +32,6 @@ using System.IO;
32using System.Net; 32using System.Net;
33using System.Reflection; 33using System.Reflection;
34using System.Text; 34using System.Text;
35using System.Timers;
36using System.Xml; 35using System.Xml;
37using OpenMetaverse; 36using OpenMetaverse;
38using log4net; 37using log4net;
@@ -71,12 +70,10 @@ namespace OpenSim.Region.DataSnapshot
71 public string m_hostname = "127.0.0.1"; 70 public string m_hostname = "127.0.0.1";
72 71
73 //Update timers 72 //Update timers
74 private Timer m_periodic = null;
75 private int m_period = 20; // in seconds 73 private int m_period = 20; // in seconds
76 private int m_maxStales = 500; 74 private int m_maxStales = 500;
77 private int m_stales = 0; 75 private int m_stales = 0;
78 private Timer m_passedCheck = null; 76 private int m_lastUpdate = 0;
79 private bool m_periodPassed = false;
80 77
81 //Program objects 78 //Program objects
82 private SnapshotStore m_snapStore = null; 79 private SnapshotStore m_snapStore = null;
@@ -126,6 +123,7 @@ namespace OpenSim.Region.DataSnapshot
126 { 123 {
127 m_disabledModules.Add(bloody_wanker); 124 m_disabledModules.Add(bloody_wanker);
128 } 125 }
126 m_lastUpdate = System.Environment.TickCount;
129 } 127 }
130 catch (Exception) 128 catch (Exception)
131 { 129 {
@@ -137,17 +135,6 @@ namespace OpenSim.Region.DataSnapshot
137 135
138 if (m_enabled) 136 if (m_enabled)
139 { 137 {
140 //Create update timer
141 m_periodic = new Timer();
142 m_periodic.Interval = m_period * 1000;
143 m_periodic.Elapsed += SnapshotTimerCallback;
144
145 //Create update eligibility timer
146 m_passedCheck = new Timer();
147 m_passedCheck.Interval = m_period * 1000;
148 m_passedCheck.Elapsed += UpdateEligibilityCallback;
149 m_passedCheck.Start();
150
151 //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer 138 //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
152 new DataRequestHandler(scene, this); 139 new DataRequestHandler(scene, this);
153 140
@@ -253,6 +240,8 @@ namespace OpenSim.Region.DataSnapshot
253 */ 240 */
254 public XmlDocument GetSnapshot(string regionName) 241 public XmlDocument GetSnapshot(string regionName)
255 { 242 {
243 CheckStale();
244
256 XmlDocument requestedSnap = new XmlDocument(); 245 XmlDocument requestedSnap = new XmlDocument();
257 requestedSnap.AppendChild(requestedSnap.CreateXmlDeclaration("1.0", null, null)); 246 requestedSnap.AppendChild(requestedSnap.CreateXmlDeclaration("1.0", null, null));
258 requestedSnap.AppendChild(requestedSnap.CreateWhitespace("\r\n")); 247 requestedSnap.AppendChild(requestedSnap.CreateWhitespace("\r\n"));
@@ -369,38 +358,34 @@ namespace OpenSim.Region.DataSnapshot
369 //Behavior here: Wait m_period seconds, then update if there has not been a request in m_period seconds 358 //Behavior here: Wait m_period seconds, then update if there has not been a request in m_period seconds
370 //or m_maxStales has been exceeded 359 //or m_maxStales has been exceeded
371 m_stales++; 360 m_stales++;
372
373 if ((m_stales >= m_maxStales) && m_periodPassed)
374 SnapshotTimerCallback(m_periodic, null);
375 else if (m_periodic.Enabled == false)
376 m_periodic.Start();
377 else
378 {
379 m_periodic.Stop();
380 m_periodic.Start();
381 }
382 } 361 }
383 362
384 private void SnapshotTimerCallback(object timer, ElapsedEventArgs args) 363 private void CheckStale()
385 { 364 {
386 m_log.Debug("[DATASNAPSHOT]: Marking scenes for snapshot updates."); 365 // Wrap check
387 366 if (System.Environment.TickCount < m_lastUpdate)
388 //Finally generate those snapshot updates 367 {
389 MakeEverythingStale(); 368 m_lastUpdate = System.Environment.TickCount;
390 369 }
391 //Stop the update delay timer
392 m_periodic.Stop();
393
394 //Reset the eligibility flag and timer
395 m_periodPassed = false;
396 m_passedCheck.Stop();
397 m_passedCheck.Start();
398 }
399 370
400 private void UpdateEligibilityCallback(object timer, ElapsedEventArgs args) 371 if (m_stales >= m_maxStales)
401 { 372 {
402 //Set eligibility, so we can start making updates 373 if (System.Environment.TickCount - m_lastUpdate >= 20000)
403 m_periodPassed = true; 374 {
375 m_stales = 0;
376 m_lastUpdate = System.Environment.TickCount;
377 MakeEverythingStale();
378 }
379 }
380 else
381 {
382 if (m_lastUpdate + 1000 * m_period < System.Environment.TickCount)
383 {
384 m_stales = 0;
385 m_lastUpdate = System.Environment.TickCount;
386 MakeEverythingStale();
387 }
388 }
404 } 389 }
405 390
406 public void MakeEverythingStale() 391 public void MakeEverythingStale()
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
index c77de96..12e0f0f 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
70 client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos, 70 client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos,
71 IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; }; 71 IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; };
72 client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, 72 client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt,
73 Quaternion rot) { this.Stale = true; }; 73 Quaternion rot, bool silent) { this.Stale = true; };
74 client.OnObjectDuplicate += delegate(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID, 74 client.OnObjectDuplicate += delegate(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID,
75 UUID GroupID) { this.Stale = true; }; 75 UUID GroupID) { this.Stale = true; };
76 client.OnObjectDuplicateOnRay += delegate(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, 76 client.OnObjectDuplicateOnRay += delegate(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID,
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs
index edf5ec1..9d81262 100644
--- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs
+++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMModel.cs
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
262 scene.PhysicsScene.RemovePrim(((SceneObjectGroup)scene.Entities[uuid]).RootPart.PhysActor); 262 scene.PhysicsScene.RemovePrim(((SceneObjectGroup)scene.Entities[uuid]).RootPart.PhysActor);
263 scene.SendKillObject(scene.Entities[uuid].LocalId); 263 scene.SendKillObject(scene.Entities[uuid].LocalId);
264 scene.m_innerScene.DeleteSceneObject(uuid, false); 264 scene.m_innerScene.DeleteSceneObject(uuid, false);
265 ((SceneObjectGroup)scene.Entities[uuid]).DeleteGroup(); 265 ((SceneObjectGroup)scene.Entities[uuid]).DeleteGroup(false);
266 } 266 }
267 catch(Exception e) 267 catch(Exception e)
268 { 268 {
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs
index d6fca7b..16edc2c 100644
--- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs
+++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs
@@ -211,14 +211,13 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
211 211
212 public void SendFullUpdate(IClientAPI client, uint clientFlags) 212 public void SendFullUpdate(IClientAPI client, uint clientFlags)
213 { 213 {
214 m_Entity.SendFullUpdateToClient(client, clientFlags); 214 m_Entity.SendFullUpdateToClient(client);
215 } 215 }
216 216
217 public void SendFullUpdateToAll() 217 public void SendFullUpdateToAll()
218 { 218 {
219 uint clientFlags = 0;
220 m_Entity.Scene.ClientManager.ForEachClient(delegate(IClientAPI controller) 219 m_Entity.Scene.ClientManager.ForEachClient(delegate(IClientAPI controller)
221 { m_Entity.SendFullUpdateToClient(controller, clientFlags); } 220 { m_Entity.SendFullUpdateToClient(controller); }
222 ); 221 );
223 } 222 }
224 223
diff --git a/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
index 827540d..b6879b0 100644
--- a/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
@@ -181,7 +181,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
181 181
182 if (Util.RandomClass.NextDouble() < killLikelyhood) 182 if (Util.RandomClass.NextDouble() < killLikelyhood)
183 { 183 {
184 m_scene.DeleteSceneObject(selectedTree.ParentGroup); 184 m_scene.DeleteSceneObject(selectedTree.ParentGroup, false);
185 m_trees.Remove(selectedTree.ParentGroup.UUID); 185 m_trees.Remove(selectedTree.ParentGroup.UUID);
186 186
187 m_scene.ForEachClient(delegate(IClientAPI controller) 187 m_scene.ForEachClient(delegate(IClientAPI controller)
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 4e7494e..6c0f57b 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -433,7 +433,7 @@ namespace OpenSim.Region.Environment.Scenes
433 /// <param name="objectLocalID"></param> 433 /// <param name="objectLocalID"></param>
434 /// <param name="AttachmentPt"></param> 434 /// <param name="AttachmentPt"></param>
435 /// <param name="rot"></param> 435 /// <param name="rot"></param>
436 protected internal void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot) 436 protected internal void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
437 { 437 {
438 // If we can't take it, we can't attach it! 438 // If we can't take it, we can't attach it!
439 // 439 //
@@ -447,7 +447,7 @@ namespace OpenSim.Region.Environment.Scenes
447 447
448 // Calls attach with a Zero position 448 // Calls attach with a Zero position
449 // 449 //
450 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero); 450 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false);
451 } 451 }
452 452
453 public SceneObjectGroup RezSingleAttachment( 453 public SceneObjectGroup RezSingleAttachment(
@@ -464,7 +464,7 @@ namespace OpenSim.Region.Environment.Scenes
464 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) 464 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
465 tainted = true; 465 tainted = true;
466 466
467 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition); 467 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
468 objatt.ScheduleGroupForFullUpdate(); 468 objatt.ScheduleGroupForFullUpdate();
469 if (tainted) 469 if (tainted)
470 objatt.HasGroupChanged = true; 470 objatt.HasGroupChanged = true;
@@ -491,14 +491,14 @@ namespace OpenSim.Region.Environment.Scenes
491 group.DetachToInventoryPrep(); 491 group.DetachToInventoryPrep();
492 m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 492 m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
493 m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID); 493 m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID);
494 m_parentScene.DeleteSceneObject(group); 494 m_parentScene.DeleteSceneObject(group, false);
495 } 495 }
496 } 496 }
497 } 497 }
498 } 498 }
499 499
500 protected internal void AttachObject( 500 protected internal void AttachObject(
501 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos) 501 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
502 { 502 {
503 List<EntityBase> EntityList = GetEntities(); 503 List<EntityBase> EntityList = GetEntities();
504 foreach (EntityBase obj in EntityList) 504 foreach (EntityBase obj in EntityList)
@@ -553,7 +553,7 @@ namespace OpenSim.Region.Environment.Scenes
553 553
554 m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); 554 m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
555 555
556 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos); 556 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
557 // In case it is later dropped again, don't let 557 // In case it is later dropped again, don't let
558 // it get cleaned up 558 // it get cleaned up
559 // 559 //
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 42986ec..c59fffc 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1601,7 +1601,7 @@ namespace OpenSim.Region.Environment.Scenes
1601 } 1601 }
1602 else if (permissionToDelete) 1602 else if (permissionToDelete)
1603 { 1603 {
1604 DeleteSceneObject(grp); 1604 DeleteSceneObject(grp, false);
1605 } 1605 }
1606 } 1606 }
1607 1607
@@ -1735,7 +1735,7 @@ namespace OpenSim.Region.Environment.Scenes
1735 1735
1736 // Finally remove the item, for reals this time. 1736 // Finally remove the item, for reals this time.
1737 if (permissionToDelete) 1737 if (permissionToDelete)
1738 DeleteSceneObject(objectGroup); 1738 DeleteSceneObject(objectGroup, false);
1739 } 1739 }
1740 1740
1741 public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, UUID assetID, UUID agentID) 1741 public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, UUID assetID, UUID agentID)
@@ -2279,7 +2279,7 @@ namespace OpenSim.Region.Environment.Scenes
2279 2279
2280 returnobjects[i] = null; 2280 returnobjects[i] = null;
2281 2281
2282 DeleteSceneObject(ObjectDeleting); 2282 DeleteSceneObject(ObjectDeleting, false);
2283 ObjectDeleting = null; 2283 ObjectDeleting = null;
2284 } 2284 }
2285 else 2285 else
@@ -2320,7 +2320,7 @@ namespace OpenSim.Region.Environment.Scenes
2320 EventManager.TriggerStopScript(part.LocalId, itemID); 2320 EventManager.TriggerStopScript(part.LocalId, itemID);
2321 } 2321 }
2322 2322
2323 public void RezSingleAttachment(IClientAPI remoteClient, UUID itemID, 2323 public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID,
2324 uint AttachmentPt) 2324 uint AttachmentPt)
2325 { 2325 {
2326 SceneObjectGroup att = m_innerScene.RezSingleAttachment(remoteClient, itemID, AttachmentPt); 2326 SceneObjectGroup att = m_innerScene.RezSingleAttachment(remoteClient, itemID, AttachmentPt);
@@ -2328,13 +2328,13 @@ namespace OpenSim.Region.Environment.Scenes
2328 if (att == null) 2328 if (att == null)
2329 { 2329 {
2330 DetachSingleAttachmentToInv(itemID, remoteClient); 2330 DetachSingleAttachmentToInv(itemID, remoteClient);
2331 return; 2331 return UUID.Zero;
2332 } 2332 }
2333 2333
2334 RezSingleAttachment(att, remoteClient, itemID, AttachmentPt); 2334 return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt);
2335 } 2335 }
2336 2336
2337 public void RezSingleAttachment(SceneObjectGroup att, 2337 public UUID RezSingleAttachment(SceneObjectGroup att,
2338 IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 2338 IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
2339 { 2339 {
2340 if (att.RootPart != null) 2340 if (att.RootPart != null)
@@ -2351,11 +2351,12 @@ namespace OpenSim.Region.Environment.Scenes
2351 } 2351 }
2352 2352
2353 } 2353 }
2354 return att.UUID;
2354 } 2355 }
2355 2356
2356 public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos) 2357 public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos)
2357 { 2358 {
2358 m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos); 2359 m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos, false);
2359 } 2360 }
2360 2361
2361 public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) 2362 public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index cee183c..40f8605 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1831,7 +1831,7 @@ namespace OpenSim.Region.Environment.Scenes
1831 foreach (EntityBase e in entities) 1831 foreach (EntityBase e in entities)
1832 { 1832 {
1833 if (e is SceneObjectGroup) 1833 if (e is SceneObjectGroup)
1834 DeleteSceneObject((SceneObjectGroup)e); 1834 DeleteSceneObject((SceneObjectGroup)e, false);
1835 } 1835 }
1836 } 1836 }
1837 } 1837 }
@@ -1840,7 +1840,7 @@ namespace OpenSim.Region.Environment.Scenes
1840 /// Delete the given object from the scene. 1840 /// Delete the given object from the scene.
1841 /// </summary> 1841 /// </summary>
1842 /// <param name="group"></param> 1842 /// <param name="group"></param>
1843 public void DeleteSceneObject(SceneObjectGroup group) 1843 public void DeleteSceneObject(SceneObjectGroup group, bool silent)
1844 { 1844 {
1845 //SceneObjectPart rootPart = group.GetChildPart(group.UUID); 1845 //SceneObjectPart rootPart = group.GetChildPart(group.UUID);
1846 1846
@@ -1866,7 +1866,7 @@ namespace OpenSim.Region.Environment.Scenes
1866 EventManager.TriggerParcelPrimCountTainted(); 1866 EventManager.TriggerParcelPrimCountTainted();
1867 } 1867 }
1868 1868
1869 group.DeleteGroup(); 1869 group.DeleteGroup(silent);
1870 } 1870 }
1871 1871
1872 /// <summary> 1872 /// <summary>
@@ -1982,7 +1982,7 @@ namespace OpenSim.Region.Environment.Scenes
1982 /// </summary> 1982 /// </summary>
1983 /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> 1983 /// <param name="attemptedPosition">the attempted out of region position of the scene object</param>
1984 /// <param name="grp">the scene object that we're crossing</param> 1984 /// <param name="grp">the scene object that we're crossing</param>
1985 public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp) 1985 public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp, bool silent)
1986 { 1986 {
1987 if (grp == null) 1987 if (grp == null)
1988 return; 1988 return;
@@ -1994,7 +1994,7 @@ namespace OpenSim.Region.Environment.Scenes
1994 // We remove the object here 1994 // We remove the object here
1995 try 1995 try
1996 { 1996 {
1997 DeleteSceneObject(grp); 1997 DeleteSceneObject(grp, false);
1998 } 1998 }
1999 catch (Exception) 1999 catch (Exception)
2000 { 2000 {
@@ -2044,7 +2044,7 @@ namespace OpenSim.Region.Environment.Scenes
2044 grp.OffsetForNewRegion(pos); 2044 grp.OffsetForNewRegion(pos);
2045 2045
2046 // If we fail to cross the border, then reset the position of the scene object on that border. 2046 // If we fail to cross the border, then reset the position of the scene object on that border.
2047 if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp)) 2047 if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent))
2048 { 2048 {
2049 grp.OffsetForNewRegion(oldGroupPosition); 2049 grp.OffsetForNewRegion(oldGroupPosition);
2050 } 2050 }
@@ -2059,7 +2059,7 @@ namespace OpenSim.Region.Environment.Scenes
2059 /// true if the crossing itself was successful, false on failure 2059 /// true if the crossing itself was successful, false on failure
2060 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region 2060 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
2061 /// </returns> 2061 /// </returns>
2062 public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp) 2062 public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent)
2063 { 2063 {
2064 bool successYN = false; 2064 bool successYN = false;
2065 int primcrossingXMLmethod = 0; 2065 int primcrossingXMLmethod = 0;
@@ -2075,7 +2075,7 @@ namespace OpenSim.Region.Environment.Scenes
2075 // We remove the object here 2075 // We remove the object here
2076 try 2076 try
2077 { 2077 {
2078 DeleteSceneObject(grp); 2078 DeleteSceneObject(grp, silent);
2079 } 2079 }
2080 catch (Exception e) 2080 catch (Exception e)
2081 { 2081 {
@@ -2115,7 +2115,7 @@ namespace OpenSim.Region.Environment.Scenes
2115 /// <returns></returns> 2115 /// <returns></returns>
2116 public bool IncomingInterRegionPrimGroup(ulong regionHandle, UUID primID, string objXMLData, int XMLMethod) 2116 public bool IncomingInterRegionPrimGroup(ulong regionHandle, UUID primID, string objXMLData, int XMLMethod)
2117 { 2117 {
2118 m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); 2118 m_log.Warn("[INTERREGION]: A new prim arrived from a neighbor");
2119 if (XMLMethod == 0) 2119 if (XMLMethod == 0)
2120 { 2120 {
2121 SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); 2121 SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData);
@@ -2129,7 +2129,7 @@ namespace OpenSim.Region.Environment.Scenes
2129 SceneObjectGroup grp = RootPrim.ParentGroup; 2129 SceneObjectGroup grp = RootPrim.ParentGroup;
2130 if (grp != null) 2130 if (grp != null)
2131 { 2131 {
2132 DeleteSceneObject(grp); 2132 DeleteSceneObject(grp, false);
2133 } 2133 }
2134 2134
2135 m_log.Info("[INTERREGION]: Denied prim crossing for banned avatar"); 2135 m_log.Info("[INTERREGION]: Denied prim crossing for banned avatar");
@@ -2145,6 +2145,8 @@ namespace OpenSim.Region.Environment.Scenes
2145 { 2145 {
2146 // Never persist 2146 // Never persist
2147 2147
2148 m_log.DebugFormat("[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.RootPart.LastOwnerID.ToString(), grp.UUID.ToString());
2149
2148 grp.DetachFromBackup(); 2150 grp.DetachFromBackup();
2149 2151
2150 // Attachment 2152 // Attachment
@@ -2156,6 +2158,7 @@ namespace OpenSim.Region.Environment.Scenes
2156 // with the deeded object, it goes back to them 2158 // with the deeded object, it goes back to them
2157 2159
2158 grp.SetFromAssetID(grp.RootPart.LastOwnerID); 2160 grp.SetFromAssetID(grp.RootPart.LastOwnerID);
2161 m_log.DebugFormat("[ATTACHMENT]: Attach to avatar {0}", sp.UUID.ToString());
2159 AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition); 2162 AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition);
2160 } 2163 }
2161 else 2164 else
@@ -4354,7 +4357,7 @@ namespace OpenSim.Region.Environment.Scenes
4354 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) 4357 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
4355 { 4358 {
4356 if (grp.RootPart.Expires <= DateTime.Now) 4359 if (grp.RootPart.Expires <= DateTime.Now)
4357 DeleteSceneObject(grp); 4360 DeleteSceneObject(grp, false);
4358 } 4361 }
4359 } 4362 }
4360 } 4363 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index fb8ec94..be21460 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -675,8 +675,6 @@ namespace OpenSim.Region.Environment.Scenes
675 // the avatar.Close below will clear the child region list. We need this below for (possibly) 675 // the avatar.Close below will clear the child region list. We need this below for (possibly)
676 // closing the child agents, so save it here (we need a copy as it is Clear()-ed). 676 // closing the child agents, so save it here (we need a copy as it is Clear()-ed).
677 List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); 677 List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList());
678 avatar.Close();
679
680 // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport 678 // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport
681 // failure at this point (unlike a border crossing failure). So perhaps this can never fail 679 // failure at this point (unlike a border crossing failure). So perhaps this can never fail
682 // once we reach here... 680 // once we reach here...
@@ -712,11 +710,14 @@ namespace OpenSim.Region.Environment.Scenes
712 710
713 avatar.MakeChildAgent(); 711 avatar.MakeChildAgent();
714 Thread.Sleep(5000); 712 Thread.Sleep(5000);
715 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle); 713 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
716 if (KiPrimitive != null) 714 if (KiPrimitive != null)
717 { 715 {
718 KiPrimitive(avatar.LocalId); 716 KiPrimitive(avatar.LocalId);
719 } 717 }
718
719 avatar.Close();
720
720 uint newRegionX = (uint)(reg.RegionHandle >> 40); 721 uint newRegionX = (uint)(reg.RegionHandle >> 40);
721 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); 722 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
722 uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); 723 uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 2f25478..a19564f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.Environment.Scenes
227 227
228 if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !IsAttachment) 228 if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !IsAttachment)
229 { 229 {
230 m_scene.CrossPrimGroupIntoNewRegion(val, this); 230 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
231 } 231 }
232 232
233 lock (m_parts) 233 lock (m_parts)
@@ -319,7 +319,7 @@ namespace OpenSim.Region.Environment.Scenes
319 { 319 {
320 m_isSelected = value; 320 m_isSelected = value;
321 // Tell physics engine that group is selected 321 // Tell physics engine that group is selected
322 if (m_rootPart.PhysActor != null) 322 if (m_rootPart != null && m_rootPart.PhysActor != null)
323 { 323 {
324 m_rootPart.PhysActor.Selected = value; 324 m_rootPart.PhysActor.Selected = value;
325 // Pass it on to the children. 325 // Pass it on to the children.
@@ -746,7 +746,7 @@ namespace OpenSim.Region.Environment.Scenes
746 /// <param name="agentID"></param> 746 /// <param name="agentID"></param>
747 /// <param name="attachmentpoint"></param> 747 /// <param name="attachmentpoint"></param>
748 /// <param name="AttachOffset"></param> 748 /// <param name="AttachOffset"></param>
749 public void AttachToAgent(UUID agentID, uint attachmentpoint, Vector3 AttachOffset) 749 public void AttachToAgent(UUID agentID, uint attachmentpoint, Vector3 AttachOffset, bool silent)
750 { 750 {
751 ScenePresence avatar = m_scene.GetScenePresence(agentID); 751 ScenePresence avatar = m_scene.GetScenePresence(agentID);
752 if (avatar != null) 752 if (avatar != null)
@@ -777,19 +777,24 @@ namespace OpenSim.Region.Environment.Scenes
777 SetAttachmentPoint(Convert.ToByte(attachmentpoint)); 777 SetAttachmentPoint(Convert.ToByte(attachmentpoint));
778 778
779 avatar.AddAttachment(this); 779 avatar.AddAttachment(this);
780 // Killing it here will cause the client to deselect it 780
781 // It then reappears on the avatar, deselected 781 if(!silent)
782 // through the full update below
783 //
784 if (IsSelected)
785 { 782 {
786 m_scene.SendKillObject(m_rootPart.LocalId); 783 // Killing it here will cause the client to deselect it
787 } 784 // It then reappears on the avatar, deselected
785 // through the full update below
786 //
787 if (IsSelected)
788 {
789 m_scene.SendKillObject(m_rootPart.LocalId);
790 }
788 791
789 IsSelected = false; // fudge.... 792 IsSelected = false; // fudge....
790 ScheduleGroupForFullUpdate(); 793 ScheduleGroupForFullUpdate();
794 }
791 } 795 }
792 } 796 }
797
793 public byte GetAttachmentPoint() 798 public byte GetAttachmentPoint()
794 { 799 {
795 if (m_rootPart != null) 800 if (m_rootPart != null)
@@ -994,7 +999,7 @@ namespace OpenSim.Region.Environment.Scenes
994 /// <summary> 999 /// <summary>
995 /// Delete this group from its scene and tell all the scene presences about that deletion. 1000 /// Delete this group from its scene and tell all the scene presences about that deletion.
996 /// </summary> 1001 /// </summary>
997 public void DeleteGroup() 1002 public void DeleteGroup(bool silent)
998 { 1003 {
999 // We need to keep track of this state in case this group is still queued for backup. 1004 // We need to keep track of this state in case this group is still queued for backup.
1000 // FIXME: This is a poor temporary solution, since it still leaves plenty of scope for race 1005 // FIXME: This is a poor temporary solution, since it still leaves plenty of scope for race
@@ -1018,8 +1023,11 @@ namespace OpenSim.Region.Environment.Scenes
1018 avatars[i].StandUp(); 1023 avatars[i].StandUp();
1019 } 1024 }
1020 1025
1021 if (m_rootPart != null && part == m_rootPart) 1026 if (!silent)
1022 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); 1027 {
1028 if (m_rootPart != null && part == m_rootPart)
1029 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId);
1030 }
1023 } 1031 }
1024 } 1032 }
1025 1033
@@ -1257,13 +1265,16 @@ namespace OpenSim.Region.Environment.Scenes
1257 1265
1258 #region Client Updating 1266 #region Client Updating
1259 1267
1260 public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientFlags) 1268 public void SendFullUpdateToClient(IClientAPI remoteClient)
1261 { 1269 {
1270 SendPartFullUpdate(remoteClient, RootPart, m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
1271
1262 lock (m_parts) 1272 lock (m_parts)
1263 { 1273 {
1264 foreach (SceneObjectPart part in m_parts.Values) 1274 foreach (SceneObjectPart part in m_parts.Values)
1265 { 1275 {
1266 SendPartFullUpdate(remoteClient, part, clientFlags); 1276 if (part != RootPart)
1277 SendPartFullUpdate(remoteClient, part, m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(remoteClient.AgentId, part.UUID));
1267 } 1278 }
1268 } 1279 }
1269 } 1280 }
@@ -1626,11 +1637,14 @@ namespace OpenSim.Region.Environment.Scenes
1626 1637
1627 public void ScheduleFullUpdateToAvatar(ScenePresence presence) 1638 public void ScheduleFullUpdateToAvatar(ScenePresence presence)
1628 { 1639 {
1640 RootPart.AddFullUpdateToAvatar(presence);
1641
1629 lock (m_parts) 1642 lock (m_parts)
1630 { 1643 {
1631 foreach (SceneObjectPart part in m_parts.Values) 1644 foreach (SceneObjectPart part in m_parts.Values)
1632 { 1645 {
1633 part.AddFullUpdateToAvatar(presence); 1646 if (part != RootPart)
1647 part.AddFullUpdateToAvatar(presence);
1634 } 1648 }
1635 } 1649 }
1636 } 1650 }
@@ -1652,11 +1666,14 @@ namespace OpenSim.Region.Environment.Scenes
1652 public void ScheduleGroupForFullUpdate() 1666 public void ScheduleGroupForFullUpdate()
1653 { 1667 {
1654 checkAtTargets(); 1668 checkAtTargets();
1669 RootPart.ScheduleFullUpdate();
1670
1655 lock (m_parts) 1671 lock (m_parts)
1656 { 1672 {
1657 foreach (SceneObjectPart part in m_parts.Values) 1673 foreach (SceneObjectPart part in m_parts.Values)
1658 { 1674 {
1659 part.ScheduleFullUpdate(); 1675 if (part != RootPart)
1676 part.ScheduleFullUpdate();
1660 } 1677 }
1661 } 1678 }
1662 } 1679 }
@@ -1680,11 +1697,14 @@ namespace OpenSim.Region.Environment.Scenes
1680 /// </summary> 1697 /// </summary>
1681 public void SendGroupFullUpdate() 1698 public void SendGroupFullUpdate()
1682 { 1699 {
1700 RootPart.SendFullUpdateToAllClients();
1701
1683 lock (m_parts) 1702 lock (m_parts)
1684 { 1703 {
1685 foreach (SceneObjectPart part in m_parts.Values) 1704 foreach (SceneObjectPart part in m_parts.Values)
1686 { 1705 {
1687 part.SendFullUpdateToAllClients(); 1706 if (part != RootPart)
1707 part.SendFullUpdateToAllClients();
1688 } 1708 }
1689 } 1709 }
1690 } 1710 }
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index db4ab52..ad12420 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -114,8 +114,6 @@ namespace OpenSim.Region.Environment.Scenes
114 private static readonly Vector3 m_sitTargetCorrectionOffset = new Vector3(0.1f, 0.0f, 0.3f); 114 private static readonly Vector3 m_sitTargetCorrectionOffset = new Vector3(0.1f, 0.0f, 0.3f);
115 private float m_godlevel = 0; 115 private float m_godlevel = 0;
116 116
117 private bool m_attachmentsTransported = true;
118
119 private bool m_invulnerable = true; 117 private bool m_invulnerable = true;
120 118
121 private Vector3 m_LastChildAgentUpdatePosition = new Vector3(); 119 private Vector3 m_LastChildAgentUpdatePosition = new Vector3();
@@ -611,8 +609,10 @@ namespace OpenSim.Region.Environment.Scenes
611 } 609 }
612 610
613 foreach (EntityBase e in ents) 611 foreach (EntityBase e in ents)
612 {
614 if (e is SceneObjectGroup) 613 if (e is SceneObjectGroup)
615 m_pendingObjects.Enqueue((SceneObjectGroup)e); 614 m_pendingObjects.Enqueue((SceneObjectGroup)e);
615 }
616 } 616 }
617 } 617 }
618 618
@@ -626,7 +626,7 @@ namespace OpenSim.Region.Environment.Scenes
626 // So it's not implemented now. 626 // So it's not implemented now.
627 // 627 //
628 628
629 // Don't even queue if we have seent this one 629 // Don't even queue if we have sent this one
630 // 630 //
631 if (!m_updateTimes.ContainsKey(g.UUID)) 631 if (!m_updateTimes.ContainsKey(g.UUID))
632 g.ScheduleFullUpdateToAvatar(this); 632 g.ScheduleFullUpdateToAvatar(this);
@@ -637,6 +637,8 @@ namespace OpenSim.Region.Environment.Scenes
637 while (m_partsUpdateQueue.Count > 0) 637 while (m_partsUpdateQueue.Count > 0)
638 { 638 {
639 SceneObjectPart part = m_partsUpdateQueue.Dequeue(); 639 SceneObjectPart part = m_partsUpdateQueue.Dequeue();
640 if (part.ParentGroup == null || part.ParentGroup.RootPart == null)
641 continue;
640 if (m_updateTimes.ContainsKey(part.UUID)) 642 if (m_updateTimes.ContainsKey(part.UUID))
641 { 643 {
642 ScenePartUpdate update = m_updateTimes[part.UUID]; 644 ScenePartUpdate update = m_updateTimes[part.UUID];
@@ -680,12 +682,25 @@ namespace OpenSim.Region.Environment.Scenes
680 { 682 {
681 //never been sent to client before so do full update 683 //never been sent to client before so do full update
682 684
683 part.SendFullUpdate(ControllingClient, 685
684 GenerateClientFlags(part.UUID)); 686 // Attachment handling
687 //
688 if (part.ParentGroup.RootPart.Shape.PCode == 9 && part.ParentGroup.RootPart.Shape.State != 0)
689 {
690 if (part != part.ParentGroup.RootPart)
691 continue;
692
693 part.ParentGroup.SendFullUpdateToClient(ControllingClient);
694 continue;
695 }
696
685 ScenePartUpdate update = new ScenePartUpdate(); 697 ScenePartUpdate update = new ScenePartUpdate();
686 update.FullID = part.UUID; 698 update.FullID = part.UUID;
687 update.LastFullUpdateTime = part.TimeStampFull; 699 update.LastFullUpdateTime = part.TimeStampFull;
688 m_updateTimes.Add(part.UUID, update); 700 m_updateTimes.Add(part.UUID, update);
701
702 part.SendFullUpdate(ControllingClient,
703 GenerateClientFlags(part.UUID));
689 updateCount++; 704 updateCount++;
690 } 705 }
691 706
@@ -1115,7 +1130,7 @@ namespace OpenSim.Region.Environment.Scenes
1115// { 1130// {
1116 proxyObjectGroup.SendGroupFullUpdate(); 1131 proxyObjectGroup.SendGroupFullUpdate();
1117 remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false); 1132 remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false);
1118 m_scene.DeleteSceneObject(proxyObjectGroup); 1133 m_scene.DeleteSceneObject(proxyObjectGroup, false);
1119// } 1134// }
1120// else 1135// else
1121// { 1136// {
@@ -2206,9 +2221,9 @@ namespace OpenSim.Region.Environment.Scenes
2206 // now we have a child agent in this region. Request all interesting data about other (root) agents 2221 // now we have a child agent in this region. Request all interesting data about other (root) agents
2207 SendInitialFullUpdateToAllClients(); 2222 SendInitialFullUpdateToAllClients();
2208 2223
2209 CrossAttachmentsIntoNewRegion(neighbourHandle); 2224 CrossAttachmentsIntoNewRegion(neighbourHandle, true);
2210 2225
2211 m_scene.SendKillObject(m_localId); 2226// m_scene.SendKillObject(m_localId);
2212 2227
2213 m_scene.NotifyMyCoarseLocationChange(); 2228 m_scene.NotifyMyCoarseLocationChange();
2214 // the user may change their profile information in other region, 2229 // the user may change their profile information in other region,
@@ -2473,22 +2488,19 @@ namespace OpenSim.Region.Environment.Scenes
2473 { 2488 {
2474 lock (m_attachments) 2489 lock (m_attachments)
2475 { 2490 {
2476 if (!m_attachmentsTransported) 2491 try
2477 { 2492 {
2478 try 2493 foreach (SceneObjectGroup grp in m_attachments)
2479 {
2480 foreach (SceneObjectGroup grp in m_attachments)
2481 {
2482 // ControllingClient may be null at this point!
2483 m_scene.m_innerScene.DetachSingleAttachmentToInv(grp.GetFromAssetID(), ControllingClient);
2484 }
2485 }
2486 catch (InvalidOperationException)
2487 { 2494 {
2488 m_log.Info("[CLIENT]: Couldn't save attachments. :("); 2495 // ControllingClient may be null at this point!
2496 m_scene.m_innerScene.DetachSingleAttachmentToInv(grp.GetFromAssetID(), ControllingClient);
2489 } 2497 }
2490 m_attachments.Clear();
2491 } 2498 }
2499 catch (InvalidOperationException)
2500 {
2501 m_log.Info("[CLIENT]: Couldn't save attachments. :(");
2502 }
2503 m_attachments.Clear();
2492 } 2504 }
2493 lock (m_knownChildRegions) 2505 lock (m_knownChildRegions)
2494 { 2506 {
@@ -2582,9 +2594,8 @@ namespace OpenSim.Region.Environment.Scenes
2582 return true; 2594 return true;
2583 } 2595 }
2584 2596
2585 public bool CrossAttachmentsIntoNewRegion(ulong regionHandle) 2597 public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent)
2586 { 2598 {
2587 m_attachmentsTransported = true;
2588 lock (m_attachments) 2599 lock (m_attachments)
2589 { 2600 {
2590 // Validate 2601 // Validate
@@ -2604,7 +2615,8 @@ namespace OpenSim.Region.Environment.Scenes
2604 gobj.RootPart.IsAttachment = false; 2615 gobj.RootPart.IsAttachment = false;
2605 gobj.AbsolutePosition = gobj.RootPart.AttachedPos; 2616 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
2606 gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 2617 gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
2607 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj); 2618 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle);
2619 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent);
2608 } 2620 }
2609 } 2621 }
2610 m_attachments.Clear(); 2622 m_attachments.Clear();
@@ -3130,6 +3142,9 @@ namespace OpenSim.Region.Environment.Scenes
3130 3142
3131 private void ItemReceived(UUID itemID) 3143 private void ItemReceived(UUID itemID)
3132 { 3144 {
3145 if (IsChildAgent)
3146 return;
3147
3133 if (null == m_appearance) 3148 if (null == m_appearance)
3134 { 3149 {
3135 m_log.Warn("[ATTACHMENT] Appearance has not been initialized"); 3150 m_log.Warn("[ATTACHMENT] Appearance has not been initialized");
@@ -3143,14 +3158,20 @@ namespace OpenSim.Region.Environment.Scenes
3143 UUID asset = m_appearance.GetAttachedAsset(attachpoint); 3158 UUID asset = m_appearance.GetAttachedAsset(attachpoint);
3144 if (UUID.Zero == asset) // We have just logged in 3159 if (UUID.Zero == asset) // We have just logged in
3145 { 3160 {
3146 m_log.InfoFormat("[ATTACHMENT] Rez attachment {0}",
3147 itemID.ToString());
3148
3149 try 3161 try
3150 { 3162 {
3151 // Rez from inventory 3163 // Rez from inventory
3152 m_scene.RezSingleAttachment(ControllingClient, itemID, 3164 asset = m_scene.RezSingleAttachment(ControllingClient,
3153 (uint)attachpoint); 3165 itemID, (uint)attachpoint);
3166 // Corner case: We are not yet a Scene Entity
3167 // Setting attachment info in RezSingleAttachment will fail
3168 // Set it here
3169 //
3170 m_appearance.SetAttachment((int)attachpoint, itemID,
3171 asset);
3172 m_log.InfoFormat("[ATTACHMENT] Rezzed attachment {0}, inworld asset {1}",
3173 itemID.ToString(), asset);
3174
3154 } 3175 }
3155 catch (Exception e) 3176 catch (Exception e)
3156 { 3177 {
@@ -3160,20 +3181,28 @@ namespace OpenSim.Region.Environment.Scenes
3160 return; 3181 return;
3161 } 3182 }
3162 3183
3163 SceneObjectPart att = m_scene.GetSceneObjectPart(m_appearance.GetAttachedAsset(attachpoint)); 3184 SceneObjectPart att = m_scene.GetSceneObjectPart(asset);
3164 3185
3165 3186
3166 // If this is null, then the asset has not yet appeared in world 3187 // If this is null, then the asset has not yet appeared in world
3167 // so we revisit this when it does 3188 // so we revisit this when it does
3168 // 3189 //
3169 if (att != null) 3190 if (att != null && att.UUID != asset) // Yes. It's really needed
3170 { 3191 {
3171 m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", 3192 m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString());
3172 itemID.ToString());
3173 3193
3174 // Attach from world, if not already attached 3194 // This will throw if crossing katty-korner
3175 if (att.ParentGroup != null && !att.IsAttachment) 3195 // So catch it here to avoid the noid
3176 m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, Vector3.Zero); 3196 //
3197 try
3198 {
3199 // Attach from world, if not already attached
3200 if (att.ParentGroup != null && !att.IsAttachment)
3201 m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, Vector3.Zero);
3202 }
3203 catch (System.NullReferenceException e)
3204 {
3205 }
3177 } 3206 }
3178 } 3207 }
3179 } 3208 }
diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
index 9ad4897..910bb28 100644
--- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
+++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Examples.SimpleModule
122 if (m_parts.Count == 1) 122 if (m_parts.Count == 1)
123 { 123 {
124 m_parts.Remove(m_rootPart.UUID); 124 m_parts.Remove(m_rootPart.UUID);
125 m_scene.DeleteSceneObject(this); 125 m_scene.DeleteSceneObject(this, false);
126 remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalId); 126 remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalId);
127 remoteClient.AddMoney(50); 127 remoteClient.AddMoney(50);
128 remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", UUID.Zero, (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully); 128 remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", UUID.Zero, (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully);
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
index 918898c..5ac57c2 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
@@ -198,7 +198,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
198 lastLocalID); 198 lastLocalID);
199 if (part != null && part.ParentGroup != null) 199 if (part != null && part.ParentGroup != null)
200 lastScriptEngine.World.DeleteSceneObject( 200 lastScriptEngine.World.DeleteSceneObject(
201 part.ParentGroup); 201 part.ParentGroup, false);
202 } 202 }
203 catch (Exception e) 203 catch (Exception e)
204 { 204 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 9d07de2..98d7bbe 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -641,7 +641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
641 { 641 {
642 m_InSelfDelete = true; 642 m_InSelfDelete = true;
643 if (part != null && part.ParentGroup != null) 643 if (part != null && part.ParentGroup != null)
644 m_Engine.World.DeleteSceneObject(part.ParentGroup); 644 m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
645 } 645 }
646 } 646 }
647 } 647 }