ui
Build and modify Godot UI at runtime: create controls, arrange containers, set anchors, apply themes, draw recipes. Changes affect the current execution context only, not .tscn files.
Instructions
UI 操作。节点: ui_create_control, ui_container_add, ui_build_layout。布局: ui_set_layout, ui_get_layout, ui_anchor_preset。主题: ui_set_theme, theme_create, theme_set_property。绘图: ui_draw_recipe。运行时操作,仅影响当前执行上下文。如需持久化,请编辑 .tscn 文件。 专属参数(additionalProperties): ui_set_theme→theme_action/theme_path/params; theme_create→theme_create_action/source_node_path/save_path; theme_set_property→theme_node_path/item_type/prop_name/theme_type/value; ui_build_layout→tree({type,name,properties,anchor_preset,layout,flex,children}); ui_draw_recipe→ops([{kind,...}])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | 操作类型 | |
| preset | No | ui_anchor_preset: 锚点预设名称 | |
| anchors | No | ui_set_layout: 锚点 {left, right, top, bottom},值 0-1 | |
| offsets | No | ui_set_layout: 边距 {left, right, top, bottom},像素值 | |
| min_size | No | ui_set_layout: 最小尺寸 {x, y} | |
| node_name | No | ui_create_control: 新节点名称 | |
| node_path | No | 节点路径(ui_set_layout/ui_get_layout/ui_anchor_preset/ui_set_theme/ui_container_add/ui_draw_recipe) | |
| node_type | No | ui_create_control/ui_container_add: Control 子类类型 | |
| child_name | No | ui_container_add: 子节点名称 | |
| child_type | No | ui_container_add: 子节点 Control 类型 | |
| properties | No | ui_create_control: 可选属性(支持 string/number/bool/null) | |
| scene_path | No | 场景路径(相对项目路径)。ui_set_theme/theme_set_property 可选 | |
| parent_path | No | ui_build_layout: 父节点路径 | |
| project_path | No | Godot 项目目录路径 | |
| grow_direction | No | ui_set_layout: 增长方向 | |
| load_autoloads | No | 是否加载 Autoload 上下文(默认 true) | |
| child_properties | No | ui_container_add: 子节点属性(支持 string/number/bool/null) | |
| parent_node_path | No | ui_create_control: 父节点路径(默认 root) | |
| custom_minimum_size | No | ui_set_layout: 自定义最小尺寸 {x, y} |