aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs46
1 files changed, 36 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 928dc97..cac768e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -253,7 +253,7 @@ namespace OpenSim.Region.Framework.Scenes
253 sceneObject.HasGroupChanged = true; 253 sceneObject.HasGroupChanged = true;
254 } 254 }
255 255
256 return AddSceneObject(sceneObject, attachToBackup); 256 return AddSceneObject(sceneObject, attachToBackup, true);
257 } 257 }
258 258
259 /// <summary> 259 /// <summary>
@@ -268,12 +268,12 @@ namespace OpenSim.Region.Framework.Scenes
268 /// <returns> 268 /// <returns>
269 /// true if the object was added, false if an object with the same uuid was already in the scene 269 /// true if the object was added, false if an object with the same uuid was already in the scene
270 /// </returns> 270 /// </returns>
271 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 271 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
272 { 272 {
273 // Ensure that we persist this new scene object 273 // Ensure that we persist this new scene object
274 sceneObject.HasGroupChanged = true; 274 sceneObject.HasGroupChanged = true;
275 275
276 return AddSceneObject(sceneObject, attachToBackup); 276 return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
277 } 277 }
278 278
279 /// <summary> 279 /// <summary>
@@ -285,12 +285,19 @@ namespace OpenSim.Region.Framework.Scenes
285 /// If true, the object is made persistent into the scene. 285 /// If true, the object is made persistent into the scene.
286 /// If false, the object will not persist over server restarts 286 /// If false, the object will not persist over server restarts
287 /// </param> 287 /// </param>
288 /// <returns>true if the object was added, false if an object with the same uuid was already in the scene 288 /// <param name="sendClientUpdates">
289 /// If true, updates for the new scene object are sent to all viewers in range.
290 /// If false, it is left to the caller to schedule the update
291 /// </param>
292 /// <returns>
293 /// true if the object was added, false if an object with the same uuid was already in the scene
289 /// </returns> 294 /// </returns>
290 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 295 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
291 { 296 {
292 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) 297 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
293 return false; 298 return false;
299
300 bool alreadyExisted = false;
294 301
295 if (m_parentScene.m_clampPrimSize) 302 if (m_parentScene.m_clampPrimSize)
296 { 303 {
@@ -311,6 +318,9 @@ namespace OpenSim.Region.Framework.Scenes
311 318
312 sceneObject.AttachToScene(m_parentScene); 319 sceneObject.AttachToScene(m_parentScene);
313 320
321 if (sendClientUpdates)
322 sceneObject.ScheduleGroupForFullUpdate();
323
314 lock (sceneObject) 324 lock (sceneObject)
315 { 325 {
316 if (!Entities.ContainsKey(sceneObject.UUID)) 326 if (!Entities.ContainsKey(sceneObject.UUID))
@@ -334,12 +344,14 @@ namespace OpenSim.Region.Framework.Scenes
334 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 344 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
335 } 345 }
336 } 346 }
337 347 }
338 return true; 348 else
349 {
350 alreadyExisted = true;
339 } 351 }
340 } 352 }
341 353
342 return false; 354 return alreadyExisted;
343 } 355 }
344 356
345 /// <summary> 357 /// <summary>
@@ -549,7 +561,10 @@ namespace OpenSim.Region.Framework.Scenes
549 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, 561 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
550 false, false, remoteClient.AgentId, true); 562 false, false, remoteClient.AgentId, true);
551 563
552 564// m_log.DebugFormat(
565// "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}",
566// objatt.Name, remoteClient.Name, AttachmentPt);
567
553 if (objatt != null) 568 if (objatt != null)
554 { 569 {
555 bool tainted = false; 570 bool tainted = false;
@@ -557,16 +572,27 @@ namespace OpenSim.Region.Framework.Scenes
557 tainted = true; 572 tainted = true;
558 573
559 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); 574 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
560 objatt.ScheduleGroupForFullUpdate(); 575 //objatt.ScheduleGroupForFullUpdate();
561 if (tainted) 576 if (tainted)
562 objatt.HasGroupChanged = true; 577 objatt.HasGroupChanged = true;
563 578
564 // Fire after attach, so we don't get messy perms dialogs 579 // Fire after attach, so we don't get messy perms dialogs
565 // 3 == AttachedRez 580 // 3 == AttachedRez
566 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); 581 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
582
583 // Do this last so that event listeners have access to all the effects of the attachment
584 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
567 } 585 }
586 else
587 {
588 m_log.WarnFormat(
589 "[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
590 itemID, remoteClient.Name, AttachmentPt);
591 }
592
568 return objatt; 593 return objatt;
569 } 594 }
595
570 return null; 596 return null;
571 } 597 }
572 598