AvatarBookmarks

Description

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts

The AvatarBookmarks API provides facilities for working with avatar bookmarks ("favorites" in the Avatar app). An avatar bookmark associates a name with an avatar model, scale, and avatar entities (wearables).

Methods

Name Return Value Summary
addBookmark None

Adds a new (or updates an existing) avatar bookmark with your current avatar model, scale, and avatar entities.

deleteBookmark None

Performs no action.

Deprecated: This function is deprecated and will be removed.

getBookmark AvatarBookmarks.BookmarkData | Object

Gets the details of an avatar bookmark.

getBookmarks Object.<string, AvatarBookmarks.BookmarkData>

Gets the details of all avatar bookmarks.

loadBookmark None

Loads an avatar bookmark, setting your avatar model, scale, and avatar entities (or attachments if an old bookmark) to those in the bookmark.

removeBookmark None

Deletes an avatar bookmark.

saveBookmark None

Updates an existing bookmark with your current avatar model, scale, and wearables. No action is taken if the bookmark doesn't exist.

updateAvatarEntities None

Updates the avatar entities and their properties. Current avatar entities not included in the list provided are deleted.

Deprecated: This function is deprecated and will be removed. Use the MyAvatar API instead.

Signals

Name Summary
bookmarkAdded

Triggered when a new avatar bookmark is added or an existing avatar bookmark is updated, using addBookmark.

bookmarkDeleted

Triggered when an avatar bookmark is deleted.

bookmarkLoaded

Triggered when an avatar bookmark is loaded, setting your avatar model, scale, and avatar entities (or attachments if an old bookmark) to those in the bookmark.

Type Definitions

BookmarkData
Type: object

Details of an avatar bookmark.

Properties

Name Type Attributes Summary
version number

The version of the bookmark data format.

avatarUrl string

The URL of the avatar model.

avatarScale number

The target scale of the avatar.

avatarEntites Array.<Object.<"properties", Entities.EntityProperties>> <optional>

The avatar entities included with the bookmark.

attachments Array.<AttachmentData> <optional>

The attachments included with the bookmark.

Deprecated: Use avatar entities instead.

Method Details

(static) addBookmark( bookmarkName )

Adds a new (or updates an existing) avatar bookmark with your current avatar model, scale, and avatar entities.

Parameters

Name Type Description
bookmarkName string

The name of the avatar bookmark (case sensitive).

Example

Add a new avatar bookmark and report the bookmark data.

var bookmarkName = "New Bookmark";
AvatarBookmarks.addBookmark(bookmarkName);
var bookmarkData = AvatarBookmarks.getBookmark(bookmarkName);
print("Bookmark data: " + JSON.stringify(bookmarkData));
(static) deleteBookmark( )

Performs no action.

Deprecated: This function is deprecated and will be removed.

(static) getBookmark( bookmarkName ) → {AvatarBookmarks.BookmarkData|Object}
Returns: The bookmark data if the bookmark exists, {} if it doesn't.

Gets the details of an avatar bookmark.

Parameters

Name Type Description
bookmarkName string

The name of the avatar bookmark (case sensitive).

(static) getBookmarks( ) → {Object.<string, AvatarBookmarks.BookmarkData>}
Returns: The current avatar bookmarks in an object where the keys are the bookmark names and the values are the bookmark details.

Gets the details of all avatar bookmarks.

Example

List the names and URLs of all the avatar bookmarks.

var bookmarks = AvatarBookmarks.getBookmarks();
print("Avatar bookmarks:");
for (var key in bookmarks) {
    print("- " + key + " " + bookmarks[key].avatarUrl);
};
(static) loadBookmark( bookmarkName )

Loads an avatar bookmark, setting your avatar model, scale, and avatar entities (or attachments if an old bookmark) to those in the bookmark.

Parameters

Name Type Description
bookmarkName string

The name of the avatar bookmark to load (case sensitive).

(static) removeBookmark( bookmarkName )

Deletes an avatar bookmark.

Parameters

Name Type Description
bookmarkName string

The name of the avatar bookmark to delete (case sensitive).

(static) saveBookmark( bookmarkName )

Updates an existing bookmark with your current avatar model, scale, and wearables. No action is taken if the bookmark doesn't exist.

Parameters

Name Type Description
bookmarkName string

The name of the avatar bookmark (case sensitive).

(static) updateAvatarEntities( avatarEntities )

Updates the avatar entities and their properties. Current avatar entities not included in the list provided are deleted.

Deprecated: This function is deprecated and will be removed. Use the MyAvatar API instead.

Parameters

Name Type Description
avatarEntities Array.<MyAvatar.AvatarEntityData>

The avatar entity IDs and properties.

Signal Details

bookmarkAdded( bookmarkName )
Returns: Signal

Triggered when a new avatar bookmark is added or an existing avatar bookmark is updated, using addBookmark.

Parameters

Name Type Description
bookmarkName string

The name of the avatar bookmark added or updated.

bookmarkDeleted( bookmarkName )
Returns: Signal

Triggered when an avatar bookmark is deleted.

Parameters

Name Type Description
bookmarkName string

The name of the avatar bookmark deleted.

Example

Report when a bookmark is deleted.

AvatarBookmarks.bookmarkDeleted.connect(function (bookmarkName) {
    print("Bookmark deleted: " + bookmarkName);
});
bookmarkLoaded( bookmarkName )
Returns: Signal

Triggered when an avatar bookmark is loaded, setting your avatar model, scale, and avatar entities (or attachments if an old bookmark) to those in the bookmark.

Parameters

Name Type Description
bookmarkName string

The name of the avatar bookmark loaded.