public void setNbMorphTargets(float[] weights, int nbMorphTargets) {
        if (times.length * nbMorphTargets != weights.length) {
            throw new IllegalArgumentException("weights.length must equal nbMorphTargets * times.length");
        }
        this.nbMorphTargets = nbMorphTargets;
        setKeyframesWeight(weights);
    }
Sets the number of morph targets and the corresponding weights.
Note that the number of weights must equal the number of frames times the number of morph targets.

@param weights        the weights for each frame (alias created
                      -- do not modify after passing it to this setter)
@param nbMorphTargets the desired number of morph targets
@throws IllegalArgumentException if the number of weights and the new
        number of morph targets violate the frame count constraint
jme3-core/src/main/java/com/jme3/anim/MorphTrack.java