Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy GitHub Pages

on:
push:
branches:
- copilot/website
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: github-pages
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure Pages
uses: actions/configure-pages@v5

- name: Prepare static site
run: |
mkdir _site
rsync -a --delete \
--exclude '.git' \
--exclude '.github' \
--exclude '.Doxyfile' \
--exclude '.gitignore' \
--exclude '_site' \
./ _site/
touch _site/.nojekyll

- name: Upload static site
uses: actions/upload-pages-artifact@v3
with:
path: _site

- name: Deploy
id: deployment
uses: actions/deploy-pages@v5
Empty file added .nojekyll
Empty file.
125 changes: 125 additions & 0 deletions Document/AnimationMcpProtocol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Animation MCP Protocol Draft

本文记录当前开源 Sequencer/UMG Animation MCP 的精简协议原则。范围限定为 UE 5.8;不引入商业版服务依赖。

## 设计原则

1. Target 是默认操作对象。`set_target_umg_asset` 决定 UMG 资产;`set_animation_scope` 决定当前动画;`set_widget_scope` 决定当前动画内的控件。下层 Target 继承上层 Target。
2. 读操作返回语义。读动画时默认返回概览;读控件时返回该控件被动画驱动的属性时间线;读时间时返回该时刻的属性值。只有调试兼容层才返回完整 keyframe dump。
3. 写操作只做并集覆盖和追加。`animation_append_widget_tracks` 和 `animation_append_time_slice` 只能覆盖已有关键帧或追加新关键帧,不允许隐式删除。
4. 删除必须走单独命令。删除指定控件、属性、时间的 key 使用 `animation_delete_widget_keys(confirm_delete=true)`;删除整段动画使用 `delete_animation(confirm_delete=true)`。
5. 所有默认 MCP 返回都必须包含可复述的计数或上下文,例如动画名、控件名、轨道数、关键帧数、时间点或删除数量。

## 当前精简工具

| Tool | 作用 |
| --- | --- |
| `set_animation_scope(animation_name)` | 设置当前动画 Target;若动画不存在则自动创建。 |
| `set_widget_scope(widget_name)` | 设置当前动画内的控件 Target。 |
| `get_all_animations()` | 返回当前 UMG Target 的动画简表。 |
| `animation_overview(animation_name?, widget_name?, property_name?)` | 返回紧凑概览:被动画驱动的控件、属性、关键时间点、轨道数和关键帧数。 |
| `animation_widget_properties(animation_name?, widget_name?, property_name?)` | 按控件视角读取属性时间线,只返回被动画驱动的属性。 |
| `animation_time_properties(times, animation_name?, widget_name?, property_name?)` | 按一个或多个时间点读取属性值。 |
| `create_animation(animation_name)` | 创建或聚焦动画。 |
| `delete_animation(animation_name, confirm_delete=true)` | 显式删除整段动画。 |
| `animation_append_widget_tracks(widget_name, tracks, animation_name?)` | 控件视角追加/覆盖多个属性轨道的关键帧。 |
| `animation_append_time_slice(time, widgets, animation_name?)` | 时间视角追加/覆盖一个时刻下多个控件的属性值,推荐只提供 diff。 |
| `animation_delete_widget_keys(property_name, times, widget_name?, animation_name?, confirm_delete=true)` | 显式删除指定控件、属性、时间点的关键帧。 |

## 默认缺省

最短可用流程:

```python
set_target_umg_asset("/Game/UI/W_Login")
create_animation("Intro")
set_animation_scope("Intro")
set_widget_scope("LoginCard")
animation_append_widget_tracks(
widget_name="LoginCard",
tracks=[
{"property": "RenderOpacity", "keys": [{"time": 0.0, "value": 0.0}, {"time": 0.4, "value": 1.0}]},
{"property": "RenderTransform.Scale", "keys": [{"time": 0.0, "value": {"x": 0.95, "y": 0.95}}, {"time": 0.4, "value": {"x": 1.0, "y": 1.0}}]},
],
)
animation_overview()
```

`animation_name` 和 `widget_name` 可以显式传入,也可以从当前 Target 推导。需要精确操作时传参;需要流式编辑时使用 Target。

## 读语义层级

- `get_all_animations`:图书馆目录,回答有哪些动画。
- `animation_overview`:读一本书的目录,回答有哪些控件、属性和关键时间。
- `animation_widget_properties`:读一个控件章节,回答该控件哪些属性在何时变化。
- `animation_time_properties`:读一个时间页,回答该时刻哪些属性值成立。

`get_animation_keyframes`、`get_animated_widgets`、`get_animation_full_data`、`get_widget_animation_data` 保留在后端兼容层,用于调试或旧脚本迁移,不进入默认 MCP 提示面。

## 写与删除

`animation_append_widget_tracks`:

```json
{
"widget_name": "LoginCard",
"tracks": [
{
"property": "RenderTransform.Translation",
"keys": [
{"time": 0.0, "value": {"x": 0, "y": 24}},
{"time": 0.5, "value": {"x": 0, "y": 0}}
]
}
]
}
```

`animation_append_time_slice`:

```json
{
"time": 0.75,
"widgets": [
{
"widget_name": "LoginCard",
"properties": {
"RenderOpacity": 1.0,
"RenderTransform.Angle": 2.0
}
}
]
}
```

删除必须显式:

```json
{
"property_name": "RenderTransform.Scale.X",
"times": [0.5],
"widget_name": "LoginCard",
"confirm_delete": true
}
```

不带 `confirm_delete=true` 的删除请求必须失败,并返回可解释的安全提示。

## 隐藏兼容命令

以下命令仍在后端路由中保留,但默认 MCP prompt 不暴露:

- `get_animation_keyframes`
- `get_animated_widgets`
- `get_animation_full_data`
- `get_widget_animation_data`
- `set_property_keys`
- `set_animation_data`
- `remove_property_track`
- `remove_keys`

这些命令只能作为内部兼容或调试工具;新 Skill 和 Demo 应使用精简工具。

## ToolMode 支撑工具

Animation ToolMode 除了上述动画工具,还必须允许 `set_target_umg_asset`、`get_target_umg_asset`、`set_target_widget`、`get_target_widget` 和 `save_asset`。这些不是动画语义本身,但它们是 Target/缺省链路和保存流程的一部分。
192 changes: 192 additions & 0 deletions Document/BlueprintBluecodeProtocol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# Blueprint Bluecode Protocol Draft

本文记录新的 Blueprint MCP 方向。范围限定为 UE 5.8;当前实现仍是过渡期节点级 MCP,bluecode 尚未落地。

## 为什么需要 bluecode

旧 Blueprint MCP 的主要问题:

1. 需要频繁逐节点调用 MCP,交互成本高。
2. `get_function_nodes` 返回节点 ID、类名等调试信息,但缺少执行语义、参数语义和数据依赖压缩。
3. `add_step`/`prepare_value`/`connect_data_to_pin` 把 AI 暴露在节点和 pin 细节里,信息密度低。
4. 旧 `delete_node`、`delete_variable` 是直接删除命令,不符合 Issue 15 的删除困难原则;默认 MCP 应隐藏它们,直到删除协议改为显式 `confirm_delete=true`。

bluecode 的目标不是一次替换所有后端,而是像 HLSL 替代 Material 图编辑一样,先定义高层协议,再逐步迁移。

## Target 层级

Target 继承关系:

1. `set_target_umg_asset`:当前 UMG/Widget Blueprint 资产。
2. `set_target_widget`:当前控件,可用于优先匹配 `Widget.Event` 或绑定函数。
3. `bluecode_set_function`:当前函数、事件或图。

`bluecode_set_function` 的目标格式建议:

```text
FunctionName
WidgetName.EventName
/Game/UI/W_Login:EventGraph
/Game/UI/W_Login:LoginButton.OnClicked
```

缺省规则:

- 未给资产路径时使用 Active UMG Target。
- 存在 Widget Target 时,优先匹配该控件的事件或绑定函数。
- 匹配多个候选时必须失败,并返回候选列表。
- 设置函数后,逻辑入口称为 `main`,空结束称为 `end`,返回称为 `return`,分支块使用稳定标签。

## 读语义

建议工具:

| Tool | 作用 |
| --- | --- |
| `bluecode_read_function(detail?)` | 以代码式摘要读取当前函数。默认返回执行流和必要数据依赖;`detail="debug"` 时才返回节点 ID 和 pin。 |
| `bluecode_read_variables()` | 读取变量、类型、默认值和引用摘要。 |
| `bluecode_read_events()` | 读取当前 UMG Target 下可编辑事件和已绑定事件。 |

默认 `bluecode_read_function` 应输出类似:

```text
main()
PrintString("Welcome")
if IsValid(LoginButton):
SetVisibility(LoginPanel, Visible)
end
```

返回 JSON 同时带结构化信息:

```json
{
"function": "LoginButton.OnClicked",
"entry": "main",
"exit": "end",
"code": "main()\n PrintString(\"Welcome\")\n end",
"exec_paths": 1,
"data_dependencies": [
{"name": "LoginPanel", "kind": "widget_reference"}
],
"debug_nodes_available": true
}
```

## 写语义

建议工具:

| Tool | 作用 |
| --- | --- |
| `bluecode_apply(code, anchor?, mode?)` | 并集式应用代码片段。默认插入到当前函数 `end` 前。 |
| `bluecode_apply_variables(variables)` | 并集式添加/更新变量,不删除未提及变量。 |
| `bluecode_connect(connects)` | 处理少量显式数据依赖或 pin 连接,作为 escape hatch。 |
| `bluecode_compile()` | 编译当前 Blueprint,返回紧凑诊断。 |

写入原则:

- 写操作只能追加或覆盖匹配到的节点、变量、连接。
- 如果输入片段省略了既有节点,不视为删除。
- 如果片段与既有节点相似,应按匹配策略复用或在右侧插入,并返回 `merge_report`。
- 无法连接的数据节点应先尝试转换为参数表达式,再尝试 cast,仍失败时放入 `floating_nodes`,并在返回中解释。

匹配优先级建议:

1. 明确 node id 或 stable label。
2. 函数名、成员类、目标对象和参数完全一致。
3. 函数名和关键参数一致。
4. 节点类型一致且邻接节点相似。
5. 无法确认时追加新节点,不覆盖旧节点。

示例:

已有:

```text
main()
PrintString("one")
PrintString("three")
end
```

输入:

```text
PrintString("two")
```

结果:

```text
main()
PrintString("one")
PrintString("three")
PrintString("two")
end
```

如果输入:

```text
main()
PrintString("two")
PrintString("three")
end
```

结果:

```text
main()
PrintString("one")
PrintString("two")
PrintString("three")
end
```

`PrintString("three")` 被匹配为既有节点,`PrintString("two")` 插入到它左侧。

## 删除语义

建议工具:

| Tool | 作用 |
| --- | --- |
| `bluecode_delete(targets, confirm_delete=true)` | 删除节点、变量或连接。必须显式确认。 |

删除必须满足:

- 未传 `confirm_delete=true` 时失败。
- target 必须是稳定 ID、稳定 label、变量名或连接描述。
- 匹配多个对象时失败,并返回候选。
- 删除返回 `deleted_count`、`affected_edges` 和 `new_flow_summary`。

## 当前过渡工具

当前默认 Blueprint MCP 只保留:

- `set_edit_function`
- `add_step`
- `prepare_value`
- `connect_data_to_pin`
- `add_variable`
- `get_variables`
- `get_function_nodes`
- `set_cursor_node`
- `search_function_library`
- `compile_blueprint`

隐藏兼容命令:

- `delete_node`
- `delete_variable`

这些删除命令后端仍存在,但默认 MCP prompt 和 Blueprint ToolMode 不暴露。它们需要在后续实现 `confirm_delete=true` 后再重新评估。

## 下一步实现建议

1. 先实现 `bluecode_read_function`,把当前节点图压缩成代码式摘要。
2. 再实现 `bluecode_apply`,内部可复用现有 `add_step`、`prepare_value`、`connect_data_to_pin`。
3. 最后实现 `bluecode_delete`,替代旧节点级删除。
4. 保留旧节点工具作为 backend compatibility,逐步从默认 prompts 中移除。
Loading
Loading