# Alembic Export Options

## Alembic 옵션 활용 패턴

### Pattern 1 — Named preset (recommended)
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
api.export_abc(slot=0, output_path=r"J:\output\char.abc", preset="Unreal_UE5")
api.export_abc_all(output_folder=r"J:\output", preset="Unity_ABC")
```
존재하지 않는 프리셋 이름은 `ValueError`를 즉시 발생시킵니다.

번들 프리셋: `Unreal_UE5`, `Unity_ABC`

### Pattern 2 — Export Type filter (Meshes / Bones)
최종 `select` 직전 필터입니다. 후보 수집(Auto Skin / Defined Selection Set) 이후에 적용됩니다.
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()

# Meshes only (typical UE Geometry Cache)
api.export_abc(
    slot=0,
    output_path=r"J:\output\char_mesh.abc",
    preset="Unreal_UE5",
    abc_options={"ExportMeshes": True, "ExportBones": False},
)

# Bones only
api.export_abc(
    slot=0,
    output_path=r"J:\output\char_bones.abc",
    abc_options={"ExportMeshes": False, "ExportBones": True},
)
```
둘 다 `False` → FAIL FAST (에러). 기본값은 둘 다 `True`.

> **Reset Root:** Export Type과 무관합니다. 본 목록을 따로 찾아 먼저 Root PRS를 리셋한 뒤, 필터된 노드만 export합니다.

### Pattern 3 — Copy defaults then modify
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
defaults = api.get_abc_default_options()
opts = defaults["options"].copy()
opts["ExportBones"] = False
opts["RemoveNameSpace"] = True
opts["ResetRoot"] = True
api.export_abc(slot=0, output_path=r"J:\output\char.abc", abc_options=opts)
```

### Pattern 4 — preset + partial override
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
api.export_abc(
    slot=0,
    output_path=r"J:\output\char.abc",
    preset="Unreal_UE5",
    abc_options={
        "ExportMeshes": True,
        "ExportBones": False,
        "CoordinateSystem": "yup",
    },
)
```

### Pattern 5 — Defined Selection Set
레퍼런스 INFO에 `fbxExportMode == "Defined"` 와 `fbxExportSelectionSets`가 있으면  
ABC도 FBX와 동일하게 Selection Set별로 파일을 나눕니다.

- 셋 1개 → `{base}.abc`
- 셋 2개 이상 → `{base}_{SetName}.abc`

각 셋의 노드에 Export Type 필터가 다시 적용됩니다.
```python
# Selection Set은 Rig Data Manager / INFO에 미리 저장된 설정을 사용
# API에서 별도 인자 없이 export_abc 호출만 하면 Defined 경로를 탐
api.export_abc(slot=0, output_path=r"J:\output\char.abc", preset="Unreal_UE5")
```

---

## 주요 Alembic 옵션 목록
| 키 | 타입 | 설명 |
| --- | --- | --- |
| `ExportMeshes` | `bool` | 최종 select에 메시 포함 (기본 `True`) |
| `ExportBones` | `bool` | 최종 select에 본 포함 (기본 `True`) |
| `RemoveNameSpace` | `bool` | 내보내기 전 네임스페이스 제거 |
| `ResetRoot` | `bool` | Root Transform 임시 리셋 후 복원 |
| `ResetRootMode` | `str` | `"auto"` 또는 `"name"` |
| `ResetRootName` | `str` | name 모드에서 찾을 노드 이름 |
| `ResetAxisX/Y/Z` | `float` | Root 리셋 후 적용 회전(도) |
| `ArchiveType` | `str` | `"ogawa"` / `"hdf5"` |
| `CoordinateSystem` | `str` | `"yup"` / `"zup"` / `"max"` |
| `Hidden` | `bool` | Hidden Geometry export |
| `UVs` / `Normals` / `VertexColors` | `bool` | Export Data |
| `AnimTimeRange` | `str` | `"CurrentFrame"` / `"TimeSlider"` / `"StartEnd"` |
| `BatchCreateSubfolder` | `bool` | Batch 시 레퍼런스별 서브폴더 |

조회:
```python
info = api.get_abc_default_options()
print(info["preset_name"])
print(info["options"].keys())
```