aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorDiva Canto2011-04-28 20:19:54 -0700
committerDiva Canto2011-04-28 20:19:54 -0700
commit9892e115ccdcc8567087041917fb5c7694aa8836 (patch)
tree096a7474e5f081067f5b08b7acb1ba8d8cffc494 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentOne less [Serializable] -- ClientInfo. (diff)
downloadopensim-SC-9892e115ccdcc8567087041917fb5c7694aa8836.zip
opensim-SC-9892e115ccdcc8567087041917fb5c7694aa8836.tar.gz
opensim-SC-9892e115ccdcc8567087041917fb5c7694aa8836.tar.bz2
opensim-SC-9892e115ccdcc8567087041917fb5c7694aa8836.tar.xz
Fatpack message on agent transfers: 1 message only (UpdateAgent) containing the agent and all attachments. Preserves backwards compatibility -- older sims get passed attachments one by one. Meaning that I finally introduced versioning in the simulation service.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs124
1 files changed, 27 insertions, 97 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e4413a9..507fc50 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3078,54 +3078,6 @@ namespace OpenSim.Region.Framework.Scenes
3078 3078
3079 cAgent.Appearance = new AvatarAppearance(m_appearance); 3079 cAgent.Appearance = new AvatarAppearance(m_appearance);
3080 3080
3081/*
3082 try
3083 {
3084 // We might not pass the Wearables in all cases...
3085 // They're only needed so that persistent changes to the appearance
3086 // are preserved in the new region where the user is moving to.
3087 // But in Hypergrid we might not let this happen.
3088 int i = 0;
3089 UUID[] wears = new UUID[m_appearance.Wearables.Length * 2];
3090 foreach (AvatarWearable aw in m_appearance.Wearables)
3091 {
3092 if (aw != null)
3093 {
3094 wears[i++] = aw.ItemID;
3095 wears[i++] = aw.AssetID;
3096 }
3097 else
3098 {
3099 wears[i++] = UUID.Zero;
3100 wears[i++] = UUID.Zero;
3101 }
3102 }
3103 cAgent.Wearables = wears;
3104
3105 cAgent.VisualParams = m_appearance.VisualParams;
3106
3107 if (m_appearance.Texture != null)
3108 cAgent.AgentTextures = m_appearance.Texture.GetBytes();
3109 }
3110 catch (Exception e)
3111 {
3112 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
3113 }
3114
3115 //Attachments
3116 List<int> attPoints = m_appearance.GetAttachedPoints();
3117 if (attPoints != null)
3118 {
3119 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3120 int i = 0;
3121 AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
3122 foreach (int point in attPoints)
3123 {
3124 attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3125 }
3126 cAgent.Attachments = attachs;
3127 }
3128*/
3129 lock (scriptedcontrols) 3081 lock (scriptedcontrols)
3130 { 3082 {
3131 ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; 3083 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3145,9 +3097,21 @@ namespace OpenSim.Region.Framework.Scenes
3145 } 3097 }
3146 catch { } 3098 catch { }
3147 3099
3148 // cAgent.GroupID = ?? 3100 // Attachment objects
3149 // Groups??? 3101 if (m_attachments != null && m_attachments.Count > 0)
3150 3102 {
3103 cAgent.AttachmentObjects = new List<ISceneObject>();
3104 cAgent.AttachmentObjectStates = new List<string>();
3105 IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3106 foreach (SceneObjectGroup sog in m_attachments)
3107 {
3108 // We need to make a copy and pass that copy
3109 // because of transfers withn the same sim
3110 ISceneObject clone = sog.CloneForNewScene();
3111 cAgent.AttachmentObjects.Add(clone);
3112 cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
3113 }
3114 }
3151 } 3115 }
3152 3116
3153 public void CopyFrom(AgentData cAgent) 3117 public void CopyFrom(AgentData cAgent)
@@ -3188,50 +3152,6 @@ namespace OpenSim.Region.Framework.Scenes
3188 AddToPhysicalScene(isFlying); 3152 AddToPhysicalScene(isFlying);
3189 } 3153 }
3190 3154
3191/*
3192 uint i = 0;
3193 try
3194 {
3195 if (cAgent.Wearables == null)
3196 cAgent.Wearables = new UUID[0];
3197 AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
3198 for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
3199 {
3200 UUID itemId = cAgent.Wearables[n];
3201 UUID assetId = cAgent.Wearables[n + 1];
3202 wears[i++] = new AvatarWearable(itemId, assetId);
3203 }
3204 // m_appearance.Wearables = wears;
3205 Primitive.TextureEntry textures = null;
3206 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
3207 textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
3208
3209 byte[] visuals = null;
3210
3211 if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
3212 visuals = (byte[])cAgent.VisualParams.Clone();
3213
3214 m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
3215 }
3216 catch (Exception e)
3217 {
3218 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
3219 }
3220
3221 // Attachments
3222 try
3223 {
3224 if (cAgent.Attachments != null)
3225 {
3226 m_appearance.ClearAttachments();
3227 foreach (AvatarAttachment att in cAgent.Attachments)
3228 {
3229 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3230 }
3231 }
3232 }
3233 catch { }
3234*/
3235 try 3155 try
3236 { 3156 {
3237 lock (scriptedcontrols) 3157 lock (scriptedcontrols)
@@ -3261,8 +3181,18 @@ namespace OpenSim.Region.Framework.Scenes
3261 } 3181 }
3262 catch { } 3182 catch { }
3263 3183
3264 //cAgent.GroupID = ?? 3184 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3265 //Groups??? 3185 {
3186 m_attachments = new List<SceneObjectGroup>();
3187 int i = 0;
3188 foreach (ISceneObject so in cAgent.AttachmentObjects)
3189 {
3190 ((SceneObjectGroup)so).LocalId = 0;
3191 ((SceneObjectGroup)so).RootPart.UpdateFlag = 0;
3192 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
3193 m_scene.IncomingCreateObject(so);
3194 }
3195 }
3266 } 3196 }
3267 3197
3268 public bool CopyAgent(out IAgentData agent) 3198 public bool CopyAgent(out IAgentData agent)