mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
Merge pull request #374 from Areloch/PostFXSaveLoadEditFixup
Misc fixes to ensure that the default postFX save, load and editing process is valid
This commit is contained in:
commit
036c7c2c75
9 changed files with 63 additions and 114 deletions
|
|
@ -41,29 +41,33 @@ DefineEngineMethod(AssetBase, getAssetId, String, (), ,
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(AssetBase, getAssetDependencyFieldCount, S32, (const char* pFieldName), (""),
|
DefineEngineMethod(AssetBase, getAssetDependencyFieldCount, S32, (const char* pFieldName), (""),
|
||||||
"Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.\n"
|
"Gets the number of asset dependencies of a given field name.\n"
|
||||||
"@return The assets' Asset Id.\n")
|
"eg. Would return '2' if you searched for 'myDependencyField'\n"
|
||||||
|
"and the asset had myDependencyField0 and myDependencyField1\n"
|
||||||
|
"@param fieldName The name of the field to get a count of\n"
|
||||||
|
"@return The number of dependency fields matching the search name.\n")
|
||||||
{
|
{
|
||||||
return object->getAssetDependencyFieldCount(pFieldName);
|
return object->getAssetDependencyFieldCount(pFieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(AssetBase, clearAssetDependencyFields, void, (const char* pFieldName), (""),
|
DefineEngineMethod(AssetBase, clearAssetDependencyFields, void, (const char* pFieldName), (""),
|
||||||
"Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.\n"
|
"Clears any asset dependency fields matching the name provided.\n"
|
||||||
"@return The assets' Asset Id.\n")
|
"@param fieldName The name of the fields to be cleared")
|
||||||
{
|
{
|
||||||
object->clearAssetDependencyFields(pFieldName);
|
object->clearAssetDependencyFields(pFieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(AssetBase, addAssetDependencyField, void, (const char* pFieldName, const char* pAssetId), ("", ""),
|
DefineEngineMethod(AssetBase, addAssetDependencyField, void, (const char* pFieldName, const char* pAssetId), ("", ""),
|
||||||
"Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.\n"
|
"Adds an asset dependency field to the asset definition.\n"
|
||||||
"@return The assets' Asset Id.\n")
|
"@param fieldName The name of the field. Will automatically increment the tailing number if the field is used multiple times\n"
|
||||||
|
"@param assetId The assetId to be marked as a dependency")
|
||||||
{
|
{
|
||||||
object->addAssetDependencyField(pFieldName, pAssetId);
|
object->addAssetDependencyField(pFieldName, pAssetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(AssetBase, saveAsset, bool, (), ,
|
DefineEngineMethod(AssetBase, saveAsset, bool, (), ,
|
||||||
"Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.\n"
|
"Saves the asset definition.\n"
|
||||||
"@return The assets' Asset Id.\n")
|
"@return Whether the save was successful.\n")
|
||||||
{
|
{
|
||||||
return object->saveAsset();
|
return object->saveAsset();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,28 +5,8 @@ function Core_PostFX::onCreate(%this)
|
||||||
exec("./scripts/postFxManager.cs");
|
exec("./scripts/postFxManager.cs");
|
||||||
exec("./scripts/postFx.cs");
|
exec("./scripts/postFx.cs");
|
||||||
|
|
||||||
/*exec("./scripts/postFxManager.gui.settings.cs");
|
//Load the default config
|
||||||
exec("./scripts/postFxManager.persistance.cs");
|
loadPresetHandler("./scripts/default.postfxpreset.cs");
|
||||||
|
|
||||||
exec("./scripts/default.postfxpreset.cs");
|
|
||||||
|
|
||||||
exec("./scripts/caustics.cs");
|
|
||||||
exec("./scripts/chromaticLens.cs");
|
|
||||||
exec("./scripts/dof.cs");
|
|
||||||
exec("./scripts/edgeAA.cs");
|
|
||||||
exec("./scripts/flash.cs");
|
|
||||||
exec("./scripts/fog.cs");
|
|
||||||
exec("./scripts/fxaa.cs");
|
|
||||||
exec("./scripts/GammaPostFX.cs");
|
|
||||||
exec("./scripts/glow.cs");
|
|
||||||
exec("./scripts/hdr.cs");
|
|
||||||
exec("./scripts/lightRay.cs");
|
|
||||||
exec("./scripts/MLAA.cs");
|
|
||||||
exec("./scripts/MotionBlurFx.cs");
|
|
||||||
exec("./scripts/ovrBarrelDistortion.cs");
|
|
||||||
exec("./scripts/ssao.cs");
|
|
||||||
exec("./scripts/turbulence.cs");
|
|
||||||
exec("./scripts/vignette.cs");*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Core_PostFX::onDestroy(%this)
|
function Core_PostFX::onDestroy(%this)
|
||||||
|
|
|
||||||
|
|
@ -341,9 +341,6 @@ function HDRPostFX::onAdd( %this )
|
||||||
{
|
{
|
||||||
PostFXManager.registerPostEffect(%this);
|
PostFXManager.registerPostEffect(%this);
|
||||||
|
|
||||||
//HDR should really be on at all times
|
|
||||||
//%this.enable();
|
|
||||||
|
|
||||||
$PostFX::HDRPostFX::enableToneMapping = 1;
|
$PostFX::HDRPostFX::enableToneMapping = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -356,7 +353,6 @@ function HDRPostFX::populatePostFXSettings(%this)
|
||||||
PostEffectEditorInspector.addCallbackField("$PostFX::HDRPostFX::Enabled", "Enabled", "bool", "", $PostFX::HDRPostFX::Enabled, "", "toggleHDRPostFX");
|
PostEffectEditorInspector.addCallbackField("$PostFX::HDRPostFX::Enabled", "Enabled", "bool", "", $PostFX::HDRPostFX::Enabled, "", "toggleHDRPostFX");
|
||||||
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::minLuminace", "Minimum Luminance", "range", "", $PostFX::HDRPostFX::minLuminace, "0 1 100");
|
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::minLuminace", "Minimum Luminance", "range", "", $PostFX::HDRPostFX::minLuminace, "0 1 100");
|
||||||
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::whiteCutoff", "White Cutoff", "range", "", $PostFX::HDRPostFX::whiteCutoff, "0 10 20");
|
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::whiteCutoff", "White Cutoff", "range", "", $PostFX::HDRPostFX::whiteCutoff, "0 10 20");
|
||||||
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::adaptRate", "Brightness Adapt Rate", "range", "", $PostFX::HDRPostFX::adaptRate, "0 1 10");
|
|
||||||
PostEffectEditorInspector.endGroup();
|
PostEffectEditorInspector.endGroup();
|
||||||
|
|
||||||
PostEffectEditorInspector.startGroup("HDR - Tonemapping");
|
PostEffectEditorInspector.startGroup("HDR - Tonemapping");
|
||||||
|
|
@ -373,6 +369,7 @@ function HDRPostFX::populatePostFXSettings(%this)
|
||||||
|
|
||||||
PostEffectEditorInspector.startGroup("HDR - Adaptation");
|
PostEffectEditorInspector.startGroup("HDR - Adaptation");
|
||||||
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::enableAutoExposure", "Enable Auto Exposure", "bool", "", $PostFX::HDRPostFX::enableAutoExposure, "");
|
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::enableAutoExposure", "Enable Auto Exposure", "bool", "", $PostFX::HDRPostFX::enableAutoExposure, "");
|
||||||
|
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::adaptRate", "Brightness Adapt Rate", "range", "", $PostFX::HDRPostFX::adaptRate, "0 1 10");
|
||||||
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::keyValue", "Key Value", "range", "", $PostFX::HDRPostFX::keyValue, "0 1 10");
|
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::keyValue", "Key Value", "range", "", $PostFX::HDRPostFX::keyValue, "0 1 10");
|
||||||
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::enableBlueShift", "Enable Blue Shift", "bool", "", $PostFX::HDRPostFX::enableBlueShift, "");
|
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::enableBlueShift", "Enable Blue Shift", "bool", "", $PostFX::HDRPostFX::enableBlueShift, "");
|
||||||
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::blueShiftColor", "Blue Shift Color", "colorF", "", $PostFX::HDRPostFX::blueShiftColor, "");
|
PostEffectEditorInspector.addField("$PostFX::HDRPostFX::blueShiftColor", "Blue Shift Color", "colorF", "", $PostFX::HDRPostFX::blueShiftColor, "");
|
||||||
|
|
|
||||||
|
|
@ -1,72 +1,14 @@
|
||||||
//-----------------------------------------------------------------------------
|
$PostFX::HDRPostFX::Enabled = 1;
|
||||||
// Copyright (c) 2012 GarageGames, LLC
|
$PostFX::HDRPostFX::minLuminace = 0.001;
|
||||||
//
|
$PostFX::HDRPostFX::whiteCutoff = 1;
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
$PostFX::HDRPostFX::adaptRate = 2;
|
||||||
// of this software and associated documentation files (the "Software"), to
|
$PostFX::HDRPostFX::tonemapMode = "ACES";
|
||||||
// deal in the Software without restriction, including without limitation the
|
$PostFX::HDRPostFX::enableBloom = 1;
|
||||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
$PostFX::HDRPostFX::brightPassThreshold = 1;
|
||||||
// sell copies of the Software, and to permit persons to whom the Software is
|
$PostFX::HDRPostFX::gaussMultiplier = 0.3;
|
||||||
// furnished to do so, subject to the following conditions:
|
$PostFX::HDRPostFX::gaussMean = 0;
|
||||||
//
|
$PostFX::HDRPostFX::gaussStdDev = 0.8;
|
||||||
// The above copyright notice and this permission notice shall be included in
|
$PostFX::HDRPostFX::enableAutoExposure = "0";
|
||||||
// all copies or substantial portions of the Software.
|
$PostFX::HDRPostFX::keyValue = 0.18;
|
||||||
//
|
$PostFX::HDRPostFX::enableBlueShift = 0;
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
$PostFX::HDRPostFX::blueShiftColor = "1.05 0.97 1.27";
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
||||||
// IN THE SOFTWARE.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
$PostFXManager::Settings::EnableVignette = "1";
|
|
||||||
$PostFXManager::Settings::EnableDOF = "1";
|
|
||||||
$PostFXManager::Settings::EnabledSSAO = "1";
|
|
||||||
$PostFXManager::Settings::EnableHDR = "1";
|
|
||||||
$PostFXManager::Settings::EnableLightRays = "1";
|
|
||||||
$PostFXManager::Settings::EnablePostFX = "1";
|
|
||||||
$PostFXManager::Settings::Vignette::VMax = "0.6";
|
|
||||||
$PostFXManager::Settings::DOF::BlurCurveFar = "";
|
|
||||||
$PostFXManager::Settings::DOF::BlurCurveNear = "";
|
|
||||||
$PostFXManager::Settings::DOF::BlurMax = "";
|
|
||||||
$PostFXManager::Settings::DOF::BlurMin = "";
|
|
||||||
$PostFXManager::Settings::DOF::EnableAutoFocus = "";
|
|
||||||
$PostFXManager::Settings::DOF::EnableDOF = "";
|
|
||||||
$PostFXManager::Settings::DOF::FocusRangeMax = "";
|
|
||||||
$PostFXManager::Settings::DOF::FocusRangeMin = "";
|
|
||||||
$PostFXManager::Settings::HDR::adaptRate = "2";
|
|
||||||
$PostFXManager::Settings::HDR::blueShiftColor = "1.05 0.97 1.27";
|
|
||||||
$PostFXManager::Settings::HDR::brightPassThreshold = "1";
|
|
||||||
$PostFXManager::Settings::HDR::enableBloom = "1";
|
|
||||||
$PostFXManager::Settings::HDR::enableBlueShift = "0";
|
|
||||||
$PostFXManager::Settings::HDR::enableToneMapping = "0.5";
|
|
||||||
$PostFXManager::Settings::HDR::gaussMean = "0";
|
|
||||||
$PostFXManager::Settings::HDR::gaussMultiplier = "0.3";
|
|
||||||
$PostFXManager::Settings::HDR::gaussStdDev = "0.8";
|
|
||||||
$PostFXManager::Settings::HDR::keyValue = "0.18";
|
|
||||||
$PostFXManager::Settings::HDR::minLuminace = "0.001";
|
|
||||||
$PostFXManager::Settings::HDR::whiteCutoff = "1";
|
|
||||||
$PostFXManager::Settings::LightRays::brightScalar = "0.75";
|
|
||||||
$PostFXManager::Settings::LightRays::decay = "1.0";
|
|
||||||
$PostFXManager::Settings::LightRays::density = "0.94";
|
|
||||||
$PostFXManager::Settings::LightRays::numSamples = "40";
|
|
||||||
$PostFXManager::Settings::LightRays::weight = "5.65";
|
|
||||||
$PostFXManager::Settings::SSAO::blurDepthTol = "0.001";
|
|
||||||
$PostFXManager::Settings::SSAO::blurNormalTol = "0.95";
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthMax = "2";
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthMin = "0.2";
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthPow = "0.2";
|
|
||||||
$PostFXManager::Settings::SSAO::lNormalPow = "2";
|
|
||||||
$PostFXManager::Settings::SSAO::lNormalTol = "-0.5";
|
|
||||||
$PostFXManager::Settings::SSAO::lRadius = "1";
|
|
||||||
$PostFXManager::Settings::SSAO::lStrength = "10";
|
|
||||||
$PostFXManager::Settings::SSAO::overallStrength = "2";
|
|
||||||
$PostFXManager::Settings::SSAO::quality = "0";
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthMax = "1";
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthMin = "0.1";
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthPow = "1";
|
|
||||||
$PostFXManager::Settings::SSAO::sNormalPow = "1";
|
|
||||||
$PostFXManager::Settings::SSAO::sNormalTol = "0";
|
|
||||||
$PostFXManager::Settings::SSAO::sRadius = "0.1";
|
|
||||||
$PostFXManager::Settings::SSAO::sStrength = "6";
|
|
||||||
$PostFXManager::Settings::ColorCorrectionRamp = "core/postFX/images/null_color_ramp.png";
|
|
||||||
|
|
|
||||||
|
|
@ -103,13 +103,26 @@ function PostFXManager::savePresetHandler( %filename )
|
||||||
|
|
||||||
$PostFXManager::currentPresetFile = %filename;
|
$PostFXManager::currentPresetFile = %filename;
|
||||||
$PostFXManager::startedPresetFileSave = false;
|
$PostFXManager::startedPresetFileSave = false;
|
||||||
|
|
||||||
|
//First, clear the existing file
|
||||||
|
%fileObj = new FileObject();
|
||||||
|
if (!%fileObj.openForWrite($PostFXManager::currentPresetFile))
|
||||||
|
{
|
||||||
|
%fileObj.delete();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
%fileObj.writeLine("");
|
||||||
|
%fileObj.close();
|
||||||
|
%fileObj.delete();
|
||||||
|
}
|
||||||
|
|
||||||
%count = PostFXManager.Count();
|
%count = PostFXManager.Count();
|
||||||
for(%i=0; %i < %count; %i++)
|
for(%i=0; %i < %count; %i++)
|
||||||
{
|
{
|
||||||
%postEffect = PostFXManager.getKey(%i);
|
%postEffect = PostFXManager.getKey(%i);
|
||||||
|
|
||||||
if(isObject(%postEffect) && %postEffect.isMethod("savePresetSettings"))
|
if(isObject(%postEffect) && %postEffect.isEnabled && %postEffect.isMethod("savePresetSettings"))
|
||||||
{
|
{
|
||||||
%postEffect.savePresetSettings();
|
%postEffect.savePresetSettings();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ function editScenePostEffects(%scene)
|
||||||
function PostFXEditorNewPFXWindow::showDialog(%this)
|
function PostFXEditorNewPFXWindow::showDialog(%this)
|
||||||
{
|
{
|
||||||
%this.setHidden(false);
|
%this.setHidden(false);
|
||||||
|
PostFXEditorNewPFXWindow.selectWindow();
|
||||||
|
|
||||||
PostFXEditorNewPFXList.clear();
|
PostFXEditorNewPFXList.clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,10 +115,9 @@
|
||||||
active = "1";
|
active = "1";
|
||||||
command = "PostFXEditorNewPFXWindow.showDialog();";
|
command = "PostFXEditorNewPFXWindow.showDialog();";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
tooltip = "Add a new Import Config";
|
tooltip = "Add a new PostFX";
|
||||||
hovertime = "1000";
|
hovertime = "1000";
|
||||||
isContainer = "0";
|
isContainer = "0";
|
||||||
internalName = "newImportConfig";
|
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
};
|
};
|
||||||
|
|
@ -142,10 +141,9 @@
|
||||||
active = "1";
|
active = "1";
|
||||||
command = "PostFXEditor.removePostFX();";
|
command = "PostFXEditor.removePostFX();";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
tooltip = "Delets the currently selected import config";
|
tooltip = "Delets the currently selected PostFX";
|
||||||
hovertime = "1000";
|
hovertime = "1000";
|
||||||
isContainer = "0";
|
isContainer = "0";
|
||||||
internalName = "deleteImportConfig";
|
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -332,8 +332,22 @@ function EditorSaveMission()
|
||||||
%obj.onSaveMission( $Server::MissionFile );
|
%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
|
//Save out the PostFX config
|
||||||
PostFXManager::savePresetHandler( $Server::LevelAsset.getPostFXPresetPath() );
|
PostFXManager::savePresetHandler( %presetFile );
|
||||||
|
|
||||||
EditorClearDirty();
|
EditorClearDirty();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ function EditorGui::buildMenus(%this)
|
||||||
item[14] = "Snap Options..." TAB "" TAB "ESnapOptions.ToggleVisibility();";
|
item[14] = "Snap Options..." TAB "" TAB "ESnapOptions.ToggleVisibility();";
|
||||||
item[15] = "-";
|
item[15] = "-";
|
||||||
item[16] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);";
|
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);
|
%this.menuBar.insert(%editMenu);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue