外部协作API列表
最終更新: 2024年6月25日
本页面介绍通过外部链接 API 从 UID、参数 ID 等设置和检索编辑器中的信息的命令、事件和错误类型。
说明
注册插件
将外部应用程序注册到编辑器。
注册完成后,将返回一个令牌。
该令牌与应用程序绑定,通过在下次连接时指定它,您可以继承用户的权限状态。
有关详细信息,请参阅“令牌认证”。
Version | Request | Response | ErrorType |
---|---|---|---|
Response | Name:String, Token?:String, Icon?:String, Path?:String | Token:String | InvalidData |
Name:String | 应用程序名称(可选): |
Token?:String | 令牌: |
Icon?:String | 图标 PNG 图像的 BASE64 字符串: |
Path?:String | 显示应用程序路径信息。 |
注意事项
除非您先运行 RegisterPlugin 并获得用户的许可,否则以下几乎所有命令都会返回 PluginNotRegistered 错误,并且不会接受 API 操作。
GetIsApprove
获取用户是否有权限与该应用通信。
这链接到设置对话框中的“允许”复选框。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.0 | Result:Boolean | InvalidData |
GetParameterValues
version 0.9.0
获取模型的当前参数 ID 和给定参数 ID 的值。
如果不指定参数ID,则会获取模型的所有参数ID和值。
不包含动画信息。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.0 | ModelUID:String, Ids?:Array<String> | Parameters:Array<{ Id:String, Value:Number }> | InvalidData InvalidModel |
version 0.9.1
获取模型的当前参数 ID 和给定参数 ID 的值。
如果不指定参数ID,则会获取模型的所有参数ID和值。
可以获得有关物理计算、模型编辑和动画的信息。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.1 | ModelUID:String, Ids?:Array<String> | Parameters:Array<{ Id:String, Value:Number }> | InvalidData InvalidModel |
SetParameterValues
version 0.9.0
设置指定的参数 ID 和值。
参数无法发送到动画文件中的模型。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.0 | ModelUID:String, Parameters:Array<{ Id:String, Value:Number }> | InvalidData InvalidModel InvalidParameter |
version 0.9.1
设置指定的参数 ID 和值。
将参数发送到动画文件中的模型时,必须选择模型轨迹。
对于物理编辑器和动画模型,参数不会立即反映,而是暂时保留。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.1 | ModelUID: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 | 参数类型 |
version 0.9.0
获取模型具有的参数列表。
ModelUID 和 DocumentUID 是可选的,但其中之一是必需的。
类型为“0”表示正常,“1”表示混合形状。
无法获取动画文件(.can3)中模型的参数列表。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.0 | ModelUID?: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 将返回空字符串。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.1 | ModelUID?: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)中包含的模型的参数列表。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.0 | ModelUID?:String, DocumentUID?:String | Groups:Array<{ GroupUID:String, GroupName:String, }> | InvalidData InvalidModel |
version 0.9.1
获取模型具有的参数组列表。
ModelUID 和 DocumentUID 是可选的,但其中之一是必需的。
如果要获取动画文件中包含的模型组列表,则必须选择模型轨迹。
如果模型是嵌入式模型轨道,则 GroupUID 将返回空字符串。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.1 | ModelUID?:String, DocumentUID?:String | Groups:Array<{ GroupUID:String, GroupName:String, }> | InvalidData InvalidModel |
GetDocuments
version 0.9.0
返回文档信息。
按类型分隔:物理计算、模型编辑,如果不存在则返回 0 文档数组。
如果拆分显示一个模型,View 数量将会增加。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.0 | PhysicsDocuments: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 数量将会增加。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.1 | PhysicsDocuments: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 的文档信息。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.3 | DocumentUID:String | PhysicsDocuments?: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。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.3 | DocumentUID:String | DocumentUID:String | InvalidData InvalidDocument |
GetCurrentModelUID
version 0.9.0
返回编辑器中当前模型的 UID。
无法获取动画文件中包含的模型的 UID。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.0 | ModelUID:String | InvalidData InvalidModel |
version 0.9.1
返回编辑器中当前模型的 UID。
如果要获取动画文件中包含的模型的 UID,则必须选择模型轨迹。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.1 | ModelUID:String | InvalidData InvalidModel |
GetCurrentEditMode
version 0.9.0
返回编辑器上的当前编辑模式。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.0 | EditMode:String | InvalidData |
EditMode:String | 编辑模式 |
SetGlobalVersion
version 0.9.1
您可以设置要使用的 API 版本。
这允许您修复外部应用程序使用的 API 版本。
如果没有设置,可以返回为未指定。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.1 | Version?:String | InvalidData |
ClearParameterValues
version 0.9.1
清除发送到目标模型的参数。
使用 SetParameterValue 发送的参数暂时保存在编辑器中。
对于物理计算编辑器和动画,参数可能会因模型更新而暂时保留。
如果您想显式清除临时保存的参数,请使用此 API。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.1 | ModelUID:String | InvalidData |
GetPhysicsInfo
version 0.9.2
在物理设置编辑器中获取计算出的 FPS。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.2 | ModelUID:String, Fps?:Number | InvalidData InvalidModel |
SendCubismLog
version 0.9.3
发送字符串作为编辑器日志。
类型可以指定为“info”或“warning”,默认值为“info”。
消息的最大字符长度为 5000 个字符。
Display 表示是否在日志调色板上显示,如果省略,则默认值设置为true,并在日志调色板上显示。
Version | Request | Response | ErrorType |
---|---|---|---|
0.9.3 | Type?: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
配置导出物理计算设置文件时的通知设置。
Version | Request | Response | Event | ErrorType |
---|---|---|---|---|
0.9.0 | Enabled:Boolean | Accepted:Boolean | Path:String, ModelFilePath:String | InvalidData |
NotifyMocFileExported
version 0.9.3
配置导出 MOC3 文件时的通知设置。
如果启用该设置,则会通知有关 MOC3 文件和相关文件的信息。
Version | Request | Response | Event | ErrorType |
---|---|---|---|---|
0.9.3 | Enabled:Boolean | Accepted:Boolean | Path:String, ModelFilePath:String, Files:Array<String> | InvalidData |
version 0.9.0
配置导出 MOC3 文件时的通知设置。
如果启用该设置,则会通知 MOC3 文件信息。
Version | Request | Response | Event | ErrorType |
---|---|---|---|---|
0.9.0 | Enabled:Boolean | Accepted:Boolean | Path:String, ModelFilePath:String | InvalidData |
NotifyMotionFileExported
version 0.9.0
配置导出运动文件时的通知设置。
Version | Request | Response | Event | ErrorType |
---|---|---|---|---|
0.9.0 | Enabled:Boolean | Accepted:Boolean | Path:String, ModelFilePath:String | InvalidData |
NotifyMotionSyncFileExported
version 0.9.0
导出运动同步设置文件时配置通知设置。
Version | Request | Response | Event | ErrorType |
---|---|---|---|---|
0.9.0 | Enabled:Boolean | Accepted:Boolean | Path:String, ModelFilePath:String | InvalidData |
NotifyChangeEditMode
version 0.9.0
配置编辑模式切换时的通知设置。
对于 EditMode,请参阅“GetCurrentEditMode”。
Version | Request | Response | Event | ErrorType |
---|---|---|---|---|
0.9.0 | Enabled:Boolean | Accepted:Boolean | EditMode:String | InvalidData |
错误类型
名称 | 说明 | Since |
---|---|---|
InvalidJson | JSON 结构不正确。 | 0.9.0 |
UnsupportedVersion | 版本不兼容。 | 0.9.0 |
MethodNotFound | 未找到指定的指令。 | 0.9.0 |
InvalidType | 类型设置无效。 | 0.9.0 |
InvalidData | 指令参数无效。 | 0.9.0 |
PluginNotRegistered | 插件注册尚未完成。 | 0.9.0 |
InvalidParameter | 指定的Live2D参数不存在。 | 0.9.0 |
InvalidModel | 指定的Live2D模型不存在。 | 0.9.0 |
InvalidDocument | 编辑器中不存在指定的文档。 | 0.9.0 |
InvalidView | 指定的视图不存在。 | 0.9.0 |