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.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 321cc45..d31b45e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -228,7 +228,7 @@ namespace OpenSim.Region.Framework.Scenes
228 sceneObject.HasGroupChanged = true; 228 sceneObject.HasGroupChanged = true;
229 } 229 }
230 230
231 return AddSceneObject(sceneObject, attachToBackup); 231 return AddSceneObject(sceneObject, attachToBackup, true);
232 } 232 }
233 233
234 /// <summary> 234 /// <summary>
@@ -243,12 +243,12 @@ namespace OpenSim.Region.Framework.Scenes
243 /// <returns> 243 /// <returns>
244 /// true if the object was added, false if an object with the same uuid was already in the scene 244 /// true if the object was added, false if an object with the same uuid was already in the scene
245 /// </returns> 245 /// </returns>
246 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 246 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
247 { 247 {
248 // Ensure that we persist this new scene object 248 // Ensure that we persist this new scene object
249 sceneObject.HasGroupChanged = true; 249 sceneObject.HasGroupChanged = true;
250 250
251 return AddSceneObject(sceneObject, attachToBackup); 251 return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
252 } 252 }
253 253
254 /// <summary> 254 /// <summary>
@@ -260,12 +260,19 @@ namespace OpenSim.Region.Framework.Scenes
260 /// If true, the object is made persistent into the scene. 260 /// If true, the object is made persistent into the scene.
261 /// If false, the object will not persist over server restarts 261 /// If false, the object will not persist over server restarts
262 /// </param> 262 /// </param>
263 /// <returns>true if the object was added, false if an object with the same uuid was already in the scene 263 /// <param name="sendClientUpdates">
264 /// If true, updates for the new scene object are sent to all viewers in range.
265 /// If false, it is left to the caller to schedule the update
266 /// </param>
267 /// <returns>
268 /// true if the object was added, false if an object with the same uuid was already in the scene
264 /// </returns> 269 /// </returns>
265 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 270 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
266 { 271 {
267 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) 272 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
268 return false; 273 return false;
274
275 bool alreadyExisted = false;
269 276
270 if (m_parentScene.m_clampPrimSize) 277 if (m_parentScene.m_clampPrimSize)
271 { 278 {
@@ -286,6 +293,9 @@ namespace OpenSim.Region.Framework.Scenes
286 293
287 sceneObject.AttachToScene(m_parentScene); 294 sceneObject.AttachToScene(m_parentScene);
288 295
296 if (sendClientUpdates)
297 sceneObject.ScheduleGroupForFullUpdate();
298
289 lock (sceneObject) 299 lock (sceneObject)
290 { 300 {
291 if (!Entities.ContainsKey(sceneObject.UUID)) 301 if (!Entities.ContainsKey(sceneObject.UUID))
@@ -309,12 +319,14 @@ namespace OpenSim.Region.Framework.Scenes
309 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 319 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
310 } 320 }
311 } 321 }
312 322 }
313 return true; 323 else
324 {
325 alreadyExisted = true;
314 } 326 }
315 } 327 }
316 328
317 return false; 329 return alreadyExisted;
318 } 330 }
319 331
320 /// <summary> 332 /// <summary>
@@ -521,26 +533,34 @@ namespace OpenSim.Region.Framework.Scenes
521 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, 533 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
522 false, false, remoteClient.AgentId, true); 534 false, false, remoteClient.AgentId, true);
523 535
536// m_log.DebugFormat(
537// "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}",
538// objatt.Name, remoteClient.Name, AttachmentPt);
539
524 if (objatt != null) 540 if (objatt != null)
525 { 541 {
526 bool tainted = false; 542 bool tainted = false;
527 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) 543 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
528 tainted = true; 544 tainted = true;
529 545
530 if (AttachObject( 546 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
531 remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false)) 547 //objatt.ScheduleGroupForFullUpdate();
532 {
533 objatt.ScheduleGroupForFullUpdate();
534 if (tainted)
535 objatt.HasGroupChanged = true;
536
537 // Fire after attach, so we don't get messy perms dialogs
538 // 3 == AttachedRez
539 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
540 548
541 // Do this last so that event listeners have access to all the effects of the attachment 549 if (tainted)
542 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); 550 objatt.HasGroupChanged = true;
543 } 551
552 // Fire after attach, so we don't get messy perms dialogs
553 // 3 == AttachedRez
554 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
555
556 // Do this last so that event listeners have access to all the effects of the attachment
557 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
558 }
559 else
560 {
561 m_log.WarnFormat(
562 "[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
563 itemID, remoteClient.Name, AttachmentPt);
544 } 564 }
545 565
546 return objatt; 566 return objatt;