Skip to content

Instantly share code, notes, and snippets.

@aescripts
Last active May 5, 2023 15:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aescripts/ed4f3e615285796c63821176b6ea4a3e to your computer and use it in GitHub Desktop.
Save aescripts/ed4f3e615285796c63821176b6ea4a3e to your computer and use it in GitHub Desktop.
#AfterEffects #Script #KBar #Scriptlet Solid Settings Changer
// Solid Settings Changer
// Select items in the Project panel
// Enter new dimensions and click Do it!
// ©2020 Lloyd Alvarez https://aescripts.com/
la_SolidSettingsChanger(this);
function la_SolidSettingsChanger(thisObj) {
var scriptName = "Solid Settings Changer";
var scriptVersion = "1.0";
var myPalette = buildUI1(thisObj);
if (myPalette != null && myPalette instanceof Window) {
// This is where you would launch your main function directly for when the script is launched from KBar or other launchers
// or show the paletter with:
myPalette.show();
}
function buildUI1(thisObj) {
var myPal = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName + " v" + scriptVersion, undefined, { resizeable: true });
if (myPal != null) {
var res =
"group { \
alignment: ['fill','fill'], \
alignChildren: ['left','top'], \
orientation: 'column', \
staticTxt: StaticText {text:'Enter new solid dimensions'}, \
sizegrp:Group {\
alignment:['fill','top'], \
alignChildren:['left','top'], \
orientation:'row', \
Xgrp:Group {\
alignment:['fill','top'], \
alignChildren:['left','top'], \
orientation:'row', \
txtX: StaticText {text:'X',preferredSize:[10,-1]}, \
sizeX:EditText {alignment: ['fill','top']}, \
}\
Ygrp:Group {\
alignment:['fill','top'], \
alignChildren:['left','top'], \
orientation:'row', \
txtY: StaticText {text:'Y',preferredSize:[10,-1]}, \
sizeY:EditText {alignment: ['fill','top']}, \
}\
}\
btn: Button {text: 'Do It', alignment: ['right','top']} , \
}";
myPal.grp = myPal.add(res);
myPal.grp.btn.onClick = function () {
app.beginUndoGroup(scriptName);
var x = parseFloat(myPal.grp.sizegrp.Xgrp.sizeX.text);
var y = parseFloat(myPal.grp.sizegrp.Ygrp.sizeY.text);
for (var i = 0; i < app.project.selection.length; i++) {
var curItem = app.project.selection[i];
if (curItem instanceof FootageItem && curItem.mainSource instanceof SolidSource) {
curItem.width = x;
curItem.height = y;
}
}
app.endUndoGroup();
}
myPal.layout.layout(true);
myPal.layout.resize();
myPal.onResizing = myPal.onResize = function () { this.layout.resize(); }
}
return myPal;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment