mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 22:11:38 +00:00
rules
This commit is contained in:
parent
a9b4f8e83b
commit
e6efc04756
8494 changed files with 495610 additions and 0 deletions
|
|
@ -0,0 +1,979 @@
|
|||
# This file is automatically generated. Please don't edit it manually.
|
||||
# To submit a bug report on the content, see
|
||||
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
|
||||
|
||||
name: AvatarCreationService
|
||||
type: class
|
||||
memory_category: Instances
|
||||
summary: |
|
||||
A service to support developer avatar creators.
|
||||
description: |
|
||||
`AvatarCreationService` is a service that supports developer avatar creators,
|
||||
providing methods that support the prompting of avatar creation from within
|
||||
experiences.
|
||||
code_samples: []
|
||||
inherits:
|
||||
- Instance
|
||||
descendants: []
|
||||
tags:
|
||||
- NotCreatable
|
||||
- Service
|
||||
deprecation_message: ''
|
||||
properties: []
|
||||
methods:
|
||||
- name: AvatarCreationService:AutoSetupAvatarAsync
|
||||
summary: |
|
||||
Automatically sets up a custom `Class.Model` as an avatar asset.
|
||||
description: |
|
||||
Automatically sets up a custom `Class.Model` as an avatar asset. This
|
||||
method returns a `string` generation ID which can be passed to
|
||||
`Class.AvatarCreationService:LoadGeneratedAvatarAsync()|LoadGeneratedAvatarAsync()`
|
||||
to load the generated avatar and return a `Class.HumanoidDescription` with
|
||||
all the generated instances and properties. The load method can be called
|
||||
on both the server and client, allowing the generated avatar to be loaded
|
||||
in both places (on the client for previewing, and on the server for saving
|
||||
the generated avatar to the player's inventory using
|
||||
`Class.AvatarCreationService:PromptCreateAvatarAsync()|PromptCreateAvatarAsync()`).
|
||||
|
||||
Auto-setup has specific model requirements and accepts certain
|
||||
configurations of models. For more information, see
|
||||
[Auto-setup requirements](../../../avatar-setup/auto-setup-requirements.md).
|
||||
In addition to the above requirements, the input model must use
|
||||
`Class.EditableMesh` and `Class.EditableImage` objects for all mesh and
|
||||
texture assets.
|
||||
code_samples:
|
||||
- AvatarCreationService-AutoSetupAvatarAsync
|
||||
parameters:
|
||||
- name: player
|
||||
type: Player
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Player` that the avatar is being set up for.
|
||||
- name: model
|
||||
type: Dictionary
|
||||
default:
|
||||
summary: |
|
||||
The humanoid `Class.Model` that will be set up as an avatar.
|
||||
- name: progressCallback
|
||||
type: Function?
|
||||
default:
|
||||
summary: |
|
||||
Optional callback function that will be invoked periodically with a
|
||||
progressInfo table with the overall progress (from 0 to 1). Type:
|
||||
`(progressInfo: { Progress: number }) -> ()`
|
||||
returns:
|
||||
- type: string
|
||||
summary: |
|
||||
A unique identifier for the generated avatar.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:GenerateAvatar2DPreviewAsync
|
||||
summary: |
|
||||
Creates a 2D avatar preview and returns a previewId.
|
||||
description: |
|
||||
Creates a 2D avatar image preview, taking as input the FileId from
|
||||
`Class.AvatarCreationService:PromptSelectAvatarGenerationImageAsync()|PromptSelectAvatarGenerationImageAsync()`
|
||||
and an optional text prompt. It returns a previewId which can be passed to
|
||||
`Class.AvatarCreationService:LoadAvatar2DPreviewAsync()|LoadAvatar2DPreviewAsync()`
|
||||
to retrieve the preview image on the client. This API can only be used on
|
||||
the game server.
|
||||
|
||||
```lua
|
||||
local AvatarCreationService = game:GetService("AvatarCreationService")
|
||||
|
||||
function generateAvatar2DPreview(sessionId, fileId, textPrompt)
|
||||
local pcallSuccess, result = pcall(function()
|
||||
local args = {}
|
||||
args.SessionId = sessionId
|
||||
args.FileId = fileId
|
||||
args.TextPrompt = textPrompt
|
||||
return AvatarCreationService:GenerateAvatar2DPreview(args)
|
||||
end)
|
||||
|
||||
if not pcallSuccess then
|
||||
warn("Generating 2D preview failed: ", result)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
```
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: avatarGeneration2dPreviewParams
|
||||
type: Dictionary
|
||||
default:
|
||||
summary: |
|
||||
A table of arguments for 2D preview generation. Type:
|
||||
`avatarGeneration2dPreviewParams: {SessionId: string, FileId: string, TextPrompt: string?}`
|
||||
returns:
|
||||
- type: string
|
||||
summary: |
|
||||
A string previewId
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:GenerateAvatarAsync
|
||||
summary: |
|
||||
Generates an avatar and returns a generationId.
|
||||
description: |
|
||||
Generate an avatar from a preview and return the generationId. The
|
||||
`Class.AvatarCreationService:LoadGeneratedAvatarAsync()|LoadGeneratedAvatarAsync()`
|
||||
method is then called to retrieve the generated
|
||||
`Class.HumanoidDescription` avatar. This API can only be used on the game
|
||||
server.
|
||||
|
||||
```lua
|
||||
local AvatarCreationService = game:GetService("AvatarCreationService")
|
||||
|
||||
function generateAvatar(sessionId, previewId)
|
||||
local pcallSuccess, result = pcall(function()
|
||||
local args = {}
|
||||
args.SessionId = sessionId
|
||||
args.PreviewId = previewId
|
||||
return AvatarCreationService:GenerateAvatarAsync(args)
|
||||
end)
|
||||
|
||||
if not pcallSuccess then
|
||||
warn("Generating avatar failed: ", result)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
```
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: avatarGenerationParams
|
||||
type: Dictionary
|
||||
default:
|
||||
summary: |
|
||||
A table of arguments for generating an avatar. Type:
|
||||
`avatarGenerationParams: {SessionId: string, PreviewId: string}`
|
||||
returns:
|
||||
- type: string
|
||||
summary: |
|
||||
A string generationId.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:GetBatchTokenDetailsAsync
|
||||
summary: |
|
||||
Gets the avatar creation token details for a list of avatar creation
|
||||
tokens at once.
|
||||
description: |
|
||||
Gets the avatar creation token details for a list of avatar creation
|
||||
tokens at once (tokens are generated through the
|
||||
[token creation](../../../production/monetization/avatar-creation-token.md)
|
||||
process). Returns an array of avatar creation token details; each token
|
||||
detail is a dictionary with the fields indicated in the example result
|
||||
below:
|
||||
|
||||
```lua
|
||||
{
|
||||
["Name"] = "string",
|
||||
["Description"] = "string",
|
||||
["UniverseId"] = 0,
|
||||
["CreatorId"] = 0,
|
||||
["CreatorType"] = Enum.CreatorType.User,
|
||||
["OnSale"] = true,
|
||||
["Price"] = 0,
|
||||
["OffSaleReasons"] = {
|
||||
"string",
|
||||
}
|
||||
}
|
||||
```
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: tokenIds
|
||||
type: Array
|
||||
default:
|
||||
summary: |
|
||||
The list of avatar creation token IDs to get details of.
|
||||
returns:
|
||||
- type: Array
|
||||
summary: |
|
||||
Array of avatar creation token details as outlined above.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:GetValidationRules
|
||||
summary: |
|
||||
Gets data regarding rules that assets must abide by to pass UGC
|
||||
validation.
|
||||
description: |
|
||||
Gets data regarding rules that assets must abide by to pass UGC
|
||||
validation. Validation is an essential step before creating avatars and
|
||||
there are various checks that occur, including mesh triangle limits,
|
||||
texture sizes, body part size limits, attachment positions, and more.
|
||||
|
||||
The returned dictionary of validation rules takes the following form:
|
||||
|
||||
```
|
||||
{
|
||||
["MeshRules"] = {
|
||||
["BodyPartMaxTriangles"] = {
|
||||
Enum.AssetType.DynamicHead: number,
|
||||
Enum.AssetType.LeftArm: number,
|
||||
Enum.AssetType.RightArm: number,
|
||||
Enum.AssetType.Torso: number,
|
||||
Enum.AssetType.LeftLeg: number,
|
||||
Enum.AssetType.RightLeg: number,
|
||||
},
|
||||
["AccessoryMaxTriangles"]: number,
|
||||
["MeshVertColor"]: Color3,
|
||||
["CageMeshMaxDistanceFromRenderMesh"]: number,
|
||||
},
|
||||
["TextureRules"] = {
|
||||
["MaxTextureSize"]: number,
|
||||
},
|
||||
["BodyPartRules"] = {
|
||||
[Enum.AssetType.DynamicHead] = {
|
||||
["Bounds"] = {
|
||||
["Classic"] = {
|
||||
["MinSize"]: Vector3,
|
||||
["MaxSize"]: Vector3,
|
||||
},
|
||||
["ProportionsSlender"] = {
|
||||
["MinSize"]: Vector3,
|
||||
["MaxSize"]: Vector3,
|
||||
},
|
||||
["ProportionsNormal"] = {
|
||||
["MinSize"]: Vector3,
|
||||
["MaxSize"]: Vector3,
|
||||
},
|
||||
},
|
||||
["SubParts"] = {
|
||||
["Head"] = {
|
||||
["NeckRigAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
["FaceFrontAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
["HatAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
["HairAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
["FaceCenterAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
[Enum.AssetType.LeftArm] = {
|
||||
["Bounds"] = {
|
||||
["Classic"] = {
|
||||
["MinSize"]: Vector3,
|
||||
["MaxSize"]: Vector3,
|
||||
},
|
||||
["ProportionsSlender"] = {
|
||||
["MinSize"]: Vector3,
|
||||
["MaxSize"]: Vector3,
|
||||
},
|
||||
["ProportionsNormal"] = {
|
||||
["MinSize"]: Vector3,
|
||||
["MaxSize"]: Vector3,
|
||||
},
|
||||
},
|
||||
["SubParts"] = {
|
||||
["LeftHand"] = {
|
||||
["LeftWristRigAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
["LeftGripAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
},
|
||||
["LeftUpperArm"] = {
|
||||
["LeftShoulderRigAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
["LeftShoulderAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
["LeftElbowRigAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
},
|
||||
["LeftLowerArm"] = {
|
||||
["LeftElbowRigAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
["LeftWristRigAttachment"] = {
|
||||
["LowerBound"]: Vector3,
|
||||
["UpperBound"]: Vector3,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
...
|
||||
},
|
||||
["AccessoryRules"] = {
|
||||
[Enum.AssetType.HairAccessory] = {
|
||||
["Attachments"] = {
|
||||
{
|
||||
["Size"]: Vector3,
|
||||
["Offset"]: Vector3,
|
||||
["Name"]: string,
|
||||
},
|
||||
},
|
||||
["RigidAllowed"]: boolean,
|
||||
},
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
code_samples: []
|
||||
parameters: []
|
||||
returns:
|
||||
- type: Dictionary
|
||||
summary: |
|
||||
Dictionary of validation rules as detailed above.
|
||||
tags:
|
||||
- CustomLuaState
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:LoadAvatar2DPreviewAsync
|
||||
summary: |
|
||||
Load an AvatarGeneration 2D preview on the client from a previewId.
|
||||
description: |
|
||||
Load an AvatarGeneration 2D preview as an `Class.EditableImage` on the
|
||||
client for the given previewId. This API can only be used on the client.
|
||||
|
||||
```lua
|
||||
local AvatarCreationService = game:GetService("AvatarCreationService")
|
||||
|
||||
function loadAvatar2DPreview(previewId)
|
||||
local pcallSuccess, result = pcall(function()
|
||||
return AvatarCreationService:LoadAvatar2DPreviewAsync(previewId)
|
||||
end)
|
||||
|
||||
if not pcallSuccess then
|
||||
warn("Failed to load preview: ", result)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
```
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: previewId
|
||||
type: string
|
||||
default:
|
||||
summary: |
|
||||
Load the preview generated from
|
||||
`Class.AvatarCreationService:GenerateAvatar2DPreviewAsync()|GenerateAvatar2DPreviewAsync()`.
|
||||
returns:
|
||||
- type: EditableImage
|
||||
summary: |
|
||||
An `Class.EditableImage` containing the preview image.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:LoadGeneratedAvatarAsync
|
||||
summary: |
|
||||
Loads a generated avatar using an avatar generation ID.
|
||||
description: |
|
||||
Loads a generated avatar using an avatar generation ID, as returned by
|
||||
`Class.AvatarCreationService:AutoSetupAvatarAsync()|AutoSetupAvatarAsync()`
|
||||
or
|
||||
`Class.AvatarCreationService:GenerateAvatarAsync()|GenerateAvatarAsync()`.
|
||||
The generated avatar will be returned as a `Class.HumanoidDescription`
|
||||
with all the generated instances and properties. Mesh and texture assets
|
||||
will be provided as `Class.EditableMesh` and `Class.EditableImage`
|
||||
objects, respectively, to allow continued editing of the generated avatar.
|
||||
|
||||
This method can be called on both the server and client, allowing the
|
||||
generated avatar to be loaded in both places (on the client for
|
||||
previewing, and on the server for saving the generated avatar to the
|
||||
player's inventory using
|
||||
`Class.AvatarCreationService:PromptCreateAvatarAsync()|PromptCreateAvatarAsync()`).
|
||||
Once the method has been invoked on both the client and server, the data
|
||||
associated with the generation ID will be erased and subsequent calls to
|
||||
his method with the same generation ID will fail.
|
||||
code_samples:
|
||||
- AvatarCreationService-LoadGeneratedAvatarAsync
|
||||
parameters:
|
||||
- name: generationId
|
||||
type: string
|
||||
default:
|
||||
summary: |
|
||||
A unique string that identifies the generated avatar, as returned by
|
||||
`Class.AvatarCreationService:AutoSetupAvatarAsync()| AutoSetupAvatarAsync()`.
|
||||
returns:
|
||||
- type: HumanoidDescription
|
||||
summary: |
|
||||
The `Class.HumanoidDescription` of the generated avatar, which
|
||||
includes all the generated instances and properties.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:PrepareAvatarForPreviewAsync
|
||||
summary: |
|
||||
Prepares in-experience avatar for preview.
|
||||
description: |
|
||||
Triggers HSR generation and attachment point updating for in-experience
|
||||
avatar previews. This allows for previewing of avatars created in
|
||||
experience with layered clothing and accessories in the same way they will
|
||||
appear when published through
|
||||
`Class.AvatarCreationService:PromptCreateAvatarAsync()|PromptCreateAvatarAsync()`.
|
||||
|
||||
When developers use `Class.EditableMesh` and `Class.WrapDeformer` to
|
||||
modify avatars before publishing, the original HSR data may not accurately
|
||||
account for the new deformations. This method generates updated HSR data
|
||||
and corrects attachment points based on the `Class.WrapDeformer`
|
||||
modifications, ensuring consistent preview and published avatar
|
||||
appearance.
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: humanoidModel
|
||||
type: Model
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Model` containing `Class.MeshPart` children with
|
||||
`Class.WrapDeformer` instances that require HSR data updating for
|
||||
preview.
|
||||
returns:
|
||||
- type: ()
|
||||
summary: ''
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:PromptCreateAvatarAssetAsync
|
||||
summary: |
|
||||
Prompts a `Class.Player` to purchase and create an avatar asset from an
|
||||
`Class.Instance`.
|
||||
description: |
|
||||
Prompts a `Class.Player` to purchase and create an avatar asset from an
|
||||
`Class.Instance`. The price of the creation is dictated by the price
|
||||
attributed to the avatar creation token. This creation token is required
|
||||
for the purchasing and creation of the asset and can be generated by
|
||||
following the
|
||||
[token creation](../../../production/monetization/avatar-creation-token.md)
|
||||
process.
|
||||
|
||||
For avatar asset creation, the `Class.Instance` is expected to include a
|
||||
new accessory to be created. This includes the following types:
|
||||
`Enum.AvatarAssetType.Hat|Hat`, `Enum.AvatarAssetType.HairAccessory|Hair`,
|
||||
`Enum.AvatarAssetType.FaceAccessory|FaceAccessory`,
|
||||
`Enum.AvatarAssetType.NeckAccessory|NeckAccessory`,
|
||||
`Enum.AvatarAssetType.ShoulderAccessory|ShoulderAccessory`,
|
||||
`Enum.AvatarAssetType.FrontAccessory|FrontAccessory`,
|
||||
`Enum.AvatarAssetType.BackAccessory|BackAccessory`,
|
||||
`Enum.AvatarAssetType.WaistAccessory|WaistAccessory`,
|
||||
`Enum.AvatarAssetType.TShirtAccessory|TShirtAccessory`,
|
||||
`Enum.AvatarAssetType.ShirtAccessory|ShirtAccessory`,
|
||||
`Enum.AvatarAssetType.PantsAccessory|PantsAccessory`,
|
||||
`Enum.AvatarAssetType.JacketAccessory|JacketAccessory`,
|
||||
`Enum.AvatarAssetType.SweaterAccessory|SweaterAccessory`,
|
||||
`Enum.AvatarAssetType.ShortsAccessory|ShortsAccessory`,
|
||||
`Enum.AvatarAssetType.DressSkirtAccessory|DressSkirtAccessory`.
|
||||
|
||||
To support this, the `Class.Instance` should be an `Class.Accessory`
|
||||
instance or contain an `Class.Accessory` child instance. This should
|
||||
include a `Class.MeshPart` child instance which makes up the accessory.
|
||||
|
||||
The avatar asset `Class.MeshPart` will also need to include:
|
||||
|
||||
- An `Class.EditableImage`.
|
||||
- An `Class.EditableMesh`.
|
||||
|
||||
If creating a layered clothing accessory such as a shirt, the
|
||||
`Class.MeshPart` should include a `Class.WrapDeformer` with an
|
||||
`Class.EditableMesh`.
|
||||
|
||||
Finally, the provided `Enum.AvatarAssetType` should match the creation
|
||||
type of the token and the type of `Class.Accessory` for upload.
|
||||
code_samples:
|
||||
- AvatarCreationService-PromptCreateAvatarAssetAsync
|
||||
parameters:
|
||||
- name: tokenId
|
||||
type: string
|
||||
default:
|
||||
summary: |
|
||||
The ID of a creation token. The token must be valid in that the
|
||||
universe the method is called from is the same universe the token was
|
||||
created for. Furthermore, the token creator must maintain ID
|
||||
verification and
|
||||
[Roblox Premium](https://www.roblox.com/premium/membership). To create
|
||||
a token for utilization in this API, follow the
|
||||
[token creation](../../../production/monetization/avatar-creation-token.md)
|
||||
process. The token's creation type must match the
|
||||
`Enum.AvatarAssetType` passed in to the method.
|
||||
- name: player
|
||||
type: Player
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Player` intended to be presented with the creation prompt.
|
||||
- name: assetInstance
|
||||
type: Instance
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Instance` of the avatar asset intended for creation.
|
||||
- name: assetType
|
||||
type: AvatarAssetType
|
||||
default:
|
||||
summary: |
|
||||
The `Enum.AvatarAssetType` of the expected creation. This must match
|
||||
the creation type of the provided token.
|
||||
returns:
|
||||
- type: Tuple
|
||||
summary: |
|
||||
A tuple containing, in order:
|
||||
|
||||
- An `Enum.PromptCreateAssetResult` indicating the result of the
|
||||
creation prompt.
|
||||
|
||||
- A string result. In the case of
|
||||
`Enum.PromptCreateAssetResult.Success`, this will indicate the asset
|
||||
ID. In the case of any failure enum, this will indicate the
|
||||
resultant error message.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:PromptCreateAvatarAsync
|
||||
summary: |
|
||||
Prompts a `Class.Player` to purchase and create an avatar from a
|
||||
`Class.HumanoidDescription`.
|
||||
description: |
|
||||
Prompts a `Class.Player` to purchase and create an avatar from a
|
||||
`Class.HumanoidDescription`. The price of the creation is dictated by the
|
||||
price attributed to the avatar creation token. This avatar creation token
|
||||
is required for the purchasing and creation of the body and can be
|
||||
generated by following the
|
||||
[token creation](../../../production/monetization/avatar-creation-token.md)
|
||||
process.
|
||||
|
||||
For avatar creation, the `Class.HumanoidDescription` is expected to
|
||||
include new assets to be created for each of the 6 body parts
|
||||
(`Enum.BodyPart.Head|Head`, `Enum.BodyPart.Torso|Torso`,
|
||||
`Enum.BodyPart.RightLeg|RightLeg`, `Enum.BodyPart.LeftLeg|LeftLeg`,
|
||||
`Enum.BodyPart.RightArm|RightArm`, `Enum.BodyPart.LeftArm|LeftArm`).
|
||||
Optionally, it can also include a new `Enum.AccessoryType.Hair|Hair`
|
||||
accessory.
|
||||
|
||||
To support this, the `Class.HumanoidDescription` should include 6
|
||||
`Class.BodyPartDescription` children (one for each body part). For each,
|
||||
the `Class.BodyPartDescription.Instance` property references a
|
||||
`Class.Folder` which includes all of the `Class.MeshPart` instances which
|
||||
make up the body part, for example a `LeftArm` folder which has
|
||||
`LeftHand`, `LeftUpperArm`, and `LeftLowerArm` `Class.MeshPart|MeshParts`.
|
||||
The `Class.BodyPartDescription.BodyPart` property should also be set to
|
||||
the relevant `Enum.BodyPart`.
|
||||
|
||||
Each body part `Class.MeshPart` will also need to include:
|
||||
|
||||
- An `Class.EditableImage`.
|
||||
- A `Class.WrapDeformer` with an `Class.EditableMesh`.
|
||||
|
||||
If including an accessory such as hair, the `Class.HumanoidDescription`
|
||||
should include a child `Class.AccessoryDescription` where:
|
||||
|
||||
- The `Class.AccessoryDescription.Instance` property references the
|
||||
`Class.Accessory` instance.
|
||||
- The `Class.AccessoryDescription.AccessoryType` property is set to the
|
||||
relevant `Enum.AccessoryType`.
|
||||
|
||||
Finally, the `Class.HumanoidDescription` should include the humanoid
|
||||
scales of `Class.HumanoidDescription.BodyTypeScale|BodyTypeScale`,
|
||||
`Class.HumanoidDescription.HeadScale|HeadScale`,
|
||||
`Class.HumanoidDescription.HeightScale|HeightScale`,
|
||||
`Class.HumanoidDescription.WidthScale|WidthScale`, and
|
||||
`Class.HumanoidDescription.ProportionScale|ProportionScale`. Be mindful of
|
||||
the scales that a base body is imported with so that they match the scales
|
||||
provided to the `Class.HumanoidDescription`.
|
||||
code_samples:
|
||||
- AvatarCreationService-PromptCreateAvatarAsync
|
||||
parameters:
|
||||
- name: tokenId
|
||||
type: string
|
||||
default:
|
||||
summary: |
|
||||
The ID of an avatar creation token. The token must be valid in that
|
||||
the universe the method is called from is the same universe the token
|
||||
was created for. Furthermore, the token creator must maintain ID
|
||||
verification and
|
||||
[Roblox Premium](https://www.roblox.com/premium/membership). To create
|
||||
a token for utilization in this API, follow the
|
||||
[token creation](../../../production/monetization/avatar-creation-token.md)
|
||||
process.
|
||||
- name: player
|
||||
type: Player
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Player` intended to be presented with the creation prompt.
|
||||
- name: humanoidDescription
|
||||
type: HumanoidDescription
|
||||
default:
|
||||
summary: |
|
||||
The `Class.HumanoidDescription` of the avatar intended for creation.
|
||||
returns:
|
||||
- type: Tuple
|
||||
summary: |
|
||||
A tuple containing, in order:
|
||||
|
||||
- An `Enum.PromptCreateAvatarResult` indicating the result of the
|
||||
creation prompt.
|
||||
|
||||
- A string result. In the case of
|
||||
`Enum.PromptCreateAvatarResult.Success`, this will indicate the
|
||||
bundle ID. In the case of any failure enum, this will indicate the
|
||||
resultant error message.
|
||||
|
||||
- A secondary optional string result. In the case of
|
||||
`Enum.PromptCreateAvatarResult.Success`, this will indicate the
|
||||
outfit ID. In the case of any failure enum, this will be `nil`.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:PromptSelectAvatarGenerationImageAsync
|
||||
summary: |
|
||||
Prompt the `Class.Player` to take a selfie and return the FileId.
|
||||
description: |
|
||||
Prompt the `Class.Player` to take a selfie and return the FileId of the
|
||||
selfie. This FileId is then passed as an argument to
|
||||
`Class.AvatarCreationService:GenerateAvatar2DPreviewAsync()|GenerateAvatar2DPreviewAsync()`.
|
||||
This API can only be used on the game server.
|
||||
|
||||
```lua
|
||||
local AvatarCreationService = game:GetService("AvatarCreationService")
|
||||
|
||||
function promptSelectAvatarGenerationImage(player)
|
||||
local pcallSuccess, result = pcall(function()
|
||||
return AvatarCreationService:PromptSelectAvatarGenerationImageAsync(player)
|
||||
end)
|
||||
|
||||
if not pcallSuccess then
|
||||
warn("Failed to prompt for image: ", result)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
```
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: player
|
||||
type: Player
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Player` to prompt for taking a selfie.
|
||||
returns:
|
||||
- type: string
|
||||
summary: |
|
||||
A string FileId of the selfie.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:RequestAvatarGenerationSessionAsync
|
||||
summary: |
|
||||
Request an AvatarGeneration session for a `Class.Player`.
|
||||
description: |
|
||||
Request an AvatarGeneration session for a `Class.Player`. Information
|
||||
about the session is returned via the callback, including the SessionId
|
||||
which is passed to the
|
||||
`Class.AvatarCreationService:GenerateAvatar2DPreviewAsync()|GenerateAvatar2DPreviewAsync()`
|
||||
and
|
||||
`Class.AvatarCreationService:GenerateAvatarAsync()|GenerateAvatarAsync()`
|
||||
methods. Additional session information includes allowed 2d preview
|
||||
generations, allowed 3d avatar generations, and the session time. The
|
||||
method returns a `Tuple` with an `Datatype.RBXScriptConnection` and
|
||||
estimated `waitTime`. The `Datatype.RBXScriptConnection` allows canceling
|
||||
a session request. The estimated `waitTime` is used to provide the player
|
||||
an estimated time in seconds until the session will be ready. This API can
|
||||
only be used on the game server.
|
||||
|
||||
```lua
|
||||
local AvatarCreationService = game:GetService("AvatarCreationService")
|
||||
local playerSessions = {}
|
||||
local playerSessionRequests = {}
|
||||
|
||||
function requestAvatarGenerationSession(player)
|
||||
local pcallSuccess, conn, waitTime = pcall(function()
|
||||
return AvatarCreationService:RequestAvatarGenerationSessionAsync(player, function(sessionInfo)
|
||||
playerSessions[player.UserID] = sessionInfo
|
||||
playerSessionRequests[player.UserID] = nil
|
||||
end)
|
||||
end)
|
||||
|
||||
if not pcallSuccess then
|
||||
warn("Failed to request Avatar generation session: ", conn)
|
||||
end
|
||||
|
||||
playerSessionRequests[player.UserID] = conn
|
||||
print("Wait time for session: ", tostring(waitTime))
|
||||
end
|
||||
|
||||
function cancelAvatarGenerationSessionRequest(player)
|
||||
if playerSessionRequests[player.UserID] ~= nil then
|
||||
playerSessionRequests[player.UserID]:Disconnect()
|
||||
end
|
||||
end
|
||||
```
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: player
|
||||
type: Player
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Player` to request an AvatarGeneration session for.
|
||||
- name: callback
|
||||
type: Function
|
||||
default:
|
||||
summary: |
|
||||
Callback function that is invoked with a SessionInfo table, with
|
||||
information about the session. Type:
|
||||
`(SessionInfo: { SessionId: string, Allowed2DGenerations: number, Allowed3DGenerations: number, SessionTime: number }) -> ()`
|
||||
returns:
|
||||
- type: Tuple
|
||||
summary: |
|
||||
A tuple containing a `Datatype.RBXScriptConnection` that can be used
|
||||
to cancel the session request and the estimated wait time in seconds.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:ValidateUGCAccessoryAsync
|
||||
summary: |
|
||||
Studio only. Runs UGC validation for an `Enum.AccessoryType`.
|
||||
description: |
|
||||
Studio only. Given a `Class.Player` and `Class.Instance` for an
|
||||
`Enum.AccessoryType`, determines if UGC validation passes.
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: player
|
||||
type: Player
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Player` validation is completed for.
|
||||
- name: accessory
|
||||
type: Instance
|
||||
default:
|
||||
summary: |
|
||||
The instance validation is run on.
|
||||
- name: accessoryType
|
||||
type: AccessoryType
|
||||
default:
|
||||
summary: |
|
||||
`Enum.AccessoryType` the instance is expected to be. Expects
|
||||
`Enum.AccessoryType.Eyebrow|Eyebrow`,
|
||||
`Enum.AccessoryType.Eyelash|Eyelash`, or
|
||||
`Enum.AccessoryType.Hair|Hair`.
|
||||
returns:
|
||||
- type: Tuple
|
||||
summary: |
|
||||
A tuple containing, in order:
|
||||
|
||||
- A boolean indicating if validation was successful for the accessory.
|
||||
- An optional table of strings. This includes failure reasons if
|
||||
validation was unsuccessful; otherwise `nil` if validation was
|
||||
successful.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:ValidateUGCBodyPartAsync
|
||||
summary: |
|
||||
Studio only. Runs UGC validation for an `Enum.BodyPart`.
|
||||
description: |
|
||||
Studio only. Given a `Class.Player` and `Class.Instance` for an
|
||||
`Enum.BodyPart`, determines if UGC validation passes. The `instance`
|
||||
parameter is expected as a `Class.Folder` in the following example format
|
||||
with relevant `Class.MeshPart|MeshParts`:
|
||||
|
||||
- `LeftArm` (`Class.Folder`)
|
||||
- `R15ArtistIntent` (`Class.Folder`)
|
||||
- `LeftLowerArm` (`Class.MeshPart`)
|
||||
- `LeftUpperArm` (`Class.MeshPart`)
|
||||
- `LeftHand` (`Class.MeshPart`)
|
||||
|
||||
However, if the expected `bodyPart` is `Enum.BodyPart.Head`, the function
|
||||
takes a singular `Head` `Class.MeshPart` directly.
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: player
|
||||
type: Player
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Player` validation is completed for.
|
||||
- name: instance
|
||||
type: Instance
|
||||
default:
|
||||
summary: |
|
||||
The instance validation is run on.
|
||||
- name: bodyPart
|
||||
type: BodyPart
|
||||
default:
|
||||
summary: |
|
||||
`Enum.BodyPart` the instance is expected to be.
|
||||
returns:
|
||||
- type: Tuple
|
||||
summary: |
|
||||
A tuple containing, in order:
|
||||
|
||||
- A boolean indicating if validation was successful for the body part.
|
||||
- An optional table of strings. This includes failure reasons if
|
||||
validation was unsuccessful; otherwise `nil` if validation was
|
||||
successful.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: AvatarCreationService:ValidateUGCFullBodyAsync
|
||||
summary: |
|
||||
Studio only. Runs UGC validation for a whole body.
|
||||
description: |
|
||||
Studio only. Given a `Class.Player` and `Class.HumanoidDescription`, all
|
||||
instances in the `Class.HumanoidDescription` will be validated.
|
||||
|
||||
The `Class.HumanoidDescription` is expected to include instances set on
|
||||
`Class.BodyPartDescription` children for each of the 6 required
|
||||
`Enum.BodyPart` values. Optionally, it can include instances set on
|
||||
`Class.AccessoryDescription` children for `Eyebrow`, `Eyelash`, and `Hair`
|
||||
`Enum.AccessoryType|AccessoryTypes`.
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: player
|
||||
type: Player
|
||||
default:
|
||||
summary: |
|
||||
The `Class.Player` validation is completed for.
|
||||
- name: humanoidDescription
|
||||
type: HumanoidDescription
|
||||
default:
|
||||
summary: |
|
||||
`Class.HumanoidDescription` representing the body that validation is
|
||||
run on.
|
||||
returns:
|
||||
- type: Tuple
|
||||
summary: |
|
||||
A tuple containing, in order:
|
||||
|
||||
- A boolean indicating if validation was successful for the body.
|
||||
- An optional table of strings. This includes failure reasons if
|
||||
validation was unsuccessful; otherwise `nil` if validation was
|
||||
successful.
|
||||
tags:
|
||||
- Yields
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
events:
|
||||
- name: AvatarCreationService.AvatarAssetModerationCompleted
|
||||
summary: |
|
||||
Fires when an in-experience-created avatar asset's moderation status has
|
||||
been updated from pending.
|
||||
description: |
|
||||
Fires when an in-experience-created avatar asset's moderation status has
|
||||
been updated from pending. This event provides a streamlined way to know
|
||||
when an avatar asset created through
|
||||
`Class.AvatarCreationService:PromptCreateAvatarAssetAsync()|PromptCreateAvatarAssetAsync()`
|
||||
has completed the moderation process and is ready for use in-experience.
|
||||
|
||||
Note that this event only fires for avatar assets created within the
|
||||
current experience and will trigger when the `Enum.ModerationStatus`
|
||||
changes from `Enum.ModerationStatus.NotReviewed|NotReviewed` to any other
|
||||
status. The event fires on the client only.
|
||||
code_samples:
|
||||
- AvatarCreationService-AvatarAssetModerationCompleted
|
||||
parameters:
|
||||
- name: assetId
|
||||
type: int64
|
||||
default:
|
||||
summary: |
|
||||
The asset ID of the asset that has completed moderation.
|
||||
- name: moderationStatus
|
||||
type: ModerationStatus
|
||||
default:
|
||||
summary: |
|
||||
The final `Enum.ModerationStatus` result after moderation completed.
|
||||
tags: []
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
capabilities: []
|
||||
- name: AvatarCreationService.AvatarModerationCompleted
|
||||
summary: |
|
||||
Fires when an in-experience-created avatar's moderation status has been
|
||||
updated from pending.
|
||||
description: |
|
||||
Fires when an in-experience-created avatar's moderation status has been
|
||||
updated from pending. This event provides a streamlined way to know when
|
||||
an avatar created through
|
||||
`Class.AvatarCreationService:PromptCreateAvatarAsync()|PromptCreateAvatarAsync()`
|
||||
has completed the moderation process and is ready for use in-experience.
|
||||
|
||||
Note that this event only fires for avatars created within the current
|
||||
experience and will trigger when the `Enum.ModerationStatus` changes from
|
||||
`Enum.ModerationStatus.NotReviewed|NotReviewed` to any other status. The
|
||||
event fires on the client only.
|
||||
`Class.AvatarEditorService:GetOutfitDetailsAsync|GetOutfitDetailsAsync`
|
||||
can be used on the server to verify the current moderation status if
|
||||
needed.
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: outfitId
|
||||
type: int64
|
||||
default:
|
||||
summary: |
|
||||
The outfit ID of the avatar that has completed moderation.
|
||||
- name: moderationStatus
|
||||
type: ModerationStatus
|
||||
default:
|
||||
summary: |
|
||||
The final `Enum.ModerationStatus` result after moderation completion.
|
||||
tags: []
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
capabilities: []
|
||||
callbacks: []
|
||||
Loading…
Add table
Add a link
Reference in a new issue