# Process

> Python API functions

### decimateTargetBake

Automatically decimates a selection of meshes, using as a target a triangle count or a ratio (reduction percentage), and bakes Normals information into a texture (plus other textures).

```python
process.decimateTargetBake(occurrences, decimationTargetType, bakingOptions, overrideExistingUV=True)
```

Parameters

| Type                                                               | Name                 | Description                      |
| ------------------------------------------------------------------ | -------------------- | -------------------------------- |
| [OccurrenceList](./scene_types.md#occurrencelist)                  | occurrences          | Occurrences to process.          |
| [DecimateOptionsSelector](./algo_types.md#decimateoptionsselector) | decimationTargetType |                                  |
| [BakeOptions](./process_types.md#bakeoptions)                      | bakingOptions        | Option maps baking.              |
| [Boolean](./core_types.md#boolean)                                 | overrideExistingUV   | Override the original UV or not. |

### generateLODChain

Automatically generates LODs for the current selection.

```python
process.generateLODChain(occurrences, decimationStrategy)
```

Parameters

| Type                                                        | Name               | Description                           |
| ----------------------------------------------------------- | ------------------ | ------------------------------------- |
| [OccurrenceList](./scene_types.md#occurrencelist)           | occurrences        | Scene paths of components to process. |
| [DecimationStrategy](./process_types.md#decimationstrategy) | decimationStrategy | The decimation strategy.              |

### generateLODChainQuality

Automatically generates LODs for the current selection.

```python
process.generateLODChainQuality(occurrences, decimateParametersList=[DecimateParameters(1., 0.1, 5.), DecimateParameters(3., 1., 10.)])
```

Parameters

| Type                                                                | Name                   | Description                              |
| ------------------------------------------------------------------- | ---------------------- | ---------------------------------------- |
| [OccurrenceList](./scene_types.md#occurrencelist)                   | occurrences            | Scene paths of components to process.    |
| [DecimateParametersList](./process_types.md#decimateparameterslist) | decimateParametersList | The list of all LOD decimate parameters. |

### generateLODChainTarget

Automatically generates LODs for the current selection, using the decimate to target algorithm.

```python
process.generateLODChainTarget(occurrences, UVImportance=0, ProtectTopology=False, LODLevels=[algo.DecimationRatio(50), algo.DecimationRatio(25)])
```

Parameters

| Type                                                          | Name            | Description                              |
| ------------------------------------------------------------- | --------------- | ---------------------------------------- |
| [OccurrenceList](./scene_types.md#occurrencelist)             | occurrences     | Scene paths of components to process.    |
| [UVImportanceEnum](./algo_types.md#uvimportanceenum)          | UVImportance    |                                          |
| [Boolean](./core_types.md#boolean)                            | ProtectTopology |                                          |
| [DecimationRatioList](./process_types.md#decimationratiolist) | LODLevels       | The list of all LOD decimate parameters. |

### generatePhantomMesh

Automatically generates one unique optimized mesh out of the models in the scene, with material(s).

```python
process.generatePhantomMesh(occurrences, generateDiffuseMap=["Yes", BakeDiffuseOptions(1024, 1)])
```

Parameters

| Type                                                        | Name               | Description             |
| ----------------------------------------------------------- | ------------------ | ----------------------- |
| [OccurrenceList](./scene_types.md#occurrencelist)           | occurrences        | Occurrences to process. |
| [GenerateDiffuseMap](./process_types.md#generatediffusemap) | generateDiffuseMap |                         |

### proxyFromMeshes

Automatically generates a Proxy Mesh out of a selection of meshes, with optional automatic textures generation.

```python
process.proxyFromMeshes(occurrences, gridResolution=50, generateTextures, transferAnimations=True, keepOriginalMesh=True) -> scene.Occurrence
```

Parameters

| Type                                                        | Name               | Description                                                       |
| ----------------------------------------------------------- | ------------------ | ----------------------------------------------------------------- |
| [OccurrenceList](./scene_types.md#occurrencelist)           | occurrences        | Occurrences to process.                                           |
| [Int](./core_types.md#int)                                  | gridResolution     | Resolution of the voxel grid used to generated the proxy.         |
| [BakeOptionSelector](./process_types.md#bakeoptionselector) | generateTextures   | Option maps baking.                                               |
| [Bool](./core_types.md#bool)                                | transferAnimations | If false, skinned animations will be lost.                        |
| [Bool](./core_types.md#bool)                                | keepOriginalMesh   | If true, does not delete original mesh at the end of the process. |

Returns

| Type                                      | Name      | Description               |
| ----------------------------------------- | --------- | ------------------------- |
| [Occurrence](./scene_types.md#occurrence) | proxyMesh | The generated proxy mesh. |

### proxyFromPointCloud

Automatically generates a Proxy Mesh out of a selection of Point Cloud, with optional automatic diffuse texture generation.

```python
process.proxyFromPointCloud(occurrences, gridResolution=50, generateDiffuseTexture, keepOriginalPointCloud=True) -> scene.Occurrence
```

Parameters

| Type                                                        | Name                   | Description                                                              |
| ----------------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------ |
| [OccurrenceList](./scene_types.md#occurrencelist)           | occurrences            | Occurrences to process.                                                  |
| [Int](./core_types.md#int)                                  | gridResolution         | Resolution of the voxel grid used to generated the proxy.                |
| [GenerateDiffuseMap](./process_types.md#generatediffusemap) | generateDiffuseTexture | Baking options.                                                          |
| [Bool](./core_types.md#bool)                                | keepOriginalPointCloud | If true, does not delete original point cloud at the end of the process. |

Returns

| Type                                      | Name      | Description               |
| ----------------------------------------- | --------- | ------------------------- |
| [Occurrence](./scene_types.md#occurrence) | proxyMesh | The generated proxy mesh. |
