DirectButton - rollover Effect [SOLVED]

Hi all,

I am working on a GUI, and the Direct button is giving me some headaches… :slight_smile:

Here http://screencast.com/t/wPTErjrZ, i have a simple attempt of usage of DirectButton, thanks Thomas i have no ugly gray box :slight_smile:, but that rollover effect, which is causing distortion (in the width of button and also the word), still bothers me, in a near future i intend to simple change colors through out the states.

Does someone know how can I stop that effect?

Thanks a lot,
Paulo

If you set an explicit state for your rollover effect with the multiple-state form of geom, text, and/or texture option, then it won’t scale the button. It only scales them when you give it a single-state form, so in that case it has to synthesize the rollover effect internally by applying a scale.

This looks something like:

b = DirectButton(geom = (geom0, geom1, geom2, geom3))

where geom0, geom1, geom2, geom3 are four different NodePaths, which show what the button should look like in the ready, clicked, rollover, and disabled state, respectively.

David

Thanks David, but…

I follow the manual and my code is the following:

# Add button
maps = loader.loadModel('../Modelos/buttons/btJogar')
b = DirectButton(frameColor = (0.5,0.5,0.5,0.5),
                 frameSize = (-.5,.5, -.2,.2),
                 relief = 0,
                 pressEffect = 0,
                 geom =(maps.find('**/jogar_ready'),
                        maps.find('**/jogar_click'),
                        maps.find('**/jogar_rollover'),
                        maps.find('**/jogar_disabled')), scale=.5, command=setText)

b['geom_scale'] = (1,1,.4)
b.reparentTo(myFrame)
b.setPos(0.5,0,0)

is this way correct? or should i create an unique egg-card for each geom?
I used the follow code to generate the maps:

egg-texture-cards -o btJogar.egg -p 256,64 jogar_ready.png jogar_click.png jogar_rollover.png jogar_disabled.png 

But the distortions continues…

Paulo

Hmm, no, that should be sufficient. Let me try to reproduce this.

David

do want the files?

I am using panda 1.6.0 for OSX

Hmm, so far unable to reproduce. I try your code with my own textures, and I observe no visible distortion.

So, OK, please send me your files, and I’ll see what it looks like with your textures. Are you sure the distortion you’re observing isn’t something intrinsic in the textures themselves?

David

shoot! Yeah David, you were right! the rollover texture was in a different size… and i didn’t realized that, thanks for the help, and i’m sorry for bothering you.