From 8e7f2d6d0efe37108b2931cfdda36e695830abb0 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 15 May 2008 14:39:54 +0000 Subject: refactoring to move AvatarAppearance into Framework and move the appearance sending bits to ScenePresence --- OpenSim/Framework/AvatarAppearance.cs | 217 ++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 OpenSim/Framework/AvatarAppearance.cs (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs new file mode 100644 index 0000000..50afa75 --- /dev/null +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -0,0 +1,217 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Security.Permissions; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework; + +namespace OpenSim.Framework +{ + [Serializable] + public class AvatarAppearance : ISerializable + { + // these are guessed at by the list here - + // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll + // correct them over time for when were are wrong. + public readonly static int BODY = 0; + public readonly static int SKIN = 1; + public readonly static int HAIR = 2; + public readonly static int EYES = 3; + public readonly static int SHIRT = 4; + public readonly static int PANTS = 5; + public readonly static int SHOES = 6; + public readonly static int SOCKS = 7; + public readonly static int JACKET = 8; + public readonly static int GLOVES = 9; + public readonly static int UNDERSHIRT = 10; + public readonly static int UNDERPANTS = 11; + public readonly static int SKIRT = 12; + + private readonly static int MAX_WEARABLES = 13; + + private static LLUUID BODY_ASSET = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); + private static LLUUID BODY_ITEM = new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"); + private static LLUUID SKIN_ASSET = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); + private static LLUUID SKIN_ITEM = new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"); + private static LLUUID SHIRT_ASSET = new LLUUID("00000000-38f9-1111-024e-222222111110"); + private static LLUUID SHIRT_ITEM = new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"); + private static LLUUID PANTS_ASSET = new LLUUID("00000000-38f9-1111-024e-222222111120"); + private static LLUUID PANTS_ITEM = new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"); + + public readonly static int VISUALPARAM_COUNT = 218; + + protected LLUUID m_scenePresenceID; + + public LLUUID ScenePresenceID + { + get { return m_scenePresenceID; } + set { m_scenePresenceID = value; } + } + protected int m_wearablesSerial = 1; + + public int WearablesSerial + { + get { return m_wearablesSerial; } + set { m_wearablesSerial = value; } + } + + protected byte[] m_visualParams; + + public byte[] VisualParams + { + get { return m_visualParams; } + set { m_visualParams = value; } + } + + protected AvatarWearable[] m_wearables; + + public AvatarWearable[] Wearables + { + get { return m_wearables; } + set { m_wearables = value; } + } + + protected LLObject.TextureEntry m_textureEntry; + + public LLObject.TextureEntry TextureEntry + { + get { return m_textureEntry; } + set { m_textureEntry = value; } + } + + protected float m_avatarHeight = 0; + + public float AvatarHeight + { + get { return m_avatarHeight; } + set { m_avatarHeight = value; } + } + + public AvatarAppearance() + { + m_wearables = new AvatarWearable[MAX_WEARABLES]; + for (int i = 0; i < MAX_WEARABLES; i++) + { + // this makes them all null + m_wearables[i] = new AvatarWearable(); + } + m_wearablesSerial = 0; + m_scenePresenceID = LLUUID.Zero; + m_visualParams = new byte[VISUALPARAM_COUNT]; + } + + public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams) + { + m_scenePresenceID = avatarID; + m_wearablesSerial = 1; + m_wearables = wearables; + m_visualParams = visualParams; + m_textureEntry = GetDefaultTextureEntry(); + } + + /// + /// + /// + /// + /// + public void SetAppearance(byte[] texture, List visualParam) + { + LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); + m_textureEntry = textureEnt; + + m_visualParams = visualParam.ToArray(); + + // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. + // (float)m_visualParams[25] = Height + // (float)m_visualParams[125] = LegLength + m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f))) + + (((float) m_visualParams[125]/255.0f)/1.5f); + } + + public void SetWearable(int wearableId, AvatarWearable wearable) + { + m_wearables[wearableId] = wearable; + } + + public static LLObject.TextureEntry GetDefaultTextureEntry() + { + LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); + textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); + textu.CreateFace(1).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); + textu.CreateFace(2).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); + textu.CreateFace(3).TextureID = new LLUUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); + textu.CreateFace(4).TextureID = new LLUUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); + textu.CreateFace(5).TextureID = new LLUUID("00000000-0000-1111-9999-000000000010"); + textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); + return textu; + } + + protected AvatarAppearance(SerializationInfo info, StreamingContext context) + { + //System.Console.WriteLine("AvatarAppearance Deserialize BGN"); + + if (info == null) + { + throw new ArgumentNullException("info"); + } + + m_scenePresenceID = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); + m_wearablesSerial = (int)info.GetValue("m_wearablesSerial", typeof(int)); + m_visualParams = (byte[])info.GetValue("m_visualParams", typeof(byte[])); + m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[])); + + byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[])); + m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); + + m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float)); + + //System.Console.WriteLine("AvatarAppearance Deserialize END"); + } + + [SecurityPermission(SecurityAction.LinkDemand, + Flags = SecurityPermissionFlag.SerializationFormatter)] + public virtual void GetObjectData( + SerializationInfo info, StreamingContext context) + { + if (info == null) + { + throw new ArgumentNullException("info"); + } + + info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID); + info.AddValue("m_wearablesSerial", m_wearablesSerial); + info.AddValue("m_visualParams", m_visualParams); + info.AddValue("m_wearables", m_wearables); + info.AddValue("m_textureEntry", m_textureEntry.ToBytes()); + info.AddValue("m_avatarHeight", m_avatarHeight); + } + } +} -- cgit v1.1 From 0c509ecdde73c7216d717da4fc4d32cb3b9d35c8 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 15 May 2008 15:10:13 +0000 Subject: minor refactor of some properties for readability --- OpenSim/Framework/AvatarAppearance.cs | 70 +++++++++++++++++------------------ 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 50afa75..64d8c0d 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -68,27 +68,27 @@ namespace OpenSim.Framework public readonly static int VISUALPARAM_COUNT = 218; - protected LLUUID m_scenePresenceID; + protected LLUUID m_owner; - public LLUUID ScenePresenceID + public LLUUID Owner { - get { return m_scenePresenceID; } - set { m_scenePresenceID = value; } + get { return m_owner; } + set { m_owner = value; } } - protected int m_wearablesSerial = 1; + protected int m_serial = 1; - public int WearablesSerial + public int Serial { - get { return m_wearablesSerial; } - set { m_wearablesSerial = value; } + get { return m_serial; } + set { m_serial = value; } } - protected byte[] m_visualParams; + protected byte[] m_visualparams; public byte[] VisualParams { - get { return m_visualParams; } - set { m_visualParams = value; } + get { return m_visualparams; } + set { m_visualparams = value; } } protected AvatarWearable[] m_wearables; @@ -99,12 +99,12 @@ namespace OpenSim.Framework set { m_wearables = value; } } - protected LLObject.TextureEntry m_textureEntry; + protected LLObject.TextureEntry m_texture; - public LLObject.TextureEntry TextureEntry + public LLObject.TextureEntry Texture { - get { return m_textureEntry; } - set { m_textureEntry = value; } + get { return m_texture; } + set { m_texture = value; } } protected float m_avatarHeight = 0; @@ -123,18 +123,18 @@ namespace OpenSim.Framework // this makes them all null m_wearables[i] = new AvatarWearable(); } - m_wearablesSerial = 0; - m_scenePresenceID = LLUUID.Zero; - m_visualParams = new byte[VISUALPARAM_COUNT]; + m_serial = 0; + m_owner = LLUUID.Zero; + m_visualparams = new byte[VISUALPARAM_COUNT]; } public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams) { - m_scenePresenceID = avatarID; - m_wearablesSerial = 1; + m_owner = avatarID; + m_serial = 1; m_wearables = wearables; - m_visualParams = visualParams; - m_textureEntry = GetDefaultTextureEntry(); + m_visualparams = visualParams; + m_texture = GetDefaultTexture(); } /// @@ -145,15 +145,15 @@ namespace OpenSim.Framework public void SetAppearance(byte[] texture, List visualParam) { LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); - m_textureEntry = textureEnt; + m_texture = textureEnt; - m_visualParams = visualParam.ToArray(); + m_visualparams = visualParam.ToArray(); // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. // (float)m_visualParams[25] = Height // (float)m_visualParams[125] = LegLength - m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f))) - + (((float) m_visualParams[125]/255.0f)/1.5f); + m_avatarHeight = (1.50856f + (((float) m_visualparams[25]/255.0f)*(2.525506f - 1.50856f))) + + (((float) m_visualparams[125]/255.0f)/1.5f); } public void SetWearable(int wearableId, AvatarWearable wearable) @@ -161,7 +161,7 @@ namespace OpenSim.Framework m_wearables[wearableId] = wearable; } - public static LLObject.TextureEntry GetDefaultTextureEntry() + public static LLObject.TextureEntry GetDefaultTexture() { LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); @@ -183,13 +183,13 @@ namespace OpenSim.Framework throw new ArgumentNullException("info"); } - m_scenePresenceID = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); - m_wearablesSerial = (int)info.GetValue("m_wearablesSerial", typeof(int)); - m_visualParams = (byte[])info.GetValue("m_visualParams", typeof(byte[])); + m_owner = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); + m_serial = (int)info.GetValue("m_wearablesSerial", typeof(int)); + m_visualparams = (byte[])info.GetValue("m_visualParams", typeof(byte[])); m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[])); byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[])); - m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); + m_texture = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float)); @@ -206,11 +206,11 @@ namespace OpenSim.Framework throw new ArgumentNullException("info"); } - info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID); - info.AddValue("m_wearablesSerial", m_wearablesSerial); - info.AddValue("m_visualParams", m_visualParams); + info.AddValue("m_scenePresenceID", m_owner.UUID); + info.AddValue("m_wearablesSerial", m_serial); + info.AddValue("m_visualParams", m_visualparams); info.AddValue("m_wearables", m_wearables); - info.AddValue("m_textureEntry", m_textureEntry.ToBytes()); + info.AddValue("m_textureEntry", m_texture.ToBytes()); info.AddValue("m_avatarHeight", m_avatarHeight); } } -- cgit v1.1 From c45218e275f11ae2d953bb7b6eefdf3df1dc4756 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 15 May 2008 15:30:03 +0000 Subject: add the rest of my UserAppearance created methods to AvatarAppearance --- OpenSim/Framework/AvatarAppearance.cs | 117 ++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 64d8c0d..0b59a67 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -99,6 +99,123 @@ namespace OpenSim.Framework set { m_wearables = value; } } + public LLUUID BodyItem { + get { return m_wearables[BODY].ItemID; } + set { m_wearables[BODY].ItemID = value; } + } + public LLUUID BodyAsset { + get { return m_wearables[BODY].AssetID; } + set { m_wearables[BODY].AssetID = value; } + } + public LLUUID SkinItem { + get { return m_wearables[SKIN].ItemID; } + set { m_wearables[SKIN].ItemID = value; } + } + public LLUUID SkinAsset { + get { return m_wearables[SKIN].AssetID; } + set { m_wearables[SKIN].AssetID = value; } + } + public LLUUID HairItem { + get { return m_wearables[HAIR].ItemID; } + set { m_wearables[HAIR].ItemID = value; } + } + public LLUUID HairAsset { + get { return m_wearables[HAIR].AssetID; } + set { m_wearables[HAIR].AssetID = value; } + } + public LLUUID EyesItem { + get { return m_wearables[EYES].ItemID; } + set { m_wearables[EYES].ItemID = value; } + } + public LLUUID EyesAsset { + get { return m_wearables[EYES].AssetID; } + set { m_wearables[EYES].AssetID = value; } + } + public LLUUID ShirtItem { + get { return m_wearables[SHIRT].ItemID; } + set { m_wearables[SHIRT].ItemID = value; } + } + public LLUUID ShirtAsset { + get { return m_wearables[SHIRT].AssetID; } + set { m_wearables[SHIRT].AssetID = value; } + } + public LLUUID PantsItem { + get { return m_wearables[PANTS].ItemID; } + set { m_wearables[PANTS].ItemID = value; } + } + public LLUUID PantsAsset { + get { return m_wearables[BODY].AssetID; } + set { m_wearables[BODY].AssetID = value; } + } + public LLUUID ShoesItem { + get { return m_wearables[SHOES].ItemID; } + set { m_wearables[SHOES].ItemID = value; } + } + public LLUUID ShoesAsset { + get { return m_wearables[SHOES].AssetID; } + set { m_wearables[SHOES].AssetID = value; } + } + public LLUUID SocksItem { + get { return m_wearables[SOCKS].ItemID; } + set { m_wearables[SOCKS].ItemID = value; } + } + public LLUUID SocksAsset { + get { return m_wearables[SOCKS].AssetID; } + set { m_wearables[SOCKS].AssetID = value; } + } + public LLUUID JacketItem { + get { return m_wearables[JACKET].ItemID; } + set { m_wearables[JACKET].ItemID = value; } + } + public LLUUID JacketAsset { + get { return m_wearables[JACKET].AssetID; } + set { m_wearables[JACKET].AssetID = value; } + } + public LLUUID GlovesItem { + get { return m_wearables[GLOVES].ItemID; } + set { m_wearables[GLOVES].ItemID = value; } + } + public LLUUID GlovesAsset { + get { return m_wearables[GLOVES].AssetID; } + set { m_wearables[GLOVES].AssetID = value; } + } + public LLUUID UnderShirtItem { + get { return m_wearables[UNDERSHIRT].ItemID; } + set { m_wearables[UNDERSHIRT].ItemID = value; } + } + public LLUUID UnderShirtAsset { + get { return m_wearables[UNDERSHIRT].AssetID; } + set { m_wearables[UNDERSHIRT].AssetID = value; } + } + public LLUUID UnderPantsItem { + get { return m_wearables[UNDERPANTS].ItemID; } + set { m_wearables[UNDERPANTS].ItemID = value; } + } + public LLUUID UnderPantsAsset { + get { return m_wearables[UNDERPANTS].AssetID; } + set { m_wearables[UNDERPANTS].AssetID = value; } + } + public LLUUID SkirtItem { + get { return m_wearables[SKIRT].ItemID; } + set { m_wearables[SKIRT].ItemID = value; } + } + public LLUUID SkirtAsset { + get { return m_wearables[SKIRT].AssetID; } + set { m_wearables[SKIRT].AssetID = value; } + } + + public void SetDefaultWearables() + { + m_wearables[BODY].AssetID = BODY_ASSET; + m_wearables[BODY].ItemID = BODY_ITEM; + m_wearables[SKIN].AssetID = SKIN_ASSET; + m_wearables[SKIN].ItemID = SKIN_ITEM; + m_wearables[SHIRT].AssetID = SHIRT_ASSET; + m_wearables[SHIRT].ItemID = SHIRT_ITEM; + m_wearables[PANTS].AssetID = PANTS_ASSET; + m_wearables[PANTS].ItemID = PANTS_ITEM; + } + protected LLObject.TextureEntry m_texture; public LLObject.TextureEntry Texture -- cgit v1.1 From 30202542c03b765bd11795dd1873a1ab3d9a8970 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 15 May 2008 20:39:34 +0000 Subject: fix bad default initialization --- OpenSim/Framework/AvatarAppearance.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 0b59a67..42cd6f9 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -243,6 +243,8 @@ namespace OpenSim.Framework m_serial = 0; m_owner = LLUUID.Zero; m_visualparams = new byte[VISUALPARAM_COUNT]; + SetDefaultWearables(); + m_texture = GetDefaultTexture(); } public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams) -- cgit v1.1 From fc773649720c062a72d1b8a098eb54bda9a84ca9 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 16 May 2008 00:04:46 +0000 Subject: appearance now survives logout. Tommorrow will involve moving the MSSQL and MYSQL mappers back in under datastores and looking at doing gid bits for this --- OpenSim/Framework/AvatarAppearance.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 42cd6f9..cf9ff58 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -293,6 +293,16 @@ namespace OpenSim.Framework return textu; } + public override String ToString() + { + String s = "[Wearables] =>"; + s += "Body Item: " + BodyItem.ToString() + ";"; + s += "Skin Item: " + SkinItem.ToString() + ";"; + s += "Shirt Item: " + ShirtItem.ToString() + ";"; + s += "Pants Item: " + PantsItem.ToString() + ";"; + return s; + } + protected AvatarAppearance(SerializationInfo info, StreamingContext context) { //System.Console.WriteLine("AvatarAppearance Deserialize BGN"); -- cgit v1.1 From 65c5efe43b68700bad94076d4cd421160203c5de Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Fri, 16 May 2008 01:22:11 +0000 Subject: Formatting cleanup. --- OpenSim/Framework/AvatarAppearance.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index cf9ff58..365df1a 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -56,7 +56,7 @@ namespace OpenSim.Framework public readonly static int SKIRT = 12; private readonly static int MAX_WEARABLES = 13; - + private static LLUUID BODY_ASSET = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); private static LLUUID BODY_ITEM = new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"); private static LLUUID SKIN_ASSET = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); @@ -204,7 +204,7 @@ namespace OpenSim.Framework set { m_wearables[SKIRT].AssetID = value; } } - public void SetDefaultWearables() + public void SetDefaultWearables() { m_wearables[BODY].AssetID = BODY_ASSET; m_wearables[BODY].ItemID = BODY_ITEM; @@ -257,7 +257,7 @@ namespace OpenSim.Framework } /// - /// + /// /// /// /// -- cgit v1.1 From 6a526fcb6fe9ddc651976b3c37422dc96d1e7bd7 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 16 May 2008 16:01:36 +0000 Subject: add to / from hash mapping for grid serialization --- OpenSim/Framework/AvatarAppearance.cs | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 365df1a..d4bfb2c 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections; using System.Collections.Generic; using System.Runtime.Serialization; using System.Security.Permissions; @@ -325,6 +326,79 @@ namespace OpenSim.Framework //System.Console.WriteLine("AvatarAppearance Deserialize END"); } + // this is used for OGS1 + public Hashtable ToHashTable() + { + Hashtable h = new Hashtable(); + h["owner"] = Owner.ToString(); + h["serial"] = Serial.ToString(); + h["visual_params"] = VisualParams; + h["texture"] = Texture.ToBytes(); + h["avatar_height"] = AvatarHeight.ToString(); + h["body_item"] = BodyItem.ToString(); + h["body_asset"] = BodyAsset.ToString(); + h["skin_item"] = SkinItem.ToString(); + h["skin_asset"] = SkinAsset.ToString(); + h["hair_item"] = HairItem.ToString(); + h["hair_asset"] = HairAsset.ToString(); + h["eyes_item"] = EyesItem.ToString(); + h["eyes_asset"] = EyesAsset.ToString(); + h["shirt_item"] = ShirtItem.ToString(); + h["shirt_asset"] = ShirtAsset.ToString(); + h["pants_item"] = PantsItem.ToString(); + h["pants_asset"] = PantsAsset.ToString(); + h["shoes_item"] = ShoesItem.ToString(); + h["shoes_asset"] = ShoesAsset.ToString(); + h["socks_item"] = SocksItem.ToString(); + h["socks_asset"] = SocksAsset.ToString(); + h["jacket_item"] = JacketItem.ToString(); + h["jacket_asset"] = JacketAsset.ToString(); + h["gloves_item"] = GlovesItem.ToString(); + h["gloves_asset"] = GlovesAsset.ToString(); + h["undershirt_item"] = UnderShirtItem.ToString(); + h["undershirt_asset"] = UnderShirtAsset.ToString(); + h["underpants_item"] = UnderPantsItem.ToString(); + h["underpants_asset"] = UnderPantsAsset.ToString(); + h["skirt_item"] = SkirtItem.ToString(); + h["skirt_asset"] = SkirtAsset.ToString(); + return h; + } + + public AvatarAppearance(Hashtable h) + { + Owner = new LLUUID((string)h["owner"]); + Serial = Convert.ToInt32((string)h["serial"]); + VisualParams = (byte[])h["visual_params"]; + Texture = new LLObject.TextureEntry((byte[])h["texture"], 0, ((byte[])h["texture"]).Length); + AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); + BodyItem = new LLUUID((string)h["body_item"]); + BodyAsset = new LLUUID((string)h["body_asset"]); + SkinItem = new LLUUID((string)h["skin_item"]); + SkinAsset = new LLUUID((string)h["skin_asset"]); + HairItem = new LLUUID((string)h["hair_item"]); + HairAsset = new LLUUID((string)h["hair_asset"]); + EyesItem = new LLUUID((string)h["eyes_item"]); + EyesAsset = new LLUUID((string)h["eyes_asset"]); + ShirtItem = new LLUUID((string)h["shirt_item"]); + ShirtAsset = new LLUUID((string)h["shirt_asset"]); + PantsItem = new LLUUID((string)h["pants_item"]); + PantsAsset = new LLUUID((string)h["pants_asset"]); + ShoesItem = new LLUUID((string)h["shoes_item"]); + ShoesAsset = new LLUUID((string)h["shoes_asset"]); + SocksItem = new LLUUID((string)h["socks_item"]); + SocksAsset = new LLUUID((string)h["socks_asset"]); + JacketItem = new LLUUID((string)h["jacket_item"]); + JacketAsset = new LLUUID((string)h["jacket_asset"]); + GlovesItem = new LLUUID((string)h["gloves_item"]); + GlovesAsset = new LLUUID((string)h["gloves_asset"]); + UnderShirtItem = new LLUUID((string)h["undershirt_item"]); + UnderShirtAsset = new LLUUID((string)h["undershirt_asset"]); + UnderPantsItem = new LLUUID((string)h["underpants_item"]); + UnderPantsAsset = new LLUUID((string)h["underpants_asset"]); + SkirtItem = new LLUUID((string)h["skirt_item"]); + SkirtAsset = new LLUUID((string)h["skirt_asset"]); + } + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public virtual void GetObjectData( -- cgit v1.1 From f99b4cbe3b53abcbfe5e751474085f7653997cc4 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 16 May 2008 19:24:28 +0000 Subject: prime the wearables structure, which should fix the exception FluxOne found. --- OpenSim/Framework/AvatarAppearance.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index d4bfb2c..53c0d92 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -371,6 +371,14 @@ namespace OpenSim.Framework VisualParams = (byte[])h["visual_params"]; Texture = new LLObject.TextureEntry((byte[])h["texture"], 0, ((byte[])h["texture"]).Length); AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); + + m_wearables = new AvatarWearable[MAX_WEARABLES]; + for (int i = 0; i < MAX_WEARABLES; i++) + { + // this makes them all null + m_wearables[i] = new AvatarWearable(); + } + BodyItem = new LLUUID((string)h["body_item"]); BodyAsset = new LLUUID((string)h["body_asset"]); SkinItem = new LLUUID((string)h["skin_item"]); -- cgit v1.1 From a5f08b430d644c7a4274db9fff3db0c63a6a7857 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sat, 17 May 2008 00:06:35 +0000 Subject: Formatting cleanup. --- OpenSim/Framework/AvatarAppearance.cs | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 53c0d92..4611647 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -381,30 +381,30 @@ namespace OpenSim.Framework BodyItem = new LLUUID((string)h["body_item"]); BodyAsset = new LLUUID((string)h["body_asset"]); - SkinItem = new LLUUID((string)h["skin_item"]); - SkinAsset = new LLUUID((string)h["skin_asset"]); - HairItem = new LLUUID((string)h["hair_item"]); - HairAsset = new LLUUID((string)h["hair_asset"]); - EyesItem = new LLUUID((string)h["eyes_item"]); - EyesAsset = new LLUUID((string)h["eyes_asset"]); - ShirtItem = new LLUUID((string)h["shirt_item"]); - ShirtAsset = new LLUUID((string)h["shirt_asset"]); - PantsItem = new LLUUID((string)h["pants_item"]); - PantsAsset = new LLUUID((string)h["pants_asset"]); - ShoesItem = new LLUUID((string)h["shoes_item"]); - ShoesAsset = new LLUUID((string)h["shoes_asset"]); - SocksItem = new LLUUID((string)h["socks_item"]); - SocksAsset = new LLUUID((string)h["socks_asset"]); - JacketItem = new LLUUID((string)h["jacket_item"]); - JacketAsset = new LLUUID((string)h["jacket_asset"]); - GlovesItem = new LLUUID((string)h["gloves_item"]); - GlovesAsset = new LLUUID((string)h["gloves_asset"]); - UnderShirtItem = new LLUUID((string)h["undershirt_item"]); - UnderShirtAsset = new LLUUID((string)h["undershirt_asset"]); - UnderPantsItem = new LLUUID((string)h["underpants_item"]); - UnderPantsAsset = new LLUUID((string)h["underpants_asset"]); - SkirtItem = new LLUUID((string)h["skirt_item"]); - SkirtAsset = new LLUUID((string)h["skirt_asset"]); + SkinItem = new LLUUID((string)h["skin_item"]); + SkinAsset = new LLUUID((string)h["skin_asset"]); + HairItem = new LLUUID((string)h["hair_item"]); + HairAsset = new LLUUID((string)h["hair_asset"]); + EyesItem = new LLUUID((string)h["eyes_item"]); + EyesAsset = new LLUUID((string)h["eyes_asset"]); + ShirtItem = new LLUUID((string)h["shirt_item"]); + ShirtAsset = new LLUUID((string)h["shirt_asset"]); + PantsItem = new LLUUID((string)h["pants_item"]); + PantsAsset = new LLUUID((string)h["pants_asset"]); + ShoesItem = new LLUUID((string)h["shoes_item"]); + ShoesAsset = new LLUUID((string)h["shoes_asset"]); + SocksItem = new LLUUID((string)h["socks_item"]); + SocksAsset = new LLUUID((string)h["socks_asset"]); + JacketItem = new LLUUID((string)h["jacket_item"]); + JacketAsset = new LLUUID((string)h["jacket_asset"]); + GlovesItem = new LLUUID((string)h["gloves_item"]); + GlovesAsset = new LLUUID((string)h["gloves_asset"]); + UnderShirtItem = new LLUUID((string)h["undershirt_item"]); + UnderShirtAsset = new LLUUID((string)h["undershirt_asset"]); + UnderPantsItem = new LLUUID((string)h["underpants_item"]); + UnderPantsAsset = new LLUUID((string)h["underpants_asset"]); + SkirtItem = new LLUUID((string)h["skirt_item"]); + SkirtAsset = new LLUUID((string)h["skirt_asset"]); } [SecurityPermission(SecurityAction.LinkDemand, -- cgit v1.1 From 29fb93d2432249709de3c99940373e8acd692206 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 19 May 2008 21:24:39 +0000 Subject: fix a constant that meant pants still weren't working. now you really can have pants. --- OpenSim/Framework/AvatarAppearance.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 4611647..676283c 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -145,8 +145,8 @@ namespace OpenSim.Framework set { m_wearables[PANTS].ItemID = value; } } public LLUUID PantsAsset { - get { return m_wearables[BODY].AssetID; } - set { m_wearables[BODY].AssetID = value; } + get { return m_wearables[PANTS].AssetID; } + set { m_wearables[PANTS].AssetID = value; } } public LLUUID ShoesItem { get { return m_wearables[SHOES].ItemID; } -- cgit v1.1 From 5158aad662f3b6af788c729b3e68f76c92b3279b Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 25 Jun 2008 19:18:51 +0000 Subject: make lots of properties virtual, which lets nhibernate do some proxy object optimizations. --- OpenSim/Framework/AvatarAppearance.cs | 72 +++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 676283c..4456138 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -71,14 +71,14 @@ namespace OpenSim.Framework protected LLUUID m_owner; - public LLUUID Owner + public virtual LLUUID Owner { get { return m_owner; } set { m_owner = value; } } protected int m_serial = 1; - public int Serial + public virtual int Serial { get { return m_serial; } set { m_serial = value; } @@ -86,7 +86,7 @@ namespace OpenSim.Framework protected byte[] m_visualparams; - public byte[] VisualParams + public virtual byte[] VisualParams { get { return m_visualparams; } set { m_visualparams = value; } @@ -94,118 +94,118 @@ namespace OpenSim.Framework protected AvatarWearable[] m_wearables; - public AvatarWearable[] Wearables + public virtual AvatarWearable[] Wearables { get { return m_wearables; } set { m_wearables = value; } } - public LLUUID BodyItem { + public virtual LLUUID BodyItem { get { return m_wearables[BODY].ItemID; } set { m_wearables[BODY].ItemID = value; } } - public LLUUID BodyAsset { + public virtual LLUUID BodyAsset { get { return m_wearables[BODY].AssetID; } set { m_wearables[BODY].AssetID = value; } } - public LLUUID SkinItem { + public virtual LLUUID SkinItem { get { return m_wearables[SKIN].ItemID; } set { m_wearables[SKIN].ItemID = value; } } - public LLUUID SkinAsset { + public virtual LLUUID SkinAsset { get { return m_wearables[SKIN].AssetID; } set { m_wearables[SKIN].AssetID = value; } } - public LLUUID HairItem { + public virtual LLUUID HairItem { get { return m_wearables[HAIR].ItemID; } set { m_wearables[HAIR].ItemID = value; } } - public LLUUID HairAsset { + public virtual LLUUID HairAsset { get { return m_wearables[HAIR].AssetID; } set { m_wearables[HAIR].AssetID = value; } } - public LLUUID EyesItem { + public virtual LLUUID EyesItem { get { return m_wearables[EYES].ItemID; } set { m_wearables[EYES].ItemID = value; } } - public LLUUID EyesAsset { + public virtual LLUUID EyesAsset { get { return m_wearables[EYES].AssetID; } set { m_wearables[EYES].AssetID = value; } } - public LLUUID ShirtItem { + public virtual LLUUID ShirtItem { get { return m_wearables[SHIRT].ItemID; } set { m_wearables[SHIRT].ItemID = value; } } - public LLUUID ShirtAsset { + public virtual LLUUID ShirtAsset { get { return m_wearables[SHIRT].AssetID; } set { m_wearables[SHIRT].AssetID = value; } } - public LLUUID PantsItem { + public virtual LLUUID PantsItem { get { return m_wearables[PANTS].ItemID; } set { m_wearables[PANTS].ItemID = value; } } - public LLUUID PantsAsset { + public virtual LLUUID PantsAsset { get { return m_wearables[PANTS].AssetID; } set { m_wearables[PANTS].AssetID = value; } } - public LLUUID ShoesItem { + public virtual LLUUID ShoesItem { get { return m_wearables[SHOES].ItemID; } set { m_wearables[SHOES].ItemID = value; } } - public LLUUID ShoesAsset { + public virtual LLUUID ShoesAsset { get { return m_wearables[SHOES].AssetID; } set { m_wearables[SHOES].AssetID = value; } } - public LLUUID SocksItem { + public virtual LLUUID SocksItem { get { return m_wearables[SOCKS].ItemID; } set { m_wearables[SOCKS].ItemID = value; } } - public LLUUID SocksAsset { + public virtual LLUUID SocksAsset { get { return m_wearables[SOCKS].AssetID; } set { m_wearables[SOCKS].AssetID = value; } } - public LLUUID JacketItem { + public virtual LLUUID JacketItem { get { return m_wearables[JACKET].ItemID; } set { m_wearables[JACKET].ItemID = value; } } - public LLUUID JacketAsset { + public virtual LLUUID JacketAsset { get { return m_wearables[JACKET].AssetID; } set { m_wearables[JACKET].AssetID = value; } } - public LLUUID GlovesItem { + public virtual LLUUID GlovesItem { get { return m_wearables[GLOVES].ItemID; } set { m_wearables[GLOVES].ItemID = value; } } - public LLUUID GlovesAsset { + public virtual LLUUID GlovesAsset { get { return m_wearables[GLOVES].AssetID; } set { m_wearables[GLOVES].AssetID = value; } } - public LLUUID UnderShirtItem { + public virtual LLUUID UnderShirtItem { get { return m_wearables[UNDERSHIRT].ItemID; } set { m_wearables[UNDERSHIRT].ItemID = value; } } - public LLUUID UnderShirtAsset { + public virtual LLUUID UnderShirtAsset { get { return m_wearables[UNDERSHIRT].AssetID; } set { m_wearables[UNDERSHIRT].AssetID = value; } } - public LLUUID UnderPantsItem { + public virtual LLUUID UnderPantsItem { get { return m_wearables[UNDERPANTS].ItemID; } set { m_wearables[UNDERPANTS].ItemID = value; } } - public LLUUID UnderPantsAsset { + public virtual LLUUID UnderPantsAsset { get { return m_wearables[UNDERPANTS].AssetID; } set { m_wearables[UNDERPANTS].AssetID = value; } } - public LLUUID SkirtItem { + public virtual LLUUID SkirtItem { get { return m_wearables[SKIRT].ItemID; } set { m_wearables[SKIRT].ItemID = value; } } - public LLUUID SkirtAsset { + public virtual LLUUID SkirtAsset { get { return m_wearables[SKIRT].AssetID; } set { m_wearables[SKIRT].AssetID = value; } } - public void SetDefaultWearables() + public virtual void SetDefaultWearables() { m_wearables[BODY].AssetID = BODY_ASSET; m_wearables[BODY].ItemID = BODY_ITEM; @@ -219,7 +219,7 @@ namespace OpenSim.Framework protected LLObject.TextureEntry m_texture; - public LLObject.TextureEntry Texture + public virtual LLObject.TextureEntry Texture { get { return m_texture; } set { m_texture = value; } @@ -227,7 +227,7 @@ namespace OpenSim.Framework protected float m_avatarHeight = 0; - public float AvatarHeight + public virtual float AvatarHeight { get { return m_avatarHeight; } set { m_avatarHeight = value; } @@ -262,7 +262,7 @@ namespace OpenSim.Framework /// /// /// - public void SetAppearance(byte[] texture, List visualParam) + public virtual void SetAppearance(byte[] texture, List visualParam) { LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); m_texture = textureEnt; @@ -276,7 +276,7 @@ namespace OpenSim.Framework + (((float) m_visualparams[125]/255.0f)/1.5f); } - public void SetWearable(int wearableId, AvatarWearable wearable) + public virtual void SetWearable(int wearableId, AvatarWearable wearable) { m_wearables[wearableId] = wearable; } @@ -327,7 +327,7 @@ namespace OpenSim.Framework } // this is used for OGS1 - public Hashtable ToHashTable() + public virtual Hashtable ToHashTable() { Hashtable h = new Hashtable(); h["owner"] = Owner.ToString(); -- cgit v1.1 From 6ef9d4da901a346c232458317cca6268da888e2e Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 18 Aug 2008 00:39:10 +0000 Subject: Formatting cleanup. --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 4456138..3133f83 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -371,7 +371,7 @@ namespace OpenSim.Framework VisualParams = (byte[])h["visual_params"]; Texture = new LLObject.TextureEntry((byte[])h["texture"], 0, ((byte[])h["texture"]).Length); AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); - + m_wearables = new AvatarWearable[MAX_WEARABLES]; for (int i = 0; i < MAX_WEARABLES; i++) { -- cgit v1.1 From 05506cff499b999d6c01e0517e658293b4791317 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 18 Aug 2008 17:22:36 +0000 Subject: Avatar Attachment persistence!! Patch #9168 (Mantis #1171) Plumbs in attachment persistence and adds the tables. Currently MySQL only, no user functionality yet. --- OpenSim/Framework/AvatarAppearance.cs | 101 ++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 3133f83..1c086d5 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -361,6 +361,11 @@ namespace OpenSim.Framework h["underpants_asset"] = UnderPantsAsset.ToString(); h["skirt_item"] = SkirtItem.ToString(); h["skirt_asset"] = SkirtAsset.ToString(); + + Hashtable attachments = GetAttachments(); + if(attachments != null) + h["attachments"] = attachments; + return h; } @@ -405,6 +410,12 @@ namespace OpenSim.Framework UnderPantsAsset = new LLUUID((string)h["underpants_asset"]); SkirtItem = new LLUUID((string)h["skirt_item"]); SkirtAsset = new LLUUID((string)h["skirt_asset"]); + + if(h.ContainsKey("attachments")) + { + Hashtable attachments = (Hashtable) h["attachments"]; + SetAttachments(attachments); + } } [SecurityPermission(SecurityAction.LinkDemand, @@ -424,5 +435,95 @@ namespace OpenSim.Framework info.AddValue("m_textureEntry", m_texture.ToBytes()); info.AddValue("m_avatarHeight", m_avatarHeight); } + + private Dictionary m_attachments = new Dictionary(); + + public void SetAttachments(Hashtable data) + { + m_attachments.Clear(); + + if(data == null) + return; + + foreach (DictionaryEntry e in data) + { + int attachpoint = Convert.ToInt32(e.Key); + + if (m_attachments.ContainsKey(attachpoint)) + continue; + + LLUUID item; + LLUUID asset; + + Hashtable uuids = (Hashtable) e.Value; + LLUUID.TryParse(uuids["item"].ToString(), out item); + LLUUID.TryParse(uuids["asset"].ToString(), out asset); + + LLUUID[] attachment = new LLUUID[2]; + attachment[0] = item; + attachment[1] = asset; + + m_attachments[attachpoint] = attachment; + } + } + + public Hashtable GetAttachments() + { + if(m_attachments.Count == 0) + return null; + + Hashtable ret = new Hashtable(); + + foreach (KeyValuePair kvp in m_attachments) + { + int attachpoint = kvp.Key; + LLUUID[] uuids = kvp.Value; + + Hashtable data = new Hashtable(); + data["item"] = uuids[0].ToString(); + data["asset"] = uuids[1].ToString(); + + ret[attachpoint] = data; + } + + return ret; + } + + public List GetAttachedPoints() + { + return new List(m_attachments.Keys); + } + + public LLUUID GetAttachedItem(int attachpoint) + { + if (!m_attachments.ContainsKey(attachpoint)) + return LLUUID.Zero; + + return m_attachments[attachpoint][0]; + } + + public LLUUID GetAttachedAsset(int attachpoint) + { + if (!m_attachments.ContainsKey(attachpoint)) + return LLUUID.Zero; + + return m_attachments[attachpoint][1]; + } + + public void AddAttachment(int attachpoint, LLUUID item, LLUUID asset) + { + if (item == LLUUID.Zero || asset == LLUUID.Zero) + { + if (m_attachments.ContainsKey(attachpoint)) + m_attachments.Remove(attachpoint); + return; + } + + if (!m_attachments.ContainsKey(attachpoint)) + m_attachments[attachpoint] = new LLUUID[2]; + + m_attachments[attachpoint][0] = item; + m_attachments[attachpoint][1] = asset; + } } } -- cgit v1.1 From 6d2e1ad6ba73fb0eba51b3885ff0a4d7d1b5d611 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 19 Aug 2008 02:12:40 +0000 Subject: Attachment persistence!!! Patch #9169 (Mantis #1171) Attachments now save to MySQL. No reattach on login yet. --- OpenSim/Framework/AvatarAppearance.cs | 67 +++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 1c086d5..67e26b1 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -362,8 +362,8 @@ namespace OpenSim.Framework h["skirt_item"] = SkirtItem.ToString(); h["skirt_asset"] = SkirtAsset.ToString(); - Hashtable attachments = GetAttachments(); - if(attachments != null) + string attachments = GetAttachmentsString(); + if(attachments != String.Empty) h["attachments"] = attachments; return h; @@ -413,8 +413,7 @@ namespace OpenSim.Framework if(h.ContainsKey("attachments")) { - Hashtable attachments = (Hashtable) h["attachments"]; - SetAttachments(attachments); + SetAttachmentsString(h["attachments"].ToString()); } } @@ -510,9 +509,12 @@ namespace OpenSim.Framework return m_attachments[attachpoint][1]; } - public void AddAttachment(int attachpoint, LLUUID item, LLUUID asset) + public void SetAttachment(int attachpoint, LLUUID item, LLUUID asset) { - if (item == LLUUID.Zero || asset == LLUUID.Zero) + if(attachpoint == 0) + return; + + if (item == LLUUID.Zero) { if (m_attachments.ContainsKey(attachpoint)) m_attachments.Remove(attachpoint); @@ -525,5 +527,58 @@ namespace OpenSim.Framework m_attachments[attachpoint][0] = item; m_attachments[attachpoint][1] = asset; } + + public void DetachAttachment(LLUUID itemID) + { + int attachpoint = 0; + + foreach (KeyValuePair kvp in m_attachments) + { + if(kvp.Value[0] == itemID) + { + attachpoint = kvp.Key; + break; + } + } + + if(attachpoint > 0) + m_attachments.Remove(attachpoint); + } + string GetAttachmentsString() + { + List strings = new List(); + + foreach (KeyValuePair e in m_attachments) + { + strings.Add(e.Key.ToString()); + strings.Add(e.Value[0].ToString()); + strings.Add(e.Value[1].ToString()); + } + + return String.Join(",", strings.ToArray()); + } + + void SetAttachmentsString(string data) + { + string[] strings = data.Split(new char[] {','}); + int i = 0; + + m_attachments.Clear(); + + while (strings.Length - i > 2) + { + int attachpoint = Int32.Parse(strings[i]); + LLUUID item = new LLUUID(strings[i+1]); + LLUUID asset = new LLUUID(strings[i+2]); + i += 3; + + if (!m_attachments.ContainsKey(attachpoint)) + { + m_attachments[attachpoint] = new LLUUID[2]; + m_attachments[attachpoint][0] = item; + m_attachments[attachpoint][1] = asset; + } + } + } } } -- cgit v1.1 From bea7d4d81ad7a75706305be6c8ca06f8dc6e6eca Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 19 Aug 2008 02:59:27 +0000 Subject: Update svn properties, formatting cleanup. --- OpenSim/Framework/AvatarAppearance.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 67e26b1..3459504 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -363,7 +363,7 @@ namespace OpenSim.Framework h["skirt_asset"] = SkirtAsset.ToString(); string attachments = GetAttachmentsString(); - if(attachments != String.Empty) + if (attachments != String.Empty) h["attachments"] = attachments; return h; @@ -411,7 +411,7 @@ namespace OpenSim.Framework SkirtItem = new LLUUID((string)h["skirt_item"]); SkirtAsset = new LLUUID((string)h["skirt_asset"]); - if(h.ContainsKey("attachments")) + if (h.ContainsKey("attachments")) { SetAttachmentsString(h["attachments"].ToString()); } @@ -441,7 +441,7 @@ namespace OpenSim.Framework { m_attachments.Clear(); - if(data == null) + if (data == null) return; foreach (DictionaryEntry e in data) @@ -468,7 +468,7 @@ namespace OpenSim.Framework public Hashtable GetAttachments() { - if(m_attachments.Count == 0) + if (m_attachments.Count == 0) return null; Hashtable ret = new Hashtable(); -- cgit v1.1 From 29530f30296271f2d5641091e45d5f396a7d4dec Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 19 Aug 2008 07:11:58 +0000 Subject: Attachment persistence!!! Patch #9170 (Mantis #1171) Attachments now persist across logouts. Mostly untested. --- OpenSim/Framework/AvatarAppearance.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 3459504..81cf372 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -528,22 +528,26 @@ namespace OpenSim.Framework m_attachments[attachpoint][1] = asset; } - public void DetachAttachment(LLUUID itemID) + public int GetAttachpoint(LLUUID itemID) { - int attachpoint = 0; - foreach (KeyValuePair kvp in m_attachments) { if(kvp.Value[0] == itemID) { - attachpoint = kvp.Key; - break; + return kvp.Key; } } + return 0; + } + + public void DetachAttachment(LLUUID itemID) + { + int attachpoint = GetAttachpoint(itemID); if(attachpoint > 0) m_attachments.Remove(attachpoint); } + string GetAttachmentsString() { List strings = new List(); -- cgit v1.1 From 5c360e7374d6d3529f7578195a86a13e3858389f Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 19 Aug 2008 13:07:24 +0000 Subject: Update svn properties, minor formatting cleanup. Remove old comment in SnapshotStore pointed out by ChrisDown (bug #2000) --- OpenSim/Framework/AvatarAppearance.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 81cf372..a287201 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -511,7 +511,7 @@ namespace OpenSim.Framework public void SetAttachment(int attachpoint, LLUUID item, LLUUID asset) { - if(attachpoint == 0) + if (attachpoint == 0) return; if (item == LLUUID.Zero) @@ -532,7 +532,7 @@ namespace OpenSim.Framework { foreach (KeyValuePair kvp in m_attachments) { - if(kvp.Value[0] == itemID) + if (kvp.Value[0] == itemID) { return kvp.Key; } @@ -544,7 +544,7 @@ namespace OpenSim.Framework { int attachpoint = GetAttachpoint(itemID); - if(attachpoint > 0) + if (attachpoint > 0) m_attachments.Remove(attachpoint); } -- cgit v1.1 From 7d89e122930be39e84a6d174548fa2d12ac0484a Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 6 Sep 2008 07:52:41 +0000 Subject: * This is the fabled LibOMV update with all of the libOMV types from JHurliman * This is a HUGE OMG update and will definitely have unknown side effects.. so this is really only for the strong hearted at this point. Regular people should let the dust settle. * This has been tested to work with most basic functions. However.. make sure you back up 'everything' before using this. It's that big! * Essentially we're back at square 1 in the testing phase.. so lets identify things that broke. --- OpenSim/Framework/AvatarAppearance.cs | 210 +++++++++++++++++----------------- 1 file changed, 105 insertions(+), 105 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a287201..0c0cfd5 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -30,8 +30,8 @@ using System.Collections; using System.Collections.Generic; using System.Runtime.Serialization; using System.Security.Permissions; -using libsecondlife; -using libsecondlife.Packets; +using OpenMetaverse; +using OpenMetaverse.Packets; using OpenSim.Framework; namespace OpenSim.Framework @@ -58,20 +58,20 @@ namespace OpenSim.Framework private readonly static int MAX_WEARABLES = 13; - private static LLUUID BODY_ASSET = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); - private static LLUUID BODY_ITEM = new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"); - private static LLUUID SKIN_ASSET = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); - private static LLUUID SKIN_ITEM = new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"); - private static LLUUID SHIRT_ASSET = new LLUUID("00000000-38f9-1111-024e-222222111110"); - private static LLUUID SHIRT_ITEM = new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"); - private static LLUUID PANTS_ASSET = new LLUUID("00000000-38f9-1111-024e-222222111120"); - private static LLUUID PANTS_ITEM = new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"); + private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); + private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); + private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); + private static UUID SKIN_ITEM = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9"); + private static UUID SHIRT_ASSET = new UUID("00000000-38f9-1111-024e-222222111110"); + private static UUID SHIRT_ITEM = new UUID("77c41e39-38f9-f75a-0000-585989bf0000"); + private static UUID PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); + private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); public readonly static int VISUALPARAM_COUNT = 218; - protected LLUUID m_owner; + protected UUID m_owner; - public virtual LLUUID Owner + public virtual UUID Owner { get { return m_owner; } set { m_owner = value; } @@ -100,107 +100,107 @@ namespace OpenSim.Framework set { m_wearables = value; } } - public virtual LLUUID BodyItem { + public virtual UUID BodyItem { get { return m_wearables[BODY].ItemID; } set { m_wearables[BODY].ItemID = value; } } - public virtual LLUUID BodyAsset { + public virtual UUID BodyAsset { get { return m_wearables[BODY].AssetID; } set { m_wearables[BODY].AssetID = value; } } - public virtual LLUUID SkinItem { + public virtual UUID SkinItem { get { return m_wearables[SKIN].ItemID; } set { m_wearables[SKIN].ItemID = value; } } - public virtual LLUUID SkinAsset { + public virtual UUID SkinAsset { get { return m_wearables[SKIN].AssetID; } set { m_wearables[SKIN].AssetID = value; } } - public virtual LLUUID HairItem { + public virtual UUID HairItem { get { return m_wearables[HAIR].ItemID; } set { m_wearables[HAIR].ItemID = value; } } - public virtual LLUUID HairAsset { + public virtual UUID HairAsset { get { return m_wearables[HAIR].AssetID; } set { m_wearables[HAIR].AssetID = value; } } - public virtual LLUUID EyesItem { + public virtual UUID EyesItem { get { return m_wearables[EYES].ItemID; } set { m_wearables[EYES].ItemID = value; } } - public virtual LLUUID EyesAsset { + public virtual UUID EyesAsset { get { return m_wearables[EYES].AssetID; } set { m_wearables[EYES].AssetID = value; } } - public virtual LLUUID ShirtItem { + public virtual UUID ShirtItem { get { return m_wearables[SHIRT].ItemID; } set { m_wearables[SHIRT].ItemID = value; } } - public virtual LLUUID ShirtAsset { + public virtual UUID ShirtAsset { get { return m_wearables[SHIRT].AssetID; } set { m_wearables[SHIRT].AssetID = value; } } - public virtual LLUUID PantsItem { + public virtual UUID PantsItem { get { return m_wearables[PANTS].ItemID; } set { m_wearables[PANTS].ItemID = value; } } - public virtual LLUUID PantsAsset { + public virtual UUID PantsAsset { get { return m_wearables[PANTS].AssetID; } set { m_wearables[PANTS].AssetID = value; } } - public virtual LLUUID ShoesItem { + public virtual UUID ShoesItem { get { return m_wearables[SHOES].ItemID; } set { m_wearables[SHOES].ItemID = value; } } - public virtual LLUUID ShoesAsset { + public virtual UUID ShoesAsset { get { return m_wearables[SHOES].AssetID; } set { m_wearables[SHOES].AssetID = value; } } - public virtual LLUUID SocksItem { + public virtual UUID SocksItem { get { return m_wearables[SOCKS].ItemID; } set { m_wearables[SOCKS].ItemID = value; } } - public virtual LLUUID SocksAsset { + public virtual UUID SocksAsset { get { return m_wearables[SOCKS].AssetID; } set { m_wearables[SOCKS].AssetID = value; } } - public virtual LLUUID JacketItem { + public virtual UUID JacketItem { get { return m_wearables[JACKET].ItemID; } set { m_wearables[JACKET].ItemID = value; } } - public virtual LLUUID JacketAsset { + public virtual UUID JacketAsset { get { return m_wearables[JACKET].AssetID; } set { m_wearables[JACKET].AssetID = value; } } - public virtual LLUUID GlovesItem { + public virtual UUID GlovesItem { get { return m_wearables[GLOVES].ItemID; } set { m_wearables[GLOVES].ItemID = value; } } - public virtual LLUUID GlovesAsset { + public virtual UUID GlovesAsset { get { return m_wearables[GLOVES].AssetID; } set { m_wearables[GLOVES].AssetID = value; } } - public virtual LLUUID UnderShirtItem { + public virtual UUID UnderShirtItem { get { return m_wearables[UNDERSHIRT].ItemID; } set { m_wearables[UNDERSHIRT].ItemID = value; } } - public virtual LLUUID UnderShirtAsset { + public virtual UUID UnderShirtAsset { get { return m_wearables[UNDERSHIRT].AssetID; } set { m_wearables[UNDERSHIRT].AssetID = value; } } - public virtual LLUUID UnderPantsItem { + public virtual UUID UnderPantsItem { get { return m_wearables[UNDERPANTS].ItemID; } set { m_wearables[UNDERPANTS].ItemID = value; } } - public virtual LLUUID UnderPantsAsset { + public virtual UUID UnderPantsAsset { get { return m_wearables[UNDERPANTS].AssetID; } set { m_wearables[UNDERPANTS].AssetID = value; } } - public virtual LLUUID SkirtItem { + public virtual UUID SkirtItem { get { return m_wearables[SKIRT].ItemID; } set { m_wearables[SKIRT].ItemID = value; } } - public virtual LLUUID SkirtAsset { + public virtual UUID SkirtAsset { get { return m_wearables[SKIRT].AssetID; } set { m_wearables[SKIRT].AssetID = value; } } @@ -217,9 +217,9 @@ namespace OpenSim.Framework m_wearables[PANTS].ItemID = PANTS_ITEM; } - protected LLObject.TextureEntry m_texture; + protected Primitive.TextureEntry m_texture; - public virtual LLObject.TextureEntry Texture + public virtual Primitive.TextureEntry Texture { get { return m_texture; } set { m_texture = value; } @@ -242,13 +242,13 @@ namespace OpenSim.Framework m_wearables[i] = new AvatarWearable(); } m_serial = 0; - m_owner = LLUUID.Zero; + m_owner = UUID.Zero; m_visualparams = new byte[VISUALPARAM_COUNT]; SetDefaultWearables(); m_texture = GetDefaultTexture(); } - public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams) + public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams) { m_owner = avatarID; m_serial = 1; @@ -264,7 +264,7 @@ namespace OpenSim.Framework /// public virtual void SetAppearance(byte[] texture, List visualParam) { - LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); + Primitive.TextureEntry textureEnt = new Primitive.TextureEntry(texture, 0, texture.Length); m_texture = textureEnt; m_visualparams = visualParam.ToArray(); @@ -281,16 +281,16 @@ namespace OpenSim.Framework m_wearables[wearableId] = wearable; } - public static LLObject.TextureEntry GetDefaultTexture() + public static Primitive.TextureEntry GetDefaultTexture() { - LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); - textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); - textu.CreateFace(1).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); - textu.CreateFace(2).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); - textu.CreateFace(3).TextureID = new LLUUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); - textu.CreateFace(4).TextureID = new LLUUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); - textu.CreateFace(5).TextureID = new LLUUID("00000000-0000-1111-9999-000000000010"); - textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); + Primitive.TextureEntry textu = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); + textu.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); + textu.CreateFace(1).TextureID = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); + textu.CreateFace(2).TextureID = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); + textu.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); + textu.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); + textu.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); + textu.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011"); return textu; } @@ -313,13 +313,13 @@ namespace OpenSim.Framework throw new ArgumentNullException("info"); } - m_owner = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); + m_owner = new UUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); m_serial = (int)info.GetValue("m_wearablesSerial", typeof(int)); m_visualparams = (byte[])info.GetValue("m_visualParams", typeof(byte[])); m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[])); byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[])); - m_texture = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); + m_texture = new Primitive.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float)); @@ -371,10 +371,10 @@ namespace OpenSim.Framework public AvatarAppearance(Hashtable h) { - Owner = new LLUUID((string)h["owner"]); + Owner = new UUID((string)h["owner"]); Serial = Convert.ToInt32((string)h["serial"]); VisualParams = (byte[])h["visual_params"]; - Texture = new LLObject.TextureEntry((byte[])h["texture"], 0, ((byte[])h["texture"]).Length); + Texture = new Primitive.TextureEntry((byte[])h["texture"], 0, ((byte[])h["texture"]).Length); AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); m_wearables = new AvatarWearable[MAX_WEARABLES]; @@ -384,32 +384,32 @@ namespace OpenSim.Framework m_wearables[i] = new AvatarWearable(); } - BodyItem = new LLUUID((string)h["body_item"]); - BodyAsset = new LLUUID((string)h["body_asset"]); - SkinItem = new LLUUID((string)h["skin_item"]); - SkinAsset = new LLUUID((string)h["skin_asset"]); - HairItem = new LLUUID((string)h["hair_item"]); - HairAsset = new LLUUID((string)h["hair_asset"]); - EyesItem = new LLUUID((string)h["eyes_item"]); - EyesAsset = new LLUUID((string)h["eyes_asset"]); - ShirtItem = new LLUUID((string)h["shirt_item"]); - ShirtAsset = new LLUUID((string)h["shirt_asset"]); - PantsItem = new LLUUID((string)h["pants_item"]); - PantsAsset = new LLUUID((string)h["pants_asset"]); - ShoesItem = new LLUUID((string)h["shoes_item"]); - ShoesAsset = new LLUUID((string)h["shoes_asset"]); - SocksItem = new LLUUID((string)h["socks_item"]); - SocksAsset = new LLUUID((string)h["socks_asset"]); - JacketItem = new LLUUID((string)h["jacket_item"]); - JacketAsset = new LLUUID((string)h["jacket_asset"]); - GlovesItem = new LLUUID((string)h["gloves_item"]); - GlovesAsset = new LLUUID((string)h["gloves_asset"]); - UnderShirtItem = new LLUUID((string)h["undershirt_item"]); - UnderShirtAsset = new LLUUID((string)h["undershirt_asset"]); - UnderPantsItem = new LLUUID((string)h["underpants_item"]); - UnderPantsAsset = new LLUUID((string)h["underpants_asset"]); - SkirtItem = new LLUUID((string)h["skirt_item"]); - SkirtAsset = new LLUUID((string)h["skirt_asset"]); + BodyItem = new UUID((string)h["body_item"]); + BodyAsset = new UUID((string)h["body_asset"]); + SkinItem = new UUID((string)h["skin_item"]); + SkinAsset = new UUID((string)h["skin_asset"]); + HairItem = new UUID((string)h["hair_item"]); + HairAsset = new UUID((string)h["hair_asset"]); + EyesItem = new UUID((string)h["eyes_item"]); + EyesAsset = new UUID((string)h["eyes_asset"]); + ShirtItem = new UUID((string)h["shirt_item"]); + ShirtAsset = new UUID((string)h["shirt_asset"]); + PantsItem = new UUID((string)h["pants_item"]); + PantsAsset = new UUID((string)h["pants_asset"]); + ShoesItem = new UUID((string)h["shoes_item"]); + ShoesAsset = new UUID((string)h["shoes_asset"]); + SocksItem = new UUID((string)h["socks_item"]); + SocksAsset = new UUID((string)h["socks_asset"]); + JacketItem = new UUID((string)h["jacket_item"]); + JacketAsset = new UUID((string)h["jacket_asset"]); + GlovesItem = new UUID((string)h["gloves_item"]); + GlovesAsset = new UUID((string)h["gloves_asset"]); + UnderShirtItem = new UUID((string)h["undershirt_item"]); + UnderShirtAsset = new UUID((string)h["undershirt_asset"]); + UnderPantsItem = new UUID((string)h["underpants_item"]); + UnderPantsAsset = new UUID((string)h["underpants_asset"]); + SkirtItem = new UUID((string)h["skirt_item"]); + SkirtAsset = new UUID((string)h["skirt_asset"]); if (h.ContainsKey("attachments")) { @@ -427,7 +427,7 @@ namespace OpenSim.Framework throw new ArgumentNullException("info"); } - info.AddValue("m_scenePresenceID", m_owner.UUID); + info.AddValue("m_scenePresenceID", m_owner.Guid); info.AddValue("m_wearablesSerial", m_serial); info.AddValue("m_visualParams", m_visualparams); info.AddValue("m_wearables", m_wearables); @@ -435,7 +435,7 @@ namespace OpenSim.Framework info.AddValue("m_avatarHeight", m_avatarHeight); } - private Dictionary m_attachments = new Dictionary(); + private Dictionary m_attachments = new Dictionary(); public void SetAttachments(Hashtable data) { @@ -451,14 +451,14 @@ namespace OpenSim.Framework if (m_attachments.ContainsKey(attachpoint)) continue; - LLUUID item; - LLUUID asset; + UUID item; + UUID asset; Hashtable uuids = (Hashtable) e.Value; - LLUUID.TryParse(uuids["item"].ToString(), out item); - LLUUID.TryParse(uuids["asset"].ToString(), out asset); + UUID.TryParse(uuids["item"].ToString(), out item); + UUID.TryParse(uuids["asset"].ToString(), out asset); - LLUUID[] attachment = new LLUUID[2]; + UUID[] attachment = new UUID[2]; attachment[0] = item; attachment[1] = asset; @@ -473,10 +473,10 @@ namespace OpenSim.Framework Hashtable ret = new Hashtable(); - foreach (KeyValuePair kvp in m_attachments) + foreach (KeyValuePair kvp in m_attachments) { int attachpoint = kvp.Key; - LLUUID[] uuids = kvp.Value; + UUID[] uuids = kvp.Value; Hashtable data = new Hashtable(); data["item"] = uuids[0].ToString(); @@ -493,28 +493,28 @@ namespace OpenSim.Framework return new List(m_attachments.Keys); } - public LLUUID GetAttachedItem(int attachpoint) + public UUID GetAttachedItem(int attachpoint) { if (!m_attachments.ContainsKey(attachpoint)) - return LLUUID.Zero; + return UUID.Zero; return m_attachments[attachpoint][0]; } - public LLUUID GetAttachedAsset(int attachpoint) + public UUID GetAttachedAsset(int attachpoint) { if (!m_attachments.ContainsKey(attachpoint)) - return LLUUID.Zero; + return UUID.Zero; return m_attachments[attachpoint][1]; } - public void SetAttachment(int attachpoint, LLUUID item, LLUUID asset) + public void SetAttachment(int attachpoint, UUID item, UUID asset) { if (attachpoint == 0) return; - if (item == LLUUID.Zero) + if (item == UUID.Zero) { if (m_attachments.ContainsKey(attachpoint)) m_attachments.Remove(attachpoint); @@ -522,15 +522,15 @@ namespace OpenSim.Framework } if (!m_attachments.ContainsKey(attachpoint)) - m_attachments[attachpoint] = new LLUUID[2]; + m_attachments[attachpoint] = new UUID[2]; m_attachments[attachpoint][0] = item; m_attachments[attachpoint][1] = asset; } - public int GetAttachpoint(LLUUID itemID) + public int GetAttachpoint(UUID itemID) { - foreach (KeyValuePair kvp in m_attachments) + foreach (KeyValuePair kvp in m_attachments) { if (kvp.Value[0] == itemID) { @@ -540,7 +540,7 @@ namespace OpenSim.Framework return 0; } - public void DetachAttachment(LLUUID itemID) + public void DetachAttachment(UUID itemID) { int attachpoint = GetAttachpoint(itemID); @@ -552,7 +552,7 @@ namespace OpenSim.Framework { List strings = new List(); - foreach (KeyValuePair e in m_attachments) + foreach (KeyValuePair e in m_attachments) { strings.Add(e.Key.ToString()); strings.Add(e.Value[0].ToString()); @@ -572,13 +572,13 @@ namespace OpenSim.Framework while (strings.Length - i > 2) { int attachpoint = Int32.Parse(strings[i]); - LLUUID item = new LLUUID(strings[i+1]); - LLUUID asset = new LLUUID(strings[i+2]); + UUID item = new UUID(strings[i+1]); + UUID asset = new UUID(strings[i+2]); i += 3; if (!m_attachments.ContainsKey(attachpoint)) { - m_attachments[attachpoint] = new LLUUID[2]; + m_attachments[attachpoint] = new UUID[2]; m_attachments[attachpoint][0] = item; m_attachments[attachpoint][1] = asset; } -- cgit v1.1 From 1ff9709ea3d5e7c9ef21f6f59ae0dce62dd7b1c4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 28 Oct 2008 21:31:23 +0000 Subject: * Possibly fix grey avatar appearance problems * And hopefully rebaking all the time should no longer be necessary now * It turns out that when the client baked the texture, the uploaded asset had the Temporary flag to true (Temporary is actually deprecated). * It also had the StoreLocal flag set to true, which signifies that the asset should be stored locally. If it disappears we should reply to the asset request with ImageNotInDatabasePacket * However, last time this was enabled some clients started crashing. This may well no longer be the case and needs to be tested, but in the mean time we will store the asset instead. * This needs to be resolved in a better way, possibly by starting to send the ImageNotInDatabase packet again instead --- OpenSim/Framework/AvatarAppearance.cs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 0c0cfd5..e1d0bbe 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -28,8 +28,10 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Reflection; using System.Runtime.Serialization; using System.Security.Permissions; +using log4net; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; @@ -39,6 +41,9 @@ namespace OpenSim.Framework [Serializable] public class AvatarAppearance : ISerializable { +// private static readonly ILog m_log +// = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // these are guessed at by the list here - // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll // correct them over time for when were are wrong. @@ -258,7 +263,7 @@ namespace OpenSim.Framework } /// - /// + /// Set up appearance textures and avatar parameters, including a height calculation /// /// /// @@ -266,7 +271,15 @@ namespace OpenSim.Framework { Primitive.TextureEntry textureEnt = new Primitive.TextureEntry(texture, 0, texture.Length); m_texture = textureEnt; - + +// m_log.DebugFormat("[APPEARANCE]: Setting an avatar appearance with {0} faces", m_texture.FaceTextures.Length); +// for (int i = 0; i < m_texture.FaceTextures.Length; i++) +// { +// Primitive.TextureEntryFace face = m_texture.FaceTextures[i]; +// String textureIdString = (face != null ? face.TextureID.ToString() : "none"); +// m_log.DebugFormat("[APPEARANCE]: Texture {0} is {1}", i, textureIdString); +// } + m_visualparams = visualParam.ToArray(); // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. @@ -297,10 +310,10 @@ namespace OpenSim.Framework public override String ToString() { String s = "[Wearables] =>"; - s += "Body Item: " + BodyItem.ToString() + ";"; - s += "Skin Item: " + SkinItem.ToString() + ";"; - s += "Shirt Item: " + ShirtItem.ToString() + ";"; - s += "Pants Item: " + PantsItem.ToString() + ";"; + s += " Body Item: " + BodyItem.ToString() + ";"; + s += " Skin Item: " + SkinItem.ToString() + ";"; + s += " Shirt Item: " + ShirtItem.ToString() + ";"; + s += " Pants Item: " + PantsItem.ToString() + ";"; return s; } -- cgit v1.1 From cf0a14bec94322656f57890d49fead85ed31730e Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 8 Nov 2008 17:20:54 +0000 Subject: * Added IClientIM to IClientCore interfaces * Changed SendInstantMessage, dropped fromAgentSession and imSessionID as security precaution, see http://opensimulator.org/wiki/OpenSim_0.6_IClientAPI#Porting_Guide for details on porting. * Removed unused usings from Framework.* --- OpenSim/Framework/AvatarAppearance.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index e1d0bbe..74a9f92 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -28,13 +28,9 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Reflection; using System.Runtime.Serialization; using System.Security.Permissions; -using log4net; using OpenMetaverse; -using OpenMetaverse.Packets; -using OpenSim.Framework; namespace OpenSim.Framework { -- cgit v1.1 From ce37b80c685d089c89311671f526936d39ae965a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2008 01:28:37 +0000 Subject: Thank you, idb, for a patch that fixes avatar height calculation Our feet will now be above ground --- OpenSim/Framework/AvatarAppearance.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 74a9f92..f2ceb20 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -267,22 +267,15 @@ namespace OpenSim.Framework { Primitive.TextureEntry textureEnt = new Primitive.TextureEntry(texture, 0, texture.Length); m_texture = textureEnt; - -// m_log.DebugFormat("[APPEARANCE]: Setting an avatar appearance with {0} faces", m_texture.FaceTextures.Length); -// for (int i = 0; i < m_texture.FaceTextures.Length; i++) -// { -// Primitive.TextureEntryFace face = m_texture.FaceTextures[i]; -// String textureIdString = (face != null ? face.TextureID.ToString() : "none"); -// m_log.DebugFormat("[APPEARANCE]: Texture {0} is {1}", i, textureIdString); -// } - m_visualparams = visualParam.ToArray(); + m_avatarHeight = 1.23077f // Shortest possible avatar height + + 0.516945f * (float)m_visualparams[25] / 255.0f // Body height + + 0.072514f * (float)m_visualparams[120] / 255.0f // Head size + + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length + + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length - // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. - // (float)m_visualParams[25] = Height - // (float)m_visualParams[125] = LegLength - m_avatarHeight = (1.50856f + (((float) m_visualparams[25]/255.0f)*(2.525506f - 1.50856f))) - + (((float) m_visualparams[125]/255.0f)/1.5f); } public virtual void SetWearable(int wearableId, AvatarWearable wearable) -- cgit v1.1 From c79a11cbd1eeb8359ad08178830c94cc0d52f877 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 14 Nov 2008 03:32:20 +0000 Subject: Lots of experimentation yielded a fair approximation of a hip offset from the physical center of an avatar, for display purposes. This should keep the avatar feet above ground visually in most cases. Tweaked for both height extremes and various leg lengths. Improvements welcome --- OpenSim/Framework/AvatarAppearance.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index f2ceb20..f549461 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -227,6 +227,7 @@ namespace OpenSim.Framework } protected float m_avatarHeight = 0; + protected float m_hipOffset = 0; public virtual float AvatarHeight { @@ -234,6 +235,11 @@ namespace OpenSim.Framework set { m_avatarHeight = value; } } + public virtual float HipOffset + { + get { return m_hipOffset; } + } + public AvatarAppearance() { m_wearables = new AvatarWearable[MAX_WEARABLES]; @@ -275,7 +281,12 @@ namespace OpenSim.Framework + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length - + m_hipOffset = (0.615385f // Half of avatar + + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length + - m_avatarHeight / 2) * 0.3f - 0.04f; + System.Console.WriteLine("Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); } public virtual void SetWearable(int wearableId, AvatarWearable wearable) -- cgit v1.1 From 558704be8bf96a58fe18dac19cfb37a81dbba57b Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 17 Nov 2008 16:14:23 +0000 Subject: * Remove the TransferRequest and hip debugging console output that crept in recently --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index f549461..224e9a3 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -286,7 +286,7 @@ namespace OpenSim.Framework + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length - m_avatarHeight / 2) * 0.3f - 0.04f; - System.Console.WriteLine("Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); + //System.Console.WriteLine("Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); } public virtual void SetWearable(int wearableId, AvatarWearable wearable) -- cgit v1.1 From e7ac639f3a8a05858df03a8b5fd611826a56ae97 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 5 Jan 2009 19:36:48 +0000 Subject: * Centralize references to the well known blank texture 5748decc-f629-461c-9a36-a35a221fe21f to a constant in OpenSim.Framework.Util --- OpenSim/Framework/AvatarAppearance.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 224e9a3..ad95f78 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -298,8 +298,8 @@ namespace OpenSim.Framework { Primitive.TextureEntry textu = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); textu.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); - textu.CreateFace(1).TextureID = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); - textu.CreateFace(2).TextureID = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); + textu.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID; + textu.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID; textu.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); textu.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); textu.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); @@ -319,8 +319,6 @@ namespace OpenSim.Framework protected AvatarAppearance(SerializationInfo info, StreamingContext context) { - //System.Console.WriteLine("AvatarAppearance Deserialize BGN"); - if (info == null) { throw new ArgumentNullException("info"); -- cgit v1.1 From 7cc906213795fbe4878c0cfb8351272e847617e9 Mon Sep 17 00:00:00 2001 From: diva Date: Tue, 17 Feb 2009 00:35:52 +0000 Subject: Major change to how appearance is managed, including changes in login and user service/server. Appearance is now sent by the user service/server along with all other loginparams. Regions don't query the user service for appearance anymore. The appearance is passed along from region to region as the avie moves around. And, as before, it's stored back with the user service as the client changes the avie's appearance. Child agents have default appearances that are set to the actual appearance when the avie moves to that region. (as before, child agents are invisible and non-physical). --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index ad95f78..52041bb 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -286,7 +286,7 @@ namespace OpenSim.Framework + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length - m_avatarHeight / 2) * 0.3f - 0.04f; - //System.Console.WriteLine("Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); + //System.Console.WriteLine("[APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); } public virtual void SetWearable(int wearableId, AvatarWearable wearable) -- cgit v1.1 From 99b051ccbe7b0f43e8bd5cc8c0012b40e24cb752 Mon Sep 17 00:00:00 2001 From: diva Date: Sun, 22 Feb 2009 01:26:11 +0000 Subject: Addresses some issues with appearance after TPs. Appearance.Owner was not being set, and that's what's being used in SendAppearanceToOtherAgent. Mantis #3204. --- OpenSim/Framework/AvatarAppearance.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 52041bb..d8fcf74 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -241,6 +241,11 @@ namespace OpenSim.Framework } public AvatarAppearance() + : this(UUID.Zero) + { + } + + public AvatarAppearance(UUID owner) { m_wearables = new AvatarWearable[MAX_WEARABLES]; for (int i = 0; i < MAX_WEARABLES; i++) @@ -249,7 +254,7 @@ namespace OpenSim.Framework m_wearables[i] = new AvatarWearable(); } m_serial = 0; - m_owner = UUID.Zero; + m_owner = owner; m_visualparams = new byte[VISUALPARAM_COUNT]; SetDefaultWearables(); m_texture = GetDefaultTexture(); @@ -286,7 +291,18 @@ namespace OpenSim.Framework + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length - m_avatarHeight / 2) * 0.3f - 0.04f; - //System.Console.WriteLine("[APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); + //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); + //System.Console.WriteLine("------------- Set Appearance Texture ---------------"); + //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; + //foreach (Primitive.TextureEntryFace face in faces) + //{ + // if (face != null) + // System.Console.WriteLine(" ++ " + face.TextureID); + // else + // System.Console.WriteLine(" ++ NULL "); + //} + //System.Console.WriteLine("----------------------------"); + } public virtual void SetWearable(int wearableId, AvatarWearable wearable) -- cgit v1.1 From 8f55b9d735fbc975ce7a4b54e972c17ffbfb1f49 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 22 Feb 2009 20:52:55 +0000 Subject: Mantis#3218. Thank you kindly, TLaukkan (Tommil) for a patch that: * Added log4net dependency to physxplugin in prebuild.xml. * Added missing m_log fields to classes. * Replaced Console.WriteLine with appropriate m_log.Xxxx * Tested that nant test target runs succesfully. * Tested that local opensim sandbox starts up without errors. --- OpenSim/Framework/AvatarAppearance.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index d8fcf74..a6cec76 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -291,17 +291,17 @@ namespace OpenSim.Framework + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length - m_avatarHeight / 2) * 0.3f - 0.04f; - //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); - //System.Console.WriteLine("------------- Set Appearance Texture ---------------"); + //m_log.Debug(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); + //m_log.Debug("------------- Set Appearance Texture ---------------"); //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; //foreach (Primitive.TextureEntryFace face in faces) //{ // if (face != null) - // System.Console.WriteLine(" ++ " + face.TextureID); + // m_log.Debug(" ++ " + face.TextureID); // else - // System.Console.WriteLine(" ++ NULL "); + // m_log.Debug(" ++ NULL "); //} - //System.Console.WriteLine("----------------------------"); + //m_log.Debug("----------------------------"); } @@ -350,7 +350,7 @@ namespace OpenSim.Framework m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float)); - //System.Console.WriteLine("AvatarAppearance Deserialize END"); + //m_log.Debug("AvatarAppearance Deserialize END"); } // this is used for OGS1 -- cgit v1.1 From 0de34e9a183d596dc051fa708517dcb99a35abae Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 5 Mar 2009 18:36:37 +0000 Subject: * remove now unused serialization code --- OpenSim/Framework/AvatarAppearance.cs | 66 ++++++++++++++--------------------- 1 file changed, 26 insertions(+), 40 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a6cec76..9e33ebc 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -34,8 +34,7 @@ using OpenMetaverse; namespace OpenSim.Framework { - [Serializable] - public class AvatarAppearance : ISerializable + public class AvatarAppearance { // private static readonly ILog m_log // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -105,102 +104,127 @@ namespace OpenSim.Framework get { return m_wearables[BODY].ItemID; } set { m_wearables[BODY].ItemID = value; } } + public virtual UUID BodyAsset { get { return m_wearables[BODY].AssetID; } set { m_wearables[BODY].AssetID = value; } } + public virtual UUID SkinItem { get { return m_wearables[SKIN].ItemID; } set { m_wearables[SKIN].ItemID = value; } } + public virtual UUID SkinAsset { get { return m_wearables[SKIN].AssetID; } set { m_wearables[SKIN].AssetID = value; } } + public virtual UUID HairItem { get { return m_wearables[HAIR].ItemID; } set { m_wearables[HAIR].ItemID = value; } } + public virtual UUID HairAsset { get { return m_wearables[HAIR].AssetID; } set { m_wearables[HAIR].AssetID = value; } } + public virtual UUID EyesItem { get { return m_wearables[EYES].ItemID; } set { m_wearables[EYES].ItemID = value; } } + public virtual UUID EyesAsset { get { return m_wearables[EYES].AssetID; } set { m_wearables[EYES].AssetID = value; } } + public virtual UUID ShirtItem { get { return m_wearables[SHIRT].ItemID; } set { m_wearables[SHIRT].ItemID = value; } } + public virtual UUID ShirtAsset { get { return m_wearables[SHIRT].AssetID; } set { m_wearables[SHIRT].AssetID = value; } } + public virtual UUID PantsItem { get { return m_wearables[PANTS].ItemID; } set { m_wearables[PANTS].ItemID = value; } } + public virtual UUID PantsAsset { get { return m_wearables[PANTS].AssetID; } set { m_wearables[PANTS].AssetID = value; } } + public virtual UUID ShoesItem { get { return m_wearables[SHOES].ItemID; } set { m_wearables[SHOES].ItemID = value; } } + public virtual UUID ShoesAsset { get { return m_wearables[SHOES].AssetID; } set { m_wearables[SHOES].AssetID = value; } } + public virtual UUID SocksItem { get { return m_wearables[SOCKS].ItemID; } set { m_wearables[SOCKS].ItemID = value; } } + public virtual UUID SocksAsset { get { return m_wearables[SOCKS].AssetID; } set { m_wearables[SOCKS].AssetID = value; } } + public virtual UUID JacketItem { get { return m_wearables[JACKET].ItemID; } set { m_wearables[JACKET].ItemID = value; } } + public virtual UUID JacketAsset { get { return m_wearables[JACKET].AssetID; } set { m_wearables[JACKET].AssetID = value; } } + public virtual UUID GlovesItem { get { return m_wearables[GLOVES].ItemID; } set { m_wearables[GLOVES].ItemID = value; } } + public virtual UUID GlovesAsset { get { return m_wearables[GLOVES].AssetID; } set { m_wearables[GLOVES].AssetID = value; } } + public virtual UUID UnderShirtItem { get { return m_wearables[UNDERSHIRT].ItemID; } set { m_wearables[UNDERSHIRT].ItemID = value; } } + public virtual UUID UnderShirtAsset { get { return m_wearables[UNDERSHIRT].AssetID; } set { m_wearables[UNDERSHIRT].AssetID = value; } } + public virtual UUID UnderPantsItem { get { return m_wearables[UNDERPANTS].ItemID; } set { m_wearables[UNDERPANTS].ItemID = value; } } + public virtual UUID UnderPantsAsset { get { return m_wearables[UNDERPANTS].AssetID; } set { m_wearables[UNDERPANTS].AssetID = value; } } + public virtual UUID SkirtItem { get { return m_wearables[SKIRT].ItemID; } set { m_wearables[SKIRT].ItemID = value; } } + public virtual UUID SkirtAsset { get { return m_wearables[SKIRT].AssetID; } set { m_wearables[SKIRT].AssetID = value; } @@ -333,26 +357,6 @@ namespace OpenSim.Framework return s; } - protected AvatarAppearance(SerializationInfo info, StreamingContext context) - { - if (info == null) - { - throw new ArgumentNullException("info"); - } - - m_owner = new UUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); - m_serial = (int)info.GetValue("m_wearablesSerial", typeof(int)); - m_visualparams = (byte[])info.GetValue("m_visualParams", typeof(byte[])); - m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[])); - - byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[])); - m_texture = new Primitive.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); - - m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float)); - - //m_log.Debug("AvatarAppearance Deserialize END"); - } - // this is used for OGS1 public virtual Hashtable ToHashTable() { @@ -444,24 +448,6 @@ namespace OpenSim.Framework } } - [SecurityPermission(SecurityAction.LinkDemand, - Flags = SecurityPermissionFlag.SerializationFormatter)] - public virtual void GetObjectData( - SerializationInfo info, StreamingContext context) - { - if (info == null) - { - throw new ArgumentNullException("info"); - } - - info.AddValue("m_scenePresenceID", m_owner.Guid); - info.AddValue("m_wearablesSerial", m_serial); - info.AddValue("m_visualParams", m_visualparams); - info.AddValue("m_wearables", m_wearables); - info.AddValue("m_textureEntry", m_texture.ToBytes()); - info.AddValue("m_avatarHeight", m_avatarHeight); - } - private Dictionary m_attachments = new Dictionary(); public void SetAttachments(Hashtable data) -- cgit v1.1 From 6323516a834b5f3dc8056b4107e216c341a42166 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 25 Mar 2009 20:15:46 +0000 Subject: * Appearance patches suite: These patches are applied to allow libomv bots to wear outfits in the future. This functionality will be upstreamed later. ** Fixed call of new AvatarAppearance without arguments, which caused bots look like clouds of gas ** Added a SendAvatarData in ScenePresence.SetAppearance, which is expected after SetAppearance is run ** Fixed AssetXferUploader: CallbackID wasn't being passed on on multiple packets asset uploads ** Set VisualParams in AvatarAppearance to stop the alien looking bot from spawning and now looks a little better. *** TODO: Set better VisualParams value then 150 to everything --- OpenSim/Framework/AvatarAppearance.cs | 63 ++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 26 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 9e33ebc..9544d5a 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -38,7 +38,7 @@ namespace OpenSim.Framework { // private static readonly ILog m_log // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + // these are guessed at by the list here - // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll // correct them over time for when were are wrong. @@ -104,127 +104,127 @@ namespace OpenSim.Framework get { return m_wearables[BODY].ItemID; } set { m_wearables[BODY].ItemID = value; } } - + public virtual UUID BodyAsset { get { return m_wearables[BODY].AssetID; } set { m_wearables[BODY].AssetID = value; } } - + public virtual UUID SkinItem { get { return m_wearables[SKIN].ItemID; } set { m_wearables[SKIN].ItemID = value; } } - + public virtual UUID SkinAsset { get { return m_wearables[SKIN].AssetID; } set { m_wearables[SKIN].AssetID = value; } } - + public virtual UUID HairItem { get { return m_wearables[HAIR].ItemID; } set { m_wearables[HAIR].ItemID = value; } } - + public virtual UUID HairAsset { get { return m_wearables[HAIR].AssetID; } set { m_wearables[HAIR].AssetID = value; } } - + public virtual UUID EyesItem { get { return m_wearables[EYES].ItemID; } set { m_wearables[EYES].ItemID = value; } } - + public virtual UUID EyesAsset { get { return m_wearables[EYES].AssetID; } set { m_wearables[EYES].AssetID = value; } } - + public virtual UUID ShirtItem { get { return m_wearables[SHIRT].ItemID; } set { m_wearables[SHIRT].ItemID = value; } } - + public virtual UUID ShirtAsset { get { return m_wearables[SHIRT].AssetID; } set { m_wearables[SHIRT].AssetID = value; } } - + public virtual UUID PantsItem { get { return m_wearables[PANTS].ItemID; } set { m_wearables[PANTS].ItemID = value; } } - + public virtual UUID PantsAsset { get { return m_wearables[PANTS].AssetID; } set { m_wearables[PANTS].AssetID = value; } } - + public virtual UUID ShoesItem { get { return m_wearables[SHOES].ItemID; } set { m_wearables[SHOES].ItemID = value; } } - + public virtual UUID ShoesAsset { get { return m_wearables[SHOES].AssetID; } set { m_wearables[SHOES].AssetID = value; } } - + public virtual UUID SocksItem { get { return m_wearables[SOCKS].ItemID; } set { m_wearables[SOCKS].ItemID = value; } } - + public virtual UUID SocksAsset { get { return m_wearables[SOCKS].AssetID; } set { m_wearables[SOCKS].AssetID = value; } } - + public virtual UUID JacketItem { get { return m_wearables[JACKET].ItemID; } set { m_wearables[JACKET].ItemID = value; } } - + public virtual UUID JacketAsset { get { return m_wearables[JACKET].AssetID; } set { m_wearables[JACKET].AssetID = value; } } - + public virtual UUID GlovesItem { get { return m_wearables[GLOVES].ItemID; } set { m_wearables[GLOVES].ItemID = value; } } - + public virtual UUID GlovesAsset { get { return m_wearables[GLOVES].AssetID; } set { m_wearables[GLOVES].AssetID = value; } } - + public virtual UUID UnderShirtItem { get { return m_wearables[UNDERSHIRT].ItemID; } set { m_wearables[UNDERSHIRT].ItemID = value; } } - + public virtual UUID UnderShirtAsset { get { return m_wearables[UNDERSHIRT].AssetID; } set { m_wearables[UNDERSHIRT].AssetID = value; } } - + public virtual UUID UnderPantsItem { get { return m_wearables[UNDERPANTS].ItemID; } set { m_wearables[UNDERPANTS].ItemID = value; } } - + public virtual UUID UnderPantsAsset { get { return m_wearables[UNDERPANTS].AssetID; } set { m_wearables[UNDERPANTS].AssetID = value; } } - + public virtual UUID SkirtItem { get { return m_wearables[SKIRT].ItemID; } set { m_wearables[SKIRT].ItemID = value; } } - + public virtual UUID SkirtAsset { get { return m_wearables[SKIRT].AssetID; } set { m_wearables[SKIRT].AssetID = value; } @@ -242,6 +242,15 @@ namespace OpenSim.Framework m_wearables[PANTS].ItemID = PANTS_ITEM; } + public virtual void SetDefaultParams(byte[] vparams) + { + // TODO: Figure out better values then 'fat scientist 150' or 'alien 0' + for (int i = 0; i < VISUALPARAM_COUNT; i++) + { + vparams[i] = 150; + } + } + protected Primitive.TextureEntry m_texture; public virtual Primitive.TextureEntry Texture @@ -280,6 +289,8 @@ namespace OpenSim.Framework m_serial = 0; m_owner = owner; m_visualparams = new byte[VISUALPARAM_COUNT]; + // This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist + SetDefaultParams(m_visualparams); SetDefaultWearables(); m_texture = GetDefaultTexture(); } -- cgit v1.1 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/Framework/AvatarAppearance.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 9544d5a..8d0d699 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -321,12 +321,12 @@ namespace OpenSim.Framework + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length - m_hipOffset = (0.615385f // Half of avatar + m_hipOffset = (0.615385f // Half of avatar + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length - m_avatarHeight / 2) * 0.3f - 0.04f; - //m_log.Debug(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); + //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}" + m_avatarHeight + " " + m_hipOffset); //m_log.Debug("------------- Set Appearance Texture ---------------"); //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; //foreach (Primitive.TextureEntryFace face in faces) @@ -358,6 +358,17 @@ namespace OpenSim.Framework return textu; } + public static byte[] GetDefaultVisualParams() + { + byte[] visualParams; + visualParams = new byte[VISUALPARAM_COUNT]; + for (int i = 0; i < VISUALPARAM_COUNT; i++) + { + visualParams[i] = 100; + } + return visualParams; + } + public override String ToString() { String s = "[Wearables] =>"; -- cgit v1.1 From 52c482a7a7b297715cbcd7460edb1ad07d7a06c6 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 27 Mar 2009 22:13:09 +0000 Subject: * This updates LibOMV to the current release 0.6.0 on March 19 2009 * Important: HttpServer.dll was changed to HttpServer_OpenSim.dll so that the HttpServer references do not conflict if you've copied the OpenMetaverse.Http.dll and requirements to the OpenSimulator bin folder. This means that if you reference HttpServer.dll in any projects, you will need to change the reference to HttpServer_OpenSim.dll. It still uses the Same HttpServer namespace though. --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 8d0d699..ec31018 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -386,7 +386,7 @@ namespace OpenSim.Framework h["owner"] = Owner.ToString(); h["serial"] = Serial.ToString(); h["visual_params"] = VisualParams; - h["texture"] = Texture.ToBytes(); + h["texture"] = Texture.GetBytes(); h["avatar_height"] = AvatarHeight.ToString(); h["body_item"] = BodyItem.ToString(); h["body_asset"] = BodyAsset.ToString(); -- cgit v1.1 From e3e7e73db3fe99761ba090910634c86caacd7a3c Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 30 May 2009 16:13:40 +0000 Subject: Added option (on my default) to the clone avatar function so that the clothes and attachments that the target avatar is wearing, to begin with, are removed. So the end result isn't a merger of those clothes/attachments and the ones the template avatar is wearing. Added IPAddress ListenIPAddress property to BaseHttpServer so that the listening/binding IP can be set. --- OpenSim/Framework/AvatarAppearance.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index ec31018..aee16c4 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -242,6 +242,15 @@ namespace OpenSim.Framework m_wearables[PANTS].ItemID = PANTS_ITEM; } + public virtual void ClearWearables() + { + for (int i = 0; i < 13; i++) + { + m_wearables[i].AssetID = UUID.Zero; + m_wearables[i].ItemID = UUID.Zero; + } + } + public virtual void SetDefaultParams(byte[] vparams) { // TODO: Figure out better values then 'fat scientist 150' or 'alien 0' @@ -583,6 +592,11 @@ namespace OpenSim.Framework m_attachments.Remove(attachpoint); } + public void ClearAttachments() + { + m_attachments.Clear(); + } + string GetAttachmentsString() { List strings = new List(); -- cgit v1.1 From 840de6c036570d559ec6924cd8405d3f34a99fdd Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 1 Jun 2009 06:37:14 +0000 Subject: Minor: Change OpenSim to OpenSimulator in older copyright headers and LICENSE.txt. --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index aee16c4..0cc5fd8 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -9,7 +9,7 @@ * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the + * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * -- cgit v1.1 From fea3ffa15449a4b2c3835a5028931c602a81c62a Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 2 Aug 2009 06:38:52 +0000 Subject: * An enum for The VisualParams array that the viewer sends us with 90% of the documentation. * Automatically generated using the BuildVisualParamsEnum Method that gets data from the libOMV VisualParams NameValue definitions which they generate from the the avatar_lad.xml file * Want to know what element controls the eye size, jowls. pointy ears? no problem. --- OpenSim/Framework/AvatarAppearance.cs | 853 +++++++++++++++++++++++++++++++++- 1 file changed, 842 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 0cc5fd8..0b9ea42 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -31,13 +31,15 @@ using System.Collections.Generic; using System.Runtime.Serialization; using System.Security.Permissions; using OpenMetaverse; +using log4net; +using System.Reflection; namespace OpenSim.Framework { public class AvatarAppearance { -// private static readonly ILog m_log -// = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log + = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // these are guessed at by the list here - // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll @@ -69,6 +71,8 @@ namespace OpenSim.Framework public readonly static int VISUALPARAM_COUNT = 218; + + protected UUID m_owner; public virtual UUID Owner @@ -282,6 +286,65 @@ namespace OpenSim.Framework get { return m_hipOffset; } } + //Builds the VisualParam Enum using LIBOMV's Visual Param NameValues + /* + public void BuildVisualParamEnum() + { + Dictionary IndexedParams = new Dictionary(); + int vpIndex = 0; + IndexedParams = new Dictionary(); + + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + + sb.Append("public enum VPElement: int\n"); + sb.Append("{\n"); + foreach (KeyValuePair kvp in OpenMetaverse.VisualParams.Params) + { + VisualParam vp = kvp.Value; + + // Only Group-0 parameters are sent in AgentSetAppearance packets + if (kvp.Value.Group == 0) + { + + if (!IndexedParams.ContainsKey(vp.Name)) + { + + if (vp.Label.Length > 0 || vp.LabelMin.Length > 0 || vp.LabelMax.Length > 0) + { + + sb.Append("/// \n"); + if (vp.LabelMin.Length > 0 && vp.LabelMax.Length > 0) + sb.Append(string.Format("/// {0} - {1} 0--+255 {2}\n", vp.Label, vp.LabelMin, + vp.LabelMax)); + + else + sb.Append(string.Format("/// {0}\n", vp.Label)); + + sb.Append("/// \n"); + } + sb.Append(string.Format(" {0}_{1} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"),vpIndex)); + + IndexedParams.Add(vp.Name, vpIndex++); + } + else + { + sb.Append(string.Format(" {0}_{1}_{2} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"), vpIndex)); + vpIndex++; + //int i = 0; + } + } + if (vpIndex < 217) + sb.Append(",\n"); + else + sb.Append("\n"); + + } + sb.Append("}\n"); + + } + */ + + public AvatarAppearance() : this(UUID.Zero) { @@ -297,13 +360,16 @@ namespace OpenSim.Framework } m_serial = 0; m_owner = owner; + //BuildVisualParamEnum() m_visualparams = new byte[VISUALPARAM_COUNT]; // This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist SetDefaultParams(m_visualparams); SetDefaultWearables(); m_texture = GetDefaultTexture(); + } + public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams) { m_owner = avatarID; @@ -324,17 +390,20 @@ namespace OpenSim.Framework m_texture = textureEnt; m_visualparams = visualParam.ToArray(); m_avatarHeight = 1.23077f // Shortest possible avatar height - + 0.516945f * (float)m_visualparams[25] / 255.0f // Body height - + 0.072514f * (float)m_visualparams[120] / 255.0f // Head size - + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length - + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height - + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height - + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length + + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size + + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length + + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height + + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length m_hipOffset = (0.615385f // Half of avatar - + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height - + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height - + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length + + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height + + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length - m_avatarHeight / 2) * 0.3f - 0.04f; + + + //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}" + m_avatarHeight + " " + m_hipOffset); //m_log.Debug("------------- Set Appearance Texture ---------------"); //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; @@ -633,5 +702,767 @@ namespace OpenSim.Framework } } } + /// + /// Viewer Params Array Element for AgentSetAppearance + /// Generated from LibOMV's Visual Params list + /// + public enum VPElement : int + { + /// + /// Brow Size - Small 0--+255 Large + /// + SHAPE_BIG_BROW = 0, + /// + /// Nose Size - Small 0--+255 Large + /// + SHAPE_NOSE_BIG_OUT = 1, + /// + /// Nostril Width - Narrow 0--+255 Broad + /// + SHAPE_BROAD_NOSTRILS = 2, + /// + /// Chin Cleft - Round 0--+255 Cleft + /// + SHAPE_CLEFT_CHIN = 3, + /// + /// Nose Tip Shape - Pointy 0--+255 Bulbous + /// + SHAPE_BULBOUS_NOSE_TIP = 4, + /// + /// Chin Angle - Chin Out 0--+255 Chin In + /// + SHAPE_WEAK_CHIN = 5, + /// + /// Chin-Neck - Tight Chin 0--+255 Double Chin + /// + SHAPE_DOUBLE_CHIN = 6, + /// + /// Lower Cheeks - Well-Fed 0--+255 Sunken + /// + SHAPE_SUNKEN_CHEEKS = 7, + /// + /// Upper Bridge - Low 0--+255 High + /// + SHAPE_NOBLE_NOSE_BRIDGE = 8, + /// + /// - Less 0--+255 More + /// + SHAPE_JOWLS = 9, + /// + /// Upper Chin Cleft - Round 0--+255 Cleft + /// + SHAPE_CLEFT_CHIN_UPPER = 10, + /// + /// Cheek Bones - Low 0--+255 High + /// + SHAPE_HIGH_CHEEK_BONES = 11, + /// + /// Ear Angle - In 0--+255 Out + /// + SHAPE_EARS_OUT = 12, + /// + /// Eyebrow Points - Smooth 0--+255 Pointy + /// + HAIR_POINTY_EYEBROWS = 13, + /// + /// Jaw Shape - Pointy 0--+255 Square + /// + SHAPE_SQUARE_JAW = 14, + /// + /// Upper Cheeks - Thin 0--+255 Puffy + /// + SHAPE_PUFFY_UPPER_CHEEKS = 15, + /// + /// Nose Tip Angle - Downturned 0--+255 Upturned + /// + SHAPE_UPTURNED_NOSE_TIP = 16, + /// + /// Nose Thickness - Thin Nose 0--+255 Bulbous Nose + /// + SHAPE_BULBOUS_NOSE = 17, + /// + /// Upper Eyelid Fold - Uncreased 0--+255 Creased + /// + SHAPE_UPPER_EYELID_FOLD = 18, + /// + /// Attached Earlobes - Unattached 0--+255 Attached + /// + SHAPE_ATTACHED_EARLOBES = 19, + /// + /// Eye Bags - Smooth 0--+255 Baggy + /// + SHAPE_BAGGY_EYES = 20, + /// + /// Eye Opening - Narrow 0--+255 Wide + /// + SHAPE_WIDE_EYES = 21, + /// + /// Lip Cleft - Narrow 0--+255 Wide + /// + SHAPE_WIDE_LIP_CLEFT = 22, + /// + /// Bridge Width - Narrow 0--+255 Wide + /// + SHAPE_WIDE_NOSE_BRIDGE = 23, + /// + /// Eyebrow Arc - Flat 0--+255 Arced + /// + HAIR_ARCED_EYEBROWS = 24, + /// + /// Height - Short 0--+255 Tall + /// + SHAPE_HEIGHT = 25, + /// + /// Body Thickness - Body Thin 0--+255 Body Thick + /// + SHAPE_THICKNESS = 26, + /// + /// Ear Size - Small 0--+255 Large + /// + SHAPE_BIG_EARS = 27, + /// + /// Shoulders - Narrow 0--+255 Broad + /// + SHAPE_SHOULDERS = 28, + /// + /// Hip Width - Narrow 0--+255 Wide + /// + SHAPE_HIP_WIDTH = 29, + /// + /// - Short Torso 0--+255 Long Torso + /// + SHAPE_TORSO_LENGTH = 30, + SHAPE_MALE = 31, + /// + /// - Short 0--+255 Long + /// + GLOVES_GLOVE_LENGTH = 32, + /// + /// - Darker 0--+255 Lighter + /// + EYES_EYE_LIGHTNESS = 33, + /// + /// - Natural 0--+255 Unnatural + /// + EYES_EYE_COLOR = 34, + /// + /// - Small 0--+255 Large + /// + SHAPE_BREAST_SIZE = 35, + /// + /// - None 0--+255 Wild + /// + SKIN_RAINBOW_COLOR = 36, + /// + /// Ruddiness - Pale 0--+255 Ruddy + /// + SKIN_RED_SKIN = 37, + /// + /// - Light 0--+255 Dark + /// + SKIN_PIGMENT = 38, + HAIR_RAINBOW_COLOR_39 = 39, + /// + /// - No Red 0--+255 Very Red + /// + HAIR_RED_HAIR = 40, + /// + /// - Black 0--+255 Blonde + /// + HAIR_BLONDE_HAIR = 41, + /// + /// - No White 0--+255 All White + /// + HAIR_WHITE_HAIR = 42, + /// + /// - Less Rosy 0--+255 More Rosy + /// + SKIN_ROSY_COMPLEXION = 43, + /// + /// - Darker 0--+255 Pinker + /// + SKIN_LIP_PINKNESS = 44, + /// + /// - Thin Eyebrows 0--+255 Bushy Eyebrows + /// + HAIR_EYEBROW_SIZE = 45, + /// + /// - Short 0--+255 Long + /// + HAIR_FRONT_FRINGE = 46, + /// + /// - Short 0--+255 Long + /// + HAIR_SIDE_FRINGE = 47, + /// + /// - Short 0--+255 Long + /// + HAIR_BACK_FRINGE = 48, + /// + /// - Short 0--+255 Long + /// + HAIR_HAIR_FRONT = 49, + /// + /// - Short 0--+255 Long + /// + HAIR_HAIR_SIDES = 50, + /// + /// - Short 0--+255 Long + /// + HAIR_HAIR_BACK = 51, + /// + /// - Sweep Forward 0--+255 Sweep Back + /// + HAIR_HAIR_SWEEP = 52, + /// + /// - Left 0--+255 Right + /// + HAIR_HAIR_TILT = 53, + /// + /// Middle Part - No Part 0--+255 Part + /// + HAIR_HAIR_PART_MIDDLE = 54, + /// + /// Right Part - No Part 0--+255 Part + /// + HAIR_HAIR_PART_RIGHT = 55, + /// + /// Left Part - No Part 0--+255 Part + /// + HAIR_HAIR_PART_LEFT = 56, + /// + /// Full Hair Sides - Mowhawk 0--+255 Full Sides + /// + HAIR_HAIR_SIDES_FULL = 57, + /// + /// - Less 0--+255 More + /// + SKIN_BODY_DEFINITION = 58, + /// + /// Lip Width - Narrow Lips 0--+255 Wide Lips + /// + SHAPE_LIP_WIDTH = 59, + /// + /// - Small 0--+255 Big + /// + SHAPE_BELLY_SIZE = 60, + /// + /// - Less 0--+255 More + /// + SKIN_FACIAL_DEFINITION = 61, + /// + /// - Less 0--+255 More + /// + SKIN_WRINKLES = 62, + /// + /// - Less 0--+255 More + /// + SKIN_FRECKLES = 63, + /// + /// - Short Sideburns 0--+255 Mutton Chops + /// + HAIR_SIDEBURNS = 64, + /// + /// - Chaplin 0--+255 Handlebars + /// + HAIR_MOUSTACHE = 65, + /// + /// - Less soul 0--+255 More soul + /// + HAIR_SOULPATCH = 66, + /// + /// - Less Curtains 0--+255 More Curtains + /// + HAIR_CHIN_CURTAINS = 67, + /// + /// Rumpled Hair - Smooth Hair 0--+255 Rumpled Hair + /// + HAIR_HAIR_RUMPLED = 68, + /// + /// Big Hair Front - Less 0--+255 More + /// + HAIR_HAIR_BIG_FRONT = 69, + /// + /// Big Hair Top - Less 0--+255 More + /// + HAIR_HAIR_BIG_TOP = 70, + /// + /// Big Hair Back - Less 0--+255 More + /// + HAIR_HAIR_BIG_BACK = 71, + /// + /// Spiked Hair - No Spikes 0--+255 Big Spikes + /// + HAIR_HAIR_SPIKED = 72, + /// + /// Chin Depth - Shallow 0--+255 Deep + /// + SHAPE_DEEP_CHIN = 73, + /// + /// Part Bangs - No Part 0--+255 Part Bangs + /// + HAIR_BANGS_PART_MIDDLE = 74, + /// + /// Head Shape - More Square 0--+255 More Round + /// + SHAPE_HEAD_SHAPE = 75, + /// + /// Eye Spacing - Close Set Eyes 0--+255 Far Set Eyes + /// + SHAPE_EYE_SPACING = 76, + /// + /// - Low Heels 0--+255 High Heels + /// + SHOES_HEEL_HEIGHT = 77, + /// + /// - Low Platforms 0--+255 High Platforms + /// + SHOES_PLATFORM_HEIGHT = 78, + /// + /// - Thin Lips 0--+255 Fat Lips + /// + SHAPE_LIP_THICKNESS = 79, + /// + /// Mouth Position - High 0--+255 Low + /// + SHAPE_MOUTH_HEIGHT = 80, + /// + /// Breast Buoyancy - Less Gravity 0--+255 More Gravity + /// + SHAPE_BREAST_GRAVITY = 81, + /// + /// Platform Width - Narrow 0--+255 Wide + /// + SHOES_SHOE_PLATFORM_WIDTH = 82, + /// + /// - Pointy Heels 0--+255 Thick Heels + /// + SHOES_HEEL_SHAPE = 83, + /// + /// - Pointy 0--+255 Square + /// + SHOES_TOE_SHAPE = 84, + /// + /// Foot Size - Small 0--+255 Big + /// + SHAPE_FOOT_SIZE = 85, + /// + /// Nose Width - Narrow 0--+255 Wide + /// + SHAPE_WIDE_NOSE = 86, + /// + /// Eyelash Length - Short 0--+255 Long + /// + SHAPE_EYELASHES_LONG = 87, + /// + /// - Short 0--+255 Long + /// + UNDERSHIRT_SLEEVE_LENGTH = 88, + /// + /// - Short 0--+255 Long + /// + UNDERSHIRT_BOTTOM = 89, + /// + /// - Low 0--+255 High + /// + UNDERSHIRT_COLLAR_FRONT = 90, + JACKET_SLEEVE_LENGTH_91 = 91, + JACKET_COLLAR_FRONT_92 = 92, + /// + /// Jacket Length - Short 0--+255 Long + /// + JACKET_BOTTOM_LENGTH_LOWER = 93, + /// + /// Open Front - Open 0--+255 Closed + /// + JACKET_OPEN_JACKET = 94, + /// + /// - Short 0--+255 Tall + /// + SHOES_SHOE_HEIGHT = 95, + /// + /// - Short 0--+255 Long + /// + SOCKS_SOCKS_LENGTH = 96, + /// + /// - Short 0--+255 Long + /// + UNDERPANTS_PANTS_LENGTH = 97, + /// + /// - Low 0--+255 High + /// + UNDERPANTS_PANTS_WAIST = 98, + /// + /// Cuff Flare - Tight Cuffs 0--+255 Flared Cuffs + /// + PANTS_LEG_PANTFLAIR = 99, + /// + /// - More Vertical 0--+255 More Sloped + /// + SHAPE_FOREHEAD_ANGLE = 100, + /// + /// - Less Body Fat 0--+255 More Body Fat + /// + SHAPE_BODY_FAT = 101, + /// + /// Pants Crotch - High and Tight 0--+255 Low and Loose + /// + PANTS_LOW_CROTCH = 102, + /// + /// Egg Head - Chin Heavy 0--+255 Forehead Heavy + /// + SHAPE_EGG_HEAD = 103, + /// + /// Head Stretch - Squash Head 0--+255 Stretch Head + /// + SHAPE_SQUASH_STRETCH_HEAD = 104, + /// + /// Torso Muscles - Less Muscular 0--+255 More Muscular + /// + SHAPE_TORSO_MUSCLES = 105, + /// + /// Outer Eye Corner - Corner Down 0--+255 Corner Up + /// + SHAPE_EYELID_CORNER_UP = 106, + /// + /// - Less Muscular 0--+255 More Muscular + /// + SHAPE_LEG_MUSCLES = 107, + /// + /// Lip Fullness - Less Full 0--+255 More Full + /// + SHAPE_TALL_LIPS = 108, + /// + /// Toe Thickness - Flat Toe 0--+255 Thick Toe + /// + SHOES_SHOE_TOE_THICK = 109, + /// + /// Crooked Nose - Nose Left 0--+255 Nose Right + /// + SHAPE_CROOKED_NOSE = 110, + /// + /// - Corner Down 0--+255 Corner Up + /// + SHAPE_MOUTH_CORNER = 111, + /// + /// - Shear Right Up 0--+255 Shear Left Up + /// + SHAPE_FACE_SHEAR = 112, + /// + /// Shift Mouth - Shift Left 0--+255 Shift Right + /// + SHAPE_SHIFT_MOUTH = 113, + /// + /// Eye Pop - Pop Right Eye 0--+255 Pop Left Eye + /// + SHAPE_POP_EYE = 114, + /// + /// Jaw Jut - Overbite 0--+255 Underbite + /// + SHAPE_JAW_JUT = 115, + /// + /// Shear Back - Full Back 0--+255 Sheared Back + /// + HAIR_HAIR_SHEAR_BACK = 116, + /// + /// - Small Hands 0--+255 Large Hands + /// + SHAPE_HAND_SIZE = 117, + /// + /// Love Handles - Less Love 0--+255 More Love + /// + SHAPE_LOVE_HANDLES = 118, + SHAPE_TORSO_MUSCLES_119 = 119, + /// + /// Head Size - Small Head 0--+255 Big Head + /// + SHAPE_HEAD_SIZE = 120, + /// + /// - Skinny Neck 0--+255 Thick Neck + /// + SHAPE_NECK_THICKNESS = 121, + /// + /// Breast Cleavage - Separate 0--+255 Join + /// + SHAPE_BREAST_FEMALE_CLEAVAGE = 122, + /// + /// Pectorals - Big Pectorals 0--+255 Sunken Chest + /// + SHAPE_CHEST_MALE_NO_PECS = 123, + /// + /// Eye Size - Beady Eyes 0--+255 Anime Eyes + /// + SHAPE_EYE_SIZE = 124, + /// + /// - Short Legs 0--+255 Long Legs + /// + SHAPE_LEG_LENGTH = 125, + /// + /// - Short Arms 0--+255 Long arms + /// + SHAPE_ARM_LENGTH = 126, + /// + /// - Pink 0--+255 Black + /// + SKIN_LIPSTICK_COLOR = 127, + /// + /// - No Lipstick 0--+255 More Lipstick + /// + SKIN_LIPSTICK = 128, + /// + /// - No Lipgloss 0--+255 Glossy + /// + SKIN_LIPGLOSS = 129, + /// + /// - No Eyeliner 0--+255 Full Eyeliner + /// + SKIN_EYELINER = 130, + /// + /// - No Blush 0--+255 More Blush + /// + SKIN_BLUSH = 131, + /// + /// - Pink 0--+255 Orange + /// + SKIN_BLUSH_COLOR = 132, + /// + /// - Clear 0--+255 Opaque + /// + SKIN_OUT_SHDW_OPACITY = 133, + /// + /// - No Eyeshadow 0--+255 More Eyeshadow + /// + SKIN_OUTER_SHADOW = 134, + /// + /// - Light 0--+255 Dark + /// + SKIN_OUT_SHDW_COLOR = 135, + /// + /// - No Eyeshadow 0--+255 More Eyeshadow + /// + SKIN_INNER_SHADOW = 136, + /// + /// - No Polish 0--+255 Painted Nails + /// + SKIN_NAIL_POLISH = 137, + /// + /// - Clear 0--+255 Opaque + /// + SKIN_BLUSH_OPACITY = 138, + /// + /// - Light 0--+255 Dark + /// + SKIN_IN_SHDW_COLOR = 139, + /// + /// - Clear 0--+255 Opaque + /// + SKIN_IN_SHDW_OPACITY = 140, + /// + /// - Dark Green 0--+255 Black + /// + SKIN_EYELINER_COLOR = 141, + /// + /// - Pink 0--+255 Black + /// + SKIN_NAIL_POLISH_COLOR = 142, + /// + /// - Sparse 0--+255 Dense + /// + HAIR_EYEBROW_DENSITY = 143, + /// + /// - 5 O'Clock Shadow 0--+255 Bushy Hair + /// + HAIR_HAIR_THICKNESS = 144, + /// + /// Saddle Bags - Less Saddle 0--+255 More Saddle + /// + SHAPE_SADDLEBAGS = 145, + /// + /// Taper Back - Wide Back 0--+255 Narrow Back + /// + HAIR_HAIR_TAPER_BACK = 146, + /// + /// Taper Front - Wide Front 0--+255 Narrow Front + /// + HAIR_HAIR_TAPER_FRONT = 147, + /// + /// - Short Neck 0--+255 Long Neck + /// + SHAPE_NECK_LENGTH = 148, + /// + /// Eyebrow Height - Higher 0--+255 Lower + /// + HAIR_LOWER_EYEBROWS = 149, + /// + /// Lower Bridge - Low 0--+255 High + /// + SHAPE_LOWER_BRIDGE_NOSE = 150, + /// + /// Nostril Division - High 0--+255 Low + /// + SHAPE_LOW_SEPTUM_NOSE = 151, + /// + /// Jaw Angle - Low Jaw 0--+255 High Jaw + /// + SHAPE_JAW_ANGLE = 152, + /// + /// Shear Front - Full Front 0--+255 Sheared Front + /// + HAIR_HAIR_SHEAR_FRONT = 153, + /// + /// - Less Volume 0--+255 More Volume + /// + HAIR_HAIR_VOLUME = 154, + /// + /// Lip Cleft Depth - Shallow 0--+255 Deep + /// + SHAPE_LIP_CLEFT_DEEP = 155, + /// + /// Puffy Eyelids - Flat 0--+255 Puffy + /// + SHAPE_PUFFY_LOWER_LIDS = 156, + /// + /// - Sunken Eyes 0--+255 Bugged Eyes + /// + SHAPE_EYE_DEPTH = 157, + /// + /// - Flat Head 0--+255 Long Head + /// + SHAPE_HEAD_LENGTH = 158, + /// + /// - Less Freckles 0--+255 More Freckles + /// + SKIN_BODY_FRECKLES = 159, + /// + /// - Low 0--+255 High + /// + UNDERSHIRT_COLLAR_BACK = 160, + JACKET_COLLAR_BACK_161 = 161, + SHIRT_COLLAR_BACK_162 = 162, + /// + /// - Short Pigtails 0--+255 Long Pigtails + /// + HAIR_PIGTAILS = 163, + /// + /// - Short Ponytail 0--+255 Long Ponytail + /// + HAIR_PONYTAIL = 164, + /// + /// Butt Size - Flat Butt 0--+255 Big Butt + /// + SHAPE_BUTT_SIZE = 165, + /// + /// Ear Tips - Flat 0--+255 Pointy + /// + SHAPE_POINTY_EARS = 166, + /// + /// Lip Ratio - More Upper Lip 0--+255 More Lower Lip + /// + SHAPE_LIP_RATIO = 167, + SHIRT_SLEEVE_LENGTH_168 = 168, + /// + /// - Short 0--+255 Long + /// + SHIRT_SHIRT_BOTTOM = 169, + SHIRT_COLLAR_FRONT_170 = 170, + SHIRT_SHIRT_RED = 171, + SHIRT_SHIRT_GREEN = 172, + SHIRT_SHIRT_BLUE = 173, + PANTS_PANTS_RED = 174, + PANTS_PANTS_GREEN = 175, + PANTS_PANTS_BLUE = 176, + SHOES_SHOES_RED = 177, + SHOES_SHOES_GREEN = 178, + /// + /// - Low 0--+255 High + /// + PANTS_WAIST_HEIGHT = 179, + PANTS_PANTS_LENGTH_180 = 180, + /// + /// Pants Fit - Tight Pants 0--+255 Loose Pants + /// + PANTS_LOOSE_LOWER_CLOTHING = 181, + SHOES_SHOES_BLUE = 182, + SOCKS_SOCKS_RED = 183, + SOCKS_SOCKS_GREEN = 184, + SOCKS_SOCKS_BLUE = 185, + UNDERSHIRT_UNDERSHIRT_RED = 186, + UNDERSHIRT_UNDERSHIRT_GREEN = 187, + UNDERSHIRT_UNDERSHIRT_BLUE = 188, + UNDERPANTS_UNDERPANTS_RED = 189, + UNDERPANTS_UNDERPANTS_GREEN = 190, + UNDERPANTS_UNDERPANTS_BLUE = 191, + GLOVES_GLOVES_RED = 192, + /// + /// Shirt Fit - Tight Shirt 0--+255 Loose Shirt + /// + SHIRT_LOOSE_UPPER_CLOTHING = 193, + GLOVES_GLOVES_GREEN = 194, + GLOVES_GLOVES_BLUE = 195, + JACKET_JACKET_RED = 196, + JACKET_JACKET_GREEN = 197, + JACKET_JACKET_BLUE = 198, + /// + /// Sleeve Looseness - Tight Sleeves 0--+255 Loose Sleeves + /// + SHIRT_SHIRTSLEEVE_FLAIR = 199, + /// + /// Knee Angle - Knock Kneed 0--+255 Bow Legged + /// + SHAPE_BOWED_LEGS = 200, + /// + /// - Short hips 0--+255 Long Hips + /// + SHAPE_HIP_LENGTH = 201, + /// + /// - Fingerless 0--+255 Fingers + /// + GLOVES_GLOVE_FINGERS = 202, + /// + /// bustle skirt - no bustle 0--+255 more bustle + /// + SKIRT_SKIRT_BUSTLE = 203, + /// + /// - Short 0--+255 Long + /// + SKIRT_SKIRT_LENGTH = 204, + /// + /// - Open Front 0--+255 Closed Front + /// + SKIRT_SLIT_FRONT = 205, + /// + /// - Open Back 0--+255 Closed Back + /// + SKIRT_SLIT_BACK = 206, + /// + /// - Open Left 0--+255 Closed Left + /// + SKIRT_SLIT_LEFT = 207, + /// + /// - Open Right 0--+255 Closed Right + /// + SKIRT_SLIT_RIGHT = 208, + /// + /// Skirt Fit - Tight Skirt 0--+255 Poofy Skirt + /// + SKIRT_SKIRT_LOOSENESS = 209, + SHIRT_SHIRT_WRINKLES = 210, + PANTS_PANTS_WRINKLES = 211, + /// + /// Jacket Wrinkles - No Wrinkles 0--+255 Wrinkles + /// + JACKET_JACKET_WRINKLES = 212, + /// + /// Package - Coin Purse 0--+255 Duffle Bag + /// + SHAPE_MALE_PACKAGE = 213, + /// + /// Inner Eye Corner - Corner Down 0--+255 Corner Up + /// + SHAPE_EYELID_INNER_CORNER_UP = 214, + SKIRT_SKIRT_RED = 215, + SKIRT_SKIRT_GREEN = 216, + SKIRT_SKIRT_BLUE = 217 + } } } -- cgit v1.1 From 190bdc8a2e8fa842759087749592769f951834ab Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey Date: Wed, 5 Aug 2009 17:33:23 +0100 Subject: * Remove some mono compiler warnings --- OpenSim/Framework/AvatarAppearance.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 0b9ea42..6a07bc9 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -38,8 +38,7 @@ namespace OpenSim.Framework { public class AvatarAppearance { - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // these are guessed at by the list here - // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll -- cgit v1.1 From 0a85d1d767d5ab3b37a3a1a797be843d0b54780e Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Wed, 12 Aug 2009 23:34:12 -0400 Subject: minor:comments --- OpenSim/Framework/AvatarAppearance.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 6a07bc9..7270f32 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -28,14 +28,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Runtime.Serialization; -using System.Security.Permissions; using OpenMetaverse; -using log4net; -using System.Reflection; namespace OpenSim.Framework { + /// + /// Contains the Avatar's Appearance and methods to manipulate the appearance. + /// public class AvatarAppearance { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); -- cgit v1.1 From ae2ceda479a2b223189b5eecedc46798e1152fcd Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 19 Aug 2009 12:41:57 -0700 Subject: * Only update TextureEntry in AvatarAppearance if the incoming XML-RPC has a valid TextureEntry. About half the time update_avatar_appearance calls are made, the TextureEntry is empty --- OpenSim/Framework/AvatarAppearance.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 7270f32..1fb01ba 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -503,7 +503,14 @@ namespace OpenSim.Framework Owner = new UUID((string)h["owner"]); Serial = Convert.ToInt32((string)h["serial"]); VisualParams = (byte[])h["visual_params"]; - Texture = new Primitive.TextureEntry((byte[])h["texture"], 0, ((byte[])h["texture"]).Length); + + if (h.Contains("texture")) + { + byte[] te = h["texture"] as byte[]; + if (te != null && te.Length > 0) + Texture = new Primitive.TextureEntry(te, 0, te.Length); + } + AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); m_wearables = new AvatarWearable[MAX_WEARABLES]; -- cgit v1.1 From 5f794d3e599c45d37fed508de24216c8888a2fba Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Tue, 25 Aug 2009 17:36:04 -0400 Subject: A slightly modified version of http://opensimulator.org/mantis/view.php?id=4040 by jhurliman. The patch didn't match up, so I winged it here. My effort to manually merge the patch seems to make sense, so I'm going to commit it. --- OpenSim/Framework/AvatarAppearance.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 1fb01ba..940ae3b 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -510,6 +510,13 @@ namespace OpenSim.Framework if (te != null && te.Length > 0) Texture = new Primitive.TextureEntry(te, 0, te.Length); } + else + { + // We shouldn't be receiving appearance hashtables without a TextureEntry, + // but in case we do this will prevent a failure when saving to the database + Texture = GetDefaultTexture(); + } + AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); -- cgit v1.1 From 5dfd2643dfc530280e5dcd0056b59add7d49f313 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 30 Sep 2009 15:53:03 -0700 Subject: * 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 --- OpenSim/Framework/AvatarAppearance.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 940ae3b..3f4214e 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -380,13 +380,13 @@ namespace OpenSim.Framework /// /// Set up appearance textures and avatar parameters, including a height calculation /// - /// - /// - public virtual void SetAppearance(byte[] texture, List visualParam) + public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) { - Primitive.TextureEntry textureEnt = new Primitive.TextureEntry(texture, 0, texture.Length); - m_texture = textureEnt; - m_visualparams = visualParam.ToArray(); + if (textureEntry != null) + m_texture = textureEntry; + if (visualParams != null) + m_visualparams = visualParams; + m_avatarHeight = 1.23077f // Shortest possible avatar height + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size -- cgit v1.1 From 1c220e173c37d835542983898dc01b004112b4a9 Mon Sep 17 00:00:00 2001 From: Rob Smart Date: Fri, 9 Oct 2009 16:13:55 +0100 Subject: Adding a hair item to the default wearables, fixes newly created avatars appearing as a cloud --- OpenSim/Framework/AvatarAppearance.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 3f4214e..56fcc15 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -66,6 +66,8 @@ namespace OpenSim.Framework private static UUID SHIRT_ITEM = new UUID("77c41e39-38f9-f75a-0000-585989bf0000"); private static UUID PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); + private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); + private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); public readonly static int VISUALPARAM_COUNT = 218; @@ -238,6 +240,8 @@ namespace OpenSim.Framework m_wearables[BODY].ItemID = BODY_ITEM; m_wearables[SKIN].AssetID = SKIN_ASSET; m_wearables[SKIN].ItemID = SKIN_ITEM; + m_wearables[HAIR].AssetID = HAIR_ASSET; + m_wearables[HAIR].ItemID = HAIR_ITEM; m_wearables[SHIRT].AssetID = SHIRT_ASSET; m_wearables[SHIRT].ItemID = SHIRT_ITEM; m_wearables[PANTS].AssetID = PANTS_ASSET; -- cgit v1.1 From 66920a9047b54db947d02f252e17409b7fc32ef0 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 12 Jan 2010 09:22:58 -0800 Subject: Fixed more appearance woes that showed up using remote connectors. Appearance is now being passed with AgentCircuitData, as it should be. --- OpenSim/Framework/AvatarAppearance.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 56fcc15..5ec9283 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -566,6 +566,16 @@ namespace OpenSim.Framework private Dictionary m_attachments = new Dictionary(); + public void SetAttachments(AttachmentData[] data) + { + foreach (AttachmentData a in data) + { + m_attachments[a.AttachPoint] = new UUID[2]; + m_attachments[a.AttachPoint][0] = a.ItemID; + m_attachments[a.AttachPoint][1] = a.AssetID; + } + } + public void SetAttachments(Hashtable data) { m_attachments.Clear(); @@ -595,6 +605,11 @@ namespace OpenSim.Framework } } + public Dictionary GetAttachmentDictionary() + { + return m_attachments; + } + public Hashtable GetAttachments() { if (m_attachments.Count == 0) -- cgit v1.1 From 802a969267da9ed2780ea66c736c3d531e336dfa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Feb 2010 21:32:03 +0000 Subject: Fix http://opensimulator.org/mantis/view.php?id=4224 This resolves the problem where eyes and hair would turn white on standalone configurations When a client receives body part information, for some insane reason or other it always ends up uploading this back to the server and then immediately re-requesting it. This should have been okay since we stored that asset in cache. However, the standalone asset service connector was not checking this cache properly, so every time the client made the request for the asset it has just loaded it would get a big fat null back in the face, causing it to make clothes and hair white. This bug did not affect grids since they use a different service connector. --- OpenSim/Framework/AvatarAppearance.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 56fcc15..a3ea499 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -69,9 +69,7 @@ namespace OpenSim.Framework private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); - public readonly static int VISUALPARAM_COUNT = 218; - - + public readonly static int VISUALPARAM_COUNT = 218; protected UUID m_owner; @@ -346,11 +344,7 @@ namespace OpenSim.Framework } */ - - public AvatarAppearance() - : this(UUID.Zero) - { - } + public AvatarAppearance() : this(UUID.Zero) {} public AvatarAppearance(UUID owner) { @@ -367,10 +361,8 @@ namespace OpenSim.Framework // This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist SetDefaultParams(m_visualparams); SetDefaultWearables(); - m_texture = GetDefaultTexture(); - + m_texture = GetDefaultTexture(); } - public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams) { @@ -1481,4 +1473,4 @@ namespace OpenSim.Framework SKIRT_SKIRT_BLUE = 217 } } -} +} \ No newline at end of file -- cgit v1.1 From 9821c4f566e11c75c8d87721777480c5b2e2bd4e Mon Sep 17 00:00:00 2001 From: Revolution Date: Sun, 14 Feb 2010 15:41:57 -0600 Subject: Revolution is on the roll again! :) Fixes: Undo, T-pose of others on login, modifiedBulletX works again, feet now stand on the ground instead of in the ground, adds checks to CombatModule. Adds: Redo, Land Undo, checks to agentUpdate (so one can not fall off of a region), more vehicle parts. Finishes almost all of LSL (1 function left, 2 events). Direct flames and kudos to Revolution, please Signed-off-by: Melanie --- OpenSim/Framework/AvatarAppearance.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a3ea499..b2c4d8e 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -390,11 +390,12 @@ namespace OpenSim.Framework + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length - m_hipOffset = (0.615385f // Half of avatar + m_hipOffset = (((1.23077f // Half of avatar + + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height - + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length - - m_avatarHeight / 2) * 0.3f - 0.04f; + ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f; -- cgit v1.1 From af265e001d3bf043590e480cd6574a14193f6de0 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 15 Feb 2010 19:15:03 +0900 Subject: Formatting cleanup. --- OpenSim/Framework/AvatarAppearance.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index b2c4d8e..a2a5c84 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -69,7 +69,7 @@ namespace OpenSim.Framework private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); - public readonly static int VISUALPARAM_COUNT = 218; + public readonly static int VISUALPARAM_COUNT = 218; protected UUID m_owner; @@ -361,7 +361,7 @@ namespace OpenSim.Framework // This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist SetDefaultParams(m_visualparams); SetDefaultWearables(); - m_texture = GetDefaultTexture(); + m_texture = GetDefaultTexture(); } public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams) -- cgit v1.1 From b1c8d0588829dfa76f89460eeb8406d9c4fc479f Mon Sep 17 00:00:00 2001 From: Master ScienceSim Date: Wed, 20 Oct 2010 16:17:54 -0700 Subject: Major refactoring of appearance handling. AvatarService -- add two new methods, GetAppearance and SetAppearance to get around the lossy encoding in AvatarData. Preseve the old functions to avoid changing the behavior for ROBUST services. AvatarAppearance -- major refactor, moved the various encoding methods used by AgentCircuitData, ClientAgentUpdate and ScenePresence into one location. Changed initialization. AvatarAttachments -- added a class specifically to handle attachments in preparation for additional functionality that will be needed for viewer 2. AvatarFactory -- removed a number of unused or methods duplicated in other locations. Moved in all appearance event handling from ScenePresence. Required a change to IClientAPI that propogated throughout all the IClientAPI implementations. --- OpenSim/Framework/AvatarAppearance.cs | 839 ++++++++++++++++------------------ 1 file changed, 403 insertions(+), 436 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 5da8ba1..55646dd 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -26,9 +26,12 @@ */ using System; +using System.Reflection; using System.Collections; using System.Collections.Generic; using OpenMetaverse; +using OpenMetaverse.StructuredData; +using log4net; namespace OpenSim.Framework { @@ -37,48 +40,26 @@ namespace OpenSim.Framework /// public class AvatarAppearance { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - // these are guessed at by the list here - - // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll - // correct them over time for when were are wrong. - public readonly static int BODY = 0; - public readonly static int SKIN = 1; - public readonly static int HAIR = 2; - public readonly static int EYES = 3; - public readonly static int SHIRT = 4; - public readonly static int PANTS = 5; - public readonly static int SHOES = 6; - public readonly static int SOCKS = 7; - public readonly static int JACKET = 8; - public readonly static int GLOVES = 9; - public readonly static int UNDERSHIRT = 10; - public readonly static int UNDERPANTS = 11; - public readonly static int SKIRT = 12; - - private readonly static int MAX_WEARABLES = 13; - - private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); - private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); - private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); - private static UUID SKIN_ITEM = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9"); - private static UUID SHIRT_ASSET = new UUID("00000000-38f9-1111-024e-222222111110"); - private static UUID SHIRT_ITEM = new UUID("77c41e39-38f9-f75a-0000-585989bf0000"); - private static UUID PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); - private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); - private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); - private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public readonly static int VISUALPARAM_COUNT = 218; + public readonly static int TEXTURE_COUNT = 21; + protected UUID m_owner; + protected int m_serial = 1; + protected byte[] m_visualparams; + protected Primitive.TextureEntry m_texture; + protected AvatarWearable[] m_wearables; + protected Dictionary m_attachments; + protected float m_avatarHeight = 0; + protected float m_hipOffset = 0; public virtual UUID Owner { get { return m_owner; } set { m_owner = value; } } - protected int m_serial = 1; public virtual int Serial { @@ -86,15 +67,17 @@ namespace OpenSim.Framework set { m_serial = value; } } - protected byte[] m_visualparams; - public virtual byte[] VisualParams { get { return m_visualparams; } set { m_visualparams = value; } } - protected AvatarWearable[] m_wearables; + public virtual Primitive.TextureEntry Texture + { + get { return m_texture; } + set { m_texture = value; } + } public virtual AvatarWearable[] Wearables { @@ -102,287 +85,363 @@ namespace OpenSim.Framework set { m_wearables = value; } } + public virtual Dictionary Attachments + { + get { return m_attachments; } + } + public virtual UUID BodyItem { - get { return m_wearables[BODY].ItemID; } - set { m_wearables[BODY].ItemID = value; } + get { return m_wearables[AvatarWearable.BODY].ItemID; } + set { m_wearables[AvatarWearable.BODY].ItemID = value; } } public virtual UUID BodyAsset { - get { return m_wearables[BODY].AssetID; } - set { m_wearables[BODY].AssetID = value; } + get { return m_wearables[AvatarWearable.BODY].AssetID; } + set { m_wearables[AvatarWearable.BODY].AssetID = value; } } public virtual UUID SkinItem { - get { return m_wearables[SKIN].ItemID; } - set { m_wearables[SKIN].ItemID = value; } + get { return m_wearables[AvatarWearable.SKIN].ItemID; } + set { m_wearables[AvatarWearable.SKIN].ItemID = value; } } public virtual UUID SkinAsset { - get { return m_wearables[SKIN].AssetID; } - set { m_wearables[SKIN].AssetID = value; } + get { return m_wearables[AvatarWearable.SKIN].AssetID; } + set { m_wearables[AvatarWearable.SKIN].AssetID = value; } } public virtual UUID HairItem { - get { return m_wearables[HAIR].ItemID; } - set { m_wearables[HAIR].ItemID = value; } + get { return m_wearables[AvatarWearable.HAIR].ItemID; } + set { m_wearables[AvatarWearable.HAIR].ItemID = value; } } public virtual UUID HairAsset { - get { return m_wearables[HAIR].AssetID; } - set { m_wearables[HAIR].AssetID = value; } + get { return m_wearables[AvatarWearable.HAIR].AssetID; } + set { m_wearables[AvatarWearable.HAIR].AssetID = value; } } public virtual UUID EyesItem { - get { return m_wearables[EYES].ItemID; } - set { m_wearables[EYES].ItemID = value; } + get { return m_wearables[AvatarWearable.EYES].ItemID; } + set { m_wearables[AvatarWearable.EYES].ItemID = value; } } public virtual UUID EyesAsset { - get { return m_wearables[EYES].AssetID; } - set { m_wearables[EYES].AssetID = value; } + get { return m_wearables[AvatarWearable.EYES].AssetID; } + set { m_wearables[AvatarWearable.EYES].AssetID = value; } } public virtual UUID ShirtItem { - get { return m_wearables[SHIRT].ItemID; } - set { m_wearables[SHIRT].ItemID = value; } + get { return m_wearables[AvatarWearable.SHIRT].ItemID; } + set { m_wearables[AvatarWearable.SHIRT].ItemID = value; } } public virtual UUID ShirtAsset { - get { return m_wearables[SHIRT].AssetID; } - set { m_wearables[SHIRT].AssetID = value; } + get { return m_wearables[AvatarWearable.SHIRT].AssetID; } + set { m_wearables[AvatarWearable.SHIRT].AssetID = value; } } public virtual UUID PantsItem { - get { return m_wearables[PANTS].ItemID; } - set { m_wearables[PANTS].ItemID = value; } + get { return m_wearables[AvatarWearable.PANTS].ItemID; } + set { m_wearables[AvatarWearable.PANTS].ItemID = value; } } public virtual UUID PantsAsset { - get { return m_wearables[PANTS].AssetID; } - set { m_wearables[PANTS].AssetID = value; } + get { return m_wearables[AvatarWearable.PANTS].AssetID; } + set { m_wearables[AvatarWearable.PANTS].AssetID = value; } } public virtual UUID ShoesItem { - get { return m_wearables[SHOES].ItemID; } - set { m_wearables[SHOES].ItemID = value; } + get { return m_wearables[AvatarWearable.SHOES].ItemID; } + set { m_wearables[AvatarWearable.SHOES].ItemID = value; } } public virtual UUID ShoesAsset { - get { return m_wearables[SHOES].AssetID; } - set { m_wearables[SHOES].AssetID = value; } + get { return m_wearables[AvatarWearable.SHOES].AssetID; } + set { m_wearables[AvatarWearable.SHOES].AssetID = value; } } public virtual UUID SocksItem { - get { return m_wearables[SOCKS].ItemID; } - set { m_wearables[SOCKS].ItemID = value; } + get { return m_wearables[AvatarWearable.SOCKS].ItemID; } + set { m_wearables[AvatarWearable.SOCKS].ItemID = value; } } public virtual UUID SocksAsset { - get { return m_wearables[SOCKS].AssetID; } - set { m_wearables[SOCKS].AssetID = value; } + get { return m_wearables[AvatarWearable.SOCKS].AssetID; } + set { m_wearables[AvatarWearable.SOCKS].AssetID = value; } } public virtual UUID JacketItem { - get { return m_wearables[JACKET].ItemID; } - set { m_wearables[JACKET].ItemID = value; } + get { return m_wearables[AvatarWearable.JACKET].ItemID; } + set { m_wearables[AvatarWearable.JACKET].ItemID = value; } } public virtual UUID JacketAsset { - get { return m_wearables[JACKET].AssetID; } - set { m_wearables[JACKET].AssetID = value; } + get { return m_wearables[AvatarWearable.JACKET].AssetID; } + set { m_wearables[AvatarWearable.JACKET].AssetID = value; } } public virtual UUID GlovesItem { - get { return m_wearables[GLOVES].ItemID; } - set { m_wearables[GLOVES].ItemID = value; } + get { return m_wearables[AvatarWearable.GLOVES].ItemID; } + set { m_wearables[AvatarWearable.GLOVES].ItemID = value; } } public virtual UUID GlovesAsset { - get { return m_wearables[GLOVES].AssetID; } - set { m_wearables[GLOVES].AssetID = value; } + get { return m_wearables[AvatarWearable.GLOVES].AssetID; } + set { m_wearables[AvatarWearable.GLOVES].AssetID = value; } } public virtual UUID UnderShirtItem { - get { return m_wearables[UNDERSHIRT].ItemID; } - set { m_wearables[UNDERSHIRT].ItemID = value; } + get { return m_wearables[AvatarWearable.UNDERSHIRT].ItemID; } + set { m_wearables[AvatarWearable.UNDERSHIRT].ItemID = value; } } public virtual UUID UnderShirtAsset { - get { return m_wearables[UNDERSHIRT].AssetID; } - set { m_wearables[UNDERSHIRT].AssetID = value; } + get { return m_wearables[AvatarWearable.UNDERSHIRT].AssetID; } + set { m_wearables[AvatarWearable.UNDERSHIRT].AssetID = value; } } public virtual UUID UnderPantsItem { - get { return m_wearables[UNDERPANTS].ItemID; } - set { m_wearables[UNDERPANTS].ItemID = value; } + get { return m_wearables[AvatarWearable.UNDERPANTS].ItemID; } + set { m_wearables[AvatarWearable.UNDERPANTS].ItemID = value; } } public virtual UUID UnderPantsAsset { - get { return m_wearables[UNDERPANTS].AssetID; } - set { m_wearables[UNDERPANTS].AssetID = value; } + get { return m_wearables[AvatarWearable.UNDERPANTS].AssetID; } + set { m_wearables[AvatarWearable.UNDERPANTS].AssetID = value; } } public virtual UUID SkirtItem { - get { return m_wearables[SKIRT].ItemID; } - set { m_wearables[SKIRT].ItemID = value; } + get { return m_wearables[AvatarWearable.SKIRT].ItemID; } + set { m_wearables[AvatarWearable.SKIRT].ItemID = value; } } public virtual UUID SkirtAsset { - get { return m_wearables[SKIRT].AssetID; } - set { m_wearables[SKIRT].AssetID = value; } + get { return m_wearables[AvatarWearable.SKIRT].AssetID; } + set { m_wearables[AvatarWearable.SKIRT].AssetID = value; } } - public virtual void SetDefaultWearables() + public virtual float AvatarHeight { - m_wearables[BODY].AssetID = BODY_ASSET; - m_wearables[BODY].ItemID = BODY_ITEM; - m_wearables[SKIN].AssetID = SKIN_ASSET; - m_wearables[SKIN].ItemID = SKIN_ITEM; - m_wearables[HAIR].AssetID = HAIR_ASSET; - m_wearables[HAIR].ItemID = HAIR_ITEM; - m_wearables[SHIRT].AssetID = SHIRT_ASSET; - m_wearables[SHIRT].ItemID = SHIRT_ITEM; - m_wearables[PANTS].AssetID = PANTS_ASSET; - m_wearables[PANTS].ItemID = PANTS_ITEM; + get { return m_avatarHeight; } + set { m_avatarHeight = value; } } - public virtual void ClearWearables() + public virtual float HipOffset { - for (int i = 0; i < 13; i++) - { - m_wearables[i].AssetID = UUID.Zero; - m_wearables[i].ItemID = UUID.Zero; - } + get { return m_hipOffset; } } - public virtual void SetDefaultParams(byte[] vparams) + public AvatarAppearance() : this(UUID.Zero) {} + + public AvatarAppearance(UUID owner) { - // TODO: Figure out better values then 'fat scientist 150' or 'alien 0' - for (int i = 0; i < VISUALPARAM_COUNT; i++) - { - vparams[i] = 150; - } +// DEBUG ON + m_log.WarnFormat("[AVATAR APPEARANCE] create empty appearance for {0}",owner); +// DEBUG OFF + m_serial = 0; + m_owner = owner; + + SetDefaultWearables(); + SetDefaultTexture(); + SetDefaultParams(); + SetHeight(); + + m_attachments = new Dictionary(); } + + public AvatarAppearance(UUID avatarID, OSDMap map) + { +// DEBUG ON + m_log.WarnFormat("[AVATAR APPEARANCE] create appearance for {0} from OSDMap",avatarID); +// DEBUG OFF + m_owner = avatarID; + Unpack(map); + SetHeight(); + } + + public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) + { +// DEBUG ON + m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); +// DEBUG OFF + m_serial = 1; + m_owner = avatarID; - protected Primitive.TextureEntry m_texture; + if (wearables != null) + m_wearables = wearables; + else + SetDefaultWearables(); + + if (textureEntry != null) + m_texture = textureEntry; + else + SetDefaultTexture(); - public virtual Primitive.TextureEntry Texture - { - get { return m_texture; } - set { m_texture = value; } + if (visualParams != null) + m_visualparams = visualParams; + else + SetDefaultParams(); + + SetHeight(); + + m_attachments = new Dictionary(); } - protected float m_avatarHeight = 0; - protected float m_hipOffset = 0; + public AvatarAppearance(AvatarAppearance appearance) + { +// DEBUG ON + m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); +// DEBUG OFF + if (appearance == null) + { + m_serial = 0; + m_owner = UUID.Zero; - public virtual float AvatarHeight + SetDefaultWearables(); + SetDefaultTexture(); + SetDefaultParams(); + SetHeight(); + + m_attachments = new Dictionary(); + + return; + } + + m_serial = appearance.Serial; + m_owner = appearance.Owner; + + m_wearables = null; + if (appearance.Wearables != null) + { + m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 13 of these + for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) + SetWearable(i,appearance.Wearables[i]); + } + + m_texture = null; + if (appearance.Texture != null) + { + byte[] tbytes = appearance.Texture.GetBytes(); + m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length); + } + + m_visualparams = null; + if (appearance.VisualParams != null) + m_visualparams = (byte[])appearance.VisualParams.Clone(); + + m_attachments = new Dictionary(); + foreach (KeyValuePair kvp in appearance.Attachments) + m_attachments[kvp.Key] = new AvatarAttachment(kvp.Value); + } + + protected virtual void SetDefaultWearables() { - get { return m_avatarHeight; } - set { m_avatarHeight = value; } + m_wearables = AvatarWearable.DefaultWearables; } - public virtual float HipOffset + protected virtual void SetDefaultParams() { - get { return m_hipOffset; } + m_visualparams = new byte[VISUALPARAM_COUNT]; + for (int i = 0; i < VISUALPARAM_COUNT; i++) + { + m_visualparams[i] = 150; + } } - //Builds the VisualParam Enum using LIBOMV's Visual Param NameValues - /* - public void BuildVisualParamEnum() + protected virtual void SetDefaultTexture() { - Dictionary IndexedParams = new Dictionary(); - int vpIndex = 0; - IndexedParams = new Dictionary(); - - System.Text.StringBuilder sb = new System.Text.StringBuilder(); + m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); + // The initialization of these seems to force a rebake regardless of whether it is needed + // m_textures.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); + // m_textures.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID; + // m_textures.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID; + // m_textures.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); + // m_textures.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); + // m_textures.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); + // m_textures.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011"); + } - sb.Append("public enum VPElement: int\n"); - sb.Append("{\n"); - foreach (KeyValuePair kvp in OpenMetaverse.VisualParams.Params) + /// + /// Set up appearance textures. + /// Returns boolean that indicates whether the new entries actually change the + /// existing values. + /// + public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry) + { + if (textureEntry == null) + return false; + + // There are much simpler versions of this copy that could be + // made. We determine if any of the textures actually + // changed to know if the appearance should be saved later + bool changed = false; + for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) { - VisualParam vp = kvp.Value; - - // Only Group-0 parameters are sent in AgentSetAppearance packets - if (kvp.Value.Group == 0) - { + Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i]; + Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i]; - if (!IndexedParams.ContainsKey(vp.Name)) - { - - if (vp.Label.Length > 0 || vp.LabelMin.Length > 0 || vp.LabelMax.Length > 0) - { - - sb.Append("/// \n"); - if (vp.LabelMin.Length > 0 && vp.LabelMax.Length > 0) - sb.Append(string.Format("/// {0} - {1} 0--+255 {2}\n", vp.Label, vp.LabelMin, - vp.LabelMax)); - - else - sb.Append(string.Format("/// {0}\n", vp.Label)); - - sb.Append("/// \n"); - } - sb.Append(string.Format(" {0}_{1} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"),vpIndex)); - - IndexedParams.Add(vp.Name, vpIndex++); - } - else - { - sb.Append(string.Format(" {0}_{1}_{2} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"), vpIndex)); - vpIndex++; - //int i = 0; - } + if (newface == null) + { + if (oldface == null) continue; } - if (vpIndex < 217) - sb.Append(",\n"); else - sb.Append("\n"); + { + if (oldface != null && oldface.TextureID == newface.TextureID) continue; + } + m_texture.FaceTextures[i] = (newface != null) ? new Primitive.TextureEntryFace(newface) : null; + changed = true; +// DEBUG ON + if (newface != null) + m_log.WarnFormat("[SCENEPRESENCE] index {0}, new texture id {1}",i,newface.TextureID); +// DEBUG OFF } - sb.Append("}\n"); + return changed; } - */ - - public AvatarAppearance() : this(UUID.Zero) {} - - public AvatarAppearance(UUID owner) + + /// + /// Set up visual parameters for the avatar and refresh the avatar height + /// Returns boolean that indicates whether the new entries actually change the + /// existing values. + /// + public virtual bool SetVisualParams(byte[] visualParams) { - m_wearables = new AvatarWearable[MAX_WEARABLES]; - for (int i = 0; i < MAX_WEARABLES; i++) + if (visualParams == null) + return false; + + // There are much simpler versions of this copy that could be + // made. We determine if any of the visual parameters actually + // changed to know if the appearance should be saved later + bool changed = false; + for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) { - // this makes them all null - m_wearables[i] = new AvatarWearable(); + if (visualParams[i] != m_visualparams[i]) + { +// DEBUG ON + m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", + i,m_visualparams[i],visualParams[i]); +// DEBUG OFF + m_visualparams[i] = visualParams[i]; + changed = true; + } } - m_serial = 0; - m_owner = owner; - //BuildVisualParamEnum() - m_visualparams = new byte[VISUALPARAM_COUNT]; - // This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist - SetDefaultParams(m_visualparams); - SetDefaultWearables(); - m_texture = GetDefaultTexture(); + + // Reset the height if the visual parameters actually changed + if (changed) + SetHeight(); + + return changed; } - - public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams) + + public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) { - m_owner = avatarID; - m_serial = 1; - m_wearables = wearables; - m_visualparams = visualParams; - m_texture = GetDefaultTexture(); + SetTextureEntries(textureEntry); + SetVisualParams(visualParams); } - - /// - /// Set up appearance textures and avatar parameters, including a height calculation - /// - public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) + + public virtual void SetHeight() { - if (textureEntry != null) - m_texture = textureEntry; - if (visualParams != null) - m_visualparams = visualParams; - m_avatarHeight = 1.23077f // Shortest possible avatar height + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size @@ -390,217 +449,63 @@ namespace OpenSim.Framework + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length + m_hipOffset = (((1.23077f // Half of avatar + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f; - - - - //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}" + m_avatarHeight + " " + m_hipOffset); - //m_log.Debug("------------- Set Appearance Texture ---------------"); - //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; - //foreach (Primitive.TextureEntryFace face in faces) - //{ - // if (face != null) - // m_log.Debug(" ++ " + face.TextureID); - // else - // m_log.Debug(" ++ NULL "); - //} - //m_log.Debug("----------------------------"); - } public virtual void SetWearable(int wearableId, AvatarWearable wearable) { - m_wearables[wearableId] = wearable; +// DEBUG ON +// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); +// DEBUG OFF + m_wearables[wearableId] = new AvatarWearable(wearable.ItemID,wearable.AssetID); } - public static Primitive.TextureEntry GetDefaultTexture() - { - Primitive.TextureEntry textu = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); - textu.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); - textu.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID; - textu.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID; - textu.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); - textu.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); - textu.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); - textu.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011"); - return textu; - } - - public static byte[] GetDefaultVisualParams() - { - byte[] visualParams; - visualParams = new byte[VISUALPARAM_COUNT]; - for (int i = 0; i < VISUALPARAM_COUNT; i++) - { - visualParams[i] = 100; - } - return visualParams; - } +// DEBUG ON public override String ToString() { - String s = "[Wearables] =>"; - s += " Body Item: " + BodyItem.ToString() + ";"; - s += " Skin Item: " + SkinItem.ToString() + ";"; - s += " Shirt Item: " + ShirtItem.ToString() + ";"; - s += " Pants Item: " + PantsItem.ToString() + ";"; - return s; - } - - // this is used for OGS1 - public virtual Hashtable ToHashTable() - { - Hashtable h = new Hashtable(); - h["owner"] = Owner.ToString(); - h["serial"] = Serial.ToString(); - h["visual_params"] = VisualParams; - h["texture"] = Texture.GetBytes(); - h["avatar_height"] = AvatarHeight.ToString(); - h["body_item"] = BodyItem.ToString(); - h["body_asset"] = BodyAsset.ToString(); - h["skin_item"] = SkinItem.ToString(); - h["skin_asset"] = SkinAsset.ToString(); - h["hair_item"] = HairItem.ToString(); - h["hair_asset"] = HairAsset.ToString(); - h["eyes_item"] = EyesItem.ToString(); - h["eyes_asset"] = EyesAsset.ToString(); - h["shirt_item"] = ShirtItem.ToString(); - h["shirt_asset"] = ShirtAsset.ToString(); - h["pants_item"] = PantsItem.ToString(); - h["pants_asset"] = PantsAsset.ToString(); - h["shoes_item"] = ShoesItem.ToString(); - h["shoes_asset"] = ShoesAsset.ToString(); - h["socks_item"] = SocksItem.ToString(); - h["socks_asset"] = SocksAsset.ToString(); - h["jacket_item"] = JacketItem.ToString(); - h["jacket_asset"] = JacketAsset.ToString(); - h["gloves_item"] = GlovesItem.ToString(); - h["gloves_asset"] = GlovesAsset.ToString(); - h["undershirt_item"] = UnderShirtItem.ToString(); - h["undershirt_asset"] = UnderShirtAsset.ToString(); - h["underpants_item"] = UnderPantsItem.ToString(); - h["underpants_asset"] = UnderPantsAsset.ToString(); - h["skirt_item"] = SkirtItem.ToString(); - h["skirt_asset"] = SkirtAsset.ToString(); - - string attachments = GetAttachmentsString(); - if (attachments != String.Empty) - h["attachments"] = attachments; - - return h; - } - - public AvatarAppearance(Hashtable h) - { - Owner = new UUID((string)h["owner"]); - Serial = Convert.ToInt32((string)h["serial"]); - VisualParams = (byte[])h["visual_params"]; - - if (h.Contains("texture")) - { - byte[] te = h["texture"] as byte[]; - if (te != null && te.Length > 0) - Texture = new Primitive.TextureEntry(te, 0, te.Length); - } - else - { - // We shouldn't be receiving appearance hashtables without a TextureEntry, - // but in case we do this will prevent a failure when saving to the database - Texture = GetDefaultTexture(); - } - + String s = ""; + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) + if (m_texture.FaceTextures[i] != null) + s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); + + foreach (AvatarWearable awear in m_wearables) + s += String.Format("Wearable: item={0}, asset={1}\n",awear.ItemID,awear.AssetID); + + s += "Visual Params: "; + for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) + s += String.Format("{0},",m_visualparams[j]); + s += "\n"; - AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); - - m_wearables = new AvatarWearable[MAX_WEARABLES]; - for (int i = 0; i < MAX_WEARABLES; i++) - { - // this makes them all null - m_wearables[i] = new AvatarWearable(); - } - - BodyItem = new UUID((string)h["body_item"]); - BodyAsset = new UUID((string)h["body_asset"]); - SkinItem = new UUID((string)h["skin_item"]); - SkinAsset = new UUID((string)h["skin_asset"]); - HairItem = new UUID((string)h["hair_item"]); - HairAsset = new UUID((string)h["hair_asset"]); - EyesItem = new UUID((string)h["eyes_item"]); - EyesAsset = new UUID((string)h["eyes_asset"]); - ShirtItem = new UUID((string)h["shirt_item"]); - ShirtAsset = new UUID((string)h["shirt_asset"]); - PantsItem = new UUID((string)h["pants_item"]); - PantsAsset = new UUID((string)h["pants_asset"]); - ShoesItem = new UUID((string)h["shoes_item"]); - ShoesAsset = new UUID((string)h["shoes_asset"]); - SocksItem = new UUID((string)h["socks_item"]); - SocksAsset = new UUID((string)h["socks_asset"]); - JacketItem = new UUID((string)h["jacket_item"]); - JacketAsset = new UUID((string)h["jacket_asset"]); - GlovesItem = new UUID((string)h["gloves_item"]); - GlovesAsset = new UUID((string)h["gloves_asset"]); - UnderShirtItem = new UUID((string)h["undershirt_item"]); - UnderShirtAsset = new UUID((string)h["undershirt_asset"]); - UnderPantsItem = new UUID((string)h["underpants_item"]); - UnderPantsAsset = new UUID((string)h["underpants_asset"]); - SkirtItem = new UUID((string)h["skirt_item"]); - SkirtAsset = new UUID((string)h["skirt_asset"]); - - if (h.ContainsKey("attachments")) - { - SetAttachmentsString(h["attachments"].ToString()); - } + return s; } +// DEBUG OFF - private Dictionary m_attachments = new Dictionary(); - - public void SetAttachments(AttachmentData[] data) + public void SetAttachments(AvatarAttachment[] data) { - foreach (AttachmentData a in data) - { - m_attachments[a.AttachPoint] = new UUID[2]; - m_attachments[a.AttachPoint][0] = a.ItemID; - m_attachments[a.AttachPoint][1] = a.AssetID; - } + foreach (AvatarAttachment attach in data) + m_attachments[attach.AttachPoint] = new AvatarAttachment(attach); } - public void SetAttachments(Hashtable data) + public void SetAttachment(int attachpoint, UUID item, UUID asset) { - m_attachments.Clear(); - - if (data == null) + if (attachpoint == 0) return; - foreach (DictionaryEntry e in data) + if (item == UUID.Zero) { - int attachpoint = Convert.ToInt32(e.Key); - if (m_attachments.ContainsKey(attachpoint)) - continue; - - UUID item; - UUID asset; - - Hashtable uuids = (Hashtable) e.Value; - UUID.TryParse(uuids["item"].ToString(), out item); - UUID.TryParse(uuids["asset"].ToString(), out asset); - - UUID[] attachment = new UUID[2]; - attachment[0] = item; - attachment[1] = asset; - - m_attachments[attachpoint] = attachment; + m_attachments.Remove(attachpoint); + return; } - } - public Dictionary GetAttachmentDictionary() - { - return m_attachments; + m_attachments[attachpoint] = new AvatarAttachment(attachpoint,item,asset); } public Hashtable GetAttachments() @@ -610,16 +515,13 @@ namespace OpenSim.Framework Hashtable ret = new Hashtable(); - foreach (KeyValuePair kvp in m_attachments) + foreach (KeyValuePair kvp in m_attachments) { - int attachpoint = kvp.Key; - UUID[] uuids = kvp.Value; - Hashtable data = new Hashtable(); - data["item"] = uuids[0].ToString(); - data["asset"] = uuids[1].ToString(); + data["item"] = kvp.Value.ItemID.ToString(); + data["asset"] = kvp.Value.AssetID.ToString(); - ret[attachpoint] = data; + ret[kvp.Key] = data; } return ret; @@ -635,7 +537,7 @@ namespace OpenSim.Framework if (!m_attachments.ContainsKey(attachpoint)) return UUID.Zero; - return m_attachments[attachpoint][0]; + return m_attachments[attachpoint].ItemID; } public UUID GetAttachedAsset(int attachpoint) @@ -643,33 +545,14 @@ namespace OpenSim.Framework if (!m_attachments.ContainsKey(attachpoint)) return UUID.Zero; - return m_attachments[attachpoint][1]; - } - - public void SetAttachment(int attachpoint, UUID item, UUID asset) - { - if (attachpoint == 0) - return; - - if (item == UUID.Zero) - { - if (m_attachments.ContainsKey(attachpoint)) - m_attachments.Remove(attachpoint); - return; - } - - if (!m_attachments.ContainsKey(attachpoint)) - m_attachments[attachpoint] = new UUID[2]; - - m_attachments[attachpoint][0] = item; - m_attachments[attachpoint][1] = asset; + return m_attachments[attachpoint].AssetID; } public int GetAttachpoint(UUID itemID) { - foreach (KeyValuePair kvp in m_attachments) + foreach (KeyValuePair kvp in m_attachments) { - if (kvp.Value[0] == itemID) + if (kvp.Value.ItemID == itemID) { return kvp.Key; } @@ -690,42 +573,126 @@ namespace OpenSim.Framework m_attachments.Clear(); } - string GetAttachmentsString() + /// + /// Create an OSDMap from the appearance data + /// + public OSDMap Pack() { - List strings = new List(); + OSDMap data = new OSDMap(); - foreach (KeyValuePair e in m_attachments) + data["serial"] = OSD.FromInteger(m_serial); + data["height"] = OSD.FromReal(m_avatarHeight); + data["hipoffset"] = OSD.FromReal(m_hipOffset); + + // Wearables + OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); + for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) + wears.Add(m_wearables[i].Pack()); + data["wearables"] = wears; + + // Avatar Textures + OSDArray textures = new OSDArray(AvatarAppearance.TEXTURE_COUNT); + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) { - strings.Add(e.Key.ToString()); - strings.Add(e.Value[0].ToString()); - strings.Add(e.Value[1].ToString()); + if (m_texture.FaceTextures[i] != null) + textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID)); + else + textures.Add(OSD.FromUUID(UUID.Zero)); } + data["textures"] = textures; - return String.Join(",", strings.ToArray()); + // Visual Parameters + OSDBinary visualparams = new OSDBinary(m_visualparams); + data["visualparams"] = visualparams; + + // Attachments + OSDArray attachs = new OSDArray(m_attachments.Count); + foreach (KeyValuePair kvp in m_attachments) + attachs.Add(kvp.Value.Pack()); + data["attachments"] = attachs; + + return data; } - void SetAttachmentsString(string data) + /// + /// Unpack and OSDMap and initialize the appearance + /// from it + /// + public void Unpack(OSDMap data) { - string[] strings = data.Split(new char[] {','}); - int i = 0; + if ((data != null) && (data["appearance_serial"] != null)) + m_serial = data["appearance_serial"].AsInteger(); + if ((data != null) && (data["height"] != null)) + m_avatarHeight = (float)data["height"].AsReal(); + if ((data != null) && (data["hipoffset"] != null)) + m_hipOffset = (float)data["hipoffset"].AsReal(); + + try + { + // Wearables + SetDefaultWearables(); + if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) + { + OSDArray wears = (OSDArray)(data["wearables"]); + for (int i = 0; i < wears.Count; i++) + m_wearables[i] = new AvatarWearable((OSDMap)wears[i]); + } + else + { + m_log.Warn("[AVATARAPPEARANCE] failed to unpack wearables"); + } - m_attachments.Clear(); + // Avatar Textures + SetDefaultTexture(); + if ((data != null) && (data["textures"] != null) && (data["textures"]).Type == OSDType.Array) + { + OSDArray textures = (OSDArray)(data["textures"]); + for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++) + { + if (textures[i] != null) + { + UUID textureID = textures[i].AsUUID(); + if (textureID != UUID.Zero) + m_texture.CreateFace((uint)i).TextureID = textureID; + } + } + } + else + { + m_log.Warn("[AVATARAPPEARANCE] failed to unpack textures"); + } - while (strings.Length - i > 2) - { - int attachpoint = Int32.Parse(strings[i]); - UUID item = new UUID(strings[i+1]); - UUID asset = new UUID(strings[i+2]); - i += 3; + // Visual Parameters + SetDefaultParams(); + if ((data != null) && (data["visualparams"] != null)) + { + if ((data["visualparams"].Type == OSDType.Binary) || (data["visualparams"].Type == OSDType.Array)) + m_visualparams = data["visualparams"].AsBinary(); + } + else + { + m_log.Warn("[AVATARAPPEARANCE] failed to unpack visual parameters"); + } - if (!m_attachments.ContainsKey(attachpoint)) + // Attachments + m_attachments = new Dictionary(); + if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array) { - m_attachments[attachpoint] = new UUID[2]; - m_attachments[attachpoint][0] = item; - m_attachments[attachpoint][1] = asset; + OSDArray attachs = (OSDArray)(data["attachments"]); + for (int i = 0; i < attachs.Count; i++) + { + AvatarAttachment attach = new AvatarAttachment((OSDMap)attachs[i]); + m_attachments[attach.AttachPoint] = attach; + } } } + catch (Exception e) + { + m_log.ErrorFormat("[AVATARAPPEARANCE] unpack failed badly: {0}",e.Message); + } } + + /// /// Viewer Params Array Element for AgentSetAppearance /// Generated from LibOMV's Visual Params list -- cgit v1.1 From 267f18925d06ca05e2a5ffbfbb63582783762439 Mon Sep 17 00:00:00 2001 From: Master ScienceSim Date: Thu, 21 Oct 2010 16:48:58 -0700 Subject: First attempt to get multiple attachments working to support viewer2. The attachment code appears to work correctly for 1.23 viewers so, in spite of some big changes in the internal representation, there don't appear to be regressions. That being said, I still can't get a viewer2 avatar to show correctly. --- OpenSim/Framework/AvatarAppearance.cs | 138 +++++++++++++++++----------------- 1 file changed, 70 insertions(+), 68 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 55646dd..ba0cad2 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -51,7 +51,7 @@ namespace OpenSim.Framework protected byte[] m_visualparams; protected Primitive.TextureEntry m_texture; protected AvatarWearable[] m_wearables; - protected Dictionary m_attachments; + protected Dictionary> m_attachments; protected float m_avatarHeight = 0; protected float m_hipOffset = 0; @@ -85,11 +85,6 @@ namespace OpenSim.Framework set { m_wearables = value; } } - public virtual Dictionary Attachments - { - get { return m_attachments; } - } - public virtual UUID BodyItem { get { return m_wearables[AvatarWearable.BODY].ItemID; } set { m_wearables[AvatarWearable.BODY].ItemID = value; } @@ -246,7 +241,7 @@ namespace OpenSim.Framework SetDefaultParams(); SetHeight(); - m_attachments = new Dictionary(); + m_attachments = new Dictionary>(); } public AvatarAppearance(UUID avatarID, OSDMap map) @@ -284,7 +279,7 @@ namespace OpenSim.Framework SetHeight(); - m_attachments = new Dictionary(); + m_attachments = new Dictionary>(); } public AvatarAppearance(AvatarAppearance appearance) @@ -302,7 +297,7 @@ namespace OpenSim.Framework SetDefaultParams(); SetHeight(); - m_attachments = new Dictionary(); + m_attachments = new Dictionary>(); return; } @@ -329,9 +324,10 @@ namespace OpenSim.Framework if (appearance.VisualParams != null) m_visualparams = (byte[])appearance.VisualParams.Clone(); - m_attachments = new Dictionary(); - foreach (KeyValuePair kvp in appearance.Attachments) - m_attachments[kvp.Key] = new AvatarAttachment(kvp.Value); + // Copy the attachment, force append mode since that ensures consistency + m_attachments = new Dictionary>(); + foreach (AvatarAttachment attachment in appearance.GetAttachments()) + AppendAttachment(new AvatarAttachment(attachment)); } protected virtual void SetDefaultWearables() @@ -487,12 +483,41 @@ namespace OpenSim.Framework } // DEBUG OFF - public void SetAttachments(AvatarAttachment[] data) + /// + /// Get a list of the attachments, note that there may be + /// duplicate attachpoints + /// + public List GetAttachments() + { + List alist = new List(); + foreach (KeyValuePair> kvp in m_attachments) + { + foreach (AvatarAttachment attach in kvp.Value) + alist.Add(new AvatarAttachment(attach)); + } + + return alist; + } + + internal void AppendAttachment(AvatarAttachment attach) { - foreach (AvatarAttachment attach in data) - m_attachments[attach.AttachPoint] = new AvatarAttachment(attach); + if (! m_attachments.ContainsKey(attach.AttachPoint)) + m_attachments[attach.AttachPoint] = new List(); + m_attachments[attach.AttachPoint].Add(attach); } + internal void ReplaceAttachment(AvatarAttachment attach) + { + m_attachments[attach.AttachPoint] = new List(); + m_attachments[attach.AttachPoint].Add(attach); + } + + /// + /// Add an attachment, if the attachpoint has the + /// 0x80 bit set then we assume this is an append + /// operation otherwise we replace whatever is + /// currently attached at the attachpoint + /// public void SetAttachment(int attachpoint, UUID item, UUID asset) { if (attachpoint == 0) @@ -505,67 +530,47 @@ namespace OpenSim.Framework return; } - m_attachments[attachpoint] = new AvatarAttachment(attachpoint,item,asset); - } - - public Hashtable GetAttachments() - { - if (m_attachments.Count == 0) - return null; - - Hashtable ret = new Hashtable(); - - foreach (KeyValuePair kvp in m_attachments) + // check if this is an append or a replace, 0x80 marks it as an append + if ((attachpoint & 0x80) > 0) { - Hashtable data = new Hashtable(); - data["item"] = kvp.Value.ItemID.ToString(); - data["asset"] = kvp.Value.AssetID.ToString(); - - ret[kvp.Key] = data; + // strip the append bit + int point = attachpoint & 0x7F; + AppendAttachment(new AvatarAttachment(point, item, asset)); + } + else + { + ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); } - - return ret; - } - - public List GetAttachedPoints() - { - return new List(m_attachments.Keys); - } - - public UUID GetAttachedItem(int attachpoint) - { - if (!m_attachments.ContainsKey(attachpoint)) - return UUID.Zero; - - return m_attachments[attachpoint].ItemID; - } - - public UUID GetAttachedAsset(int attachpoint) - { - if (!m_attachments.ContainsKey(attachpoint)) - return UUID.Zero; - - return m_attachments[attachpoint].AssetID; } public int GetAttachpoint(UUID itemID) { - foreach (KeyValuePair kvp in m_attachments) + foreach (KeyValuePair> kvp in m_attachments) { - if (kvp.Value.ItemID == itemID) - { + int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); + if (index >= 0) return kvp.Key; - } } + return 0; } public void DetachAttachment(UUID itemID) { - int attachpoint = GetAttachpoint(itemID); + foreach (KeyValuePair> kvp in m_attachments) + { + int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); + if (index >= 0) + { + // Remove it from the list of attachments at that attach point + m_attachments[kvp.Key].RemoveAt(index); - if (attachpoint > 0) - m_attachments.Remove(attachpoint); + // And remove the list if there are no more attachments here + if (m_attachments[kvp.Key].Count == 0) + m_attachments.Remove(kvp.Key); + return; + } + } } public void ClearAttachments() @@ -607,8 +612,8 @@ namespace OpenSim.Framework // Attachments OSDArray attachs = new OSDArray(m_attachments.Count); - foreach (KeyValuePair kvp in m_attachments) - attachs.Add(kvp.Value.Pack()); + foreach (AvatarAttachment attach in GetAttachments()) + attachs.Add(attach.Pack()); data["attachments"] = attachs; return data; @@ -675,15 +680,12 @@ namespace OpenSim.Framework } // Attachments - m_attachments = new Dictionary(); + m_attachments = new Dictionary>(); if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array) { OSDArray attachs = (OSDArray)(data["attachments"]); for (int i = 0; i < attachs.Count; i++) - { - AvatarAttachment attach = new AvatarAttachment((OSDMap)attachs[i]); - m_attachments[attach.AttachPoint] = attach; - } + AppendAttachment(new AvatarAttachment((OSDMap)attachs[i])); } } catch (Exception e) -- cgit v1.1 From 6e58c3d563b50c5797d1cfffbaec3fe82f18c2ea Mon Sep 17 00:00:00 2001 From: Master ScienceSim Date: Mon, 25 Oct 2010 14:11:47 -0700 Subject: Half of the compatibility is working. Login into a new region with old data works. Teleport out of a new region with old data works. Teleport into a new region with old data does not trigger the necessary rebake. --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index ba0cad2..05330c7 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -389,7 +389,7 @@ namespace OpenSim.Framework changed = true; // DEBUG ON if (newface != null) - m_log.WarnFormat("[SCENEPRESENCE] index {0}, new texture id {1}",i,newface.TextureID); + m_log.WarnFormat("[AVATAR APPEARANCE] index {0}, new texture id {1}",i,newface.TextureID); // DEBUG OFF } -- cgit v1.1 From 0f28fa400d1f853cc3c3ebd2707b08ed06d2f127 Mon Sep 17 00:00:00 2001 From: Master ScienceSim Date: Thu, 28 Oct 2010 09:00:39 -0700 Subject: Added background thread to handle delayed send and save of appearance to accommodate batching of the many updates that happen on login and teleport. Fixed handling of the serial property in appearance. --- OpenSim/Framework/AvatarAppearance.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 05330c7..e66a1e7 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -233,7 +233,7 @@ namespace OpenSim.Framework // DEBUG ON m_log.WarnFormat("[AVATAR APPEARANCE] create empty appearance for {0}",owner); // DEBUG OFF - m_serial = 0; + m_serial = 1; m_owner = owner; SetDefaultWearables(); @@ -289,7 +289,7 @@ namespace OpenSim.Framework // DEBUG OFF if (appearance == null) { - m_serial = 0; + m_serial = 1; m_owner = UUID.Zero; SetDefaultWearables(); @@ -467,6 +467,9 @@ namespace OpenSim.Framework public override String ToString() { String s = ""; + + s += String.Format("Serial: {0}\n",m_serial); + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) if (m_texture.FaceTextures[i] != null) s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); @@ -625,8 +628,8 @@ namespace OpenSim.Framework /// public void Unpack(OSDMap data) { - if ((data != null) && (data["appearance_serial"] != null)) - m_serial = data["appearance_serial"].AsInteger(); + if ((data != null) && (data["serial"] != null)) + m_serial = data["serial"].AsInteger(); if ((data != null) && (data["height"] != null)) m_avatarHeight = (float)data["height"].AsReal(); if ((data != null) && (data["hipoffset"] != null)) -- cgit v1.1 From 5f4badf9e2cd96f4a4a48b0019bd5f39298213ab Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Oct 2010 20:48:37 +0200 Subject: Add my work on top of cmickeyb's --- OpenSim/Framework/AvatarAppearance.cs | 100 +++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 55646dd..4738d88 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -35,6 +35,104 @@ using log4net; namespace OpenSim.Framework { + // A special dictionary for avatar appearance + public struct LayerItem + { + public UUID ItemID; + public UUID AssetID; + + public LayerItem(UUID itemID, UUID assetID) + { + ItemID = itemID; + AssetID = assetID; + } + } + + public class Layer + { + protected int m_layerType; + protected Dictionary m_items = new Dictionary(); + protected List m_ids = new List(); + + public Layer(int type) + { + m_layerType = type; + } + + public int LayerType + { + get { return m_layerType; } + } + + public int Count + { + get { return m_ids.Count; } + } + + public void Add(UUID itemID, UUID assetID) + { + if (m_items.ContainsKey(itemID)) + return; + if (m_ids.Count >= 5) + return; + + m_ids.Add(itemID); + m_items[itemID] = assetID; + } + + public void Wear(UUID itemID, UUID assetID) + { + Clear(); + Add(itemID, assetID); + } + + public void Clear() + { + m_ids.Clear(); + m_items.Clear(); + } + + public void RemoveItem(UUID itemID) + { + if (m_items.ContainsKey(itemID)) + { + m_ids.Remove(itemID); + m_items.Remove(itemID); + } + } + + public void RemoveAsset(UUID assetID) + { + UUID itemID = UUID.Zero; + + foreach (KeyValuePair kvp in m_items) + { + if (kvp.Value == assetID) + { + itemID = kvp.Key; + break; + } + } + + if (itemID != UUID.Zero) + { + m_ids.Remove(itemID); + m_items.Remove(itemID); + } + } + + public LayerItem this [int idx] + { + get + { + if (idx >= m_ids.Count || idx < 0) + return new LayerItem(UUID.Zero, UUID.Zero); + + return new LayerItem(m_ids[idx], m_items[m_ids[idx]]); + } + } + } + /// /// Contains the Avatar's Appearance and methods to manipulate the appearance. /// @@ -1456,4 +1554,4 @@ namespace OpenSim.Framework SKIRT_SKIRT_BLUE = 217 } } -} \ No newline at end of file +} -- cgit v1.1 From f5c9a56c8b73ef93db712fefe9f0366c4983e04f Mon Sep 17 00:00:00 2001 From: Master ScienceSim Date: Fri, 29 Oct 2010 13:37:13 -0700 Subject: Bunch of fixes that reduce the number of times appearance and avatar data are sent. And the number of times they are stored. --- OpenSim/Framework/AvatarAppearance.cs | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index e66a1e7..17e4eb4 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -45,6 +45,7 @@ namespace OpenSim.Framework public readonly static int VISUALPARAM_COUNT = 218; public readonly static int TEXTURE_COUNT = 21; + public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; protected UUID m_owner; protected int m_serial = 1; @@ -347,14 +348,8 @@ namespace OpenSim.Framework protected virtual void SetDefaultTexture() { m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); - // The initialization of these seems to force a rebake regardless of whether it is needed - // m_textures.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); - // m_textures.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID; - // m_textures.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID; - // m_textures.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); - // m_textures.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); - // m_textures.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); - // m_textures.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011"); + for (uint i = 0; i < TEXTURE_COUNT; i++) + m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE); } /// @@ -371,7 +366,7 @@ namespace OpenSim.Framework // made. We determine if any of the textures actually // changed to know if the appearance should be saved later bool changed = false; - for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) { Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i]; Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i]; @@ -385,7 +380,6 @@ namespace OpenSim.Framework if (oldface != null && oldface.TextureID == newface.TextureID) continue; } - m_texture.FaceTextures[i] = (newface != null) ? new Primitive.TextureEntryFace(newface) : null; changed = true; // DEBUG ON if (newface != null) @@ -393,6 +387,7 @@ namespace OpenSim.Framework // DEBUG OFF } + m_texture = textureEntry; return changed; } @@ -415,8 +410,8 @@ namespace OpenSim.Framework if (visualParams[i] != m_visualparams[i]) { // DEBUG ON - m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", - i,m_visualparams[i],visualParams[i]); +// m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", +// i,m_visualparams[i],visualParams[i]); // DEBUG OFF m_visualparams[i] = visualParams[i]; changed = true; @@ -581,6 +576,8 @@ namespace OpenSim.Framework m_attachments.Clear(); } + #region Packing Functions + /// /// Create an OSDMap from the appearance data /// @@ -605,7 +602,7 @@ namespace OpenSim.Framework if (m_texture.FaceTextures[i] != null) textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID)); else - textures.Add(OSD.FromUUID(UUID.Zero)); + textures.Add(OSD.FromUUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); } data["textures"] = textures; @@ -657,12 +654,10 @@ namespace OpenSim.Framework OSDArray textures = (OSDArray)(data["textures"]); for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++) { + UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; if (textures[i] != null) - { - UUID textureID = textures[i].AsUUID(); - if (textureID != UUID.Zero) - m_texture.CreateFace((uint)i).TextureID = textureID; - } + textureID = textures[i].AsUUID(); + m_texture.CreateFace((uint)i).TextureID = new UUID(textureID); } } else @@ -697,6 +692,9 @@ namespace OpenSim.Framework } } + #endregion + + #region VPElement /// /// Viewer Params Array Element for AgentSetAppearance @@ -1460,5 +1458,6 @@ namespace OpenSim.Framework SKIRT_SKIRT_GREEN = 216, SKIRT_SKIRT_BLUE = 217 } + #endregion } } \ No newline at end of file -- cgit v1.1 From e66ec432afccb90ae400041e2428b26ad108d373 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 29 Oct 2010 23:45:10 +0100 Subject: Rationalize the logging messages from the merged appearance branch, commenting out most of them as per Mic --- OpenSim/Framework/AvatarAppearance.cs | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a4bb765..9494410 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -329,9 +329,8 @@ namespace OpenSim.Framework public AvatarAppearance(UUID owner) { -// DEBUG ON - m_log.WarnFormat("[AVATAR APPEARANCE] create empty appearance for {0}",owner); -// DEBUG OFF +// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner); + m_serial = 1; m_owner = owner; @@ -345,9 +344,8 @@ namespace OpenSim.Framework public AvatarAppearance(UUID avatarID, OSDMap map) { -// DEBUG ON - m_log.WarnFormat("[AVATAR APPEARANCE] create appearance for {0} from OSDMap",avatarID); -// DEBUG OFF +// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID); + m_owner = avatarID; Unpack(map); SetHeight(); @@ -355,9 +353,8 @@ namespace OpenSim.Framework public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) { -// DEBUG ON - m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); -// DEBUG OFF +// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); + m_serial = 1; m_owner = avatarID; @@ -383,9 +380,8 @@ namespace OpenSim.Framework public AvatarAppearance(AvatarAppearance appearance) { -// DEBUG ON - m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); -// DEBUG OFF +// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); + if (appearance == null) { m_serial = 1; @@ -479,10 +475,9 @@ namespace OpenSim.Framework } changed = true; -// DEBUG ON - if (newface != null) - m_log.WarnFormat("[AVATAR APPEARANCE] index {0}, new texture id {1}",i,newface.TextureID); -// DEBUG OFF + +// if (newface != null) +// m_log.WarnFormat("[AVATAR APPEARANCE]: index {0}, new texture id {1}",i,newface.TextureID); } m_texture = textureEntry; @@ -742,7 +737,7 @@ namespace OpenSim.Framework } else { - m_log.Warn("[AVATARAPPEARANCE] failed to unpack wearables"); + m_log.Warn("[AVATAR APPEARANCE]: failed to unpack wearables"); } // Avatar Textures @@ -760,7 +755,7 @@ namespace OpenSim.Framework } else { - m_log.Warn("[AVATARAPPEARANCE] failed to unpack textures"); + m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures"); } // Visual Parameters @@ -772,7 +767,7 @@ namespace OpenSim.Framework } else { - m_log.Warn("[AVATARAPPEARANCE] failed to unpack visual parameters"); + m_log.Warn("[AVATAR APPEARANCE]: failed to unpack visual parameters"); } // Attachments @@ -786,7 +781,7 @@ namespace OpenSim.Framework } catch (Exception e) { - m_log.ErrorFormat("[AVATARAPPEARANCE] unpack failed badly: {0}",e.Message); + m_log.ErrorFormat("[AVATAR APPEARANCE]: unpack failed badly: {0}{1}", e.Message, e.StackTrace); } } -- cgit v1.1 From 818ed2032aa4e6c0a9ede3598d64f0c7960135c4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 30 Oct 2010 00:41:36 +0100 Subject: READ CAREFULLY!!! This is a BROKEN commit. It is UNTESTED and INCOMPLETE. It contains a major interface version bump and will NOT work with earlier grid services. This is preliminary work that will lead to layers support. Rest appearance services are commented out completely, they will have to be adapted by someone who actually uses them. Remote admin is working, but has no layers support. There is no layers support in the database. Login likely won't work. You have been warned. --- OpenSim/Framework/AvatarAppearance.cs | 241 ++-------------------------------- 1 file changed, 9 insertions(+), 232 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a4bb765..f378e96 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -35,104 +35,6 @@ using log4net; namespace OpenSim.Framework { - // A special dictionary for avatar appearance - public struct LayerItem - { - public UUID ItemID; - public UUID AssetID; - - public LayerItem(UUID itemID, UUID assetID) - { - ItemID = itemID; - AssetID = assetID; - } - } - - public class Layer - { - protected int m_layerType; - protected Dictionary m_items = new Dictionary(); - protected List m_ids = new List(); - - public Layer(int type) - { - m_layerType = type; - } - - public int LayerType - { - get { return m_layerType; } - } - - public int Count - { - get { return m_ids.Count; } - } - - public void Add(UUID itemID, UUID assetID) - { - if (m_items.ContainsKey(itemID)) - return; - if (m_ids.Count >= 5) - return; - - m_ids.Add(itemID); - m_items[itemID] = assetID; - } - - public void Wear(UUID itemID, UUID assetID) - { - Clear(); - Add(itemID, assetID); - } - - public void Clear() - { - m_ids.Clear(); - m_items.Clear(); - } - - public void RemoveItem(UUID itemID) - { - if (m_items.ContainsKey(itemID)) - { - m_ids.Remove(itemID); - m_items.Remove(itemID); - } - } - - public void RemoveAsset(UUID assetID) - { - UUID itemID = UUID.Zero; - - foreach (KeyValuePair kvp in m_items) - { - if (kvp.Value == assetID) - { - itemID = kvp.Key; - break; - } - } - - if (itemID != UUID.Zero) - { - m_ids.Remove(itemID); - m_items.Remove(itemID); - } - } - - public LayerItem this [int idx] - { - get - { - if (idx >= m_ids.Count || idx < 0) - return new LayerItem(UUID.Zero, UUID.Zero); - - return new LayerItem(m_ids[idx], m_items[m_ids[idx]]); - } - } - } - /// /// Contains the Avatar's Appearance and methods to manipulate the appearance. /// @@ -184,136 +86,6 @@ namespace OpenSim.Framework set { m_wearables = value; } } - public virtual UUID BodyItem { - get { return m_wearables[AvatarWearable.BODY].ItemID; } - set { m_wearables[AvatarWearable.BODY].ItemID = value; } - } - - public virtual UUID BodyAsset { - get { return m_wearables[AvatarWearable.BODY].AssetID; } - set { m_wearables[AvatarWearable.BODY].AssetID = value; } - } - - public virtual UUID SkinItem { - get { return m_wearables[AvatarWearable.SKIN].ItemID; } - set { m_wearables[AvatarWearable.SKIN].ItemID = value; } - } - - public virtual UUID SkinAsset { - get { return m_wearables[AvatarWearable.SKIN].AssetID; } - set { m_wearables[AvatarWearable.SKIN].AssetID = value; } - } - - public virtual UUID HairItem { - get { return m_wearables[AvatarWearable.HAIR].ItemID; } - set { m_wearables[AvatarWearable.HAIR].ItemID = value; } - } - - public virtual UUID HairAsset { - get { return m_wearables[AvatarWearable.HAIR].AssetID; } - set { m_wearables[AvatarWearable.HAIR].AssetID = value; } - } - - public virtual UUID EyesItem { - get { return m_wearables[AvatarWearable.EYES].ItemID; } - set { m_wearables[AvatarWearable.EYES].ItemID = value; } - } - - public virtual UUID EyesAsset { - get { return m_wearables[AvatarWearable.EYES].AssetID; } - set { m_wearables[AvatarWearable.EYES].AssetID = value; } - } - - public virtual UUID ShirtItem { - get { return m_wearables[AvatarWearable.SHIRT].ItemID; } - set { m_wearables[AvatarWearable.SHIRT].ItemID = value; } - } - - public virtual UUID ShirtAsset { - get { return m_wearables[AvatarWearable.SHIRT].AssetID; } - set { m_wearables[AvatarWearable.SHIRT].AssetID = value; } - } - - public virtual UUID PantsItem { - get { return m_wearables[AvatarWearable.PANTS].ItemID; } - set { m_wearables[AvatarWearable.PANTS].ItemID = value; } - } - - public virtual UUID PantsAsset { - get { return m_wearables[AvatarWearable.PANTS].AssetID; } - set { m_wearables[AvatarWearable.PANTS].AssetID = value; } - } - - public virtual UUID ShoesItem { - get { return m_wearables[AvatarWearable.SHOES].ItemID; } - set { m_wearables[AvatarWearable.SHOES].ItemID = value; } - } - - public virtual UUID ShoesAsset { - get { return m_wearables[AvatarWearable.SHOES].AssetID; } - set { m_wearables[AvatarWearable.SHOES].AssetID = value; } - } - - public virtual UUID SocksItem { - get { return m_wearables[AvatarWearable.SOCKS].ItemID; } - set { m_wearables[AvatarWearable.SOCKS].ItemID = value; } - } - - public virtual UUID SocksAsset { - get { return m_wearables[AvatarWearable.SOCKS].AssetID; } - set { m_wearables[AvatarWearable.SOCKS].AssetID = value; } - } - - public virtual UUID JacketItem { - get { return m_wearables[AvatarWearable.JACKET].ItemID; } - set { m_wearables[AvatarWearable.JACKET].ItemID = value; } - } - - public virtual UUID JacketAsset { - get { return m_wearables[AvatarWearable.JACKET].AssetID; } - set { m_wearables[AvatarWearable.JACKET].AssetID = value; } - } - - public virtual UUID GlovesItem { - get { return m_wearables[AvatarWearable.GLOVES].ItemID; } - set { m_wearables[AvatarWearable.GLOVES].ItemID = value; } - } - - public virtual UUID GlovesAsset { - get { return m_wearables[AvatarWearable.GLOVES].AssetID; } - set { m_wearables[AvatarWearable.GLOVES].AssetID = value; } - } - - public virtual UUID UnderShirtItem { - get { return m_wearables[AvatarWearable.UNDERSHIRT].ItemID; } - set { m_wearables[AvatarWearable.UNDERSHIRT].ItemID = value; } - } - - public virtual UUID UnderShirtAsset { - get { return m_wearables[AvatarWearable.UNDERSHIRT].AssetID; } - set { m_wearables[AvatarWearable.UNDERSHIRT].AssetID = value; } - } - - public virtual UUID UnderPantsItem { - get { return m_wearables[AvatarWearable.UNDERPANTS].ItemID; } - set { m_wearables[AvatarWearable.UNDERPANTS].ItemID = value; } - } - - public virtual UUID UnderPantsAsset { - get { return m_wearables[AvatarWearable.UNDERPANTS].AssetID; } - set { m_wearables[AvatarWearable.UNDERPANTS].AssetID = value; } - } - - public virtual UUID SkirtItem { - get { return m_wearables[AvatarWearable.SKIRT].ItemID; } - set { m_wearables[AvatarWearable.SKIRT].ItemID = value; } - } - - public virtual UUID SkirtAsset { - get { return m_wearables[AvatarWearable.SKIRT].AssetID; } - set { m_wearables[AvatarWearable.SKIRT].AssetID = value; } - } - public virtual float AvatarHeight { get { return m_avatarHeight; } @@ -407,7 +179,7 @@ namespace OpenSim.Framework m_wearables = null; if (appearance.Wearables != null) { - m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 13 of these + m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 15 of these for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) SetWearable(i,appearance.Wearables[i]); } @@ -552,7 +324,9 @@ namespace OpenSim.Framework // DEBUG ON // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); // DEBUG OFF - m_wearables[wearableId] = new AvatarWearable(wearable.ItemID,wearable.AssetID); + m_wearables[wearableId].Clear(); + for (int i = 0 ; i < wearable.Count ; i++) + m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); } @@ -568,7 +342,10 @@ namespace OpenSim.Framework s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); foreach (AvatarWearable awear in m_wearables) - s += String.Format("Wearable: item={0}, asset={1}\n",awear.ItemID,awear.AssetID); + { + for ( int i = 0 ; i < awear.Count ; i++ ) + s += String.Format("Wearable: item={0}, asset={1}\n",awear[i].ItemID,awear[i].AssetID); + } s += "Visual Params: "; for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) @@ -738,7 +515,7 @@ namespace OpenSim.Framework { OSDArray wears = (OSDArray)(data["wearables"]); for (int i = 0; i < wears.Count; i++) - m_wearables[i] = new AvatarWearable((OSDMap)wears[i]); + m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); } else { -- cgit v1.1 From ff7da2082d4d44b34c3ef312d5ec5e88c94931e1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 30 Oct 2010 02:25:25 +0100 Subject: This commit fixes all the appearance related null refs. Still can't log in, client displays a blank error box. --- OpenSim/Framework/AvatarAppearance.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index ee60622..1e003f7 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -111,6 +111,10 @@ namespace OpenSim.Framework SetDefaultParams(); SetHeight(); + m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; + for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) + m_wearables[i] = new AvatarWearable(); + m_attachments = new Dictionary>(); } @@ -172,10 +176,11 @@ namespace OpenSim.Framework m_serial = appearance.Serial; m_owner = appearance.Owner; - m_wearables = null; + m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; + for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) + m_wearables[i] = new AvatarWearable(); if (appearance.Wearables != null) { - m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 15 of these for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) SetWearable(i,appearance.Wearables[i]); } -- cgit v1.1 From d0895a4a3ae8a60764db4ada43c194fddc90ddf4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 30 Oct 2010 03:28:59 +0100 Subject: On first login, Ruth is back now. Strangely, inventory items are created for tattoo and alpha layers. Any change of appearance in the sim makes the green gnome reappear on next login. Progress of sorts. --- OpenSim/Framework/AvatarAppearance.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 1e003f7..f0d8335 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -111,10 +111,6 @@ namespace OpenSim.Framework SetDefaultParams(); SetHeight(); - m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; - for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) - m_wearables[i] = new AvatarWearable(); - m_attachments = new Dictionary>(); } -- cgit v1.1 From e98d8d500f5c0dda6e9ef8b9a0e1bddec8510d1d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 30 Oct 2010 19:06:47 +0100 Subject: Fix logins and avatar appearance. Contains a Migration. May contain nuts. This will cause visual params to be persisted along with worn items. With this, alpha and tattoo laters will be saved. Multiple layers MAY work, but not tested because I don't use Viewer 2. --- OpenSim/Framework/AvatarAppearance.cs | 40 +++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index f0d8335..d0a22b2 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -150,7 +150,11 @@ namespace OpenSim.Framework m_attachments = new Dictionary>(); } - public AvatarAppearance(AvatarAppearance appearance) + public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) + { + } + + public AvatarAppearance(AvatarAppearance appearance, bool copyWearables) { // m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); @@ -175,7 +179,7 @@ namespace OpenSim.Framework m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) m_wearables[i] = new AvatarWearable(); - if (appearance.Wearables != null) + if (copyWearables && (appearance.Wearables != null)) { for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) SetWearable(i,appearance.Wearables[i]); @@ -198,6 +202,28 @@ namespace OpenSim.Framework AppendAttachment(new AvatarAttachment(attachment)); } + public void GetAssetsFrom(AvatarAppearance app) + { + for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) + { + for (int j = 0 ; j < m_wearables[i].Count ; j++) + { + UUID itemID = m_wearables[i][j].ItemID; + UUID assetID = app.Wearables[i].GetAsset(itemID); + + if (assetID != UUID.Zero) + m_wearables[i].Add(itemID, assetID); + } + } + } + + public void ClearWearables() + { + m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; + for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) + m_wearables[i] = new AvatarWearable(); + } + protected virtual void SetDefaultWearables() { m_wearables = AvatarWearable.DefaultWearables; @@ -205,11 +231,11 @@ namespace OpenSim.Framework protected virtual void SetDefaultParams() { - m_visualparams = new byte[VISUALPARAM_COUNT]; - for (int i = 0; i < VISUALPARAM_COUNT; i++) - { - m_visualparams[i] = 150; - } + m_visualparams = new byte[] { 56,23,66,0,0,25,0,124,107,0,0,91,137,36,180,79,78,20,32,255,0,63,137,137,63,122,0,71,127,94,63,0,150,150,150,17,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,78,0,0,0,0,0,0,0,0,0,145,216,133,0,0,0,219,107,150,150,165,135,0,150,150,150,63,112,155,150,150,150,150,150,150,150,150,150,150,150,0,0,0,0,188,255,91,219,124,0,150,127,165,127,127,127,127,59,63,107,71,68,89,33,79,114,178,127,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,0,85,131,117,127,147,163,104,0,140,18,0,107,130,0,150,150,198,0,0,40,38,91,165,209,198,127,127,153,204,51,51,150,150,255,204,0,150,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,22,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; +// for (int i = 0; i < VISUALPARAM_COUNT; i++) +// { +// m_visualparams[i] = 150; +// } } protected virtual void SetDefaultTexture() -- cgit v1.1 From 43ac44b02896343ac4df82cd7c91c1ea2c119cf7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 2 Nov 2010 21:41:27 +0000 Subject: Fix default club feet --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index d0a22b2..69e1ae6 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -231,7 +231,7 @@ namespace OpenSim.Framework protected virtual void SetDefaultParams() { - m_visualparams = new byte[] { 56,23,66,0,0,25,0,124,107,0,0,91,137,36,180,79,78,20,32,255,0,63,137,137,63,122,0,71,127,94,63,0,150,150,150,17,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,78,0,0,0,0,0,0,0,0,0,145,216,133,0,0,0,219,107,150,150,165,135,0,150,150,150,63,112,155,150,150,150,150,150,150,150,150,150,150,150,0,0,0,0,188,255,91,219,124,0,150,127,165,127,127,127,127,59,63,107,71,68,89,33,79,114,178,127,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,0,85,131,117,127,147,163,104,0,140,18,0,107,130,0,150,150,198,0,0,40,38,91,165,209,198,127,127,153,204,51,51,150,150,255,204,0,150,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,22,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; + m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; // for (int i = 0; i < VISUALPARAM_COUNT; i++) // { // m_visualparams[i] = 150; -- cgit v1.1 From ae9c4a4d118e126b4f849bbfed112d0971459339 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 8 Nov 2010 07:48:35 -0500 Subject: Formatting cleanup. --- OpenSim/Framework/AvatarAppearance.cs | 77 +++++++++++++++++------------------ 1 file changed, 38 insertions(+), 39 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 69e1ae6..2906af8 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -46,7 +46,7 @@ namespace OpenSim.Framework public readonly static int TEXTURE_COUNT = 21; public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; - + protected UUID m_owner; protected int m_serial = 1; protected byte[] m_visualparams; @@ -110,10 +110,10 @@ namespace OpenSim.Framework SetDefaultTexture(); SetDefaultParams(); SetHeight(); - + m_attachments = new Dictionary>(); } - + public AvatarAppearance(UUID avatarID, OSDMap map) { // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID); @@ -122,11 +122,11 @@ namespace OpenSim.Framework Unpack(map); SetHeight(); } - + public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) { // m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); - + m_serial = 1; m_owner = avatarID; @@ -134,7 +134,7 @@ namespace OpenSim.Framework m_wearables = wearables; else SetDefaultWearables(); - + if (textureEntry != null) m_texture = textureEntry; else @@ -172,41 +172,41 @@ namespace OpenSim.Framework return; } - + m_serial = appearance.Serial; m_owner = appearance.Owner; m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; - for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) + for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) m_wearables[i] = new AvatarWearable(); if (copyWearables && (appearance.Wearables != null)) { for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) SetWearable(i,appearance.Wearables[i]); } - + m_texture = null; if (appearance.Texture != null) { byte[] tbytes = appearance.Texture.GetBytes(); m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length); } - + m_visualparams = null; if (appearance.VisualParams != null) m_visualparams = (byte[])appearance.VisualParams.Clone(); - + // Copy the attachment, force append mode since that ensures consistency m_attachments = new Dictionary>(); foreach (AvatarAttachment attachment in appearance.GetAttachments()) AppendAttachment(new AvatarAttachment(attachment)); } - + public void GetAssetsFrom(AvatarAppearance app) { - for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) + for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) { - for (int j = 0 ; j < m_wearables[i].Count ; j++) + for (int j = 0; j < m_wearables[i].Count; j++) { UUID itemID = m_wearables[i][j].ItemID; UUID assetID = app.Wearables[i].GetAsset(itemID); @@ -220,7 +220,7 @@ namespace OpenSim.Framework public void ClearWearables() { m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; - for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) + for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) m_wearables[i] = new AvatarWearable(); } @@ -248,7 +248,7 @@ namespace OpenSim.Framework /// /// Set up appearance textures. /// Returns boolean that indicates whether the new entries actually change the - /// existing values. + /// existing values. /// public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry) { @@ -263,7 +263,7 @@ namespace OpenSim.Framework { Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i]; Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i]; - + if (newface == null) { if (oldface == null) continue; @@ -274,7 +274,7 @@ namespace OpenSim.Framework } changed = true; - + // if (newface != null) // m_log.WarnFormat("[AVATAR APPEARANCE]: index {0}, new texture id {1}",i,newface.TextureID); } @@ -282,11 +282,11 @@ namespace OpenSim.Framework m_texture = textureEntry; return changed; } - + /// /// Set up visual parameters for the avatar and refresh the avatar height /// Returns boolean that indicates whether the new entries actually change the - /// existing values. + /// existing values. /// public virtual bool SetVisualParams(byte[] visualParams) { @@ -316,13 +316,13 @@ namespace OpenSim.Framework return changed; } - + public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) { SetTextureEntries(textureEntry); SetVisualParams(visualParams); } - + public virtual void SetHeight() { m_avatarHeight = 1.23077f // Shortest possible avatar height @@ -347,25 +347,24 @@ namespace OpenSim.Framework // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); // DEBUG OFF m_wearables[wearableId].Clear(); - for (int i = 0 ; i < wearable.Count ; i++) + for (int i = 0; i < wearable.Count; i++) m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); } - // DEBUG ON public override String ToString() { String s = ""; s += String.Format("Serial: {0}\n",m_serial); - + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) if (m_texture.FaceTextures[i] != null) s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); foreach (AvatarWearable awear in m_wearables) { - for ( int i = 0 ; i < awear.Count ; i++ ) + for (int i = 0; i < awear.Count; i++) s += String.Format("Wearable: item={0}, asset={1}\n",awear[i].ItemID,awear[i].AssetID); } @@ -373,13 +372,13 @@ namespace OpenSim.Framework for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) s += String.Format("{0},",m_visualparams[j]); s += "\n"; - + return s; } // DEBUG OFF /// - /// Get a list of the attachments, note that there may be + /// Get a list of the attachments, note that there may be /// duplicate attachpoints /// public List GetAttachments() @@ -390,10 +389,10 @@ namespace OpenSim.Framework foreach (AvatarAttachment attach in kvp.Value) alist.Add(new AvatarAttachment(attach)); } - + return alist; } - + internal void AppendAttachment(AvatarAttachment attach) { if (! m_attachments.ContainsKey(attach.AttachPoint)) @@ -406,11 +405,11 @@ namespace OpenSim.Framework m_attachments[attach.AttachPoint] = new List(); m_attachments[attach.AttachPoint].Add(attach); } - + /// - /// Add an attachment, if the attachpoint has the + /// Add an attachment, if the attachpoint has the /// 0x80 bit set then we assume this is an append - /// operation otherwise we replace whatever is + /// operation otherwise we replace whatever is /// currently attached at the attachpoint /// public void SetAttachment(int attachpoint, UUID item, UUID asset) @@ -485,14 +484,14 @@ namespace OpenSim.Framework data["serial"] = OSD.FromInteger(m_serial); data["height"] = OSD.FromReal(m_avatarHeight); data["hipoffset"] = OSD.FromReal(m_hipOffset); - + // Wearables OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); - for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) + for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) wears.Add(m_wearables[i].Pack()); data["wearables"] = wears; - // Avatar Textures + // Avatar Textures OSDArray textures = new OSDArray(AvatarAppearance.TEXTURE_COUNT); for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) { @@ -506,7 +505,7 @@ namespace OpenSim.Framework // Visual Parameters OSDBinary visualparams = new OSDBinary(m_visualparams); data["visualparams"] = visualparams; - + // Attachments OSDArray attachs = new OSDArray(m_attachments.Count); foreach (AvatarAttachment attach in GetAttachments()) @@ -529,14 +528,14 @@ namespace OpenSim.Framework if ((data != null) && (data["hipoffset"] != null)) m_hipOffset = (float)data["hipoffset"].AsReal(); - try + try { // Wearables SetDefaultWearables(); if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) { OSDArray wears = (OSDArray)(data["wearables"]); - for (int i = 0; i < wears.Count; i++) + for (int i = 0; i < wears.Count; i++) m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); } else -- cgit v1.1 From df860516bf4fa4e4196be4d5fc26db71d98334f4 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 3 Dec 2010 16:17:50 -0800 Subject: Various bug fixes for appearance handling: more aggressive reset of textures and vparams when appearance is not cached and when wearables change. Send appearance to the viewer with initial data. Cleaned up (and added) debugging. --- OpenSim/Framework/AvatarAppearance.cs | 36 +++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 2906af8..18a5733 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -48,7 +48,7 @@ namespace OpenSim.Framework public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; protected UUID m_owner; - protected int m_serial = 1; + protected int m_serial = 0; protected byte[] m_visualparams; protected Primitive.TextureEntry m_texture; protected AvatarWearable[] m_wearables; @@ -103,7 +103,7 @@ namespace OpenSim.Framework { // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner); - m_serial = 1; + m_serial = 0; m_owner = owner; SetDefaultWearables(); @@ -127,7 +127,7 @@ namespace OpenSim.Framework { // m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); - m_serial = 1; + m_serial = 0; m_owner = avatarID; if (wearables != null) @@ -160,7 +160,7 @@ namespace OpenSim.Framework if (appearance == null) { - m_serial = 1; + m_serial = 0; m_owner = UUID.Zero; SetDefaultWearables(); @@ -229,6 +229,24 @@ namespace OpenSim.Framework m_wearables = AvatarWearable.DefaultWearables; } + /// + /// Invalidate all of the baked textures in the appearance, useful + /// if you know that none are valid + /// + public virtual void ResetAppearance() + { + m_serial = 0; + + SetDefaultParams(); + SetDefaultTexture(); + + //for (int i = 0; i < BAKE_INDICES.Length; i++) + // { + // int idx = BAKE_INDICES[i]; + // m_texture.FaceTextures[idx].TextureID = UUID.Zero; + // } + } + protected virtual void SetDefaultParams() { m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; @@ -240,9 +258,10 @@ namespace OpenSim.Framework protected virtual void SetDefaultTexture() { - m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); - for (uint i = 0; i < TEXTURE_COUNT; i++) - m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE); + m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); + + // for (uint i = 0; i < TEXTURE_COUNT; i++) + // m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE); } /// @@ -274,9 +293,6 @@ namespace OpenSim.Framework } changed = true; - -// if (newface != null) -// m_log.WarnFormat("[AVATAR APPEARANCE]: index {0}, new texture id {1}",i,newface.TextureID); } m_texture = textureEntry; -- cgit v1.1 From c4727645b864a92fc489427c516ccab3a21c2d91 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 25 Jan 2011 14:23:58 -0800 Subject: Removed a few more spurious appearance saves. When an avatar enters a region the attachments module tries to update the appearance with attachments that are already part of the appearance. Just added a check to only save if the attachments weren't there before. --- OpenSim/Framework/AvatarAppearance.cs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 18a5733..5a6b265 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -427,19 +427,30 @@ namespace OpenSim.Framework /// 0x80 bit set then we assume this is an append /// operation otherwise we replace whatever is /// currently attached at the attachpoint + /// return true if something actually changed /// - public void SetAttachment(int attachpoint, UUID item, UUID asset) + public bool SetAttachment(int attachpoint, UUID item, UUID asset) { if (attachpoint == 0) - return; + return false; if (item == UUID.Zero) { if (m_attachments.ContainsKey(attachpoint)) + { m_attachments.Remove(attachpoint); - return; + return true; + } + return false; } + // check if the item is already attached at this point + if (GetAttachpoint(item) == (attachpoint & 0x7F)) + { + // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item); + return false; + } + // check if this is an append or a replace, 0x80 marks it as an append if ((attachpoint & 0x80) > 0) { @@ -451,6 +462,7 @@ namespace OpenSim.Framework { ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); } + return true; } public int GetAttachpoint(UUID itemID) @@ -465,7 +477,7 @@ namespace OpenSim.Framework return 0; } - public void DetachAttachment(UUID itemID) + public bool DetachAttachment(UUID itemID) { foreach (KeyValuePair> kvp in m_attachments) { @@ -478,9 +490,10 @@ namespace OpenSim.Framework // And remove the list if there are no more attachments here if (m_attachments[kvp.Key].Count == 0) m_attachments.Remove(kvp.Key); - return; + return true; } } + return false; } public void ClearAttachments() -- cgit v1.1 From f97278610c2ab9717b32b9c64bc5865b0b47dd41 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 4 Jul 2011 17:54:14 +0300 Subject: Fixed updating avatar appearance Signed-off-by: root --- OpenSim/Framework/AvatarAppearance.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 5a6b265..716baab 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -196,6 +196,9 @@ namespace OpenSim.Framework if (appearance.VisualParams != null) m_visualparams = (byte[])appearance.VisualParams.Clone(); + m_avatarHeight = appearance.m_avatarHeight; + m_hipOffset = appearance.m_hipOffset; + // Copy the attachment, force append mode since that ensures consistency m_attachments = new Dictionary>(); foreach (AvatarAttachment attachment in appearance.GetAttachments()) @@ -237,7 +240,6 @@ namespace OpenSim.Framework { m_serial = 0; - SetDefaultParams(); SetDefaultTexture(); //for (int i = 0; i < BAKE_INDICES.Length; i++) -- cgit v1.1 From 59f548cda82facef003fb7309180412254a234a1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Aug 2011 23:41:29 +0100 Subject: Get osNpcCreate appearance working with avatars that are currently in the scene. Had to stop using AvatarService for now since it doesn't store baked texture IDs (which is why this was failing). Also failing because cloning appearance was also cloning the AvatarApperance.Owner field, which we weren't then changing. Extended TestCreate() to check this. --- OpenSim/Framework/AvatarAppearance.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 716baab..6b1f58a 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -77,7 +77,11 @@ namespace OpenSim.Framework public virtual Primitive.TextureEntry Texture { get { return m_texture; } - set { m_texture = value; } + set + { +// m_log.DebugFormat("[AVATAR APPEARANCE]: Set TextureEntry to {0}", value); + m_texture = value; + } } public virtual AvatarWearable[] Wearables -- cgit v1.1 From b6ac1c46cd473b129b70344f0001f1e8f97d8860 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Aug 2011 00:13:04 +0100 Subject: Get rid of AvatarAppearance.Owner to simplify the code. This is not used for anything - appearances are always properties of objects with ids (ScenePresence, AgentCircuitData) and just has the potential to get out of sync when the appearance is cloned. --- OpenSim/Framework/AvatarAppearance.cs | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 6b1f58a..73b068d 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -47,7 +47,6 @@ namespace OpenSim.Framework public readonly static int TEXTURE_COUNT = 21; public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; - protected UUID m_owner; protected int m_serial = 0; protected byte[] m_visualparams; protected Primitive.TextureEntry m_texture; @@ -56,12 +55,6 @@ namespace OpenSim.Framework protected float m_avatarHeight = 0; protected float m_hipOffset = 0; - public virtual UUID Owner - { - get { return m_owner; } - set { m_owner = value; } - } - public virtual int Serial { get { return m_serial; } @@ -101,38 +94,31 @@ namespace OpenSim.Framework get { return m_hipOffset; } } - public AvatarAppearance() : this(UUID.Zero) {} - - public AvatarAppearance(UUID owner) + public AvatarAppearance() { -// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner); +// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); m_serial = 0; - m_owner = owner; - SetDefaultWearables(); SetDefaultTexture(); SetDefaultParams(); SetHeight(); - m_attachments = new Dictionary>(); } - public AvatarAppearance(UUID avatarID, OSDMap map) + public AvatarAppearance(OSDMap map) { -// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID); +// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); - m_owner = avatarID; Unpack(map); SetHeight(); } - public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) + public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) { -// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); +// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance"); m_serial = 0; - m_owner = avatarID; if (wearables != null) m_wearables = wearables; @@ -165,24 +151,21 @@ namespace OpenSim.Framework if (appearance == null) { m_serial = 0; - m_owner = UUID.Zero; - SetDefaultWearables(); SetDefaultTexture(); SetDefaultParams(); SetHeight(); - m_attachments = new Dictionary>(); return; } m_serial = appearance.Serial; - m_owner = appearance.Owner; m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) m_wearables[i] = new AvatarWearable(); + if (copyWearables && (appearance.Wearables != null)) { for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) -- cgit v1.1 From e869eeb0bfc48c769f680970f99e4c67dd5a1a70 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Aug 2011 03:51:34 +0100 Subject: Implement first draft functions for saving and loading NPC appearance from storage. This works by serializing and deserializing NPC AvatarAppearance to a notecard in the prim inventory and making the required baked textures permanent. By using notecards, we avoid lots of awkward, technical and user-unfriendly issues concerning retaining asset references and creating a new asset type. Notecards also allow different appearances to be swapped and manipulated easily. This also allows stored NPC appearances to work transparently with OARs/IARs since the UUID scan will pick up and store the necessary references from the notecard text. This works in my basic test but is not at all ready for user use or bug reporting yet. --- OpenSim/Framework/AvatarAppearance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 73b068d..02af5d9 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -539,7 +539,7 @@ namespace OpenSim.Framework /// public void Unpack(OSDMap data) { - if ((data != null) && (data["serial"] != null)) + if ((data != null) && (data["serial"] != null)) m_serial = data["serial"].AsInteger(); if ((data != null) && (data["height"] != null)) m_avatarHeight = (float)data["height"].AsReal(); -- cgit v1.1 From 57e54d84d641787d40a2b45549f6f2d373c5f2f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 23:05:08 +0100 Subject: Add new FireAndForgetMethod.None. This executes the callback on the same thread that made the request. Designed for use only by regression tests that rely on a predicable event ordering. --- OpenSim/Framework/AvatarAppearance.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 02af5d9..ab4ed66 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -412,12 +412,20 @@ namespace OpenSim.Framework } /// - /// Add an attachment, if the attachpoint has the + /// Add an attachment + /// + /// + /// If the attachpoint has the /// 0x80 bit set then we assume this is an append /// operation otherwise we replace whatever is /// currently attached at the attachpoint + /// + /// + /// If UUID.Zero, then an any attachment at the attachpoint is removed. + /// + /// /// return true if something actually changed - /// + /// public bool SetAttachment(int attachpoint, UUID item, UUID asset) { if (attachpoint == 0) -- cgit v1.1 From e7a515bab0e46c228f8f543397f97b7ba2f0df3c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Aug 2011 22:06:24 +0100 Subject: Fix bug where attachments were remaining on the avatar after being dropped. If the inventory service is configured not to allow deletion then these will not disappear from inventory --- OpenSim/Framework/AvatarAppearance.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index ab4ed66..7c6295d 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -383,9 +383,11 @@ namespace OpenSim.Framework // DEBUG OFF /// - /// Get a list of the attachments, note that there may be - /// duplicate attachpoints + /// Get a list of the attachments. /// + /// + /// There may be duplicate attachpoints + /// public List GetAttachments() { List alist = new List(); @@ -487,6 +489,7 @@ namespace OpenSim.Framework // And remove the list if there are no more attachments here if (m_attachments[kvp.Key].Count == 0) m_attachments.Remove(kvp.Key); + return true; } } -- cgit v1.1 From 5c1fa968ab954bec9860023dffc8f68baf3c0620 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Sep 2011 01:11:16 +0100 Subject: Stop NPCs losing attachments when the source avatar takes them off. This was happening because we were using the source avatar's item IDs in the clone appearance. Switch to using the asset IDs of attachments instead for NPCs. The InventoryAccessModule and AttachmentModule had to be changed to allow rezzing of an object without an associated inventory item. Hopefully goes some way towards resolving http://opensimulator.org/mantis/view.php?id=5653 --- OpenSim/Framework/AvatarAppearance.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 7c6295d..aed9087 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -433,6 +433,10 @@ namespace OpenSim.Framework if (attachpoint == 0) return false; +// m_log.DebugFormat( +// "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}", +// attachpoint, item, asset); + if (item == UUID.Zero) { if (m_attachments.ContainsKey(attachpoint)) @@ -459,7 +463,7 @@ namespace OpenSim.Framework } else { - ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); + ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset)); } return true; } @@ -608,7 +612,14 @@ namespace OpenSim.Framework { OSDArray attachs = (OSDArray)(data["attachments"]); for (int i = 0; i < attachs.Count; i++) - AppendAttachment(new AvatarAttachment((OSDMap)attachs[i])); + { + AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]); + AppendAttachment(att); + +// m_log.DebugFormat( +// "[AVATAR APPEARANCE]: Unpacked attachment itemID {0}, assetID {1}, point {2}", +// att.ItemID, att.AssetID, att.AttachPoint); + } } } catch (Exception e) -- cgit v1.1 From 0cb0140a1d652c3ba47f1c9000d1ba81c8e786f8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Sep 2011 00:29:37 +0100 Subject: Stop the pointless double setting of every attachment in AvatarAppearance. The second was already being filtered out so this has no user level effect --- OpenSim/Framework/AvatarAppearance.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index aed9087..0b0afeb 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -402,8 +402,13 @@ namespace OpenSim.Framework internal void AppendAttachment(AvatarAttachment attach) { - if (! m_attachments.ContainsKey(attach.AttachPoint)) +// m_log.DebugFormat( +// "[AVATAR APPEARNCE]: Appending itemID={0}, assetID={1} at {2}", +// attach.ItemID, attach.AssetID, attach.AttachPoint); + + if (!m_attachments.ContainsKey(attach.AttachPoint)) m_attachments[attach.AttachPoint] = new List(); + m_attachments[attach.AttachPoint].Add(attach); } @@ -430,13 +435,13 @@ namespace OpenSim.Framework /// public bool SetAttachment(int attachpoint, UUID item, UUID asset) { - if (attachpoint == 0) - return false; - // m_log.DebugFormat( // "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}", // attachpoint, item, asset); + if (attachpoint == 0) + return false; + if (item == UUID.Zero) { if (m_attachments.ContainsKey(attachpoint)) @@ -465,6 +470,7 @@ namespace OpenSim.Framework { ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset)); } + return true; } -- cgit v1.1 From b903d2ca963d5f68803a1cabbd033f89ab72634a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Sep 2011 01:59:21 +0100 Subject: In SetAttachment, if the existing attachment has no asset id then carry on rather than abort. When a user logs in, the attachment item ids are pulled from persistence in the Avatars table. However, the asset ids are not saved. When the avatar enters a simulator the attachments are set again. If we simply perform an item check then the asset ids (which are now present) are never set, and NPC attachments later fail unless the attachment is detached and reattached. Hopefully resolves part of http://opensimulator.org/mantis/view.php?id=5653 --- OpenSim/Framework/AvatarAppearance.cs | 36 ++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 0b0afeb..cce44b0 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -414,12 +414,16 @@ namespace OpenSim.Framework internal void ReplaceAttachment(AvatarAttachment attach) { +// m_log.DebugFormat( +// "[AVATAR APPEARANCE]: Replacing itemID={0}, assetID={1} at {2}", +// attach.ItemID, attach.AssetID, attach.AttachPoint); + m_attachments[attach.AttachPoint] = new List(); m_attachments[attach.AttachPoint].Add(attach); } /// - /// Add an attachment + /// Set an attachment /// /// /// If the attachpoint has the @@ -449,11 +453,20 @@ namespace OpenSim.Framework m_attachments.Remove(attachpoint); return true; } + return false; } - // check if the item is already attached at this point - if (GetAttachpoint(item) == (attachpoint & 0x7F)) + // When a user logs in, the attachment item ids are pulled from persistence in the Avatars table. However, + // the asset ids are not saved. When the avatar enters a simulator the attachments are set again. If + // we simply perform an item check here then the asset ids (which are now present) are never set, and NPC attachments + // later fail unless the attachment is detached and reattached. + // + // Therefore, we will carry on with the set if the existing attachment has no asset id. + AvatarAttachment existingAttachment = GetAttachmentForItem(item); + if (existingAttachment != null + && existingAttachment.AssetID != UUID.Zero + && existingAttachment.AttachPoint == (attachpoint & 0x7F)) { // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item); return false; @@ -474,6 +487,23 @@ namespace OpenSim.Framework return true; } + /// + /// If the item is already attached, return it. + /// + /// + /// Returns null if this item is not attached. + public AvatarAttachment GetAttachmentForItem(UUID itemID) + { + foreach (KeyValuePair> kvp in m_attachments) + { + int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); + if (index >= 0) + return kvp.Value[index]; + } + + return null; + } + public int GetAttachpoint(UUID itemID) { foreach (KeyValuePair> kvp in m_attachments) -- cgit v1.1 From dab6387bba7a7388e3cdb4ad1eeea646bc03a287 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 12 Sep 2011 21:05:26 +0100 Subject: lock AvatarAppearance.m_attachments when we use it This is partly to address http://opensimulator.org/mantis/view.php?id=5644, though something more thorough is needed. --- OpenSim/Framework/AvatarAppearance.cs | 91 ++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 33 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index cce44b0..c69dde3 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -391,10 +391,14 @@ namespace OpenSim.Framework public List GetAttachments() { List alist = new List(); - foreach (KeyValuePair> kvp in m_attachments) + + lock (m_attachments) { - foreach (AvatarAttachment attach in kvp.Value) - alist.Add(new AvatarAttachment(attach)); + foreach (KeyValuePair> kvp in m_attachments) + { + foreach (AvatarAttachment attach in kvp.Value) + alist.Add(new AvatarAttachment(attach)); + } } return alist; @@ -406,10 +410,13 @@ namespace OpenSim.Framework // "[AVATAR APPEARNCE]: Appending itemID={0}, assetID={1} at {2}", // attach.ItemID, attach.AssetID, attach.AttachPoint); - if (!m_attachments.ContainsKey(attach.AttachPoint)) - m_attachments[attach.AttachPoint] = new List(); - - m_attachments[attach.AttachPoint].Add(attach); + lock (m_attachments) + { + if (!m_attachments.ContainsKey(attach.AttachPoint)) + m_attachments[attach.AttachPoint] = new List(); + + m_attachments[attach.AttachPoint].Add(attach); + } } internal void ReplaceAttachment(AvatarAttachment attach) @@ -418,8 +425,11 @@ namespace OpenSim.Framework // "[AVATAR APPEARANCE]: Replacing itemID={0}, assetID={1} at {2}", // attach.ItemID, attach.AssetID, attach.AttachPoint); - m_attachments[attach.AttachPoint] = new List(); - m_attachments[attach.AttachPoint].Add(attach); + lock (m_attachments) + { + m_attachments[attach.AttachPoint] = new List(); + m_attachments[attach.AttachPoint].Add(attach); + } } /// @@ -448,10 +458,13 @@ namespace OpenSim.Framework if (item == UUID.Zero) { - if (m_attachments.ContainsKey(attachpoint)) + lock (m_attachments) { - m_attachments.Remove(attachpoint); - return true; + if (m_attachments.ContainsKey(attachpoint)) + { + m_attachments.Remove(attachpoint); + return true; + } } return false; @@ -494,11 +507,14 @@ namespace OpenSim.Framework /// Returns null if this item is not attached. public AvatarAttachment GetAttachmentForItem(UUID itemID) { - foreach (KeyValuePair> kvp in m_attachments) + lock (m_attachments) { - int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); - if (index >= 0) - return kvp.Value[index]; + foreach (KeyValuePair> kvp in m_attachments) + { + int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); + if (index >= 0) + return kvp.Value[index]; + } } return null; @@ -506,11 +522,14 @@ namespace OpenSim.Framework public int GetAttachpoint(UUID itemID) { - foreach (KeyValuePair> kvp in m_attachments) + lock (m_attachments) { - int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); - if (index >= 0) - return kvp.Key; + foreach (KeyValuePair> kvp in m_attachments) + { + int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); + if (index >= 0) + return kvp.Key; + } } return 0; @@ -518,27 +537,32 @@ namespace OpenSim.Framework public bool DetachAttachment(UUID itemID) { - foreach (KeyValuePair> kvp in m_attachments) + lock (m_attachments) { - int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); - if (index >= 0) + foreach (KeyValuePair> kvp in m_attachments) { - // Remove it from the list of attachments at that attach point - m_attachments[kvp.Key].RemoveAt(index); - - // And remove the list if there are no more attachments here - if (m_attachments[kvp.Key].Count == 0) - m_attachments.Remove(kvp.Key); - - return true; + int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); + if (index >= 0) + { + // Remove it from the list of attachments at that attach point + m_attachments[kvp.Key].RemoveAt(index); + + // And remove the list if there are no more attachments here + if (m_attachments[kvp.Key].Count == 0) + m_attachments.Remove(kvp.Key); + + return true; + } } } + return false; } public void ClearAttachments() { - m_attachments.Clear(); + lock (m_attachments) + m_attachments.Clear(); } #region Packing Functions @@ -576,7 +600,8 @@ namespace OpenSim.Framework data["visualparams"] = visualparams; // Attachments - OSDArray attachs = new OSDArray(m_attachments.Count); + List attachments = GetAttachments(); + OSDArray attachs = new OSDArray(attachments.Count); foreach (AvatarAttachment attach in GetAttachments()) attachs.Add(attach.Pack()); data["attachments"] = attachs; -- cgit v1.1 From c8304b7f84b1a8d9fb978cae510f684e36419deb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Sep 2011 02:59:33 +0100 Subject: Fix avatar parameter updating for viewer 3 and maybe 2. When a slider parameter is changed, the viewer uploads a new shape (or other asset) and the item is updated to point to it. Viewer 1 uploaded the data in the initial request itself, so the asset references was almost always correctly updated. However, viewer 3/2 always uploads data in a subsequent xfer, which exposed a race condition where the viewer would make the item update before the asset had uploaded. This commit shuffles the order of operations to avoid this race, the item is updated with the new asset id instead of the old one while the upload was still taking place. A second race had to be fixed where avatar appearance would also be updated with the old asset id rather than the new one. This was fixed by updating the avatar appearance ids when the appearance was actually saved, rather than when the wearables update was made. --- OpenSim/Framework/AvatarAppearance.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index c69dde3..72b580b 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -225,6 +225,8 @@ namespace OpenSim.Framework /// public virtual void ResetAppearance() { +// m_log.WarnFormat("[AVATAR APPEARANCE]: Reset appearance"); + m_serial = 0; SetDefaultTexture(); -- cgit v1.1 From e182cc198d3b0151b2a891f6470e664f77e42d79 Mon Sep 17 00:00:00 2001 From: nebadon Date: Sat, 5 Nov 2011 02:56:52 -0700 Subject: Fix avatar height, removes the hip offset hack Author: Mana Janus --- OpenSim/Framework/AvatarAppearance.cs | 36 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 72b580b..6c2a954 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -53,7 +53,6 @@ namespace OpenSim.Framework protected AvatarWearable[] m_wearables; protected Dictionary> m_attachments; protected float m_avatarHeight = 0; - protected float m_hipOffset = 0; public virtual int Serial { @@ -89,11 +88,6 @@ namespace OpenSim.Framework set { m_avatarHeight = value; } } - public virtual float HipOffset - { - get { return m_hipOffset; } - } - public AvatarAppearance() { // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); @@ -184,7 +178,6 @@ namespace OpenSim.Framework m_visualparams = (byte[])appearance.VisualParams.Clone(); m_avatarHeight = appearance.m_avatarHeight; - m_hipOffset = appearance.m_hipOffset; // Copy the attachment, force append mode since that ensures consistency m_attachments = new Dictionary>(); @@ -332,20 +325,18 @@ namespace OpenSim.Framework public virtual void SetHeight() { - m_avatarHeight = 1.23077f // Shortest possible avatar height - + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height - + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size - + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length - + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height - + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height - + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length - - m_hipOffset = (((1.23077f // Half of avatar - + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height - + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length - + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height - + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height - ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f; + // Start with shortest possible female avatar height + m_avatarHeight = 1.14597f; + // Add offset for male avatars + if (m_visualparams[(int)VPElement.SHAPE_MALE] != 0) + m_avatarHeight += 0.0848f; + // Add offsets for visual params + m_avatarHeight += 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f + + 0.08117f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f + + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f + + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f + + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f + + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; } public virtual void SetWearable(int wearableId, AvatarWearable wearable) @@ -578,7 +569,6 @@ namespace OpenSim.Framework data["serial"] = OSD.FromInteger(m_serial); data["height"] = OSD.FromReal(m_avatarHeight); - data["hipoffset"] = OSD.FromReal(m_hipOffset); // Wearables OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); @@ -621,8 +611,6 @@ namespace OpenSim.Framework m_serial = data["serial"].AsInteger(); if ((data != null) && (data["height"] != null)) m_avatarHeight = (float)data["height"].AsReal(); - if ((data != null) && (data["hipoffset"] != null)) - m_hipOffset = (float)data["hipoffset"].AsReal(); try { -- cgit v1.1 From 0b91ec8dd2b78461cb0fcdec567a83e88a76ac87 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 18:58:05 +0000 Subject: Migrate detailed "appearance show" report generation up to AvatarFactoryModule from AppearanceInfoModule so that it can be used in debug (inactive). Further filters "debug packet " to exclused [Request]ObjectPropertiesFamily if level is below 25. Adjust some method doc Minor changes to some logging messages. --- OpenSim/Framework/AvatarAppearance.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 6c2a954..4f598b0 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -249,10 +249,12 @@ namespace OpenSim.Framework } /// - /// Set up appearance textures. - /// Returns boolean that indicates whether the new entries actually change the - /// existing values. + /// Set up appearance texture ids. /// + /// + /// True if any existing texture id was changed by the new data. + /// False if there were no changes or no existing texture ids. + /// public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry) { if (textureEntry == null) @@ -269,25 +271,30 @@ namespace OpenSim.Framework if (newface == null) { - if (oldface == null) continue; + if (oldface == null) + continue; } else { - if (oldface != null && oldface.TextureID == newface.TextureID) continue; + if (oldface != null && oldface.TextureID == newface.TextureID) + continue; } changed = true; } m_texture = textureEntry; + return changed; } /// /// Set up visual parameters for the avatar and refresh the avatar height - /// Returns boolean that indicates whether the new entries actually change the - /// existing values. /// + /// + /// True if any existing visual parameter was changed by the new data. + /// False if there were no changes or no existing visual parameters. + /// public virtual bool SetVisualParams(byte[] visualParams) { if (visualParams == null) -- cgit v1.1 From 5d4ac5a90fea758e18c8a9e97b06e799186b5a14 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Oct 2012 00:59:27 +0100 Subject: Add TestOsNpcLoadAppearance() --- OpenSim/Framework/AvatarAppearance.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 4f598b0..95e9667 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -330,6 +330,9 @@ namespace OpenSim.Framework SetVisualParams(visualParams); } + /// + /// Set avatar height by a calculation based on their visual parameters. + /// public virtual void SetHeight() { // Start with shortest possible female avatar height -- cgit v1.1 From 364816421985c052521cf7b444e124760c0a1025 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Mar 2013 21:44:18 +0000 Subject: Prevent multiple instances of the same item ID being appended to an AvatarAppearance It looks like this was happening when AttachmentsModule.RezAttachments was doing a secondary set of each attachment to update with the asset ID (initially they only have the inventory ID). However, with multi-attach this was appending a second copy of the same attachment rather than updating the data that was already there. This commit requires both simulator and service to be updated. --- OpenSim/Framework/AvatarAppearance.cs | 78 +++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 30 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 95e9667..494ae5e 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -459,45 +459,59 @@ namespace OpenSim.Framework if (attachpoint == 0) return false; - if (item == UUID.Zero) + lock (m_attachments) { - lock (m_attachments) + if (item == UUID.Zero) { if (m_attachments.ContainsKey(attachpoint)) { m_attachments.Remove(attachpoint); return true; } + + return false; } - - return false; - } - // When a user logs in, the attachment item ids are pulled from persistence in the Avatars table. However, - // the asset ids are not saved. When the avatar enters a simulator the attachments are set again. If - // we simply perform an item check here then the asset ids (which are now present) are never set, and NPC attachments - // later fail unless the attachment is detached and reattached. - // - // Therefore, we will carry on with the set if the existing attachment has no asset id. - AvatarAttachment existingAttachment = GetAttachmentForItem(item); - if (existingAttachment != null - && existingAttachment.AssetID != UUID.Zero - && existingAttachment.AttachPoint == (attachpoint & 0x7F)) - { - // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item); - return false; - } - - // check if this is an append or a replace, 0x80 marks it as an append - if ((attachpoint & 0x80) > 0) - { - // strip the append bit - int point = attachpoint & 0x7F; - AppendAttachment(new AvatarAttachment(point, item, asset)); - } - else - { - ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset)); + // When a user logs in, the attachment item ids are pulled from persistence in the Avatars table. However, + // the asset ids are not saved. When the avatar enters a simulator the attachments are set again. If + // we simply perform an item check here then the asset ids (which are now present) are never set, and NPC attachments + // later fail unless the attachment is detached and reattached. + // + // Therefore, we will carry on with the set if the existing attachment has no asset id. + AvatarAttachment existingAttachment = GetAttachmentForItem(item); + if (existingAttachment != null) + { +// m_log.DebugFormat( +// "[AVATAR APPEARANCE]: Found existing attachment for {0}, asset {1} at point {2}", +// existingAttachment.ItemID, existingAttachment.AssetID, existingAttachment.AttachPoint); + + if (existingAttachment.AssetID != UUID.Zero && existingAttachment.AttachPoint == (attachpoint & 0x7F)) + { + m_log.DebugFormat( + "[AVATAR APPEARANCE]: Ignoring attempt to attach an already attached item {0} at point {1}", + item, attachpoint); + + return false; + } + else + { + // Remove it here so that the later append does not add a second attachment but we still update + // the assetID + DetachAttachment(existingAttachment.ItemID); + } + } + + // check if this is an append or a replace, 0x80 marks it as an append + if ((attachpoint & 0x80) > 0) + { + // strip the append bit + int point = attachpoint & 0x7F; + AppendAttachment(new AvatarAttachment(point, item, asset)); + } + else + { + ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset)); + } } return true; @@ -547,6 +561,10 @@ namespace OpenSim.Framework int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); if (index >= 0) { +// m_log.DebugFormat( +// "[AVATAR APPEARANCE]: Detaching attachment {0}, index {1}, point {2}", +// m_attachments[kvp.Key][index].ItemID, index, m_attachments[kvp.Key][index].AttachPoint); + // Remove it from the list of attachments at that attach point m_attachments[kvp.Key].RemoveAt(index); -- cgit v1.1 From 681fbda4b6b9700421b82dc639f954c60871542e Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 24 May 2013 13:18:16 -0700 Subject: This is an experimental patch that adds support for comparing texture hashes for the purpose of accurately responding to AgentTextureCached packets. There is a change to IClientAPI to report the wearbles hashes that come in through the SetAppearance packet. Added storage of the texture hashes in the appearance. While these are added to the Pack/Unpack (with support for missing values) routines (which means Simian will store them properly), they are not currently persisted in Robust. --- OpenSim/Framework/AvatarAppearance.cs | 98 +++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 32 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 494ae5e..157feb5 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -53,6 +53,7 @@ namespace OpenSim.Framework protected AvatarWearable[] m_wearables; protected Dictionary> m_attachments; protected float m_avatarHeight = 0; + protected UUID[] m_texturehashes; public virtual int Serial { @@ -98,6 +99,8 @@ namespace OpenSim.Framework SetDefaultParams(); SetHeight(); m_attachments = new Dictionary>(); + + ResetTextureHashes(); } public AvatarAppearance(OSDMap map) @@ -108,32 +111,6 @@ namespace OpenSim.Framework SetHeight(); } - public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) - { -// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance"); - - m_serial = 0; - - if (wearables != null) - m_wearables = wearables; - else - SetDefaultWearables(); - - if (textureEntry != null) - m_texture = textureEntry; - else - SetDefaultTexture(); - - if (visualParams != null) - m_visualparams = visualParams; - else - SetDefaultParams(); - - SetHeight(); - - m_attachments = new Dictionary>(); - } - public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) { } @@ -151,6 +128,8 @@ namespace OpenSim.Framework SetHeight(); m_attachments = new Dictionary>(); + ResetTextureHashes(); + return; } @@ -166,6 +145,10 @@ namespace OpenSim.Framework SetWearable(i,appearance.Wearables[i]); } + m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; + for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) + m_texturehashes[i] = new UUID(appearance.m_texturehashes[i]); + m_texture = null; if (appearance.Texture != null) { @@ -200,6 +183,37 @@ namespace OpenSim.Framework } } + public void ResetTextureHashes() + { + m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) + m_texturehashes[i] = UUID.Zero; + } + + public UUID GetTextureHash(int textureIndex) + { + return m_texturehashes[NormalizeBakedTextureIndex(textureIndex)]; + } + + public void SetTextureHash(int textureIndex, UUID textureHash) + { + m_texturehashes[NormalizeBakedTextureIndex(textureIndex)] = new UUID(textureHash); + } + + /// + /// Normalizes the texture index to the actual bake index, this is done to + /// accommodate older viewers that send the BAKE_INDICES index rather than + /// the actual texture index + /// + private int NormalizeBakedTextureIndex(int textureIndex) + { + // Earlier viewer send the index into the baked index array, just trying to be careful here + if (textureIndex < BAKE_INDICES.Length) + return BAKE_INDICES[textureIndex]; + + return textureIndex; + } + public void ClearWearables() { m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; @@ -223,12 +237,7 @@ namespace OpenSim.Framework m_serial = 0; SetDefaultTexture(); - - //for (int i = 0; i < BAKE_INDICES.Length; i++) - // { - // int idx = BAKE_INDICES[i]; - // m_texture.FaceTextures[idx].TextureID = UUID.Zero; - // } + ResetTextureHashes(); } protected virtual void SetDefaultParams() @@ -598,6 +607,12 @@ namespace OpenSim.Framework data["serial"] = OSD.FromInteger(m_serial); data["height"] = OSD.FromReal(m_avatarHeight); + // Hashes + OSDArray hashes = new OSDArray(AvatarAppearance.TEXTURE_COUNT); + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) + hashes.Add(OSD.FromUUID(m_texturehashes[i])); + data["hashes"] = hashes; + // Wearables OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) @@ -642,6 +657,25 @@ namespace OpenSim.Framework try { + // Hashes + m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; + if ((data != null) && (data["hashes"] != null) && (data["hashes"]).Type == OSDType.Array) + { + OSDArray hashes = (OSDArray)(data["hashes"]); + for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) + { + UUID hashID = UUID.Zero; + if (i < hashes.Count && hashes[i] != null) + hashID = hashes[i].AsUUID(); + m_texturehashes[i] = hashID; + } + } + else + { + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) + m_texturehashes[i] = UUID.Zero; + } + // Wearables SetDefaultWearables(); if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) -- cgit v1.1 From 5b73b9c4a85335ba837280688b903fef44be8f35 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 11 Dec 2013 01:39:56 +0000 Subject: Committing the Avination Scene Presence and related texture code - Parts of region crossing code - New bakes handling code - Bakes now sent from sim to sim without central storage - Appearance handling changes - Some changes to sitting - A number of unrelated fixes and improvements --- OpenSim/Framework/AvatarAppearance.cs | 313 +++++++++++++++++++++++----------- 1 file changed, 217 insertions(+), 96 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 157feb5..b7a0adf 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -40,8 +40,17 @@ namespace OpenSim.Framework /// public class AvatarAppearance { + // SL box diferent to size + const float AVBOXAJUST = 0.2f; + // constrains for ubitode physics + const float AVBOXMINX = 0.2f; + const float AVBOXMINY = 0.3f; + const float AVBOXMINZ = 1.2f; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // this is viewer capabilities and weared things dependent + // should be only used as initial default value ( V1 viewers ) public readonly static int VISUALPARAM_COUNT = 218; public readonly static int TEXTURE_COUNT = 21; @@ -53,7 +62,12 @@ namespace OpenSim.Framework protected AvatarWearable[] m_wearables; protected Dictionary> m_attachments; protected float m_avatarHeight = 0; - protected UUID[] m_texturehashes; + protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); // sl Z cloud value + protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); + protected float m_avatarFeetOffset = 0; + protected float m_avatarAnimOffset = 0; + protected WearableCacheItem[] m_cacheitems; + protected bool m_cacheItemsDirty = true; public virtual int Serial { @@ -67,6 +81,21 @@ namespace OpenSim.Framework set { m_visualparams = value; } } + public virtual Vector3 AvatarSize + { + get { return m_avatarSize; } + } + + public virtual Vector3 AvatarBoxSize + { + get { return m_avatarBoxSize; } + } + + public virtual float AvatarFeetOffset + { + get { return m_avatarFeetOffset + m_avatarAnimOffset; } + } + public virtual Primitive.TextureEntry Texture { get { return m_texture; } @@ -88,6 +117,18 @@ namespace OpenSim.Framework get { return m_avatarHeight; } set { m_avatarHeight = value; } } + + public virtual WearableCacheItem[] WearableCacheItems + { + get { return m_cacheitems; } + set { m_cacheitems = value; } + } + + public virtual bool WearableCacheItemsDirty + { + get { return m_cacheItemsDirty; } + set { m_cacheItemsDirty = value; } + } public AvatarAppearance() { @@ -97,10 +138,9 @@ namespace OpenSim.Framework SetDefaultWearables(); SetDefaultTexture(); SetDefaultParams(); - SetHeight(); +// SetHeight(); + SetSize(new Vector3(0.45f,0.6f,1.9f)); m_attachments = new Dictionary>(); - - ResetTextureHashes(); } public AvatarAppearance(OSDMap map) @@ -108,7 +148,35 @@ namespace OpenSim.Framework // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); Unpack(map); - SetHeight(); +// SetHeight(); done in Unpack + } + + public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) + { +// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance"); + + m_serial = 0; + + if (wearables != null) + m_wearables = wearables; + else + SetDefaultWearables(); + + if (textureEntry != null) + m_texture = textureEntry; + else + SetDefaultTexture(); + + if (visualParams != null) + m_visualparams = visualParams; + else + SetDefaultParams(); + +// SetHeight(); + if(m_avatarHeight == 0) + SetSize(new Vector3(0.45f,0.6f,1.9f)); + + m_attachments = new Dictionary>(); } public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) @@ -125,11 +193,10 @@ namespace OpenSim.Framework SetDefaultWearables(); SetDefaultTexture(); SetDefaultParams(); - SetHeight(); +// SetHeight(); + SetSize(new Vector3(0.45f, 0.6f, 1.9f)); m_attachments = new Dictionary>(); - ResetTextureHashes(); - return; } @@ -145,10 +212,6 @@ namespace OpenSim.Framework SetWearable(i,appearance.Wearables[i]); } - m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; - for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) - m_texturehashes[i] = new UUID(appearance.m_texturehashes[i]); - m_texture = null; if (appearance.Texture != null) { @@ -160,7 +223,8 @@ namespace OpenSim.Framework if (appearance.VisualParams != null) m_visualparams = (byte[])appearance.VisualParams.Clone(); - m_avatarHeight = appearance.m_avatarHeight; +// m_avatarHeight = appearance.m_avatarHeight; + SetSize(appearance.AvatarSize); // Copy the attachment, force append mode since that ensures consistency m_attachments = new Dictionary>(); @@ -183,37 +247,6 @@ namespace OpenSim.Framework } } - public void ResetTextureHashes() - { - m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; - for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) - m_texturehashes[i] = UUID.Zero; - } - - public UUID GetTextureHash(int textureIndex) - { - return m_texturehashes[NormalizeBakedTextureIndex(textureIndex)]; - } - - public void SetTextureHash(int textureIndex, UUID textureHash) - { - m_texturehashes[NormalizeBakedTextureIndex(textureIndex)] = new UUID(textureHash); - } - - /// - /// Normalizes the texture index to the actual bake index, this is done to - /// accommodate older viewers that send the BAKE_INDICES index rather than - /// the actual texture index - /// - private int NormalizeBakedTextureIndex(int textureIndex) - { - // Earlier viewer send the index into the baked index array, just trying to be careful here - if (textureIndex < BAKE_INDICES.Length) - return BAKE_INDICES[textureIndex]; - - return textureIndex; - } - public void ClearWearables() { m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; @@ -237,7 +270,12 @@ namespace OpenSim.Framework m_serial = 0; SetDefaultTexture(); - ResetTextureHashes(); + + //for (int i = 0; i < BAKE_INDICES.Length; i++) + // { + // int idx = BAKE_INDICES[i]; + // m_texture.FaceTextures[idx].TextureID = UUID.Zero; + // } } protected virtual void SetDefaultParams() @@ -249,6 +287,21 @@ namespace OpenSim.Framework // } } + /// + /// Invalidate all of the baked textures in the appearance, useful + /// if you know that none are valid + /// + public virtual void ResetBakedTextures() + { + SetDefaultTexture(); + + //for (int i = 0; i < BAKE_INDICES.Length; i++) + // { + // int idx = BAKE_INDICES[i]; + // m_texture.FaceTextures[idx].TextureID = UUID.Zero; + // } + } + protected virtual void SetDefaultTexture() { m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); @@ -313,22 +366,33 @@ namespace OpenSim.Framework // made. We determine if any of the visual parameters actually // changed to know if the appearance should be saved later bool changed = false; - for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) + + int newsize = visualParams.Length; + + if (newsize != m_visualparams.Length) + { + changed = true; + m_visualparams = (byte[])visualParams.Clone(); + } + else { - if (visualParams[i] != m_visualparams[i]) + + for (int i = 0; i < newsize; i++) { -// DEBUG ON -// m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", -// i,m_visualparams[i],visualParams[i]); -// DEBUG OFF - m_visualparams[i] = visualParams[i]; - changed = true; + if (visualParams[i] != m_visualparams[i]) + { + // DEBUG ON + // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", + // i,m_visualparams[i],visualParams[i]); + // DEBUG OFF + m_visualparams[i] = visualParams[i]; + changed = true; + } } } - // Reset the height if the visual parameters actually changed - if (changed) - SetHeight(); +// if (changed) +// SetHeight(); return changed; } @@ -344,6 +408,7 @@ namespace OpenSim.Framework /// public virtual void SetHeight() { +/* // Start with shortest possible female avatar height m_avatarHeight = 1.14597f; // Add offset for male avatars @@ -356,6 +421,35 @@ namespace OpenSim.Framework + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; +*/ + } + + public void SetSize(Vector3 avSize) + { + if (avSize.X > 32f) + avSize.X = 32f; + else if (avSize.X < 0.1f) + avSize.X = 0.1f; + + if (avSize.Y > 32f) + avSize.Y = 32f; + else if (avSize.Y < 0.1f) + avSize.Y = 0.1f; + if (avSize.Z > 32f) + avSize.Z = 32f; + else if (avSize.Z < 0.1f) + avSize.Z = 0.1f; + + m_avatarSize = avSize; + m_avatarBoxSize = avSize; + m_avatarBoxSize.Z += AVBOXAJUST; + if (m_avatarBoxSize.X < AVBOXMINX) + m_avatarBoxSize.X = AVBOXMINX; + if (m_avatarBoxSize.Y < AVBOXMINY) + m_avatarBoxSize.Y = AVBOXMINY; + if (m_avatarBoxSize.Z < AVBOXMINZ) + m_avatarBoxSize.Z = AVBOXMINZ; + m_avatarHeight = m_avatarSize.Z; } public virtual void SetWearable(int wearableId, AvatarWearable wearable) @@ -386,7 +480,8 @@ namespace OpenSim.Framework } s += "Visual Params: "; - for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) + // for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) + for (uint j = 0; j < m_visualparams.Length; j++) s += String.Format("{0},",m_visualparams[j]); s += "\n"; @@ -402,18 +497,16 @@ namespace OpenSim.Framework /// public List GetAttachments() { - List alist = new List(); - lock (m_attachments) { + List alist = new List(); foreach (KeyValuePair> kvp in m_attachments) { foreach (AvatarAttachment attach in kvp.Value) alist.Add(new AvatarAttachment(attach)); } - } - - return alist; + return alist; + } } internal void AppendAttachment(AvatarAttachment attach) @@ -557,7 +650,6 @@ namespace OpenSim.Framework return kvp.Key; } } - return 0; } @@ -607,12 +699,6 @@ namespace OpenSim.Framework data["serial"] = OSD.FromInteger(m_serial); data["height"] = OSD.FromReal(m_avatarHeight); - // Hashes - OSDArray hashes = new OSDArray(AvatarAppearance.TEXTURE_COUNT); - for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) - hashes.Add(OSD.FromUUID(m_texturehashes[i])); - data["hashes"] = hashes; - // Wearables OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) @@ -634,12 +720,14 @@ namespace OpenSim.Framework OSDBinary visualparams = new OSDBinary(m_visualparams); data["visualparams"] = visualparams; - // Attachments - List attachments = GetAttachments(); - OSDArray attachs = new OSDArray(attachments.Count); - foreach (AvatarAttachment attach in GetAttachments()) - attachs.Add(attach.Pack()); - data["attachments"] = attachs; + lock (m_attachments) + { + // Attachments + OSDArray attachs = new OSDArray(m_attachments.Count); + foreach (AvatarAttachment attach in GetAttachments()) + attachs.Add(attach.Pack()); + data["attachments"] = attachs; + } return data; } @@ -653,29 +741,11 @@ namespace OpenSim.Framework if ((data != null) && (data["serial"] != null)) m_serial = data["serial"].AsInteger(); if ((data != null) && (data["height"] != null)) - m_avatarHeight = (float)data["height"].AsReal(); +// m_avatarHeight = (float)data["height"].AsReal(); + SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal())); try { - // Hashes - m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; - if ((data != null) && (data["hashes"] != null) && (data["hashes"]).Type == OSDType.Array) - { - OSDArray hashes = (OSDArray)(data["hashes"]); - for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) - { - UUID hashID = UUID.Zero; - if (i < hashes.Count && hashes[i] != null) - hashID = hashes[i].AsUUID(); - m_texturehashes[i] = hashID; - } - } - else - { - for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) - m_texturehashes[i] = UUID.Zero; - } - // Wearables SetDefaultWearables(); if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) @@ -1505,7 +1575,58 @@ namespace OpenSim.Framework SHAPE_EYELID_INNER_CORNER_UP = 214, SKIRT_SKIRT_RED = 215, SKIRT_SKIRT_GREEN = 216, - SKIRT_SKIRT_BLUE = 217 + SKIRT_SKIRT_BLUE = 217, + + /// + /// Avatar Physics section. These are 0 type visual params which get transmitted. + /// + + /// + /// Breast Part 1 + /// + BREAST_PHYSICS_MASS = 218, + BREAST_PHYSICS_GRAVITY = 219, + BREAST_PHYSICS_DRAG = 220, + BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221, + BREAST_PHYSICS_UPDOWN_SPRING = 222, + BREAST_PHYSICS_UPDOWN_GAIN = 223, + BREAST_PHYSICS_UPDOWN_DAMPING = 224, + BREAST_PHYSICS_INOUT_MAX_EFFECT = 225, + BREAST_PHYSICS_INOUT_SPRING = 226, + BREAST_PHYSICS_INOUT_GAIN = 227, + BREAST_PHYSICS_INOUT_DAMPING = 228, + /// + /// Belly + /// + BELLY_PHYISCS_MASS = 229, + BELLY_PHYSICS_GRAVITY = 230, + BELLY_PHYSICS_DRAG = 231, + BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232, + BELLY_PHYSICS_UPDOWN_SPRING = 233, + BELLY_PHYSICS_UPDOWN_GAIN = 234, + BELLY_PHYSICS_UPDOWN_DAMPING = 235, + + /// + /// Butt + /// + BUTT_PHYSICS_MASS = 236, + BUTT_PHYSICS_GRAVITY = 237, + BUTT_PHYSICS_DRAG = 238, + BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239, + BUTT_PHYSICS_UPDOWN_SPRING = 240, + BUTT_PHYSICS_UPDOWN_GAIN = 241, + BUTT_PHYSICS_UPDOWN_DAMPING = 242, + BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243, + BUTT_PHYSICS_LEFTRIGHT_SPRING = 244, + BUTT_PHYSICS_LEFTRIGHT_GAIN = 245, + BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246, + /// + /// Breast Part 2 + /// + BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, + BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, + BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, + BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250 } #endregion } -- cgit v1.1 From 712c50e0bf2a70e5b7d950113191b20af4fec429 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Fri, 18 Jul 2014 17:39:20 +0300 Subject: Don't append attachments multiple times --- OpenSim/Framework/AvatarAppearance.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index b7a0adf..69113b1 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -520,6 +520,12 @@ namespace OpenSim.Framework if (!m_attachments.ContainsKey(attach.AttachPoint)) m_attachments[attach.AttachPoint] = new List(); + foreach (AvatarAttachment prev in m_attachments[attach.AttachPoint]) + { + if (prev.ItemID == attach.ItemID) + return; + } + m_attachments[attach.AttachPoint].Add(attach); } } -- cgit v1.1