C# Class OpenMetaverse.AppearanceManager

Exibir arquivo Open project: N3X15/VoxelSim Class Usage Examples

Public Properties

Property Type Description
BAKED_TEXTURE_HASH UUID[]
BakeIndexToTextureIndex byte[]
DEFAULT_AVATAR_TEXTURE UUID
WEARABLE_BAKE_MAP WearableType[][]

Public Methods

Method Description
AddAttachments ( List attachments, bool removeExistingFirst ) : void

Adds a list of attachments to our agent

AddToOutfit ( InventoryItem wearableItem ) : void

Add a wearable to the current outfit and set appearance

AddToOutfit ( List wearableItems ) : void

Add a list of wearables to the current outfit and set appearance

AppearanceManager ( GridClient client ) : System

Default constructor

Attach ( InventoryItem item, AttachmentPoint attachPoint ) : void

Attach an item to our agent at a specific attach point

Attach ( UUID itemID, UUID ownerID, string name, string description, Permissions perms, uint itemFlags, AttachmentPoint attachPoint ) : void

Attach an item to our agent specifying attachment details

BakeTypeToAgentTextureIndex ( BakeType index ) : AvatarTextureIndex

Converts a BakeType to the corresponding baked texture slot in AvatarTextureIndex

BakeTypeToTextures ( BakeType bakeType ) : List

Converts a BakeType to a list of the texture slots that make up that bake

Detach ( InventoryItem item ) : void

Detach an item from our agent using an OpenMetaverse.InventoryItem object

Detach ( UUID itemID ) : void

Detach an item from our agent

GetWearableAsset ( WearableType type ) : UUID

Returns the AssetID of the asset that is currently being worn in a given WearableType slot

GetWearables ( ) : WearableData>.Dictionary

Returns a copy of the agents currently worn wearables

Avoid calling this function multiple times as it will make a copy of all of the wearable data each time

IsItemWorn ( InventoryItem item ) : WearableType

Checks if an inventory item is currently being worn

MorphLayerForBakeType ( BakeType bakeType ) : AvatarTextureIndex

Gives the layer number that is used for morph mask

RemoveFromOutfit ( InventoryItem wearableItem ) : void

Remove a wearable from the current outfit and set appearance

RemoveFromOutfit ( List wearableItems ) : void

Removes a list of wearables from the current outfit and set appearance

ReplaceOutfit ( List wearableItems ) : void

Replace the current outfit with a list of wearables and set appearance

RequestAgentWearables ( ) : void

Ask the server what textures our agent is currently wearing

RequestCachedBakes ( ) : void

Build hashes out of the texture assetIDs for each baking layer to ask the simulator whether it has cached copies of each baked texture

RequestSetAppearance ( ) : void

Starts the appearance setting thread

RequestSetAppearance ( bool forceRebake ) : void

Starts the appearance setting thread

WearOutfit ( List wearables, bool replaceItems ) : void

Calls either ReplaceOutfit or AddToOutfit depending on the value of replaceItems

WearableTypeToAssetType ( WearableType type ) : AssetType

Converts a WearableType to a bodypart or clothing WearableType

Protected Methods

Method Description
AgentCachedTextureResponseHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
AgentWearablesUpdateHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
OnAgentCachedBakes ( AgentCachedBakesReplyEventArgs e ) : void

Raises the CachedBakesReply event

OnAgentWearables ( AgentWearablesReplyEventArgs e ) : void

Raises the AgentWearablesReply event

OnAppearanceSet ( AppearanceSetEventArgs e ) : void

Raises the AppearanceSet event

OnRebakeAvatar ( RebakeAvatarTexturesEventArgs e ) : void

Raises the RebakeAvatarRequested event

RebakeAvatarTexturesHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Private Methods

Method Description
AddTextureDownload ( AvatarTextureIndex index, List textures ) : void

Helper method to lookup the TextureID for a single layer and add it to a list if it is not already present

CreateBake ( BakeType bakeType ) : bool

Blocking method to create and upload a baked texture for a single bake layer

CreateBakes ( ) : bool

Blocking method to create and upload baked textures for all of the missing bakes

DecodeWearableParams ( WearableData wearable ) : void

Populates textures and visual params from a decoded asset

DelayedRequestSetAppearance ( ) : void
DownloadTextures ( List bakeLayers ) : void

Blocking method to download all of the textures needed for baking the given bake layers

No return value is given because the baking will happen whether or not all textures are successfully downloaded

DownloadWearables ( ) : bool

Blocking method to download and parse currently worn wearable assets

GetAgentWearables ( ) : bool

Blocking method to populate the Wearables dictionary

GetCachedBakes ( ) : bool

Blocking method to populate the Textures array with cached bakes

GetColorFromParams ( List param ) : Color4

Calculates base color/tint for a specific wearable based on its params

GetFolderWearables ( UUID folder, List &wearables, List &attachments ) : bool
GetFolderWearables ( string folderPath, List &wearables, List &attachments ) : bool
GetTextureDownloadList ( BakeType bakeType ) : List

Get a list of all of the textures that need to be downloaded for a single bake layer

MakeParamValues ( ) : float>.Dictionary

Creates a dictionary of visual param values from the downloaded wearables

Network_OnDisconnected ( object sender, OpenMetaverse.DisconnectedEventArgs e ) : void
Network_OnEventQueueRunning ( object sender, OpenMetaverse.EventQueueRunningEventArgs e ) : void
RebakeScheduleTimerTick ( Object state ) : void
ReplaceOutfit ( List wearableItems ) : void

Replaces the Wearables collection with a list of new wearable items

RequestAgentSetAppearance ( ) : void

Create an AgentSetAppearance packet from Wearables data and the Textures array and send it

SendAgentIsNowWearing ( ) : void

Inform the sim which wearables are part of our current outfit

SetPreviousAppearance ( ) : void
SetPreviousAppearance ( bool allowBake ) : void
UploadBake ( byte textureData ) : UUID

Blocking method to upload a baked texture

Method Details

AddAttachments() public method

Adds a list of attachments to our agent
public AddAttachments ( List attachments, bool removeExistingFirst ) : void
attachments List A List containing the attachments to add
removeExistingFirst bool If true, tells simulator to remove existing attachment /// first
return void

AddToOutfit() public method

Add a wearable to the current outfit and set appearance
public AddToOutfit ( InventoryItem wearableItem ) : void
wearableItem InventoryItem Wearable to be added to the outfit
return void

AddToOutfit() public method

Add a list of wearables to the current outfit and set appearance
public AddToOutfit ( List wearableItems ) : void
wearableItems List List of wearable inventory items to /// be added to the outfit
return void

AgentCachedTextureResponseHandler() protected method

protected AgentCachedTextureResponseHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object
e OpenMetaverse.PacketReceivedEventArgs
return void

AgentWearablesUpdateHandler() protected method

protected AgentWearablesUpdateHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object
e OpenMetaverse.PacketReceivedEventArgs
return void

AppearanceManager() public method

Default constructor
public AppearanceManager ( GridClient client ) : System
client GridClient A reference to our agent
return System

Attach() public method

Attach an item to our agent at a specific attach point
public Attach ( InventoryItem item, AttachmentPoint attachPoint ) : void
item InventoryItem A to attach
attachPoint AttachmentPoint the on the avatar /// to attach the item to
return void

Attach() public method

Attach an item to our agent specifying attachment details
public Attach ( UUID itemID, UUID ownerID, string name, string description, Permissions perms, uint itemFlags, AttachmentPoint attachPoint ) : void
itemID UUID The of the item to attach
ownerID UUID The attachments owner
name string The name of the attachment
description string The description of the attahment
perms Permissions The to apply when attached
itemFlags uint The of the attachment
attachPoint AttachmentPoint The on the agent /// to attach the item to
return void

BakeTypeToAgentTextureIndex() public static method

Converts a BakeType to the corresponding baked texture slot in AvatarTextureIndex
public static BakeTypeToAgentTextureIndex ( BakeType index ) : AvatarTextureIndex
index BakeType A BakeType
return AvatarTextureIndex

BakeTypeToTextures() public static method

Converts a BakeType to a list of the texture slots that make up that bake
public static BakeTypeToTextures ( BakeType bakeType ) : List
bakeType BakeType A BakeType
return List

Detach() public method

Detach an item from our agent using an OpenMetaverse.InventoryItem object
public Detach ( InventoryItem item ) : void
item InventoryItem An object
return void

Detach() public method

Detach an item from our agent
public Detach ( UUID itemID ) : void
itemID UUID The inventory itemID of the item to detach
return void

GetWearableAsset() public method

Returns the AssetID of the asset that is currently being worn in a given WearableType slot
public GetWearableAsset ( WearableType type ) : UUID
type WearableType WearableType slot to get the AssetID for
return UUID

GetWearables() public method

Returns a copy of the agents currently worn wearables
Avoid calling this function multiple times as it will make a copy of all of the wearable data each time
public GetWearables ( ) : WearableData>.Dictionary
return WearableData>.Dictionary

IsItemWorn() public method

Checks if an inventory item is currently being worn
public IsItemWorn ( InventoryItem item ) : WearableType
item InventoryItem The inventory item to check against the agent /// wearables
return WearableType

MorphLayerForBakeType() public static method

Gives the layer number that is used for morph mask
public static MorphLayerForBakeType ( BakeType bakeType ) : AvatarTextureIndex
bakeType BakeType >A BakeType
return AvatarTextureIndex

OnAgentCachedBakes() protected method

Raises the CachedBakesReply event
protected OnAgentCachedBakes ( AgentCachedBakesReplyEventArgs e ) : void
e AgentCachedBakesReplyEventArgs An AgentCachedBakesReplyEventArgs object containing the /// data returned from the data server AgentCachedTextureResponse
return void

OnAgentWearables() protected method

Raises the AgentWearablesReply event
protected OnAgentWearables ( AgentWearablesReplyEventArgs e ) : void
e AgentWearablesReplyEventArgs An AgentWearablesReplyEventArgs object containing the /// data returned from the data server
return void

OnAppearanceSet() protected method

Raises the AppearanceSet event
protected OnAppearanceSet ( AppearanceSetEventArgs e ) : void
e AppearanceSetEventArgs An AppearanceSetEventArgs object indicating if the operatin was successfull
return void

OnRebakeAvatar() protected method

Raises the RebakeAvatarRequested event
protected OnRebakeAvatar ( RebakeAvatarTexturesEventArgs e ) : void
e RebakeAvatarTexturesEventArgs An RebakeAvatarTexturesEventArgs object containing the /// data returned from the data server
return void

RebakeAvatarTexturesHandler() protected method

protected RebakeAvatarTexturesHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object
e OpenMetaverse.PacketReceivedEventArgs
return void

RemoveFromOutfit() public method

Remove a wearable from the current outfit and set appearance
public RemoveFromOutfit ( InventoryItem wearableItem ) : void
wearableItem InventoryItem Wearable to be removed from the outfit
return void

RemoveFromOutfit() public method

Removes a list of wearables from the current outfit and set appearance
public RemoveFromOutfit ( List wearableItems ) : void
wearableItems List List of wearable inventory items to /// be removed from the outfit
return void

ReplaceOutfit() public method

Replace the current outfit with a list of wearables and set appearance
public ReplaceOutfit ( List wearableItems ) : void
wearableItems List List of wearable inventory items that /// define a new outfit
return void

RequestAgentWearables() public method

Ask the server what textures our agent is currently wearing
public RequestAgentWearables ( ) : void
return void

RequestCachedBakes() public method

Build hashes out of the texture assetIDs for each baking layer to ask the simulator whether it has cached copies of each baked texture
public RequestCachedBakes ( ) : void
return void

RequestSetAppearance() public method

Starts the appearance setting thread
public RequestSetAppearance ( ) : void
return void

RequestSetAppearance() public method

Starts the appearance setting thread
public RequestSetAppearance ( bool forceRebake ) : void
forceRebake bool True to force rebaking, otherwise false
return void

WearOutfit() public method

Calls either ReplaceOutfit or AddToOutfit depending on the value of replaceItems
public WearOutfit ( List wearables, bool replaceItems ) : void
wearables List List of wearable inventory items to add /// to the outfit or become a new outfit
replaceItems bool True to replace existing items with the /// new list of items, false to add these items to the existing outfit
return void

WearableTypeToAssetType() public static method

Converts a WearableType to a bodypart or clothing WearableType
public static WearableTypeToAssetType ( WearableType type ) : AssetType
type WearableType A WearableType
return AssetType

Property Details

BAKED_TEXTURE_HASH public_oe static_oe property

Magic values to finalize the cache check hashes for each bake
public static UUID[] BAKED_TEXTURE_HASH
return UUID[]

BakeIndexToTextureIndex public_oe static_oe property

Mapping between BakeType and AvatarTextureIndex
public static byte[] BakeIndexToTextureIndex
return byte[]

DEFAULT_AVATAR_TEXTURE public_oe static_oe property

Default avatar texture, used to detect when a custom texture is not set for a face
public static UUID DEFAULT_AVATAR_TEXTURE
return UUID

WEARABLE_BAKE_MAP public_oe static_oe property

Map of what wearables are included in each bake
public static WearableType[][] WEARABLE_BAKE_MAP
return WearableType[][]