Misc fixes to ensure that the default postFX save, load and editing process is valid

Also fixes it so if a level asset doesn't point to a valid postfx preset file, it'll generate a clean one on save
This commit is contained in:
Areloch 2020-11-01 15:39:30 -06:00
parent 302a64edd1
commit 9ca276fef0
9 changed files with 63 additions and 114 deletions

View file

@ -134,6 +134,7 @@ function editScenePostEffects(%scene)
function PostFXEditorNewPFXWindow::showDialog(%this)
{
%this.setHidden(false);
PostFXEditorNewPFXWindow.selectWindow();
PostFXEditorNewPFXList.clear();

View file

@ -115,10 +115,9 @@
active = "1";
command = "PostFXEditorNewPFXWindow.showDialog();";
tooltipProfile = "GuiToolTipProfile";
tooltip = "Add a new Import Config";
tooltip = "Add a new PostFX";
hovertime = "1000";
isContainer = "0";
internalName = "newImportConfig";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -142,10 +141,9 @@
active = "1";
command = "PostFXEditor.removePostFX();";
tooltipProfile = "GuiToolTipProfile";
tooltip = "Delets the currently selected import config";
tooltip = "Delets the currently selected PostFX";
hovertime = "1000";
isContainer = "0";
internalName = "deleteImportConfig";
canSave = "1";
canSaveDynamicFields = "0";
};

View file

@ -332,8 +332,22 @@ function EditorSaveMission()
%obj.onSaveMission( $Server::MissionFile );
}
//We'll sanity check that we have a valid file association to our level asset first
%presetFile = $Server::LevelAsset.getPostFXPresetPath();
if(!isFile(%presetFile))
{
//if it isn't valid, we'll fabricate a new one just to be sure
$Server::LevelAsset.PostFXPresetFile = fileBase($Server::LevelAsset.getLevelPath()) @ $PostFXManager::fileExtension;
$Server::LevelAsset.saveAsset();
$Server::LevelAsset.refresh();
%presetFile = $Server::LevelAsset.getPostFXPresetPath();
}
//Save out the PostFX config
PostFXManager::savePresetHandler( $Server::LevelAsset.getPostFXPresetPath() );
PostFXManager::savePresetHandler( %presetFile );
EditorClearDirty();

View file

@ -208,7 +208,7 @@ function EditorGui::buildMenus(%this)
item[14] = "Snap Options..." TAB "" TAB "ESnapOptions.ToggleVisibility();";
item[15] = "-";
item[16] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);";
item[17] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXEditor);";
item[17] = "Edit Default PostFX Config" TAB "" TAB "PostFXEditor.editDefaultPostFXSettings();";
};
%this.menuBar.insert(%editMenu);