texturecraft

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

TextureCraft

TextureCraft

Operate TextureCraft through its structured automation interface. Preserve the user's requested texturing workflow and target texture set.
通过结构化自动化接口操作 TextureCraft。保留用户所请求的纹理绘制工作流和目标纹理集。

Protocol reference

协议参考

Read the relevant sections of references/control-protocol.md before constructing calls. This is the downloaded upstream protocol, captured on 2026-11-04.
Useful sections: the Control channel method table, the MCP server tool table, MaterialCraft materials, and CLI. Relative links inside the downloaded document refer to upstream documentation; resolve them against
https://github.com/storytold/texturecraft/blob/main/docs/
when needed. The document lists example commands, not the full command library: discover command ids, labels, parameter docs and current enabled state at runtime with
command.list {filter?}
(MCP:
command_list
) instead of inventing ids.
在构建调用前,阅读 references/control-protocol.md 的相关章节。这是下载的上游协议,捕获于 2026-11-04。
有用章节:Control channel 方法表、MCP server 工具表、MaterialCraft materials 和 CLI。下载文档中的相对链接指向上游文档;需要时,应基于
https://github.com/storytold/texturecraft/blob/main/docs/
解析。该文档列出的是示例命令,而非完整命令库:应在运行时使用
command.list {filter?}
(MCP:
command_list
)发现命令 ID、标签、参数文档和当前启用状态,而不是凭空编造 ID。

Locate the executables

定位可执行文件

texturecraft
and
texturecraft-cli
may not be on
PATH
even when TextureCraft is installed. Discover them before assuming anything is missing, and never invent a path — search for it:
  1. PATH:
    command -v texturecraft texturecraft-cli
    (POSIX) or
    where texturecraft texturecraft-cli
    (Windows).
  2. macOS: look for
    TextureCraft.app
    in
    /Applications
    and
    ~/Applications
    , or run
    mdfind -name TextureCraft.app
    ; the binary inside
    Contents/MacOS/
    is the desktop app.
  3. Linux: AppImage, Flatpak, deb/rpm, or tarball installs; the CLI may be a separate download.
  4. Built from source:
    cargo run --release -p texturecraft
    and
    cargo run --release -p texturecraft-cli -- …
    .
即使已安装 TextureCraft,
texturecraft
和
texturecraft-cli
也可能不在
PATH
中。在假定任何内容缺失前应先发现它们,绝不能臆造路径——请搜索:
  1. PATH:
    command -v texturecraft texturecraft-cli
    (POSIX)或
    where texturecraft texturecraft-cli
    (Windows)。
  2. macOS: 在
    /Applications
    和
    ~/Applications
    中查找
    TextureCraft.app
    ,或运行
    mdfind -name TextureCraft.app
    ;桌面应用的可执行文件位于
    Contents/MacOS/
    中。
  3. Linux: AppImage、Flatpak、deb/rpm 或 tarball 安装;CLI 可能需要单独下载。
  4. 从源代码构建:
    cargo run --release -p texturecraft
    和
    cargo run --release -p texturecraft-cli -- …
    。

Select the session

选择会话

  • For a user's open project or visible application, use a TextureCraft MCP bridge (
    texturecraft-cli mcp --bridge <port>
    ) or the app's control channel (
    texturecraft --control <port>
    ). A headless session has its own in-process project and cannot edit the user's live window.
  • For unattended file processing, use headless MCP (
    texturecraft-cli mcp --read-root DIR --write-root DIR
    ), the JSON-lines server (
    texturecraft-cli serve [--port <port>]
    ), or one-shot CLI subcommands (
    new
    ,
    run
    ,
    batch
    ,
    bake
    ,
    export
    ,
    render
    ,
    info
    ).
The control channel requires an
auth
request first on every connection: token from
TEXTURECRAFT_CONTROL_TOKEN
or the file
<temp>/texturecraft-control-<port>.token
. Then one JSON object per line,
{"id", "method", "params"}
; match replies by
id
and check
ok
. Set
TEXTURECRAFT_NO_PREFS
(any value) for scripted runs so the user's layout and settings are left alone. Keep TCP on loopback and credentials in a private token file; do not print, commit, or expose tokens in command arguments.
  • 对于用户已打开的项目或可见应用,使用 TextureCraft MCP 桥接(
    texturecraft-cli mcp --bridge <port>
    )或应用的控制通道(
    texturecraft --control <port>
    )。无头会话拥有自己的进程内项目,无法编辑用户当前可见的窗口。
  • 对于无人值守的文件处理,使用无头 MCP(
    texturecraft-cli mcp --read-root DIR --write-root DIR
    )、JSON-lines 服务器(
    texturecraft-cli serve [--port <port>]
    )或单次执行的 CLI 子命令(
    new
    、
    run
    、
    batch
    、
    bake
    、
    export
    、
    render
    、
    info
    )。
控制通道要求每次连接时首先发送
auth
请求:令牌来自
TEXTURECRAFT_CONTROL_TOKEN
或文件
<temp>/texturecraft-control-<port>.token
。随后每行传入一个 JSON 对象
{"id", "method", "params"}
;通过
id
匹配响应并检查
ok
。脚本运行时设置
TEXTURECRAFT_NO_PREFS
(任意值),避免改动用户的布局和设置。TCP 应保持在环回地址上,凭据应存放在私有令牌文件中;不要打印、提交令牌,也不要在命令参数中暴露令牌。

Inspect, edit, and verify

检查、编辑和验证

Inspect before editing:
session.inspect
returns the project, mesh, texture sets, the layer stack with every layer, mask, effect and fill source, painted tile counts, the tool, camera, display and history — an agent can verify most work without a screenshot.
project.inspect
shows a
.mcmat
fill layer's
link
(the MaterialCraft graph's exposed inputs, presets and image inputs).
Edit through engine commands via
command.run
:
project.new {mesh?, resolution?, name?, template?}
(built-in meshes:
material_ball
,
sphere
,
cube
,
rounded_cube
,
cylinder
,
torus
,
plane
,
crate
),
layer.add.fill {color?, roughness?, metallic?, …}
,
layer.add.image
,
mask.add.black
,
effect.add.generator {generator: "edgeWear"|…}
,
textureSet.meshMap.set
/
textureSet.meshMap.clear
for imported mesh maps,
bake.run {resolution?, maps?}
,
material.apply {material}
, and painting through
tool.stroke
(or the MCP
paint_stroke
tool, whose points are viewport pixels).
edit.undo {steps?}
/
edit.redo {steps?}
move through history; any command accepts
merge: true
to fold its edit into the previous undo step.
Commands run programmatically and never open dialogs. Use
ui.menu.invoke
only when interactive menu behavior is intended. In the app,
ui.set
can change layout, dock, preferences (language, brightness, accent) and keymap;
debug.paintTest
and
debug.frames
exist for performance work.
Verify visually and structurally: re-run
session.inspect
, then render —
viewport.screenshot {view: "3d"|"2d"}
(app),
viewport_render
(MCP;
samples
up to 4096 path-traces the 3D view),
render
(JSON-lines), or
texturecraft-cli render project.tcraft out.png --size 1280x800 --yaw 30 --pitch 15
(CLI). Stroke points and render sizes share one space: the default render size is the session viewport (1280×800), so
paint_stroke
points can be read straight off a
viewport_render
image.
编辑前先进行检查:
session.inspect
返回项目、网格、纹理集、包含每个图层、蒙版、效果和填充源的图层堆栈、已绘制图块数量、工具、相机、显示设置和历史记录——Agent 无需截图即可验证大部分工作。
project.inspect
显示
.mcmat
填充图层的
link
(MaterialCraft 图的公开输入、预设和图像输入)。
通过
command.run
使用引擎命令进行编辑:
project.new {mesh?, resolution?, name?, template?}
(内置网格:
material_ball
、
sphere
、
cube
、
rounded_cube
、
cylinder
、
torus
、
plane
、
crate
)、
layer.add.fill {color?, roughness?, metallic?, …}
、
layer.add.image
、
mask.add.black
、
effect.add.generator {generator: "edgeWear"|…}
、用于导入网格贴图的
textureSet.meshMap.set
/
textureSet.meshMap.clear
、
bake.run {resolution?, maps?}
、
material.apply {material}
,以及通过
tool.stroke
进行绘制(或使用 MCP
paint_stroke
工具,其 points 为视口像素)。
edit.undo {steps?}
/
edit.redo {steps?}
可在历史记录中前后移动;任何命令都接受
merge: true
,用于将当前编辑合并到上一个撤销步骤中。
命令以编程方式运行,不会打开对话框。仅当需要交互式菜单行为时才使用
ui.menu.invoke
。在应用中,
ui.set
可更改布局、停靠面板、首选项(语言、亮度、强调色)和按键映射;
debug.paintTest
和
debug.frames
可用于性能工作。
从视觉和结构两方面进行验证:重新运行
session.inspect
,然后进行渲染——
viewport.screenshot {view: "3d"|"2d"}
(应用)、
viewport_render
(MCP;
samples
最多为 4096 时会对 3D 视图执行路径追踪)、
render
(JSON-lines),或
texturecraft-cli render project.tcraft out.png --size 1280x800 --yaw 30 --pitch 15
(CLI)。笔划点和渲染尺寸共用同一坐标空间:默认渲染尺寸为会话视口大小(1280×800),因此可以直接从
viewport_render
图像读取
paint_stroke
的 points。

File access and output

文件访问和输出

Headless file access is workspace-scoped by launch-time roots (
--read-root
/
--write-root
); use task-scoped roots and forward-slash relative paths within them.
..
, absolute paths, drive letters and symlink escapes are refused. Do not bypass rejected paths by switching to ambient filesystem commands. Through
command_run
, path-carrying commands (
file.*
except
file.close
/
file.removeUnused
,
resource.import
,
material.save
, …) are refused in both MCP modes: use the dedicated tools.
  • Projects:
    project_open {path}
    (
    .tcraft
    or a mesh file) /
    project_save {path?}
    ; in bridge mode
    project_save
    without a path invokes File › Save. Meshes:
    mesh_import {path, resolution?}
    (glTF/GLB, FBX, COLLADA, USD, Alembic, OBJ, PLY, STL),
    mesh_reimport
    ,
    mesh_export {path, format?}
    (textured obj, glb, usd).
  • Resources and baking:
    resource_import {path}
    embeds an image (for
    layer.add.image
    or
    tool.stencil
    , or as a mesh map via
    textureSet.meshMap.set
    );
    bake_mesh_add {path, cage?}
    adds a high-poly mesh;
    bake {resolution?, maps?, cpu?}
    bakes mesh maps, on the GPU when there is one.
  • Materials:
    material_save {path, layer?, name?}
    writes a
    .tcmat
    smart material;
    material_load {path}
    reads
    .tcmat
    , a MaterialCraft
    .mcmat
    or
    .mcraft
    package; drive
    .mcmat
    inputs with
    material.link.set
    /
    material.link.preset
    /
    material.link.cook
    (re-cooks call
    materialcraft-cli
    , found via
    $MATERIALCRAFT_CLI
    or next to the executable).
  • Textures:
    textures_export {dir, preset?, ts?, format?, padding?, size?}
    writes engine-ready maps (PNG, JPEG, TGA, TIFF, BMP, WEBP, EXR, HDR at 8, 16 or 32 bits); CLI:
    texturecraft-cli export model.tcraft out/ --preset "Unreal Engine (Packed)"
    .
  • Report successful saves and exports with the exact output path and format. Do not overwrite the user's source project unless asked; save a copy under a new name.
无头文件访问受启动时指定的根目录限制(
--read-root
/
--write-root
);应使用任务范围的根目录,并在其中使用正斜杠相对路径。
..
、绝对路径、驱动器号和符号链接越界均会被拒绝。不要改用外部文件系统命令来绕过被拒绝的路径。通过
command_run
执行时,两种 MCP 模式都会拒绝带路径的命令(
file.*
除外,但不包括
file.close
/
file.removeUnused
、
resource.import
、
material.save
等);应改用专用工具。
  • 项目:
    project_open {path}
    (
    .tcraft
    或网格文件)/
    project_save {path?}
    ;在桥接模式下,不带路径调用
    project_save
    会触发 File › Save。网格:
    mesh_import {path, resolution?}
    (glTF/GLB、FBX、COLLADA、USD、Alembic、OBJ、PLY、STL)、
    mesh_reimport
    、
    mesh_export {path, format?}
    (带纹理的 obj、glb、usd)。
  • 资源和烘焙:
    resource_import {path}
    可嵌入图像(用于
    layer.add.image
    或
    tool.stencil
    ,也可通过
    textureSet.meshMap.set
    作为网格贴图);
    bake_mesh_add {path, cage?}
    添加高模网格;
    bake {resolution?, maps?, cpu?}
    烘焙网格贴图,存在 GPU 时会使用 GPU。
  • 材质:
    material_save {path, layer?, name?}
    写入
    .tcmat
    智能材质;
    material_load {path}
    读取
    .tcmat
    、MaterialCraft
    .mcmat
    或
    .mcraft
    包;使用
    material.link.set
    /
    material.link.preset
    /
    material.link.cook
    驱动
    .mcmat
    输入(重新计算会调用
    materialcraft-cli
    ,该命令可通过
    $MATERIALCRAFT_CLI
    或可执行文件所在位置找到)。
  • 纹理:
    textures_export {dir, preset?, ts?, format?, padding?, size?}
    写入引擎可用贴图(PNG、JPEG、TGA、TIFF、BMP、WEBP、EXR、HDR,支持 8、16 或 32 位);CLI:
    texturecraft-cli export model.tcraft out/ --preset "Unreal Engine (Packed)"
    。
  • 报告成功保存和导出的结果时,应提供精确的输出路径和格式。除非用户明确要求,否则不要覆盖用户的源项目;应使用新名称保存副本。

Batches and uncertain outcomes

批处理和不确定结果

Use
command_batch {steps}
(MCP, JSON-lines
command.batch
, or
texturecraft-cli batch script.json
) for known sequences; it stops at the first error and reports
{completed, results, failed}
. Batches are not transactions: earlier steps persist on failure, so inspect per-step results. Replies are capped (8 MiB of JSON, 5 MiB per PNG, 256 batch steps).
After a disconnect or any other unclear failure, run
session.inspect
before retrying a mutation — the command may already have completed. Stop and report unresolved state if inspection cannot determine whether replay is safe.
对于已知操作序列,使用
command_batch {steps}
(MCP、JSON-lines
command.batch
或
texturecraft-cli batch script.json
);它会在首个错误处停止,并报告
{completed, results, failed}
。批处理并非事务:失败时,之前执行的步骤仍会保留,因此需要检查每个步骤的结果。响应存在大小上限(JSON 为 8 MiB、PNG 为 5 MiB、批处理步骤为 256 步)。
断线或发生其他不明确的故障后,重试修改操作前应先运行
session.inspect
——该命令可能已经完成。如果检查后仍无法确定是否可以安全重放,应停止操作并报告未解决的状态。