Fast Ref API
/
Overview
Fast Ref API — 概览
下载 MarkdownFast Ref API 是供外部脚本自动化 Fast Ref 工作流的 Python 接口。
v2 主要变更
| 项目 | v1 | v2 |
|---|---|---|
| Import | 必须写 5 行 sys.path 样板 | 一行:from os_fast_ref.api import FastRefAPI |
| 公开方法数 | 16 | 30 |
| 写操作 | 部分场景状态可能弹出确认框 | 始终 silent(无确认框) |
| FBX 导出 | 仅 fbx_options=dict |
新增 preset= 关键字 |
| Alembic 导出 | 无 | export_abc / export_abc_all / get_abc_default_options |
| Get Nodes | 无(仅旧 select_*) |
7 个 get_*(查询 + 可选场景选择) |
| slot 类型校验 | 仅范围/空槽位 | 增加 int 类型校验(含 bool) |
| Max 支持版本 | 2022 / 2025 | 2022 / 2025 / 2027 |
设计原则
| 项目 | 方针 |
|---|---|
| 读取(READ) | 无需 UI — 直接从场景 InfoNode 读取 |
| 写入(WRITE) | 独立于 UI + 始终 silent |
| 数据加载 | 使用会话内缓存 |
| FBX / Alembic 选项 | preset 关键字或 dict(+ Export Type: ExportMeshes/ExportBones) |
| 公开表面 | 30 个(semver 承诺) |
API 方法列表(30 个)
| 分类 | 方法 | 说明 |
|---|---|---|
| 查询 | get_reference_list() |
返回场景中的引用列表 |
| 查询 | check_file_status() |
检查源文件最新/变更/缺失状态 |
| 查询 | get_outdated_references() |
仅返回 OUTDATED 引用 [v2 新增] |
| 查询 | get_fbx_default_options() |
查询当前 FBX 默认预设选项 |
| 查询 | get_abc_default_options() |
查询当前 Alembic 默认预设选项 |
| 查询 | refresh() |
强制重新扫描 InfoNode [v2 新增] |
| 节点查询 | get_all_objects() |
查询槽位全部引用节点(可选场景选择) |
| 节点查询 | get_skin_meshes() |
查询蒙皮网格节点(可选场景选择) |
| 节点查询 | get_skin_bones() |
查询蒙皮骨骼节点(可选场景选择) |
| 节点查询 | get_all_skin_objects() |
查询蒙皮网格+骨骼(可选场景选择) |
| 节点查询 | get_duplicate_nodes() |
查询重复名节点(可选场景选择) |
| 节点查询 | get_biped_com() |
查询 Biped COM 节点(可选场景选择) |
| 节点查询 | get_biped_nodes() |
查询全部 Biped 节点(可选场景选择) |
| 管理 | add_reference() |
添加引用 |
| 管理 | remove_reference() |
移除引用 |
| 管理 | replace_reference() |
替换引用文件 |
| 管理 | reload_reference() |
重载单个引用 |
| 管理 | reload_all_references() |
重载全部引用 |
| 管理 | reload_outdated_references() |
仅重载 OUTDATED 引用 [v2 新增] |
| FBX 导出 | export_fbx() |
导出单个引用为 FBX(preset / Export Type) |
| FBX 导出 | export_fbx_all() |
批量导出全部引用为 FBX(preset / Export Type) |
| Alembic 导出 | export_abc() |
导出单个引用为 Alembic(preset / Export Type) |
| Alembic 导出 | export_abc_all() |
批量导出全部引用为 Alembic |
| 高级 | merge_reference() |
将单个引用转换为场景对象 |
| 高级 | merge_all_references() |
批量转换全部引用 |
| 高级 | set_space_activate() |
切换命名空间 ON/OFF |
| 高级 | set_unpack() |
切换 Unpack ON/OFF |
| 高级 | convert_to_reference() |
将所选对象转换为引用 |
| 高级 | set_namespace() |
更改命名空间 |
| UI | update_ui() |
手动刷新 Fast Ref UI |
@@block9a-ko
Fast_Ref Export Type (FBX + Alembic)
FBX / Alembic 모두 동일한 Fast_Ref Options 키로 최종 select를 필터합니다.
ExportMeshes/ExportBones(기본True) — 둘 다False→ FAIL FASTResetRoot는 Export Type과 무관하게 전체 bone list로 먼저 처리- FBX의
Skin은 FBX API(스킨/웨이트) 전용 — 노드 선택 필터가 아님
# FBX
api.export_fbx(
slot=0,
output_path=r"J:\output\char_mesh.fbx",
fbx_options={"ExportMeshes": True, "ExportBones": False},
)
# Alembic (preset 예: Unreal_UE5, Unity_ABC)
api.export_abc(
slot=0,
output_path=r"J:\output\char.abc",
preset="Unreal_UE5",
abc_options={"ExportMeshes": True, "ExportBones": False},
)
@@block9a-en
Fast_Ref Export Type (FBX + Alembic)
FBX and Alembic share the same Fast_Ref Options keys for the final select filter.
ExportMeshes/ExportBones(defaultTrue) — bothFalse→ FAIL FASTResetRootuses the full bone list first, independent of Export Type- FBX
Skinis FBX API (skin/weights) only — not the node selection filter
# FBX
api.export_fbx(
slot=0,
output_path=r"J:\output\char_mesh.fbx",
fbx_options={"ExportMeshes": True, "ExportBones": False},
)
# Alembic (presets e.g. Unreal_UE5, Unity_ABC)
api.export_abc(
slot=0,
output_path=r"J:\output\char.abc",
preset="Unreal_UE5",
abc_options={"ExportMeshes": True, "ExportBones": False},
)
@@block9a-ja
@@block9a-zh
@@block9b-ko
Namespace Rename (v2.1 신규)
set_namespace()를 사용하면 대화상자 없이 레퍼런스의 네임스페이스를 변경할 수 있습니다. 파이프라인 스크립트에서 자동화된 이름 변경이 필요할 때 사용합니다.
api.set_namespace(slot=0, namespace="Enemy_A")
- 중복 네임스페이스 사용 시 즉시
ValueError발생. - 이미 같은 이름이면 씬을 수정하지 않고 성공 반환 (no-op).
@@block9b-en
Namespace Rename (v2.1 new)
set_namespace() renames a reference namespace without any dialog — ideal for automated pipeline scripts.
api.set_namespace(slot=0, namespace="Enemy_A")
- Duplicate namespace raises
ValueErrorimmediately. - If the name is unchanged, returns success without modifying the scene (no-op).
@@block9b-ja
@@block9b-zh
Error Handling Rules
| Situation | Behavior |
|---|---|
| File does not exist | Raises FileNotFoundError |
| Invalid slot number / empty slot | Raises ValueError |
| slot is not int (including bool) | Raises TypeError [v2 new] |
| Non-existent FBX / Alembic preset name | Raises ValueError |
| Invalid argument type | Raises TypeError |
| License authentication failure | Raises PermissionError during initialization |
| Operation failure (recoverable) | Returns {"success": False, ...} |