AvatarCreationService
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
AvatarCreationService は、開発者アバタークリエーターをサポートするサービスで、経験内からのアバター作成の促示をサポートする方法を提供します。
概要
方法
アセットがUGCの検証に合格するために遵守する必要がある規則に関するデータを取得します。
一度にアバター作成トークンのリストを取得し、アバター作成トークンの詳細を取得します。
- PromptCreateAvatarAsync(tokenId : string,player : Player,humanoidDescription : HumanoidDescription):Tuple
Player に購入してアバターを作成するように促すと、HumanoidDescription からアバターを購入して作成します。
- ValidateUGCAccessoryAsync(player : Player,accessory : Instance,accessoryType : Enum.AccessoryType):Tuple
スタジオのみ。UGC の検証を Enum.AccessoryType に実行します。
スタジオのみ。UGC の検証を Enum.BodyPart に実行します。
スタジオのみ。全ボディの UGC 検証を実行します。
イベント
- AvatarModerationCompleted(outfitId : number,moderationStatus : Enum.ModerationStatus):RBXScriptSignal
プロパティ
方法
GetValidationRules
アセットがUGCの検証に合格するために遵守する必要がある規則に関するデータを取得します。検証は、アバターを作成する前の必須のステップであり、メッシュトライアングル制限、テクスチャサイズ、ボディパーツサイズ制限、付属位置など、多くのチェックが発生します。
有効性規則の返された辞書の形式は次のようになります:
{["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,},...}}
戻り値
上記の詳細に示された有効性規則の辞書。
GetBatchTokenDetailsAsync
一度にアバター作成トークンのリストを取得し、アバター作成トークンの詳細を取得します (トークンは トークン作成プロセス を通じて生成されます)。アバター作成トークンの詳細のアレイを返し、各トークン詳細は以下の例の結果で指定されたフィールドを持つ辞書です:
{["Name"] = "string",["Description"] = "string",["UniverseId"] = 0,["CreatorId"] = 0,["CreatorType"] = Enum.CreatorType.User,["OnSale"] = true,["Price"] = 0,["OffSaleReasons"] = {"string",}}
パラメータ
詳細を取得するためのアバター作成トークン ID リスト。
戻り値
上記のようにアバター作成トークンの詳細のアレイ。
PromptCreateAvatarAsync
Player に購入してアバターを作成するように促すと、HumanoidDescription からアバターを購入して作成します。作成の価格は、アバター作成トークンに割り当てられた価格によって決まります。このアバター作成トークンは、ボディの購入と作成に必要であり、トークン作成プロセス に従って生成できます。
アバターの作作品では、HumanoidDescription は、6つの身体部分(Head、Torso、RightLeg、LeftLeg、RightArm、LeftArm)のそれぞれに作成される新しいアセットを含めることが期待されます。オプションで、新しい Hair アクセサリーも含めることができます。
これをサポートするために、HumanoidDescription は、6のBodyPartDescription (それぞれの身体部分の 1) を含める必要があります。それぞれについて、 プロパティは、体の部分を構成するすべての インスタンスを含む を参照します。たとえば、 フォルダに 、 、および が含まれています。BodyPartDescription.BodyPart プロパティも、関連する Enum.BodyPart に設定する必要があります。
各ボディパーツ MeshPart も含める必要があります:
- An EditableImage .
- A WrapDeformer に EditableMesh がある。
髪などのアクセサリーを含める場合、 には、次のような子を含める必要があります:
- The AccessoryDescription.Instance プロパティは、Accessory インスタンスを参照します。
- AccessoryDescription.AccessoryType プロパティは、関連する Enum.AccessoryType に設定されます。
最後に、HumanoidDescription は、BodyTypeScale、HeadScale、HeightScale、WidthScale、およびProportionScaleのヒューマノイドスケールを含むべきです。ベースボディがインポートされるスケールを注意して、HumanoidDescription に提供されたスケールと一致するようにしてください。
パラメータ
アバター作成トークンのID。トークンは、メソッドが呼ばれる宇宙がトークンが作成された宇宙と同じ宇宙であることによって有効でなければなりません。さらに、トークンクリエータは、ID の検証と Roblox Premium を維持する必要があります。この API で使用するトークンを作成するには、トークン作成プロセス に従ってください。
作品成する予定のアバターの HumanoidDescription。
戻り値
順に含まれるtuple:
作成プロンプトの結果を示す Enum.PromptCreateAvatarResult 。
ストリング結果。In the case of Enum.PromptCreateAvatarResult.Success , これはバンドル ID を示します。エラー枚挙の場合、これは結果のエラーメッセージを示します。
セカンダリオプション文字列の結果。In the case of Enum.PromptCreateAvatarResult.Success , これは衣装 ID を示します。エラー枚挙の場合、これは nil になります。
コードサンプル
The following code populates a HumanoidDescription in the expected format, prompts for avatar creation, and responds to the result.
local AvatarCreationService = game:GetService("AvatarCreationService")
export type BodyPartInfo = {
bodyPart: Enum.BodyPart,
instance: Instance, --Folder with Created MeshParts
}
export type BodyPartList = { BodyPartInfo }
local function publishAvatar(bodyPartInstances: BodyPartList, player: Player, tokenId: string)
local humanoidDescription = Instance.new("HumanoidDescription")
for _, bodyPartInfo in bodyPartInstances do
local bodyPartDescription = Instance.new("BodyPartDescription")
bodyPartDescription.Instance = bodyPartInfo.instance
bodyPartDescription.BodyPart = bodyPartInfo.bodyPart
bodyPartDescription.Parent = humanoidDescription
end
local pcallSuccess, result, resultMessage = pcall(function()
return AvatarCreationService:PromptCreateAvatarAsync(tokenId, player, humanoidDescription)
end)
if pcallSuccess then
if result == Enum.PromptCreateAvatarResult.Success then
print("Successfully uploaded with BundleId: ", resultMessage)
else
print("Unsuccessfully uploaded with error message:", resultMessage)
end
else
print("Avatar failed to create.")
end
end
ValidateUGCAccessoryAsync
スタジオのみ。Player と Instance を与えて、Enum.AccessoryType で UGC の検証がパスするかどうかを判断します。
パラメータ
インスタンス検証が実行されます。
Enum.AccessoryType インスタンスは、Eyebrow 、Eyelash 、または Hair となることが期待されます。
戻り値
順に含まれるtuple:
- アクセサリーの有効性が成功したかどうかを示すブール。
- オプションの文字列のテーブル。これには、検証が失敗した場合の失敗理由が含まれ、検証が成功した場合は nil です。
ValidateUGCBodyPartAsync
スタジオのみ。Player と Instance を与えて、Enum.BodyPart に UGC の検証がパスするかどうかを判断します。パラメータ は、関連する で次の例の形式で期待されます:
しかし、期待される bodyPart が Enum.BodyPart.Head である場合、機能は単数の Head MeshPart を直接取得します。
パラメータ
インスタンス検証が実行されます。
Enum.BodyPart インスタンスが期待されます。
戻り値
順に含まれるtuple:
- ボディパーツの有効性検証が成功したかどうかを示すブール。
- オプションの文字列のテーブル。これには、検証が失敗した場合の失敗理由が含まれ、検証が成功した場合は nil です。
ValidateUGCFullBodyAsync
スタジオのみ。Player と HumanoidDescription を与えると、HumanoidDescription のすべてのインスタンスが有効になります。
The HumanoidDescription は、6つの必須の BodyPartDescription 値すべてに対して、子供の Enum.BodyPart インスタンスを設定する必要があります。オプションでは、AccessoryDescription 子供に設定されたインスタンスを含めることができます Eyebrow 、Eyelash 、そして Hair 、AccessoryTypes 。
パラメータ
HumanoidDescription 有効性が実行される体を表す。
戻り値
順に含まれるtuple:
- ボディの有効性が成功したかどうかを示すブール。
- オプションの文字列のテーブル。これには、検証が失敗した場合の失敗理由が含まれ、検証が成功した場合は nil です。