# ProcessSettings

> Human Generator for Blender documentation. Web version: https://humgen3d.com/docs/api/processsettings

Reached as: `human.process`

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L61

Processes the human for export, as the Process tab does, or step by step.

`run` does everything the Process tab does, from an `ExportSettings`:

    settings = ExportSettings.from_recipe("unity")
    settings.output.folder = "/path/to/project/Assets/Characters"
    result = human.process.run(settings)
    print(result.files)

The other methods are the single steps of `run`, which change this human in
place, so call them on a `human.duplicate()`. They take the section of the
settings they are about, or plain arguments. `run` does them in this order,
which the steps depend on:

    1. `set_shape_keys`, so the other steps only carry the keys that stay
    2. `convert_to_haircards`
    3. `convert_to_game_eyes` and `lod.set_teeth_lod`, before baking, as
       they change the materials
    4. `bake_textures`, before the meshes are reduced
    5. `set_quality` (or `lod.set_body_lod` and `lod.set_clothing_lod`)
    6. `remove_hidden_skin`
    7. `set_t_pose_as_rest` and `convert_to_game_rig`
    8. `apply_names`
    9. `prepare_clips`, once the skeleton is final
    10. `human.export.write`, or `mark_as_processed` to keep it in the file

The steps that change the human for good refuse to run twice, see the
`has_*` and `was_*` properties.

The process system runs on the data of the HG_Export content pack, which is
downloaded from your Superhive account (formerly BlenderMarket). Without it, `run`, the steps,
`lod` and `baking` raise `ExportPackMissing`, a `HumGenException`. The
`has_*`, `was_*` and `is_*` properties and `settings` work without it.

## Attributes

### baking

```python
human.process.baking: BakeSettings
```

*read-only*

The baking API of earlier versions, see `bake_textures`.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L101

### lod

```python
human.process.lod: LodSettings
```

*read-only*

Gives access to the LOD settings.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L107

### settings

```python
human.process.settings: Optional[ExportSettings]
```

*read-only*

The settings a processed human was made with, None for other humans.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L176

### has_haircards

```python
human.process.has_haircards: bool
```

*read-only*

Checks if haircards are present.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L261

### was_baked

```python
human.process.was_baked: bool
```

*read-only*

Checks if materials were baked.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L331

### is_lod

```python
human.process.is_lod: bool
```

*read-only*

Checks if the body of the human has a lower level of detail.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L419

### has_game_eyes

```python
human.process.has_game_eyes: bool
```

*read-only*

Checks if the eyes were converted to single layer eyes.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L428

### has_t_pose_rest

```python
human.process.has_t_pose_rest: bool
```

*read-only*

Checks if the T-pose was baked into the rest pose.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L537

### has_game_rig

```python
human.process.has_game_rig: bool
```

*read-only*

Checks if the rig was converted to a game engine skeleton.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L564

### game_rig_names

```python
human.process.game_rig_names: Optional[str]
```

*read-only*

The bone names the rig was converted to, None if it has no game rig.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L573

### is_processed

```python
human.process.is_processed: bool
```

*read-only*

Checks if this human is a frozen result of the process system.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L758

## Methods

### preflight()

```python
human.process.preflight(settings: ExportSettings, context: C = None) -> Preflight
```

Checks what `run` with these settings would complain about.

Parameters:
- `settings` ([ExportSettings](https://humgen3d.com/docs/api/exportsettings)): The settings to check.
- `context` (C, default None): Blender context. bpy.context if not provided.

Returns: [Preflight](https://humgen3d.com/docs/api/preflight) — Errors that stop the run and warnings that don't.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L121

### run()

```python
human.process.run(settings: ExportSettings, context: C = None, progress: Optional[ProgressCallback] = None) -> ExportResult
```

Processes this human by the settings, as the Process tab does.

This human is not changed. Every LOD level of the settings becomes a
processed duplicate, which is added to the file or written to the files
of the output format and removed again.

Parameters:
- `settings` ([ExportSettings](https://humgen3d.com/docs/api/exportsettings)): What to make, see `ExportSettings.from_recipe`.
- `context` (C, default None): Blender context. bpy.context if not provided.
- `progress` (Optional[ProgressCallback], default None): Called with the fraction done.

Returns: [ExportResult](https://humgen3d.com/docs/api/exportresult) — The humans added to the file or the files written, with warnings and triangle counts.

Raises: HumGenException — If the preflight finds an error or a step fails.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L137

### run_steps()

```python
human.process.run_steps(settings: ExportSettings, context: C = None) -> Steps[ExportResult]
```

The work of `run` as resumable steps, see `HumGen3D.common.progress`.

Parameters:
- `settings` ([ExportSettings](https://humgen3d.com/docs/api/exportsettings))
- `context` (C, default None)

Returns: Steps[[ExportResult](https://humgen3d.com/docs/api/exportresult)]

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L167

### set_shape_keys()

```python
human.process.set_shape_keys(settings: Optional[ShapeKeySettings] = None, level: int = 0, face_rig: KeyAction = 'keep', expressions: KeyAction = 'keep', correctives: KeyAction = 'keep', body: KeyAction = 'bake', face: KeyAction = 'bake', age: KeyAction = 'bake', keep: Optional[KeepSelection] = None, context: C = None)
```

Decides which shape keys stay on the human, per group of keys.

Each group is kept as shape keys, baked into the mesh at its current value
or removed. Keeping livekeys converts them to shape keys, so for example
the body sliders can be exported as blend shapes. The livekeys and the
gender key are always baked afterwards, as is the fit of the clothing.
Kept keys that bones drive, the face rig and the correctives, need their
drivers reconnected after exporting.

Parameters:
- `settings` (Optional[[ShapeKeySettings](https://humgen3d.com/docs/api/shapekeysettings)], default None): The actions as a recipe holds them. The other arguments are ignored when given.
- `level` (int, default 0): The LOD level this human is, with `settings` only. With `ShapeKeySettings.lod0_only` the lower levels keep no keys.
- `face_rig` (KeyAction, default 'keep'): "keep" loads the FACS face rig if the human has none yet, "remove" removes it. Baking is not possible.
- `expressions` (KeyAction, default 'keep'): The 1-click expressions.
- `correctives` (KeyAction, default 'keep'): Keys driven by bones that fix the joints and the eyelids, also on the clothing.
- `body` (KeyAction, default 'bake'): The body proportion sliders, including the muscles.
- `face` (KeyAction, default 'bake'): The face proportion sliders, face presets and eyes.
- `age` (KeyAction, default 'bake'): The age sliders.
- `keep` (Optional[KeepSelection], default None): Per group the names of the keys to keep, see `shape_key_options`. Missing groups keep all.
- `context` (C, default None): Blender context. bpy.context if not provided.

Raises: ValueError — If an action is not possible for a group.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L184

### shape_key_options()

```python
human.process.shape_key_options(context: C = None) -> Dict[str, List[str]]
```

The keys `set_shape_keys` can keep, per group, by display name.

The face rig and the expressions list everything in the library, the
other groups what this human has. Use a subset as the `keep` argument
or `ShapeKeySettings.keep`.

Parameters:
- `context` (C, default None): Blender context. bpy.context if not provided.

Returns: Dict[str, List[str]]

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L244

### convert_to_haircards()

```python
human.process.convert_to_haircards(quality: Literal['ultra', 'high', 'medium', 'low', 'haircap_only'] = 'high', context: C = None) -> List[bpy.types.Object]
```

Replaces every particle hair system of this human by hair cards.

The hair, eyebrows, eyelashes and facial hair each become a mesh object
with a haircap and cards, skinned to the rig, see
`human.hair.regular_hair.convert_to_haircards` for one of them. The
particle systems are removed afterwards, as no file format carries them.

Parameters:
- `quality` (Literal['ultra', 'high', 'medium', 'low', 'haircap_only'], default 'high'): Triangle budget of the cards, see `QualitySettings.haircards`.
- `context` (C, default None): Blender context. bpy.context if not provided.

Returns: List[bpy.types.Object] — List[bpy.types.Object]: The hair card objects that were made.

Raises: HumGenException — If the human has hair cards already.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L269

### separate_haircaps()

```python
human.process.separate_haircaps(context: C = None) -> List[bpy.types.Object]
```

Puts the cap and the cards of every hair type in objects of their own.

The cards are made as one object with the cap in the first material
slot and the cards in the second. A game engine sorts, culls and lights
the blended cap and the cut-out cards of one mesh as one renderer; as
meshes of their own each gets the treatment of its kind. The export
pipeline runs this before the names are applied, so a file holds
`Jake_Haircap` and `Jake_HairCards`. Objects that hold one material are
left alone, so this can run again.

Parameters:
- `context` (C, default None): Blender context. bpy.context if not provided.

Returns: List[bpy.types.Object] — List[bpy.types.Object]: The new objects, with the cards.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L307

### bake_textures()

```python
human.process.bake_textures(settings: Optional[TextureBakeSettings] = None, folder: Optional[str] = None, output: Optional[OutputSettings] = None, level: int = 0, levels: int = 1, only_sets: Optional[Iterable[str]] = None, context: C = None) -> List[bpy.types.Image]
```

Bakes every material of this human to textures and replaces it.

The skin, hair and eye materials are node trees exporters can't read,
so every material becomes a Principled BSDF with image nodes, with the
maps packed and flipped as the settings ask. The materials are copied
first, so a human this one was duplicated from keeps its own.

Parameters:
- `settings` (Optional[[TextureBakeSettings](https://humgen3d.com/docs/api/texturebakesettings)], default None): Passes, resolution, packing, normal map direction and samples. Separate maps at 2k by default.
- `folder` (Optional[str], default None): Folder to write the images to, None packs them in the blend file.
- `output` (Optional[[OutputSettings](https://humgen3d.com/docs/api/outputsettings)], default None): Naming scheme and name of the images and materials, see `apply_names`. The plain scheme with the name of the human by default.
- `level` (int, default 0): LOD level of this human, for the names.
- `levels` (int, default 1): Number of LOD levels, for the names.
- `only_sets` (Optional[Iterable[str]], default None): Bake only these texture sets of `TEXTURE_SETS`, for a level that shares the others, see `share_textures`.
- `context` (C, default None): Blender context. bpy.context if not provided.

Returns: List[bpy.types.Image] — List[bpy.types.Image]: The images of the new materials.

Raises: HumGenException — If the materials were baked already.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L339

### share_textures()

```python
human.process.share_textures(source: Human)
```

Gives this human the baked materials of another, per part.

LOD levels share their textures: the meshes keep their UV layout when
they are reduced, so the images baked for the first level fit every
level. The hair cards and the eyes are left alone, their UVs differ per
quality, bake those with `bake_textures(only_sets=("eyes", "hair"))`.

Parameters:
- `source` ([Human](https://humgen3d.com/docs/api/human)): Human with baked materials.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L402

### convert_to_game_eyes()

```python
human.process.convert_to_game_eyes(detail: Literal['high', 'medium', 'low'] = 'medium')
```

Replaces the layered eyes by single layer eyes for game engines.

Only the front of the cornea is kept, with the eye color as opaque
material on it. Applies the shape keys of the eyes, so changing the height
or proportions won't work on this human anymore.

Parameters:
- `detail` (Literal['high', 'medium', 'low'], default 'medium'): Resolution of the eye mesh. Medium has a quarter of the triangles of high, low about a sixteenth.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L436

### set_quality()

```python
human.process.set_quality(quality: QualitySettings, meshes: Optional[MeshSettings] = None, context: C = None)
```

Reduces the meshes of this human to the detail of a LOD level.

Converts the eyes, decimates the teeth and the clothing and dissolves
edges of the body, as `QualitySettings` asks. Hair cards and bones per
vertex are not part of it, see `convert_to_haircards` and
`convert_to_game_rig`. Meshes that have their detail already are skipped.

Parameters:
- `quality` ([QualitySettings](https://humgen3d.com/docs/api/qualitysettings)): Detail per mesh, see `QualitySettings.from_tier`.
- `meshes` (Optional[[MeshSettings](https://humgen3d.com/docs/api/meshsettings)], default None): Which modifiers of the clothing to remove and whether to remove the skin under it. Defaults apply.
- `context` (C, default None): Blender context. bpy.context if not provided.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L452

### remove_hidden_skin()

```python
human.process.remove_hidden_skin(context: C = None) -> int
```

Deletes the vertices of the body that the clothing hides.

Applies the mask modifiers of the clothing to the body mesh itself,
with the shape keys carried along. Exporters skip modifiers, so
without this the body is complete under every garment.

Parameters:
- `context` (C, default None): Blender context. bpy.context if not provided.

Returns: int — Number of vertices removed.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L492

### apply_modifiers()

```python
human.process.apply_modifiers(modifier_types: Iterable[str], objects: Optional[Iterable[bpy.types.Object]] = None, apply_hidden: bool = False, context: C = None)
```

Applies modifiers to the meshes of this human, keeping the shape keys.

Blender refuses to apply a modifier to a mesh with shape keys, this
applies it to every key. For scripts and anything the other steps don't
cover; particle systems and decimate modifiers are never applied.

Parameters:
- `modifier_types` (Iterable[str]): Types to apply, like "SUBSURF" or "SOLIDIFY".
- `objects` (Optional[Iterable[bpy.types.Object]], default None): Meshes to apply to, every mesh of the human when None.
- `apply_hidden` (bool, default False): Also apply modifiers hidden in the viewport.
- `context` (C, default None): Blender context. bpy.context if not provided.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L509

### set_t_pose_as_rest()

```python
human.process.set_t_pose_as_rest(context: C = None)
```

Bakes the T-pose into the rest pose of the meshes and armature.

Discards the current pose and removes the shoulder side raise corrective
shape keys. Features that rely on the A-pose rest pose, like changing the
pose, height, proportions or clothing, won't work on this human anymore.

Parameters:
- `context` (C, default None): The Blender context. Defaults to None.

Raises: HumGenException — If the rest pose is the T-pose already, or the human is a Rigify or legacy human.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L545

### convert_to_game_rig()

```python
human.process.convert_to_game_rig(names: str = HUMGEN_NAMES, keep_eyes: bool = True, keep_jaw: bool = True, keep_breasts: bool = True, keep_metacarpals: bool = False, max_influences: int = 4, root_bone: Optional[bool] = None, root_bone_name: Optional[str] = None, names_file: Optional[str] = None, settings: Optional[SkeletonSettings] = None, context: C = None)
```

Converts the rig to a skeleton for game engines.

Removes the bones that deform nothing, like the face rig controls and the
eye targets, and bakes the shape keys they drove at their current value.
Merges the weights of the bones that are not kept into their parents, adds
a root bone at the origin, bakes the constraints into the pose, removes the
vertex groups that are neither bones nor used by a modifier, limits the
number of bones per vertex and renames the bones. The face
rig, poses and animations of Human Generator won't work on this human
anymore. Call set_t_pose_as_rest first for a T-pose, which happens by
itself when `settings` ask for it.

Parameters:
- `names` (str, default HUMGEN_NAMES): The bone names, as `SkeletonSettings.names`: "humgen" keeps the Human Generator names, "humanoid" uses the names of Unity, Godot and VRM, "unreal" the Mannequin names, "mixamo" the Mixamo names and "custom" the names of names_file.
- `keep_eyes` (bool, default True): Keep the eye bones, otherwise the eyes follow the head.
- `keep_jaw` (bool, default True): Keep the jaw bones that move the teeth.
- `keep_breasts` (bool, default True): Keep the breast bones.
- `keep_metacarpals` (bool, default False): Keep the palm bones between hand and fingers.
- `max_influences` (int, default 4): Maximum number of bones per vertex, 0 for no limit. Also with `settings`, as `QualitySettings.bones_per_vertex` holds it per LOD level.
- `root_bone` (Optional[bool], default None): Add a root bone at the origin, None uses the choice of the names. Mixamo has none, the others do.
- `root_bone_name` (Optional[str], default None): Name of the root bone, None uses the name that goes with the names.
- `names_file` (Optional[str], default None): JSON file with "names" and "sides" like game_rig_presets.json, for "custom" names.
- `settings` (Optional[[SkeletonSettings](https://humgen3d.com/docs/api/skeletonsettings)], default None): The skeleton as a recipe holds it, replaces the arguments above except max_influences. Its rest pose is applied first when it is the T-pose.
- `context` (C, default None): Blender context. bpy.context if not provided.

Raises: HumGenException — If the human has a game rig already, or is a Rigify or legacy human.

Raises: ValueError — If the names do not exist.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L586

### apply_names()

```python
human.process.apply_names(output: Optional[OutputSettings] = None, level: int = 0, levels: int = 1)
```

Names the objects, meshes, materials and images by a naming scheme.

A copy of a human has names like "HG_Body.001", which engines show.
This names every datablock after the human and its part instead:
"Jake_Body", "Jake_Skin" and "Jake_Body_BaseColor", or with the Unreal
scheme "SK_Jake_Body", "M_Jake_Skin" and "T_Jake_Body_BC". Unused
material slots are removed. Materials shared with another human, like
the one this is a duplicate of, are copied first.

Parameters:
- `output` (Optional[[OutputSettings](https://humgen3d.com/docs/api/outputsettings)], default None): Scheme, templates and the name, `OutputSettings.name` with "{name}" for the name of the human. The plain scheme with the name of the human by default.
- `level` (int, default 0): LOD level of this human, added as "_LOD1" suffix to the meshes when there is more than one level.
- `levels` (int, default 1): Number of LOD levels.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L667

### prepare_clips()

```python
human.process.prepare_clips(settings: Optional[AnimationClipSettings] = None, source: Optional[Human] = None, context: C = None) -> List[bpy.types.Action]
```

Gives this human its own animation clips, fitted to its skeleton.

After `convert_to_game_rig` the actions of the source human no longer
fit: bones are gone or renamed and the rest pose may be the T-pose. The
Human Generator animations are retargeted onto the converted skeleton,
other actions are copied as they are with a warning in the log. The
clips end up as one NLA strip each, so `human.export.write(...,
animation="strips")` writes every clip as a take. Afterwards the clips
are the only animation on this human.

Parameters:
- `settings` (Optional[[AnimationClipSettings](https://humgen3d.com/docs/api/animationclipsettings)], default None): Which clips, from the human or the library, and the root motion. Every clip on the source human by default.
- `source` (Optional[[Human](https://humgen3d.com/docs/api/human)], default None): The human the clips come from, this human by default. Pass the original when this is its duplicate.
- `context` (C, default None): Blender context. bpy.context if not provided.

Returns: List[bpy.types.Action] — List[bpy.types.Action]: The clips of this human.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L706

### merge_levels()

```python
human.process.merge_levels(levels: List[Human])
```

Puts the meshes of other LOD levels under the skeleton of this human.

For one file with every level. The skeletons have to be identical,
which they are when the levels were made from the same source with the
same skeleton settings. The rigs of the other levels are removed, so
they are no humans afterwards.

Parameters:
- `levels` (List[[Human](https://humgen3d.com/docs/api/human)]): The other levels, in order of detail.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L743

### mark_as_processed()

```python
human.process.mark_as_processed(original_human: Human)
```

Marks this human as the frozen, processed result of another human.

The Human Generator interface doesn't allow editing processed humans, it
refers to the original human instead.

Parameters:
- `original_human` ([Human](https://humgen3d.com/docs/api/human)): The editable human this human was made from.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/process/process.py#L766
