-
Script UI Panel
Been trying to do my own version (only for personal use) of the “Ft-Toolbar” ft-toolbar by Francios Tarlier. I’m trying to learning scripting to expand my knowledge base, as I’ve gotten a pretty good handle on Expressions. I’m trying to build a Script UI Panel, which works as expected on the MAC, but not on the PC and I can’t figure out why only the particular button shows up: Do I have to make a buttonPanel for them to sit in?
Here’s the code: (Thanks in advance for your help)
var whichComp = app.project.activeItem;
var myLayer = whichComp.selectedLayers;var w = buildUI(this);
function buildUI(thisObj) {
var win = (thisObj instanceof Panel) ? thisObj:new Window('palette', 'Tim Tools',undefined, {resizable: true});if (win != null) {
win.particularLayer = win.add('button', [10,13,120,35], 'Particular Layer'); //Create Particular Button
win.particularLayer.onClick = function()
{
//Make a solid and apply Particular to it
app.beginUndoGroup("Particular Creation");
particularSolid = whichComp.layers.addSolid([0.51, 0.075, 0.075], "Particular fx", whichComp.width, whichComp.height, 1.0);
particularSolid.property("Effects").addProperty("tc Particular");
app.endUndoGroup("Particular Creation");
}
win.GazBlurT = win.add('button', [10,43,120,35], 'Gaussian Blur'); //Create Gaussian Blur Button
win.GazBlurT.onClick = function()
{
//Add the Gaussian Blur fx to the current first layer selected
var currentLayer = whichComp.selectedLayers[0];
currentLayer.property("Effects").addProperty("ADBE Gaussian Blur");
}win.cameraT = win.add('button', [10,73,120,35], 'Camera'); //Adds Camera to the Scene
win.cameraT.onClick = function()
{
//Add new camera to current comp letting user name camera
whatName = prompt("What do you want to name the Camera?", "Camera 1");
myCamera = whichComp.layers.addCamera(whatName, [whichComp.width * .5, whichComp.height * .5]);
}
win.adjLayer = win.add('button', [10,103,120,35], 'Adjustment Layer');
win.adjLayer.onClick = function()
{
//Add an adjustment layer to current Comp
var adjustName = prompt("What do you want to call the Adjustment Layer", "Adjustment Layer 1");
var currentLayer = whichComp.layers.addSolid([1.0, 1.0, 1.0], adjustName, whichComp.width, whichComp.height, 1.0);
currentLayer.adjustmentLayer = true;
}win.preComp = win.add('button', [10,133,120,35], 'PreCompose');
win.preComp.onClick = function()
{
//Pre-comp selected layers letting user name Pre-Comp
var preCompName = prompt("What do you want to name the Comp?", "My Comp Name");
var theseLayers = whichComp.selectedLayers;
var howManyLayers = theseLayers.length;
//If no layers selected assume user wants to Pre-Comp everything in the comp
if(howManyLayers == 0){
var layerIndices = new Array();
howManyLayers = whichComp.layers.length;
for (i = 0; i < howManyLayers; i++){
layerIndices[i] = i + 1;
}
var newPreComp = whichComp.layers.precompose(layerIndices, preCompName);
}
else
{
//If only one layers selected give Move All option [Not available for multiple layers]
if(howManyLayers == 1){
var moveAllName = prompt("Move all attributes?", "Yes");
var whatLayerAmI = theseLayers[0].index;
switch(moveAllName)
{
case "Yes":
moveAllName = true;
break;
case "No":
moveAllName = false;
break;
case "yes":
moveAllName = true;
break;
case "no":
moveAllName = false;
break;
case "YES":
moveAllName = true;
break;
case "NO":
moveAllName = false;
break;
default:
}
var newPreComp = whichComp.layers.precompose([whatLayerAmI], preCompName, moveAllName);}
else{
//See which layers are selected and precompose them
var combineLayers = new Array(howManyLayers);
for (i = 0; i < howManyLayers; i++){
combineLayers[i] = theseLayers[i].index;
}var newPreComp = whichComp.layers.precompose(combineLayers, preCompName);
}
}
}
}
return win
}