Browse Source

Add proper refreshing of fields in the Project and Editor settings editors.

Areloch 6 years ago
parent
commit
782ab7b73a

+ 7 - 1
Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs

@@ -419,9 +419,15 @@ function ImportOptionsConfigList::changeEditorSetting(%this, %varName, %value)
    
    %configGroup = AssetImportConfigName.getText();
    
+   %oldValue = AssetImportSettings.value(%configGroup @ "/" @ %varName, %value);
+   
    AssetImportSettings.setValue(%configGroup @ "/" @ %varName, %value);
    
-   //%success = AssetImportSettings.write();
+   if(%oldValue !$= %value)
+   {
+      %id = %this.getSelectedRow();
+      %this.setSelectedRow(%id);  
+   }
 }
 
 function ImportOptionsConfigList::ToggleImportMesh(%this, %fieldName, %newValue, %ownerObject)

+ 25 - 5
Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs

@@ -118,6 +118,18 @@ function ESettingsWindow::addGameSettingsPage(%this, %settingsPageName, %setting
    GameSettingsPageList.add(%settingsPageName, %settingsPageText);
 }
 
+function ESettingsWindow::refresh(%this)
+{
+   if(ESettingsWindow.selectedPageId !$= "")
+   {
+      ESettingsWindowList.setSelectedById( ESettingsWindow.selectedPageId );  
+   }
+   else
+   {
+      ESettingsWindowList.setSelectedById( 1 );  
+   }
+}
+
 //-----------------------------------------------------------------------------
 
 function ESettingsWindowList::onSelect( %this, %id, %text )
@@ -130,6 +142,9 @@ function ESettingsWindowList::onSelect( %this, %id, %text )
       %pageName = GameSettingsPageList.getKey(GameSettingsPageList.getIndexFromValue(%text));
       
    eval("ESettingsWindow.get" @ %pageName @ "Settings();");
+   
+   ESettingsWindow.selectedPageId = %id;
+   ESettingsWindow.selectedPageText = %text;
 }
 
 //Read/write field functions
@@ -147,25 +162,30 @@ function SettingsInspector::changeEditorSetting(%this, %varName, %value)
 {
    %varName = strreplace(%varName, "-", "/");
    
-   if(isFile(%value) || IsDirectory(%value))
+   if(%value !$= "" && (fileExt(%value) !$= "" || IsDirectory(%value)))
    {
       %value = makeFullPath(%value);
    }
    
-   echo("Set " @ %varName @ " to be " @ %value);  
+   //echo("Set " @ %varName @ " to be " @ %value);  
+   
+   if(ESettingsWindow.mode $= "Editor")
+      %oldValue = EditorSettings.value(%varName);
+   else
+      %oldValue = ProjectSettings.value(%varName);
    
    if(ESettingsWindow.mode $= "Editor")
       EditorSettings.setValue(%varName, %value);
    else
       ProjectSettings.setValue(%varName, %value);
    
-   //%id = ESettingsWindowList.getSelectedRow();
-   //ESettingsWindowList.setSelectedRow(%id);
-   
    if(ESettingsWindow.mode $= "Editor")
       %success = EditorSettings.write();
    else
       %success = ProjectSettings.write();
+      
+   if(%oldValue !$= %value)
+      ESettingsWindow.refresh();
 }
 
 function GuiInspectorVariableGroup::buildOptionsSettingField(%this, %fieldName, %fieldLabel, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %ownerObj)

+ 2 - 2
Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs

@@ -131,7 +131,7 @@ function EditorOpenTorsionProject( %projectFile )
    {
       MessageBoxOK(
          "Torsion Not Found",
-         "Torsion not found at '" @ %torsionPath @ "'.  Please set the correct path in the preferences."
+         "Torsion not found at '" @ %torsionPath @ "'.  Please set the correct path in the Editor Settings."
       );
       return;
    }
@@ -170,7 +170,7 @@ function EditorOpenFileInTorsion( %file, %line )
    {
       MessageBoxOK(
          "Torsion Not Found",
-         "Torsion not found at '" @ %torsionPath @ "'.  Please set the correct path in the preferences."
+         "Torsion not found at '" @ %torsionPath @ "'.  Please set the correct path in the Editor Settings."
       );
       return;
    }