# Python API

This Python API is compatible with every version of Smedge.

Smedge 2024 and later include a version of this API. You can always update it to make use of the latest Python API functionality by replacing the existing API. In earlier versions just make the missing folders as needed in the Smedge program files location for each OS.


## Installation

Copy or overwrite the `smedge` folder from this package to the Smedge program files:

| OS      | Path                                             |
|---------|--------------------------------------------------|
| Windows | `C:\Program Files\Smedge\python`                 |
| MacOS   | `/Applications/Smedge.app/Contents/MacOS/python` |
| Linux   | `/opt/smedge/python`                             |


## Blender

> &#x26a0;&#xfe0f; Note
> 
> The Blender integration does not use Qt currently. Instead, it immediately tries to save and submit the active project. It is possible to add Qt support in Blender, and you could use the Nuke or Maya scripts as an example.

Create a file called `smedge_api.py` in the `startup` subfolder of any folder Blender has been configured to use for scripts.

```python
import sys
sys.path.append("/Applications/Smedge.app/Contents/MacOS/python")
import smedge.dcc.blender
smedge.dcc.blender.register()
```

For more info on configuring script paths in Blender see:
https://docs.blender.org/manual/en/latest/editors/preferences/file_paths.html#script-directories


## Cinema 4D

Run the included script to submit the current file to Smedge:

| OS      | Path                                                                    |
|---------|-------------------------------------------------------------------------|
| Windows | `C:\Program Files\Smedge\Utilities\smedgeRender_C4D.py`                 |
| MacOS   | `/Applications/Smedge.app/Contents/MacOS/Utilities/smedgeRender_C4D.py` |
| Linux   | `/opt/smedge/Utilities/smedgeRender_C4D.py`                             |


## Maya

Add to a shelf with this Python code:

```python
import sys
sys.path.append("/Applications/Smedge.app/Contents/MacOS/python")
import smedge.dcc.maya
win = smedge.dcc.maya.SmedgeSubmitWindow()
```


## Nuke

Add these lines in your `menu.py` file:

```python
import sys
sys.path.append("/Applications/Smedge.app/Contents/MacOS/python")
nuke.menu("Nuke").addCommand("Render/Submit to Smedge", "import smedge.dcc.nuke; win = smedge.dcc.nuke.SmedgeSubmitWindow()")
```
