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