Copy link to clipboard
Copied
hello,
I'm writing a script where I could select some psd files in project, and script would basicly replace those psd-s with the same files, but load them as *layered comps*, duplicate them 2 times, and solo the specific layers in each layered comp.
The script is working perfectly, but the problem begins when I try to add *Options* button which should load new palette, with bunch of checkboxes. It simply don't want to show/render the new palette inside After Effects, but it's working perfectly inside ExtendScript?! Here are the screenshots:
Is there something like a maximum allowed video memory for custom ui or is it just a bug in software? I'm using AE cs6, and I tested this in cs5 and cs5.5 - same problem...
anything would be helpful.
thanks
(sorry for bad eng)
1 Correct answer
Ok, there seems to be something wrong with CS6 outright. After trying a number of ways I then realized that NONE of the other scripts in my interface that had popup windows would work. All of these scripts worked perfectly fine before testing this script, so something is going screwy here.
I think by not having the "winVinjOpt" and "winPsdOpt" window code inside the onclick function is causing some issues. Once I placed the code inside the onClick functions, it no longer killed all popup windows.
...Copy link to clipboard
Copied
It should work, it just depends on how the code is written. It could be a number of things:
- Something as simple as an element's visible property is marked false.
- Layout coordinates are offset (if you manually set the layout coordinates)
- This also can be a stacking order issue where you have a UI element on top of the other elements and it is simply blocking the view of the controls.
Please share a bit more info in how you built the UI. Was it via resource string or manually built line by line? I see a small glimpse in the right screen shot that looks to me that you are using the auto layout manager by using "undefined" for the coordinates in the "Line" checkbox element.
Copy link to clipboard
Copied
hi David,
firstly I want to say that I followed your training while creating this script, and I'm honoured to have your attention here
As you say, It should work but it doesn't (in ae). I tried all sorts of things and I still can't get it working properly. Sometimes, after 5 or 6 times restarting the AE, I got the panels loading properly, but restarting a program is not a solution.
your thoughts:
1. element visability - I don't think it's the problem, because that is what the button is actually doing:
myPanel.grp.groupOne.panelOne.groupPsdAndOpt.psdReplaceOptBTN.onClick = function (){
winPsdOpt.show();
}
2. layout cordinates - everything inside that plette is *undefined*
3. stacking order - I understand what youre saying but I can't see why are plettes loading in ExtendScript while testing, and then with the same code they are not loading in AE? really confusing???
4. yes I'm using resource string for main panel, and *options* palettes are created manualy.
I tried using "window"
var winPsdOpt= new Window ("window", "PSD Replace Options", undefined);
instead "palette"
var winPsdOpt= new Window ("palette", "PSD Replace Options", undefined);
still not working...
here is the code actualy (without many functions - it's too big for posting here):
-----------------------------------------------------------------------------------------------------
function myScript(thisObj){
function myScript_buildUI (thisObj){
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window ("palette", "My window name", undefined, {resizeable : true});
var res = "group{orientation:'column', spacing: 4, \
groupOne: Group{orientation:'column', alignment: ['fill','fill'], alignChildren: ['fill', 'fill'], spacing: 4,\
panelOne: Panel{text:'', orientation:'column', alignment: ['fill','fill'], alignChildren: ['left', 'fill'], spacing: 2,\
groupPsdAndOpt: Group{orientation:'row', alignment: ['fill','fill'], alignChildren: ['fill', 'fill'], spacing: 2,\
psdReplacerBTN: Button{text:'Psd Replacer', alignment: ['fill','']},\
psdReplaceOptBTN: Button{text:'Opt', size: [30,20,0,0], alignment: ['right','fill']},\
},\
cb1: Checkbox{text:'Reload Footage'},\
cb11: Checkbox{text:'Remove Unused Footage'},\
},\
panelTwo: Panel{text:'', orientation:'column', alignment: ['fill','fill'], alignChildren: ['left', 'fill'], spacing: 2,\
removeEffectsBTN: Button{text:'Remove Effects', alignment: ['fill','']},\
rb1: RadioButton{text:'Whole Project'},\
rb2: RadioButton{text:'Selection'},\
rb3: RadioButton{text:'Selection (Deep)'},\
},\
panelThree: Panel{text:'', orientation:'column', alignment: ['fill','fill'], alignChildren: ['left', 'fill'], spacing: 2,\
preComposerBTN: Button{text:'preComposer', alignment: ['fill','']},\
cb2: Checkbox{text:'Create Master Comp'},\
cb3: Checkbox{text:'Separate Layers'},\
},\
},\
groupActions: Group{orientation:'column', alignment: ['fill','fill'], alignChildren: ['fill', 'fill'],\
panelFour: Panel{text:'', orientation:'column', alignment: ['fill','fill'], alignChildren: ['left', 'fill'], spacing: 2,\
actionsBTN: Button{text:'Execute Action', alignment: ['fill','']},\
cb4: Checkbox{text:'Psd Replacer'},\
cb5: Checkbox{text:'Remove Effects'},\
cb6: Checkbox{text:'PreCompose'},\
groupVinj: Group{orientation:'row', alignment: ['fill','fill'], alignChildren: ['fill', 'fill'],\
cb7: Checkbox{text:'Add Vignette'},\
vinjOptBTN: Button{text:'...', size: [5,0,0,0]},\
},\
cb8: Checkbox{text:'Add Adjustment Layer'},\
DDList1: DropDownList{properties:{items:['DD Item 1', 'PSnew', 'DD Item 3', 'DD Item 4']}, title: 'preset:', alignment: ['right', 'center'], spacing: 2},\
},\
},\
groupTwo: Group{orientation:'column', alignment: ['fill','fill'], alignChildren: ['fill', 'fill'], spacing: 2,\
myProgressBar: Progressbar{text:'Progressbar', value:50},\
},\
groupTxt: Group{orientation:'column', alignment: ['fill','fill'], alignChildren: ['fill', 'fill'], spacing: 2,\
progressText: StaticText{text: 'Completed 100 %', alignment: ['right','fill']}},\
}"
myPanel.grp = myPanel.add(res);
myPanel.layout.layout(true);
// myPanel.grp.groupActions.panelFour.groupPresets.DDList1.titleLayout = { alignment: ['left', 'center'], spacing: 3, characters: 16, justify: 'right' };
myPanel.grp.groupTwo.graphics.backgroundColor = myPanel.grp.groupTwo.graphics.newBrush (myPanel.grp.groupTwo.graphics.BrushType.SOLID_COLOR, [0.0, 0.5, 0.0]);
// w.panel2.ddl2.titleLayout = { margins: [15, 0, 15, 0] };
myPanel.grp.groupTwo.size[1] = 9;
myPanel.grp.groupTwo.myProgressBar.size[1] = 9;
myPanel.grp.groupActions.panelFour.groupVinj.vinjOptBTN.onClick = function (){
winVinjOpt.show();
}
myPanel.grp.groupOne.panelOne.groupPsdAndOpt.psdReplaceOptBTN.onClick = function (){
winPsdOpt.show();
}
myPanel.grp.groupOne.panelOne.groupPsdAndOpt.psdReplacerBTN.onClick = function () {
PSD_ActiveItemReplacer();
}
return myPanel;
}
var myScriptPal = myScript_buildUI (thisObj);
if ((myScriptPal != null) && (myScriptPal instanceof Window)){
myScriptPal.center();
myScriptPal.show();
}
}
myScript (this);
function PSD_ActiveItemReplacer() {
alert ("psdReplace");
}
{ // PsdReplaceOptionsBTN Window and options
var winPsdOpt = new Window ("palette", "PSD Replace Options", undefined);
var g = winPsdOpt.add ("group");
var panelLin = g.add ("panel", undefined, "Line"); //[0,0,300,200]
var lCB1 = panelLin.add("checkbox", undefined, "Line");
var lCB2 = panelLin.add("checkbox", undefined, "Shadow Line");
var lCB3 = panelLin.add("checkbox", undefined, "Temp");
var lCB4 = panelLin.add("checkbox", undefined, "Shadow");
var lCB5 = panelLin.add("checkbox", undefined, "Highlights");
var lCB6 = panelLin.add("checkbox", undefined, "Color");
var panelSenka = g.add ("panel", undefined, "Shadow"); //[0,0,300,200]
var sCB1 = panelSenka.add("checkbox", undefined, "Line");
var sCB2 = panelSenka.add("checkbox", undefined, "Shadow Line");
var sCB3 = panelSenka.add("checkbox", undefined, "Temp");
var sCB4 = panelSenka.add("checkbox", undefined, "Shadow");
var sCB5 = panelSenka.add("checkbox", undefined, "Highlights");
var sCB6 = panelSenka.add("checkbox", undefined, "Color");
var panelBoja = g.add ("panel", undefined, "Color"); //[0,0,300,200]
var bCB1 = panelBoja.add("checkbox", undefined, "Line");
var bCB2 = panelBoja.add("checkbox", undefined, "Shadow Line");
var bCB3 = panelBoja.add("checkbox", undefined, "Temp");
var bCB4 = panelBoja.add("checkbox", undefined, "Shadow");
var bCB5 = panelBoja.add("checkbox", undefined, "Highlights");
var bCB6 = panelBoja.add("checkbox", undefined, "Color");
// Defaults
g.orientation = "row";
panelLin.alignChildren = panelSenka.alignChildren = panelBoja.alignChildren = "left";
panelLin.spacing = panelSenka.spacing = panelBoja.spacing = 1;
}
{ // VignetteOptionsBTN Window and options
var winVinjOpt = new Window ("palette", "Vignette Options", undefined);
var masterGr = winVinjOpt.add ("group");
var radB1 = masterGr.add ("radiobutton", undefined, "Solid Layer Vignette");
var pal1 = masterGr.add("panel", [0, 0, 800, 0], "");
var radGrp1 = masterGr.add("group");
var colorPickBTN = radGrp1.add("button", [0,0,35,20], "Pick");
var maskDDlist1 = radGrp1.add("dropdownlist", undefined, ["Elipse", "Square"]);
maskDDlist1.title = "Mask Type: ";
maskDDlist1.selection = 0;
var solidTxt = radGrp1.add("statictext", undefined, "Mask Fether");
var maskFslid = radGrp1.add ("slider", undefined, 400, 0, 500);
var maskFval = radGrp1.add ("edittext {text: 400, characters: 5, justify: center, active: true}");
maskFslid.onChanging = function () {maskFval.text = maskFslid.value}
maskFval.onChanging = function () {maskFslid.value = Number (maskFval.text)}
var blendModesArray = ["NORMAL", "MULTIPLY", "DARKEN", "ADD", "LIGHTEN", "OVERLAY" ];
var blendModeDDl = radGrp1.add("dropdownlist", undefined, blendModesArray);
blendModeDDl.title = "Blending Mode: ";
blendModeDDl.selection = 0;
var solidTxt1 = radGrp1.add("statictext", undefined, "Opacity");
var opacFslid = radGrp1.add ("slider", undefined, 80, 0, 100);
var opacFval = radGrp1.add ("edittext {text: 80, characters: 5, justify: center, active: true}");
opacFslid.onChanging = function () {opacFval.text = opacFslid.value}
opacFval.onChanging = function () {opacFslid.value = Number (opacFval.text)}
var radB2 = masterGr.add ("radiobutton", undefined, "Adjustment Layer Vignette");
var pal2 = masterGr.add("panel", [0,0, 800, 0], "");
var radGrp2 = masterGr.add("group");
// Defaults
radB1.onClick = function (){
radB2.value = false;
}
radB2.onClick = function (){
radB1.value = false;
}
radGrp1.orientation = "row";
radGrp1.spacing = 2;
radGrp1.alignChildren = "left";
masterGr.orientation = "column";
masterGr.alignChildren = "left";
masterGr.spacing =2;
}
Copy link to clipboard
Copied
Oddly enough it works perfectly fine when I launch it in AECC. I will try CS6 next.
Copy link to clipboard
Copied
Ok, in CS6 it fails.
Copy link to clipboard
Copied
Ok, there seems to be something wrong with CS6 outright. After trying a number of ways I then realized that NONE of the other scripts in my interface that had popup windows would work. All of these scripts worked perfectly fine before testing this script, so something is going screwy here.
I think by not having the "winVinjOpt" and "winPsdOpt" window code inside the onclick function is causing some issues. Once I placed the code inside the onClick functions, it no longer killed all popup windows. Having a window in limbo was messing with the system. Another thing I would change too would be to make both "winVinjOpt" and "winPsdOpt" a dialog instead of palette. This will keep the window on top of everything and prevent them from being hidden behind your main panel or any other floating panels.
Copy link to clipboard
Copied
Hi David,
I'm really sorry for the big delay, I had a lot of work these days.
It turns out that you were right. having those unnecessary curly brackets was the main issue.
After removing them, everything works just fine. and I even don't need to have window constructor code inside the onClick functions, which is a great thing. I have access to variables from any function.
So thank you very much my friend, I really appreciate your help
have a great day.

