fgui_replace_object_resource
Replace an Image/Loader image reference or a component instance's source component in FairyGUI, then optionally save and verify via disk comparison or document reload.
Instructions
通过 Editor API 替换 Image/Loader 图片引用或组件实例的源组件(0.8.21+);保存后默认比对磁盘 XML。Button 状态暂不支持。
组件实例换源组件走编辑器原生命令 Document.ReplaceSelection:id/name/xy/relation/显式 size 全部保留, 没有显式 size 时尺寸跟随新源组件(FGUI 语义,preserve_size 对组件实例不适用)。 expected_type 省略时按目标对象推导(image/loader→image,组件实例→component),显式传入则作为断言。
external_reload=True 会在保存后关闭并重新打开文档再比对,是唯一能证明「重新载入时值不丢」的验证;需要 save=True。响应中的 strength 字段标明验证强度:reload / disk / none。
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"resource_url": "<resource_url>"
},
"name": "fgui_replace_object_resource"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| save | No | ||
| state | No | ||
| verify | No | ||
| object_id | No | ||
| object_name | No | ||
| object_path | No | ||
| resource_url | Yes | ||
| expected_type | No | ||
| external_reload | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||