Game Development Community

BUG B5: GUI Editor uses script to populate

by Scott Peal · in Torque 3D Professional · 08/29/2009 (12:29 pm) · 7 replies

If you create a GUI then write a script to override the settings in the GUI file. The GUI Editor will show the settings of the script overrides and not the GUI file. This should not be. The GUI Editor should always just use the GUI file.

For example:

1. Create a window control and add two buttons with a visible flag set to true and save and close GUI editor.

2. Now create a script which will make one of the control's visible flag set to false and save and add to list of scripts to load.

3. Now open the GUI editor and you will see that one of the controls is gone.

4. Now save the GUI and look at it via Torsion. The code now shows the scripted override values and not the intended values. The 2nd button is in the file, but visible flag is set to false.

As a development tool we always need to see the GUI elements as they are defined in the GUI Editor and never have any scripts applied. Maybe a switch could be added to the GUI editor to change this behavior for those who want it and those who do not. If we layout a large form then use script to alter that form based upon some imported data, the original file layout (aka template) should not change.




#1
09/02/2009 (6:02 pm)
Logged as THREED-729
#2
09/02/2009 (6:36 pm)
While it's a valid complaint, I can't see a way to "fix" this without some pretty massive re-writes. GUI elements are objects like any other. Any object in Torque can be saved to a file. There's no distinction between a script setting a GUI element visible flag to false or hiding it via the GUI editor because the GUI editor itself is made of scripts. The GUIs are not templates, they are the objects themselves.

A system where each GUI has two copies, one that is used for editing and other that is used in-game, could work, but it would involve a huge lot of changes (right away there would be problems with same named objects).
#3
09/02/2009 (7:01 pm)
True to what Manoel said. If you're going to be using script to affect a gui you should be setting a default, changing, and 'zeroing' out the settings all from script anyway -- so it shouldn't matter what information was stored/saved in the GUI.
#4
09/02/2009 (10:58 pm)
Hasn't it always been this way ? Even when I used to work with TGEA 1.7.1 and AFX 1.8.1, If you executed a script THEN save the gui, it just saves what ever is currently on the screen, ie, whatever the state is, WYSIWYG (What you see is what you get). In my opinion this works just fine.

Just out of curiosity, if you don't expect the script to affect the GUI, why would you save the GUI after executing the script since... you did not expect anything to change... ? Just open it, test your function, then quit. Alternatively, as Michael said, just create a function to reset your GUI to its initial state. (This function is immensely useful and should be created anyway even if you don't intend to use it for this purpose :P)
#5
09/03/2009 (9:16 am)
Like Michael and Dreamarvel said, if you're manipulating any component you're via scripts it is good practice to have your scripts set the values you're manipulating to a default state when your game starts or when the GUI is displayed (depends on your needs).
#6
09/03/2009 (1:43 pm)
Quote:Hasn't it always been this way ?
Please don't take this as being hostile, but we don't know and don't care about other engines as we bought T3D :D

Quote:Just out of curiosity, if you don't expect the script to affect the GUI, why would you save the GUI after executing the script since... you did not expect anything to change... ?

The script is executed when we bring up the Torque Toolbox and click the GUI Editor button. We did not run the script, the GUI Editor did.

As part of our develop process, a developer will alter the GUI dynamicly based upon an XML file. For example, if the XML file has 3 categories and the GUI has 5 buttons, then hide the two buttons not used. When we replace the XML file with another XML and it may have 5 categories, then only hide one button.

Once the developer has completed their work, a graphic artist then makes look & feel changes to the GUI then saves. But that is impossible, because the GUI Editor is running the script after showing the contents of the *.gui file, thus hidding objects and making changes to labels, etc.

We feel this is a bug, just because there is a work-around or it has always been this way does not constitute it not being a bug. If you are a Visual Studio developer and you make a change to the code-behind of a form. The form does not run the code. It stays the same until the program is ran. It is the same way for all GUI editors I know as a professional programmer.

Setting the values to a default value is what the *.gui file should be for.

Just my 2 cents.






#7
09/03/2009 (1:46 pm)
Simple really. Keep your script separate from the GUI and don't execute it if all you want is for an artist to look at it.