/// <summary> /// Set appearance data (textureentry and slider settings) received from the client /// </summary> /// <param name="textureEntry"></param> /// <param name="visualParams"></param> /// <param name="client"></param> /// <param name="wearables"></param> /// <param name="serial"></param> public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte [] visualParams, WearableCache [] wearables, uint serial) { IScenePresence sp = m_scene.GetScenePresence(client.AgentId); IAvatarAppearanceModule appearance = sp.RequestModuleInterface <IAvatarAppearanceModule> (); appearance.Appearance.Serial = (int)serial; //MainConsole.Instance.InfoFormat("[AVFACTORY]: start SetAppearance for {0}", client.AgentId); bool texturesChanged = false; bool visualParamsChanged = false; // Process the texture entry transactionally, this doesn't guarantee that Appearance is // going to be handled correctly but it does serialize the updates to the appearance lock (m_setAppearanceLock) { if (textureEntry != null) { List <UUID> ChangedTextures; texturesChanged = appearance.Appearance.SetTextureEntries(textureEntry, out ChangedTextures); } appearance.Appearance.SetCachedWearables(wearables); // Process the visual params, this may change height as well if (visualParams != null) { //Now update the visual params and see if they have changed visualParamsChanged = appearance.Appearance.SetVisualParams(visualParams); //Fix the height only if the parameters have changed if (visualParamsChanged) { sp.SetHeight(appearance.Appearance.AvatarHeight); } } } // If something changed in the appearance then queue an appearance save if (texturesChanged || visualParamsChanged) { // NPC's should skip saving appearance if (!sp.IsNpcAgent) { QueueAppearanceSave(client.AgentId); } } // send appearance regardless of any changes QueueAppearanceSend(client.AgentId); }
/// <summary> /// Set appearance data (textureentry and slider settings) received from the client /// </summary> /// <param name="texture"></param> /// <param name="visualParam"></param> public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCache[] wearables) { IScenePresence sp = m_scene.GetScenePresence(client.AgentId); IAvatarAppearanceModule appearance = sp.RequestModuleInterface <IAvatarAppearanceModule> (); if (sp == null) { m_log.WarnFormat("[AvatarFactory]: SetAppearance unable to find presence for {0}", client.AgentId); return; } //m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}", client.AgentId); // Process the texture entry transactionally, this doesn't guarantee that Appearance is // going to be handled correctly but it does serialize the updates to the appearance lock (m_setAppearanceLock) { bool texturesChanged = false; bool visualParamsChanged = false; if (textureEntry != null) { List <UUID> ChangedTextures = new List <UUID>(); texturesChanged = appearance.Appearance.SetTextureEntries(textureEntry, out ChangedTextures); // m_log.WarnFormat("[AVFACTORY]: Prepare to check textures for {0}",client.AgentId); //Do this async as it accesses the asset service (could be remote) multiple times Util.FireAndForget(delegate(object o) { //Validate all the textures now that we've updated ValidateBakedTextureCache(client, false); //The client wants us to cache the baked textures CacheWearableData(sp, textureEntry, wearables); }); // m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId); } // Process the visual params, this may change height as well if (visualParams != null) { //Now update the visual params and see if they have changed visualParamsChanged = appearance.Appearance.SetVisualParams(visualParams); //Fix the height only if the parameters have changed if (visualParamsChanged && appearance.Appearance.AvatarHeight > 0) { sp.SetHeight(appearance.Appearance.AvatarHeight); } } // Process the baked texture array if (textureEntry != null) { //Check for banned clients here Aurora.Framework.IBanViewersModule module = client.Scene.RequestModuleInterface <Aurora.Framework.IBanViewersModule>(); if (module != null) { module.CheckForBannedViewer(client, textureEntry); } } // If something changed in the appearance then queue an appearance save if (texturesChanged || visualParamsChanged) { QueueAppearanceSave(client.AgentId); } } // And always queue up an appearance update to send out QueueAppearanceSend(client.AgentId); // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); }