The Amazing Disappearing hprInterval

I’m having trouble where my hprIntervals suddenly disappear mid-game.

I have different classes that load different models. Some of the nodes have hprIntervals set on them.

When I load in a new class- it turns off the hprIntervals on the pre-existing nodes globally.

self.center.hprInterval(5,Point3(360,-15,0)).loop()

As new classes are loaded in a different times in the game- they work before then suddenly stop when a new hprInterval is added, sometimes from a different class altogether. It seeems weird to me.
Anyone have any idea what’s happening here?

How do you mean this? When you create a hprInterval on-the-fly like that without saving a pointer to it, there’s no real way to stop it ever again, unless you go mucking about inside the ivalMgr.

David

I mean it stops spinning. -As if it only allows one spinning object in the world at a time.

This code does the same thing.

self.centerint = self.center.hprInterval(5,Point3(360,-15,0))
self.centerint.loop()

Is it possible that this is a garbage collection bug? I seem to vaguely recall that if you don’t store a pointer to an Actor, it will stop animating. Could this be the same thing?

I don’t think it’s a garbage collection problem.

I’ve noticed the same thing with Actor before. But I have handles to everything at all times. I typically destroy everything only at the end of the level.

Hmm. I can’t think of anything that would cause this. There is a convention that if you create a new interval with the exact same name as a previously created (and running) interval, the new one will supercede the old one. But if you don’t give the interval an explicit name, it will create a unique name for itself, and you don’t seem to be giving your intervals a name in the lines above.

Is it true that the interval has stopped running, or only that the model is no longer visible for some reason? You can print ivalMgr (imported from IntervalGlobal) to list the currently running intervals. Assuming the interval is stopping by itself for some mysterious reason, see if you can narrow down the exact line at which the interval stops running.

David

Implicitly naming the hprInterval resolved the issue.

For me it’s not a big deal- I just generated a random number ran it through the str() command and set it as the name of the interval.

If it’s supposed to do this automatically, this may be a bug. I’m using 1.4.1 Windows binaries downloaded from the site.

>>> i1 = model.hprInterval(5,Point3(360,-15,0))
>>> i1.getName()
'LerpHprInterval-1'
>>> i2 = model.hprInterval(5,Point3(360,-15,0))
>>> i2.getName()
'LerpHprInterval-2'

Looks like it is working properly to me: each new interval gets the next consecutive index number, so there are no repeats.

Hmm. Is it possible you are reloading LerpInterval.py, and thereby resetting LerpNodePathInterval.lerpNodePathNum, which is the counter that is supposed to be incremented for each new interval?

David

Well, I don’t think I’m doing anything strange with the LerpInterval.py The only difference between your code in your last post and what I’m doing is that the hprintervals are in separate classes. I didn’t know about the .getName() function. I guess I could try that one the old code and see what’s happening.

i have run into this exact interval weirdness too, i no longer use intervals and consider them broken. It started happening when i would create 100+ intervals at a time think machine gun like projectiles. I also though they contributed to massive memory leaks … but since i remove the broken intervals completely memory steel leaks.

But when ever i tried to generate this problem with a simple program i failed. It only happens under load.

Bugs are always possible in any code, of course, but at the VR Studio we use intervals heavily in our online games, including Toontown and Pirates of the Carribbean, and the interval code itself has been largely stable and unchanged for years. I would indeed be very surprised to find a bug of this magnitude lurking within the interval code.

Still, I am curious to learn what mavasher reports from sampling the getName() method. This weird requirement that each interval must have a unique name has surprised more than one person before.

David

bugs? both on Linux & Win ?
I’ve never had somethg like that. This scene works perfectly :

from pandac.PandaModules import Point3,Vec3
import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from direct.interval.IntervalGlobal import *
from random import random
import sys


class MovingObj:
  def __init__(self):
      model=loader.loadModel('smiley')
      model.reparentTo(render)
      model.setScale(.2)
      model.posInterval(5,Point3(random(),random(),0)*5).loop()
      model.hprInterval(1,Vec3(360,0,0)).loop()
      

class World(DirectObject):
  def __init__(self):
      self.accept('escape',sys.exit)
      self.accept('space-repeat',self.createAnotherInstance)

      camera.setPos(-5,-5,10)
      camera.lookAt(render)
      base.mouseInterface.stash()
      
      self.numInstances=0
      MovingObj()

  def createAnotherInstance(self):
      MovingObj()
      self.numInstances+=1
      print self.numInstances

World()
run()

hold down SPACE.
How is it on yours ?

Well, I think the script has to be pretty large. For some reason it seems like the larger the script the more likely it is to have a problem.

Again, if you just implicitly name the interval it goes away.

yes, using the same name for some ivals doesn’t work :

model.hprInterval(1,Vec3(360,0,0),name='i')

it expects something like this :

model.hprInterval(1,Vec3(360,0,0),name='i%d')

or not named at all.

Any chance to expose the class ?