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.cs43
1 files changed, 33 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index b7fcd7d..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,7 +548,7 @@ 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
@@ -544,8 +559,16 @@ namespace OpenSim.Region.Framework.Scenes
544 // Do this last so that event listeners have access to all the effects of the attachment 559 // Do this last so that event listeners have access to all the effects of the attachment
545 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); 560 m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
546 } 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
547 return objatt; 569 return objatt;
548 } 570 }
571
549 return null; 572 return null;
550 } 573 }
551 574