AvatarCreationService

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

作成できません
サービス

AvatarCreationService は、開発者アバタークリエーターをサポートするサービスで、経験内からのアバター作成の促示をサポートする方法を提供します。

概要

方法

プロパティ

方法

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,
},
...
}
}

戻り値

上記の詳細に示された有効性規則の辞書。

GenerateAvatar2DPreviewAsync

イールド

パラメータ

avatarGeneration2dPreviewParams: Dictionary
既定値: ""

戻り値

GetBatchTokenDetailsAsync

イールド

一度にアバター作成トークンのリストを取得し、アバター作成トークンの詳細を取得します (トークンは トークン作成プロセス を通じて生成されます)。アバター作成トークンの詳細のアレイを返し、各トークン詳細は以下の例の結果で指定されたフィールドを持つ辞書です:


{
["Name"] = "string",
["Description"] = "string",
["UniverseId"] = 0,
["CreatorId"] = 0,
["CreatorType"] = Enum.CreatorType.User,
["OnSale"] = true,
["Price"] = 0,
["OffSaleReasons"] = {
"string",
}
}

パラメータ

tokenIds: Array

詳細を取得するためのアバター作成トークン ID リスト。

既定値: ""

戻り値

上記のようにアバター作成トークンの詳細のアレイ。

LoadAvatar2DPreviewAsync

イールド

パラメータ

previewId: string
既定値: ""

戻り値

LoadGeneratedAvatarAsync

イールド

パラメータ

generationId: string
既定値: ""

戻り値

PrepareAvatarForPreviewAsync

()
イールド

パラメータ

humanoidModel: Model
既定値: ""

戻り値

()

PromptCreateAvatarAsync

イールド

Player に購入してアバターを作成するように促すと、HumanoidDescription からアバターを購入して作成します。作成の価格は、アバター作成トークンに割り当てられた価格によって決まります。このアバター作成トークンは、ボディの購入と作成に必要であり、トークン作成プロセス に従って生成できます。

アバターの作作品では、HumanoidDescription は、6つの身体部分(HeadTorsoRightLegLeftLegRightArmLeftArm)のそれぞれに作成される新しいアセットを含めることが期待されます。オプションで、新しい Hair アクセサリーも含めることができます。

これをサポートするために、HumanoidDescription は、6のBodyPartDescription (それぞれの身体部分の 1) を含める必要があります。それぞれについて、 プロパティは、体の部分を構成するすべての インスタンスを含む を参照します。たとえば、 フォルダに 、 、および が含まれています。BodyPartDescription.BodyPart プロパティも、関連する Enum.BodyPart に設定する必要があります。

各ボディパーツ MeshPart も含める必要があります:

髪などのアクセサリーを含める場合、 には、次のような子を含める必要があります:

最後に、HumanoidDescription は、BodyTypeScaleHeadScaleHeightScaleWidthScale、およびProportionScaleのヒューマノイドスケールを含むべきです。ベースボディがインポートされるスケールを注意して、HumanoidDescription に提供されたスケールと一致するようにしてください。

パラメータ

tokenId: string

アバター作成トークンのID。トークンは、メソッドが呼ばれる宇宙がトークンが作成された宇宙と同じ宇宙であることによって有効でなければなりません。さらに、トークンクリエータは、ID の検証と Roblox Premium を維持する必要があります。この API で使用するトークンを作成するには、トークン作成プロセス に従ってください。

既定値: ""
player: Player

作成プロンプトと一緒に表示される予定の Player

既定値: ""
humanoidDescription: HumanoidDescription

作品成する予定のアバターの HumanoidDescription

既定値: ""

戻り値

順に含まれるtuple:

コードサンプル

The following code populates a HumanoidDescription in the expected format, prompts for avatar creation, and responds to the result.

PromptCreateAvatarAsync

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

イールド

スタジオのみ。PlayerInstance を与えて、Enum.AccessoryType で UGC の検証がパスするかどうかを判断します。

パラメータ

player: Player

有効性の検証が完了しました。Player

既定値: ""
accessory: Instance

インスタンス検証が実行されます。

既定値: ""
accessoryType: Enum.AccessoryType

Enum.AccessoryType インスタンスは、EyebrowEyelash 、または Hair となることが期待されます。

既定値: ""

戻り値

順に含まれるtuple:

  • アクセサリーの有効性が成功したかどうかを示すブール。
  • オプションの文字列のテーブル。これには、検証が失敗した場合の失敗理由が含まれ、検証が成功した場合は nil です。

ValidateUGCBodyPartAsync

イールド

スタジオのみ。PlayerInstance を与えて、Enum.BodyPart に UGC の検証がパスするかどうかを判断します。パラメータ は、関連する で次の例の形式で期待されます:

しかし、期待される bodyPartEnum.BodyPart.Head である場合、機能は単数の Head MeshPart を直接取得します。

パラメータ

player: Player

有効性の検証が完了しました。Player

既定値: ""
instance: Instance

インスタンス検証が実行されます。

既定値: ""
bodyPart: Enum.BodyPart

Enum.BodyPart インスタンスが期待されます。

既定値: ""

戻り値

順に含まれるtuple:

  • ボディパーツの有効性検証が成功したかどうかを示すブール。
  • オプションの文字列のテーブル。これには、検証が失敗した場合の失敗理由が含まれ、検証が成功した場合は nil です。

ValidateUGCFullBodyAsync

イールド

スタジオのみ。PlayerHumanoidDescription を与えると、HumanoidDescription のすべてのインスタンスが有効になります。

The HumanoidDescription は、6つの必須の BodyPartDescription 値すべてに対して、子供の Enum.BodyPart インスタンスを設定する必要があります。オプションでは、AccessoryDescription 子供に設定されたインスタンスを含めることができます EyebrowEyelash 、そして HairAccessoryTypes

パラメータ

player: Player

有効性の検証が完了しました。Player

既定値: ""
humanoidDescription: HumanoidDescription

HumanoidDescription 有効性が実行される体を表す。

既定値: ""

戻り値

順に含まれるtuple:

  • ボディの有効性が成功したかどうかを示すブール。
  • オプションの文字列のテーブル。これには、検証が失敗した場合の失敗理由が含まれ、検証が成功した場合は nil です。

イベント

AvatarModerationCompleted

パラメータ

outfitId: number
moderationStatus: Enum.ModerationStatus