Introduction

By default, when a new avatar is created in OpenSimulator they are clothed with a default clothing set consisting of hair, shape, eyes, skin, pants and shirt (this is also known as the "Ruth" avatar).

By making various ROBUST service calls and uploading the appropriate assets, one can also set clothing on an avatar without manually doing this through a viewer. It is also possible to achieve the same end through other means, such as direct database updates. However, this document will concentrate on the ROBUST service call approach. Using ROBUST service calls does not require the caller to have an extremely detailed knowledge of the OpenSimulator data structure, though a very large amount of knowledge about OpenSimulator in general is still required. The ROBUST service call approach is also less vulnerable to change as OpenSimulator evolves. One disadvantage is that it requires the appropriate ROBUST service instances to be running whereas direct database updates could be made when OpenSimulator is completely inactive.

This technique also currently applies only to the grid architecture of OpenSimulator, since the standalone mode cannot currently expose the necessary external service interfaces. In theory, there is some undocumented code in the RemoteAdmin facility that can be used to setup differently clothed avatars in standalone mode but the extent to which this is operational is not currently known.

Also, please note that this technique needs the user to be offline throughout. If the user is online then they can make updates to their clothing which conflict with updates made through the ROBUST service calls.

Steps

For now, we are going to assume

That we are clothing a new avatar, not changing the clothing of one that already exists.

The necessary assets are not yet in OpenSimulator's asset service.

Step 1: Upload the assets

Each clothing item needs an associated asset for its appearance and other parameters (e.g. length in the case of hair). As assets are immutable, they will be reused for every user (if a user were to change their hair length then a new asset just for them would be created). However, we are assuming that the original assets aren't yet in the asset service so we will need to upload them.

One way to do this is to directly POST the assets to the asset service, as described at AssetService#POST:.2Fassets. There are a number of ways to get the raw asset data (the part that actual describes the hair, pants, etc.) itself. One is to dump assets using the "dump asset" region console command. Another is to extract them from OpenSim Region Archives (OARs) or OpenSim Inventory Archives (IARs).

You will also need the textures referenced by the bodyparts/clothing. You can see these by directly reading the asset data files. Or alternatively you could upload everything saved from an OAR or IAR.

Here's example data POST for an eyes asset and the associated texture reference embedded within the eyes asset.

Step 2: Create the user

This can be done by any number of means, including via a manual "create user" command on the ROBUST service interface or via the ROBUST calls detailed in UserManipulation. You may want to set

[UserAccountService]
CreateDefaultAvatarEntries = false

in Robust.ini if you don't want a new avatar to have the "Ruth" clothing. However, there is no harm if the avatar has these entries as well.

Step 3: Create the inventory items

For each user and each asset you will need to create an inventory item (e.g. an eyes inventory item for the eyes asset). You can do this by fetching the BodyParts (asset type 13) and Clothing Type (asset type 6) folders using the GETFOLDERFORTYPE operation in InventoryService and then uploading each item's metadata using the ADDITEM operation in InventoryService.

In version 1 viewers, we would want to set the worn clothing by changing the relevant entries in the Avatar service.

However, this technique will not work on LL viewer 2 and later where worn clothing is controlled by inventory links in the "Current Outfit" system folder. In fact, such viewers will override any existing settings in the Avatar service where they conflict with worn clothing inventory links.

Therefore, we will use the inventory link approach here. However, a full implementation would probably also set the matching Avatar service entries in order to cater for earlier viewers. This is TODO.

Step 4.1: Get the "Current Outfit" system folder

Step 4.2: Delete existing item links as appropriate

Before we add our links, we want to remove any existing clothing links which would conflict with our links. We would fetch the items in the current outfit folder using InventoryService#GETFOLDERCONTENT, for example with POST data