Browse Source

Removed unneeded default irradiance and prefilter cubemaps, and their convars
Added getGUIPath console function to guiAsset
Corrected console function documentation for getScriptPath in MaterialAsset
Added getter console functions to PostEffectAsset
Added getAnimationPath console function to PostEffectAsset
Fixes handling of mapto with the reskin usage when generating preview renders for ShapeAssets
Standardizes getShapeFile to getShapePath on ShapeAsset to better match formatting of other getters on assets
Adds sanity checking for getStringWidth to prevent crash if there's an issue with the font being ready at time of request(from Az)
Earlies out on rendering of impostors if it's the deferred bin to prevent unneeded duplicate rendering messing up results(from Az)
Fixed duplicate naming of quality levels on LightingQualityList
Added check so if _makePrettyResString is handed a 'human formatted' resolution string(as in, has <width> x <height> it can handle that properly
Shifted yes/no and on/off option lists to globals for ease and consistency of handling on options menu
Improves check for unapplied graphics options on options menu and applies them all at once
Add sanitizing of variable names so getVariable doesn't have issues when looking up array variables in optionsMenu logic
Adds better tracking of what options menu category is shown so refreshes don't reset it
Add better handling for changing resolution in options menu and getting it to apply properly
Adds better utility functions for setting bools vs optionsLists vs quality lists and updates options fields to use the most appropriate
Removes redundant setting of $pref::SFX::channelVolume vars in defaults.tscript
Removed unneeded extra logging from asset browser drag-n-drop actions
Adds item to RMB context menu in AB to regenerate preview images
Fixes move command for asset types(needed to properly reference the full path of the associated files) and added it for shapes, animations and terrains
Added logic so when the dropdown for selecting a target module on the Create New Asset window is changed, it forcefully updates the target path to point to the module to avoid erroneous paths being provided
Adds proper clamping of values to Forest Editor's brush size in the editor bar. Could be set to below 1 even though it would visually clamp to 1.
Temporarily disables fields and handling of 'open in Torsion'.
Fixes bad pixel in gui/images/tab_border.png which was causing it to fail to generate bitmap array properly
Makes the New GUI option from menubar in GUI Editor use same Create New Asset method as everything else
Disables access to the CubemapDesc reflector field in the material editor as it's not nominally used now in favor of probes
Adds proper loading of roughness and metalness fields in material editor
Fixes the default ReflectProbePreviewMat to use a better base DiffuseMap (No Material) rather than the occluder
Fixes disable display for some options in the advanced panel in the shape editor so they look more fitting to everything else
Adds check to avoid spam of markItem errors in the event requested tree item is invalid
Fixed remove material button and command in TerrainMaterial Editor

JeffR 3 years ago
parent
commit
d044ae0702
47 changed files with 574 additions and 235 deletions
  1. 7 0
      Engine/source/T3D/assets/GUIAsset.cpp
  2. 1 2
      Engine/source/T3D/assets/MaterialAsset.cpp
  3. 18 0
      Engine/source/T3D/assets/PostEffectAsset.cpp
  4. 6 0
      Engine/source/T3D/assets/ShapeAnimationAsset.cpp
  5. 7 4
      Engine/source/T3D/assets/ShapeAsset.cpp
  6. 0 10
      Engine/source/gfx/gfxTextureManager.cpp
  7. 0 5
      Engine/source/gfx/gfxTextureManager.h
  8. 1 1
      Engine/source/gui/core/guiTypes.cpp
  9. 1 0
      Engine/source/renderInstance/renderImposterMgr.cpp
  10. 0 2
      Templates/BaseGame/game/core/rendering/Core_Rendering.tscript
  11. BIN
      Templates/BaseGame/game/core/rendering/images/default_irradiance.dds
  12. 0 8
      Templates/BaseGame/game/core/rendering/images/default_irradiance_image.asset.taml
  13. BIN
      Templates/BaseGame/game/core/rendering/images/default_prefilter.dds
  14. 0 8
      Templates/BaseGame/game/core/rendering/images/default_prefilter_image.asset.taml
  15. 6 1
      Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript
  16. 194 68
      Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript
  17. 0 5
      Templates/BaseGame/game/data/defaults.tscript
  18. 17 7
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript
  19. 1 1
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript
  20. 1 1
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cubemap.tscript
  21. 1 1
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript
  22. 3 3
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript
  23. 22 16
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript
  24. 6 2
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.tscript
  25. 32 19
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript
  26. 4 4
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript
  27. 5 5
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript
  28. 39 16
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript
  29. 17 1
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript
  30. 16 0
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript
  31. 16 0
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript
  32. 42 15
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript
  33. 12 0
      Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript
  34. 46 1
      Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript
  35. 6 4
      Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript
  36. 1 1
      Templates/BaseGame/game/tools/forestEditor/forestEditToolbar.ed.gui
  37. 1 1
      Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript
  38. 1 1
      Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript
  39. BIN
      Templates/BaseGame/game/tools/gui/images/tab_border.png
  40. 6 2
      Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript
  41. 1 0
      Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui
  42. 28 14
      Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript
  43. 1 1
      Templates/BaseGame/game/tools/resources/ReflectProbePreviewMat.asset.taml
  44. 2 0
      Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui
  45. 3 3
      Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript
  46. 1 0
      Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript
  47. 2 2
      Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript

+ 7 - 0
Engine/source/T3D/assets/GUIAsset.cpp

@@ -226,6 +226,13 @@ DefineEngineMethod(GUIAsset, getScriptPath, const char*, (), ,
 {
 {
    return object->getScriptPath();
    return object->getScriptPath();
 }
 }
+
+DefineEngineMethod(GUIAsset, getGUIPath, const char*, (), ,
+   "Gets the GUI file path associated to this asset.\n"
+   "@return The full script file path.")
+{
+   return object->getGUIPath();
+}
 #endif
 #endif
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------

+ 1 - 2
Engine/source/T3D/assets/MaterialAsset.cpp

@@ -449,8 +449,7 @@ DefineEngineStaticMethod(MaterialAsset, findMaterialDefinitionByAssetId, S32, (c
 
 
 
 
 DefineEngineMethod(MaterialAsset, getScriptPath, const char*, (), ,
 DefineEngineMethod(MaterialAsset, getScriptPath, const char*, (), ,
-   "Queries the Asset Database to see if any asset exists that is associated with the provided material name.\n"
-   "@return The AssetId of the associated asset, if any.")
+   "Gets the script file path for the asset.")
 {
 {
    return object->getScriptPath();
    return object->getScriptPath();
 }
 }

+ 18 - 0
Engine/source/T3D/assets/PostEffectAsset.cpp

@@ -206,3 +206,21 @@ void PostEffectAsset::setGLSLShaderFile(const char* pShaderFile)
    // Refresh the asset.
    // Refresh the asset.
    refreshAsset();
    refreshAsset();
 }
 }
+
+DefineEngineMethod(PostEffectAsset, getScriptPath, const char*, (), ,
+   "Gets the script file path for the asset.")
+{
+   return object->getScriptPath();
+}
+
+DefineEngineMethod(PostEffectAsset, getHLSLShaderPath, const char*, (), ,
+   "Gets the HLSL Shader file path for the asset.")
+{
+   return object->getHLSLShaderPath();
+}
+
+DefineEngineMethod(PostEffectAsset, getGLSLShaderPath, const char*, (), ,
+   "Gets the GLSL Shader file path for the asset.")
+{
+   return object->getGLSLShaderPath();
+}

+ 6 - 0
Engine/source/T3D/assets/ShapeAnimationAsset.cpp

@@ -204,3 +204,9 @@ DefineEngineMethod(ShapeAnimationAsset, getAnimationCount, S32, (), ,
 {
 {
    return object->getAnimationCount();
    return object->getAnimationCount();
 }
 }
+
+DefineEngineMethod(ShapeAnimationAsset, getAnimationPath, const char*, (), ,
+   "Gets the Animation file path associated to this asset.")
+{
+   return object->getAnimationPath();
+}

+ 7 - 4
Engine/source/T3D/assets/ShapeAsset.cpp

@@ -576,9 +576,12 @@ const char* ShapeAsset::generateCachedPreviewImage(S32 resolution, String overri
    // We need to create our own instance to render with.
    // We need to create our own instance to render with.
    TSShapeInstance* shape = new TSShapeInstance(mShape, true);
    TSShapeInstance* shape = new TSShapeInstance(mShape, true);
 
 
-   if(overrideMaterial.isNotEmpty())
-      shape->reSkin(overrideMaterial, mShape->materialList->getMaterialName(0));
-
+   if (overrideMaterial.isNotEmpty())
+   {
+      Material *tMat = dynamic_cast<Material*>(Sim::findObject(overrideMaterial));
+      if (tMat)
+         shape->reSkin(tMat->mMapTo, mShape->materialList->getMaterialName(0));
+   }
    // Animate the shape once.
    // Animate the shape once.
    shape->animate(0);
    shape->animate(0);
 
 
@@ -676,7 +679,7 @@ DefineEngineMethod(ShapeAsset, getAnimation, ShapeAnimationAsset*, (S32 index),
    return object->getAnimation(index);
    return object->getAnimation(index);
 }
 }
 
 
-DefineEngineMethod(ShapeAsset, getShapeFile, const char*, (), ,
+DefineEngineMethod(ShapeAsset, getShapePath, const char*, (), ,
    "Gets the shape's file path\n"
    "Gets the shape's file path\n"
    "@return The filename of the shape file")
    "@return The filename of the shape file")
 {
 {

+ 0 - 10
Engine/source/gfx/gfxTextureManager.cpp

@@ -46,8 +46,6 @@ S32 GFXTextureManager::smTextureReductionLevel = 0;
 String GFXTextureManager::smMissingTexturePath(Con::getVariable("$Core::MissingTexturePath"));
 String GFXTextureManager::smMissingTexturePath(Con::getVariable("$Core::MissingTexturePath"));
 String GFXTextureManager::smUnavailableTexturePath(Con::getVariable("$Core::UnAvailableTexturePath"));
 String GFXTextureManager::smUnavailableTexturePath(Con::getVariable("$Core::UnAvailableTexturePath"));
 String GFXTextureManager::smWarningTexturePath(Con::getVariable("$Core::WarningTexturePath"));
 String GFXTextureManager::smWarningTexturePath(Con::getVariable("$Core::WarningTexturePath"));
-String GFXTextureManager::smDefaultIrradianceCubemapPath(Con::getVariable("$Core::DefaultIrradianceCubemap"));
-String GFXTextureManager::smDefaultPrefilterCubemapPath(Con::getVariable("$Core::DefaultPrefilterCubemap"));
 String GFXTextureManager::smBRDFTexturePath(Con::getVariable("$Core::BRDFTexture"));
 String GFXTextureManager::smBRDFTexturePath(Con::getVariable("$Core::BRDFTexture"));
 
 
 GFXTextureManager::EventSignal GFXTextureManager::smEventSignal;
 GFXTextureManager::EventSignal GFXTextureManager::smEventSignal;
@@ -75,14 +73,6 @@ void GFXTextureManager::init()
       "The file path of the texture used to warn the developer.\n"
       "The file path of the texture used to warn the developer.\n"
       "@ingroup GFX\n" );
       "@ingroup GFX\n" );
 
 
-   Con::addVariable("$Core::DefaultIrradianceCubemap", TypeRealString, &smDefaultIrradianceCubemapPath,
-      "The file path of the texture used as the default irradiance cubemap for PBR.\n"
-      "@ingroup GFX\n");
-
-   Con::addVariable("$Core::DefaultPrefilterCubemap", TypeRealString, &smDefaultPrefilterCubemapPath,
-      "The file path of the texture used as the default specular cubemap for PBR.\n"
-      "@ingroup GFX\n");
-
    Con::addVariable("$Core::BRDFTexture", TypeRealString, &smBRDFTexturePath,
    Con::addVariable("$Core::BRDFTexture", TypeRealString, &smBRDFTexturePath,
       "The file path of the texture used as the default irradiance cubemap for PBR.\n"
       "The file path of the texture used as the default irradiance cubemap for PBR.\n"
       "@ingroup GFX\n");
       "@ingroup GFX\n");

+ 0 - 5
Engine/source/gfx/gfxTextureManager.h

@@ -75,9 +75,6 @@ public:
    /// Provide the path to the texture used to warn the developer
    /// Provide the path to the texture used to warn the developer
    static const String& getWarningTexturePath() { return smWarningTexturePath; }
    static const String& getWarningTexturePath() { return smWarningTexturePath; }
 
 
-   static const String& getDefaultIrradianceCubemapPath() { return smDefaultIrradianceCubemapPath; }
-   static const String& getDefaultPrefilterCubemapPath() { return smDefaultPrefilterCubemapPath; }
-
    static const String& getBRDFTexturePath() { return smBRDFTexturePath; }
    static const String& getBRDFTexturePath() { return smBRDFTexturePath; }
 
 
    /// Update width and height based on available resources.
    /// Update width and height based on available resources.
@@ -217,8 +214,6 @@ protected:
    /// File path to the warning texture
    /// File path to the warning texture
    static String smWarningTexturePath;
    static String smWarningTexturePath;
 
 
-   static String smDefaultIrradianceCubemapPath;
-   static String smDefaultPrefilterCubemapPath;
    static String smBRDFTexturePath;
    static String smBRDFTexturePath;
 
 
    GFXTextureObject *mListHead;
    GFXTextureObject *mListHead;

+ 1 - 1
Engine/source/gui/core/guiTypes.cpp

@@ -735,7 +735,7 @@ DefineEngineMethod( GuiControlProfile, getStringWidth, S32, (const char* string)
    "@param string String to get the width of."
    "@param string String to get the width of."
    "@return width of the string in pixels." )
    "@return width of the string in pixels." )
 {
 {
-   return object->mFont->getStrNWidth( string, dStrlen( string ) );
+   return (object->mFont) ? object->mFont->getStrNWidth( string, dStrlen( string ) ) : -1;
 }
 }
 
 
 DefineEngineMethod(GuiControlProfile, getBitmap, const char*, (), , "get name")
 DefineEngineMethod(GuiControlProfile, getBitmap, const char*, (), , "get name")

+ 1 - 0
Engine/source/renderInstance/renderImposterMgr.cpp

@@ -133,6 +133,7 @@ void RenderImposterMgr::_renderDeferred( const SceneRenderState *state, RenderDe
 
 
 void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDeferredMgr *deferredBin )
 void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDeferredMgr *deferredBin )
 {
 {
+   if (deferredBin == NULL) return;
    PROFILE_SCOPE( RenderImposterMgr_InnerRender );
    PROFILE_SCOPE( RenderImposterMgr_InnerRender );
 
 
    // Capture the GFX stats for this render.
    // Capture the GFX stats for this render.

+ 0 - 2
Templates/BaseGame/game/core/rendering/Core_Rendering.tscript

@@ -5,8 +5,6 @@ function Core_Rendering::onCreate(%this)
    $Core::UnAvailableTexturePath = "core/rendering/images/unavailable";
    $Core::UnAvailableTexturePath = "core/rendering/images/unavailable";
    $Core::WarningTexturePath = "core/rendering/images/warnMat";
    $Core::WarningTexturePath = "core/rendering/images/warnMat";
    $Core::CommonShaderPath = "core/rendering/shaders";
    $Core::CommonShaderPath = "core/rendering/shaders";
-   $Core::DefaultIrradianceCubemap = "core/rendering/images/default_irradiance.dds";
-   $Core::DefaultPrefilterCubemap = "core/rendering/images/default_prefilter.dds";
    $Core::BRDFTexture = "core/rendering/images/brdfTexture.dds";
    $Core::BRDFTexture = "core/rendering/images/brdfTexture.dds";
    
    
    $Core::NoImageAssetFallback = "Core_Rendering:missingTexture_image";
    $Core::NoImageAssetFallback = "Core_Rendering:missingTexture_image";

BIN
Templates/BaseGame/game/core/rendering/images/default_irradiance.dds


+ 0 - 8
Templates/BaseGame/game/core/rendering/images/default_irradiance_image.asset.taml

@@ -1,8 +0,0 @@
-<ImageAsset
-    canSave="true"
-    canSaveDynamicFields="true"
-    AssetName="default_irradiance_image"
-    imageFile="@assetFile=default_irradiance.dds"
-    UseMips="true"
-    isHDRImage="false"
-    imageType="Albedo" />

BIN
Templates/BaseGame/game/core/rendering/images/default_prefilter.dds


+ 0 - 8
Templates/BaseGame/game/core/rendering/images/default_prefilter_image.asset.taml

@@ -1,8 +0,0 @@
-<ImageAsset
-    canSave="true"
-    canSaveDynamicFields="true"
-    AssetName="default_prefilter_image"
-    imageFile="@assetFile=default_prefilter.dds"
-    UseMips="true"
-    isHDRImage="false"
-    imageType="Albedo" />

+ 6 - 1
Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript

@@ -453,7 +453,7 @@ new SimGroup( LightingQualityList )
       class = "GraphicsQualityLevel";
       class = "GraphicsQualityLevel";
       caseSensitive = true;
       caseSensitive = true;
       
       
-      displayName = "High";
+      displayName = "Highest";
       
       
       key["$pref::maximumNumOfLights"] = -1;
       key["$pref::maximumNumOfLights"] = -1;
       key["$pref::useLightFade"] = false;
       key["$pref::useLightFade"] = false;
@@ -821,6 +821,11 @@ function _makePrettyResString( %resString, %giveAspectRation )
    %width = getWord( %resString, $WORD::RES_X );
    %width = getWord( %resString, $WORD::RES_X );
    %height = getWord( %resString, $WORD::RES_Y );
    %height = getWord( %resString, $WORD::RES_Y );
    
    
+   //If it's an x, it means we've got the human-readable 'x' in the middle
+   //so skip it
+   if(%height $= "x")
+      %height = getWord( %resString, 2 ); 
+   
    %aspect = %width / %height;
    %aspect = %width / %height;
    %aspect = mRound( %aspect * 100 ) * 0.01;            
    %aspect = mRound( %aspect * 100 ) * 0.01;            
    
    

+ 194 - 68
Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript

@@ -46,6 +46,9 @@
 //headbob
 //headbob
 //FOV
 //FOV
 
 
+$yesNoList = "No\tYes";
+$onOffList = "Off\tOn";
+
 function OptionsMenu::onAdd(%this)
 function OptionsMenu::onAdd(%this)
 {
 {
    if(!isObject(%this.optionsCategories))
    if(!isObject(%this.optionsCategories))
@@ -159,6 +162,7 @@ function OptionsMenu::apply(%this)
    %hasVideoChanges = false;
    %hasVideoChanges = false;
    %hasPostFXChanges = false;
    %hasPostFXChanges = false;
    %hasAudioChanges = false;
    %hasAudioChanges = false;
+   %hasGraphicsChanges = false;
    for(%i=0; %i < %this.unappliedChanges.count(); %i++)
    for(%i=0; %i < %this.unappliedChanges.count(); %i++)
    {
    {
       %targetVar = %this.unappliedChanges.getKey(%i);
       %targetVar = %this.unappliedChanges.getKey(%i);
@@ -184,7 +188,10 @@ function OptionsMenu::apply(%this)
       
       
       if(!%wasKeybind)
       if(!%wasKeybind)
       {
       {
-         %currentValue = getVariable(%targetVar);
+         %sanitizedVar = strReplace(%targetVar, "[", "");
+         %sanitizedVar = strReplace(%sanitizedVar, "]", "");
+         %sanitizedVar = strReplace(%sanitizedVar, ",", "_");
+         %currentValue = getVariable(%sanitizedVar);
          if(%currentValue !$= %newValue)
          if(%currentValue !$= %newValue)
          {
          {
             setVariable(%targetVar, %newValue);
             setVariable(%targetVar, %newValue);
@@ -195,22 +202,6 @@ function OptionsMenu::apply(%this)
             {
             {
                MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." );
                MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." );
             }
             }
-            else if(startsWith(%targetVar, "$pref::Graphics::"))
-            {
-               //isolate the quality group name, like $pref::Graphics::LightingQuality
-               //we grab LightingQuality
-               %qualityGroupName = getSubStr(%targetVar, 17);
-               if(isObject(%qualityGroupName @ "List"))
-               {
-                  //yep, it's a quality group, so apply it 
-                  (%qualityGroupName @ "List").applySetting(%newValue); 
-               }
-               
-               if(%qualityGroupName $= "TextureQuality")
-               {
-                  reloadTextures();  
-               }
-            }
             else if(startsWith(%targetVar, "$pref::PostFX::"))
             else if(startsWith(%targetVar, "$pref::PostFX::"))
             {
             {
                %hasPostFXChanges = true;
                %hasPostFXChanges = true;
@@ -218,11 +209,26 @@ function OptionsMenu::apply(%this)
             else if(startsWith(%targetVar, "$pref::Video::"))
             else if(startsWith(%targetVar, "$pref::Video::"))
             {
             {
                %hasVideoChanges = true;
                %hasVideoChanges = true;
+               
+               //if it's the resolution, it's possible we got the human-friendly
+               //version stored off. if so, reprocess into the usable state
+               if(%targetVar $= "$pref::Video::Resolution")
+               {
+                  if(strpos(%newValue, " x ") != -1)
+                  {
+                     %newValue = strreplace(%newValue, " x ", " ");
+                     setVariable(%targetVar, %newValue);
+                  }
+               }
             }
             }
             else if(startsWith(%targetVar, "$pref::SFX::"))
             else if(startsWith(%targetVar, "$pref::SFX::"))
             {
             {
                %hasAudioChanges = true;
                %hasAudioChanges = true;
             }
             }
+            else if(startsWith(%targetVar, "$pref::Graphics::"))
+            {
+               %hasGraphicsChanges = true;
+            }
          }
          }
       }
       }
    }
    }
@@ -265,6 +271,11 @@ function OptionsMenu::apply(%this)
       updateAudioSettings();
       updateAudioSettings();
    }
    }
    
    
+   if(%hasGraphicsChanges)
+   {
+      updateGraphicsSettings();  
+   }
+   
    //Finally, write our prefs to file
    //Finally, write our prefs to file
    %prefPath = getPrefpath();
    %prefPath = getPrefpath();
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
@@ -282,8 +293,17 @@ function OptionsMenu::resetToDefaults(%this)
 
 
 function OptionsMenu::refresh(%this)
 function OptionsMenu::refresh(%this)
 {
 {
+   %cat = %this.currentCategory;
    if(%this.currentCategory !$= "")
    if(%this.currentCategory !$= "")
    {
    {
+      if(!isInt(%this.currentCategory))
+      {
+         %this.currentCategory = getOptionsCategoryIndexByName(%this.currentCategory);  
+      }
+      
+      if(%this.currentCategory == -1)
+         return;
+         
       %category = %this.optionsCategories.getKey(%this.currentCategory);
       %category = %this.optionsCategories.getKey(%this.currentCategory);
       %command = %this.optionsCategories.getValue(%this.currentCategory);
       %command = %this.optionsCategories.getValue(%this.currentCategory);
       eval(%command);
       eval(%command);
@@ -299,7 +319,10 @@ function OptionsMenu::getOptionVariableValue(%this, %variableName)
       return strreplace(%value, "\"", "");
       return strreplace(%value, "\"", "");
    }  
    }  
    
    
-   return getVariable(%variableName);
+   %sanitizedVar = strReplace(%variableName, "[", "");
+   %sanitizedVar = strReplace(%sanitizedVar, "]", "");
+   %sanitizedVar = strReplace(%sanitizedVar, ",", "_");
+   return getVariable(%sanitizedVar);
 }
 }
 
 
 function OptionsMenuSelectButton::onVisible(%this, %state)
 function OptionsMenuSelectButton::onVisible(%this, %state)
@@ -321,6 +344,8 @@ function populateDisplaySettingsList()
 {
 {
    OptionsMenuSettingsList.clear();
    OptionsMenuSettingsList.clear();
    
    
+   OptionsMenu.currentCategory = "Display";
+   
    OptionName.setText("");
    OptionName.setText("");
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
@@ -378,20 +403,26 @@ function populateDisplaySettingsList()
    if(%mode !$= "Borderless")
    if(%mode !$= "Borderless")
    {
    {
       %resolutionList = getScreenResolutionList($pref::Video::deviceId, $pref::Video::deviceMode);
       %resolutionList = getScreenResolutionList($pref::Video::deviceId, $pref::Video::deviceMode);
-      OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "",  true, "Resolution of the game window", _makePrettyResString( $pref::Video::mode ));
+      %resolution = OptionsMenu.getOptionVariableValue("$pref::Video::Resolution");
+      if(%resolution $= "")
+         %resolution =  $pref::Video::mode;
+         
+      %resolution = _makePrettyResString(%resolution);
+   
+      OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "",  true, "Resolution of the game window", %resolution);
    }
    }
    
    
-   OptionsMenuSettingsList.addOptionRow("VSync", "$pref::Video::disableVerticalSync", "No\tYes", false, "",  true, "", convertBoolToYesNo(!$pref::Video::disableVerticalSync));
+   OptionsMenuSettingsList.addOptionBoolRow("VSync", "$pref::Video::disableVerticalSync", $yesNoList, false, "",  true, "");
 
 
 
 
    %refreshList = getScreenRefreshList($pref::Video::mode);
    %refreshList = getScreenRefreshList($pref::Video::mode);
-   OptionsMenuSettingsList.addOptionRow("Refresh Rate", "$pref::Video::RefreshRate", %refreshList, false, "",  true, "", $pref::Video::RefreshRate);
+   OptionsMenuSettingsList.addOptionRow("Refresh Rate", "$pref::Video::RefreshRate", %refreshList, false, "",  true, "", OptionsMenu.getOptionVariableValue("$pref::Video::RefreshRate"));
    
    
    //move to gameplay tab
    //move to gameplay tab
-   OptionsMenuSettingsList.addSliderRow("Field of View", "", 75, 5, "65 100", "");
+   //OptionsMenuSettingsList.addSliderRow("Field of View", "", 75, 5, "65 100", "");
    
    
-   OptionsMenuSettingsList.addSliderRow("Brightness", "", 0.5, 0.1, "0 1", "");
-   OptionsMenuSettingsList.addSliderRow("Contrast", "", 0.5, 0.1, "0 1", "");
+   //OptionsMenuSettingsList.addSliderRow("Brightness", "", 0.5, 0.1, "0 1", "");
+   //OptionsMenuSettingsList.addSliderRow("Contrast", "", 0.5, 0.1, "0 1", "");
 }
 }
 
 
 //
 //
@@ -401,32 +432,76 @@ function populateGraphicsSettingsList()
 {
 {
    OptionsMenuSettingsList.clear();
    OptionsMenuSettingsList.clear();
    
    
+   OptionsMenu.currentCategory = "Graphics";
+   
    OptionName.setText("");
    OptionName.setText("");
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
    %yesNoList = "No\tYes";
    %yesNoList = "No\tYes";
    %onOffList = "Off\tOn";
    %onOffList = "Off\tOn";
-   %highMedLow = "Low\tMedium\tHigh";
    %anisoFilter = "Off\t4\t8\t16";
    %anisoFilter = "Off\t4\t8\t16";
    %aaFilter = "Off\t1\t2\t4";
    %aaFilter = "Off\t1\t2\t4";
-   OptionsMenuSettingsList.addOptionRow("Lighting Quality", "$pref::Graphics::LightingQuality", getQualityLevels(LightingQualityList), false, "",  true, "Amount and drawdistance of local lights", getCurrentQualityLevel(LightingQualityList));
-   OptionsMenuSettingsList.addOptionRow("Shadow Quality", "$pref::Graphics::ShadowQuality", getQualityLevels(ShadowQualityList), false, "",  true, "Shadow revolution quality", getCurrentQualityLevel(ShadowQualityList));
-   OptionsMenuSettingsList.addOptionRow("Soft Shadow Quality", "$pref::Graphics::SoftShadowQuality", getQualityLevels(SoftShadowList), false, "",  true, "Amount of softening applied to shadowmaps", getCurrentQualityLevel(SoftShadowList));
-   OptionsMenuSettingsList.addOptionRow("Mesh Quality", "$pref::Graphics::MeshQuality", getQualityLevels(MeshQualityGroup), false, "",  true, "Fidelity of rendering of mesh objects", getCurrentQualityLevel(MeshQualityGroup));
-   OptionsMenuSettingsList.addOptionRow("Object Draw Distance", "$pref::Graphics::ObjectDrawDistance", getQualityLevels(MeshDrawDistQualityGroup), false, "",  true, "Dictates if and when static objects fade out in the distance", getCurrentQualityLevel(MeshDrawDistQualityGroup));
-   OptionsMenuSettingsList.addOptionRow("Texture Quality", "$pref::Graphics::TextureQuality", getQualityLevels(TextureQualityGroup), false, "",  true, "Fidelity of textures", getCurrentQualityLevel(TextureQualityGroup));
-   OptionsMenuSettingsList.addOptionRow("Terrain Quality", "$pref::Graphics::TerrainQuality", getQualityLevels(TerrainQualityGroup), false, "",  true, "Quality level of terrain objects", getCurrentQualityLevel(TerrainQualityGroup));
-   OptionsMenuSettingsList.addOptionRow("Decal Lifetime", "$pref::Graphics::DecalLifetime", getQualityLevels(DecalLifetimeGroup), false, "",  true, "How long decals are rendered", getCurrentQualityLevel(DecalLifetimeGroup));
-   OptionsMenuSettingsList.addOptionRow("Ground Cover Density", "$pref::Graphics::GroundCoverDensity", getQualityLevels(GroundCoverDensityGroup), false, "",  true, "Density of ground cover items, such as grass", getCurrentQualityLevel(GroundCoverDensityGroup));
-   OptionsMenuSettingsList.addOptionRow("Shader Quality", "$pref::Graphics::ShaderQuality", getQualityLevels(ShaderQualityGroup), false, "",  true, "Dictates the overall shader quality level, adjusting what features are enabled.", getCurrentQualityLevel(ShaderQualityGroup));
-   OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", "$pref::Video::defaultAnisotropy", %anisoFilter, false, "",  true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance", $pref::Video::defaultAnisotropy);
-   OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", "$pref::Video::AA", %aaFilter, false, "",  true, "Amount of Post-Processing Anti-Aliasing applied to rendering", $pref::Video::AA);
-   OptionsMenuSettingsList.addOptionRow("Parallax", "$pref::Video::disableParallaxMapping", %onOffList, false, "",  true, "Whether the surface parallax shader effect is enabled", convertBoolToOnOff(!$pref::Video::disableParallaxMapping));
-   OptionsMenuSettingsList.addOptionRow("Water Reflections", "$pref::Water::disableTrueReflections", %onOffList, false, "",  true, "Whether water reflections are enabled", convertBoolToOnOff(!$pref::Water::disableTrueReflections));
-   OptionsMenuSettingsList.addOptionRow("SSAO", "$pref::PostFX::EnableSSAO", %onOffList, false, "",  true, "Whether Screen-Space Ambient Occlusion is enabled", convertBoolToOnOff($pref::PostFX::EnableSSAO));
-   OptionsMenuSettingsList.addOptionRow("Depth of Field", "$pref::PostFX::EnableDOF", %onOffList, false, "",  true, "Whether the Depth of Field effect is enabled", convertBoolToOnOff($pref::PostFX::EnableDOF));
-   OptionsMenuSettingsList.addOptionRow("Vignette", "$pref::PostFX::EnableVignette", %onOffList, false, "",  true, "Whether the vignette effect is enabled", convertBoolToOnOff($pref::PostFX::EnableVignette));
-   OptionsMenuSettingsList.addOptionRow("Light Rays", "$pref::PostFX::EnableLightRays", %onOffList, false, "",  true, "Whether the light rays effect is enabled", convertBoolToOnOff($pref::PostFX::EnableLightRays));
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Lighting Quality", "$pref::Graphics::LightingQuality", 
+      LightingQualityList, false, "",  true, "Amount and drawdistance of local lights");
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Shadow Quality", "$pref::Graphics::ShadowQuality", 
+      ShadowQualityList, false, "",  true, "Shadow revolution quality");
+   
+   %shadowQuality = OptionsMenu.getOptionVariableValue("$pref::Graphics::ShadowQuality");
+   if(%shadowQuality !$= "None")
+   {
+      OptionsMenuSettingsList.addOptionQualityLevelRow("Soft Shadow Quality", "$pref::Graphics::SoftShadowQuality", 
+         SoftShadowList, false, "",  true, "Amount of softening applied to shadowmaps");
+   }
+   
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Mesh Quality", "$pref::Graphics::MeshQuality", 
+      MeshQualityGroup, false, "",  true, "Fidelity of rendering of mesh objects");
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Object Draw Distance", "$pref::Graphics::ObjectDrawDistance", 
+      MeshDrawDistQualityGroup, false, "",  true, "Dictates if and when static objects fade out in the distance");
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Texture Quality", "$pref::Graphics::TextureQuality", 
+      TextureQualityGroup, false, "",  true, "Fidelity of textures");
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Terrain Quality", "$pref::Graphics::TerrainQuality", 
+      TerrainQualityGroup, false, "",  true, "Quality level of terrain objects");
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Decal Lifetime", "$pref::Graphics::DecalLifetime", 
+      DecalLifetimeGroup, false, "",  true, "How long decals are rendered");
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Ground Cover Density", "$pref::Graphics::GroundCoverDensity", 
+      GroundCoverDensityGroup, false, "",  true, "Density of ground cover items, such as grass");
+   OptionsMenuSettingsList.addOptionQualityLevelRow("Shader Quality", "$pref::Graphics::ShaderQuality", 
+      ShaderQualityGroup, false, "",  true, "Dictates the overall shader quality level, adjusting what features are enabled.");
+   OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", "$pref::Video::defaultAnisotropy", %anisoFilter, false, "",  true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance");
+   OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", "$pref::Video::AA", %aaFilter, false, "",  true, "Amount of Post-Processing Anti-Aliasing applied to rendering");
+   OptionsMenuSettingsList.addOptionBoolRow("Parallax", "$pref::Video::disableParallaxMapping", %onOffList, false, "",  true, "Whether the surface parallax shader effect is enabled");
+   OptionsMenuSettingsList.addOptionBoolRow("Water Reflections", "$pref::Water::disableTrueReflections", %onOffList, false, "",  true, "Whether water reflections are enabled");
+   OptionsMenuSettingsList.addOptionBoolRow("SSAO", "$pref::PostFX::EnableSSAO", %onOffList, false, "",  true, "Whether Screen-Space Ambient Occlusion is enabled");
+   OptionsMenuSettingsList.addOptionBoolRow("Depth of Field", "$pref::PostFX::EnableDOF", %onOffList, false, "",  true, "Whether the Depth of Field effect is enabled");
+   OptionsMenuSettingsList.addOptionBoolRow("Vignette", "$pref::PostFX::EnableVignette", %onOffList, false, "",  true, "Whether the vignette effect is enabled");
+   OptionsMenuSettingsList.addOptionBoolRow("Light Rays", "$pref::PostFX::EnableLightRays", %onOffList, false, "",  true, "Whether the light rays effect is enabled");
+}
+
+function updateGraphicsSettings()
+{
+   if($pref::Graphics::LightingQuality !$= getCurrentQualityLevel(LightingQualityList))
+      LightingQualityList.applySetting($pref::Graphics::LightingQuality);
+   if($pref::Graphics::ShadowQuality !$= getCurrentQualityLevel(ShadowQualityList))
+      ShadowQualityList.applySetting($pref::Graphics::ShadowQuality);
+   if($pref::Graphics::SoftShadowQuality !$= getCurrentQualityLevel(SoftShadowList))
+      SoftShadowList.applySetting($pref::Graphics::SoftShadowQuality);
+      
+   if($pref::Graphics::MeshQuality !$= getCurrentQualityLevel(MeshQualityGroup))
+      MeshQualityGroup.applySetting($pref::Graphics::MeshQuality);
+   if($pref::Graphics::ObjectDrawDistance !$= getCurrentQualityLevel(MeshDrawDistQualityGroup))
+      MeshDrawDistQualityGroup.applySetting($pref::Graphics::ObjectDrawDistance);
+   if($pref::Graphics::TextureQuality !$= getCurrentQualityLevel(TextureQualityGroup))
+   {
+      TextureQualityGroup.applySetting($pref::Graphics::TextureQuality);
+      
+      reloadTextures();
+   }
+   if($pref::Graphics::TerrainQuality !$= getCurrentQualityLevel(TerrainQualityGroup))
+      TerrainQualityGroup.applySetting($pref::Graphics::TerrainQuality);
+   if($pref::Graphics::DecalLifetime !$= getCurrentQualityLevel(DecalLifetimeGroup))
+      DecalLifetimeGroup.applySetting($pref::Graphics::DecalLifetime);
+   if($pref::Graphics::GroundCoverDensity !$= getCurrentQualityLevel(GroundCoverDensityGroup))
+      GroundCoverDensityGroup.applySetting($pref::Graphics::GroundCoverDensity);
 }
 }
 
 
 function updateDisplaySettings()
 function updateDisplaySettings()
@@ -522,6 +597,8 @@ function populateAudioSettingsList()
 {
 {
    OptionsMenuSettingsList.clear();
    OptionsMenuSettingsList.clear();
    
    
+   OptionsMenu.currentCategory = "Audio";
+   
    OptionName.setText("");
    OptionName.setText("");
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
@@ -557,13 +634,13 @@ function populateAudioSettingsList()
       }
       }
    }
    }
    
    
-   OptionsMenuSettingsList.addOptionRow("Audio Provider", "$pref::SFX::AudioProvider", %audioProviderList, false, "audioProviderChanged", true, "", $currentAudioProvider);
-   OptionsMenuSettingsList.addOptionRow("Audio Device", "$pref::SFX::device", %audioDeviceList, false, "", true, $pref::SFX::device);
+   OptionsMenuSettingsList.addOptionRow("Audio Provider", "$pref::SFX::AudioProvider", %audioProviderList, false, "audioProviderChanged", true, "");
+   OptionsMenuSettingsList.addOptionRow("Audio Device", "$pref::SFX::device", %audioDeviceList, false, "", true);
    
    
-   OptionsMenuSettingsList.addSliderRow("Master Volume", "$pref::SFX::masterVolume", $pref::SFX::masterVolume, 0.1, "0 1", "");
-   OptionsMenuSettingsList.addSliderRow("GUI Volume", "$pref::SFX::channelVolume[ $GuiAudioType]", $pref::SFX::channelVolume[ $GuiAudioType], 0.1, "0 1", "");
-   OptionsMenuSettingsList.addSliderRow("Effects Volume", "$pref::SFX::channelVolume[ $SimAudioType ]", $pref::SFX::channelVolume[ $SimAudioType ], 0.1, "0 1", "");
-   OptionsMenuSettingsList.addSliderRow("Music Volume", "$pref::SFX::channelVolume[ $MusicAudioType ]", $pref::SFX::channelVolume[ $MusicAudioType ], 0.1, "0 1", "");
+   OptionsMenuSettingsList.addSliderRow("Master Volume", "$pref::SFX::masterVolume", 0.1, "0 1", "");
+   OptionsMenuSettingsList.addSliderRow("GUI Volume", "$pref::SFX::channelVolume[" @ $GuiAudioType @ "]", 0.1, "0 1", "");
+   OptionsMenuSettingsList.addSliderRow("Effects Volume", "$pref::SFX::channelVolume[" @ $SimAudioType @ "]", 0.1, "0 1", "");
+   OptionsMenuSettingsList.addSliderRow("Music Volume", "$pref::SFX::channelVolume[" @ $MusicAudioType @ "]", 0.1, "0 1", "");
 }
 }
 
 
 function audioProviderChanged()
 function audioProviderChanged()
@@ -613,6 +690,8 @@ function populateKeyboardMouseSettingsList()
 {
 {
    OptionsMenuSettingsList.clear();
    OptionsMenuSettingsList.clear();
    
    
+   OptionsMenu.currentCategory = "Keyboard & Mouse";
+   
    OptionName.setText("");
    OptionName.setText("");
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
@@ -626,6 +705,8 @@ function populateGamepadSettingsList()
 {
 {
    OptionsMenuSettingsList.clear();
    OptionsMenuSettingsList.clear();
    
    
+   OptionsMenu.currentCategory = "Gamepad";
+   
    OptionName.setText("");
    OptionName.setText("");
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
@@ -717,21 +798,57 @@ function OptionsMenuSettingsList::addOptionRow(%this, %label, %targetPrefVar, %o
    
    
    %option.targetPrefVar = %targetPrefVar; //create a var-option association
    %option.targetPrefVar = %targetPrefVar; //create a var-option association
    
    
-   //now some override trickery, if we have a value cached for unapplied changes, swapsies the defaultValue out
-   //with the unapplied, allowing us to change options categories without losing changes
-   %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromValue(%targetPrefVar);
+   %option.setListSetting(%label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue);
+
+   %this.add(%option);
+}
+
+function OptionsMenuSettingsList::addOptionQualityLevelRow(%this, %label, %targetPrefVar, %qualityLevelList, %wrapOptions, %callback, %enabled, %description, %defaultValue)
+{
+   if(%defaultValue $= "")
+   {
+      %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetPrefVar);
    if(%unappliedPrefIndex != -1)
    if(%unappliedPrefIndex != -1)
    {
    {
-      %unappliedValue = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex);
-      %defaultValue = %unappliedValue;
+         %value = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex);
+         %defaultValue = strreplace(%value, "\"", "");
    }
    }
    
    
-   %option.setListSetting(%label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue);
+      if(%defaultValue $= "")
+      {
+         %sanitizedVar = strReplace(%targetPrefVar, "[", "");
+         %sanitizedVar = strReplace(%sanitizedVar, "]", "");
+         %sanitizedVar = strReplace(%sanitizedVar, ",", "_");
+         %defaultValue = getVariable(%sanitizedVar);
+      }
+         
+      if(%defaultValue $= "")
+         %defaultValue = getCurrentQualityLevel(%qualityLevelList);
+   }
+   
+   return %this.addOptionRow(%label, %targetPrefVar, getQualityLevels(%qualityLevelList), 
+      %wrapOptions, %callback, %enabled, %description, %defaultValue);
+}
 
 
-   %this.add(%option);
+function OptionsMenuSettingsList::addOptionBoolRow(%this, %label, %targetPrefVar, %qualityLevelList, %wrapOptions, %callback, %enabled, %description, %defaultValue)
+{
+   if(%defaultValue $= "")
+      %defaultValue = OptionsMenu.getOptionVariableValue(%targetPrefVar);
+      
+   if(%qualityLevelList $= $yesNoList && isInt(%defaultValue))
+   {
+      %defaultValue = convertBoolToYesNo(!%defaultValue);
+   }
+   else if(%qualityLevelList $= $onOffList && isInt(%defaultValue))
+   {
+      %defaultValue = convertBoolToOnOff(!%defaultValue);
+   }
+
+   return %this.addOptionRow(%label, %targetPrefVar, %qualityLevelList, 
+      %wrapOptions, %callback, %enabled, %description, %defaultValue);
 }
 }
 
 
-function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %defaultValue, %increment, %range, %callback, %enabled, %description)
+function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %increment, %range, %callback, %enabled, %description, %defaultValue)
 {
 {
    if(%enabled $= "")
    if(%enabled $= "")
       %enabled = true;
       %enabled = true;
@@ -752,14 +869,8 @@ function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %d
    
    
    %option.targetPrefVar = %targetPrefVar; //create a var-option association
    %option.targetPrefVar = %targetPrefVar; //create a var-option association
    
    
-   //now some override trickery, if we have a value cached for unapplied changes, swapsies the defaultValue out
-   //with the unapplied, allowing us to change options categories without losing changes
-   %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromValue(%targetPrefVar);
-   if(%unappliedPrefIndex != -1)
-   {
-      %unappliedValue = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex);
-      %defaultValue = %unappliedValue;
-   }
+   if(%defaultValue $= "")
+      %defaultValue = OptionsMenu.getOptionVariableValue(%targetPrefVar);
    
    
    %option.setSliderSetting(%label, %defaultValue, %increment, %range, %callback, %enabled, %description);
    %option.setSliderSetting(%label, %defaultValue, %increment, %range, %callback, %enabled, %description);
 
 
@@ -809,16 +920,20 @@ function convertBoolToYesNo(%val)
 {
 {
    if(%val == 1)
    if(%val == 1)
       return "Yes";
       return "Yes";
-   else 
+   else if(%val == 0)
       return "No";
       return "No";
+      
+   return %val;
 }
 }
 
 
 function convertBoolToOnOff(%val)
 function convertBoolToOnOff(%val)
 {
 {
    if(%val == 1)
    if(%val == 1)
       return "On";
       return "On";
-   else 
+   else if(%val == 0)
       return "Off";
       return "Off";
+      
+   return %val;
 }
 }
 
 
 function getDisplayDeviceName()
 function getDisplayDeviceName()
@@ -883,7 +998,7 @@ function MenuOptionsButton::onChange(%this)
    }
    }
    
    
    //Update the UI in case there's responsive logic
    //Update the UI in case there's responsive logic
-   schedule(32, OptionsMenu, "refresh");
+   OptionsMenu.schedule(32, "refresh");
 }
 }
 
 
 function OptionsMenu::onKeybindChanged(%this, %actionMap, %keybind)
 function OptionsMenu::onKeybindChanged(%this, %actionMap, %keybind)
@@ -913,6 +1028,17 @@ function removeOptionsMenuCategory(%categoryName)
       OptionsMenu.optionsCategories.erase(%index);
       OptionsMenu.optionsCategories.erase(%index);
 }
 }
 
 
+function getOptionsCategoryIndexByName(%categoryName)
+{
+   for(%i=0; %i < OptionsMenu.optionsCategories.count(); %i++)
+   {
+      if(OptionsMenu.optionsCategories.getKey(%i) $= %categoryName)
+         return %i;
+   }
+   
+   return -1;
+}
+
 function addListOption(%label, %description, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled)
 function addListOption(%label, %description, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled)
 {
 {
    if(%wrapOptions $= "")
    if(%wrapOptions $= "")

+ 0 - 5
Templates/BaseGame/game/data/defaults.tscript

@@ -125,11 +125,6 @@ $pref::SFX::channelVolume6 = 1;
 $pref::SFX::channelVolume7 = 1;
 $pref::SFX::channelVolume7 = 1;
 $pref::SFX::channelVolume8 = 1;
 $pref::SFX::channelVolume8 = 1;
 
 
-$pref::SFX::channelVolume[1] = 1;
-$pref::SFX::channelVolume[2] = 1;
-$pref::SFX::channelVolume[3] = 1;
-$pref::SFX::channelVolume[4] = 1;
-
 $pref::PostEffect::PreferedHDRFormat = "GFXFormatR8G8B8A8";
 $pref::PostEffect::PreferedHDRFormat = "GFXFormatR8G8B8A8";
 
 
 /// This is an scalar which can be used to reduce the 
 /// This is an scalar which can be used to reduce the 

+ 17 - 7
Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript

@@ -1088,7 +1088,7 @@ function AssetBrowserPreviewButton::onRightClick(%this)
    
    
    //Do some enabling/disabling of options depending on asset type
    //Do some enabling/disabling of options depending on asset type
    EditAssetPopup.enableItem(0, true);
    EditAssetPopup.enableItem(0, true);
-   EditAssetPopup.enableItem(7, true);
+   EditAssetPopup.enableItem(9, true);
    
    
    //Is it an editable type?
    //Is it an editable type?
    if(%assetType $= "ImageAsset" /*|| %assetType $= "GameObjectAsset"*/ || %assetType $= "CppAsset")
    if(%assetType $= "ImageAsset" /*|| %assetType $= "GameObjectAsset"*/ || %assetType $= "CppAsset")
@@ -1101,9 +1101,18 @@ function AssetBrowserPreviewButton::onRightClick(%this)
        || %assetType $= "MaterialAsset" || %assetType $= "ParticleAsset"  || %assetType $= "PostEffectAsset" || %assetType $= "ScriptAsset"
        || %assetType $= "MaterialAsset" || %assetType $= "ParticleAsset"  || %assetType $= "PostEffectAsset" || %assetType $= "ScriptAsset"
        || %assetType $= "StateMachineAsset")
        || %assetType $= "StateMachineAsset")
    {
    {
-      EditAssetPopup.enableItem(7, false);
+      EditAssetPopup.enableItem(9, false);
    }
    }
    
    
+   %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
+   if(%assetDef.originalFilePath $= "" || !isFile(%assetDef.originalFilePath))
+   {
+      //if we have no noted original import file path or it's invalid
+      //we can't reimport either
+      EditAssetPopup.enableItem(9, false);
+   }
+   AssetDatabase.releaseAsset(EditAssetPopup.assetId);
+   
    if(%assetType $= "LevelAsset")
    if(%assetType $= "LevelAsset")
    {
    {
       EditLevelAssetPopup.showPopup(Canvas);  
       EditLevelAssetPopup.showPopup(Canvas);  
@@ -2403,19 +2412,14 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position )
    %assetName = %payload.assetName;
    %assetName = %payload.assetName;
    %moduleName = %payload.moduleName;
    %moduleName = %payload.moduleName;
    
    
-   echo("DROPPED A " @ %assetType @ " ON THE ASSET BROWSER NAVIGATION TREE!");
-   
    %item = %this.getItemAtPosition(%position);
    %item = %this.getItemAtPosition(%position);
    
    
-   echo("DROPPED IT ON ITEM " @ %item);
-   
    %parent = %this.getParentItem(%item);
    %parent = %this.getParentItem(%item);
    
    
    if(%item != 1)
    if(%item != 1)
    {
    {
       //we're a folder entry, cool
       //we're a folder entry, cool
       %path = %this.getItemValue(%item) @ "/" @ %this.getItemText(%item);
       %path = %this.getItemValue(%item) @ "/" @ %this.getItemText(%item);
-      echo("DROPPED IT ON PATH " @ %path);  
       
       
       if(%path !$= AssetBrowser.dirHandler.CurrentAddress)
       if(%path !$= AssetBrowser.dirHandler.CurrentAddress)
       {
       {
@@ -2430,7 +2434,11 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position )
             
             
             //Do any cleanup required given the type
             //Do any cleanup required given the type
             if(AssetBrowser.isMethod("moveFolder"))
             if(AssetBrowser.isMethod("moveFolder"))
+            {
                eval(AssetBrowser @ ".moveFolder(\""@%originFolder@"\",\""@%path@"\");");
                eval(AssetBrowser @ ".moveFolder(\""@%originFolder@"\",\""@%path@"\");");
+               
+               AssetBrowser.refresh();
+            }
          }
          }
          else
          else
          {
          {
@@ -2443,6 +2451,8 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position )
             {
             {
                %command = AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %path @ "\");";
                %command = AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %path @ "\");";
                eval(AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %path @ "\");");
                eval(AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %path @ "\");");
+               
+               AssetBrowser.refresh();
             }
             }
          }
          }
       }
       }

+ 1 - 1
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript

@@ -204,7 +204,7 @@ function AssetBrowser::deleteCpp(%this, %assetDef)
 function AssetBrowser::moveCpp(%this, %assetDef, %destination)
 function AssetBrowser::moveCpp(%this, %assetDef, %destination)
 {
 {
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    

+ 1 - 1
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cubemap.tscript

@@ -69,7 +69,7 @@ function AssetBrowser::deleteCubemapAsset(%this, %assetDef)
 function AssetBrowser::moveCubemapAsset(%this, %assetDef, %destination)
 function AssetBrowser::moveCubemapAsset(%this, %assetDef, %destination)
 {
 {
    /*%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    /*%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    

+ 1 - 1
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript

@@ -233,7 +233,7 @@ function AssetBrowser::deleteGameObjectAsset(%this, %assetDef)
 function AssetBrowser::moveGameObjectAsset(%this, %assetDef, %destination)
 function AssetBrowser::moveGameObjectAsset(%this, %assetDef, %destination)
 {
 {
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    

+ 3 - 3
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript

@@ -145,15 +145,15 @@ function AssetBrowser::deleteGUIAsset(%this, %assetDef)
 function AssetBrowser::moveGUIAsset(%this, %assetDef, %destination)
 function AssetBrowser::moveGUIAsset(%this, %assetDef, %destination)
 {
 {
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    
    if(%newAssetPath $= "")
    if(%newAssetPath $= "")
       return false;
       return false;
 
 
-   moveAssetLooseFile(%assetDef.guifile, %destination);
-   moveAssetLooseFile(%assetDef.scriptFile, %destination);
+   moveAssetLooseFile(%assetDef.getGUIPath(), %destination);
+   moveAssetLooseFile(%assetDef.getScriptPath(), %destination);
    
    
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);

+ 22 - 16
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript

@@ -175,8 +175,11 @@ function AssetBrowser::importImageAsset(%this, %assetItem)
       AssetDatabase.refreshAsset(%assetId);
       AssetDatabase.refreshAsset(%assetId);
 }
 }
 
 
-function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
+function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate)
 {
 {
+   if(%forcePreviewRegenerate $= "")
+      %forcePreviewRegenerate = false;
+      
    %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getImagePath())));
    %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getImagePath())));
    %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
    %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
    
    
@@ -195,7 +198,7 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
    
    
    %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
    %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
    
    
-   if(%generatePreview)
+   if(%generatePreview || %forcePreviewRegenerate)
    {
    {
       displayEditorLoadingGui("Generating Image Asset Preview...");
       displayEditorLoadingGui("Generating Image Asset Preview...");
       
       
@@ -203,20 +206,23 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
       
       
       if(%success)
       if(%success)
       {
       {
-         %previewAsset = new ImageAsset()
+         if(!AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName))
          {
          {
-            assetName = %previewAssetName;
-            versionId = 1;
-            imageFile = fileName(%previewFilePath);
-         };
-      
-         %previewAssetName = "ToolsModule:" @ %previewAssetName;
-         %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
-         %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); 
-      
-         %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
+            %previewAsset = new ImageAsset()
+            {
+               assetName = %previewAssetName;
+               versionId = 1;
+               imageFile = fileName(%previewFilePath);
+            };
          
          
-         %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
+            %previewAssetName = "ToolsModule:" @ %previewAssetName;
+            %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
+            %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); 
+         
+            %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
+            
+            %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
+         }
       }
       }
       else
       else
       {
       {
@@ -303,14 +309,14 @@ function AssetBrowser::deleteImageAsset(%this, %assetDef)
 function AssetBrowser::moveImageAsset(%this, %assetDef, %destination)
 function AssetBrowser::moveImageAsset(%this, %assetDef, %destination)
 {
 {
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    
    if(%newAssetPath $= "")
    if(%newAssetPath $= "")
       return false;
       return false;
 
 
-   moveAssetLooseFile(%assetDef.imageFile, %destination);
+   moveAssetLooseFile(%assetDef.getImagePath(), %destination);
    
    
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);

+ 6 - 2
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.tscript

@@ -113,14 +113,18 @@ function AssetBrowser::deleteLevelAsset(%this, %assetDef)
 function AssetBrowser::moveLevelAsset(%this, %assetDef, %destination)
 function AssetBrowser::moveLevelAsset(%this, %assetDef, %destination)
 {
 {
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    
    if(%newAssetPath $= "")
    if(%newAssetPath $= "")
       return false;
       return false;
 
 
-   moveAssetLooseFile(%assetDef.LevelFile, %destination);
+   moveAssetLooseFile(%assetDef.getLevelPath(), %destination);
+   moveAssetLooseFile(%assetDef.getLevelPath(), %destination);
+   moveAssetLooseFile(%assetDef.getPreviewImagePath(), %destination);
+   moveAssetLooseFile(%assetDef.getPostFXPresetPath(), %destination);
+   moveAssetLooseFile(%assetDef.getDecalsPath(), %destination);
    
    
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);

+ 32 - 19
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript

@@ -69,14 +69,14 @@ function AssetBrowser::deleteMaterialAsset(%this, %assetDef)
 function AssetBrowser::moveMaterialAsset(%this, %assetDef, %destination)
 function AssetBrowser::moveMaterialAsset(%this, %assetDef, %destination)
 {
 {
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    
    if(%newAssetPath $= "")
    if(%newAssetPath $= "")
       return false;
       return false;
 
 
-   moveAssetLooseFile(%assetDef.scriptPath, %destination);
+   moveAssetLooseFile(%assetDef.getScriptPath(), %destination);
    
    
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
@@ -424,8 +424,11 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem)
       AssetDatabase.refreshAsset(%assetId);
       AssetDatabase.refreshAsset(%assetId);
 }
 }
 
 
-function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
-{
+function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate)
+{   
+   if(%forcePreviewRegenerate $= "")
+      %forcePreviewRegenerate = false;
+      
    %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()))));
    %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()))));
    %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
    %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
 
 
@@ -447,14 +450,13 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
       {
       {
          if(compareFileTimes(%assetDef.materialDefinitionName.getDiffuseMap(0), %previewFilePath) == 1 ||
          if(compareFileTimes(%assetDef.materialDefinitionName.getDiffuseMap(0), %previewFilePath) == 1 ||
             compareFileTimes(%assetDef.materialDefinitionName.getFilename(), %previewFilePath) == 1)
             compareFileTimes(%assetDef.materialDefinitionName.getFilename(), %previewFilePath) == 1)
-      %generatePreview = true;
-         
+            %generatePreview = true;
       }
       }
    }
    }
 
 
    %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
    %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
                                    
                                    
-   if(%generatePreview)
+   if(%generatePreview || %forcePreviewRegenerate)
    {
    {
       displayEditorLoadingGui("Generating Material Asset Preview...");
       displayEditorLoadingGui("Generating Material Asset Preview...");
    
    
@@ -466,19 +468,26 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
          pathCopy(%generatedFilePath, %previewFilePath);
          pathCopy(%generatedFilePath, %previewFilePath);
          fileDelete(%generatedFilePath);
          fileDelete(%generatedFilePath);
 
 
-         %previewAsset = new ImageAsset()
+         if(!AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName))
          {
          {
-            assetName = %previewAssetName;
-            versionId = 1;
-            imageFile = fileName(%previewFilePath);
-         };
-         
-         %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
-         %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); 
-         
-         %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
+            %previewAsset = new ImageAsset()
+            {
+               assetName = %previewAssetName;
+               versionId = 1;
+               imageFile = fileName(%previewFilePath);
+            };
             
             
-         %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
+            %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
+            %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); 
+            
+            %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
+               
+            %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
+         }
+      }
+      else
+      {
+         error("Failed to generate preview for material: " @ %assetDef.materialDefinitionName);
       }
       }
       
       
       hideEditorLoadingGui();
       hideEditorLoadingGui();
@@ -504,11 +513,15 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
       %previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
       %previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
    else
    else
       %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
       %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
+      
+   %definitionPath = %assetDef.getScriptPath();
+   if(%definitionPath $= "")
+      %definitionPath = %assetDef.getFilename();
    
    
    %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ 
    %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ 
                            "\nAsset Type: Material Asset" @  
                            "\nAsset Type: Material Asset" @  
                            "\nAsset Definition ID: " @  %assetDef @
                            "\nAsset Definition ID: " @  %assetDef @
-                           "\nDefinition Path: " @ %assetDef.getScriptPath();
+                           "\nDefinition Path: " @ %definitionPath;
                            
                            
    if(!%this.selectMode)
    if(!%this.selectMode)
    {
    {

+ 4 - 4
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript

@@ -140,16 +140,16 @@ function AssetBrowser::deletePostEffectAsset(%this, %assetDef)
 function AssetBrowser::movePostEffectAsset(%this, %assetDef, %destination)
 function AssetBrowser::movePostEffectAsset(%this, %assetDef, %destination)
 {
 {
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    
    if(%newAssetPath $= "")
    if(%newAssetPath $= "")
       return false;
       return false;
 
 
-   moveAssetLooseFile(%assetDef.scriptPath, %destination);
-   moveAssetLooseFile(%assetDef.hlslShader, %destination);
-   moveAssetLooseFile(%assetDef.glslShader, %destination);
+   moveAssetLooseFile(%assetDef.getScriptPath(), %destination);
+   moveAssetLooseFile(%assetDef.getHLSLShaderPath(), %destination);
+   moveAssetLooseFile(%assetDef.getGLSLShaderPath(), %destination);
    
    
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);

+ 5 - 5
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript

@@ -36,7 +36,7 @@ function AssetBrowser::editScriptAsset(%this, %assetDef)
 {
 {
    %scriptFile = %assetDef.scriptFile;
    %scriptFile = %assetDef.scriptFile;
    
    
-   EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0);
+   //EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0);
 }
 }
 
 
 function AssetBrowser::duplicateScriptAsset(%this, %assetDef, %targetModule)
 function AssetBrowser::duplicateScriptAsset(%this, %assetDef, %targetModule)
@@ -76,14 +76,14 @@ function AssetBrowser::deleteScriptAsset(%this, %assetDef)
 function AssetBrowser::moveScriptAsset(%this, %assetDef, %destination)
 function AssetBrowser::moveScriptAsset(%this, %assetDef, %destination)
 {
 {
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
    %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
-   %targetModule = AssetBrowser.getModuleFromAddress(%destination);
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
    
    
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    %newAssetPath = moveAssetFile(%assetDef, %destination);
    
    
    if(%newAssetPath $= "")
    if(%newAssetPath $= "")
       return false;
       return false;
 
 
-   moveAssetLooseFile(%assetDef.scriptFile, %destination);
+   moveAssetLooseFile(%assetDef.getScriptPath(), %destination);
    
    
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
    AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
@@ -93,7 +93,7 @@ function AssetBrowser::buildScriptAssetPreview(%this, %assetDef, %previewData)
 {
 {
    %previewData.assetName = %assetDef.assetName;
    %previewData.assetName = %assetDef.assetName;
    %previewData.assetPath = %assetDef.scriptFile;
    %previewData.assetPath = %assetDef.scriptFile;
-   %previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );";
+   //%previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );";
    
    
    if(%assetDef.isServerSide)
    if(%assetDef.isServerSide)
       %previewData.previewImage = "ToolsModule:serverScriptIcon_image";
       %previewData.previewImage = "ToolsModule:serverScriptIcon_image";
@@ -109,7 +109,7 @@ function AssetBrowser::buildTScriptPreview(%this, %assetDef, %previewData)
 {
 {
    %previewData.assetName = %assetDef.assetName;
    %previewData.assetName = %assetDef.assetName;
    %previewData.assetPath = %assetDef.scriptFile;
    %previewData.assetPath = %assetDef.scriptFile;
-   %previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );";
+   //%previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );";
    
    
    if(%assetDef.isServerSide)
    if(%assetDef.isServerSide)
       %previewData.previewImage = "ToolsModule:serverScriptIcon_image";
       %previewData.previewImage = "ToolsModule:serverScriptIcon_image";

+ 39 - 16
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript

@@ -46,6 +46,23 @@ function AssetBrowser::deleteShapeAsset(%this, %assetDef)
    
    
 }
 }
 
 
+function AssetBrowser::moveShapeAsset(%this, %assetDef, %destination)
+{
+   %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
+   
+   %newAssetPath = moveAssetFile(%assetDef, %destination);
+   
+   if(%newAssetPath $= "")
+      return false;
+
+   moveAssetLooseFile(%assetDef.getShapePath(), %destination);
+   moveAssetLooseFile(%assetDef.getShapeConstructorFilePath(), %destination);
+   
+   AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
+   AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
+}
+
 function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
 function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
 {
 {
    ImportActivityLog.add("Preparing Shape for Import: " @ %assetItem.assetName);
    ImportActivityLog.add("Preparing Shape for Import: " @ %assetItem.assetName);
@@ -246,9 +263,12 @@ function AssetBrowser::importShapeAsset(%this, %assetItem)
       AssetDatabase.refreshAsset(%assetId);
       AssetDatabase.refreshAsset(%assetId);
 }
 }
 
 
-function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData)
+function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate)
 {
 {
-   %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getShapeFile())));
+   if(%forcePreviewRegenerate $= "")
+      %forcePreviewRegenerate = false;
+      
+   %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getShapePath())));
    %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
    %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
    
    
    if(!IsDirectory(%previewPath))
    if(!IsDirectory(%previewPath))
@@ -259,14 +279,14 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData)
    %generatePreview = false;
    %generatePreview = false;
    
    
    %previewFilePath = %previewPath @ %assetDef.assetName @ "_Preview.dds";
    %previewFilePath = %previewPath @ %assetDef.assetName @ "_Preview.dds";
-   if(!isFile(%previewFilePath) || (compareFileTimes(%assetDef.getShapeFile(), %previewFilePath) == 1))
+   if(!isFile(%previewFilePath) || (compareFileTimes(%assetDef.getShapePath(), %previewFilePath) == 1))
    {
    {
       %generatePreview = true;
       %generatePreview = true;
    }
    }
    
    
    %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
    %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
    
    
-   if(%generatePreview)
+   if(%generatePreview || %forcePreviewRegenerate)
    {
    {
       displayEditorLoadingGui("Generating Shape Asset Preview...");
       displayEditorLoadingGui("Generating Shape Asset Preview...");
       
       
@@ -278,19 +298,22 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData)
       pathCopy(%filePath, %previewFilePath);
       pathCopy(%filePath, %previewFilePath);
       fileDelete(%filePath); //cleanup
       fileDelete(%filePath); //cleanup
       
       
-      %previewAsset = new ImageAsset()
+      if(!AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName))
       {
       {
-         assetName = %previewAssetName;
-         versionId = 1;
-         imageFile = fileName(%previewFilePath);
-      };
-      
-      %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
-      %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); 
-      
-      %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
+         %previewAsset = new ImageAsset()
+         {
+            assetName = %previewAssetName;
+            versionId = 1;
+            imageFile = fileName(%previewFilePath);
+         };
          
          
-      %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
+         %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
+         %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); 
+         
+         %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
+            
+         %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
+      }
       
       
       hideEditorLoadingGui();
       hideEditorLoadingGui();
    }
    }
@@ -313,7 +336,7 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData)
    %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @ 
    %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @ 
                            "Asset Type: Shape Asset\n" @ 
                            "Asset Type: Shape Asset\n" @ 
                            "Asset Definition ID: " @  %assetDef @ "\n" @ 
                            "Asset Definition ID: " @  %assetDef @ "\n" @ 
-                           "Shape File path: " @ %assetDef.getShapeFile();
+                           "Shape File path: " @ %assetDef.getShapePath();
                            
                            
    if(%this.selectMode)
    if(%this.selectMode)
    {
    {

+ 17 - 1
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript

@@ -31,6 +31,22 @@ function AssetBrowser::editShapeAnimationAsset(%this, %assetDef)
    ShapeEditorPlugin.openShapeAsset(%assetDef);   
    ShapeEditorPlugin.openShapeAsset(%assetDef);   
 }
 }
 
 
+function AssetBrowser::moveShapeAnimationAsset(%this, %assetDef, %destination)
+{
+   %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
+   
+   %newAssetPath = moveAssetFile(%assetDef, %destination);
+   
+   if(%newAssetPath $= "")
+      return false;
+
+   moveAssetLooseFile(%assetDef.getAnimationPath(), %destination);
+   
+   AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
+   AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
+}
+
 function AssetBrowser::buildShapeAnimationAssetPreview(%this, %assetDef, %previewData)
 function AssetBrowser::buildShapeAnimationAssetPreview(%this, %assetDef, %previewData)
 {
 {
    %previewData.assetName = %assetDef.animationName;
    %previewData.assetName = %assetDef.animationName;
@@ -51,5 +67,5 @@ function AssetBrowser::buildShapeAnimationAssetPreview(%this, %assetDef, %previe
    
    
    %previewData.assetFriendlyName = %assetDef.assetName;
    %previewData.assetFriendlyName = %assetDef.assetName;
    %previewData.assetDesc = %assetDef.description;
    %previewData.assetDesc = %assetDef.description;
-   %previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef @ "\nShape File path: " @ %assetDef.getShapeFile();
+   %previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef @ "\nShape File path: " @ %assetDef.getShapePath();
 }
 }

+ 16 - 0
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript

@@ -11,6 +11,22 @@ function AssetBrowser::onSoundAssetChanged(%this, %assetDef)
         sfxStop($PreviewSoundSource);
         sfxStop($PreviewSoundSource);
 }
 }
 
 
+function AssetBrowser::moveSoundAsset(%this, %assetDef, %destination)
+{
+   %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
+   
+   %newAssetPath = moveAssetFile(%assetDef, %destination);
+   
+   if(%newAssetPath $= "")
+      return false;
+
+   moveAssetLooseFile(%assetDef.getSoundPath(), %destination);
+   
+   AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
+   AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
+}
+
 function AssetBrowser::buildSoundAssetPreview(%this, %assetDef, %previewData)
 function AssetBrowser::buildSoundAssetPreview(%this, %assetDef, %previewData)
 {
 {
    %previewData.assetName = %assetDef.assetName;
    %previewData.assetName = %assetDef.assetName;

+ 16 - 0
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript

@@ -161,6 +161,22 @@ function AssetBrowser::deleteTerrainAsset(%this, %assetDef)
 {
 {
 }
 }
 
 
+function AssetBrowser::moveTerrainAsset(%this, %assetDef, %destination)
+{
+   %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
+   
+   %newAssetPath = moveAssetFile(%assetDef, %destination);
+   
+   if(%newAssetPath $= "")
+      return false;
+
+   moveAssetLooseFile(%assetDef.getTerrainFilePath(), %destination);
+   
+   AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
+   AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
+}
+
 function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData)
 function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData)
 {
 {
    %previewData.assetName = %assetDef.assetName;
    %previewData.assetName = %assetDef.assetName;

+ 42 - 15
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript

@@ -93,8 +93,27 @@ function AssetBrowser::deleteTerrainMaterialAsset(%this, %assetDef)
 {
 {
 }
 }
 
 
-function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previewData)
+function AssetBrowser::moveTerrainMaterialAsset(%this, %assetDef, %destination)
 {
 {
+   %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
+   %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination);
+   
+   %newAssetPath = moveAssetFile(%assetDef, %destination);
+   
+   if(%newAssetPath $= "")
+      return false;
+
+   moveAssetLooseFile(%assetDef.getScriptPath(), %destination);
+   
+   AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
+   AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
+}
+
+function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate)
+{
+   if(%forcePreviewRegenerate $= "")
+      %forcePreviewRegenerate = false;
+      
    %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()))));
    %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()))));
    %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
    %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
 
 
@@ -122,31 +141,35 @@ function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previ
 
 
    %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
    %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
                                    
                                    
-   if(%generatePreview)
+   if(%generatePreview || %forcePreviewRegenerate)
    {
    {
       displayEditorLoadingGui("Generating Material Asset Preview...");
       displayEditorLoadingGui("Generating Material Asset Preview...");
    
    
       if(isObject(%assetDef.materialDefinitionName))
       if(isObject(%assetDef.materialDefinitionName))
       {
       {
          %previewShapeDef = AssetDatabase.acquireAsset("ToolsModule:previewSphereShape");
          %previewShapeDef = AssetDatabase.acquireAsset("ToolsModule:previewSphereShape");
-         %generatedFilePath = %previewShapeDef.generateCachedPreviewImage(256, %assetDef.materialDefinitionName);
+         %generatedFilePath = %previewShapeDef.generateCachedPreviewImage(256, DummyTerrMatPreview);
       
       
          pathCopy(%generatedFilePath, %previewFilePath);
          pathCopy(%generatedFilePath, %previewFilePath);
          fileDelete(%generatedFilePath);
          fileDelete(%generatedFilePath);
 
 
-         %previewAsset = new ImageAsset()
+
+         if(!AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName))
          {
          {
-            assetName = %previewAssetName;
-            versionId = 1;
-            imageFile = fileName(%previewFilePath);
-         };
-         
-         %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
-         %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); 
-         
-         %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
+            %previewAsset = new ImageAsset()
+            {
+               assetName = %previewAssetName;
+               versionId = 1;
+               imageFile = fileName(%previewFilePath);
+            };
             
             
-         %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
+            %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
+            %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); 
+            
+            %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
+               
+            %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
+         }
       }
       }
       
       
       hideEditorLoadingGui();
       hideEditorLoadingGui();
@@ -170,10 +193,14 @@ function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previ
    %previewData.assetDesc = %assetDef.description;
    %previewData.assetDesc = %assetDef.description;
    %previewData.tooltip = %assetDef.gameObjectName;
    %previewData.tooltip = %assetDef.gameObjectName;
    
    
+   %definitionPath = %assetDef.getScriptPath();
+   if(%definitionPath $= "")
+      %definitionPath = %assetDef.getFilename();
+   
    %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ 
    %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ 
                            "\nAsset Type: Terrain Material Asset" @  
                            "\nAsset Type: Terrain Material Asset" @  
                            "\nAsset Definition ID: " @  %assetDef @
                            "\nAsset Definition ID: " @  %assetDef @
-                           "\nDefinition Path: " @ %assetDef.getScriptPath();
+                           "\nDefinition Path: " @ %definitionPath;
 }
 }
 
 
 function GuiInspectorTypeTerrainMaterialAssetPtr::onClick( %this, %fieldName )
 function GuiInspectorTypeTerrainMaterialAssetPtr::onClick( %this, %fieldName )

+ 12 - 0
Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript

@@ -111,7 +111,19 @@ function AssetBrowser::refreshAsset(%this, %assetId)
 }
 }
 
 
 //------------------------------------------------------------
 //------------------------------------------------------------
+function AssetBrowser::regeneratePreviewImage(%this)
+{
+   %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
+   %dummyObj = new ScriptObject();
+   %regenCommand = "AssetBrowser.build" @ EditAssetPopup.assetType @ 
+                     "Preview(" @%assetDef @ "," @ %dummyObj @ ", true);";
+   eval(%regenCommand);
 
 
+   %dummyObj.delete();
+   AssetDatabase.releaseAsset(EditAssetPopup.assetId);
+}
+
+//------------------------------------------------------------
 function AssetBrowser::renameAsset(%this)
 function AssetBrowser::renameAsset(%this)
 {
 {
    //Find out what type it is
    //Find out what type it is

+ 46 - 1
Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript

@@ -139,6 +139,19 @@ function newAssetUpdatePath(%newPath)
    NewAssetTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
    NewAssetTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
 }
 }
 
 
+//
+function NewAssetTargetModule::onSelect(%this, %idx, %idy)
+{
+   %newModuleName = %this.getText();
+   
+   %currentTargetPath = NewAssetTargetAddress.getText();
+   if(!startsWith(%currentTargetPath, "data/" @ %newModuleName @ "/"))
+   {
+      NewAssetTargetAddress.setText("data/" @ %newModuleName @ "/");
+   }
+}
+
+//
 //We do a quick validation that mandatory fields are filled in before passing along to the asset-type specific function
 //We do a quick validation that mandatory fields are filled in before passing along to the asset-type specific function
 function CreateNewAsset()
 function CreateNewAsset()
 {
 {
@@ -172,9 +185,41 @@ function CreateNewAsset()
 		return;
 		return;
 	}
 	}
 	
 	
+	//First, we need to make sure we're not creating a conflicting asset
+	if(AssetDatabase.isDeclaredAsset(%moduleName @ ":" @ %assetName))
+	{
+	   toolsMessageBoxOK( "Error", "An asset with the ID: " @ %moduleName @ ":" @ %assetName 
+	                        @ " already exists! Please review and rename.");
+		return;
+	}
+	
+	%assetType = AssetBrowser.newAssetSettings.assetType;
+	
+	if(%assetType $= "MaterialAsset" || %assetType $= "TerrainMaterialAsset" || 
+	   %assetType $= "GUIAsset")
+	{
+	   if(isObject(%assetName))
+	   {
+         toolsMessageBoxOK( "Error", "Attempted to create a new asset that requires " @
+                                    "a unique name, as the object definition must be unique. " @
+                                    "Please use a new name.");
+         return;
+	   }
+	}
+	
+	%currentTargetPath = NewAssetTargetAddress.getText();
+	%modulePath = makeRelativePath(ModuleDatabase.findModule(%moduleName).ModulePath);
+	
+	if(!startsWith(%currentTargetPath, %modulePath))
+   {
+      toolsMessageBoxOK( "Error", "Attempting to create a new asset in an invalid path. " @ 
+                                    "Please set the target path to be within the target module folder.");
+      return;
+   }
+      
+	
 	AssetBrowser.newAssetSettings.moduleName = %moduleName;
 	AssetBrowser.newAssetSettings.moduleName = %moduleName;
 	
 	
-   %assetType = AssetBrowser.newAssetSettings.assetType;
 	if(%assetType $= "")
 	if(%assetType $= "")
 	{
 	{
 	   toolsMessageBoxOK( "Error", "Attempted to make a new asset with no type!");
 	   toolsMessageBoxOK( "Error", "Attempted to make a new asset with no type!");

+ 6 - 4
Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript

@@ -28,11 +28,13 @@ function AssetBrowser::buildPopupMenus(%this)
          item[ 2 ] = "Reload Asset" TAB "" TAB "AssetBrowser.refreshAsset();";
          item[ 2 ] = "Reload Asset" TAB "" TAB "AssetBrowser.refreshAsset();";
          item[ 3 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();";
          item[ 3 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();";
          item[ 4 ] = "-";
          item[ 4 ] = "-";
-         Item[ 5 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();";
+         item[ 5 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();";
          item[ 6 ] = "-";
          item[ 6 ] = "-";
-         item[ 7 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();";
+         item[ 7 ] = "Regenerate Preview Image" TAB "" TAB "AssetBrowser.regeneratePreviewImage();";
          item[ 8 ] = "-";
          item[ 8 ] = "-";
-         item[ 9 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
+         item[ 9 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();";
+         item[ 10 ] = "-";
+         item[ 11 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
 
 
          jumpFileName = "";
          jumpFileName = "";
          jumpLineNumber = "";
          jumpLineNumber = "";
@@ -182,7 +184,7 @@ function AssetBrowser::buildPopupMenus(%this)
          item[9] = "-";
          item[9] = "-";
          item[10] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
          item[10] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
          item[11] = "-";
          item[11] = "-";
-         item[12] = "Import Loose Files" TAB "" TAB "AssetBrowser.importLooseFiles();";
+         item[12] = "View Loose Files" TAB "" TAB "AssetBrowser.importLooseFiles();";
       
       
       };
       };
    }
    }

+ 1 - 1
Templates/BaseGame/game/tools/forestEditor/forestEditToolbar.ed.gui

@@ -110,7 +110,7 @@ $guiContent = new GuiControl(ForestEditToolbar,EditorGuiGroup) {
             MinExtent = "8 16";
             MinExtent = "8 16";
             canSave = "1";
             canSave = "1";
             Visible = "1";
             Visible = "1";
-            AltCommand = "ForestTools->BrushTool.size = $ThisControl.getValue();";
+            AltCommand = "ForestTools->BrushTool.size = mClamp($ThisControl.getValue(), 1, getWord(ETerrainEditor.maxBrushSize, 0));";
             validate = "ForestEditorGui.validateBrushSize();";
             validate = "ForestEditorGui.validateBrushSize();";
             tooltipprofile = "ToolsGuiToolTipProfile";
             tooltipprofile = "ToolsGuiToolTipProfile";
             hovertime = "1000";
             hovertime = "1000";

+ 1 - 1
Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript

@@ -220,7 +220,7 @@ function selectNewForestMesh(%selectedShapeAssetId)
    //%str = "datablock TSForestItemData( " @ %name @ " ) { shapeFile = \"" @ %fullPath @ "\"; };";            
    //%str = "datablock TSForestItemData( " @ %name @ " ) { shapeFile = \"" @ %fullPath @ "\"; };";            
    //eval( %str );
    //eval( %str );
    
    
-   //%fullPath = AssetDatabase.acquireAsset(%selectedShapeAssetId).getShapeFile();
+   //%fullPath = AssetDatabase.acquireAsset(%selectedShapeAssetId).getShapePath();
    
    
    new TSForestItemData(%name) {
    new TSForestItemData(%name) {
       shapeAsset = %selectedShapeAssetId;
       shapeAsset = %selectedShapeAssetId;

+ 1 - 1
Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript

@@ -300,7 +300,7 @@ function ESettingsWindow::getGeneralSettings(%this)
    SettingsInspector.endGroup();
    SettingsInspector.endGroup();
    
    
    SettingsInspector.startGroup("Paths");
    SettingsInspector.startGroup("Paths");
-   SettingsInspector.addSettingsField("WorldEditor/torsionPath", "Torsion Path", "filename", "");
+   //SettingsInspector.addSettingsField("WorldEditor/torsionPath", "Torsion Path", "filename", "");
    SettingsInspector.endGroup();
    SettingsInspector.endGroup();
    
    
    SettingsInspector.startGroup("Theme");
    SettingsInspector.startGroup("Theme");

BIN
Templates/BaseGame/game/tools/gui/images/tab_border.png


+ 6 - 2
Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript

@@ -254,9 +254,13 @@ function GuiEditCanvas::onWindowClose(%this)
 
 
 function GuiEditCanvas::create( %this )
 function GuiEditCanvas::create( %this )
 {
 {
-   GuiEditorNewGuiDialog.init( "NewGui", "GuiControl" );
+   AssetBrowser.setupCreateNewAsset("GUIAsset", AssetBrowser.selectedModule, "GuiEditCanvas.finishCreateNewGUI");
+}
       
       
-   Canvas.pushDialog( GuiEditorNewGuiDialog );
+function GuiEditCanvas::finishCreateNewGUI(%this, %newGUIAssetId)
+{
+   %assetDef = AssetDatabase.acquireAsset(%newGUIAssetId);
+   AssetBrowser.editAsset(%assetDef);
 }
 }
 
 
 //---------------------------------------------------------------------------------------------
 //---------------------------------------------------------------------------------------------

+ 1 - 0
Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui

@@ -4445,6 +4445,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
                         VertSizing = "bottom";
                         VertSizing = "bottom";
                         Position = "0 95";
                         Position = "0 95";
                         Extent = "212 25";
                         Extent = "212 25";
+                        visible = "0";
                         
                         
                         new GuiBitmapCtrl(){
                         new GuiBitmapCtrl(){
                            position="2 2";
                            position="2 2";

+ 28 - 14
Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript

@@ -38,25 +38,34 @@ function MaterialEditorGui::establishMaterials(%this)
    };
    };
    
    
    //Material used to preview other materials in the editor.
    //Material used to preview other materials in the editor.
-   singleton Material(materialEd_previewMaterial)
+   if(!isObject(materialEd_previewMaterial))
    {
    {
-      mapTo = "matEd_mappedMat";
-      diffuseMapAsset[0] = "ToolsModule:matEd_mappedMat_image";
-   };
+      singleton Material(materialEd_previewMaterial)
+      {
+         mapTo = "matEd_mappedMat";
+         diffuseMapAsset[0] = "ToolsModule:matEd_mappedMat_image";
+      };
+   }
 
 
-   singleton CustomMaterial( materialEd_justAlphaMaterial )
+   if(!isObject(materialEd_previewMaterial))
    {
    {
-      mapTo = "matEd_mappedMatB";
-      texture[0] = materialEd_previewMaterial.getdiffuseMap(0);
-   };
+      singleton CustomMaterial( materialEd_justAlphaMaterial )
+      {
+         mapTo = "matEd_mappedMatB";
+         texture[0] = materialEd_previewMaterial.getdiffuseMap(0);
+      };
+   }
 
 
-   //Custom shader to allow the display of just the alpha channel. 
-   singleton ShaderData( materialEd_justAlphaShader )
+   if(!isObject(materialEd_previewMaterial))
    {
    {
-      DXVertexShaderFile 	= "shaders/alphaOnlyV.hlsl";
-      DXPixelShaderFile 	= "shaders/alphaOnlyP.hlsl";
-      pixVersion = 1.0;
-   };
+      //Custom shader to allow the display of just the alpha channel. 
+      singleton ShaderData( materialEd_justAlphaShader )
+      {
+         DXVertexShaderFile 	= "shaders/alphaOnlyV.hlsl";
+         DXPixelShaderFile 	= "shaders/alphaOnlyP.hlsl";
+         pixVersion = 1.0;
+      };
+   }
 }
 }
 
 
 function MaterialEditorGui::open(%this)
 function MaterialEditorGui::open(%this)
@@ -843,6 +852,11 @@ function MaterialEditorGui::guiSync( %this, %material )
       MaterialEditorPropertiesWindow-->isSRGBCheckbox.setValue((%material).isSRGB[%layer]);
       MaterialEditorPropertiesWindow-->isSRGBCheckbox.setValue((%material).isSRGB[%layer]);
       MaterialEditorPropertiesWindow-->invertRoughnessCheckbox.setValue((%material).invertRoughness[%layer]);
       MaterialEditorPropertiesWindow-->invertRoughnessCheckbox.setValue((%material).invertRoughness[%layer]);
    }
    }
+   else
+   {
+      MaterialEditorPropertiesWindow-->RoughnessSlider.setValue((%material).roughness, true);
+      MaterialEditorPropertiesWindow-->MetalnessSlider.setValue((%material).metalness, true);
+   }
       
       
    MaterialEditorPropertiesWindow-->isSRGBCheckbox.setVisible(%hasOrmMap);
    MaterialEditorPropertiesWindow-->isSRGBCheckbox.setVisible(%hasOrmMap);
    MaterialEditorPropertiesWindow-->invertRoughnessCheckbox.setVisible(%hasOrmMap);
    MaterialEditorPropertiesWindow-->invertRoughnessCheckbox.setVisible(%hasOrmMap);

+ 1 - 1
Templates/BaseGame/game/tools/resources/ReflectProbePreviewMat.asset.taml

@@ -9,7 +9,7 @@
         mapTo="ReflectProbePreviewMat">
         mapTo="ReflectProbePreviewMat">
         <Material.Stages>
         <Material.Stages>
             <Stages_beginarray
             <Stages_beginarray
-                DiffuseMapAsset="ToolsModule:occluderProxyImage_image"
+                DiffuseMapAsset="Core_Rendering:NoMaterial"
                 diffuseColor="1 1 1 1"
                 diffuseColor="1 1 1 1"
                 roughness="0"
                 roughness="0"
                 metalness="1"/>
                 metalness="1"/>

+ 2 - 0
Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui

@@ -164,6 +164,7 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow, EditorGuiGroup) {
                   hovertime = "500";
                   hovertime = "500";
                   isContainer = true;
                   isContainer = true;
                   internalName = "levelsInactive";
                   internalName = "levelsInactive";
+                  color = "128 128 128 255";
                };
                };
                new GuiTextCtrl() {
                new GuiTextCtrl() {
                   text = "0";
                   text = "0";
@@ -691,6 +692,7 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow, EditorGuiGroup) {
                };
                };
                new GuiBitmapCtrl(){
                new GuiBitmapCtrl(){
                   bitmapAsset = "ToolsModule:inactive_overlay_image";
                   bitmapAsset = "ToolsModule:inactive_overlay_image";
+                  color = "128 128 128 255";
                   position = "4 18";
                   position = "4 18";
                   Extent = "193 64";
                   Extent = "193 64";
                   tooltip = "Imposters must be enabled, and an imposter detail level selected to edit these properties";
                   tooltip = "Imposters must be enabled, and an imposter detail level selected to edit these properties";

+ 3 - 3
Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript

@@ -1784,7 +1784,7 @@ function ShapeEdSeqFromMenu::onBrowseSelect( %this, %assetId )
    %this.setText( %assetId );
    %this.setText( %assetId );
    
    
    %assetDef = AssetDatabase.acquireAsset(%assetId);
    %assetDef = AssetDatabase.acquireAsset(%assetId);
-   %shapePath = %assetDef.getShapeFile();
+   %shapePath = %assetDef.getShapePath();
    AssetDatabase.releaseAsset(%assetId);
    AssetDatabase.releaseAsset(%assetId);
    
    
    ShapeEdSequences.onEditSequenceSource( %shapePath );
    ShapeEdSequences.onEditSequenceSource( %shapePath );
@@ -3010,7 +3010,7 @@ function ShapeEditor::autoAddDetails( %this, %dest )
    // Determine the base name of the input file (MyShape_LOD in the example above)
    // Determine the base name of the input file (MyShape_LOD in the example above)
    // and use that to find any other shapes in the set.
    // and use that to find any other shapes in the set.
    %assetDef = AssetDatabase.acquireAsset(%dest.baseShapeAsset);
    %assetDef = AssetDatabase.acquireAsset(%dest.baseShapeAsset);
-   %shapeFile = %assetDef.getShapeFile();
+   %shapeFile = %assetDef.getShapePath();
    AssetDatabase.releaseAsset(%dest.baseShapeAsset);
    AssetDatabase.releaseAsset(%dest.baseShapeAsset);
    
    
    %base = fileBase( %shapeFile );
    %base = fileBase( %shapeFile );
@@ -3058,7 +3058,7 @@ function ShapeEditor::addLODFromFile( %this, %dest, %assetId, %size, %allowUnmat
 {
 {
    %assetDef = AssetDatabase.acquireAsset(%assetId);
    %assetDef = AssetDatabase.acquireAsset(%assetId);
    %csPath = %assetDef.getShapeConstructorFilePath();
    %csPath = %assetDef.getShapeConstructorFilePath();
-   %filename = %assetDef.getShapeFile();
+   %filename = %assetDef.getShapePath();
    AssetDatabase.releaseAsset(%assetId);
    AssetDatabase.releaseAsset(%assetId);
    
    
    // Get (or create) a TSShapeConstructor object for the source shape. Need to
    // Get (or create) a TSShapeConstructor object for the source shape. Need to

+ 1 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript

@@ -82,6 +82,7 @@ function ObjectCreator::setNewObjectGroup( %this, %group )
    %group = %group.getID();
    %group = %group.getID();
    %this.objectGroup = %group;
    %this.objectGroup = %group;
    %itemId = EditorTree.findItemByObjectId( %group );
    %itemId = EditorTree.findItemByObjectId( %group );
+   if(%itemId != -1)
    EditorTree.markItem( %itemId );
    EditorTree.markItem( %itemId );
 }
 }
 
 

+ 2 - 2
Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript

@@ -136,7 +136,7 @@ function EPainter::updateLayers( %this, %matIndex )
             VertSizing = "bottom";
             VertSizing = "bottom";
             position = ( %listwidth - 20 ) SPC "26";
             position = ( %listwidth - 20 ) SPC "26";
             Extent = "17 17";
             Extent = "17 17";
-            command = "EPainter.showMaterialDeleteDlg( " @ %matInternalName @ " );";
+            command = "EPainter.showMaterialDeleteDlg( \"" @ %matInternalName @ "\" );";
          };
          };
       };
       };
 
 
@@ -193,7 +193,7 @@ function EPainter::showMaterialDeleteDlg( %this, %matInternalName )
 {
 {
    toolsMessageBoxYesNo( "Confirmation",
    toolsMessageBoxYesNo( "Confirmation",
       "Really remove material '" @ %matInternalName @ "' from the terrain?",
       "Really remove material '" @ %matInternalName @ "' from the terrain?",
-      %this @ ".removeMaterial( " @ %matInternalName @ " );", "" );
+      %this @ ".removeMaterial( \"" @ %matInternalName @ "\" );", "" );
 }
 }
 
 
 function EPainter::removeMaterial( %this, %matInternalName )
 function EPainter::removeMaterial( %this, %matInternalName )