From 41440e184b1c12f1b83d894b2cd5b7b801b4ca38 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Tue, 19 Aug 2008 18:34:46 +0000
Subject: Attachment persistence (Mantis #1711) Change user server to handle
 attachment assets record properly. Ensure that attachments are not re-rezzed
 on region crossing. Persistence will NOT WORK with earliser UGAI!! Change
 region server to match.

---
 OpenSim/Region/Environment/Scenes/ScenePresence.cs | 29 ++++++++++++++--------
 1 file changed, 19 insertions(+), 10 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 706fd61..4bc5d34 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -2880,24 +2880,33 @@ namespace OpenSim.Region.Environment.Scenes
             if (attachpoint == 0)
                 return;
 
+            LLUUID asset = m_appearance.GetAttachedAsset(attachpoint);
+            if (asset == LLUUID.Zero) // We have just logged in
+            {
+                m_log.InfoFormat("[ATTACHMENT] Rez attachment {0}",
+                        itemID.ToString());
+
+                // Rez from inventory
+                m_scene.RezSingleAttachment(ControllingClient, itemID,
+                        (uint)attachpoint, 0, 0);
+                return;
+            }
+
             SceneObjectPart att = m_scene.GetSceneObjectPart(m_appearance.GetAttachedAsset(attachpoint));
 
 
-            // If this is null, then we have just rezzed in. Non null means
-            // we're crossing
+            // If this is null, then the asset has not yet appeared in world
+            // so we revisit this when it does
             //
             if (att != null)
             {
-                System.Console.WriteLine("Attach from world {0}", itemID.ToString());
+                m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}",
+                        itemID.ToString());
+
                 // Attach from world
                 if (att.ParentGroup != null)
-                    m_scene.RezSingleAttachment(att.ParentGroup, ControllingClient, itemID, (uint)attachpoint, 0, 0);
-            }
-            else
-            {
-                System.Console.WriteLine("Rez attachment {0}", itemID.ToString());
-                // Rez from inventory
-                m_scene.RezSingleAttachment(ControllingClient, itemID, (uint)attachpoint, 0, 0);
+                    m_scene.RezSingleAttachment(att.ParentGroup,
+                            ControllingClient, itemID, (uint)attachpoint, 0, 0);
             }
         }
     }
-- 
cgit v1.1