ShapeKeyItem

human/keys/keys.py

Inherits from KeyItem, SavableContent

Item representing a Blender shape key on the human.

Attributes
category_dict—
sk_name—
valuefloatGet the current value of the shape key.
name—from KeyItem
category—from KeyItem
subcategory—from KeyItem
Methods
as_bpy()ShapeKeyGet pointer to the Blender shape key's key_block.
save_to_library()Save this shape key to the Human Generator content library.
draw_prop()bpy.types.UILayoutDraw the shape key as a slider in the UI.
save_objects_optimized()Saves the passed objects as a new blend file.from SavableContent
remove_number_suffix()strRemove the number suffix from the passed name (i.e. Box.004 becomes Box).from SavableContent

Attributes

ShapeKeyItem.category_dict

source

No description yet.

ShapeKeyItem.sk_name

source

No description yet.

ShapeKeyItem.value: float

source

Get the current value of the shape key.

ShapeKeyItem.namefrom KeyItem

source

No description yet.

ShapeKeyItem.categoryfrom KeyItem

source

No description yet.

ShapeKeyItem.subcategoryfrom KeyItem

source

No description yet.

Methods

ShapeKeyItem.as_bpy() → ShapeKey

source

Get pointer to the Blender shape key's key_block.

This is useful for sliders in the UI.

Returns ShapeKey — Blender shape key's key_block

ShapeKeyItem.save_to_library(name: str, category: str, subcategory: str, as_livekey: bool = True, delete_original: bool = False)

source

Save this shape key to the Human Generator content library.

This means this shape key will be available for all other characters you create in Human Generator. Save it as a livekey to save space and to have the rig and clothing update automatically when you change the key. Save as shape key if it will be used for animation.

ParameterTypeDescription
namestrName to save the key as
categorystrCategory to save the key in. This has to be one of the preset categories. As of writing these are "face_proportions", "body_proportions", "presets", "expressions", and "special".
subcategorystrSubcategory to save the key in. If the subcategory does not exist, a new folder will be created.
as_livekeybool
default True
Save as livekey or shape key. Defaults to True.
delete_originalbool
default False
Delete the original key after saving. Defaults to False.

ShapeKeyItem.draw_prop(layout: bpy.types.UILayout, value_propname: Literal['value', 'value_limited', 'value_positive_limited'] = 'value') → bpy.types.UILayout

source

Draw the shape key as a slider in the UI.

ParameterTypeDescription
layoutbpy.types.UILayoutlayout to draw the slider in
value_propnameLiteral['value', 'value_limited', 'value_positive_limited']
default 'value'
IGNORED for shapekeys. Defaults to "value".

Returns bpy.types.UILayout — bpy.types.UILayout: layout with the slider drawn in it

ShapeKeyItem.save_objects_optimized(context: bpy.types.Context, objs: Iterable[bpy.types.Object], folder: str, filename: str, clear_sk: bool = True, clear_materials: bool = True, clear_vg: bool = True, clear_ps: bool = True, run_in_background: bool = True, clear_drivers: bool = True)static methodfrom SavableContent

source

Saves the passed objects as a new blend file.

opening the file in the background to make it as small as possible

ParameterTypeDescription
contextbpy.types.ContextBlender context.
objsIterable[bpy.types.Object]List of objects to save
folderstrFolder to save the file in
filenamestrName to save the file as
clear_skbool
default True
Remove all shapekeys from objs. Defaults to True.
clear_materialsbool
default True
Remove all materials from objs. Defaults to True.
clear_vgbool
default True
Remove all vertex groups from objs. Defaults to True.
clear_psbool
default True
Remove all particle systems from objs. Defaults to True.
run_in_backgroundbool
default True
Open the new subprocess in the background. Defaults to True.
clear_driversbool
default True
Remove all drivers from objs. Defaults to True.

ShapeKeyItem.remove_number_suffix(name: str) → strstatic methodfrom SavableContent

source

Remove the number suffix from the passed name (i.e. Box.004 becomes Box).

ParameterTypeDescription
namestrname to remove suffix from

Returns str — name without suffix