DuAEF.DuScriptUI

ScriptUI tools

Members

static defaultColumnAlignment :Array.<String>

The default alignment of children of containers with "column" orientation
Default Value:
  • ["fill","top"]

static defaultMargins :int

The default margins of containers
Default Value:
  • 2

static defaultRowAlignment :Array.<String>

The default alignment of children of containers with "row" orientation
Default Value:
  • ["left","center"]

static defaultSpacing :int

The default spacing of containers
Default Value:
  • 2

static defaultStackAlignment :Array.<String>

The default alignment of children of containers with "stack" orientation
Default Value:
  • ["fill","top"]

static helpPanel

The panel where the help is displayed

static uiStrings

Stores all strings used by the UI.
This can be very useful to work with a translation framework.

Methods

static addButton(container, textopt, imageopt, helpTipopt, imageOveropt) → {DuButton}

Creates a button with an optionnal icon. Must have at least an icon or a text, or both.
Parameters:
Name Type Attributes Default Description
container Panel | Window | Group The ScriptUI Object which will contain and display the button.
text string <optional>
The label of the button. Default: empty string
image string <optional>
The path to the icon. Default: empty string
helpTip string <optional>
The helptip. Default: empty string
imageOver string <optional>
image The path to an icon displayed when the mouse is over the button.
Returns:
DuButton - The image button created.

static addCheckBox(container, text, image, helpTip, imageChecked, imageOver, textCheckedopt) → {DuCheckBox}

Creates a checkbox with an optionnal icon. Must have at least an icon or a text, or both.
Parameters:
Name Type Attributes Description
container Panel | Window | Group The ScriptUI Object which will contain and display the button.
text string The label of the button. Default: empty string
image string The path to the icon. Default: empty string
helpTip string The helptip. Default: empty string
imageChecked string The path to an icon displayed when the button is checked. Default: empty string
imageOver string The path to an icon displayed when the mouse is over the button. Default: same as imageChecked
textChecked string <optional>
The label of the button displayed when it is checked.
Returns:
DuCheckBox - The image checkbox created.

static addCompSelector(container) → {CompSelector}

Creates a drop down selector for compositions
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the selector.
Returns:
CompSelector - - The selector

static addEditText(container, text, prefixopt, suffixopt, placeHolderopt, helpTipopt, translatableopt) → {DuEditText}

Creates a nice edittext where the edit text is shown only on click.
Parameters:
Name Type Attributes Default Description
container Window | Panel | Group The ScriptUI Object which will contain and display the nice edit text.
text string The initial text in the edit.
prefix string <optional>
"" A text prefix to display.
suffix string <optional>
"" A text suffix to display.
placeHolder string <optional>
"" A place holder default text.
helpTip string <optional>
"" The helpTip of this control
translatable bool <optional>
true Wether to translate the texts of this control
Returns:
DuEditText - The custom Group containing the edit text.

static addForm(container) → {Form}

Creates a layout to add forms to a UI, using ScriptUI groups.
You can easily add controls/fields to this form using DuAEF.DuScriptUI.addFormField
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the form.
Returns:
Form - The custom Group containing the form.

static addGroup(container, orientationopt) → {Group}

Adds a group in a container, using DuAEF.DuScriptUI default alignments, and DuAEF.DuScriptUI.defaultSpacing. Margins are set to 0.
Parameters:
Name Type Attributes Description
container Panel | Window | Group Where to create the group
orientation string <optional>
The orientation to use. One of "column", "row" or "stack". By default, "column" if added in a row, "row" if added in a column.
Returns:
Group - The group created

static addLayerPicker(container) → {LayerPicker}

Creates a two-columns group to allow the user to pick layers
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the selector.
Returns:
LayerPicker - The picker.

static addLayerSelector(container) → {Selector}

Creates a drop down selector for layers
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the selector.
Returns:
Selector - - The selector

static addSelector(container) → {Selector}

Creates a drop down selector, using image buttons
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the selector.
Returns:
Selector - - The selector

static addSeparator(container, nameopt, checkableopt, drawLineopt) → {Separator}

Adds separator with an optionnal name in the group
Parameters:
Name Type Attributes Default Description
container Panel | Window | Group Where to create the separator
name string <optional>
The name displayed
checkable boolean <optional>
false When true, adds a checkbox to the separator
drawLine boolean <optional>
true Draws a line when there is no name. When false, the separator is an empty space
Returns:
Separator - The separator

static addSimpleCheckBox(container, textopt, helpTipopt, coloropt) → {SimpleCheckBox}

Creates a checkbox which can be colored, and changes color on hover
Parameters:
Name Type Attributes Default Description
container Panel | Window | Group The ScriptUI Object which will contain and display the button.
text string <optional>
The label of the button.
helpTip string <optional>
The helptip.
color color <optional>
DuAEF.DuJS.Color.Colors.LIGHT_GREY The color of the text
Returns:
SimpleCheckBox - The image checkbox created.

static addSlider(container, defaultValueopt, minopt, maxopt, orientationopt, invertedAppearanceopt, prefixopt, suffixopt) → {DuSlider}

Creates a nice edittext where the edit text is shown only on click.
Parameters:
Name Type Attributes Default Description
container Window | Panel | Group The ScriptUI Object which will contain and display the nice edit text.
defaultValue int <optional>
0 The initial value.
min int <optional>
0 The minimal value.
max int <optional>
100 The maximal value.
orientation string <optional>
'column' Either 'row' or 'column'
invertedAppearance boolean <optional>
Revert the slider with max value on the left
prefix string <optional>
A text prefix to display.
suffix string <optional>
A text suffix to display.
Returns:
DuSlider - The custom Group containing the slider.
To Do:
  • implement helpTip

static addStaticText(container, text, coloropt, translatableopt, multilineopt) → {StaticText}

Creates a statictext (with an optionnal color).
Parameters:
Name Type Attributes Default Description
container Window | Panel | Group The ScriptUI Object which will contain and display the nice edit text.
text string The initial text in the edit.
color Array.<int> <optional>
The color of the text.
translatable bool <optional>
true Set this to false to never translate this text.
multiline bool <optional>
false Set this to true to add a multiline text.
Returns:
StaticText - The ScriptUI StaticText created.

static addTabPanel(container, showTitleopt) → {TabPanel}

Creates a panel with tabs
Parameters:
Name Type Attributes Default Description
container Window | Panel | Group The ScriptUI Object which will contain and display the panel.
showTitle boolean <optional>
true Wether to show the titles of the tabs or not.
Returns:
TabPanel - The panel.

static adjustColor(color) → {Array.<float>}

Adjust the color according to the brightness setting of After Effects
Parameters:
Name Type Description
color Array.<float> The color [R,V,B,A] Array
Returns:
Array.<float> - - The new color [R,V,B,A] Array

static buildAllTabs()

Builds all the tabs from all the tab panels

static createLayerPickerDialog(title) → {LayerPickerDialog}

Creates a dialog with a LayerPicker
Use DuAEF.DuScriptUI.showUI to show it after creation.
Parameters:
Name Type Description
title string The title of the dialog.
Returns:
LayerPickerDialog - The dialog window.

static createUI(container, scriptName, contentAlignmentopt) → {Panel|Window}

Creates the main panel of a script
Parameters:
Name Type Attributes Default Description
container Panel | null The container ('this' in the root of the calling script), either a Panel (when launched from the 'Window' menu) or null (when launched from 'file/scripts/run...')
scriptName string A name for this UI
contentAlignment Array.<string> <optional>
DuAEF.DuScriptUI.defaultColumnAlignment The alignment of the contents in the panel
Returns:
Panel | Window - The panel created, either a ScriptUI Panel or a ScriptUI Window.
The resulting object has one custom method: Panel.refreshUI which takes one argument:
a File object which must be the script to reload.
The method returns true on success, false otherwise.
Example
var ui = DuAEF.DuScriptUI.createUI(this,"Test Script");
var refreshButton = ui.add('button',undefined,"Refresh");
refreshButton.onClick = function() { ui.refreshUI( new File($.fileName) ); }; //reloads the current script
DuAEF.DuScriptUI.showUI(ui);

static layout(item)

Resets the layout of the whole ui containing a scriptUI item.
Parameters:
Name Type Description
item ScriptUI The ScriptUI element which needs to be resized

static setBackgroundColor(uiItem, color, adjustedopt)

Changes the color of the background of a ScriptUI Object
Parameters:
Name Type Attributes Default Description
uiItem ScriptUI The ScriptUI Object
color Array The new color [R,V,B,A] Array
adjusted bool <optional>
true lightens the color if the brightness setting of Ae is not set on the darkest one

static setTextColor(text, color, adjustedopt)

Changes the color of the text of a ScriptUI Object
Parameters:
Name Type Attributes Default Description
text ScriptUI The ScriptUI Object
color Array.<float> The new color [R,V,B,A] Array
adjusted bool <optional>
true lightens the color if the brightness setting of Ae is not set on the darkest one

static showAbout()

Shows the about popup

static showHelp()

Shows the help popup

static showNews()

Shows the news popup

static showUI(ui)

Resizes and shows the main panel of a script
Parameters:
Name Type Description
ui Panel | Window The UI created by Duik.ui.createUI

static updateAboutPopup(title, text, link)

Updates the About Popup with new information
Parameters:
Name Type Description
title string A title.
text string The help text.
link string The http link to a webpage

static updateHelpPopup(title, text, link)

Updates the helpPopup with new information
Parameters:
Name Type Description
title string A title.
text string The help text.
link string The http link to a webpage