diff options
author | John Hurliman | 2009-09-30 15:53:03 -0700 |
---|---|---|
committer | John Hurliman | 2009-09-30 15:53:03 -0700 |
commit | 5dfd2643dfc530280e5dcd0056b59add7d49f313 (patch) | |
tree | 1e508a2e9be42eda630f0b97c4fac9606a288a7e /OpenSim/Region/Framework/Scenes | |
parent | Prevent null data being sent to the decoder (diff) | |
download | opensim-SC-5dfd2643dfc530280e5dcd0056b59add7d49f313.zip opensim-SC-5dfd2643dfc530280e5dcd0056b59add7d49f313.tar.gz opensim-SC-5dfd2643dfc530280e5dcd0056b59add7d49f313.tar.bz2 opensim-SC-5dfd2643dfc530280e5dcd0056b59add7d49f313.tar.xz |
* Change the signature of the agent set appearance callback to prevent unnecessary serialization/deserialization of TextureEntry objects and allow TextureEntry to be inspected for missing bakes
* Inspect incoming TextureEntry updates for bakes that do not exist on the simulator and request the missing textures
* Properly handle appearance updates that do not have a TextureEntry set
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 23fe2d3..ea5240e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -73,6 +73,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
73 | 73 | ||
74 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 74 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
75 | 75 | ||
76 | private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; | ||
77 | |||
76 | public static byte[] DefaultTexture; | 78 | public static byte[] DefaultTexture; |
77 | 79 | ||
78 | public UUID currentParcelUUID = UUID.Zero; | 80 | public UUID currentParcelUUID = UUID.Zero; |
@@ -2685,7 +2687,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2685 | /// </summary> | 2687 | /// </summary> |
2686 | /// <param name="texture"></param> | 2688 | /// <param name="texture"></param> |
2687 | /// <param name="visualParam"></param> | 2689 | /// <param name="visualParam"></param> |
2688 | public void SetAppearance(byte[] texture, List<byte> visualParam) | 2690 | public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) |
2689 | { | 2691 | { |
2690 | if (m_physicsActor != null) | 2692 | if (m_physicsActor != null) |
2691 | { | 2693 | { |
@@ -2703,7 +2705,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
2703 | AddToPhysicalScene(flyingTemp); | 2705 | AddToPhysicalScene(flyingTemp); |
2704 | } | 2706 | } |
2705 | } | 2707 | } |
2706 | m_appearance.SetAppearance(texture, visualParam); | 2708 | |
2709 | #region Bake Cache Check | ||
2710 | |||
2711 | if (textureEntry != null) | ||
2712 | { | ||
2713 | for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
2714 | { | ||
2715 | int j = BAKE_INDICES[i]; | ||
2716 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[j]; | ||
2717 | |||
2718 | if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
2719 | { | ||
2720 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) | ||
2721 | { | ||
2722 | m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + (AppearanceManager.TextureIndex)j + ") for avatar " + this.Name); | ||
2723 | this.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | ||
2724 | } | ||
2725 | } | ||
2726 | } | ||
2727 | } | ||
2728 | |||
2729 | #endregion Bake Cache Check | ||
2730 | |||
2731 | m_appearance.SetAppearance(textureEntry, visualParams); | ||
2707 | if (m_appearance.AvatarHeight > 0) | 2732 | if (m_appearance.AvatarHeight > 0) |
2708 | SetHeight(m_appearance.AvatarHeight); | 2733 | SetHeight(m_appearance.AvatarHeight); |
2709 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); | 2734 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); |
@@ -3253,14 +3278,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3253 | wears[i++] = new AvatarWearable(itemId, assetId); | 3278 | wears[i++] = new AvatarWearable(itemId, assetId); |
3254 | } | 3279 | } |
3255 | m_appearance.Wearables = wears; | 3280 | m_appearance.Wearables = wears; |
3256 | byte[] te = null; | 3281 | Primitive.TextureEntry te; |
3257 | if (cAgent.AgentTextures != null) | 3282 | if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) |
3258 | te = cAgent.AgentTextures; | 3283 | te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); |
3259 | else | 3284 | else |
3260 | te = AvatarAppearance.GetDefaultTexture().GetBytes(); | 3285 | te = AvatarAppearance.GetDefaultTexture(); |
3261 | if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) | 3286 | if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) |
3262 | cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); | 3287 | cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); |
3263 | m_appearance.SetAppearance(te, new List<byte>(cAgent.VisualParams)); | 3288 | m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone()); |
3264 | } | 3289 | } |
3265 | catch (Exception e) | 3290 | catch (Exception e) |
3266 | { | 3291 | { |