Human
human/human.pyPython representation of a Human Generator human.
This class with its subclasses can be used to modify the Human Generator human inside Blender.
| Attributes | ||
|---|---|---|
| body | BodySettings | Points to the body settings of the human. |
| height | HeightSettings | Points to the height settings of the human. |
| face | FaceSettings | Points to the face settings of the human. |
| age | AgeSettings | Points to the age settings of the human. |
| pose | PoseSettings | Points to the pose settings of the human. |
| animation | AnimationSettings | Points to the animation settings of the human. |
| clothing | ClothingSettings | Points to the clothing settings of the human. |
| expression | ExpressionSettings | Points to the expression settings of the human. |
| process | ProcessSettings | Points to the class used by the process tab of HumGen. |
| materials | MaterialSettings | Points to the class giving access to different materials of human. |
| objects | ObjectCollection | Get a collection of all objects that are part of the human. |
| children | Iterable[Object] | A generator of all children of the rig object of the human. |
| gender | GenderStr | Gender of this human in ("male", "female"). |
| pose_bones | bpy_prop_collection | Pose bones of the human rig. |
| props | HG_OBJECT_PROPS | Custom object properties of the human. |
| skin | SkinSettings | Subclass used to change the skin material of the human body. |
| keys | KeySettings | Subclass used to access and change the shape keys of the body object. |
| eyes | EyeSettings | Subclass used to access and change the eye object and material. |
| hair | HairSettings | Subclass used to access and change the hair systems and materials. |
| export | ExportBuilder | Subclass used to export the human. |
| location | FloatVectorProperty | Location of the human in Blender global space. |
| rotation_euler | FloatVectorProperty | Euler rotation of the human in Blender global space. |
| name | str | Name of this human. Takes name of rig object and removes HG_ prefix. |
| is_trial | bool | Whether this human is a trial human. |
| Methods | ||
| get_preset_options() | List[str] | Return a list of human possible presets for the given gender. |
| from_existing() | Human | None | New instance from a passed Blender object that is part of an existing human. |
| from_preset() | Human | Creates human in Blender based on passed preset and returns Human instance. |
| get_categories() | list[str] | Get a list of categories the human presets are divided into. |
| delete() | Delete the human from Blender. | |
| hide_set() | Switch between visible and hidden state for all objects of this human. | |
| make_camera_look_at_human() | Makes the passed camera point towards a preset point on the human. | |
| save_to_library() | Save the human with it's current settings as a starting human preset. | |
| duplicate() | Human | Make a copy of this human. Will both duplicate in Blender and Python. |
| render_thumbnail() | str | Render a thumbnail of this human. |
| as_dict() | Save these settings to a dict and restore them from one. | |
Attributes
human.body: BodySettingsread-only
sourcePoints to the body settings of the human.
human.height: HeightSettingsread-only
sourcePoints to the height settings of the human.
human.face: FaceSettingsread-only
sourcePoints to the face settings of the human.
human.age: AgeSettingsread-only
sourcePoints to the age settings of the human.
human.pose: PoseSettingsread-only
sourcePoints to the pose settings of the human.
human.animation: AnimationSettingsread-only
sourcePoints to the animation settings of the human.
human.clothing: ClothingSettingsread-only
sourcePoints to the clothing settings of the human.
human.expression: ExpressionSettingsread-only
sourcePoints to the expression settings of the human.
human.process: ProcessSettingsread-only
sourcePoints to the class used by the process tab of HumGen.
human.materials: MaterialSettingsread-only
sourcePoints to the class giving access to different materials of human.
human.objects: ObjectCollectionread-only
sourceGet a collection of all objects that are part of the human.
A generator of all children of the rig object of the human.
Does NOT yield subchildren.
Gender of this human in ("male", "female").
human.pose_bones: bpy_prop_collectionread-only
sourcePose bones of the human rig.
human.props: HG_OBJECT_PROPSread-only
sourceCustom object properties of the human.
Used by the add-on for storing metadata like gender, backup_human pointer, current phase, body_obj pointer. Points to rig_obj.HG
human.skin: SkinSettingsread-only
sourceSubclass used to change the skin material of the human body.
human.keys: KeySettingsread-only
sourceSubclass used to access and change the shape keys of the body object.
Iterating yields key_blocks.
human.eyes: EyeSettingsread-only
sourceSubclass used to access and change the eye object and material.
human.hair: HairSettingsread-only
sourceSubclass used to access and change the hair systems and materials.
human.export: ExportBuilderread-only
sourceSubclass used to export the human.
Location of the human in Blender global space.
Retrieved from rig_obj.location
human.rotation_euler: FloatVectorProperty
sourceEuler rotation of the human in Blender global space.
Retrieved from rig_obj.rotation_euler
Name of this human. Takes name of rig object and removes HG_ prefix.
Whether this human is a trial human.
Methods
Human.get_preset_options(gender: GenderStr, category: str = 'All', context: C = None) → List[str]static method
sourceReturn a list of human possible presets for the given gender.
Choose one of the options to pass to Human.from_preset() constructor.
| Parameter | Type | Description |
|---|---|---|
| gender | GenderStr | string in ('male', 'female') |
| category | str default 'All' | Category to find presets for. Defaults to 'All'. You can get a list of all categories by calling Human.get_categories() |
| context | C default None | Blender context, uses bpy.context if not passed |
Returns List[str] — A list of starting human presets you can choose from
Human.from_existing(existing_human: Object, strict_check: bool = True) → Human | Noneclass method
sourceNew instance from a passed Blender object that is part of an existing human.
| Parameter | Type | Description |
|---|---|---|
| existing_human | Object | Object that is part of the human you want to get. |
| strict_check | bool default True | If True, the method will raise an exception if the passed object is not part of a human. If False, it will return None instead. Defaults to True |
Returns Human | None — A Human instance or None
Raises TypeError — Raised if the passed object is not a Blender object.
Raises HumGenException — Raised if the passed object is not part of a human and strict_check is True. This will also raise if the passed object is part of a legacy human.
Human.from_preset(preset: str, context: C = None, prettify_eevee: bool = True, from_batch_generator: bool = False) → Humanclass method
sourceCreates human in Blender based on passed preset and returns Human instance.
| Parameter | Type | Description |
|---|---|---|
| preset | str | The name of the preset, as retrieved from Human.get_preset_options() |
| context | C default None | The Blender context. Defaults to bpy.context if None |
| prettify_eevee | bool default True | If True, the AO and Strip settings will be set to settings that look nicer. Defaults to True |
| from_batch_generator | bool default False | If True, some settings will be skipped as they are defined in the batch generator. Defaults to False |
Returns Human — A Human instance
Human.get_categories(gender: GenderStr) → list[str]static method
sourceGet a list of categories the human presets are divided into.
| Parameter | Type | Description |
|---|---|---|
| gender | GenderStr | Gender to find categories for |
Returns list[str] — list[str]: List of categories, choose one to pass to get_preset_options()
Delete the human from Blender.
Will delete all meshes and objects that this human consists of, including the backup human.
Switch between visible and hidden state for all objects of this human.
| Parameter | Type | Description |
|---|---|---|
| state | bool | Use True for hidden, False for visible |
human.make_camera_look_at_human(obj_camera: Object, look_at_correction: float = 0.9)
sourceMakes the passed camera point towards a preset point on the human.
| Parameter | Type | Description |
|---|---|---|
| obj_camera | Object | Camera object |
| look_at_correction | float default 0.9 | Correction based on how much lower to point the camera compared to the top of the armature |
human.save_to_library(name: str, category: str = 'Custom', thumbnail: Optional[Image] = None, context: C = None)
sourceSave the human with it's current settings as a starting human preset.
Will add it to the content library.
| Parameter | Type | Description |
|---|---|---|
| name | str | Name of the preset |
| category | str default 'Custom' | Category of the preset, defaults to "Custom". Creates new category if it doesn't exist yet. |
| thumbnail | Optional[Image] default None | Image to use as thumbnail for the preset. If None no thumbnail will be added. |
| context | C default None | The context of the current scene. |
Make a copy of this human. Will both duplicate in Blender and Python.
All relations will be corrected:
| Parameter | Type | Description |
|---|---|---|
| context | C default None | The context of the current scene. |
Returns Human — The duplicated human as Python instance.
human.render_thumbnail(folder: Optional[str] = None, name: str = 'temp_thumbnail', focus: str = 'full_body_front', context: C = None, resolution: int = 256, white_material: bool = False) → str
sourceRender a thumbnail of this human.
| Parameter | Type | Description |
|---|---|---|
| folder | Optional[str] default None | Folder to save the thumbnail to. If None the default folder will be used. |
| name | str default 'temp_thumbnail' | Name of the thumbnail. Will be used as filename. |
| focus | str default 'full_body_front' | Focus of the thumbnail. Can be one of: "full_body_front", "full_body_side", "head_front", "head_side". |
| context | C default None | The context of the current scene. |
| resolution | int default 256 | Resolution of the thumbnail. Defaults to 256. |
| white_material | bool default False | Use a white material for the human. Defaults to False. |
Returns str — Path to the rendered thumbnail.