# FBX Export Options

## FBX Export Patterns

### Pattern 1 — Named preset (v2, recommended)
Apply a saved preset by name. The simplest approach.
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
api.export_fbx(slot=0, output_path=r"J:\output\char.fbx", preset="Unreal_Ani")
api.export_fbx_all(output_folder=r"J:\output", preset="Unreal")
```
A non-existent preset name immediately raises `ValueError`.

### Pattern 2 — Override specific keys only
Keep the default preset and change only some options.
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
api.export_fbx(slot=0, output_path=r"J:\output\char.fbx",
               fbx_options={"Animation": False})
```

### Pattern 3 — Copy defaults then modify
Fetch all defaults and change only what you need.
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
defaults = api.get_fbx_default_options()
opts = defaults['options'].copy()
opts['UpAxis'] = 'Y'
opts['ConvertUnit'] = 'm'
api.export_fbx_all(output_folder=r"J:\output", fbx_options=opts)
```

### Pattern 4 — preset + partial override (v2)
Load a preset then override only specific options.
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
api.export_fbx(
    slot=0,
    output_path=r"J:\output\char.fbx",
    preset="Unreal_Ani",
    fbx_options={"BakeAnimation": False}
)
```

### Pattern 5 — Reset Root to 0,0,0
Reset the Root node's transform to the origin before exporting.
```python
from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
api.export_fbx(
    slot=0,
    output_path=r"J:\output\char.fbx",
    fbx_options={
        "ResetRoot": True,
        "ResetRootMode": "manual",
        "ResetRootName": "Root",
        "ResetAxisX": 0.0,
        "ResetAxisY": 0.0,
        "ResetAxisZ": 0.0,
    }
)
```
> **Note:** `ResetRootMode`
- `"auto"` — automatically finds the top bone in the skin hierarchy
- `"manual"` — uses the bone matching the name in `ResetRootName`

---

## Key FBX Options Reference
| Key | Type | Description |
| --- | --- | --- |
| `Animation` | `bool` | Include animation data |
| `Skin` | `bool` | Include mesh skin (False = export Bone only) |
| `Shape` | `bool` | Include Morph Target (Shape) data |
| `BakeAnimation` | `bool` | Bake keyframes (remove controllers) |
| `SmoothingGroups` | `bool` | Include smoothing groups |
| `EmbedTextures` | `bool` | Embed textures into the FBX file |
| `ASCII` | `bool` | Use FBX ASCII format (False = Binary) |
| `UpAxis` | `str` | Up-axis direction (`"Y"` or `"Z"`) |
| `ConvertUnit` | `str` | Unit conversion (`"cm"`, `"m"`, etc.) |
| `RemoveNameSpace` | `bool` | Remove namespace prefix after export |
| `ResetRoot` | `bool` | Reset Root node transform before export |
| `ResetRootMode` | `str` | Root detection mode (`"auto"` or `"manual"`) |
| `ResetRootName` | `str` | Root bone name for manual mode |
| `ResetAxisX/Y/Z` | `float` | Target rotation for root reset (degrees) |