mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-27 18:43:48 +00:00
Changes the saving of postfx from saving via the editor to instead save on level save Reorganizes the core postfx folder to subfolders for better organization, as well as moving the shaders to group with the respective postFX Changes the postfx editor so it only edits postFXs that are actively enabled in the scene, and only saves out similarly. Adjusts the level download logic to pass asset id for both data compactness compared to the full level filename, as well as easier lookup reference for associated files like the postFX preset file or decal files from the asset def. Updated the PostFXAsset template to provide an up-to-date starting point/template.
148 lines
No EOL
3.7 KiB
C#
148 lines
No EOL
3.7 KiB
C#
function PostFXEditor::onDialogPush( %this )
|
|
{
|
|
//Apply the settings to the controls
|
|
postVerbose("% - PostFX Editor - Loading GUI.");
|
|
|
|
%this.refresh();
|
|
|
|
PostEffectEditorList.setSelectedById( 1 );
|
|
}
|
|
|
|
function PostFXEditor::onDialogPop( %this )
|
|
{
|
|
//Always change the manager target back to the scene's just to be save when done editing
|
|
$PostFXManager::currentPreset = $Client::LevelAsset.getPostFXPresetPath();
|
|
|
|
PostFXManager.loadPresetHandler($PostFXManager::currentPreset);
|
|
|
|
PostFXEditorWindow.text = "PostFX Editor";
|
|
}
|
|
|
|
function PostFXEditor::editScenePostFXSettings( %this )
|
|
{
|
|
$PostFXManager::currentPreset = $Client::LevelAsset.getPostFXPresetPath();
|
|
Canvas.pushDialog(%this);
|
|
|
|
PostFXEditorWindow.text = "PostFX Editor - " @ getScene(0).getName();
|
|
|
|
PostFXEditorActionButton.text = "Revert";
|
|
PostFXEditorActionButton.command = "PostFXEditor.revert();";
|
|
}
|
|
|
|
function PostFXEditor::editDefaultPostFXSettings( %this )
|
|
{
|
|
$PostFXManager::currentPreset = $PostFXManager::defaultPreset;
|
|
PostFXManager.loadPresetHandler($PostFXManager::currentPreset);
|
|
|
|
Canvas.pushDialog(%this);
|
|
|
|
PostFXEditorWindow.text = "PostFX Editor - Default Config";
|
|
|
|
PostFXEditorActionButton.text = "Save";
|
|
PostFXEditorActionButton.command = "PostFXManager::savePresetHandler($PostFXManager::defaultPreset);";
|
|
}
|
|
|
|
|
|
function PostFXEditor::refresh(%this)
|
|
{
|
|
PostEffectEditorList.clear();
|
|
|
|
%count = PostFXManager.Count();
|
|
for(%i=0; %i < %count; %i++)
|
|
{
|
|
%postEffect = PostFXManager.getKey(%i);
|
|
|
|
if(%postEffect.isEnabled)
|
|
PostEffectEditorList.addRow( %i, %postEffect.getName() );
|
|
}
|
|
}
|
|
|
|
function PostFXEditor::apply(%this)
|
|
{
|
|
%count = PostFXManager.Count();
|
|
for(%i=0; %i < %count; %i++)
|
|
{
|
|
%postEffect = PostFXManager.getKey(%i);
|
|
|
|
if(isObject(%postEffect) && %postEffect.isMethod("applyFromPreset"))
|
|
{
|
|
%postEffect.applyFromPreset();
|
|
}
|
|
}
|
|
}
|
|
|
|
function PostFXEditor::revert(%this)
|
|
{
|
|
%targetPreset = $PostFXManager::currentPreset;
|
|
if(%targetPreset $= "")
|
|
%targetPreset = $PostFXManager::defaultPreset;
|
|
|
|
PostFXManager::loadPresetHandler(%targetPreset);
|
|
|
|
%this.refresh();
|
|
|
|
PostEffectEditorInspector.clearFields();
|
|
PostEffectEditorList.setSelectedRow(1);
|
|
}
|
|
|
|
function PostEffectEditorList::onSelect( %this, %id, %text )
|
|
{
|
|
PostEffectEditorInspector.clearFields();
|
|
|
|
%postEffect = PostFXManager.getKey(%id);
|
|
|
|
if(isObject(%postEffect) && %postEffect.isMethod("populatePostFXSettings"))
|
|
{
|
|
%postEffect.populatePostFXSettings();
|
|
}
|
|
}
|
|
|
|
function PostFXEditor::addNewPostFXs(%this)
|
|
{
|
|
%rowIndex = PostFXEditorNewPFXList.getSelectedRow();
|
|
%postFXName = PostFXEditorNewPFXList.getRowText(%rowIndex);
|
|
|
|
%postFXName.enable();
|
|
|
|
%this.refresh();
|
|
|
|
%rowIndex = PostEffectEditorList.findTextIndex(%postFXName);
|
|
PostEffectEditorList.setSelectedRow(%rowIndex);
|
|
|
|
PostFXEditorNewPFXWindow.setHidden(true);
|
|
}
|
|
|
|
function PostFXEditor::removePostFX(%this)
|
|
{
|
|
%rowIndex = PostEffectEditorList.getSelectedRow();
|
|
%postFXName = PostEffectEditorList.getRowText(%rowIndex);
|
|
|
|
%postFXName.disable();
|
|
|
|
%this.refresh();
|
|
|
|
PostEffectEditorInspector.clearFields();
|
|
PostEffectEditorList.setSelectedRow(1);
|
|
}
|
|
|
|
function editScenePostEffects(%scene)
|
|
{
|
|
if(EditorIsActive())
|
|
PostFXEditor.editScenePostFXSettings();
|
|
}
|
|
|
|
function PostFXEditorNewPFXWindow::showDialog(%this)
|
|
{
|
|
%this.setHidden(false);
|
|
|
|
PostFXEditorNewPFXList.clear();
|
|
|
|
%count = PostFXManager.Count();
|
|
for(%i=0; %i < %count; %i++)
|
|
{
|
|
%postEffect = PostFXManager.getKey(%i);
|
|
|
|
if(!%postEffect.isEnabled)
|
|
PostFXEditorNewPFXList.addRow( %i, %postEffect.getName() );
|
|
}
|
|
} |