TGB/Resources/Making the Default GUI Profiles Show Up in TGB

From TDN

First of all I hope this is useful for those who have the source access to TGB/T2D. This was written w/ version 1.7.5 in mind, if you aren't using this version, I suggest you do, before trying to apply the source updates to an earlier version. I don't know where it may be at in the earlier version(s), but it may be around the same place mentioned.

Ok, so this is actually a very easy fix to the engine code to allow the default or "common" GUI Profiles to show up in the builder while you are working on your game.

We are going to work on the file engine/source/gui/editor/guiInspectorTypes.cc. This file should be located within your TGB engine source tree. I do not know where you installed TGB, so I've included the full path below the TGB installation directory here, just to clarify.

Your going to go to line 162 (in 1.7.5, otherwise, around line 162) and find this block of code:

      if(profile)
      {
         // rdbnote: added the below for the tool because we only want to show gui profiles
         // from the game if we are in release mode...
#ifdef TORQUE_TOOLS
#  ifdef TORQUE_DEBUG
         entries.push_back(profile->getName());
#  else
         // check whether this is coming from the 'game' or 'tool'
         bool samePath = dStrstr(profile->getScriptFile(), Platform::getExecutablePath()) != NULL;
         bool isDefault = dStrcmp(profile->getName(), "GuiDefaultProfile") == 0;

         if (!samePath || isDefault)
            entries.push_back(profile->getName());
#  endif
#else
         entries.push_back(profile->getName());
#endif
      }

This should be contained within the class member method/function

GuiControl* GuiInspectorTypeGuiProfile::constructEditControl()


Now that you have found this block, the fix to this is really easy. After line 172 add a blank line and input this code:

bool isCommon = dStrstr(profile->getScriptFile(), "/common/gui/") != NULL;

Next on line 174, you want to find this code:

if (!samePath || isDefault)

and change it to add in the check we just input. So, it should look like this:

if (!samePath || isDefault || isCommon)

Explanation of code added:

This will add a boolean variable "isCommon" that checks if the profile being processed resides in the "/common/gui" directory. I didn't get any more specific than that with this fix, because it's not needed. The path "/common/gui" should have a file named "profiles.cs" inside of it that holds all of the "common" profiles used in the GUI Editor, or TorqueScript. Unless you have modified this script file and removed those profiles, after you rebuild the engine and the builder executable w/ this code, you should now have access to all of those profiles in the GUI Builder.

Now, after you have added and changed that code, just rebuild your engine and builder executable, and VIOLA! You have access to those GuiProfiles.

Here is a link to reference the GuiControlProfile object that these profiles are based from. It has all of the relevant fields you would need to know about and an explanation of 99% of them. Good stuff.

Reference for GuiControlProfile

Hope this has helped some of you out there!