外部协作API列表

最終更新: 2024年6月25日

本页面介绍通过外部链接 API 从 UID、参数 ID 等设置和检索编辑器中的信息的命令、事件和错误类型。

说明

注册插件

将外部应用程序注册到编辑器。
注册完成后,将返回一个令牌。
该令牌与应用程序绑定,通过在下次连接时指定它,您可以继承用户的权限状态。
有关详细信息,请参阅“令牌认证”。

VersionRequestResponseErrorType
ResponseName:String,
Token?:String,
Icon?:String,
Path?:String
Token:StringInvalidData
Name:String

应用程序名称(可选):
请给它一个独特的名称。
即使名称与其他应用程序重叠,也不会影响操作。

Token?:String

令牌:
如果省略或未注册令牌,RegisterPlugin 将返回一个新令牌。
如果指定的令牌已注册,则原样返回。

Icon?:String

图标 PNG 图像的 BASE64 字符串:
大小应为 32×32 或更大、256×256 或更小、0.5MB 或更小的正方形。

Path?:String显示应用程序路径信息。
注意事项

除非您先运行 RegisterPlugin 并获得用户的许可,否则以下几乎所有命令都会返回 PluginNotRegistered 错误,并且不会接受 API 操作。

GetIsApprove

获取用户是否有权限与该应用通信。
这链接到设置对话框中的“允许”复选框。

VersionRequestResponseErrorType
0.9.0Result:BooleanInvalidData

GetParameterValues

version 0.9.0

获取模型的当前参数 ID 和给定参数 ID 的值。
如果不指定参数ID,则会获取模型的所有参数ID和值。
不包含动画信息。

VersionRequestResponseErrorType
0.9.0ModelUID:String,
Ids?:Array<String>
Parameters:Array<{
  Id:String,
  Value:Number
}>
InvalidData
InvalidModel

version 0.9.1

获取模型的当前参数 ID 和给定参数 ID 的值。
如果不指定参数ID,则会获取模型的所有参数ID和值。
可以获得有关物理计算、模型编辑和动画的信息。

VersionRequestResponseErrorType
0.9.1ModelUID:String,
Ids?:Array<String>
Parameters:Array<{
  Id:String,
  Value:Number
}>
InvalidData
InvalidModel

SetParameterValues

version 0.9.0

设置指定的参数 ID 和值。
参数无法发送到动画文件中的模型。

VersionRequestResponseErrorType
0.9.0ModelUID:String,
Parameters:Array<{
  Id:String,
  Value:Number
}>
InvalidData
InvalidModel
InvalidParameter

version 0.9.1

设置指定的参数 ID 和值。
将参数发送到动画文件中的模型时,必须选择模型轨迹。
对于物理编辑器和动画模型,参数不会立即反映,而是暂时保留。

VersionRequestResponseErrorType
0.9.1ModelUID:String,
Parameters:Array<{
  Id:String,
  Value:Number
}>
InvalidData
InvalidModel
InvalidParameter

GetParameters

Id:String参数ID
Name:String参数名称
GroupUID:String所属参数组的UID
Default:Number默认值
Max,Max:Number最大值、最小值
Repeat:Boolean循环
Type:Number

参数类型
0:正常
1:混合形状

version 0.9.0

获取模型具有的参数列表。
ModelUID 和 DocumentUID 是可选的,但其中之一是必需的。
类型为“0”表示正常,“1”表示混合形状。
无法获取动画文件(.can3)中模型的参数列表。

VersionRequestResponseErrorType
0.9.0ModelUID?:String,
DocumentUID?:String
Parameters:Array<{
  Id:String, 
  Name:String,
  GroupUID:String,
  Default:Number,
  Max:Number,
  Min:Number,
  Repeat:Boolean
  Type:Number
}>
InvalidData
InvalidModel

version 0.9.1

获取模型具有的参数列表。
ModelUID 和 DocumentUID 是可选的,但其中之一是必需的。
类型为“0”表示正常,“1”表示混合形状。
如果您想要获取动画文件中包含的模型的参数列表,则必须选择模型轨迹。
如果模型是嵌入式模型轨道,则 GroupUID 将返回空字符串。

VersionRequestResponseErrorType
0.9.1ModelUID?:String,
DocumentUID?:String
Parameters:Array<{
  Id:String, 
  Name:String,
  GroupUID:String,
  Default:Number,
  Max:Number,
  Min:Number,
  Repeat:Boolean
  Type:Number
}>
InvalidData
InvalidModel

GetParameterGroups

version 0.9.0

获取模型具有的参数组列表。
ModelUID 和 DocumentUID 是可选的,但其中之一是必需的。
无法获取动画文件(.can3)中包含的模型的参数列表。

VersionRequestResponseErrorType
0.9.0ModelUID?:String,
DocumentUID?:String
Groups:Array<{
  GroupUID:String,
  GroupName:String,
}>
InvalidData
InvalidModel

version 0.9.1

获取模型具有的参数组列表。
ModelUID 和 DocumentUID 是可选的,但其中之一是必需的。
如果要获取动画文件中包含的模型组列表,则必须选择模型轨迹。
如果模型是嵌入式模型轨道,则 GroupUID 将返回空字符串。

VersionRequestResponseErrorType
0.9.1ModelUID?:String,
DocumentUID?:String
Groups:Array<{
  GroupUID:String,
  GroupName:String,
}>
InvalidData
InvalidModel

GetDocuments

version 0.9.0

返回文档信息。
按类型分隔:物理计算、模型编辑,如果不存在则返回 0 文档数组。
如果拆分显示一个模型,View 数量将会增加。

VersionRequestResponseErrorType
0.9.0PhysicsDocuments:Array<{
  DocumentUID:String,
  DocumentFilePath:String,
  ModelUID:String
}>,
ModelingDocuments:Array<{
  DocumentUID:String,
  DocumentFilePath:String,
  Views:Array<{
    ModelUID:String
   }>
}>
InvalidData
InvalidDocument

version 0.9.1

返回文档信息。
按类型分隔:物理计算、模型编辑,如果不存在则返回 0 文档数组。
如果拆分显示一个模型,View 数量将会增加。

VersionRequestResponseErrorType
0.9.1PhysicsDocuments:Array<{
  DocumentUID:String,
  DocumentFilePath:String
  ModelUID:String,
}>
ModelingDocuments:Array<{
  DocumentUID:String,
  DocumentFilePath:String
  Views:Array<{
    ModelUID:String
  }>
}>
AnimationDocuments:Array<{
  DocumentUID:String,
  DocumentFilePath:String
  Views:Array<{
    ModelUID:String,
    ModelFilePath:String
  }>
}>
InvalidData
InvalidDocument

GetDocument

version 0.9.3

返回给定文档 UID 的文档信息。

VersionRequestResponseErrorType
0.9.3DocumentUID:StringPhysicsDocuments?:Array<{
  DocumentFilePath:String
  ModelUID:String,
}>
ModelingDocuments?:Array<{
  DocumentFilePath:String
  Views:Array<{
    ModelUID:String
  }>
}>
AnimationDocuments?: Array<{
  DocumentFilePath:String
  Views : Array<{
    ModelUID:String,
    ModelFilePath:String
  }>
}>
InvalidData
InvalidDocument

GetCurrentDocumentUID

version 0.9.3

返回编辑器中当前文档的 UID。

VersionRequestResponseErrorType
0.9.3DocumentUID:StringDocumentUID:StringInvalidData
InvalidDocument

GetCurrentModelUID

version 0.9.0

返回编辑器中当前模型的 UID。
无法获取动画文件中包含的模型的 UID。

VersionRequestResponseErrorType
0.9.0ModelUID:StringInvalidData
InvalidModel

version 0.9.1

返回编辑器中当前模型的 UID。
如果要获取动画文件中包含的模型的 UID,则必须选择模型轨迹。

VersionRequestResponseErrorType
0.9.1ModelUID:StringInvalidData
InvalidModel

GetCurrentEditMode

version 0.9.0

返回编辑器上的当前编辑模式。

VersionRequestResponseErrorType
0.9.0EditMode:StringInvalidData
EditMode:String

编辑模式
“Physics”:物理计算设置编辑器
“建模”:模型编辑
“动画”:动画编辑
“ModelingMeshEdit”:网格编辑
“FormAnimation”:编辑表单动画 *5.1 beta1 或更高版本标记>

SetGlobalVersion

version 0.9.1

您可以设置要使用的 API 版本。
这允许您修复外部应用程序使用的 API 版本。
如果没有设置,可以返回为未指定。

VersionRequestResponseErrorType
0.9.1Version?:StringInvalidData

ClearParameterValues

version 0.9.1

清除发送到目标模型的参数。
使用 SetParameterValue 发送的参数暂时保存在编辑器中。
对于物理计算编辑器和动画,参数可能会因模型更新而暂时保留。
如果您想显式清除临时保存的参数,请使用此 API。

VersionRequestResponseErrorType
0.9.1ModelUID:StringInvalidData

GetPhysicsInfo

version 0.9.2

在物理设置编辑器中获取计算出的 FPS。

VersionRequestResponseErrorType
0.9.2ModelUID:String,
Fps?:Number
InvalidData
InvalidModel

SendCubismLog

version 0.9.3

发送字符串作为编辑器日志。
类型可以指定为“info”或“warning”,默认值为“info”。
消息的最大字符长度为 5000 个字符。
Display 表示是否在日志调色板上显示,如果省略,则默认值设置为true,并在日志调色板上显示。

VersionRequestResponseErrorType
0.9.3Type?:String,
Message:String,
Display?:Boolean
InvalidData
InvalidModel

活动

要处理事件,客户端必须首先启用服务器的权限标志。

{
    (省略)
    "Type": "Request",
    "Method": "NotifyMocFileExported",
    "Data": {
        "Enable" : true
    }
}

然后,当服务器执行特定的过程(事件)时,无论客户端的请求如何,它都会发送 JSON。
请注意,如果模型文件从未保存过,则 ModelFilePath 字段将包含空字符串。

{
    (省略)
    "Type": "Response",
    "Method": "NotifyMocFileExported",
    "Data": {
        "Path" : "c:\\temp\\export.moc3",
        "ModelFilePath" : "c:\\models\\hoge03.cmo3"
    }
}

NotifyPhysicsFileExported

version 0.9.0

配置导出物理计算设置文件时的通知设置。

VersionRequestResponseEventErrorType
0.9.0Enabled:BooleanAccepted:BooleanPath:String,
ModelFilePath:String
InvalidData

NotifyMocFileExported

version 0.9.3

配置导出 MOC3 文件时的通知设置。
如果启用该设置,则会通知有关 MOC3 文件和相关文件的信息。

VersionRequestResponseEventErrorType
0.9.3Enabled:BooleanAccepted:BooleanPath:String,
ModelFilePath:String,
Files:Array<String>
InvalidData

version 0.9.0

配置导出 MOC3 文件时的通知设置。
如果启用该设置,则会通知 MOC3 文件信息。

VersionRequestResponseEventErrorType
0.9.0Enabled:BooleanAccepted:BooleanPath:String,
ModelFilePath:String
InvalidData

NotifyMotionFileExported

version 0.9.0

配置导出运动文件时的通知设置。

VersionRequestResponseEventErrorType
0.9.0Enabled:BooleanAccepted:BooleanPath:String,
ModelFilePath:String
InvalidData

NotifyMotionSyncFileExported

version 0.9.0

导出运动同步设置文件时配置通知设置。

VersionRequestResponseEventErrorType
0.9.0Enabled:BooleanAccepted:BooleanPath:String,
ModelFilePath:String
InvalidData

NotifyChangeEditMode

version 0.9.0

配置编辑模式切换时的通知设置。
对于 EditMode,请参阅“GetCurrentEditMode”。

VersionRequestResponseEventErrorType
0.9.0Enabled:BooleanAccepted:BooleanEditMode:StringInvalidData

错误类型

名称说明Since
InvalidJsonJSON 结构不正确。0.9.0
UnsupportedVersion版本不兼容。0.9.0
MethodNotFound未找到指定的指令。0.9.0
InvalidType类型设置无效。0.9.0
InvalidData

指令参数无效。
如果参数不足或为参数指定了不同类型,则会返回此错误。

0.9.0
PluginNotRegistered

插件注册尚未完成。
如果在未完成插件注册(RegisterPlugin)和用户授权的情况下请求指令,将会返回此错误。

0.9.0
InvalidParameter指定的Live2D参数不存在。0.9.0
InvalidModel指定的Live2D模型不存在。0.9.0
InvalidDocument编辑器中不存在指定的文档。0.9.0
InvalidView指定的视图不存在。0.9.0
请问这篇文章对您有帮助吗?
关于本报道,敬请提出您的意见及要求。