diff options
author | Mic Bowman | 2010-11-29 16:24:16 -0800 |
---|---|---|
committer | Melanie | 2010-11-30 16:20:43 +0100 |
commit | ab2adaf3418e5a64c7d94305d45489310eaa2ab0 (patch) | |
tree | 7f80d7795fdc6c4dfb0911ed87af8d8d0131b275 /OpenSim/Region/CoreModules/Avatar | |
parent | Prevent the restart module from barfing if it's not configured (diff) | |
download | opensim-SC-ab2adaf3418e5a64c7d94305d45489310eaa2ab0.zip opensim-SC-ab2adaf3418e5a64c7d94305d45489310eaa2ab0.tar.gz opensim-SC-ab2adaf3418e5a64c7d94305d45489310eaa2ab0.tar.bz2 opensim-SC-ab2adaf3418e5a64c7d94305d45489310eaa2ab0.tar.xz |
Various bug fixes for appearance handling
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 93 |
1 files changed, 59 insertions, 34 deletions
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) |