So basically can I find out if a node has interval playing on it? Can i get a handle to it?
No, this is not possible. Intervals happen on a completely different level.
You could store a list on every node though, as a python tag, storing each interval you created for the node. Then you can do node.getPythonTag(“intervals”) to get back that list.
Ive noticed there are two ways to create intervals: by a NodePath method and by creating an interval object and passing the nodePath as argument. Is the first just a convenience function for the latter? Or do they work differently? If so, is it relevant here?
The python tag is a good idea though.
BTW, “python” tag got me thinking, is everything inside the module “direct” (also Intervals) pure python? Maybe I should just use tasks? Because I might have hundreds of them running.
The nodePath methods that create intervals are just convenience wrappers around the interval constructors. The definition of NodePath.posInterval looks something like this:
def posInterval(self, *args, **kw):
return LerpPosInterval(self, *args, **kw)
Some interval types (like Func) are implemented in pure Python, while others (like LerpPosInterval and most of the other lerp intervals) are implmented in C++. In either case, the interval system is reasonably efficient, but you can keep an eye on the performance in PStats.
David