Func Interval extraArgs Problem[SOLVED]

I’m running into some trouble with putting extra arguments into Func() intervals.

When I create such an interval, for example:

mySeq = Sequence(Func(myFunc, extraArgs = [1,2,3]), myInterval)

The extra arguments aren’t getting passed to the function (myFunc in the example above).

I took a look at the code in FunctionInterval.py and put in a print statement to try and figure out what was going on.

def __init__(self, function, **kw):
        """__init__(function, name = None, openEnded = 1, extraArgs = [])
        """
        print("Interval Init", kw)
        name = kw.pop('name', None)
        openEnded = kw.pop('openEnded', 1)
        extraArgs = kw.pop('extraArgs', [])

To my surprise, the extraArgs key in kw shows up, but always has () for its value. My arguments aren’t showing up. When I add a name to the interval with the name keyword, that shows up fine. Why aren’t my extraArgs?

I’m using Panda3D 1.7.2 by the way.

I solved the problem by scrolling down in FunctionInterval.py to the class declaration of Func and commenting out two lines, so it now looks as follows:

class Func(FunctionInterval):
    def __init__(self, *args, **kw):
        function = args[0]
        assert hasattr(function, '__call__')
        #extraArgs = args[1:]
        #kw['extraArgs'] = extraArgs
        FunctionInterval.__init__(self, function, **kw)

Am I the only one who’s run into this problem? It seems odd that it hasn’t been noticed and fixed, unless it’s somehow specific to my situation. I don’t know how that could be the case, but that doesn’t mean it can’t be.

This works for me:

Func(myFunc, arg1, arg2, arg3)

At some point I noticed that, too. The manual is pretty clear on this, which is good. However it can be debated if that’s an inconsistency:

seq = Sequence(
	LerpFunc(set_node_tx_a, fromData=0.0, toData=1.0, duration=1.25, extraArgs=[node]),
	Wait(wait))

but:

seq = Sequence(Func(self.ships[id].set_key_left),
			Wait(turntime*0.8), Func(self.set_key, "turnl", 0), Func(self.jump_ship_out, id, 4.0))

I would definitely call it an inconsistency. Everything else in Panda3D that takes a function as an argument uses the extraArgs = [] format. That I can think of anyway.