From bce5ed5812cc4385852a324da8a478086a7a0d37 Mon Sep 17 00:00:00 2001 From: diva Date: Fri, 27 Mar 2009 20:18:55 +0000 Subject: Moved a method GetDefaultVisualParameters from Scene to AvatarAppearance, where it belongs. Better error handling in ScenePresence.CopyFrom. --- OpenSim/Region/Framework/Scenes/Scene.cs | 13 +------------ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +++++-- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a60f7d8..1891f9d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3361,21 +3361,10 @@ namespace OpenSim.Region.Framework.Scenes public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) { - visualParams = GetDefaultVisualParams(); + visualParams = AvatarAppearance.GetDefaultVisualParams(); wearables = AvatarWearable.DefaultWearables; } - private static byte[] GetDefaultVisualParams() - { - byte[] visualParams; - visualParams = new byte[218]; - for (int i = 0; i < 218; i++) - { - visualParams[i] = 100; - } - return visualParams; - } - #endregion public void RegionHandleRequest(IClientAPI client, UUID regionID) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a6d1ad3..c78aceb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2849,6 +2849,8 @@ namespace OpenSim.Region.Framework.Scenes uint i = 0; try { + if (cAgent.Wearables == null) + cAgent.Wearables = new UUID[0]; AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2]; for (uint n = 0; n < cAgent.Wearables.Length; n += 2) { @@ -2857,12 +2859,13 @@ namespace OpenSim.Region.Framework.Scenes wears[i++] = new AvatarWearable(itemId, assetId); } m_appearance.Wearables = wears; - byte[] te = null; if (cAgent.AgentTextures != null) te = cAgent.AgentTextures; else - te = AvatarAppearance.GetDefaultTexture().ToBytes(); + te = AvatarAppearance.GetDefaultTexture().ToBytes(); + if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) + cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); m_appearance.SetAppearance(te, new List(cAgent.VisualParams)); } catch (Exception e) -- cgit v1.1