| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- 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 PostEffectEditorInspector::refresh(%this)
- {
- PostFXEditor.refresh();
- }
- function PostFXEditor::refresh(%this)
- {
- %selectedItem = PostEffectEditorList.getSelectedRow();
- PostEffectEditorList.clear();
- %count = PostFXManager.Count();
- for(%i=0; %i < %count; %i++)
- {
- %postEffect = PostFXManager.getKey(%i);
-
- if(%postEffect.isEnabled())
- PostEffectEditorList.addRow( %i, %postEffect.getName() );
- }
-
- PostEffectEditorList.setSelectedRow(%selectedItem);
- }
- 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);
- PostFXEditorNewPFXWindow.selectWindow();
-
- PostFXEditorNewPFXList.clear();
-
- %count = PostFXManager.Count();
- for(%i=0; %i < %count; %i++)
- {
- %postEffect = PostFXManager.getKey(%i);
-
- if(!%postEffect.isEnabled())
- PostFXEditorNewPFXList.addRow( %i, %postEffect.getName() );
- }
- }
|