Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Updating UI Elements based on External Actions

$
0
0

I have a script that I am trying to update based on selecting a different effect. So let's say for example you have a Box Blur and Curves effect applied to a layer. The script recognises what you have selected. So if you had Box Blur selected in the effects window it would display that in the dockable UI. The problem is if I select another effect (like the Curves), it does not change. How can I update the text (in this case currentEffect) when the user selects a different effect? Thanks!

 

(There are some omitted arrays from the code below)

var selectedComp = app.project.activeItem;
var selectedLayer = selectedComp.selectedLayers;
var selectedEffect = selectedLayer[0].selectedProperties;
var selectedEffectName = selectedEffect[0].name;
var currentEffect;
var currentEffectDescription;




// check if selected effect is in array, then stores it if/when it finds it
for(var i = 0; i < effectNames.length; i++){    if(selectedEffectName == effectNames[i]){            currentEffect = String(effectNames[i]);            currentEffectDescription = String(effectDescription[i]);        }    }


{
   function myScript(thisObj){      function myScript_buildUI(thisObj){         var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Effect Updater", undefined, {resizeable:true});                 res = "group{orientation:'column',\            groupOne: Group{orientation:'row',\          },\          groupTwo: Group{orientation:'row',\          titleText: StaticText{text:'" + currentEffect + "'},\          },\          descriptionText: StaticText{text:'" + currentEffectDescription +"', properties:{multiline:true}},\          groupFour: Group{orientation:'row',\          buttonOne: Button{text:'Test'},\          buttonTwo: Button{text:'Test 2'},\          },\         }";         myPanel.grp = myPanel.add(res);                         myPanel.grp.groupFour.tutorialButton.onClick = function(){             }                 myPanel.grp.groupFour.moreInfoButton.onClick = function(){             }                 myPanel.layout.layout(true);                 return myPanel;               }        var myScriptPal = myScript_buildUI(thisObj);      if (myScriptPal != null && myScriptPal instanceof Window){         myScriptPal.center();         myScriptPal.show();      }   }   myScript(this);  
}

Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>