OpenMetaverse.AppearanceManager.RequestSetAppearance C# (CSharp) Method

RequestSetAppearance() public method

Starts the appearance setting thread
public RequestSetAppearance ( bool forceRebake ) : void
forceRebake bool True to force rebaking, otherwise false
return void
        public void RequestSetAppearance(bool forceRebake)
        {
            if (Interlocked.CompareExchange(ref AppearanceThreadRunning, 1, 0) != 0)
            {
                Logger.Log("Appearance thread is already running, skipping", Helpers.LogLevel.Warning);
                return;
            }

            // If we have an active delayed scheduled appearance bake, we dispose of it
            if (RebakeScheduleTimer != null)
            {
                RebakeScheduleTimer.Dispose();
                RebakeScheduleTimer = null;
            }

            // This is the first time setting appearance, run through the entire sequence
            AppearanceThread = new Thread(
                delegate()
                {
                    bool success = true;
                    try
                    {
                        if (forceRebake)
                        {
                            // Set all of the baked textures to UUID.Zero to force rebaking
                            for (int bakedIndex = 0; bakedIndex < BAKED_TEXTURE_COUNT; bakedIndex++)
                                Textures[(int)BakeTypeToAgentTextureIndex((BakeType)bakedIndex)].TextureID = UUID.Zero;
                        }

                        if (SetAppearanceSerialNum == 0)
                        {
                            // Fetch a list of the current agent wearables
                            if (!GetAgentWearables())
                            {
                                Logger.Log("Failed to retrieve a list of current agent wearables, appearance cannot be set",
                                    Helpers.LogLevel.Error, Client);
                                throw new Exception("Failed to retrieve a list of current agent wearables, appearance cannot be set");
                            }
                        }

                        // Download and parse all of the agent wearables
                        if (!DownloadWearables())
                        {
                            success = false;
                            Logger.Log("One or more agent wearables failed to download, appearance will be incomplete",
                                Helpers.LogLevel.Warning, Client);
                        }

                        // If this is the first time setting appearance and we're not forcing rebakes, check the server
                        // for cached bakes
                        if (SetAppearanceSerialNum == 0 && !forceRebake)
                        {
                            // Compute hashes for each bake layer and compare against what the simulator currently has
                            if (!GetCachedBakes())
                            {
                                Logger.Log("Failed to get a list of cached bakes from the simulator, appearance will be rebaked",
                                    Helpers.LogLevel.Warning, Client);
                            }
                        }

                        // Download textures, compute bakes, and upload for any cache misses
                        if (!CreateBakes())
                        {
                            success = false;
                            Logger.Log("Failed to create or upload one or more bakes, appearance will be incomplete",
                                Helpers.LogLevel.Warning, Client);
                        }

                        // Send the appearance packet
                        RequestAgentSetAppearance();
                    }
                    catch (Exception)
                    {
                        success = false;
                    }
                    finally
                    {
                        AppearanceThreadRunning = 0;

                        OnAppearanceSet(new AppearanceSetEventArgs(success));
                    }
                }
            );
            AppearanceThread.Name = "Appearance";
            AppearanceThread.IsBackground = true;
            AppearanceThread.Start();
        }

Same methods

AppearanceManager::RequestSetAppearance ( ) : void