# ExpressionSettings

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

Reached as: `human.expression`

Inherits from: [PreviewCollectionContent](https://humgen3d.com/docs/api/previewcollectioncontent)

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/expression/expression.py#L79

Class for manipulating human expression.

Either using 1-click expressions or with the facial rig.

## Attributes

### has_facial_rig

```python
human.expression.has_facial_rig: bool
```

*read-only*

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/expression/expression.py#L91

### keys

```python
human.expression.keys: list[ShapeKeyItem]
```

*read-only*

Filtered list from HumGen3D.human.keys for keys part of expressions.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/expression/expression.py#L95

## Methods

### set()

```python
human.expression.set(preset: str)
```

Loads the passed 1-click expression preset on the human.

This will import the shapekey from the .npz file and set the value to 1.0.

Parameters:
- `preset` (str): Preset to load. You can get a list of available presets with `get_options()`.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/expression/expression.py#L104

### load_facial_rig()

```python
human.expression.load_facial_rig(context: C = None, reset_expressions: bool = True)
```

Imports all necessary shape keys and unhides the bones used to control face.

Parameters:
- `context` (C, default None): Blender context. bpy.context if not provided.
- `reset_expressions` (bool, default True): Set the 1-click expressions to 0, as they would otherwise combine with the face rig.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/expression/expression.py#L143

### remove_facial_rig()

```python
human.expression.remove_facial_rig()
```

Remove the facial rig from the human, including all it's shape keys.

Will also hide the bones again.

Raises: HumGenException — If no facial rig is loaded on this human.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/expression/expression.py#L172

### set_random()

```python
human.expression.set_random(context: C = None, update_ui: bool = False)
```

*inherited from PreviewCollectionContent*

Set this content type to a random content item.

This will use random.choice to select a random item from the output of
get_options().

Parameters:
- `context` (C, default None): Blender context. bpy.context if not provided.
- `update_ui` (bool, default False): Will also show the chosen item as the active thumbnail in the template_icon_view. Defaults to False.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/common_baseclasses/pcoll_content.py#L68

### get_options()

```python
human.expression.get_options(context: C = None, category: str = 'All') -> List[str]
```

*inherited from PreviewCollectionContent*

Get a list of options you can use for the set() method of this content.

These represent the choises the user sees in the UI. The output is a list of
relative paths to the content files, starting from the Human Generator folder.

Parameters:
- `context` (C, default None): Blender context. bpy.context if not provided.
- `category` (str, default 'All'): Category to filter the content by. Defaults to "All". You can get a list of categories from the get_categories() method.

Returns: List[str] — List[str]: List of relative paths to content files. You can pick one of these and pass it to the set() method.

Raises: ValueError — If the passed category is not present in the list of categories.

Raises: HumGenException — If no options can be found, this can be caused by the content pack for this type of content not being installed.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/common_baseclasses/pcoll_content.py#L98

### get_categories()

```python
human.expression.get_categories() -> list[str]
```

*inherited from PreviewCollectionContent*

Get a list of categoris this content type is organized in.

You can choose one of these categories to filter the content retreived from
get_options().

Returns: list[str] — list[str]: List of categories. These are the names of the folders the content is saved in.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/common_baseclasses/pcoll_content.py#L148

### refresh_pcoll()

```python
human.expression.refresh_pcoll(context: C = None, override_category: Optional[str] = None, ignore_searchterm: bool = False)
```

*inherited from PreviewCollectionContent*

Refresh the items of this preview collection.

This is low level functionality, you should not need to use this. It is used
to refresh the list of possible content for this human. If you use get_options()
this is automatically done for you.

Parameters:
- `context` (C, default None): Blender context. bpy.context if not provided.
- `override_category` (Optional[str], default None): Override the category to use, if not provided all items regardless of category will be shown.
- `ignore_searchterm` (bool, default False): If True, the searchterm set by the user will be ignored. Defaults to False.

Source: https://github.com/OliverJPost/HumGen3D/blob/main/human/common_baseclasses/pcoll_content.py#L180
