public void SetBlendShapeFrameWeight(BlendShapeFrame blendShapeFrame, float weight, string undoName)
{
if(selectedBlendshape &&
blendShapeFrame &&
weight >= 1f &&
selectedBlendshape.frames.Contains(blendShapeFrame))
{
RegisterObjectUndo(selectedBlendshape, undoName);
RegisterObjectUndo(blendShapeFrame, undoName);
BlendShapeFrame other = null;
foreach(BlendShapeFrame f in selectedBlendshape.frames)
{
if(f != blendShapeFrame && f.weight == weight)
{
other = f;
break;
}
}
if(other)
{
DeleteBlendShapeFrame(selectedBlendshape, other, undoName);
}
blendShapeFrame.weight = weight;
SortBlendshapeFrames(selectedBlendshape);
m_DirtyVertices = true;
isDirty = true;
}
}