技能版本 1.0.0

godot-tscn-format

Godot .tscn 场景文件格式规范。让 AI 能够直接读写 Godot 场景文件,理解节点树结构、外部/内嵌资源引用、Transform 变换、信号连接等。当需要创建或修改 .tscn 文件时使用此 Skill。

价格

免费

  • 安装:免费

在组织开通时一次性收取;再次读取清单或下载不重复收费。

以上为公开标价。你的组织可能有协议价,以控制台显示的价格为准。

如何使用

  1. 为组织安装

    开通即安装:组织固定使用开通时的版本(当前为 1.0.0)。升级到新版本需要取消后重新开通。

  2. 创建凭证

    客户端使用组织凭证读取;绑定到数字人后,数字人使用绑定凭证按需加载。请求中携带:

    Authorization: Bearer $ZGI_MARKET_KEY

  3. 读取清单与安装包

    清单列出版本、文件和校验值;安装包是一个 zip 文件。

    读取清单
    curl "https://market-api.zgi.im/v1/market/skills/godot-tscn-format/manifest" \
      -H "Authorization: Bearer $ZGI_MARKET_KEY"
    下载安装包
    curl "https://market-api.zgi.im/v1/market/skills/godot-tscn-format/package" \
      -H "Authorization: Bearer $ZGI_MARKET_KEY" \
      -o godot-tscn-format.zip

    读取清单和下载安装包不计入用量。下载后请用响应头中的 SHA-256 校验文件。

技能说明

名称
godot-tscn-format
说明
Godot .tscn 场景文件格式规范。让 AI 能够直接读写 Godot 场景文件,理解节点树结构、外部/内嵌资源引用、Transform 变换、信号连接等。当需要创建或修改 .tscn 文件时使用此 Skill。
仅指令

技能包内没有脚本文件:这个技能是供模型阅读的文本。

SKILL.md 节选

# Godot .tscn 场景文件格式规范

> **用途**:让 AI 能够直接读写 Godot 场景文件  
> **版本**:v1.0 · 2026-04-24  
> **适用引擎**:Godot 4.x

---

## 核心原则

**Godot 场景文件是纯文本**,AI 可以直接通过 `write_to_file` 和 `replace_in_file` 操作,无需任何中间层。

---

## 一、文件结构总览

```
[gd_scene load_steps=N format=3 uid="uid://xxx"]    ← 头部(必需)

[ext_resource type="Type" path="res://..." id="ID"]  ← 外部资源引用(可选)
[ext_resource ...]

[sub_resource type="Type" id="ID"]                   ← 内嵌资源定义(可选)
property = value
[sub_resource ...]

[node name="Name" type="Type"]                       ← 根节点(必需)
property = value

[node name="Child" type="Type" parent="."]           ← 子节点
property = value

[connection signal="sig" from="Node" to="Target" method="func"]  ← 信号连接(可选)
```

---

## 二、头部声明

### 2.1 基本格式

```
[gd_scene load_steps=4 format=3]
```

| 字段 | 说明 |
|------|------|
| `load_steps` | 资源加载步数 = ext_resource 数 + sub_resource 数 + 1(场景本身) |
| `format` | 固定为 `3`(Godot 4.x) |
| `uid` | 可选,Godot 自动生成的唯一 ID,创建时可省略 |

### 2.2 计算 load_steps

```python
load_steps = len(ext_resources) + len(sub_resources) + 1
```

示例:2 个外部资源 + 3 个内嵌资源 → `load_steps=6`

---

## 三、外部资源引用 (ext_resource)

### 3.1 格式

```
[ext_resource type="Type" path="res://path/to/file" id="ID"]
```

### 3.2 常见类型

| type | 文件类型 | 示例 |
|------|----------|------|
| `Script` | GDScript | `path="res://scripts/player.gd"` |
| `PackedScene` | 场景 | `path="res://scenes/enemy.tscn"` |
| `Material` | 材质资源 | `path="res://materials/floor.tres"` |
| `Texture2D` | 2D 纹理 | `path="res://textures/icon.png"` |
| `AudioStream` | 音频 | `path="res://audio/shoot.wav"` |
| `Shader` | 着色器 | `path="res://shaders/outline.gdshader"` |

### 3.3 ID 命名规范

AI 生成时使用有意义的 ID:
```
[ext_resource type="Script" path="res://scripts/player.gd" id="1_player_script"]
[ext_resource type="Material" path="res://resources/floor_mat.tres" id="2_floor_mat"]
[ext_resource type="PackedScene" path="res://scenes/bullet.tscn" id="3_bullet_scene"]
```

---

## 四、内嵌资源定义 (sub_resource)

### 4.1 格式

```
[sub_resource type="Type" id="ID"]
property1 = value1
property2 = value2
```

### 4.2 常用碰撞形状

```
# 胶囊体(角色常用)
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_player"]
radius = 0.35
height = 1.8

# 球体
[sub_resource type="SphereShape3D" id="SphereShape3D_001"]
radius = 0.5

# 盒子
[sub_resource type="BoxShape3D" id="BoxShape3D_floor"]
size = Vector3(10, 0.2, 10)

# 圆柱体
[sub_resource type="CylinderShape3D" id="CylinderShape3D_001"]
height = 2.0
radius = 0.5

# 2D 形状
[sub_resource type="RectangleShape2D" id="RectangleShape2D_001"]
size = Vector2(32, 32)

[sub_resource type="CircleShape2D" id="CircleShape2D_001"]
radius = 16.0
```

### 4.3 常用网格

```
# 盒子网格
[sub_resource type="BoxMesh" id="BoxMesh_001"]
size = Vector3(1, 1, 1)

# 球体网格
[sub_resource type="SphereMesh" id="SphereMesh_001"]
radius = 0.5
height = 1.0

# 胶囊网格
[sub_resource type="CapsuleMesh" id="CapsuleMesh_001"]
radius = 0.5
height = 2.0

# 圆柱网格
[sub_resource type="CylinderMesh" id="CylinderMesh_001"]
top_radius = 0.5
bottom_radius = 0.5
height = 2.0

# 平面网格
[sub_resource type="PlaneMesh" id="PlaneMesh_001"]
size = Vector2(10, 10)
```

### 4.4 材质(内嵌)

```
[sub_resource type="StandardMaterial3D" id="Material_red"]
albedo_color = Color(1, 0, 0, 1)
roughness = 0.8
metallic = 0.2

# 发光材质
[sub_resource type="StandardMaterial3D" id="Material_glow"]
emission_enabled = true
emission = Color(1, 0.8, 0, 1)
emission_energy_multiplier = 2.0
```

---

## 五、节点声明 (node)

### 5.1 根节点

```
[node name="Player" type="CharacterBody3D"]

SKILL.md 不止这些内容,安装后可阅读全文。

技能包内容

共 1 个文件,合计 11.1 KiB

  • SKILL.md11.1 KiB

来源与审核

审核状态
尚未审核,内容来自上游来源
许可证
未说明

审核状态是平台对上架信息的记录,不构成对上游服务质量或可用性的担保。