From 64deb6ae6fdf586bcd2e940d3cbf3ee54367dc83 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2014 19:49:58 +0100 Subject: Second part of invisible base avatar option --- OpenSim/Framework/AvatarAppearance.cs | 28 ++++++++++++++++++++++ .../Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 ++++++---- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 3874c47..257997e 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -72,6 +72,7 @@ namespace OpenSim.Framework protected float m_avatarAnimOffset = 0; protected WearableCacheItem[] m_cacheitems; protected bool m_cacheItemsDirty = true; + public static Primitive.TextureEntry Invisible = null; public virtual int Serial { @@ -134,8 +135,30 @@ namespace OpenSim.Framework set { m_cacheItemsDirty = value; } } + private void CreateInvisibleTextureEntry() + { + if (Invisible != null) + return; + Invisible = new Primitive.TextureEntry(new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); + + Invisible.FaceTextures[8] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[8].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[9] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[9].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[10] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[10].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[11] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[11].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[19] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[19].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[20] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[20].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + } + public AvatarAppearance() { + CreateInvisibleTextureEntry(); + // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); m_serial = 0; @@ -149,6 +172,9 @@ namespace OpenSim.Framework public AvatarAppearance(OSDMap map) { + CreateInvisibleTextureEntry(); + + Invisible = new Primitive.TextureEntry(new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); Unpack(map); @@ -157,6 +183,7 @@ namespace OpenSim.Framework public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) { + CreateInvisibleTextureEntry(); // m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance"); m_serial = 0; @@ -194,6 +221,7 @@ namespace OpenSim.Framework public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked) { + CreateInvisibleTextureEntry(); // m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); if (appearance == null) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f2f7cf9..b7a4b93 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5142,7 +5142,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP acceleration = Vector3.Zero; if (sendTexture) - textureEntry = presence.Appearance.Texture.GetBytes(); + { + if (presence.Invisible) + textureEntry = AvatarAppearance.Invisible.GetBytes(); + else + textureEntry = presence.Appearance.Texture.GetBytes(); + } else textureEntry = null; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7086b52..5a3e554 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -90,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes public bool isNPC { get; private set; } + public bool Invisible { get; set; } private PresenceType m_presenceType; public PresenceType PresenceType { get {return m_presenceType;} @@ -949,6 +950,7 @@ namespace OpenSim.Region.Framework.Scenes public ScenePresence( IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) { + Invisible = false; AttachmentsSyncLock = new Object(); AllowMovement = true; IsChildAgent = true; @@ -3709,14 +3711,17 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) return; - avatar.ControllingClient.SendAppearance( - UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); + SendAppearanceToAgentNF(avatar); } public void SendAppearanceToAgentNF(ScenePresence avatar) { - avatar.ControllingClient.SendAppearance( - UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); + if (Invisible) + avatar.ControllingClient.SendAppearance( + UUID, Appearance.VisualParams, AvatarAppearance.Invisible.GetBytes()); + else + avatar.ControllingClient.SendAppearance( + UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); } public void SendAnimPackToAgent(ScenePresence p) -- cgit v1.1