aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMic Bowman2011-01-25 14:23:58 -0800
committerMic Bowman2011-01-25 14:23:58 -0800
commitc4727645b864a92fc489427c516ccab3a21c2d91 (patch)
tree007117969b7defbb881a407aeb9a459c8bd40e07 /OpenSim
parentFix script data not being reset as it should be (diff)
downloadopensim-SC_OLD-c4727645b864a92fc489427c516ccab3a21c2d91.zip
opensim-SC_OLD-c4727645b864a92fc489427c516ccab3a21c2d91.tar.gz
opensim-SC_OLD-c4727645b864a92fc489427c516ccab3a21c2d91.tar.bz2
opensim-SC_OLD-c4727645b864a92fc489427c516ccab3a21c2d91.tar.xz
Removed a few more spurious appearance saves. When an avatar
enters a region the attachments module tries to update the appearance with attachments that are already part of the appearance. Just added a check to only save if the attachments weren't there before.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs23
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs4
3 files changed, 31 insertions, 18 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 18a5733..5a6b265 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -427,19 +427,30 @@ namespace OpenSim.Framework
427 /// 0x80 bit set then we assume this is an append 427 /// 0x80 bit set then we assume this is an append
428 /// operation otherwise we replace whatever is 428 /// operation otherwise we replace whatever is
429 /// currently attached at the attachpoint 429 /// currently attached at the attachpoint
430 /// return true if something actually changed
430 /// </summary> 431 /// </summary>
431 public void SetAttachment(int attachpoint, UUID item, UUID asset) 432 public bool SetAttachment(int attachpoint, UUID item, UUID asset)
432 { 433 {
433 if (attachpoint == 0) 434 if (attachpoint == 0)
434 return; 435 return false;
435 436
436 if (item == UUID.Zero) 437 if (item == UUID.Zero)
437 { 438 {
438 if (m_attachments.ContainsKey(attachpoint)) 439 if (m_attachments.ContainsKey(attachpoint))
440 {
439 m_attachments.Remove(attachpoint); 441 m_attachments.Remove(attachpoint);
440 return; 442 return true;
443 }
444 return false;
441 } 445 }
442 446
447 // check if the item is already attached at this point
448 if (GetAttachpoint(item) == (attachpoint & 0x7F))
449 {
450 // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item);
451 return false;
452 }
453
443 // check if this is an append or a replace, 0x80 marks it as an append 454 // check if this is an append or a replace, 0x80 marks it as an append
444 if ((attachpoint & 0x80) > 0) 455 if ((attachpoint & 0x80) > 0)
445 { 456 {
@@ -451,6 +462,7 @@ namespace OpenSim.Framework
451 { 462 {
452 ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); 463 ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset));
453 } 464 }
465 return true;
454 } 466 }
455 467
456 public int GetAttachpoint(UUID itemID) 468 public int GetAttachpoint(UUID itemID)
@@ -465,7 +477,7 @@ namespace OpenSim.Framework
465 return 0; 477 return 0;
466 } 478 }
467 479
468 public void DetachAttachment(UUID itemID) 480 public bool DetachAttachment(UUID itemID)
469 { 481 {
470 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) 482 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
471 { 483 {
@@ -478,9 +490,10 @@ namespace OpenSim.Framework
478 // And remove the list if there are no more attachments here 490 // And remove the list if there are no more attachments here
479 if (m_attachments[kvp.Key].Count == 0) 491 if (m_attachments[kvp.Key].Count == 0)
480 m_attachments.Remove(kvp.Key); 492 m_attachments.Remove(kvp.Key);
481 return; 493 return true;
482 } 494 }
483 } 495 }
496 return false;
484 } 497 }
485 498
486 public void ClearAttachments() 499 public void ClearAttachments()
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 360a014..ff26264 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -132,8 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
132 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId 132 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
133 + ", AttachmentPoint: " + AttachmentPt); 133 + ", AttachmentPoint: " + AttachmentPt);
134 134
135 if (m_scene.AvatarFactory != null)
136 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
137 } 135 }
138 } 136 }
139 catch (Exception e) 137 catch (Exception e)
@@ -336,7 +334,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
336 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 334 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
337 item = m_scene.InventoryService.GetItem(item); 335 item = m_scene.InventoryService.GetItem(item);
338 336
339 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 337 bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
338 if (changed && m_scene.AvatarFactory != null)
339 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
340 } 340 }
341 341
342 return att.UUID; 342 return att.UUID;
@@ -380,9 +380,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
380 // XXYY!! 380 // XXYY!!
381 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 381 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
382 item = m_scene.InventoryService.GetItem(item); 382 item = m_scene.InventoryService.GetItem(item);
383 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); 383 bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
384 384 if (changed && m_scene.AvatarFactory != null)
385 if (m_scene.AvatarFactory != null)
386 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 385 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
387 } 386 }
388 } 387 }
@@ -402,11 +401,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
402 ScenePresence presence; 401 ScenePresence presence;
403 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 402 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
404 { 403 {
405 presence.Appearance.DetachAttachment(itemID);
406
407 // Save avatar attachment information 404 // Save avatar attachment information
408 m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); 405 m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
409 if (m_scene.AvatarFactory != null) 406
407 bool changed = presence.Appearance.DetachAttachment(itemID);
408 if (changed && m_scene.AvatarFactory != null)
410 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 409 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
411 } 410 }
412 411
@@ -431,9 +430,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
431 part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) 430 part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
432 return; 431 return;
433 432
434 presence.Appearance.DetachAttachment(itemID); 433 bool changed = presence.Appearance.DetachAttachment(itemID);
435 434 if (changed && m_scene.AvatarFactory != null)
436 if (m_scene.AvatarFactory != null)
437 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 435 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
438 436
439 part.ParentGroup.DetachToGround(); 437 part.ParentGroup.DetachToGround();
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index ed0a290..f8ce444 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -217,7 +217,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
217 // update transaction. In theory, we should be able to do an immediate 217 // update transaction. In theory, we should be able to do an immediate
218 // appearance send and save here. 218 // appearance send and save here.
219 219
220 QueueAppearanceSave(client.AgentId); 220 // save only if there were changes, send no matter what (doesn't hurt to send twice)
221 if (changed)
222 QueueAppearanceSave(client.AgentId);
221 QueueAppearanceSend(client.AgentId); 223 QueueAppearanceSend(client.AgentId);
222 } 224 }
223 225