aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJohn Hurliman2009-09-30 15:53:03 -0700
committerJohn Hurliman2009-09-30 15:53:03 -0700
commit5dfd2643dfc530280e5dcd0056b59add7d49f313 (patch)
tree1e508a2e9be42eda630f0b97c4fac9606a288a7e /OpenSim/Region
parentPrevent null data being sent to the decoder (diff)
downloadopensim-SC_OLD-5dfd2643dfc530280e5dcd0056b59add7d49f313.zip
opensim-SC_OLD-5dfd2643dfc530280e5dcd0056b59add7d49f313.tar.gz
opensim-SC_OLD-5dfd2643dfc530280e5dcd0056b59add7d49f313.tar.bz2
opensim-SC_OLD-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')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs39
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs7
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs8
4 files changed, 42 insertions, 26 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index dae525d..9788f40 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -5272,13 +5272,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5272 // for the client session anyway, in order to protect ourselves against bad code in plugins 5272 // for the client session anyway, in order to protect ourselves against bad code in plugins
5273 try 5273 try
5274 { 5274 {
5275 List<byte> visualparams = new List<byte>(); 5275 byte[] visualparams = new byte[appear.VisualParam.Length];
5276 foreach (AgentSetAppearancePacket.VisualParamBlock x in appear.VisualParam) 5276 for (int i = 0; i < appear.VisualParam.Length; i++)
5277 { 5277 visualparams[i] = appear.VisualParam[i].ParamValue;
5278 visualparams.Add(x.ParamValue); 5278
5279 } 5279 Primitive.TextureEntry te = null;
5280 if (appear.ObjectData.TextureEntry.Length > 1)
5281 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
5280 5282
5281 handlerSetAppearance(appear.ObjectData.TextureEntry, visualparams); 5283 handlerSetAppearance(te, visualparams);
5282 } 5284 }
5283 catch (Exception e) 5285 catch (Exception e)
5284 { 5286 {
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 {
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 2316267..57f5d29 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -861,12 +861,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
861 Scene scene = (Scene)Scene; 861 Scene scene = (Scene)Scene;
862 AvatarAppearance appearance; 862 AvatarAppearance appearance;
863 scene.GetAvatarAppearance(this, out appearance); 863 scene.GetAvatarAppearance(this, out appearance);
864 List<byte> visualParams = new List<byte>(); 864 OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone());
865 foreach (byte visualParam in appearance.VisualParams)
866 {
867 visualParams.Add(visualParam);
868 }
869 OnSetAppearance(appearance.Texture.GetBytes(), visualParams);
870 } 865 }
871 866
872 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) 867 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index b3bfe07..30a2675 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -163,13 +163,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
163 { 163 {
164 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); 164 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene);
165 165
166 List<byte> wearbyte = new List<byte>(); 166 sp.SetAppearance(x.Texture, (byte[])x.VisualParams.Clone());
167 for (int i = 0; i < x.VisualParams.Length; i++)
168 {
169 wearbyte.Add(x.VisualParams[i]);
170 }
171
172 sp.SetAppearance(x.Texture.GetBytes(), wearbyte);
173 } 167 }
174 168
175 m_avatars.Add(npcAvatar.AgentId, npcAvatar); 169 m_avatars.Add(npcAvatar.AgentId, npcAvatar);