aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs23
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs93
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs46
4 files changed, 111 insertions, 55 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 2906af8..aaf441c 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -238,11 +238,27 @@ namespace OpenSim.Framework
238// } 238// }
239 } 239 }
240 240
241 /// <summary>
242 /// Invalidate all of the baked textures in the appearance, useful
243 /// if you know that none are valid
244 /// </summary>
245 public virtual void ResetBakedTextures()
246 {
247 SetDefaultTexture();
248
249 //for (int i = 0; i < BAKE_INDICES.Length; i++)
250 // {
251 // int idx = BAKE_INDICES[i];
252 // m_texture.FaceTextures[idx].TextureID = UUID.Zero;
253 // }
254 }
255
241 protected virtual void SetDefaultTexture() 256 protected virtual void SetDefaultTexture()
242 { 257 {
243 m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); 258 m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
244 for (uint i = 0; i < TEXTURE_COUNT; i++) 259
245 m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE); 260 // for (uint i = 0; i < TEXTURE_COUNT; i++)
261 // m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
246 } 262 }
247 263
248 /// <summary> 264 /// <summary>
@@ -274,9 +290,6 @@ namespace OpenSim.Framework
274 } 290 }
275 291
276 changed = true; 292 changed = true;
277
278// if (newface != null)
279// m_log.WarnFormat("[AVATAR APPEARANCE]: index {0}, new texture id {1}",i,newface.TextureID);
280 } 293 }
281 294
282 m_texture = textureEntry; 295 m_texture = textureEntry;
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index e7f2e13..b7f9a05 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -990,6 +990,7 @@ namespace OpenSim.Framework.Capabilities
990 public void BakedTextureUploaded(UUID assetID, byte[] data) 990 public void BakedTextureUploaded(UUID assetID, byte[] data)
991 { 991 {
992// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); 992// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
993
993 AssetBase asset; 994 AssetBase asset;
994 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); 995 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
995 asset.Data = data; 996 asset.Data = data;
@@ -1331,6 +1332,7 @@ namespace OpenSim.Framework.Capabilities
1331 newAssetID = UUID.Random(); 1332 newAssetID = UUID.Random();
1332 uploaderPath = path; 1333 uploaderPath = path;
1333 httpListener = httpServer; 1334 httpListener = httpServer;
1335 // m_log.WarnFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
1334 } 1336 }
1335 1337
1336 /// <summary> 1338 /// <summary>
@@ -1342,6 +1344,8 @@ namespace OpenSim.Framework.Capabilities
1342 /// <returns></returns> 1344 /// <returns></returns>
1343 public string uploaderCaps(byte[] data, string path, string param) 1345 public string uploaderCaps(byte[] data, string path, string param)
1344 { 1346 {
1347 m_log.WarnFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
1348
1345 string res = String.Empty; 1349 string res = String.Empty;
1346 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 1350 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
1347 uploadComplete.new_asset = newAssetID.ToString(); 1351 uploadComplete.new_asset = newAssetID.ToString();
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index ab1c206..63e7ddc 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -115,8 +115,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
115 115
116 #endregion 116 #endregion
117 117
118
118 public bool ValidateBakedTextureCache(IClientAPI client) 119 public bool ValidateBakedTextureCache(IClientAPI client)
119 { 120 {
121 return ValidateBakedTextureCache(client, true);
122 }
123
124 private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly)
125 {
120 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 126 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
121 if (sp == null) 127 if (sp == null)
122 { 128 {
@@ -131,15 +137,33 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
131 { 137 {
132 int idx = AvatarAppearance.BAKE_INDICES[i]; 138 int idx = AvatarAppearance.BAKE_INDICES[i];
133 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; 139 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
134 if (face == null || face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) 140
141 // if there is no texture entry, skip it
142 if (face == null)
135 continue; 143 continue;
136 144
145 // if the texture is one of the "defaults" then skip it
146 // this should probably be more intelligent (skirt texture doesnt matter
147 // if the avatar isnt wearing a skirt) but if any of the main baked
148 // textures is default then the rest should be as well
149 if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
150 continue;
151
137 defonly = false; // found a non-default texture reference 152 defonly = false; // found a non-default texture reference
138 153
139 if (! CheckBakedTextureAsset(client,face.TextureID,idx)) 154 if (! CheckBakedTextureAsset(client,face.TextureID,idx))
140 return false; 155 {
156 // the asset didn't exist if we are only checking, then we found a bad
157 // one and we're done otherwise, ask for a rebake
158 if (checkonly) return false;
159
160 m_log.WarnFormat("[AVFACTORY] missing baked texture {0}, request rebake",face.TextureID);
161 client.SendRebakeAvatarTextures(face.TextureID);
162 }
141 } 163 }
142 164
165 m_log.WarnFormat("[AVFACTORY]: complete texture check for {0}",client.AgentId);
166
143 // If we only found default textures, then the appearance is not cached 167 // If we only found default textures, then the appearance is not cached
144 return (defonly ? false : true); 168 return (defonly ? false : true);
145 } 169 }
@@ -158,7 +182,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
158 return; 182 return;
159 } 183 }
160 184
161 // m_log.WarnFormat("[AVFACTORY]: Start SetAppearance for {0}",client.AgentId); 185 m_log.WarnFormat("[AVFACTORY]: start SetAppearance for {0}",client.AgentId);
162 186
163 bool changed = false; 187 bool changed = false;
164 188
@@ -166,47 +190,40 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
166 // going to be handled correctly but it does serialize the updates to the appearance 190 // going to be handled correctly but it does serialize the updates to the appearance
167 lock (m_setAppearanceLock) 191 lock (m_setAppearanceLock)
168 { 192 {
193 // Process the visual params, this may change height as well
194 if (visualParams != null)
195 {
196 changed = sp.Appearance.SetVisualParams(visualParams);
197 if (sp.Appearance.AvatarHeight > 0)
198 sp.SetHeight(sp.Appearance.AvatarHeight);
199 }
200
201 // Process the baked texture array
169 if (textureEntry != null) 202 if (textureEntry != null)
170 { 203 {
171 changed = sp.Appearance.SetTextureEntries(textureEntry); 204 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
172 205
173 // m_log.WarnFormat("[AVFACTORY]: Prepare to check textures for {0}",client.AgentId); 206 m_log.WarnFormat("[AVFACTORY]: received texture update for {0}",client.AgentId);
207 Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); });
174 208
175 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 209 // This appears to be set only in the final stage of the appearance
176 { 210 // update transaction. In theory, we should be able to do an immediate
177 int idx = AvatarAppearance.BAKE_INDICES[i]; 211 // appearance send and save here.
178 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
179 if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
180 Util.FireAndForget(delegate(object o) {
181 if (! CheckBakedTextureAsset(client,face.TextureID,idx))
182 client.SendRebakeAvatarTextures(face.TextureID);
183 });
184 }
185 212
186 m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId); 213 QueueAppearanceSave(client.AgentId);
214 QueueAppearanceSend(client.AgentId);
187 } 215 }
188 216
189 // Process the visual params, this may change height as well
190 if (visualParams != null)
191 {
192 if (sp.Appearance.SetVisualParams(visualParams))
193 {
194 changed = true;
195 if (sp.Appearance.AvatarHeight > 0)
196 sp.SetHeight(sp.Appearance.AvatarHeight);
197 }
198 }
199 } 217 }
200
201 218
202 // If something changed in the appearance then queue an appearance save 219// // If something changed in the appearance then queue an appearance save
203 if (changed) 220// if (changed)
204 QueueAppearanceSave(client.AgentId); 221// QueueAppearanceSave(client.AgentId);
205 222
206 // And always queue up an appearance update to send out 223// // And always queue up an appearance update to send out
207 QueueAppearanceSend(client.AgentId); 224// QueueAppearanceSend(client.AgentId);
208 225
209 // m_log.WarnFormat("[AVFACTORY]: Complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); 226 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
210 } 227 }
211 228
212 /// <summary> 229 /// <summary>
@@ -229,6 +246,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
229 246
230 #region UpdateAppearanceTimer 247 #region UpdateAppearanceTimer
231 248
249 /// <summary>
250 /// Queue up a request to send appearance, makes it possible to
251 /// accumulate changes without sending out each one separately.
252 /// </summary>
232 public void QueueAppearanceSend(UUID agentid) 253 public void QueueAppearanceSend(UUID agentid)
233 { 254 {
234 // m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); 255 // m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
@@ -268,6 +289,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
268 289
269 // Send the appearance to everyone in the scene 290 // Send the appearance to everyone in the scene
270 sp.SendAppearanceToAllOtherAgents(); 291 sp.SendAppearanceToAllOtherAgents();
292
293 // Send animations back to the avatar as well
294 sp.Animator.SendAnimPack();
271 } 295 }
272 296
273 private void HandleAppearanceSave(UUID agentid) 297 private void HandleAppearanceSave(UUID agentid)
@@ -355,7 +379,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
355 379
356 // operate on a copy of the appearance so we don't have to lock anything 380 // operate on a copy of the appearance so we don't have to lock anything
357 AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false); 381 AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
358 382 sp.Appearance.ResetBakedTextures(); // this makes sure we don't reuse old textures if the baking takes time
383
359 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 384 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
360 { 385 {
361 if (wear.Type < AvatarWearable.MAX_WEARABLES) 386 if (wear.Type < AvatarWearable.MAX_WEARABLES)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 24c809b..5a842d8 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2773,30 +2773,44 @@ namespace OpenSim.Region.Framework.Scenes
2773 // the inventory arrives 2773 // the inventory arrives
2774 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 2774 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
2775 2775
2776 // This agent just became root. We are going to tell everyone about it. The process of 2776 bool cachedappearance = false;
2777 // getting other avatars information was initiated in the constructor... don't do it
2778 // again here...
2779 SendAvatarDataToAllAgents();
2780 2777
2781 // We have an appearance but we may not have the baked textures. Check the asset cache 2778 // We have an appearance but we may not have the baked textures. Check the asset cache
2782 // to see if all the baked textures are already here. 2779 // to see if all the baked textures are already here.
2783 if (m_scene.AvatarFactory != null) 2780 if (m_scene.AvatarFactory != null)
2784 { 2781 {
2785 if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) 2782 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient);
2786 {
2787// m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
2788 SendAppearanceToAgent(this);
2789
2790 // If the avatars baked textures are all in the cache, then we have a
2791 // complete appearance... send it out, if not, then we'll send it when
2792 // the avatar finishes updating its appearance
2793 SendAppearanceToAllOtherAgents();
2794 }
2795 } 2783 }
2796 else 2784 else
2797 { 2785 {
2798 m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); 2786 m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
2799 } 2787 }
2788
2789 // If we aren't using a cached appearance, then clear out the baked textures
2790 if (! cachedappearance)
2791 {
2792 m_appearance.ResetBakedTextures();
2793 if (m_scene.AvatarFactory != null)
2794 m_scene.AvatarFactory.QueueAppearanceSave(UUID);
2795 }
2796
2797 // This agent just became root. We are going to tell everyone about it. The process of
2798 // getting other avatars information was initiated in the constructor... don't do it
2799 // again here... this comes after the cached appearance check because the avatars
2800 // appearance goes into the avatar update packet
2801 SendAvatarDataToAllAgents();
2802
2803 // If we are using the the cached appearance then send it out to everyone
2804 if (cachedappearance)
2805 {
2806 m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
2807 SendAppearanceToAgent(this);
2808
2809 // If the avatars baked textures are all in the cache, then we have a
2810 // complete appearance... send it out, if not, then we'll send it when
2811 // the avatar finishes updating its appearance
2812 SendAppearanceToAllOtherAgents();
2813 }
2800 } 2814 }
2801 2815
2802 /// <summary> 2816 /// <summary>
@@ -2856,7 +2870,7 @@ namespace OpenSim.Region.Framework.Scenes
2856 /// Send avatar data to an agent. 2870 /// Send avatar data to an agent.
2857 /// </summary> 2871 /// </summary>
2858 /// <param name="avatar"></param> 2872 /// <param name="avatar"></param>
2859 private void SendAvatarDataToAgent(ScenePresence avatar) 2873 public void SendAvatarDataToAgent(ScenePresence avatar)
2860 { 2874 {
2861// m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); 2875// m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
2862 2876
@@ -2924,7 +2938,7 @@ namespace OpenSim.Region.Framework.Scenes
2924 /// Send appearance data to an agent. 2938 /// Send appearance data to an agent.
2925 /// </summary> 2939 /// </summary>
2926 /// <param name="avatar"></param> 2940 /// <param name="avatar"></param>
2927 private void SendAppearanceToAgent(ScenePresence avatar) 2941 public void SendAppearanceToAgent(ScenePresence avatar)
2928 { 2942 {
2929// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); 2943// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
2930 2944