# material

> Material and shader operations. Read: read. Write: set_params, create, save, load. Shader: shader_read, shader_write, shader_load_file, shader_save_file, shader_list_templates, shader_apply_template. 运行时操作，仅影响当前执行上下文。如需持久化，请编辑 .tscn 文件。

| 属性 | 值 |
|------|-----|
| 所属层 | headless |
| 安全级别 | guarded |
| 需要 Godot | 是 |
| 需要编辑器 | 否 |
| 只读 | 否 |
| 长耗时 | 否 |

## Actions

- `read`
- `set_params`
- `create`
- `save`
- `load`
- `shader_read`
- `shader_write`
- `shader_load_file`
- `shader_save_file`
- `shader_list_templates`
- `shader_apply_template`

## Parameters

| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| `action` | enum (11 项) | ✓ | Operation type |
| `project_path` | string |  | Godot project directory path |
| `node_path` | string |  | Scene tree node path |
| `material_index` | number |  | Material index (optional, default 0) |
| `params` | object |  | set_params: parameter key-value pairs |
| `material_type` | string |  | create: material type |
| `shader_path` | string |  | create: shader resource path |
| `resource_path` | string |  | save/load: resource path |
| `code` | string |  | shader_write/shader_save_file: shader code |
| `file_path` | string |  | shader_load_file/shader_save_file: file path |
| `template_name` | string |  | shader_apply_template: template name |
| `load_autoloads` | boolean |  | Load Autoload context (default true) |

## 风险分布

读 3 / 写 8

---
<!-- AUTO-GENERATED by scripts/gen-tool-docs.mjs from capability-matrix.json v0.32.21. DO NOT edit manually; re-run npm run gen:tool-docs after tool changes. -->
