cli-anything-blender

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

cli-anything-blender

cli-anything-blender

A stateful command-line interface for 3D scene editing, following the same patterns as the GIMP CLI harness. Uses a JSON scene description format with bpy script generation for actual Blender rendering.
一款遵循GIMP CLI框架模式的、用于3D场景编辑的有状态命令行界面。它采用JSON场景描述格式,并通过生成bpy脚本实现Blender的实际渲染。

Installation

安装

This CLI is installed as part of the cli-anything-blender package:
bash
pip install cli-anything-blender
Prerequisites:
  • Python 3.10+
  • blender (>= 4.2) must be installed on your system
该CLI作为cli-anything-blender包的一部分进行安装:
bash
pip install cli-anything-blender
前提条件:
  • Python 3.10及以上版本
  • 系统中必须安装Blender(版本≥4.2)

Usage

使用方法

Basic Commands

基础命令

bash
undefined
bash
undefined

Show help

显示帮助信息

cli-anything-blender --help
cli-anything-blender --help

Start interactive REPL mode

启动交互式REPL模式

cli-anything-blender
cli-anything-blender

Create a new project

创建新项目

cli-anything-blender project new -o project.json
cli-anything-blender project new -o project.json

Run with JSON output (for agent consumption)

以JSON格式输出(供Agent使用)

cli-anything-blender --json project info -p project.json
undefined
cli-anything-blender --json project info -p project.json
undefined

REPL Mode

REPL模式

When invoked without a subcommand, the CLI enters an interactive REPL session:
bash
cli-anything-blender
当不指定子命令调用时,CLI会进入交互式REPL会话:
bash
cli-anything-blender

Enter commands interactively with tab-completion and history

以交互式方式输入命令,支持标签补全和历史记录

undefined
undefined

Command Groups

命令组

Scene

场景

Scene management commands.
CommandDescription
new
Create a new scene
open
Open an existing scene
save
Save the current scene
info
Show scene information
profiles
List available scene profiles
json
Print raw scene JSON
场景管理命令。
命令描述
new
创建新场景
open
打开现有场景
save
保存当前场景
info
显示场景信息
profiles
列出可用的场景配置文件
json
打印原始场景JSON数据

Object Group

对象组

3D object management commands.
CommandDescription
add
Add a 3D primitive object
remove
Remove an object by index
duplicate
Duplicate an object
transform
Transform an object (translate, rotate, scale)
set
Set an object property (name, visible, location, rotation, scale, parent)
list
List all objects
get
Get detailed info about an object
3D对象管理命令。
命令描述
add
添加3D基础几何体对象
remove
通过索引删除对象
duplicate
复制对象
transform
变换对象(平移、旋转、缩放)
set
设置对象属性(名称、可见性、位置、旋转、缩放、父对象)
list
列出所有对象
get
获取对象的详细信息

Material

材质

Material management commands.
CommandDescription
create
Create a new material
assign
Assign a material to an object
set
Set a material property (color, metallic, roughness, specular, alpha, etc.)
list
List all materials
get
Get detailed info about a material
材质管理命令。
命令描述
create
创建新材质
assign
为对象分配材质
set
设置材质属性(颜色、金属度、粗糙度、高光、透明度等)
list
列出所有材质
get
获取材质的详细信息

Modifier Group

修改器组

Modifier management commands.
CommandDescription
list-available
List all available modifiers
info
Show details about a modifier
add
Add a modifier to an object
remove
Remove a modifier by index
set
Set a modifier parameter
list
List modifiers on an object
修改器管理命令。
命令描述
list-available
列出所有可用的修改器
info
显示修改器的详细信息
add
为对象添加修改器
remove
通过索引删除修改器
set
设置修改器参数
list
列出对象上的所有修改器

Camera

相机

Camera management commands.
CommandDescription
add
Add a camera to the scene
set
Set a camera property
set-active
Set the active camera
list
List all cameras
相机管理命令。
命令描述
add
向场景中添加相机
set
设置相机属性
set-active
设置激活相机
list
列出所有相机

Light

灯光

Light management commands.
CommandDescription
add
Add a light to the scene
set
Set a light property
list
List all lights
灯光管理命令。
命令描述
add
向场景中添加灯光
set
设置灯光属性
list
列出所有灯光

Animation

动画

Animation and keyframe commands.
CommandDescription
keyframe
Set a keyframe on an object
remove-keyframe
Remove a keyframe from an object
frame-range
Set the animation frame range
fps
Set the animation FPS
list-keyframes
List keyframes for an object
动画与关键帧命令。
命令描述
keyframe
为对象设置关键帧
remove-keyframe
从对象中删除关键帧
frame-range
设置动画帧范围
fps
设置动画帧率(FPS)
list-keyframes
列出对象的所有关键帧

Render Group

渲染组

Render settings and output commands.
CommandDescription
settings
Configure render settings
info
Show current render settings
presets
List available render presets
execute
Render the scene (generates bpy script)
script
Generate bpy script without rendering
渲染设置与输出命令。
命令描述
settings
配置渲染设置
info
显示当前渲染设置
presets
列出可用的渲染预设
execute
渲染场景(生成bpy脚本)
script
生成bpy脚本但不执行渲染

Session

会话

Session management commands.
CommandDescription
status
Show session status
undo
Undo the last operation
redo
Redo the last undone operation
history
Show undo history
会话管理命令。
命令描述
status
显示会话状态
undo
撤销上一步操作
redo
重做上一步撤销的操作
history
显示撤销历史记录

Examples

示例

Create a New Project

创建新项目

Create a new blender project file.
bash
cli-anything-blender project new -o myproject.json
创建新的Blender项目文件。
bash
cli-anything-blender project new -o myproject.json

Or with JSON output for programmatic use

或以JSON格式输出供程序化调用

cli-anything-blender --json project new -o myproject.json
undefined
cli-anything-blender --json project new -o myproject.json
undefined

Interactive REPL Session

交互式REPL会话

Start an interactive session with undo/redo support.
bash
cli-anything-blender
启动支持撤销/重做的交互式会话。
bash
cli-anything-blender

Enter commands interactively

交互式输入命令

Use 'help' to see available commands

使用'help'查看可用命令

Use 'undo' and 'redo' for history navigation

使用'undo'和'redo'进行历史记录导航

undefined
undefined

State Management

状态管理

The CLI maintains session state with:
  • Undo/Redo: Up to 50 levels of history
  • Project persistence: Save/load project state as JSON
  • Session tracking: Track modifications and changes
该CLI通过以下方式维护会话状态:
  • 撤销/重做:最多支持50级历史记录
  • 项目持久化:以JSON格式保存/加载项目状态
  • 会话跟踪:跟踪所有修改与变更

Output Formats

输出格式

All commands support dual output modes:
  • Human-readable (default): Tables, colors, formatted text
  • Machine-readable (
    --json
    flag): Structured JSON for agent consumption
bash
undefined
所有命令支持两种输出模式:
  • 人类可读格式(默认):表格、彩色文本、格式化内容
  • 机器可读格式
    --json
    参数):结构化JSON格式,供Agent使用
bash
undefined

Human output

人类可读格式输出

cli-anything-blender project info -p project.json
cli-anything-blender project info -p project.json

JSON output for agents

供Agent使用的JSON格式输出

cli-anything-blender --json project info -p project.json
undefined
cli-anything-blender --json project info -p project.json
undefined

For AI Agents

面向AI Agent的使用说明

When using this CLI programmatically:
  1. Always use
    --json
    flag
    for parseable output
  2. Check return codes - 0 for success, non-zero for errors
  3. Parse stderr for error messages on failure
  4. MANDATORY: Use absolute paths for all file operations (rendering, project files). Relative paths are prone to failure in background execution.
  5. Verify outputs exist after export operations
当以程序化方式使用该CLI时:
  1. 始终使用
    --json
    参数
    以获得可解析的输出
  2. 检查返回码——0表示成功,非0表示出错
  3. 解析stderr以获取失败时的错误信息
  4. 强制要求:所有文件操作(渲染、项目文件)使用绝对路径。相对路径在后台执行时容易失败。
  5. 导出操作后验证输出是否存在

More Information

更多信息

  • Full documentation: See README.md in the package
  • Test coverage: See TEST.md in the package
  • Methodology: See HARNESS.md in the cli-anything-plugin
  • 完整文档:查看包中的README.md
  • 测试覆盖率:查看包中的TEST.md
  • 实现方法:查看cli-anything-plugin中的HARNESS.md

Version

版本

1.0.0
1.0.0