Ver código fonte

Adds ability to adjust padding to guiTextListCtrl's rows
ForcedMaterialMeshMgr tweaked to allow proper setting of override material
Ongoing WIP of update/fixing of options menus
WIP of expanded visualizers, including material complexity viz
Adds no-pie flag when compiling on linux with non-clang compilers

Areloch 6 anos atrás
pai
commit
7c3bd49615

+ 4 - 2
Engine/source/gui/controls/guiTextListCtrl.cpp

@@ -125,6 +125,7 @@ GuiTextListCtrl::GuiTextListCtrl()
    mColumnOffsets.push_back(0);
    mFitParentWidth = true;
    mClipColumnText = false;
+   mRowHeightPadding = 2;
 }
 
 void GuiTextListCtrl::initPersistFields()
@@ -132,6 +133,7 @@ void GuiTextListCtrl::initPersistFields()
    addField("columns",                 TypeS32Vector, Offset(mColumnOffsets, GuiTextListCtrl), "A vector of column offsets.  The number of values determines the number of columns in the table.\n" );
    addField("fitParentWidth",          TypeBool, Offset(mFitParentWidth, GuiTextListCtrl), "If true, the width of this control will match the width of its parent.\n");
    addField("clipColumnText",          TypeBool, Offset(mClipColumnText, GuiTextListCtrl), "If true, text exceeding a column's given width will get clipped.\n" );
+   addField("rowHeightPadding", TypeS32, Offset(mRowHeightPadding, GuiTextListCtrl), "Sets how much padding to add to the row heights on top of the font height");
    Parent::initPersistFields();
 }
 
@@ -205,7 +207,7 @@ void GuiTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected,
          else
             slen = dStrlen(text);
 
-         Point2I pos(offset.x + 4 + mColumnOffsets[index], offset.y);
+         Point2I pos(offset.x + 4 + mColumnOffsets[index], offset.y + mRowHeightPadding / 2);
 
          RectI saveClipRect;
          bool clipped = false;
@@ -368,7 +370,7 @@ void GuiTextListCtrl::setSize(Point2I newSize)
          mCellSize.x = maxWidth + 8;
       }
 
-      mCellSize.y = mFont->getHeight() + 2;
+      mCellSize.y = mFont->getHeight() + mRowHeightPadding;
    }
 
    Point2I newExtent( newSize.x * mCellSize.x + mHeaderDim.x, newSize.y * mCellSize.y + mHeaderDim.y );

+ 1 - 0
Engine/source/gui/controls/guiTextListCtrl.h

@@ -56,6 +56,7 @@ class GuiTextListCtrl : public GuiArrayCtrl
 
    bool  mFitParentWidth;
    bool  mClipColumnText;
+   S32   mRowHeightPadding;
 
    U32 getRowWidth(Entry *row);
    bool cellSelected(Point2I cell);

+ 1 - 0
Engine/source/gui/editor/popupMenu.cpp

@@ -296,6 +296,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */)
       mTextList = new GuiPopupMenuTextListCtrl();
       mTextList->registerObject();
       mTextList->setControlProfile(profile);
+      mTextList->mRowHeightPadding = 5;
 
       mTextList->mPopup = this;
       mTextList->mMenuBar = getMenuBarCtrl();

+ 4 - 3
Engine/source/renderInstance/forcedMaterialMeshMgr.cpp

@@ -126,9 +126,10 @@ const char* ForcedMaterialMeshMgr::_getOverrideMat( void *object, const char *da
 bool ForcedMaterialMeshMgr::_setOverrideMat( void *object, const char *index, const char *data )
 {
    ForcedMaterialMeshMgr &mgr = *reinterpret_cast<ForcedMaterialMeshMgr *>( object );   
-   BaseMatInstance* material;
-   Sim::findObject( data, material );
-   mgr.setOverrideMaterial( material );
+   Material* material;
+   Sim::findObject(data, material);
+   mgr.mOverrideMaterial = material;
+
    return false;
 }
 

+ 2 - 0
Templates/BaseGame/game/data/ui/UI.cs

@@ -73,8 +73,10 @@ function UI::initClient(%this)
    
    //Load scripts
    exec("./scripts/optionsList.cs");
+   exec("./scripts/displayMenu.cs");
    exec("./scripts/graphicsMenu.cs");
    exec("./scripts/controlsMenu.cs");
+   exec("./scripts/audioMenu.cs");
    exec("./scripts/messageBoxes.cs");
    exec("./scripts/help.cs");
    exec("./scripts/cursors.cs");

+ 11 - 226
Templates/BaseGame/game/data/ui/guis/optionsMenu.cs

@@ -70,6 +70,7 @@ function OptionsMenu::onWake(%this)
       text = "Keyboard and Mouse";
       profile = GuiMenuButtonProfile;
       extent = %array.extent.x SPC "35";
+      command="ControlsMenu::loadSettings();";
    };
    
    %controllerMenuBtn = new GuiButtonCtrl(){
@@ -104,14 +105,15 @@ function OptionsMenu::onWake(%this)
       text = "Gameplay";
       profile = GuiMenuButtonProfile;
       extent = %array.extent.x SPC "35";
+      command="GameplayMenu::loadSettings();";
    };
    
    %array.add(%keyboardMenuBtn);
-   %array.add(%controllerMenuBtn);
+   //%array.add(%controllerMenuBtn);
    %array.add(%displayMenuBtn);
    %array.add(%graphicsMenuBtn);
    %array.add(%audioMenuBtn);
-   %array.add(%gameplayMenuBtn);
+   //%array.add(%gameplayMenuBtn);
    
    //We programmatically set up our settings here so we can do some prepwork on the fields/controls
    //Presets
@@ -143,6 +145,13 @@ function OptionsMenu::onWake(%this)
    OptionsMenu.addSettingOption(%array, "Water Reflections", "On", ShadowQualityList, $pref::Video::Resolution);
    
    OptionsMenu.addSettingOption(%array, "Anisotropic Filtering", "16x", ShadowQualityList, $pref::Video::Resolution);*/
+   
+   if(!isObject(GraphicsSettingsCache))
+   {
+      new ArrayObject(GraphicsSettingsCache){};
+   }
+   
+   GraphicsSettingsCache.empty();
 }
 
 function OptionsMenuOKButton::onClick(%this)
@@ -438,228 +447,4 @@ function CameraMenuOKButton::onClick(%this)
 function CameraMenuDefaultsButton::onClick(%this)
 {
    
-}
-// =============================================================================
-// AUDIO MENU
-// =============================================================================
-$AudioTestHandle = 0;
-// Description to use for playing the volume test sound.  This isn't
-// played with the description of the channel that has its volume changed
-// because we know nothing about the playback state of the channel.  If it
-// is paused or stopped, the test sound would not play then.
-$AudioTestDescription = new SFXDescription()
-{
-   sourceGroup = AudioChannelMaster;
-};
-
-function AudioMenu::loadSettings(%this)
-{
-   // Audio
-   //OptAudioHardwareToggle.setStateOn($pref::SFX::useHardware);
-   //OptAudioHardwareToggle.setActive( true );
-   
-   %this-->OptAudioVolumeMaster.setValue( $pref::SFX::masterVolume );
-   %this-->OptAudioVolumeShell.setValue( $pref::SFX::channelVolume[ $GuiAudioType] );
-   %this-->OptAudioVolumeSim.setValue( $pref::SFX::channelVolume[ $SimAudioType ] );
-   %this-->OptAudioVolumeMusic.setValue( $pref::SFX::channelVolume[ $MusicAudioType ] );
-   
-   AudioMenuSoundDriver.clear();
-   %buffer = sfxGetAvailableDevices();
-   %count = getRecordCount( %buffer );   
-   for(%i = 0; %i < %count; %i++)
-   {
-      %record = getRecord(%buffer, %i);
-      %provider = getField(%record, 0);
-      
-      if ( AudioMenuSoundDriver.findText( %provider ) == -1 )
-            AudioMenuSoundDriver.add( %provider, %i );
-   }
-   
-   AudioMenuSoundDriver.sort();
-
-   %selId = AudioMenuSoundDriver.findText($pref::SFX::provider);
-	if ( %selId == -1 )
-		AudioMenuSoundDriver.setFirstSelected();
-   else
-	   AudioMenuSoundDriver.setSelected( %selId );
-}
-
-function AudioMenu::loadDevices(%this)
-{
-   if(!isObject(SoundDeviceGroup))
-   {
-      new SimGroup( SoundDeviceGroup );
-   }
-   else
-   {
-      SoundDeviceGroup.clear();
-   }
-   
-   %buffer = sfxGetAvailableDevices();
-   %count = getRecordCount( %buffer );
-   for (%i = 0; %i < %count; %i++)
-   {
-      %record = getRecord(%buffer, %i);
-      %provider = getField(%record, 0);
-      %device = getField(%record, 1);
-         
-      if($pref::SFX::provider !$= %provider)
-         continue;
-      
-      %setting = new ArrayObject()
-      {
-         class = "OptionsMenuSettingLevel";
-         caseSensitive = true;
-         
-         displayName = %device;
-         
-         key["$pref::SFX::Device"] = %device;
-      };
-      
-      SoundDeviceGroup.add(%setting);
-   }
-}
-
-function AudioMenu::apply(%this)
-{
-   sfxSetMasterVolume( $pref::SFX::masterVolume );
-   
-   sfxSetChannelVolume( $GuiAudioType, $pref::SFX::channelVolume[ $GuiAudioType ] );
-   sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
-   sfxSetChannelVolume( $MusicAudioType, $pref::SFX::channelVolume[ $MusicAudioType ] );
-   
-   if ( !sfxCreateDevice(  $pref::SFX::provider, 
-                           $pref::SFX::device, 
-                           $pref::SFX::useHardware,
-                           -1 ) )                              
-      error( "Unable to create SFX device: " @ $pref::SFX::provider 
-                                             SPC $pref::SFX::device 
-                                             SPC $pref::SFX::useHardware );        
-
-   if( !isObject( $AudioTestHandle ) )
-   {
-      sfxPlay(menuButtonPressed);
-   }
-}
-
-function AudioMenuOKButton::onClick(%this)
-{
-   //save the settings and then back out
-    AudioMenu.apply();
-    OptionsMenu.backOut();
-}
-
-function AudioMenuDefaultsButton::onClick(%this)
-{
-   sfxInit();
-   AudioMenu.loadSettings();
-}
-
-function OptAudioUpdateMasterVolume( %volume )
-{
-   if( %volume == $pref::SFX::masterVolume )
-      return;
-      
-   sfxSetMasterVolume( %volume );
-   $pref::SFX::masterVolume = %volume;
-   
-   if( !isObject( $AudioTestHandle ) )
-      $AudioTestHandle = sfxPlayOnce( AudioChannel, "data/ui/sounds/volumeTest.wav" );
-}
-
-function OptAudioUpdateChannelVolume( %description, %volume )
-{
-   %channel = sfxGroupToOldChannel( %description.sourceGroup );
-   
-   if( %volume == $pref::SFX::channelVolume[ %channel ] )
-      return;
-
-   sfxSetChannelVolume( %channel, %volume );
-   $pref::SFX::channelVolume[ %channel ] = %volume;
-   
-   if( !isObject( $AudioTestHandle ) )
-   {
-      $AudioTestDescription.volume = %volume;
-      $AudioTestHandle = sfxPlayOnce( $AudioTestDescription, "data/ui/sounds/volumeTest.wav" );
-   }
-}
-
-function AudioMenuSoundDriver::onSelect( %this, %id, %text )
-{
-   // Skip empty provider selections.   
-   if ( %text $= "" )
-      return;
-      
-   $pref::SFX::provider = %text;
-   AudioMenuSoundDevice.clear();
-   
-   %buffer = sfxGetAvailableDevices();
-   %count = getRecordCount( %buffer );   
-   for(%i = 0; %i < %count; %i++)
-   {
-      %record = getRecord(%buffer, %i);
-      %provider = getField(%record, 0);
-      %device = getField(%record, 1);
-      
-      if (%provider !$= %text)
-         continue;
-            
-       if ( AudioMenuSoundDevice.findText( %device ) == -1 )
-            AudioMenuSoundDevice.add( %device, %i );
-   }
-
-   // Find the previous selected device.
-   %selId = AudioMenuSoundDevice.findText($pref::SFX::device);
-   if ( %selId == -1 )
-      AudioMenuSoundDevice.setFirstSelected();
-   else
-   AudioMenuSoundDevice.setSelected( %selId );
-}
-
-function AudioMenuSoundDevice::onSelect( %this, %id, %text )
-{
-   // Skip empty selections.
-   if ( %text $= "" )
-      return;
-      
-   $pref::SFX::device = %text;
-   
-   if ( !sfxCreateDevice(  $pref::SFX::provider, 
-                           $pref::SFX::device, 
-                           $pref::SFX::useHardware,
-                           -1 ) )                              
-      error( "Unable to create SFX device: " @ $pref::SFX::provider 
-                                             SPC $pref::SFX::device 
-                                             SPC $pref::SFX::useHardware );                                             
-}
-
-//==============================================================================
-// DISPLAY MENU
-//==============================================================================
-function DisplayMenu::loadSettings()
-{
-   OptionsSettingStack.clear();
-   
-   OptionsMenu.addSettingOption(OptionsSettingStack, "Resolution", "1024 x 768", "", $pref::Video::Resolution);
-   OptionsMenu.addSettingOption(OptionsSettingStack, "Full Screen", "Off", "", $pref::Video::FullScreen);
-   OptionsMenu.addSettingOption(OptionsSettingStack, "Refresh Rate", "60", "", $pref::Video::RefreshRate);
-   OptionsMenu.addSettingOption(OptionsSettingStack, "VSync", "Off", "", $pref::Video::Vsync);
-   
-   OptionsMenu.addSliderOption(OptionsSettingStack, "Field of View", $pref::Video::FOV, "65 120", 55, 75);
-   
-   OptionsMenu.addSliderOption(OptionsSettingStack, "Brightness", $pref::Video::Brightness, "0 1", 10, 5);
-   OptionsMenu.addSliderOption(OptionsSettingStack, "Contrast", $pref::Video::Contrast, "0 1", 10, 5);
-}
-
-//==============================================================================
-// AUDIO MENU
-//==============================================================================
-function AudioMenu::loadSettings()
-{
-   OptionsSettingStack.clear();
-   
-   OptionsMenu.addSliderOption(OptionsSettingStack, "Master Volume", $pref::Video::Brightness, "0 1", 10, 5);
-   OptionsMenu.addSliderOption(OptionsSettingStack, "Menu Volume", $pref::Video::Brightness, "0 1", 10, 5);
-   OptionsMenu.addSliderOption(OptionsSettingStack, "Effects Volume", $pref::Video::Brightness, "0 1", 10, 5);
-   OptionsMenu.addSliderOption(OptionsSettingStack, "Music Volume", $pref::Video::Brightness, "0 1", 10, 5);
 }

+ 200 - 0
Templates/BaseGame/game/data/ui/scripts/audioMenu.cs

@@ -0,0 +1,200 @@
+// =============================================================================
+// AUDIO MENU
+// =============================================================================
+$AudioTestHandle = 0;
+// Description to use for playing the volume test sound.  This isn't
+// played with the description of the channel that has its volume changed
+// because we know nothing about the playback state of the channel.  If it
+// is paused or stopped, the test sound would not play then.
+$AudioTestDescription = new SFXDescription()
+{
+   sourceGroup = AudioChannelMaster;
+};
+
+function AudioMenu::loadSettings(%this)
+{
+   // Audio
+   //OptAudioHardwareToggle.setStateOn($pref::SFX::useHardware);
+   //OptAudioHardwareToggle.setActive( true );
+   
+   /*%this-->OptAudioVolumeMaster.setValue( $pref::SFX::masterVolume );
+   %this-->OptAudioVolumeShell.setValue( $pref::SFX::channelVolume[ $GuiAudioType] );
+   %this-->OptAudioVolumeSim.setValue( $pref::SFX::channelVolume[ $SimAudioType ] );
+   %this-->OptAudioVolumeMusic.setValue( $pref::SFX::channelVolume[ $MusicAudioType ] );
+   
+   AudioMenuSoundDriver.clear();
+   %buffer = sfxGetAvailableDevices();
+   %count = getRecordCount( %buffer );   
+   for(%i = 0; %i < %count; %i++)
+   {
+      %record = getRecord(%buffer, %i);
+      %provider = getField(%record, 0);
+      
+      if ( AudioMenuSoundDriver.findText( %provider ) == -1 )
+            AudioMenuSoundDriver.add( %provider, %i );
+   }
+   
+   AudioMenuSoundDriver.sort();
+
+   %selId = AudioMenuSoundDriver.findText($pref::SFX::provider);
+	if ( %selId == -1 )
+		AudioMenuSoundDriver.setFirstSelected();
+   else
+	   AudioMenuSoundDriver.setSelected( %selId );*/
+	   
+   OptionsSettingStack.clear();
+   
+   OptionsMenu.addSliderOption(OptionsSettingStack, "Master Volume", $pref::Video::Brightness, "0 1", 10, 5);
+   OptionsMenu.addSliderOption(OptionsSettingStack, "Menu Volume", $pref::Video::Brightness, "0 1", 10, 5);
+   OptionsMenu.addSliderOption(OptionsSettingStack, "Effects Volume", $pref::Video::Brightness, "0 1", 10, 5);
+   OptionsMenu.addSliderOption(OptionsSettingStack, "Music Volume", $pref::Video::Brightness, "0 1", 10, 5);
+}
+
+function AudioMenu::loadDevices(%this)
+{
+   if(!isObject(SoundDeviceGroup))
+   {
+      new SimGroup( SoundDeviceGroup );
+   }
+   else
+   {
+      SoundDeviceGroup.clear();
+   }
+   
+   %buffer = sfxGetAvailableDevices();
+   %count = getRecordCount( %buffer );
+   for (%i = 0; %i < %count; %i++)
+   {
+      %record = getRecord(%buffer, %i);
+      %provider = getField(%record, 0);
+      %device = getField(%record, 1);
+         
+      if($pref::SFX::provider !$= %provider)
+         continue;
+      
+      %setting = new ArrayObject()
+      {
+         class = "OptionsMenuSettingLevel";
+         caseSensitive = true;
+         
+         displayName = %device;
+         
+         key["$pref::SFX::Device"] = %device;
+      };
+      
+      SoundDeviceGroup.add(%setting);
+   }
+}
+
+function AudioMenu::apply(%this)
+{
+   sfxSetMasterVolume( $pref::SFX::masterVolume );
+   
+   sfxSetChannelVolume( $GuiAudioType, $pref::SFX::channelVolume[ $GuiAudioType ] );
+   sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
+   sfxSetChannelVolume( $MusicAudioType, $pref::SFX::channelVolume[ $MusicAudioType ] );
+   
+   if ( !sfxCreateDevice(  $pref::SFX::provider, 
+                           $pref::SFX::device, 
+                           $pref::SFX::useHardware,
+                           -1 ) )                              
+      error( "Unable to create SFX device: " @ $pref::SFX::provider 
+                                             SPC $pref::SFX::device 
+                                             SPC $pref::SFX::useHardware );        
+
+   if( !isObject( $AudioTestHandle ) )
+   {
+      sfxPlay(menuButtonPressed);
+   }
+}
+
+function AudioMenuOKButton::onClick(%this)
+{
+   //save the settings and then back out
+    AudioMenu.apply();
+    OptionsMenu.backOut();
+}
+
+function AudioMenuDefaultsButton::onClick(%this)
+{
+   sfxInit();
+   AudioMenu.loadSettings();
+}
+
+function OptAudioUpdateMasterVolume( %volume )
+{
+   if( %volume == $pref::SFX::masterVolume )
+      return;
+      
+   sfxSetMasterVolume( %volume );
+   $pref::SFX::masterVolume = %volume;
+   
+   if( !isObject( $AudioTestHandle ) )
+      $AudioTestHandle = sfxPlayOnce( AudioChannel, "data/ui/sounds/volumeTest.wav" );
+}
+
+function OptAudioUpdateChannelVolume( %description, %volume )
+{
+   %channel = sfxGroupToOldChannel( %description.sourceGroup );
+   
+   if( %volume == $pref::SFX::channelVolume[ %channel ] )
+      return;
+
+   sfxSetChannelVolume( %channel, %volume );
+   $pref::SFX::channelVolume[ %channel ] = %volume;
+   
+   if( !isObject( $AudioTestHandle ) )
+   {
+      $AudioTestDescription.volume = %volume;
+      $AudioTestHandle = sfxPlayOnce( $AudioTestDescription, "data/ui/sounds/volumeTest.wav" );
+   }
+}
+
+function AudioMenuSoundDriver::onSelect( %this, %id, %text )
+{
+   // Skip empty provider selections.   
+   if ( %text $= "" )
+      return;
+      
+   $pref::SFX::provider = %text;
+   AudioMenuSoundDevice.clear();
+   
+   %buffer = sfxGetAvailableDevices();
+   %count = getRecordCount( %buffer );   
+   for(%i = 0; %i < %count; %i++)
+   {
+      %record = getRecord(%buffer, %i);
+      %provider = getField(%record, 0);
+      %device = getField(%record, 1);
+      
+      if (%provider !$= %text)
+         continue;
+            
+       if ( AudioMenuSoundDevice.findText( %device ) == -1 )
+            AudioMenuSoundDevice.add( %device, %i );
+   }
+
+   // Find the previous selected device.
+   %selId = AudioMenuSoundDevice.findText($pref::SFX::device);
+   if ( %selId == -1 )
+      AudioMenuSoundDevice.setFirstSelected();
+   else
+   AudioMenuSoundDevice.setSelected( %selId );
+}
+
+function AudioMenuSoundDevice::onSelect( %this, %id, %text )
+{
+   // Skip empty selections.
+   if ( %text $= "" )
+      return;
+      
+   $pref::SFX::device = %text;
+   
+   if ( !sfxCreateDevice(  $pref::SFX::provider, 
+                           $pref::SFX::device, 
+                           $pref::SFX::useHardware,
+                           -1 ) )                              
+      error( "Unable to create SFX device: " @ $pref::SFX::provider 
+                                             SPC $pref::SFX::device 
+                                             SPC $pref::SFX::useHardware );                                             
+}

+ 17 - 17
Templates/BaseGame/game/data/ui/scripts/controlsMenu.cs

@@ -49,7 +49,7 @@ $RemapCmd[$RemapCount] = "toggleCamera";
 $RemapGroup[$RemapCount] = "Miscellaneous";
 $RemapCount++;
 
-function ControlsMenu::onWake(%this)
+function ControlsMenu::loadSettings(%this)
 {
    ControlSetList.clear();
    ControlSetList.add( "Movement", "Movement" );
@@ -58,9 +58,9 @@ function ControlsMenu::onWake(%this)
    
    ControlSetList.setSelected( "Movement", false );
    
-   ControlsMenuOptionsArray.clear();
-   ControlsMenu.loadGroupKeybinds("Movement");
-   ControlsMenuOptionsArray.refresh();
+   OptionsSettingStack.clear();
+   loadGroupKeybinds("Movement");
+   //ControlsMenuOptionsArray.refresh();
 }
 
 function ControlSetList::onSelect( %this, %id, %text )
@@ -68,13 +68,13 @@ function ControlSetList::onSelect( %this, %id, %text )
    ControlsMenuOptionsArray.clear();
    
    if(%text $= "Movement")
-      ControlsMenu.loadGroupKeybinds("Movement");
+      loadGroupKeybinds("Movement");
    else if(%text $= "Combat")
-      ControlsMenu.loadGroupKeybinds("Combat");
+      loadGroupKeybinds("Combat");
    else if(%text $= "Miscellaneous")
-      ControlsMenu.loadGroupKeybinds("Miscellaneous");
+      loadGroupKeybinds("Miscellaneous");
 
-    ControlsMenuOptionsArray.refresh();
+    //ControlsMenuOptionsArray.refresh();
 }
 
 function ControlsMenuOKButton::onClick(%this)
@@ -94,7 +94,7 @@ function ControlsMenuDefaultsButton::onClick(%this)
    ControlsMenu.reload();
 }
 
-function ControlsMenu::loadGroupKeybinds(%this, %keybindGroup)
+function loadGroupKeybinds(%keybindGroup)
 {
    %optionIndex = 0;
    for(%i=0; %i < $RemapCount; %i++)
@@ -102,9 +102,9 @@ function ControlsMenu::loadGroupKeybinds(%this, %keybindGroup)
       //find and add all the keybinds for the particular group we're looking at
       if($RemapGroup[%i] $= %keybindGroup)
       {
-         %temp = %this.getKeybindString(%i);
+         %temp = getKeybindString(%i);
          
-         %option = %this.addKeybindOption();
+         %option = addKeybindOption();
          %option-->nameText.setText($RemapName[%i]);
          %option-->rebindButton.setText(%temp);
          %option-->rebindButton.keybindIndex = %i;
@@ -114,18 +114,18 @@ function ControlsMenu::loadGroupKeybinds(%this, %keybindGroup)
    }
 }
 
-function ControlsMenu::addKeybindOption(%this)
+function addKeybindOption()
 {
     %tamlReader = new Taml();
    
     %graphicsOption = %tamlReader.read("data/ui/guis/controlsMenuSetting.taml");
 
-    ControlsMenuOptionsArray.add(%graphicsOption);
+    OptionsSettingStack.add(%graphicsOption);
 
     return %graphicsOption;
 }
 
-function ControlsMenu::getKeybindString(%this, %index )
+function getKeybindString(%index )
 {
    %name       = $RemapName[%index];
    %cmd        = $RemapCmd[%index];
@@ -142,11 +142,11 @@ function ControlsMenu::getKeybindString(%this, %index )
       %device = getField( %temp, %i + 0 );
       %object = getField( %temp, %i + 1 );
       
-      %displayName = %this.getMapDisplayName( %device, %object );
+      %displayName = getMapDisplayName( %device, %object );
       
       if(%displayName !$= "")
       {
-         %tmpMapString = %this.getMapDisplayName( %device, %object );
+         %tmpMapString = getMapDisplayName( %device, %object );
          
          if(%mapString $= "")
          {
@@ -175,7 +175,7 @@ function ControlsMenu::redoMapping( %device, %action, %cmd, %oldIndex, %newIndex
 	%remapList.setRowById( %newIndex, buildFullMapString( %newIndex ) );
 }
 
-function ControlsMenu::getMapDisplayName( %this, %device, %action )
+function getMapDisplayName( %device, %action )
 {
 	if ( %device $= "keyboard" )
 		return( %action );		

+ 228 - 0
Templates/BaseGame/game/data/ui/scripts/displayMenu.cs

@@ -0,0 +1,228 @@
+function DisplayMenu::loadSettings()
+{
+   OptionsMenu.currentMenu = "DisplayMenu";
+   OptionsSettingStack.clear();
+   
+   %APICount = getTokenCount(GraphicsDriverSetting::getList(),",");
+   if(%APICount > 1)
+      OptionsMenu.addSettingOption(OptionsSettingStack, "Diplay API", "", "GraphicsDriverSetting");
+   
+   OptionsMenu.addSettingOption(OptionsSettingStack, "Screen Resolution", "", "ScreenResolutionSetting");
+   OptionsMenu.addSettingOption(OptionsSettingStack, "Fullscreen", "", "FullscreenSetting");
+   OptionsMenu.addSettingOption(OptionsSettingStack, "VSync", "", "VSyncSetting");
+   
+   OptionsMenu.addSliderOption(OptionsSettingStack, "Field of View", $pref::Video::FOV, "65 120", 55, 75);
+   
+   OptionsMenu.addSliderOption(OptionsSettingStack, "Brightness", $pref::Video::Brightness, "0 1", 10, 5);
+   OptionsMenu.addSliderOption(OptionsSettingStack, "Contrast", $pref::Video::Contrast, "0 1", 10, 5);
+   
+   GraphicsSettingsCache.empty();
+}
+
+function DisplayMenu::apply(%this)
+{
+   //Loop through the settings cache and actually apply the values
+   %cachedSettingCount = GraphicsSettingsCache.count();
+   
+   for(%i=0; %i < %cachedSettingCount; %i++)
+   {
+      %var = GraphicsSettingsCache.getKey(%i);  
+      %val = GraphicsSettingsCache.getValue(%i);
+      
+      if(%var $= "$pref::Video::displayDevice")
+      {
+         MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." );
+      }
+      
+      setVariable(%var, %val);
+   }
+      
+   //Update the display settings now
+   $pref::Video::Resolution = getWord( $pref::Video::Resolution, 0 ) SPC getWord( $pref::Video::Resolution, 2 );
+	
+   /*if ( %newFullScreen $= "false" )
+	{
+      // If we're in windowed mode switch the fullscreen check
+      // if the resolution is bigger than the desktop.
+      %deskRes    = getDesktopResolution();      
+      %deskResX   = getWord(%deskRes, $WORD::RES_X);
+      %deskResY   = getWord(%deskRes, $WORD::RES_Y);
+	   if (  getWord( %newRes, $WORD::RES_X ) > %deskResX || 
+	         getWord( %newRes, $WORD::RES_Y ) > %deskResY )
+      {
+         $pref::Video::FullScreen = "true";
+         GraphicsMenuFullScreen.setStateOn( true );
+      }
+	}*/
+
+   // Build the final mode string.
+	%newMode = $pref::Video::Resolution SPC $pref::Video::FullScreen SPC 32 SPC $pref::Video::RefreshRate SPC $pref::Video::AA;
+	
+   // Change the video mode.   
+   /*if (  %newMode !$= $pref::Video::mode || 
+         %newVsync != $pref::Video::disableVerticalSync )
+   {
+      if ( %testNeedApply )
+         return true;*/
+
+      $pref::Video::mode = %newMode;
+      //$pref::Video::disableVerticalSync = %newVsync;      
+      configureCanvas();
+   //}
+   
+   echo("Exporting client prefs");
+   %prefPath = getPrefpath();
+   export("$pref::*", %prefPath @ "/clientPrefs.cs", false);
+}
+//
+function GraphicsDriverSetting::set(%setting)
+{
+   switch$(%setting)
+   {
+      case "D3D11":
+         GraphicsMenu::set("$pref::Video::displayDevice", "D3D11");
+      case "OpenGL":
+         GraphicsMenu::set("$pref::Video::displayDevice", "OpenGL");
+      default:
+         GraphicsMenu::set("$pref::Video::displayDevice", "OpenGL");
+   }
+}
+
+function GraphicsDriverSetting::get()
+{
+   if($pref::Video::displayDevice == "D3D11")
+      return "D3D11";
+   else if($pref::Video::displayDevice == "OpenGL")
+      return "OpenGL";
+   else
+      return "Unknown";
+}
+
+function GraphicsDriverSetting::getList()
+{
+   %returnsList = "";
+   %buffer = getDisplayDeviceList();
+   %deviceCount = getFieldCount( %buffer );   
+   
+   %count = 0;
+   for(%i = 0; %i < %deviceCount; %i++)
+   {
+      %deviceDesc = getField(%buffer, %i);
+      
+      if(%deviceDesc $= "GFX Null Device")
+         continue;
+         
+      if(%count != 0)
+         %returnsList = %returnsList @ "," @ %deviceDesc;
+      else
+         %returnsList = %deviceDesc;
+         
+      %count++;
+   }
+
+   return %returnsList;
+}
+
+//
+function ScreenResolutionSetting::set(%setting)
+{
+   GraphicsMenu::set("$pref::Video::Resolution", %setting);
+}
+
+function ScreenResolutionSetting::get()
+{
+   return _makePrettyResString( $pref::Video::Resolution );
+}
+
+function ScreenResolutionSetting::getList()
+{
+   %returnsList = "";
+   
+   %resCount = Canvas.getModeCount();
+   for (%i = 0; %i < %resCount; %i++)
+   {
+      %testResString = Canvas.getMode( %i );
+      %testRes = _makePrettyResString( %testResString );
+      
+      //sanitize
+      %found = false;
+      %retCount = getTokenCount(%returnsList, ",");
+      for (%x = 0; %x < %retCount; %x++)
+      {
+         %existingEntry = getToken(%returnsList, ",", %x);
+         if(%existingEntry $= %testRes)
+         {
+            %found = true;
+            break;  
+         }
+      }
+      
+      if(%found)
+         continue;
+                     
+      if(%i != 0)
+         %returnsList = %returnsList @ "," @ %testRes;
+      else
+         %returnsList = %testRes;
+   }
+   
+   return %returnsList;
+}
+
+//
+function FullscreenSetting::set(%setting)
+{
+   switch$(%setting)
+   {
+      case "On":
+         GraphicsMenu::set("$pref::Video::FullScreen", "1");
+      case "Off":
+         GraphicsMenu::set("$pref::Video::FullScreen", "0");
+      default:
+         GraphicsMenu::set("$pref::Video::FullScreen", "0");
+   }
+}
+
+function FullscreenSetting::get()
+{
+   if($pref::Video::FullScreen == 1)
+      return "On";
+   else if($pref::Video::FullScreen == 0)
+      return "Off";
+   else
+      return "Custom";
+}
+
+function FullscreenSetting::getList()
+{
+   return "Off,On";
+}
+
+//
+function VSyncSetting::set(%setting)
+{
+   switch$(%setting)
+   {
+      case "On":
+         GraphicsMenu::set("$pref::Video::disableVerticalSync", "0");
+      case "Off":
+         GraphicsMenu::set("$pref::Video::disableVerticalSync", "1");
+      default:
+         GraphicsMenu::set("$pref::Video::disableVerticalSync", "1");
+   }
+}
+
+function VSyncSetting::get()
+{
+   if($pref::Video::disableVerticalSync == 0)
+      return "On";
+   else if($pref::Video::disableVerticalSync == 1)
+      return "Off";
+   else
+      return "Custom";
+}
+
+function VSyncSetting::getList()
+{
+   return "Off,On";
+}

+ 11 - 65
Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs

@@ -293,7 +293,7 @@ function GraphicsMenu::Autodetect_Apply(%this, %shaderVer, %intel, %videoMem )
    return "Graphics quality settings have been auto detected.";
 }
 
-function _makePrettyResString( %resString )
+function _makePrettyResString( %resString, %giveAspectRation )
 {
    %width = getWord( %resString, $WORD::RES_X );
    %height = getWord( %resString, $WORD::RES_Y );
@@ -312,7 +312,7 @@ function _makePrettyResString( %resString )
    }
    
    %outRes = %width @ " x " @ %height;
-   if ( %aspect !$= "" )
+   if ( %giveAspectRation && %aspect !$= "" )
       %outRes = %outRes @ "  (" @ %aspect @ ")";
       
    return %outRes;   
@@ -320,38 +320,20 @@ function _makePrettyResString( %resString )
 
 function GraphicsMenu::apply(%this)
 {
-   %newAdapter    = GraphicsMenuDriver.getText();
-	%numAdapters   = GFXInit::getAdapterCount();
-	%newDevice     = $pref::Video::displayDevice;
-							
-	for( %i = 0; %i < %numAdapters; %i ++ )
-	{
-	   if( GFXInit::getAdapterName( %i ) $= %newAdapter )
-	   {
-	      %newDevice = GFXInit::getAdapterType( %i );
-	      break;
-	   }
-	}
-	   
-   // Change the device.
-   if ( %newDevice !$= $pref::Video::displayDevice )
-   {
-      if ( %testNeedApply )
-         return true;
-         
-      $pref::Video::displayDevice = %newDevice;
-      if( %newAdapter !$= getDisplayDeviceInformation() )
-         MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." );
-   }
-   
    //Loop through the settings cache and actually apply the values
    %cachedSettingCount = GraphicsSettingsCache.count();
+   %canvasUpdate = false;
    
    for(%i=0; %i < %cachedSettingCount; %i++)
    {
       %var = GraphicsSettingsCache.getKey(%i);  
       %val = GraphicsSettingsCache.getValue(%i);
       
+      if(%var $= "$pref::Video::AA")
+      {
+         %canvasUpdate = true;
+      }
+      
       setVariable(%var, %val);
    }
    
@@ -368,41 +350,10 @@ function GraphicsMenu::apply(%this)
    PostFXManager.settingsEffectSetEnabled("DOF", $pref::PostFX::EnableDOF);
    PostFXManager.settingsEffectSetEnabled("LightRays", $pref::PostFX::EnableLightRays);
    PostFXManager.settingsEffectSetEnabled("Vignette", $pref::PostFX::EnableVignette);
-   
-   //Update the display settings now
-   $pref::Video::Resolution = getWords( Canvas.getMode( GraphicsMenuResolution.getSelected() ), $WORD::RES_X, $WORD::RES_Y );
-   %newBpp        = 32; // ... its not 1997 anymore.
-	$pref::Video::FullScreen = GraphicsMenuFullScreen.isStateOn() ? "true" : "false";
-	$pref::Video::RefreshRate    = GraphicsMenuRefreshRate.getSelected();
-	$pref::Video::disableVerticalSync = !GraphicsMenuVSync.isStateOn();	
-	
-   if ( %newFullScreen $= "false" )
-	{
-      // If we're in windowed mode switch the fullscreen check
-      // if the resolution is bigger than the desktop.
-      %deskRes    = getDesktopResolution();      
-      %deskResX   = getWord(%deskRes, $WORD::RES_X);
-      %deskResY   = getWord(%deskRes, $WORD::RES_Y);
-	   if (  getWord( %newRes, $WORD::RES_X ) > %deskResX || 
-	         getWord( %newRes, $WORD::RES_Y ) > %deskResY )
-      {
-         $pref::Video::FullScreen = "true";
-         GraphicsMenuFullScreen.setStateOn( true );
-      }
-	}
-
-   // Build the final mode string.
-	%newMode = $pref::Video::Resolution SPC $pref::Video::FullScreen SPC %newBpp SPC $pref::Video::RefreshRate SPC $pref::Video::AA;
-	
-   // Change the video mode.   
-   if (  %newMode !$= $pref::Video::mode || 
-         %newVsync != $pref::Video::disableVerticalSync )
-   {
-      if ( %testNeedApply )
-         return true;
 
-      $pref::Video::mode = %newMode;
-      $pref::Video::disableVerticalSync = %newVsync;      
+   if (  %canvasUpdate )
+   {
+      // Change the video mode.   
       configureCanvas();
    }
    
@@ -436,11 +387,6 @@ function GraphicsMenu::loadSettings()
    OptionsMenu.addSettingOption(OptionsSettingStack, "Anti Aliasing", "", "AASetting");
    OptionsMenu.addSettingOption(OptionsSettingStack, "Anisotropic Filtering", "", "AnisotropicFilteringSetting");
    
-   if(!isObject(GraphicsSettingsCache))
-   {
-      new ArrayObject(GraphicsSettingsCache){};
-   }
-   
    GraphicsSettingsCache.empty();
 }
 

+ 124 - 124
Templates/BaseGame/game/tools/settings.xml

@@ -1,188 +1,188 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <EditorSettings>
-    <Group name="Theme">
-        <Setting name="fieldTextSELColor">240 240 240 255</Setting>
-        <Setting name="fieldBGSELColor">100 98 96 255</Setting>
-        <Setting name="dividerLightColor">96 94 92 255</Setting>
-        <Setting name="headerColor">50 49 48 255</Setting>
-        <Setting name="tabsSELColor">59 58 57 255</Setting>
-        <Setting name="tabsHLColor">50 49 48 255</Setting>
-        <Setting name="fieldTextHLColor">234 232 230 255</Setting>
-        <Setting name="windowBackgroundColor">32 31 30 255</Setting>
-        <Setting name="headerTextColor">236 234 232 255</Setting>
-        <Setting name="fieldBGColor">59 58 57 255</Setting>
-        <Setting name="tooltipBGColor">43 43 43 255</Setting>
-        <Setting name="fieldTextColor">178 175 172 255</Setting>
-        <Setting name="dividerMidColor">50 49 48 255</Setting>
-        <Setting name="dividerDarkColor">17 16 15 255</Setting>
-        <Setting name="tooltipDividerColor">72 70 68 255</Setting>
-        <Setting name="fieldBGHLColor">72 70 68 255</Setting>
-        <Setting name="tooltipTextColor">255 255 255 255</Setting>
-        <Setting name="tabsColor">37 36 35 255</Setting>
-    </Group>
-    <Group name="AxisGizmo">
-        <Setting name="axisGizmoMaxScreenLen">100</Setting>
-        <Setting name="snapRotations">0</Setting>
-        <Setting name="rotationSnap">15</Setting>
-        <Setting name="mouseRotateScalar">0.8</Setting>
-        <Setting name="mouseScaleScalar">0.8</Setting>
-        <Setting name="renderInfoText">1</Setting>
-        <Setting name="renderWhenUsed">0</Setting>
-        <Group name="Grid">
-            <Setting name="renderPlane">0</Setting>
-            <Setting name="gridColor">255 255 255 20</Setting>
-            <Setting name="planeDim">500</Setting>
-            <Setting name="renderPlaneHashes">0</Setting>
-            <Setting name="snapToGrid">0</Setting>
-            <Setting name="gridSize">10 10 10</Setting>
+    <Group name="LevelInformation">
+        <Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
+        <Group name="levels">
+            <Group name="PbrMatTest.mis">
+                <Setting name="cameraSpeed">5</Setting>
+            </Group>
+            <Group name="BlankRoom.mis">
+                <Setting name="cameraSpeed">25</Setting>
+            </Group>
         </Group>
     </Group>
     <Group name="WorldEditor">
-        <Setting name="undoLimit">40</Setting>
         <Setting name="orthoFOV">50</Setting>
-        <Setting name="displayType">6</Setting>
+        <Setting name="dropType">screenCenter</Setting>
+        <Setting name="torsionPath">AssetWork_Debug.exe</Setting>
         <Setting name="forceLoadDAE">0</Setting>
         <Setting name="orthoShowGrid">1</Setting>
-        <Setting name="torsionPath">AssetWork_Debug.exe</Setting>
-        <Setting name="dropType">screenCenter</Setting>
+        <Setting name="undoLimit">40</Setting>
+        <Setting name="displayType">6</Setting>
         <Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
-        <Group name="Grid">
-            <Setting name="gridOriginColor">255 255 255 100</Setting>
-            <Setting name="gridColor">102 102 102 100</Setting>
-            <Setting name="gridSnap">0</Setting>
-            <Setting name="gridSize">1</Setting>
-            <Setting name="gridMinorColor">51 51 51 100</Setting>
+        <Group name="ObjectIcons">
+            <Setting name="fadeIconsEndAlpha">0</Setting>
+            <Setting name="fadeIcons">1</Setting>
+            <Setting name="fadeIconsStartDist">8</Setting>
+            <Setting name="fadeIconsEndDist">20</Setting>
+            <Setting name="fadeIconsStartAlpha">255</Setting>
+        </Group>
+        <Group name="Tools">
+            <Setting name="snapGround">0</Setting>
+            <Setting name="snapSoftSize">2</Setting>
+            <Setting name="dropAtScreenCenterMax">100</Setting>
+            <Setting name="objectsUseBoxCenter">1</Setting>
+            <Setting name="boundingBoxCollision">0</Setting>
+            <Setting name="snapSoft">0</Setting>
+            <Setting name="dropAtScreenCenterScalar">1</Setting>
         </Group>
         <Group name="Docs">
             <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
             <Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
-            <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
             <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
+            <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
         </Group>
         <Group name="Color">
-            <Setting name="popupBackgroundColor">100 100 100 255</Setting>
-            <Setting name="objMouseOverColor">0 255 0 255</Setting>
-            <Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
-            <Setting name="dragRectColor">255 255 0 255</Setting>
             <Setting name="selectionBoxColor">255 255 0 255</Setting>
+            <Setting name="objMouseOverColor">0 255 0 255</Setting>
             <Setting name="objSelectColor">255 0 0 255</Setting>
             <Setting name="objectTextColor">255 255 255 255</Setting>
+            <Setting name="dragRectColor">255 255 0 255</Setting>
+            <Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
+            <Setting name="popupBackgroundColor">100 100 100 255</Setting>
         </Group>
-        <Group name="Theme">
-            <Setting name="windowTitleFontHLColor">255 255 255 255</Setting>
-            <Setting name="windowTitleBGNAColor">180 180 180 255</Setting>
-            <Setting name="windowTitleBGHLColor">48 48 48 255</Setting>
-            <Setting name="windowTitleFontColor">215 215 215 255</Setting>
-            <Setting name="windowTitleBGColor">50 50 50 255</Setting>
+        <Group name="Images">
+            <Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
+            <Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
+            <Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
         </Group>
-        <Group name="ObjectIcons">
-            <Setting name="fadeIconsEndDist">20</Setting>
-            <Setting name="fadeIconsStartAlpha">255</Setting>
-            <Setting name="fadeIconsEndAlpha">0</Setting>
-            <Setting name="fadeIcons">1</Setting>
-            <Setting name="fadeIconsStartDist">8</Setting>
+        <Group name="Grid">
+            <Setting name="gridColor">102 102 102 100</Setting>
+            <Setting name="gridSnap">0</Setting>
+            <Setting name="gridSize">1</Setting>
+            <Setting name="gridMinorColor">51 51 51 100</Setting>
+            <Setting name="gridOriginColor">255 255 255 100</Setting>
         </Group>
         <Group name="Render">
+            <Setting name="renderObjText">1</Setting>
+            <Setting name="renderObjHandle">1</Setting>
             <Setting name="showMousePopupInfo">1</Setting>
-            <Setting name="renderPopupBackground">1</Setting>
             <Setting name="renderSelectionBox">1</Setting>
-            <Setting name="renderObjHandle">1</Setting>
-            <Setting name="renderObjText">1</Setting>
-        </Group>
-        <Group name="Tools">
-            <Setting name="snapGround">0</Setting>
-            <Setting name="snapSoft">0</Setting>
-            <Setting name="dropAtScreenCenterScalar">1</Setting>
-            <Setting name="boundingBoxCollision">0</Setting>
-            <Setting name="objectsUseBoxCenter">1</Setting>
-            <Setting name="dropAtScreenCenterMax">100</Setting>
-            <Setting name="snapSoftSize">2</Setting>
+            <Setting name="renderPopupBackground">1</Setting>
         </Group>
-        <Group name="Images">
-            <Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
-            <Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
-            <Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
+        <Group name="Theme">
+            <Setting name="windowTitleBGNAColor">180 180 180 255</Setting>
+            <Setting name="windowTitleBGHLColor">48 48 48 255</Setting>
+            <Setting name="windowTitleFontHLColor">255 255 255 255</Setting>
+            <Setting name="windowTitleFontColor">215 215 215 255</Setting>
+            <Setting name="windowTitleBGColor">50 50 50 255</Setting>
         </Group>
     </Group>
     <Group name="GuiEditor">
-        <Setting name="lastPath">tools/gui</Setting>
         <Setting name="previewResolution">1024 768</Setting>
-        <Group name="Rendering">
-            <Setting name="drawBorderLines">1</Setting>
-            <Setting name="drawGuides">1</Setting>
-        </Group>
-        <Group name="Help">
-            <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
-            <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
-            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
-        </Group>
+        <Setting name="lastPath">tools/gui</Setting>
         <Group name="Snapping">
-            <Setting name="snapToGuides">1</Setting>
+            <Setting name="sensitivity">2</Setting>
+            <Setting name="snap2GridSize">8</Setting>
+            <Setting name="snap2Grid">0</Setting>
             <Setting name="snapToControls">1</Setting>
+            <Setting name="snapToGuides">1</Setting>
             <Setting name="snapToEdges">1</Setting>
-            <Setting name="snapToCanvas">1</Setting>
             <Setting name="snapToCenters">1</Setting>
-            <Setting name="sensitivity">2</Setting>
-            <Setting name="snap2Grid">0</Setting>
-            <Setting name="snap2GridSize">8</Setting>
+            <Setting name="snapToCanvas">1</Setting>
         </Group>
-        <Group name="Selection">
-            <Setting name="fullBox">0</Setting>
+        <Group name="Library">
+            <Setting name="viewType">Categorized</Setting>
+        </Group>
+        <Group name="Help">
+            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
+            <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
+            <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
+        </Group>
+        <Group name="Rendering">
+            <Setting name="drawBorderLines">1</Setting>
+            <Setting name="drawGuides">1</Setting>
         </Group>
         <Group name="EngineDevelopment">
+            <Setting name="showEditorGuis">0</Setting>
             <Setting name="toggleIntoEditor">0</Setting>
             <Setting name="showEditorProfiles">0</Setting>
-            <Setting name="showEditorGuis">0</Setting>
         </Group>
-        <Group name="Library">
-            <Setting name="viewType">Categorized</Setting>
+        <Group name="Selection">
+            <Setting name="fullBox">0</Setting>
         </Group>
     </Group>
+    <Group name="Theme">
+        <Setting name="windowBackgroundColor">32 31 30 255</Setting>
+        <Setting name="tabsSELColor">59 58 57 255</Setting>
+        <Setting name="tabsHLColor">50 49 48 255</Setting>
+        <Setting name="dividerDarkColor">17 16 15 255</Setting>
+        <Setting name="fieldTextSELColor">240 240 240 255</Setting>
+        <Setting name="fieldBGColor">59 58 57 255</Setting>
+        <Setting name="dividerMidColor">50 49 48 255</Setting>
+        <Setting name="fieldTextColor">178 175 172 255</Setting>
+        <Setting name="tooltipBGColor">43 43 43 255</Setting>
+        <Setting name="tabsColor">37 36 35 255</Setting>
+        <Setting name="fieldBGSELColor">100 98 96 255</Setting>
+        <Setting name="headerColor">50 49 48 255</Setting>
+        <Setting name="tooltipTextColor">255 255 255 255</Setting>
+        <Setting name="tooltipDividerColor">72 70 68 255</Setting>
+        <Setting name="fieldTextHLColor">234 232 230 255</Setting>
+        <Setting name="fieldBGHLColor">72 70 68 255</Setting>
+        <Setting name="headerTextColor">236 234 232 255</Setting>
+        <Setting name="dividerLightColor">96 94 92 255</Setting>
+    </Group>
     <Group name="TerrainEditor">
         <Setting name="currentAction">lowerHeight</Setting>
         <Group name="ActionValues">
-            <Setting name="SlopeMinAngle">0</Setting>
             <Setting name="noiseFactor">1</Setting>
-            <Setting name="setHeightVal">100</Setting>
-            <Setting name="softSelectFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
             <Setting name="scaleVal">1</Setting>
-            <Setting name="softSelectRadius">50</Setting>
-            <Setting name="smoothFactor">0.1</Setting>
-            <Setting name="softSelectDefaultFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
-            <Setting name="adjustHeightVal">10</Setting>
+            <Setting name="softSelectFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
             <Setting name="SlopeMaxAngle">90</Setting>
+            <Setting name="adjustHeightVal">10</Setting>
+            <Setting name="softSelectDefaultFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
+            <Setting name="smoothFactor">0.1</Setting>
+            <Setting name="softSelectRadius">50</Setting>
+            <Setting name="setHeightVal">100</Setting>
+            <Setting name="SlopeMinAngle">0</Setting>
         </Group>
         <Group name="Brush">
-            <Setting name="maxBrushSize">40 40</Setting>
             <Setting name="brushSize">40 40</Setting>
-            <Setting name="brushType">ellipse</Setting>
-            <Setting name="brushPressure">1</Setting>
             <Setting name="brushSoftness">1</Setting>
+            <Setting name="maxBrushSize">40 40</Setting>
+            <Setting name="brushPressure">1</Setting>
+            <Setting name="brushType">ellipse</Setting>
+        </Group>
+    </Group>
+    <Group name="AxisGizmo">
+        <Setting name="renderWhenUsed">0</Setting>
+        <Setting name="mouseRotateScalar">0.8</Setting>
+        <Setting name="axisGizmoMaxScreenLen">100</Setting>
+        <Setting name="mouseScaleScalar">0.8</Setting>
+        <Setting name="snapRotations">0</Setting>
+        <Setting name="renderInfoText">1</Setting>
+        <Setting name="rotationSnap">15</Setting>
+        <Group name="Grid">
+            <Setting name="snapToGrid">0</Setting>
+            <Setting name="gridSize">10 10 10</Setting>
+            <Setting name="planeDim">500</Setting>
+            <Setting name="renderPlane">0</Setting>
+            <Setting name="gridColor">255 255 255 20</Setting>
+            <Setting name="renderPlaneHashes">0</Setting>
         </Group>
     </Group>
     <Group name="RiverEditor">
-        <Setting name="DefaultNormal">0 0 1</Setting>
+        <Setting name="HoverSplineColor">255 0 0 255</Setting>
+        <Setting name="DefaultDepth">5</Setting>
         <Setting name="DefaultWidth">10</Setting>
         <Setting name="HoverNodeColor">255 255 255 255</Setting>
         <Setting name="SelectedSplineColor">0 255 0 255</Setting>
-        <Setting name="DefaultDepth">5</Setting>
-        <Setting name="HoverSplineColor">255 0 0 255</Setting>
-    </Group>
-    <Group name="ConvexEditor">
-        <Setting name="materialName">Grid_512_Orange</Setting>
+        <Setting name="DefaultNormal">0 0 1</Setting>
     </Group>
     <Group name="NavEditor">
         <Setting name="SpawnClass">AIPlayer</Setting>
     </Group>
-    <Group name="LevelInformation">
-        <Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
-        <Group name="levels">
-            <Group name="PbrMatTest.mis">
-                <Setting name="cameraSpeed">5</Setting>
-            </Group>
-            <Group name="BlankRoom.mis">
-                <Setting name="cameraSpeed">25</Setting>
-            </Group>
-        </Group>
+    <Group name="ConvexEditor">
+        <Setting name="materialName">Grid_512_Orange</Setting>
     </Group>
 </EditorSettings>

+ 18 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/visibility/lightViz.cs

@@ -425,4 +425,22 @@ function toggleLightFrustumViz()
 function disableLightFrustumViz()
 {
    $Light::renderLightFrustums = false;
+}
+
+//Lighting Viz
+singleton Material( Viz_DetailLightingMat )
+{
+   diffuseColor[0] = "0.5 0.5 0.5 1";
+   
+   preload = true;
+};
+
+function toggleDetailLightingViz()
+{
+   if(!isObject(lightBizBin))
+      DiffuseRenderPassManager.addManager( new lightVisualizerBin(lightBizBin) { renderOrder = 1.5; processAddOrder = 1.5; } );
+      
+   lightBizBin.material = Viz_DetailLightingMat;
+   
+   //Then set the lighting bin flags for various modes here
 }

+ 38 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/visibility/miscViz.cs

@@ -302,4 +302,42 @@ function Viz_ColorBlindnessPFX::onEnabled( %this )
    disableSurfacePropertiesViz();
    
    return true;
+}
+
+
+//
+//Material Complexity Viz
+new ShaderData( Viz_MaterialComplexity )
+{
+   DXVertexShaderFile   = "./shaders/Viz_materialComplexityV.hlsl";
+   DXPixelShaderFile    = "./shaders/Viz_materialComplexityP.hlsl";
+ 
+   OGLVertexShaderFile   = "./shaders/basicRibbonShaderV.glsl";
+   OGLPixelShaderFile    = "./shaders/basicRibbonShaderP.glsl";
+ 
+   //samplerNames[0] = "$ribTex";
+ 
+   pixVersion = 2.0;
+};
+ 
+singleton CustomMaterial( Viz_MaterialComplexityMat )
+{
+   shader = Viz_MaterialComplexity;
+   version = 2.0;
+   
+   emissive[0] = true;
+   
+   doubleSided = true;
+   translucent = true;
+   
+   preload = true;
+};
+
+function toggleMatComplexityViz()
+{
+   if(!isObject(MatComplexityVizBin))
+      DiffuseRenderPassManager.addManager( new MaterailComplexityVisualizerBin(MatComplexityVizBin) { renderOrder = 1.55; processAddOrder = 1.55; } );
+      
+   MatComplexityVizBin.material = Viz_MaterialComplexityMat;
+   MatComplexityVizBin.maxComplexity = 10;
 }

+ 84 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/visibility/shaders/Viz_LightProperties.hlsl

@@ -0,0 +1,84 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
+#include "../../../../core/rendering/shaders/shaderModel.hlsl"
+#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
+#include "../../../../core/rendering/shaders/lighting.hlsl"
+
+TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
+TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 1);
+TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 2);
+TORQUE_UNIFORM_SAMPLER2D(ssaoMaskTex, 3);
+TORQUE_UNIFORM_SAMPLER2D(backbufferTex, 4);
+TORQUE_UNIFORM_SAMPLER2D(glowBuffer, 5);
+
+uniform float mode;
+uniform float3 eyePosWorld;
+uniform float4x4 cameraToWorld;
+
+float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
+{     
+    //unpack normal and linear depth 
+    float4 normDepth = TORQUE_DEFERRED_UNCONDITION(deferredBuffer, IN.uv0.xy);
+
+    //create surface
+    Surface surface = createSurface(normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
+        IN.uv0.xy, eyePosWorld, IN.wsEyeRay, cameraToWorld);
+
+    [branch]
+    if(mode == 0)
+        return float4(surface.baseColor.rgb,1);
+    else if(mode == 1)
+        return float4(surface.N.rgb,1);
+    else if(mode == 2)
+        return float4(surface.ao.rrr,1);
+    else if(mode == 3)
+        return float4(surface.roughness.rrr,1);
+    else if(mode == 4)
+        return float4(surface.metalness.rrr,1);
+    else if(mode == 5)
+        return float4(surface.depth.rrr,1);
+    else if(mode == 6) //Diffuse Color
+        return float4(surface.albedo.rgb,1);
+    else if(mode == 7) //Specular Color
+    {
+        float3 specularColor = surface.baseColor.rgb * surface.ao;
+        return float4(specularColor.rgb,1);
+    }
+    else if(mode == 8) //Mat Flags
+        return float4(surface.matFlag.rrr,1);
+    else if(mode == 9)
+        return float4(surface.P.xyz,1);
+    else if(mode == 10)
+        return float4(surface.R.xyz,1);
+    else if(mode == 11)
+        return float4(surface.F.rgb,1);
+    else if(mode == 12)
+        float4(TORQUE_TEX2D( ssaoMaskTex, IN.uv0 ).rgb, 1.0);
+    else if(mode == 13)
+        float4(TORQUE_TEX2D( backbufferTex, IN.uv0 ).rgb, 1.0);
+    else if(mode == 14)
+        float4(TORQUE_TEX2D( glowBuffer, IN.uv0 ).rgb, 1.0);
+
+    return float4(0,0,0,1);   
+}

+ 52 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/visibility/shaders/Viz_materialComplexityP.hlsl

@@ -0,0 +1,52 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+#include "../../../../core/rendering/shaders/lighting.hlsl"
+#include "../../../../core/rendering/shaders/torque.hlsl"
+
+struct ConnectData
+{
+   float4 hpos            : SV_Position;
+   float2 out_texCoord    : TEXCOORD0;
+   float3 outWsPosition   : TEXCOORD1;
+};
+
+uniform float materialComplexity;
+uniform float minComplexity;
+uniform float maxComplexity;
+
+
+float4 main( ConnectData IN ) : TORQUE_TARGET0
+{     
+    float complexity = (materialComplexity-minComplexity)/(maxComplexity-minComplexity);
+
+    float3 green = float3(0,1,0);
+    float3 yellow = float3(1,1,0);
+    float3 red = float3(1,0,0);
+
+    float a = complexity * 2;
+    float3 finalColor = lerp (green, yellow, a);
+    a -= 1;
+    finalColor = lerp (finalColor, red, a);
+
+    return float4(finalColor, 1.0);   
+}

+ 66 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/visibility/shaders/Viz_materialComplexityV.hlsl

@@ -0,0 +1,66 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+// Dependencies:
+#include "../../../../core/rendering/shaders/lighting.hlsl"
+#include "../../../../core/rendering/shaders/torque.hlsl"
+
+
+struct VertData
+{
+   float3 position        : POSITION;
+   float3 normal     : NORMAL;
+   float3 binormal   : BINORMAL;
+   float3 tangent    : TANGENT;
+   float2 uv0        : TEXCOORD0;
+};
+
+
+struct ConnectData
+{
+   float4 hpos            : SV_Position;
+   float2 out_texCoord    : TEXCOORD0;
+   float3 outWsPosition   : TEXCOORD1;
+};
+
+
+//-----------------------------------------------------------------------------
+// Main
+//-----------------------------------------------------------------------------
+ConnectData main( VertData IN,
+                  uniform float4x4 modelview       : register(C0),
+                  uniform float4x4 worldToObj      : register(C4),
+                  uniform float4x4 objTrans        : register(C8)
+)
+{
+   ConnectData OUT;
+
+   // Vert Position
+   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
+   
+   // Base Texture
+   OUT.out_texCoord = (float2)IN.uv0;
+   
+   // Deferred RT Lighting
+   OUT.outWsPosition = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
+   
+   return OUT;
+}

+ 2 - 1
Tools/CMake/torque3d.cmake

@@ -33,7 +33,7 @@ if(UNIX)
 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CXX_FLAG32} -Wundef -msse -pipe -Wfatal-errors -Wno-return-type-c-linkage -Wno-unused-local-typedef ${TORQUE_ADDITIONAL_LINKER_FLAGS}")
     else()
     # default compiler flags
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAG32} -Wundef -msse -pipe -Wfatal-errors ${TORQUE_ADDITIONAL_LINKER_FLAGS} -Wl,-rpath,'$$ORIGIN'")
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAG32} -Wundef -msse -pipe -Wfatal-errors -no-pie ${TORQUE_ADDITIONAL_LINKER_FLAGS} -Wl,-rpath,'$$ORIGIN'")
 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CXX_FLAG32} -Wundef -msse -pipe -Wfatal-errors ${TORQUE_ADDITIONAL_LINKER_FLAGS} -Wl,-rpath,'$$ORIGIN'")
 
    endif()    
@@ -313,6 +313,7 @@ addPath("${srcDir}/materials")
 addPath("${srcDir}/lighting")
 addPath("${srcDir}/lighting/common")
 addPath("${srcDir}/renderInstance")
+addPath("${srcDir}/renderInstance/debug")
 addPath("${srcDir}/scene")
 addPath("${srcDir}/scene/culling")
 addPath("${srcDir}/scene/zones")