Sequencing/Controlling egg-texture-cards models

I succeeded in making 8 absolutely beautiful explosions using a program called Particle Illusion. For each, I saved a sequence of frames to PNG files then used the egg-texture-cards program to build an egg model. Now, I need to gain control over their animating capabilities so that I can make them appear [ model.show() ], start them animating at the first frame in the model [ ??? ], and then hide them again [ model.hide() ].

How would I do the [ ??? ] ? That is, how would I start them animating a the first frame and trap when the last frame was displayed so that I can hide it again? All I want to do is to be able to place the model at a specific point and trigger an explosion effect.

Or … would it be easier for me to create an AVI texture instead and use ‘movieTexture.play()’ when I need it to go BOOM! ?

Thanks,
Paul

model.node().play()

Note that you can also:

model.node().stop()
model.node().loop(restart = True)
model.node().pose(frame)

and so on. See SequenceNode in the generated docs for more (specifically, the methods inherited from AnimInterface).

You may need first to reset your model NodePath to the actual SequenceNode, e.g.:

model = loader.loadModel('myExplosion.egg')
model = model.find('**/+SequenceNode')

David

Oh yeah, best way to know when to hide it again after all frames have played is to do a doMethodLater() for the appropriate time, e.g. model.node().getNumFrames() * model.node().getFrameRate().

David

Excellent, thx!

Paul

BTW: Here is what I ended up doing :

class Explosion:
	def __init__(self,modelfile):

		scale = 10
		self.mModel = loader.loadModel(modelfile)
		self.mModel.setScale(scale,scale,scale)
		self.mModel.setColor(1,1,1)
		self.mModel.setBillboardPointEye()
		self.mModel.setLightOff()
		self.mNode = self.mModel.find('**/+SequenceNode')
		self.mNode.node().stop()
		self.mNode.node().pose(0)

	def hide(self):
		self.mModel.hide()

	def show(self):
		self.mModel.show()

	def reparentTo(self,parentNode) :
		self.mModel.reparentTo(parentNode)

	def explode(self) :
		self.mNode.node().stop()
		self.mNode.node().pose(0)
		self.mNode.node().play()

I’m trying to do the exact same thing yet my .egg file has no text ‘SequenceNode’

Here’s the file:

<Comment> {
  "egg-texture-cards -o explosion.egg -fps 30 shipExplosion0001.png shipExplosion0002.png shipExplosion0003.png shipExplosion0004.png shipExplosion0005.png shipExplosion0006.png shipExplosion0007.png shipExplosion0008.png shipExplosion0009.png shipExplosion0010.png shipExplosion0011.png shipExplosion0012.png shipExplosion0013.png shipExplosion0014.png shipExplosion0015.png shipExplosion0016.png shipExplosion0017.png shipExplosion0018.png shipExplosion0019.png shipExplosion0020.png shipExplosion0021.png shipExplosion0022.png shipExplosion0023.png shipExplosion0024.png shipExplosion0025.png shipExplosion0026.png shipExplosion0027.png shipExplosion0028.png shipExplosion0029.png shipExplosion0030.png shipExplosion0031.png shipExplosion0032.png shipExplosion0033.png shipExplosion0034.png shipExplosion0035.png shipExplosion0036.png shipExplosion0037.png shipExplosion0038.png shipExplosion0039.png shipExplosion0040.png shipExplosion0041.png shipExplosion0042.png shipExplosion0043.png shipExplosion0044.png shipExplosion0045.png shipExplosion0046.png shipExplosion0047.png shipExplosion0048.png shipExplosion0049.png shipExplosion0050.png shipExplosion0051.png shipExplosion0052.png shipExplosion0053.png shipExplosion0054.png shipExplosion0055.png shipExplosion0056.png shipExplosion0057.png shipExplosion0058.png shipExplosion0059.png shipExplosion0060.png"
}
<Texture> shipExplosion0060 {
  shipExplosion0060.png
}
<Texture> shipExplosion0059 {
  shipExplosion0059.png
}
<Texture> shipExplosion0058 {
  shipExplosion0058.png
}
<Texture> shipExplosion0057 {
  shipExplosion0057.png
}
<Texture> shipExplosion0056 {
  shipExplosion0056.png
}
<Texture> shipExplosion0055 {
  shipExplosion0055.png
}
<Texture> shipExplosion0054 {
  shipExplosion0054.png
}
<Texture> shipExplosion0053 {
  shipExplosion0053.png
}
<Texture> shipExplosion0052 {
  shipExplosion0052.png
}
<Texture> shipExplosion0051 {
  shipExplosion0051.png
}
<Texture> shipExplosion0050 {
  shipExplosion0050.png
}
<Texture> shipExplosion0049 {
  shipExplosion0049.png
}
<Texture> shipExplosion0048 {
  shipExplosion0048.png
}
<Texture> shipExplosion0047 {
  shipExplosion0047.png
}
<Texture> shipExplosion0046 {
  shipExplosion0046.png
}
<Texture> shipExplosion0045 {
  shipExplosion0045.png
}
<Texture> shipExplosion0044 {
  shipExplosion0044.png
}
<Texture> shipExplosion0043 {
  shipExplosion0043.png
}
<Texture> shipExplosion0042 {
  shipExplosion0042.png
}
<Texture> shipExplosion0041 {
  shipExplosion0041.png
}
<Texture> shipExplosion0040 {
  shipExplosion0040.png
}
<Texture> shipExplosion0039 {
  shipExplosion0039.png
}
<Texture> shipExplosion0038 {
  shipExplosion0038.png
}
<Texture> shipExplosion0037 {
  shipExplosion0037.png
}
<Texture> shipExplosion0036 {
  shipExplosion0036.png
}
<Texture> shipExplosion0035 {
  shipExplosion0035.png
}
<Texture> shipExplosion0034 {
  shipExplosion0034.png
}
<Texture> shipExplosion0033 {
  shipExplosion0033.png
}
<Texture> shipExplosion0032 {
  shipExplosion0032.png
}
<Texture> shipExplosion0031 {
  shipExplosion0031.png
}
<Texture> shipExplosion0030 {
  shipExplosion0030.png
}
<Texture> shipExplosion0029 {
  shipExplosion0029.png
}
<Texture> shipExplosion0028 {
  shipExplosion0028.png
}
<Texture> shipExplosion0027 {
  shipExplosion0027.png
}
<Texture> shipExplosion0026 {
  shipExplosion0026.png
}
<Texture> shipExplosion0025 {
  shipExplosion0025.png
}
<Texture> shipExplosion0024 {
  shipExplosion0024.png
}
<Texture> shipExplosion0023 {
  shipExplosion0023.png
}
<Texture> shipExplosion0022 {
  shipExplosion0022.png
}
<Texture> shipExplosion0021 {
  shipExplosion0021.png
}
<Texture> shipExplosion0020 {
  shipExplosion0020.png
}
<Texture> shipExplosion0019 {
  shipExplosion0019.png
}
<Texture> shipExplosion0018 {
  shipExplosion0018.png
}
<Texture> shipExplosion0017 {
  shipExplosion0017.png
}
<Texture> shipExplosion0016 {
  shipExplosion0016.png
}
<Texture> shipExplosion0015 {
  shipExplosion0015.png
}
<Texture> shipExplosion0014 {
  shipExplosion0014.png
}
<Texture> shipExplosion0013 {
  shipExplosion0013.png
}
<Texture> shipExplosion0012 {
  shipExplosion0012.png
}
<Texture> shipExplosion0011 {
  shipExplosion0011.png
}
<Texture> shipExplosion0010 {
  shipExplosion0010.png
}
<Texture> shipExplosion0009 {
  shipExplosion0009.png
}
<Texture> shipExplosion0008 {
  shipExplosion0008.png
}
<Texture> shipExplosion0007 {
  shipExplosion0007.png
}
<Texture> shipExplosion0006 {
  shipExplosion0006.png
}
<Texture> shipExplosion0005 {
  shipExplosion0005.png
}
<Texture> shipExplosion0004 {
  shipExplosion0004.png
}
<Texture> shipExplosion0003 {
  shipExplosion0003.png
}
<Texture> shipExplosion0002 {
  shipExplosion0002.png
}
<Texture> shipExplosion0001 {
  shipExplosion0001.png
}
<Group> {
  <Switch> { 1 }
  <Scalar> fps { 30 }
  <VertexPool> vpool {
    <Vertex> 0 {
      -0.5 0.5 0
      <UV> { 0 1 }
    }
    <Vertex> 1 {
      -0.5 -0.5 0
      <UV> { 0 0 }
    }
    <Vertex> 2 {
      0.5 -0.5 0
      <UV> { 1 0 }
    }
    <Vertex> 3 {
      0.5 0.5 0
      <UV> { 1 1 }
    }
  }
  <Group> shipExplosion0001 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0001 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0002 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0002 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0003 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0003 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0004 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0004 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0005 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0005 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0006 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0006 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0007 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0007 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0008 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0008 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0009 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0009 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0010 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0010 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0011 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0011 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0012 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0012 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0013 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0013 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0014 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0014 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0015 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0015 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0016 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0016 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0017 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0017 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0018 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0018 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0019 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0019 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0020 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0020 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0021 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0021 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0022 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0022 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0023 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0023 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0024 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0024 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0025 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0025 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0026 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0026 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0027 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0027 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0028 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0028 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0029 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0029 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0030 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0030 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0031 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0031 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0032 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0032 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0033 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0033 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0034 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0034 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0035 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0035 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0036 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0036 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0037 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0037 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0038 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0038 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0039 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0039 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0040 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0040 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0041 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0041 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0042 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0042 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0043 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0043 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0044 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0044 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0045 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0045 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0046 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0046 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0047 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0047 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0048 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0048 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0049 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0049 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0050 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0050 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0051 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0051 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0052 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0052 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0053 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0053 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0054 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0054 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0055 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0055 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0056 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0056 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0057 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0057 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0058 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0058 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0059 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0059 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
  <Group> shipExplosion0060 {
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <TRef> { shipExplosion0060 }
      <VertexRef> { 0 1 2 3 <Ref> { vpool } }
    }
  }
}

Whenever I try to play the explosion, I get a messed up texture.

img64.imageshack.us/img64/3383/s … bugpl5.png

That’s a screenshot of the bug. It won’t play the explosion properly. Also, the way I am doing it is from the CollisionEntry, entry.getIntoNodePath().getParent() and attach the explosion there. The problem is that if I remove the object, the explosion goes away as well, so I need a way to fix that but I’m not sure how. I’d want the model to disappear once the explosion animation stops playing but I should probably turn off collision on it so I don’t run into it.

Thanks.

I found out that it’s just taking my enemyship2.bmp (the ship’s texture) and showing that instead of my explosion. I don’t get it.