/// <summary>
        ///     The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name="client"></param>
        /// <param name="args"></param>
        void AgentCachedTexturesRequest(IClientAPI client, List <CachedAgentArgs> args)
        {
            IScenePresence          sp  = m_scene.GetScenePresence(client.AgentId);
            IAvatarAppearanceModule app = sp.RequestModuleInterface <IAvatarAppearanceModule> ();
            // Look up hashes to make sure that the request is valid

            List <CachedAgentArgs> resp = new List <CachedAgentArgs> ();

            foreach (CachedAgentArgs arg in args)
            {
                CachedAgentArgs r = new CachedAgentArgs();
                r.TextureIndex = arg.TextureIndex;
                //V2 changed to send the actual texture index, and not the baked texture index
                int index = arg.TextureIndex >= 5
                    ? arg.TextureIndex
                    : (int)AppearanceManager.BakeTypeToAgentTextureIndex((BakeType)arg.TextureIndex);

                r.ID = (
                    app.Appearance.Texture.FaceTextures [index] == null ||
                    app.Appearance.WearableCache.Count == 0 ||
                    !app.Appearance.WearableCache.ContainsKey(index.ToString()) ||
                    app.Appearance.WearableCache [index.ToString()] != arg.ID
                        ? UUID.Zero
                        : app.Appearance.Texture.FaceTextures [index].TextureID);

                resp.Add(r);
            }

            client.SendAgentCachedTexture(resp);
        }
Esempio n. 2
0
        /// <summary>
        /// The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name="client"></param>
        /// <param name="args"></param>
        public void AgentCachedTexturesRequest(IClientAPI client, List <CachedAgentArgs> args)
        {
            List <CachedAgentArgs> resp = new List <CachedAgentArgs>();

            //AvatarData ad = m_scene.AvatarService.GetAvatar(client.AgentId);
            //Send all with UUID zero for now so that we don't confuse the client about baked textures...
            foreach (CachedAgentArgs arg in args)
            {
                UUID cachedID = UUID.Zero;

                /*if (ad.Data.ContainsKey("CachedWearables"))
                 * {
                 *  OSDArray array = (OSDArray)OSDParser.DeserializeJson(ad.Data["CachedWearables"]);
                 *  AvatarWearable wearable = new AvatarWearable();
                 *  wearable.MaxItems = 0; //Unlimited items
                 *  wearable.Unpack(array);
                 *  cachedID = wearable.GetAsset(arg.ID);
                 * }*/
                CachedAgentArgs respArgs = new CachedAgentArgs();
                respArgs.ID           = cachedID;
                respArgs.TextureIndex = arg.TextureIndex;
                resp.Add(respArgs);
            }

            client.SendAgentCachedTexture(resp);
        }
        void AgentCachedTextureRequest(IClientAPI client, List <CachedAgentArgs> args)
        {
            ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
            // Look up hashes to make sure that the request is valid
            AvatarAppearance       app            = sp.Appearance;
            List <CachedAgentArgs> cachedTextures = m_scene.CommsManager.AvatarService.GetCachedBakedTextures(args);

            if (cachedTextures == null || cachedTextures.Count == 0)
            {
                cachedTextures = new List <CachedAgentArgs>();
                foreach (CachedAgentArgs arg in args)
                {
                    cachedTextures.Add(new CachedAgentArgs()
                    {
                        ID = UUID.Zero, TextureIndex = arg.TextureIndex
                    });
                }
            }
            else if (cachedTextures.Count != args.Count)
            {
                //This happens if we don't have all of the textures in the database,
                //  so we need to re-add UUID.Zero to tell the client to rebake
                foreach (CachedAgentArgs arg in args)
                {
                    if (cachedTextures.Find((a) => a.TextureIndex == arg.TextureIndex) == null)
                    {
                        cachedTextures.Add(new CachedAgentArgs()
                        {
                            ID = UUID.Zero, TextureIndex = arg.TextureIndex
                        });
                    }
                }
            }

            client.SendAgentCachedTexture(cachedTextures);
        }
        /// <summary>
        ///   The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name = "client"></param>
        /// <param name = "args"></param>
        public void AgentCachedTexturesRequest(IClientAPI client, List<CachedAgentArgs> args)
        {
            List<CachedAgentArgs> resp = (from arg in args let cachedID = UUID.Zero select new CachedAgentArgs {ID = cachedID, TextureIndex = arg.TextureIndex}).ToList();

            //AvatarData ad = m_scene.AvatarService.GetAvatar(client.AgentId);
            //Send all with UUID zero for now so that we don't confuse the client about baked textures...

            client.SendAgentCachedTexture(resp);
        }
        /// <summary>
        ///     The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name="client"></param>
        /// <param name="args"></param>
        void AgentCachedTexturesRequest (IClientAPI client, List<CachedAgentArgs> args)
        {
            IScenePresence sp = m_scene.GetScenePresence (client.AgentId);
            IAvatarAppearanceModule app = sp.RequestModuleInterface<IAvatarAppearanceModule> ();
            // Look up hashes to make sure that the request is valid

            List<CachedAgentArgs> resp = new List<CachedAgentArgs> ();
            foreach (CachedAgentArgs arg in args) {
                CachedAgentArgs r = new CachedAgentArgs ();
                r.TextureIndex = arg.TextureIndex;
                //V2 changed to send the actual texture index, and not the baked texture index
                int index = arg.TextureIndex >= 5
                    ? arg.TextureIndex
                    : (int)AppearanceManager.BakeTypeToAgentTextureIndex ((BakeType)arg.TextureIndex);

                r.ID = (
                    app.Appearance.Texture.FaceTextures [index] == null ||
                    app.Appearance.WearableCache.Count == 0 ||
                    !app.Appearance.WearableCache.ContainsKey (index.ToString ()) ||
                    app.Appearance.WearableCache [index.ToString ()] != arg.ID
                        ? UUID.Zero
                        : app.Appearance.Texture.FaceTextures [index].TextureID);

                resp.Add (r);
            }

            client.SendAgentCachedTexture (resp);
        }
Esempio n. 6
0
        /// <summary>
        /// The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name="client"></param>
        /// <param name="args"></param>
        public void AgentCachedTexturesRequest(IClientAPI client, List<CachedAgentArgs> args)
        {
            List<CachedAgentArgs> resp = new List<CachedAgentArgs>();

            //AvatarData ad = m_scene.AvatarService.GetAvatar(client.AgentId);
            //Send all with UUID zero for now so that we don't confuse the client about baked textures...
            foreach (CachedAgentArgs arg in args)
            {
                UUID cachedID = UUID.Zero;
                /*if (ad.Data.ContainsKey("CachedWearables"))
                {
                    OSDArray array = (OSDArray)OSDParser.DeserializeJson(ad.Data["CachedWearables"]);
                    AvatarWearable wearable = new AvatarWearable();
                    wearable.MaxItems = 0; //Unlimited items
                    wearable.Unpack(array);
                    cachedID = wearable.GetAsset(arg.ID);
                }*/
                CachedAgentArgs respArgs = new CachedAgentArgs();
                respArgs.ID = cachedID;
                respArgs.TextureIndex = arg.TextureIndex;
                resp.Add(respArgs);
            }

            client.SendAgentCachedTexture(resp);
        }
        void AgentCachedTextureRequest(IClientAPI client, List<CachedAgentArgs> args)
        {
            ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
            // Look up hashes to make sure that the request is valid
            AvatarAppearance app = sp.Appearance;
            List<CachedAgentArgs> cachedTextures = m_scene.CommsManager.AvatarService.GetCachedBakedTextures(args);
            if (cachedTextures == null || cachedTextures.Count == 0)
            {
                cachedTextures = new List<CachedAgentArgs>();
                foreach (CachedAgentArgs arg in args)
                    cachedTextures.Add(new CachedAgentArgs() { ID = UUID.Zero, TextureIndex = arg.TextureIndex });
            }
            else if (cachedTextures.Count != args.Count)
            {
                //This happens if we don't have all of the textures in the database, 
                //  so we need to re-add UUID.Zero to tell the client to rebake
                foreach (CachedAgentArgs arg in args)
                {
                    if (cachedTextures.Find((a) => a.TextureIndex == arg.TextureIndex) == null)
                        cachedTextures.Add(new CachedAgentArgs() { ID = UUID.Zero, TextureIndex = arg.TextureIndex });
                }
            }

            client.SendAgentCachedTexture(cachedTextures);
        }