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

This commit is contained in:
Areloch 2019-10-05 01:16:14 -05:00
parent 28c4bad74d
commit 3bc8401947
3 changed files with 34 additions and 8 deletions

View file

@ -419,9 +419,15 @@ function ImportOptionsConfigList::changeEditorSetting(%this, %varName, %value)
%configGroup = AssetImportConfigName.getText(); %configGroup = AssetImportConfigName.getText();
%oldValue = AssetImportSettings.value(%configGroup @ "/" @ %varName, %value);
AssetImportSettings.setValue(%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) function ImportOptionsConfigList::ToggleImportMesh(%this, %fieldName, %newValue, %ownerObject)

View file

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

View file

@ -131,7 +131,7 @@ function EditorOpenTorsionProject( %projectFile )
{ {
MessageBoxOK( MessageBoxOK(
"Torsion Not Found", "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; return;
} }
@ -170,7 +170,7 @@ function EditorOpenFileInTorsion( %file, %line )
{ {
MessageBoxOK( MessageBoxOK(
"Torsion Not Found", "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; return;
} }