.setBitmap()
by Ron Yacketta · in Torque Game Engine · 06/05/2003 (11:29 am) · 11 replies
Folks,
Here goes another one that by damn I know I should know!
How does one force an update to allow of swaping bitmaps from script?
I want to swap a bitmap image on the fly, but I can only seem to make
the change take effect if I enter and extit the editor (F10).
I am just doing a %somethingy.setBitmap(%somotherthing.bitmap);
I am also dynamicly setting images for the guibitmapbuttonctrl when onpickup is called. The images are not being displayed unless I do the editor trick above.
-Ron
Here goes another one that by damn I know I should know!
How does one force an update to allow of swaping bitmaps from script?
I want to swap a bitmap image on the fly, but I can only seem to make
the change take effect if I enter and extit the editor (F10).
I am just doing a %somethingy.setBitmap(%somotherthing.bitmap);
I am also dynamicly setting images for the guibitmapbuttonctrl when onpickup is called. The images are not being displayed unless I do the editor trick above.
-Ron
#2
NOTE: You could also probably do %something.repaint(); but I'm not sure if that function is inherited or not.
06/05/2003 (12:16 pm)
You can try doing a canvas.repaint(); after the call to change the bitmap.NOTE: You could also probably do %something.repaint(); but I'm not sure if that function is inherited or not.
#3
Another way to trigger an update on the specific control is to make the following call on the object ... %obj.setVisible(true). This will update the control and all its children only.
To answer Harold, Canvas.repaint() is a great way for updating all the current gui and can be very useful at times but unfortunately, isn't available on other controls. :(
If you're changing a control fairly fast, you'd definately want to target the control only for performance else simply do a canvas repaint as Harold suggested. Gotta' always think of those S3-Virge people etc!
Hope this helps bud.
- Melv.
06/05/2003 (10:33 pm)
Ron,Another way to trigger an update on the specific control is to make the following call on the object ... %obj.setVisible(true). This will update the control and all its children only.
To answer Harold, Canvas.repaint() is a great way for updating all the current gui and can be very useful at times but unfortunately, isn't available on other controls. :(
If you're changing a control fairly fast, you'd definately want to target the control only for performance else simply do a canvas repaint as Harold suggested. Gotta' always think of those S3-Virge people etc!
Hope this helps bud.
- Melv.
#4
Im using a S3 SuperSavage 16MB VRAM. Tribes2 and Torque works ... but some funky stuff (like blending more than 2 textures) make the models look either shiny or dark.
Alex
06/06/2003 (1:32 am)
Thanks Melv.Im using a S3 SuperSavage 16MB VRAM. Tribes2 and Torque works ... but some funky stuff (like blending more than 2 textures) make the models look either shiny or dark.
Alex
#5
I have now spent a good 5 hours (total) on this one little issue *sigh* what a royal pain in the arse this is becoming ;)
-Ron
P.S
%Parent/%Child.setVisible(0) then a %Parent/%Child.setVisible(1) does not do jack either
06/06/2003 (4:35 am)
Something is really odd.. I have tried the Canvas.repaint() and the %parent.setVisible() as well as %child.setVisible() and the bitmaps never change until I enter/exit the editor.I have now spent a good 5 hours (total) on this one little issue *sigh* what a royal pain in the arse this is becoming ;)
-Ron
P.S
%Parent/%Child.setVisible(0) then a %Parent/%Child.setVisible(1) does not do jack either
#6
If you run-up the stock TGE code and give the "Credits" button on the main-menu the name, "cmdCredits" within the editor.
Then, in the console, type "cmdCredits.setVisible(false);" and it should dissapear.
If, in your code, "RonsControl.setVisible(false);" doesn't make it disappear then you've definately got some kind of script problem.
Of course, I am assuming your are using the stock, "GuiBitmapCtrl". When you call the ".setBitmap" function, it loads the texture (which must of been in place when you started the TGE) and calls "setUpdate()" which triggers a render next rendering pass.
- Melv.
06/06/2003 (4:44 am)
Ron,If you run-up the stock TGE code and give the "Credits" button on the main-menu the name, "cmdCredits" within the editor.
Then, in the console, type "cmdCredits.setVisible(false);" and it should dissapear.
If, in your code, "RonsControl.setVisible(false);" doesn't make it disappear then you've definately got some kind of script problem.
Of course, I am assuming your are using the stock, "GuiBitmapCtrl". When you call the ".setBitmap" function, it loads the texture (which must of been in place when you started the TGE) and calls "setUpdate()" which triggers a render next rendering pass.
- Melv.
#7
It does disappear :) and reappear BUT with the old bitmap. I think it is a bug in GuiBitmapButtonCtrl, I do not have this issue with GuiBitmap. I can flop the bitmaps of a GuiBitmapCtrl around at will and they take effect.
Here is what I am trying to-do (high level overview)
have 3 buttons, each with an image. If button 1 or 3 is selectred it's image would be swapped with image 2. I can do this with GuiBitmapCtrl, but lack mouse ability. Using GuiBitmapButtonCtrl does not work, unless one enters/exits the editor.
-Ron
06/06/2003 (6:08 am)
Melv,It does disappear :) and reappear BUT with the old bitmap. I think it is a bug in GuiBitmapButtonCtrl, I do not have this issue with GuiBitmap. I can flop the bitmaps of a GuiBitmapCtrl around at will and they take effect.
Here is what I am trying to-do (high level overview)
have 3 buttons, each with an image. If button 1 or 3 is selectred it's image would be swapped with image 2. I can do this with GuiBitmapCtrl, but lack mouse ability. Using GuiBitmapButtonCtrl does not work, unless one enters/exits the editor.
-Ron
#8
06/06/2003 (6:47 am)
You could use a animated bitmap control where the animations are 1 frame long. there's 2 different resources for animated bitmaps. one is mine, the other is an improved version of mine. I would choose the improved version. You can do this with one of these guys. Good luck. Robert.
#9
does the animated control accept mouse events? such that clicking an animated control could fire a command etc.. to swap images?
Also, that would mean each control would have to have an animation (IFL?) list of every single bitmap, correct?
-Ron
06/06/2003 (7:11 am)
Robert,does the animated control accept mouse events? such that clicking an animated control could fire a command etc.. to swap images?
Also, that would mean each control would have to have an animation (IFL?) list of every single bitmap, correct?
-Ron
#10
I changed it to be a child of GuiControl and include "gui/guiButtonBaseCtrl.h"
now I just do a %button.setVisible(1) (as Melv said) and all works.
Thanxs for the help guys!!!
-Ron
06/06/2003 (7:44 am)
Fixed it :) it was a bug in GuiBitmapButtonCtrlI changed it to be a child of GuiControl and include "gui/guiButtonBaseCtrl.h"
now I just do a %button.setVisible(1) (as Melv said) and all works.
Thanxs for the help guys!!!
-Ron
#11
I thought you meant the GuiBitmapCtrl ...
Glad you got it working, :)
- Melv.
06/06/2003 (11:31 am)
...ahh I see ...I thought you meant the GuiBitmapCtrl ...
Glad you got it working, :)
- Melv.
Torque 3D Owner Stefan Rampp
Use %somethingy.setUpdate(); to tell the gui component to refresh.
Stefan.