Avatar Appearance

From libopenmetaverse - libomv - Developer Wiki

Jump to: navigation, search

The library supports basic appearance baking, which means it can set your previous appearance set in the viewer or set your avatars appearance using items stored in a folder in your inventory.

 
# Note: current trunk versions, and releases after 0.7.0 will do appearance setting automatically
 

When you connect to your first region always use SetPreviousAppearance(true);

Meaning make sure you check its the current Sim (The typical mistake is that people do it for all simulator connections)

 
public void Network_OnEventQueueRuning(Simulator simulator) {
            if (simulator==client.Network.CurrentSim)
            {
                client.Appearance.SetPreviousAppearance(true);
            }
    }
 


When you cross regions you can use the following. This needs to be sent after initial login and anytime you switch from one simulator to another. The best way of doing this is in the OnCurrentSimChanged event

 
public override void Network_OnCurrentSimChanged(Simulator PreviousSimulator)
        {
            if (PreviousSimulator != null)
            {
                client.Appearance.SetPreviousAppearance(false);
            }
        }
 

Dont forget before you connect to register the above code in your GridClient:

 
       // subscribe to the events
       Client.Network.OnCurrentSimChanged += Network_OnCurrentSimChanged;
       Client.Network.OnEventQueueRuning += Network_OnEventQueueRuning;
 

For appearance to be set properly you must:

  • Make sure you have one of the following copied to your bots/clients bin directory
    • openjpeg-dotnet.dll (Windows/.NET and Windows/Mono)
    • libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib (Apple OSX/Mono)
    • libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so (Linux/Mono 32bit)
    • libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so (Linux/Mono x86_64)

For Linux (all architectures) you will also need OpenMetaverse.dll.config copied to your bot/clients bin directory

  • Your appearance cannot contain any textures from the Library (These "Linden" Textures cannot be downloaded and the bake will fail or produce strange results)