DirectGUI (DirectWaitBar)...

In the docs it states that DirectGUI objects can be skinned with textures or geoms.

Does this mean for the DirectWaitBar I can have a custom border texture and then a custom fill texture as well? I don’t see it specifically as an option for DirectWaitBar but I found this post from drwr:

While it’s not mentioning DirectWaitBar per se, it mentions again that you can skin DirectGUI objects.

Steve

Yes, you certainly can. Looking at it now, I see that it really needs to have a barTexture setter, which it is currently lacking. I’ll add that, for the future. In the meantime, you can work around it, by setting the barStyle explicitly, like this:

grid = loader.loadTexture('maps/grid.rgb')
noise = loader.loadTexture('maps/noise.rgb')
wb = DirectWaitBar(frameSize = (0, 1, 0, 1),
                   scale = (1, 1, 0.1),
                   pos = (-1, 0, -0.95),
                   relief = FLAT,
                   frameColor = (1, 1, 1, 1),
                   frameTexture = noise,
                   barRelief = FLAT,
                   barColor = (1, 1, 1, 1))
wb.barStyle.setTexture(grid)
wb.updateBarStyle()

This will apply two different textures, one to the background frame, and one to the bar which adjusts in the middle. The texture is applied across the bar’s current length, so that as the bar moves across the frame, it will stretch the texture out as it goes. If what you want is to give the effect of the bar revealing the texture, where the texture remains in place and the bar moves through it, you can use Panda’s mechanism to generate texture coordinates based on the vertex positions, as described in the manual, like this:

ts = TextureStage.getDefault()
wb.setTexGen(ts, TexGenAttrib.MWorldPosition)
wb.setTexProjector(ts, render2d, wb);
wb.setTexTransform(ts, TransformState.makeHpr(VBase3(0, 90, 0)))

The first two calls, setTexGen and setTexProjector, are right out of the manual. The last line is also right out of the manual; it rotates the texture mapping 90 degrees so that it maps the X, Z coordinates to the U, V coordinates (since the Y coordinate is not used in render2d).

David

David,

As always, you go above and beyond! Thanks for taking the time.

I find the DirectGUI system one of the hardest parts of Panda3D to understand. It seems very cryptic or non-intuitive, from an outsider anyways.

Thanks again!

Steve