# IRdAvatarCustomization Interface Reference

Inherits IRsObject.

List of all members.

## Public Member Functions
HRESULT | SetAvatarName ([in] BSTR bszAvatarName)
HRESULT | GetAvatarName ([out, retval] BSTR *pAvatarName)
HRESULT | SetBodyMesh ([in] BSTR bszBodyMeshName)
HRESULT | GetBodyMesh ([out, retval] BSTR *pBodyMeshName)
HRESULT | AddInventory ([in] BSTR bszInventoryName)
HRESULT | RemoveInventory ([in] RtDWORD index)
HRESULT | GetInventoryCount ([out, retval] RtDWORD *pCount)
HRESULT | GetInventoryName ([in] RtDWORD index,[out, retval] BSTR *pInventoryName)
HRESULT | GetItemCount ([in] RtDWORD inventoryIndex,[out, retval] RtDWORD *pCount)
HRESULT | GetItemInfo ([in] RtDWORD inventoryIndex,[in] RtDWORD itemIndex,[out] BSTR *pName,[out] RtBool *pActive,[out] RtBool *pDefault)
HRESULT | GetActiveItem ([in] RtDWORD inventoryIndex,[out, retval] RtDWORD *pActiveItem)
HRESULT | GetDefaultItem ([in] RtDWORD inventoryIndex,[out, retval] RtDWORD *pDefaultItem)
HRESULT | SetActiveItem ([in] RtDWORD inventoryIndex,[in] RtDWORD activeItem)
HRESULT | SetDefaultItem ([in] RtDWORD inventoryIndex,[in] RtDWORD defaultItem)
HRESULT | AddItem ([in] RtDWORD inventoryIndex,[in] BSTR bszName)
HRESULT | RemoveItem ([in] RtDWORD inventoryIndex,[in] RtDWORD itemIndex)
HRESULT | AddMorph ([in] GUID *pGuid,[in] BSTR bszName,[in] BSTR bszTarget,[in] RtFloat fValue)
HRESULT | RemoveMorph ([in] GUID *pGuid)
HRESULT | GetMorphCount ([out, retval] RtDWORD *pMorphCount)
HRESULT | GetMorphGuid ([in] RtDWORD index,[out, retval] GUID *pGuid)
HRESULT | GetMorphWeight ([in] GUID *pGuid,[out, retval] RtFloat *pValue)
HRESULT | SetMorphWeight ([in] GUID *pGuid,[in] RtFloat val)
HRESULT | ClearMorphs ()
HRESULT | ParseFromXMLStream ([in] IStream *pStream)
HRESULT | StoreToXMLStream ([in] IStream *pStream)
HRESULT | ActivateItem ([in] BSTR inventoryname,[in] BSTR itemname)
HRESULT | SetCacheGuid ([in] GUID guid)
HRESULT | GetCacheGuid ([out, retval] GUID *pGuid)
HRESULT | GetTemplateName ([out, retval] BSTR *pTemplateName)
HRESULT | SetTemplateName (BSTR bszTemplateName)
HRESULT | GetMorphTarget (GUID *pGuid, BSTR *pbszTarget)

## Detailed Description

This data object stores the customization of avatar and is used in avatar editor as well.
It is also used in content server-client exchange. Is capable of storing the customization in XML format which is used on server mainly.
Modifications of the customization do not change the avatar directly.
Avatar in avatar editor has to be recomposed in order to reflect changes.
Customization stores inventories together with list of items for each of them, morph weights for body proportions and cache guid used by the network cache.

## Member Function Documentation

HRESULT IRdAvatarCustomization::SetAvatarName | ( | [in] BSTR | bszAvatarName | ) |

Set the Avatar Name.

Parameters:

  | bszAvatarName | is filled with the name value you wish to set to the Avatar.

     var inCust = params.ConValue('Customization');
     avatarName = "My avatar";
     inCust.SetAvatarName(avatarName);
     System.Alert(avatarName);

HRESULT IRdAvatarCustomization::GetAvatarName | ( | [out, retval] BSTR * | pAvatarName | ) |

Get the Avatar Name.

Returns:
  pAvatarName is filled with the Avatar name.

     var inCust = params.ConValue('Customization');
     avatarName = inCust.GetAvatarName();
     System.Alert(avatarName);

HRESULT IRdAvatarCustomization::SetBodyMesh | ( | [in] BSTR | bszBodyMeshName | ) |

Set the Avatar body mesh.

Parameters:

  | bszBodyMeshName | is filled with the body mesh name.

     var inCust = params.ConValue('Customization');
     avatarBodyName = "Rs Main Libraries\\Avatar - Male\\man.RsAvatar";
     inCust.SetBodyMesh(avatarBodyName);
     System.Alert(avatarBodyName);

HRESULT IRdAvatarCustomization::GetBodyMesh | ( | [out, retval] BSTR * | pBodyMeshName | ) |

Get the Avatar body mesh name.

Returns:
  pBodyMeshName is filled with the name of the body mesh.
  Standard HRESULT processing can be applied to the result.

     var inCust = params.ConValue('Customization');
     bodyMesh = inCust.GetBodyMesh();
     System.Alert(bodyMesh);

HRESULT IRdAvatarCustomization::AddInventory | ( | [in] BSTR | bszInventoryName | ) |

Add inventory.

Parameters:

  | bszInventoryName | is filled with the inventory name.
       var inCust = params.ConValue('Customization');
       invName = "Left hand";
       inCust.AddInventry(invName);
       System.Alert(invName);

HRESULT IRdAvatarCustomization::RemoveInventory | ( | [in] RtDWORD | index | ) |

Remove inventory.

Parameters:

  | index | is filled with the index value of the Inventory to be removed.
       var inCust = params.ConValue('Customization');
       invName = "Left hand";
       inCust.RemoveInventory(invName);
       System.Alert(invName);

HRESULT IRdAvatarCustomization::GetInventoryCount | ( | [out, retval] RtDWORD * | pCount | ) |

Get Inventory count.

Returns:
  pCount is filled with the number of inventories.

       var inCust = params.ConValue('Customization');
       invCount = inCust.GetInventoryCount(avatarName);
       System.Alert(invCount);

HRESULT IRdAvatarCustomization::GetInventoryName | ( | [in] RtDWORD | index,
|  | [out, retval] BSTR * | pInventoryName |
| ) |  |  |

Get Inventory name.

Parameters:

  | index | is filled with the index value of the inventory to retrieve name from.

Returns:
  pInventoryName is filled with the Inventory's name value.

       var inCust = params.ConValue('Customization');
       inCust.AddInventory('Left hand');
       invName = inCust.GetInventoryName(0);
       System.Alert(invName);

HRESULT IRdAvatarCustomization::GetItemCount | ( | [in] RtDWORD | inventoryIndex,
|  | [out, retval] RtDWORD * | pCount |
| ) |  |  |

Get Item count.

Parameters:

  | inventoryIndex | is filled with the index for the inventory.

Returns:
  pCount is filled with item count from specified inventory.

       var inCust = params.ConValue('Customization');
       inCust.AddInventory("Left hand");
       itemCnt = inCust.GetItemCount(0);
       System.Alert(itemCnt);

HRESULT IRdAvatarCustomization::GetItemInfo | ( | [in] RtDWORD | inventoryIndex,
|  | [in] RtDWORD | itemIndex,
|  | [out] BSTR * | pName,
|  | [out] RtBool * | pActive,
|  | [out] RtBool * | pDefault |
| ) |  |  |

Get Item Info.

Parameters:

  | inventoryIndex | is filled with the index for the inventory.
  | itemIndex | is filled with the index value of the Item to retrieve information regarding.

Returns:
  pName is filled with name of Item.

  pActive indicates if the Item is active or not.

  pDefault indicates if Item is active by default.

Remarks:
  Scripting allows for one return value only. This method will not be accessible from script in its present form.

     var inCust = params.ConValue('Customization');
     inCust.AddInventory("Left hand");
     inCust.AddItem(0, "Sword");
     var name;
     var active, default;
     inCust.GetItemInfo(0,0,name,active,default);
     System.Alert(name);

HRESULT IRdAvatarCustomization::GetActiveItem | ( | [in] RtDWORD | inventoryIndex,
|  | [out, retval] RtDWORD * | pActiveItem |
| ) |  |  |

Get Active Item for specified inventory.

Parameters:

  | inventoryIndex | is filled with the index for the inventory.

Returns:
  pActiveItem is filled with index value of the Active item.

     var inCust = params.ConValue('Customization');
     var activeItem
     inCust.GetActiveItem(0,activeItem);
     inCust.AddItem(0, "Sword");
     System.Alert(activeItem);

HRESULT IRdAvatarCustomization::GetDefaultItem | ( | [in] RtDWORD | inventoryIndex,
|  | [out, retval] RtDWORD * | pDefaultItem |
| ) |  |  |

Get the default item for specified inventory

Parameters:

  | inventoryIndex | is filled with the index for the inventory.

Returns:
  pDefaultItem is filled with index value of the Default item.

     var inCust = params.ConValue('Customization');
     inCust.AddInventory("Left hand");
     inCust.AddItem(0, "Sword");
     var defaultItem = inCust.GetDefaultItem(0);
     System.Alert(defaultItem);

HRESULT IRdAvatarCustomization::SetActiveItem | ( | [in] RtDWORD | inventoryIndex,
|  | [in] RtDWORD | activeItem |
| ) |  |  |

Set the Active Item.

Parameters:

  | inventoryIndex | is filled with the index for the inventory.
  | activeItem | is filled with the index value of the item to make active.

        var inCust = params.ConValue('Customization');
     inCust.AddInventory("Left hand");
     inCust.AddItem(0,"Sword");
     inCust.SetActiveItem(0,0);
     activeItem = inCust.GetActiveItem(0);
     System.Alert(activeItem);

HRESULT IRdAvatarCustomization::SetDefaultItem | ( | [in] RtDWORD | inventoryIndex,
|  | [in] RtDWORD | defaultItem |
| ) |  |  |

Set the default item for specified inventory

Parameters:

  | inventoryIndex | is filled with the index for the inventory.
  | defaultItem | is filled with the index value of the item to make default.

        var inCust = params.ConValue('Customization');
     inCust.AddInventory(0,"Left hand");
     inCust.AddItem(0,"Sword");
     inCust.SetDefaultItem(0,0);

HRESULT IRdAvatarCustomization::AddItem | ( | [in] RtDWORD | inventoryIndex,
|  | [in] BSTR | bszName |
| ) |  |  |

Adds new item to specified inventory

Parameters:

  | inventoryIndex | is filled with the index for the inventory.
  | bszName | is filled with the name of the item to add.

        var inCust = params.ConValue('Customization');
     inCust.AddInventory("inventory");
     inCust.AddItem(0, "Sword");

HRESULT IRdAvatarCustomization::RemoveItem | ( | [in] RtDWORD | inventoryIndex,
|  | [in] RtDWORD | itemIndex |
| ) |  |  |

Removes item with specified index from specified inventory.

Parameters:

  | inventoryIndex | is filled with the index for the inventory.
  | itemIndex | is filled with the index value of the item to remove.

        var inCust = params.ConValue('Customization');
     inCust.AddInventory("Right hand");
     inCust.AddItem(0,"Sword");
     inCust.RemoveItem(0,0);

HRESULT IRdAvatarCustomization::AddMorph | ( | [in] GUID * | pGuid,
|  | [in] BSTR | bszName,
|  | [in] BSTR | bszTarget,
|  | [in] RtFloat | fValue |
| ) |  |  |

Add Morph.

Parameters:

  | pGuid | is filled with the GUID for morph.
  | bszName | is filled with the name of the morph.
  | bszTarget | mesh name to which morph belongs to i.e. "head", "body"
  | fWeight | weight of morph

        var inCust = params.ConValue('Customization');
     var iid = "{F71B3CE9-CCBF-4ba4-9240-50A41DC4B13C}"
     inCust.AddMorph( iid, "Eyebrows", "head", 1);

HRESULT IRdAvatarCustomization::RemoveMorph | ( | [in] GUID * | pGuid | ) |

Removes specified morph

Parameters:

  | pGuid | is filled with the GUID for morph.

        var inCust = params.ConValue('Customization');
     var iid = "{F71B3CE9-CCBF-4ba4-9240-50A41DC4B13C}"
     inCust.RemoveMorph(iid);

HRESULT IRdAvatarCustomization::GetMorphCount | ( | [out, retval] RtDWORD * | pMorphCount | ) |

Returns the number of morphs stored within customization

Returns:
  pMorphCount is filled with count of morphs.

     @code
     var inCust = params.ConValue('Customization');
     var iid = "{F71B3CE9-CCBF-4ba4-9240-50A41DC4B13C}"
     inCust.AddMorph( iid, "Eyebrows", "head", 1);
        morphCount = inCust.GetMorphCount();
     System.Alert(morphCount);

HRESULT IRdAvatarCustomization::GetMorphGuid | ( | [in] RtDWORD | index,
|  | [out, retval] GUID * | pGuid |
| ) |  |  |

Gets GUID of morph with specified index.

Parameters:

  | index | is filled with the index value for the morph.

Returns:
  pGuid is filled with the GUID of the morph.

     var inCust = params.ConValue('Customization');
     var iid = "{F71B3CE9-CCBF-4ba4-9240-50A41DC4B13C}"
     inCust.AddMorph( iid, "Eyebrows", "head", 1);
     var iid2 = inCust.GetMorphGuid(0);
     System.Alert(iid2);

HRESULT IRdAvatarCustomization::GetMorphWeight | ( | [in] GUID * | pGuid,
|  | [out, retval] RtFloat * | pValue |
| ) |  |  |

Gets the weight of morph with specified guid

Parameters:

  | pGuid | is filled with the GUID for the morph.

Returns:
  pValue is filled with the weight value.

     var inCust = params.ConValue('Customization');
     var iid = "{F71B3CE9-CCBF-4ba4-9240-50A41DC4B13C}"
     inCust.AddMorph( iid, "Eyebrows", "head", 1);
     var fWeight = inCust.GetMorphWeight(iid);
     System.Alert(fWeight)

HRESULT IRdAvatarCustomization::SetMorphWeight | ( | [in] GUID * | pGuid,
|  | [in] RtFloat | val |
| ) |  |  |

Sets the morph weight with specified IID

Parameters:

  | pGuid | is filled with the GUID for the morph.
  | val | is filled with the weight value.

     var inCust = params.ConValue('Customization');
     var iid = "{F71B3CE9-CCBF-4ba4-9240-50A41DC4B13C}"
     inCust.AddMorph( iid, "Eyebrows", "head", 1);
     inCust.SetMorphWeight(iid, 0.5f);

HRESULT IRdAvatarCustomization::ClearMorphs | ( |  | ) |

Clear Morphs. Removes all stored morphs from customization

        var inCust = ConValue('Customization');
     inCust.ClearMorphs();

HRESULT IRdAvatarCustomization::ParseFromXMLStream | ( | [in] IStream * | pStream | ) |

ParseFromXMLStream.

Parameters:

  | pStream | is filled with name of stream.

Can not be used with script

HRESULT IRdAvatarCustomization::StoreToXMLStream | ( | [in] IStream * | pStream | ) |

StoreToXMLStream.

Parameters:

  | pStream | is filled with name of stream.

Can not be used with script

HRESULT IRdAvatarCustomization::ActivateItem | ( | [in] BSTR | inventoryname,
|  | [in] BSTR | itemname |
| ) |  |  |

Activates item with specified name for specified inventory

Parameters:

  | inventoryname | is filled with name of inventory.
  | itemname | is filled with the item's name.

        var inCust = params.ConValue('Customization');
     inCust.AddInventory("Right hand");
     inCust.AddItem(0, "Sword");
     inCust.AddItem(0, "Knife");
     inCust.ActivateItem("Sword", "Knife");

HRESULT IRdAvatarCustomization::SetCacheGuid | ( | [in] GUID | guid | ) |

sets cache id of the avatar using this customization

Parameters:

  | guid | is filled with GUID.

     var inCust = params.ConValue('Customization');
     var iid = "{C311BB02-9526-45fa-88C9-34AEE029FBED}"
     inCust.SetCacheGuid(iid);

HRESULT IRdAvatarCustomization::GetCacheGuid | ( | [out, retval] GUID * | pGuid | ) |

Gets cache id of the avatar

Returns:
  pGuid is filled with the cache GUID.

        var inCust = params.ConValue('Customization');
     var iid = inCust.GetCacheGuid();
     System.Alert(iid);

HRESULT IRdAvatarCustomization::GetTemplateName | ( | [out, retval] BSTR * | pTemplateName | ) |

Returns the name of template which forms this customization

Parameters:

  | pTemplateName | is filled with the name of the template to retrieve.

        var inCust = params.ConValue('Customization');
     System.Alert(inCust.GetTemplateName);

HRESULT IRdAvatarCustomization::SetTemplateName | ( | BSTR | bszTemplateName | ) |

Sets the template name for this custmization

Parameters:

  | bszTemplateName | is filled with the name of the template to set.

        var inCust = params.ConValue('Customization');
     inCust.SetTemplateName('template_name');

HRESULT IRdAvatarCustomization::GetMorphTarget | ( | GUID * | pGuid,
|  | BSTR * | pbszTarget |
| ) |  |  |

Gets the morph target for the specified morph. Target of morph is a name of mesh for which the morph is stored (e.g. 'head','body'...

Parameters:

  | pGuid | - guid of morph

Returns:
  name of target mesh

     var inCust = params.ConValue('Customization');
     var iid = '{C311BB02-9526-45fa-88C9-34AEE029FBED}';
     var target = inCust.GetMorphTarget(iid);
     System.Alert(target);