ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Dockable GUI

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Krishna MoorthyDockable GUI
by on Nov 30, 2016 at 5:33:22 pm

Here is the code:

function myScript(thisObj){
function myScript_buildUI(thisObj){
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "myScript", undefined, {resizeable:true});
if(myPanel != null){
var res = "group {orientation:'column',\
grp1: Group{orientation:'row',\
RadioButton1: RadioButton{text:'1'},\
RadioButton2: RadioButton{text:'2'},\
},\
grp2: Group{,\
finalButton: Button{text:'Make a PIP'},\
},\
}";
var myPanel.grp = myPanel.add(res);

return myPanel;
}
}

var myPal = myScript_buildUI(thisObj);
if(myPal != null){
if(myPal instanceof Window){
myPal.center();
myPal.show();
}
}

}

myScript(this);


Saving this file in scriptUI folder doesn't provide me with a dockable panel, instead it gives only the window. what should change or add in this code, to get a dockable UI?


Return to posts index

Walter SoykaRe: Dockable GUI
by on Nov 30, 2016 at 5:49:04 pm

[Krishna Moorthy] "Saving this file in scriptUI folder doesn't provide me with a dockable panel, instead it gives only the window. what should change or add in this code, to get a dockable UI?"

That code should generate a dockable panel, but you have to run the script a specific way for it to work. After saving the script in the ScriptUI folder, re-launch After Effects and invoke the script from the Window menu.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Krishna MoorthyRe: Dockable GUI
by on Dec 1, 2016 at 12:34:02 pm

I know, this code should give me a dockable panel. But it doesn't gave one, that is why I posted it here. I have saved in ScriptUI folder and re-launched AE too. The error it shows is, "expected ;" at this line:

var myPanel.grp = myPanel.add(res);

I will more pleased, if you help me to crack this out.


Return to posts index


Walter SoykaRe: Dockable GUI
by on Dec 1, 2016 at 1:47:19 pm

I cleaned up your code:

function myScript(thisObj){
function myScript_buildUI(thisObj){
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "myScript", undefined, {resizeable:true});
if(myPanel != null){
var res = "group {orientation:'column',\
grp1: Panel {orientation:'row',\
RadioButton1: RadioButton{text:'1'},\
RadioButton2: RadioButton{text:'2'},\
},\
grp2: Panel {\
finalButton: Button{text:'Make a PIP'}\
}\
}";
myPanel.grp = myPanel.add(res);

return myPanel;
}
}

var myPal = myScript_buildUI(thisObj);
if(myPal != null){
if(myPal instanceof Window){
myPal.center();
myPal.show();
}
}

}

myScript(this);


Declaring myPanel.grp as a variable was wrong and was triggering the error you described; additionally, grp1 and grp2 should be Panels, not groups, and you had some extraneous commas in the res string throughout grp2.

If you have any questions on what this code is actually doing, please ask away and I'll do my best to answer.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Krishna MoorthyRe: Dockable GUI
by on Dec 1, 2016 at 4:34:31 pm

Hey, thanks for your work. But, I get only an empty panel while pasting it in the scriptUI folder and launching via window. Don't know what is going wrong? :(


Return to posts index

Walter SoykaRe: Dockable GUI
by on Dec 1, 2016 at 5:02:12 pm

Oops. It works as a window, not a panel as written above, because I left out the layout call.

Try this:
function myScript(thisObj){
function myScript_buildUI(thisObj){
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "myScript", undefined, {resizeable:true});
if(myPanel != null){
var res = "group {orientation:'column',\
grp1: Group {orientation:'row',\
RadioButton1: RadioButton{text:'1'},\
RadioButton2: RadioButton{text:'2'},\
},\
grp2: Group {\
finalButton: Button{text:'Make a PIP'}\
}\
}";
myPanel.grp = myPanel.add(res);

myPanel.layout.layout(true);
myPanel.grp.minimumSize = myPanel.grp.size;
myPanel.layout.resize();
myPanel.onResizing = myPanel.onResize = function () {this.layout.resize();}

return myPanel;
}
}

var myPal = myScript_buildUI(thisObj);
if(myPal != null){
if(myPal instanceof Window){
myPal.center();
myPal.show();
}
}

}

myScript(this);


Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index


Krishna MoorthyRe: Dockable GUI
by on Dec 1, 2016 at 6:01:19 pm

First of all, a heart full of thanks for your intention towards helping me. You are faster than me in replying in the thread which I had posted. Thank you so much dude.

So, this is the code you have added in the code that I had posted not on the code you provided, rite??

myPanel.layout.layout(true);
myPanel.grp.minimumSize = myPanel.grp.size;
myPanel.layout.resize();
myPanel.onResizing = myPanel.onResize = function


Then, kindly explain me this snippet.

Are they built in functions? if it so?

Where can I learn about these? and othe functions or methods lie these?


Return to posts index

Walter SoykaRe: Dockable GUI
by on Dec 1, 2016 at 6:07:08 pm

Yes. That code invokes the ScriptUI layout manager, which allows the contents of the window to be modified after it is drawn (necessary for panels!), sets the size to the minimum, and ensures that any resize calls properly refer to the object we're creating here.

Here's another resource that I should have pointed you to last week:
http://www.kahrel.plus.com/indesign/scriptui.html

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Krishna MoorthyRe: Dockable GUI
by on Dec 1, 2016 at 7:20:28 pm

Once again, thanks for your response dude.

That is very helpful, will rock my office tomorrow or the next day by finishing this script. Credits to you man.


Return to posts index


Walter SoykaRe: Dockable GUI
by on Dec 1, 2016 at 7:49:05 pm

You're welcome.

Scripting is a little difficult to get into, but once you understand it, it's incredibly powerful. Good luck with your project.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]