Need some guidance on a setblend problem

I am trying to blend animations fluidly on an actor model, and have discovered some great techniques in these two threads:

discourse.panda3d.org/viewtopic.php?t=4249 - for single key presses

discourse.panda3d.org/viewtopic.php?t=2903 - setblend techniques

I’ve added the single keypress technique to my jump and attack animations smoothly, but I am having a very rough time blending my actor from jumping or attacking to walk and back again. I have tried to wait then run the walk animation, different intervals, and a task to handle it. It still eludes me but I believe I am near a soloution using the setblend techniques shown by drwr.

I can get the jump to play and it is so close to the correct behaviour, but it always leaves the actor skating on the terrain after an attack or a jump. To note the jump and the attack always start correct, even while moving, but it doesn’t seem to blend back to the walk animation.

Any advice on this would be greatly appreciated.

Truncated code for clarity

#regular keys down #truncated
    #time keys down
    self.JumpkeyMap = {"jump":0} 
    self.accept("space", self.setTimeKey, ["jump", 1])
    #regular keys up #truncated
    #time keys up
    self.accept("space-up", self.setTimeKey, ["jump",0])

    taskMgr.add(self.move,"moveTask") 

    # Game state variables 
    self.prevtime = 0 
    self.isMoving = False

# Records the state of the regular keys  
def setKey(self, key, value): 
    self.keyMap[key] = value

# Records the state of the time keys    
def setTimeKey(self, key, value):  
    self.keyTimeMap[key] = value
    frame = globalClock.getFrameCount() 
    taskMgr.add(self.resetTimeKeys, "resetTimeKeys", 
                extraArgs = [key, frame], 
                appendTask = True)

#Resets the time keys
def resetTimeKeys(self, key, frame, task): 
    if globalClock.getFrameCount() > frame:  
        self.keyTimeMap[key] = 0
        return Task.done 
    else: 
        return Task.cont

def move(self, task):
    elapsed = task.time - self.prevtime
    # If a move-key is pressed, move player
    if (self.keyMap["forward"]!=0): 
            backward = self.player.getNetTransform().getMat().getRow3(1) 
            backward.setZ(0) 
            backward.normalize() 
            self.player.setPos(self.player.getPos() - backward*(elapsed*5))
    #truncated

        # loop/stop the jump animation. 
        if (self.keyTimeMap["jump"]!=0): 
            self.player.play("jump") 
            self.jumpSound1.setLoopCount(1)
            self.jumpSound1.play()
            if self.isMoving is True:
               i2 = Sequence(ActorInterval(self.player, 'walk', loop = 1, duration = 3), 
              LerpAnimInterval(self.player, 0.5, 'walk', 'jump'), 
              ActorInterval(self.player, 'jump'), 
              LerpAnimInterval(self.player, 0.5, 'jump', 'walk'), 
              ActorInterval(self.player, 'walk', loop = 1, duration = 3))
               
                
        # loop/stop the run animation. 
        if (self.keyMap["forward"]!=0) or (self.keyMap["backward"]!=0) or (self.keyMap["left"]!=0) or (self.keyMap["right"]!=0): 
            if self.isMoving is False: 
                self.player.loop("walk") 
                self.walkSound1.play()
                self.isMoving = True 
        else: 
            if self.isMoving: 
                self.player.stop() 
                self.player.loop("idle",5) 
                self.walkSound1.stop()
                self.isMoving = False

edited for clarification