Blend Shapes

<done>

Overview

The Blend Shapes Component controls the blend shapes of a skinned mesh..just like the SkinnedMeshRenderer component does. but you don't have to search for the mesh deep in the hierarchy.

Sample of the BlendShapes component
Blend Shapes inside the SkinnedMeshRenderer Component.
Blend Shapes inside the SkinnedMeshRenderer Component.

Also you can load/save Blend Shape Presets to have different variations.

Parameters

Mesh

Reference to the skinned mesh renderer.

LODs

Extra meshes that share the same Blendshapes, like LODs meshes or the Magic Tattoos on the Poly Art Animals:

The "magic" mesh also changes with the mesh of the wolf

Pin Blend Shape

The Pin blendshape is the value stored to be used with Unity Events, since this unity Events cannot have more than one value on its listeners.

E.g. : In the first Listener we Store/Pin Blend Shape (the first one, with index=0) and on the second Listener we change the value of tha stored/pinned blend shape with the Slider value of the UI component.

You can check how to use the Pin Shape on the Callback Sample scenes of each Animal.

Blend Shape Weight List

List of all the Blend shapes weights of the skinned mesh renderer. Each Blendshape have a label for its Index. E.g.: (00) is the Index for the Blend Shape Big Eyes on the Wolf.

Preset

The Blend Shape Preset is simply an array of float values to save/load the Blend shapes you have modified.

Load Preset

If the Preset parameter has a preset set, then At start the component this preset will be loaded.

Random

At Start this component will generate random blend shape weights.

Editor Buttons

Reset

Reset all the weights of the blendshapes to zero.

Randomize

Randomize all the weights of the blendshapes

Save

Save the current blend shapes to a preset.

Load

Load a blend preset.

Public Methods

float[] GetBlendShapeValues()

Gets an array of all the blendshape weights on the skinned mesh renderer.

​

void LoadSmoothPreset(BlendShapePreset preset)

Blends from the current blend shapes weights to the weights of the preset.

​

void LoadPreset()

Load the weights from the preset stored on the Preset parameter.

​

LoadPreset(BlendShapePreset preset)

Load the weights from the preset.

​

void SavePreset()

Save the current blendshape weights to the preset on the Preset parameter.

​

void Randomize()

Randomize the weights on the skinned mesh and its LODs

​

void SetWeight(string name, float value)

Set a new weight on a blendshape using its name

​

void SetWeight(int index, float value)

Set a new weight on a blendshape using its index

​

void _PinShape(string name)

Store/Pin a blend shape by its name

​

void _PinShape(int index)

Store/Pin a blend shape by its Index

​

_PinnedShapeSetValue(float value)

Set a new weight on the Stored/Pinned blend shape

​

void UpdateBlendShapes()

Updates all the weights of the component to the Skinned mesh renderer