Game Development Community

Dynamically updating Editor Scene view

by William Trevino · in Torque Game Builder · 06/29/2011 (9:39 am) · 4 replies

Hi All,

I was wondering is there any way to have the TGB editor update dynamically when I change a value. Lets say I have a scene variable called Princess_saved and when it is set to 0 the object for the princess is invisible but when it is set to 1 I want the princess object to appear. I can do this in game and have started creating in game editors to help but I was hoping that I could avoid having to reinvent the wheel just to gain the same functionality as the TGB editor.


Has anyone run across this and does anyone have an idea how to do this or a work around for it???

Thanks,
William

#1
06/30/2011 (5:19 pm)
Well, the funny thing is that the TGB editor will "dynamically" update if you check or uncheck the "Visible" box under the "Scene Object". Please excuse me if I don't see how a scene variable to control the visibility of a single image is intuitive.

So in game, you must have some listener or callback that checks if "Princess_saved" is true or false and sets visibility accordingly. You could do something similar in the level editor, because in all truth, the level editor itself is a GUI and some TorqueScripts. Find it here:

TGB Installation Directory\tgb\tools\levelEditor
#2
07/01/2011 (9:30 am)
I think you are missing my point. My point isn't about making something visible or not my point is dynamically updating the scene window in the editor.

lets keep going with my princess saved example. If the princess isn't saved I want town guards all over the place and towns people hiding in their homes. Then after the princess is saved I want a giant celebration going on.

I want everything to update when I click on those events so it is easy to see how it will look in game and modify anything I need to

Thank you for the info on the levelEditor scripts thought I will start looking into it there.
#3
07/01/2011 (3:47 pm)
You basically need to add that functionality to the builder then, or another gui like you did. So that you can expose the in game event model to the builder.. Since the game's event model could be anything you coded, there is no way for TGB to tell what your in game event model would be or currently is. It just knows it's code that runs.

So, in the end, if you want game events like that exposed, you need to build your own gui extension to the builder for it, or just add an in game gui for development. That way you don't add something to TGB you don't really want added or may change a lot down the road. You should only add things to the TGB Builder if it's generic enough (like a sprite, or another general tool).

But for what TGB does know about and have controls for, it does automatically update the scenegraph and the object in question, AFAIK. I've never seen where it wouldn't.. Take a look at adding a new particle emitter as an example.
#4
07/02/2011 (10:43 pm)
William, hm gotcha, that example is much more exciting. IMHO it seems like more work than it's worth, when you can just run the game and see how it looks, but you know your needs better than I do. I second smally's advice.