SetAnim no longer allows the blending of frame if animations are shorter than the blend time

I am in the process of updating my app to use the most current stable release.

I have come across an issue with creating a blend from animations that are shorter than the blend time.

I have tracked it down to a new line in the AnimChannel Class

public void setAnim(String name, float blendTime){
    if (name == null)
        throw new IllegalArgumentException("name cannot be null");

    if (blendTime < 0f)
        throw new IllegalArgumentException("blendTime cannot be less than zero");

    Animation anim = control.animationMap.get(name);
    if (anim == null)
        throw new IllegalArgumentException("Cannot find animation named: '"+name+"'");

    control.notifyAnimChange(this, name);

    if (animation != null && blendTime > 0f){
        this.blendTime = blendTime;
        // activate blending
        blendTime = Math.min(blendTime, anim.getLength() / speed);    <----------This has been added.        
        blendFrom = animation;
        timeBlendFrom = time;
        speedBlendFrom = speed;
        loopModeBlendFrom = loopMode;
        blendAmount = 0f;
        blendRate   = 1f / blendTime;
    }else{
        blendFrom = null;
    }

    animation = anim;
    time = 0;
    speed = 1f;
    loopMode = LoopMode.Loop;
    notified = false;
}

What I currently have implemented in my app is the function to choose a pose or a longer animation and then adjust the time it takes to create that animation. With the newly added line this truncates the animation to the shortest duration of the 2 so if I want to have the animation take a longer time this is no longer possible.

My question is there another way to what I am attempting or will I need to build a custom build of JME3 to do what have I have been doing currently?

Thank you for your time
Dustin

this is a very old fix… It was before the github migration so I don’t know exactly why it has been integrated, but I guess that was just that, preventing the blend time to be longer than the animation duration else it would result in “jumps” when chaining animations…

There is no way around this, you’re going to have to patch that class at least or to have your own build of the engine if you rely on this behaviour

@nehon

Thank you for the information. I have never built the JME project before, I have only ever used the binaries. Do you suggest a specific IDE to build it? Could you provide me with a link if there are some instructions on how to build the project binaries after I have made my changes?

Thank you for your time.
Dustin

If you don’t target android you can just patch the class in your project.
If you have only this change don’t go through the hassle of building the whole engine.

Put your modified class in the exact same package as it is in the engine and yours will be picked by the class loader.