Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all 2143 articles
Browse latest View live

Bug in renderQueue.outputModule.file; everything after period gets truncated

$
0
0

I wrote a script that takes a video title from the user and will render it (Windows only), with the rendered file having that name.

 

Observe the following code:

 

var renderpath = containingfolder + "\\mxfs\\" + title;
app.project.renderQueue.item(1).outputModule(1).file = File(renderpath);

 

I realized that if the variable title has a period in it, for some reason, the renderQueue output name cuts off everything after the period and then appends the extension of whatever codec I'm using (mxf typically).

 

Here's what I mean; if the user enters this:

 

l7wRNLU.png

 

Then the "title" variable contains is "A Vs. B" (I have verified this through alert(title)), but yet...

OtgmGvl.png

 

Everything after the period gets cut off!  There must be something I'm not understanding, or perhaps this is a bug.  Can somebody please explain why part of the title gets truncated?  How can I fix this?

 

I urge you to try this for yourself.

 

Windows 10 build 14393 and After Effects CC 2014.0 for reference.


pyautogui and extendscript

$
0
0

Hey guys,

I've recently discovered the wonders of Python and pyautogui's gui automation potential, and I'm wondering if I can use it to get around some of the clunkier behaviors of my Extendscripts, when they use menu commands.

 

For example, if one of my scripts uses the collect feature, I'd like to be able to write the destination and press ok.

 

Or when my script needs to automatically save a preset, right now I have to have two dialogs pop up. One with the full path of the preset that my script will assume the new preset's name will be, so the user can copy it, and then the actual save preset dialog that they paste it into. If I were able to automate the gui, only one dialog would be necessary here, and the user wouldn't have to even interact with that one.

 

The problem I'm running into is that I can call a python script while Extendscript is running, but it won't call DURING a dialog. I can call it BEFORE opening these dialogs, or AFTER they close. I could try to get around this by having python call the command from the menu, instead of using Extendscript's app.executeCommand(app.findMenuCommandId, but then I run into the following problem: pyautogui can't interact with AE while an Extendscript is running, just like you can't manually interact with AE while it's running, since you get the spinning wait mouse cursor until it finishes executing.

 

Is there any way around this?

Can't get a property from a XMP sidecar file

$
0
0

I am unable to get a property from an XMP sidecar file. The code snippet below gets the "CreatorTool" property.

The code works if the target file is a JPG, but fails if the target file is a XMP sidecar file.

 

        if ( !ExternalObject.AdobeXMPScript )

            ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

            targetFile = File.openDialog ("Select test file...", "*.xmp,*.jpg", false)

            xmpFile = new XMPFile(targetFile.fsName, XMPConst.XML, XMPConst.OPEN_FOR_READ);

            xmp = xmpFile.getXMP();

                alert(xmp.getProperty(XMPConst.NS_XMP,"CreatorTool"));

            xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);

            unloadXMPLibrary();  

 

I must be missing something. Any ideas?

OMV Files

$
0
0

Hi,

 

So from looking at older information it seems that the Extendscript Toolkit used to have OMV files (xml files containing the extendscript api for each program), I was wondering if anyone would know where I could find them now as they don't appear to be with ESTK 3 in either mac or windows.

 

Thanks in advance.

After Effects 2017 Panel Bootstrap skin + jQuery Spinner plugin

$
0
0

Hi all, been working on this the last couple of days, it's not finished but good enough to share.  I've tried to replicate the current AE 2017 look (default dark theme) where possible:

AE Editor UI 2 - JSFiddle

 

Most of the UI is "hacked" Bootstrap CSS, later I'd like to do this correctly using compiled CSS tools.  The Spinner is implemented as a jQuery plugin and probably needs some work.  The Sliders are a Bootstrap plugin which I've also skinned and need minimal javascript.

 

I'll be posting all this to GitHub soon so everyone can collaborate.  Let me know if there's any commonly used UI elements I've missed.

 

TNKS!

 

Geordie

CEP Panels and import modules

$
0
0

Hey,

 

I'm pretty sure I already know the answer to this question through testing but wanted to make sure, do CEP Panels support import export modules?
From my testing they don't, alot of browsers don't and it looks like the one that runs extensions (built on chromium) is no exception.
Has anyone else tested this?

 

Thanks in advance.

Setting Source Text Resets Justification To Center

$
0
0

In simple terms, I am just trying to change the source text on a left justified text object.  However, it keeps resetting the justification to center, instead of just leaving it.  Even when I try to set it to left as part of the process, it doesn't listen.

 

var textProp = myComp.layer('myTextObject').property("Source Text");

var textDocument = textProp.value;

textDocument.text = strings["name"];

textDocument.justification = ParagraphJustification.LEFT_JUSTIFY;

textProp.setValue(textDocument);

textProp.setValue(textDocument);

 

I was trying to setValue twice because I found a thread about a bug that made you do it twice, but that doesn't work either.

 

I was doing it this way, but switched to the above when I found the issue.

myComp.layer('myTextObject').property("Source Text").setValue(strings["name"]);

 

Any help?  Thanks!

How to make my script dockable?

$
0
0

i made a simple after effects script, and i want to know how to turn it to a dockable script...

when i put it in the scriptsUI folder it just shows me 2 screens...

 

here is the script:

 

 


 

//UI Creation
var myWindow = new Window("palette");
var myMessage = myWindow.add("statictext");




myMessage.text = "תסריט להפיכת טקסט. נעשה על ידי איתי אסולין";

var buttons = myWindow.add("panel", undefined, "buttons");

var HebrewThis = buttons.add("button", undefined, "HebrewThis!");
var Cancel = buttons.add("button", undefined, "Cancel");
buttons.orientation = "row";





//UI Creation End.//



//Function creations

//Hebrew this button
HebrewThis.onClick = function(){





app.beginUndoGroup("AddEffect");

var curItem = app.project.activeItem;

var selectedLayers = curItem.selectedLayers;



// check if comp is selected
if (curItem == null || !(curItem instanceof CompItem)){


// if no comp selected, display an alert
alert("בבקשה בחר שכבה");

} else {

// define the layer in the loop we're currently looking at
var myLayer = app.project.activeItem.layer(1);
var curVal = myLayer.property("Scale").value;
myLayer.property("Scale").setValue([-100, 100]);


var Text = selectedLayers[0].Text.Animators.addProperty("ADBE Text Animator");
myText.property("ADBE Text Selectors").addProperty("ADBE Text Selector");
myText.property("ADBE Text Animator Properties").addProperty("ADBE Text Scale 3D").setValue([-100, 100]);
}

// close the undo group
app.endUndoGroup();
}

   







//Hebrew this button ended.

//cancel button
Cancel.onClick = function(){
           



app.beginUndoGroup("AddEffect");

var curItem = app.project.activeItem;

var selectedLayers = curItem.selectedLayers;



// check if comp is selected
if (curItem == null || !(curItem instanceof CompItem)){


// if no comp selected, display an alert
alert("בבקשה בחר שכבה");

} else {

// define the layer in the loop we're currently looking at
var myLayer = app.project.activeItem.layer(1);
var curVal = myLayer.property("Scale").value;
myLayer.property("Scale").setValue([100, 100]);

var myAnim = selectedLayers[0].Text.Animators.property("ADBE Text Animator");
myAnim.property("ADBE Text Selectors").property("ADBE Text Selector");
myAnim.property("ADBE Text Animator Properties").property("ADBE Text Scale 3D").setValue([100, 100]);
}

// close the undo group
app.endUndoGroup();
    }
.show();
-=

Have Multiple Text Formats Within One Object?

$
0
0

If I manually type in a text object, I can, say, highlight a word and italicize it.  Is there a way to do this in a script while setting the source text?

 

All I could find was this thread: How to have various text styles in a single textbox via scripting

 

... which tells me no, but I'm hoping something might have changed?

 

I want it, because I have the name of an item, which I would like to bold, and then a description under it.

 

Cheers!

Need help editing a script.

$
0
0

I have a script that Jeff Almasol has written at redifinery a while back that I need some help tweaking. This current script is designed to highlight multiple layers that might have different versions of text, effects, adjustment layers, what have you, on each layer and add them to render simultaneously. As different versions activating each layer separately.

 

I am trying to get rid of the indexing number in the naming and also add a Versioning number that would go at the end of the name that could be added in the UI in the script any help would be greatly appreciated.

 

Thanks,

 

My current setup is

 

Creative Cloud 4.8.0.421

Extendscript Toolkit CC version 4.0

After Effects Versions 16.0.1 and 15.1.2

macOS High Sierra 10.13.6 (17G4015)

  Model Name: MacBook Pro

  Model Identifier: MacBookPro14,1

  Processor Name: Intel Core i5

  Processor Speed: 2.3 GHz

  Number of Processors: 1

  Total Number of Cores: 2

  L2 Cache (per Core): 256 KB

  L3 Cache: 4 MB

  Memory: 8 GB

  Boot ROM Version: 184.0.0.0.0

  SMC Version (system): 2.43f6

  Serial Number (system): C02VTE7VHV29

  Hardware UUID: 61EE7213-F183-585E-9129-2EA517412535

 

// rd_RenderLayers.jsx

// Copyright (c) 2006-2013 redefinery (Jeffrey R. Almasol). All rights reserved.

// check it: www.redefinery.com

//

// Name: rd_RenderLayers

// Version: 3.1

//

// Description:

// This script renders each of the selected layers separately. You might

// find this script useful if layers represent different versions of an

// effect or different parts of an effect that you want to render as

// separate "passes" for flexibility in how they get composited.

//

// Rendering uses existing render settings and output module template, so

// be sure to create them beforehand. When you run this script, you can

// select the templates to use; select the range of frames for each selected

// layer to render; control if unselected, adjustment, active camera, and

// light layers should be rendered as well; and define the name for each

// rendered output. Each rendered layer will generate separate "render

// finished" sounds.

//

// The Output Name Template can be defined with the same properties

// available in the File Name Templates dialog box, with the following

// additions:

//    [layerName] - Current layer's name

//    [layerNumber] - Current layer's index number

//

// Note: If you select an output template that uses a single-image

// format (such as Photoshop), be sure to include the [#####] property

// in the Output Name Template.

//

// Note: If the layer is completely outside of the composition time range,

// the layer will not be rendered. However, if you select a range of

// Work Area and the layer is outside of the composition's work area, the

// layer will still be rendered.

//

// The Queue Only option is available only when Layer Range to Render

// is set to Layer In/Out Range or Work Area. Also, this mode creates a

// temp folder (in the same location as the comp) with " - Temp Comps"

// in the name. The comp is duplicated (with incremented comp name)

// to retain the state of each selected layer.

//

// Note: This version of the script requires After Effects CS5

// or later. It can be used as a dockable panel by placing the

// script in a ScriptUI Panels subfolder of the Scripts folder,

// and then choosing this script from the Window menu.

//

// Enhancements requested by Gary Jaeger and James Tobias.

//

// Legal stuff:

// This script is provided "as is," without warranty of any kind, expressed

// or implied. In no event shall the author be held liable for any damages

// arising in any way from the use of this script.

//

// In other words, I'm just trying to share knowledge with and help out my

// fellow AE script heads, so don't blame me if my code doesn't rate. :-)

 

 

 

 

 

 

 

 

// rd_RenderLayers()

//

// Description:

// This function contains the main logic for this script.

//

// Parameters:

// thisObj - "this" object.

//

// Returns:

// Nothing.

//

(function rd_RenderLayers(thisObj)

{

// Globals

 

var rd_RenderLayersData = new Object(); // Store globals in an object

rd_RenderLayersData.scriptName = "rd: Render Layers";

rd_RenderLayersData.scriptTitle = rd_RenderLayersData.scriptName + " v3.1";

 

rd_RenderLayersData.strLayerRange = {en: "Layer Range to Render:"};

rd_RenderLayersData.strLayerRangeOpts = {en: '["Work Area", "Entire Composition", "Layer In/Out Range"]'};

rd_RenderLayersData.strKeepInRender = {en: "Keep in Render:"};

rd_RenderLayersData.strKeepInUnsel = {en: "Unselected layers"};

rd_RenderLayersData.strKeepInAdjust = {en: "Adjustment layers"};

rd_RenderLayersData.strKeepInActiveCam = {en: "Active Camera"};

rd_RenderLayersData.strKeepInLights = {en: "Lights"};

rd_RenderLayersData.strRSTemplate = {en: "Render Settings Template:"};

rd_RenderLayersData.strOMTemplate = {en: "Output Module Template:"};

rd_RenderLayersData.strRefresh = {en: "Refresh"};

rd_RenderLayersData.strOutFolder = {en: "Output Folder:"};

rd_RenderLayersData.strOutFolderBrowse = {en: "Browse..."};

rd_RenderLayersData.strOutName = {en: "Output Name Template:"}

rd_RenderLayersData.strQueueOnly = {en: "Queue Only"};

rd_RenderLayersData.strRender = {en: "Render"};

rd_RenderLayersData.strHelp = {en: "?"};

rd_RenderLayersData.strErrNoCompSel = {en: "Cannot perform operation. Please select or open a single composition in the Project panel, and try again."};

rd_RenderLayersData.strErrNoLayerSel = {en: "Cannot perform operation. Please select at least one layer, and try again."};

rd_RenderLayersData.strMinAE100 = {en: "This script requires Adobe After Effects CS5 or later."};

rd_RenderLayersData.strHelpText =

{

en: "Copyright (c) 2006-2013 redefinery (Jeffrey R. Almasol). \n" +

"All rights reserved.\n" +

"\n" +

"This script renders each of the selected layers separately. You might find this script useful if layers represent different versions of an effect or different parts of an effect that you want to render as separate \"passes\" for flexibility in how they get composited.\n" +

"\n" +

"Rendering uses existing render settings and output module template, so be sure to create them beforehand. When you run this script, you can select the templates to use; select the range of frames for each selected layer to render; control if unselected, adjustment, active camera, and light layers should be rendered as well; and define the name for each rendered output. Each rendered layer will generate separate \"render finished\" sounds.\n" +

"\n" +

"The Output Name Template can be defined with the same properties available in the File Name Templates dialog box, with the following additions:\n" +

"    [layerName] - Current layer's name\n" +

"    [layerNumber] - Current layer's index number\n" +

"\n" +

"Note: If you select an output template that uses a single-image format (such as Photoshop), be sure to include the [#####] property in the Output Name Template.\n" +

"\n" +

"Note: If the layer is completely outside of the composition time range, the layer will not be rendered. However, if you select a range of Work Area and the layer is outside of the composition's work area, the layer will still be rendered.\n" +

"\n" +

"The Queue Only option is available only when Layer Range to Layer In/Out Range or Render is set to Work Area. Also, this mode creates a temp folder (in the same location as the comp) with \" - Temp Comps\" in the name. The comp is duplicated (with incremented comp name) to retain the state of each selected layer.\n" +

"\n" +

"Note: This version of the script requires After Effects CS5 or later. It can be used as a dockable panel by placing the script in a ScriptUI Panels subfolder of the Scripts folder, and then choosing this script from the Window menu.\n" +

"\n" +

"Enhancements requested by Gary Jaeger and James Tobias"

};

 

 

 

 

// rd_RenderLayers_localize()

//

// Description:

// This function localizes the given string variable based on the current locale.

//

// Parameters:

//   strVar - The string variable's name.

//

// Returns:

// String.

//

function rd_RenderLayers_localize(strVar)

{

return strVar["en"];

}

 

 

 

 

// rd_RenderLayers_buildUI()

//

// Description:

// This function builds the user interface.

//

// Parameters:

// thisObj - Panel object (if script is launched from Window menu); null otherwise.

//

// Returns:

// Window or Panel object representing the built user interface.

//

function rd_RenderLayers_buildUI(thisObj)

{

var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", rd_RenderLayersData.scriptName, undefined, {resizeable:true});

 

if (pal !== null)

{

var res =

"group { \

orientation:'column', alignment:['fill','top'], \

header: Group { \

alignment:['fill','top'], \

title: StaticText { text:'" + rd_RenderLayersData.scriptName + "', alignment:['fill','center'] }, \

help: Button { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strHelp) +"', maximumSize:[30,20], alignment:['right','center'] }, \

}, \

r1: Group { \

alignment:['fill','top'], \

layerRange: StaticText { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strLayerRange) + "' }, \

layerRangeList: DropDownList { properties:{items:" + rd_RenderLayers_localize(rd_RenderLayersData.strLayerRangeOpts) + "}, alignment:['fill','top'], preferredSize:[-1,20] }, \

}, \

r2: Group { \

alignment:['fill','top'], \

keepInRender: StaticText { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strKeepInRender) + "' }, \

keepInUnsel: Checkbox { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strKeepInUnsel) + "', value:false }, \

keepInAdjust: Checkbox { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strKeepInAdjust) + "', value:true }, \

}, \

r3: Group { \

alignment:['fill','top'], \

keepInActiveCam: Checkbox { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strKeepInActiveCam) + "', value:true }, \

keepInLights: Checkbox { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strKeepInLights) + "', value:true }, \

}, \

r4: Group { \

alignment:['fill','top'], \

r4left: Group { \

orientation:'column', alignment:['fill','center'], \

r4top: Group { \

alignment:['fill','top'], \

rsTpl: StaticText { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strRSTemplate) + "' }, \

rsTplList: DropDownList { alignment:['fill','top'], alignment:['fill','top'], preferredSize:[-1,20] }, \

}, \

r4btm: Group { \

alignment:['fill','top'], \

omTpl: StaticText { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strOMTemplate) + "' }, \

omTplList: DropDownList { alignment:['fill','top'], alignment:['fill','top'], preferredSize:[-1,20] }, \

}, \

}, \

refresh: Button { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strRefresh) + "', alignment:['right','center'], preferredSize:[-1,20] }, \

}, \

r5: Group { \

alignment:['fill','top'], \

outFolder: StaticText { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strOutFolder) + "' }, \

outFolderName: EditText { text:'', characters:20, alignment:['fill','top'], preferredSize:[-1,20] }, \

outFolderBrowse: Button { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strOutFolderBrowse) + "', alignment:['right','top'], preferredSize:[-1,20] }, \

}, \

r6: Group { \

alignment:['fill','top'], \

outName: StaticText { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strOutName) + "' }, \

outNameTpl: EditText { text:'[compName]_[layerName].[fileExtension]', characters:20, alignment:['fill','top'], preferredSize:[-1,20] }, \

}, \

cmds: Group { \

alignment:['right','top'], \

queueOnlyBtn: Button { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strQueueOnly) + "', preferredSize:[-1,20] }, \

renderBtn: Button { text:'" + rd_RenderLayers_localize(rd_RenderLayersData.strRender) + "', preferredSize:[-1,20] }, \

}, \

}";

pal.grp = pal.add(res);

 

pal.grp.r1.layerRange.preferredSize.width =

pal.grp.r2.keepInRender.preferredSize.width =

pal.grp.r4.r4left.r4btm.omTpl.preferredSize.width =

pal.grp.r5.outFolder.preferredSize.width =

pal.grp.r6.outName.preferredSize.width =

pal.grp.r4.r4left.r4top.rsTpl.preferredSize.width;

pal.grp.r3.margins.left = pal.grp.r4.r4left.r4top.rsTpl.preferredSize.width + pal.grp.r2.spacing;

 

pal.grp.r3.keepInActiveCam.preferredSize.width = pal.grp.r2.keepInUnsel.preferredSize.width;

 

pal.grp.r4.r4left.r4btm.margins.top -= 5;

pal.grp.cmds.margins.top += 5;

 

pal.layout.layout(true);

pal.grp.minimumSize = pal.grp.size;

pal.layout.resize();

pal.onResizing = pal.onResize = function () {this.layout.resize();}

 

pal.grp.r1.layerRangeList.selection = 0;

pal.grp.r1.layerRangeList.onChange = function ()

{

// Enable the Queue Only button only if using Work Area

this.parent.parent.cmds.queueOnlyBtn.enabled = (this.selection.index === 0) || (this.selection.index === 2);

}

 

pal.grp.r4.refresh.onClick = function ()

{

rd_RenderLayers_doRefreshTemplates(this.parent.parent.parent);

}

pal.grp.r5.outFolderBrowse.onClick = function ()

{

var defaultFolder = this.parent.outFolderName.text;

if ($.os.indexOf("Windows") !== -1) // On Windows, escape backslashes first

defaultFolder = defaultFolder.replace("\\", "\\\\");

 

var folder = Folder.selectDialog("Output To Folder", defaultFolder);

if (folder !== null)

this.parent.outFolderName.text = folder.fsName;

}

 

pal.grp.header.help.onClick = function () {alert(rd_RenderLayersData.scriptTitle + "\n" + rd_RenderLayers_localize(rd_RenderLayersData.strHelpText), rd_RenderLayersData.scriptName);}

pal.grp.cmds.queueOnlyBtn.onClick = function () {rd_RenderLayers_doRenderLayers(this.parent.parent, false);}

pal.grp.cmds.renderBtn.onClick = function () {rd_RenderLayers_doRenderLayers(this.parent.parent, true);}

 

pal.grp.cmds.margins.top += 5;

}

 

return pal;

}

 

 

 

 

// rd_RenderLayers_doRefreshTemplates()

//

// Description:

// This callback function rescans the render settings and output module templates,

// updating the user interface.

//

// Parameters:

//   pal - Window object representing the palette.

//

// Returns:

// Nothing.

//

function rd_RenderLayers_doRefreshTemplates(pal)

{

var activeComp = app.project.activeItem;

 

if ((activeComp === null) || !(activeComp instanceof CompItem))

{

alert(rd_RenderLayers_localize(rd_RenderLayersData.strErrNoCompSel));

return;

}

 

pal.grp.r4.r4left.r4top.rsTplList.selection = null;

pal.grp.r4.r4left.r4top.rsTplList.removeAll();

 

 

pal.grp.r4.r4left.r4btm.omTplList.selection = null;

pal.grp.r4.r4left.r4btm.omTplList.removeAll();

 

// Get the list of render settings and output module templates

// (Need to add a dummy comp to the render queue to do this)

var rqi = app.project.renderQueue.items.add(activeComp);

var om = rqi.outputModule(1); // Assumes at least one output module

 

for (var i=0; i<rqi.templates.length; i++)

if (rqi.templates[i].indexOf("_HIDDEN") !== 0) // Don't add hidden templates, like for X-Factor

pal.grp.r4.r4left.r4top.rsTplList.add("item", rqi.templates[i]);

for (var i=0; i<om.templates.length; i++)

if (om.templates[i].indexOf("_HIDDEN") !== 0) // Don't add hidden templates, like for X-Factor

pal.grp.r4.r4left.r4btm.omTplList.add("item", om.templates[i]);

 

if (rqi.templates.length > 0) // Select the first template in the list, if there is at least one

pal.grp.r4.r4left.r4top.rsTplList.selection = 0;

if (om.templates.length > 0)

pal.grp.r4.r4left.r4btm.omTplList.selection = 0;

 

rqi.remove(); // Remove the temp render queue item

}

 

 

 

 

// rd_RenderLayers_doRenderLayers()

//

// Description:

// This callback function performs the main operation of rendering each selected

// layer.

//

// Parameters:

//   groupObj - Group object containing the controls in the panel.

//   doRender - Boolean controlling if we should actually render or just add to the render queue.

//

// Returns:

// Nothing.

//

function rd_RenderLayers_doRenderLayers(groupObj, doRender)

{

var layerRange = groupObj.r1.layerRangeList.selection.index;

var keepUnselLayers = groupObj.r2.keepInUnsel.value;

var keepAdjLayers = groupObj.r2.keepInAdjust.value;

var keepActiveCam = groupObj.r3.keepInActiveCam.value;

var keepLights = groupObj.r3.keepInLights.value;

var rsTpl = groupObj.r4.r4left.r4top.rsTplList.selection;

var omTpl = groupObj.r4.r4left.r4btm.omTplList.selection;

var outFolder = groupObj.r5.outFolderName.text;

var outName = groupObj.r6.outNameTpl.text;

 

// Encapsulate all operations into a single undo event

app.beginUndoGroup(rd_RenderLayersData.scriptName);

 

var comp = app.project.activeItem;

 

// Confirm that we still have selected layers in the current comp

if ((comp === null) || !(comp instanceof CompItem))

{

alert(rd_RenderLayers_localize(rd_RenderLayersData.strErrNoCompSel));

return;

}

else if (comp.selectedLayers.length === 0)

{

alert(rd_RenderLayers_localize(rd_RenderLayersData.strErrNoLayerSel));

return;

}

 

// Remember the on/off/selected states of the layers in the comp

var layerStates = new Array();

var selectedLayerIndices = new Array();

var layer, state, layerIndex;

 

for (var i=1; i<=comp.numLayers; i++)

{

layer = comp.layer(i);

state = "";

 

if (layer.hasVideo && layer.enabled)

state += "v";

if (layer.hasAudio && layer.audioEnabled)

state += "a";

if ((layer.property("zoom") !== null) && layer.enabled) // Camera layers (c = visible)

state += "c";

if ((layer.property("intensity") !== null) && layer.enabled) // Light layers (l = visible)

state += "l";

if (layer.adjustmentLayer && layer.enabled) // Adjustment layers (j = visible)

state += "j";

if (layer.selected)

{

state += "s";

selectedLayerIndices[selectedLayerIndices.length] = layer.index;

}

 

layerStates[layerStates.length] = state;

}

 

// If using Queue Only, save the current state of the comp as a temp so that the RQ item represents the selection

if (!doRender)

var queueOnlyFolder = comp.parentFolder.items.addFolder(comp.name + " - Temp Comps"); // Create in same folder as comp

 

// Turn off any unselected layers, if not needing them for the render

var noPrevCams = true; // Switch to false once we encounter the first (active) camera

 

if (!keepUnselLayers)

{

for (var i=0; i<layerStates.length; i++)

if (layerStates[i].indexOf("s") === -1) // Check if not selected

{

layer = comp.layer(i+1);

 

// Skip turning off the active camera, lights, or adjustment layers, if enabled and requested to do so

if ((layer.property("zoom") !== null) && layer.enabled)

{

if (keepActiveCam && noPrevCams)

continue;

 

noPrevCams = false; // Keep track of topmost cam

}

else if ((layer.property("intensity") !== null) && layer.enabled && keepLights)

continue;

else if (layer.adjustmentLayer && layer.enabled && keepAdjLayers)

continue;

 

layer.enabled = false;

layer.audioEnabled = false;

}

}

 

// Turn off all selected layers (in preparation for the per-layer rendering to come)

for (var i=0; i<selectedLayerIndices.length; i++)

{

comp.layer(selectedLayerIndices[i]).enabled = false;

comp.layer(selectedLayerIndices[i]).audioEnabled = false;

}

 

// Remember the states of all renderable render queue items; turning off any that are to render

var rq = app.project.renderQueue;

var rqiStates = new Array();

 

for (var i=1; i<=rq.numItems; i++)

if (rq.item(i).render && (rq.item(i).status === RQItemStatus.QUEUED))

{

rqiStates[rqiStates.length] = i;

rq.item(i).render = false;

}

 

// Remember the current work area, in case it gets reset during rendering

var workAreaStart = comp.workAreaStart;

var workAreaDuration = comp.workAreaDuration;

var workAreaIsSingleFrame = (comp.workAreaDuration === comp.frameDuration);

 

// Set the work area to the full comp (if needed)

if (layerRange === 1) // Entire Composition

{

comp.workAreaStart = 0;

comp.workAreaDuration = comp.duration - 0.001; // Seems to need some slop to avoid workAreaDuration range errors...odd

}

 

// Process each selected layer

var rqi, om, outFName;

var rangeIn, rangeOut;

 

for (var i=0; i<selectedLayerIndices.length; i++)

{

layerIndex = selectedLayerIndices[i];

layer = comp.layer(layerIndex);

 

// If layer is out of range of the comp, skip it

if (layer.stretch > 0)

{

if ((layer.outPoint < 0) || (layer.inPoint > comp.duration))

continue;

}

else

{

if ((layer.inPoint < 0) || (layer.outPoint > comp.duration))

continue;

}

 

// Enable the current layer

if (layerStates[layerIndex-1].indexOf("v") !== -1)

layer.enabled = true;

if (layerStates[layerIndex-1].indexOf("a") !== -1)

layer.audioEnabled = true;

 

// If using Queue Only, save the current state of the comp as a temp so that the RQ item represents the selection

if (!doRender)

{

var compQueued = queueOnlyComp = comp.duplicate();

queueOnlyComp.parentFolder = queueOnlyFolder; // Move duped comp into temp folder

}

else {

var compQueued = comp;

}

// Add comp to the render queue

rqi = rq.items.add(compQueued);

 

// Set the comp work area to the layer range (if needed)

if (layerRange === 2) // Layer In/Out Range

{

if (layer.stretch > 0)

{

rangeIn = (layer.inPoint < 0) ? 0 : layer.inPoint;

rangeOut = (layer.outPoint > compQueued.duration) ? compQueued.duration : layer.outPoint;

}

else

{

rangeIn = (layer.outPoint < 0) ? 0 : layer.outPoint;

rangeOut = (layer.inPoint > compQueued.duration) ? compQueued.duration : layer.inPoint;

}

 

compQueued.workAreaStart = 0; // Set to min size first, then resize -- to avoid problems setting range

compQueued.workAreaDuration = compQueued.frameDuration;

/*

$.writeln(rangeIn+" to "+rangeOut+" (dur: "+(rangeOut-rangeIn)+")");

$.writeln("  comp: 0 to "+comp.duration);

$.writeln("  workAreaStart="+comp.workAreaStart+", workAreaDuration="+comp.workAreaDuration+", frameDuration="+comp.frameDuration);

$.writeln("  workAreaDiff-rangeDiff="+(workAreaDuration-(rangeOut-rangeIn)));

*/

 

compQueued.workAreaStart = rangeIn;

if ((rangeOut - rangeIn - compQueued.frameDuration) > 0.0001) // special-case layer in/out range being one frame to avoid precision problems

compQueued.workAreaDuration = parseInt((rangeOut - rangeIn) * 1000) / 1000;

}

 

// Set templates and output file name

rqi.applyTemplate(rsTpl);

om = rqi.outputModule(1);

om.applyTemplate(omTpl);

 

outFName = outName;

outFName = outFName.replace("[layerName]", layer.name);

outFName = outFName.replace("[layerNumber]", layer.index);

om.file = new File(outFolder + "/" + outFName);

 

// Render (if actually clicked Render)

if (doRender)

app.project.renderQueue.render();

 

// Remove render queue item

//rqi.remove();

 

// Disable the current layer

layer.enabled = false;

layer.audioEnabled = false;

}

 

// Restore the work area (if modified)

if (layerRange !== 0) // Entire Composition or Layer In/Out Range

{

comp.workAreaStart = 0; // Set to max size first, then shrink down -- to avoid problems setting range

// comp.workAreaDuration = parseInt(comp.frameDuration * 1000) / 1000;

 

comp.workAreaStart = workAreaStart;

if (!workAreaIsSingleFrame) // Avoid setting to a single frame -- seems to be sensitive to setting to a single frame duration

comp.workAreaDuration = workAreaDuration;

}

 

// Restore any forceably unqueued render queue items

for (var i=0; i<rqiStates.length; i++)

rq.item(rqiStates[i]).render = true;

 

// Restore any selected layers

for (var i=0; i<selectedLayerIndices.length; i++)

{

layerIndex = selectedLayerIndices[i];

if (layerStates[layerIndex-1].indexOf("v") !== -1)

comp.layer(layerIndex).enabled = true;

if (layerStates[layerIndex-1].indexOf("a") !== -1)

comp.layer(layerIndex).audioEnabled = true;

}

 

// Restore any unselected layers, if previously turned off

if (!keepUnselLayers)

{

for (var i=0; i<layerStates.length; i++)

if (layerStates[i].indexOf("s") === -1) // Check if not selected

{

layer = comp.layer(i+1);

 

if ((layerStates[i].indexOf("v") !== -1) || (layerStates[i].indexOf("c") !== -1) || (layerStates[i].indexOf("l") !== -1) || (layerStates[i].indexOf("j") !== -1))

layer.enabled = true;

if (layerStates[i].indexOf("a") !== -1)

layer.audioEnabled = true;

}

}

 

app.endUndoGroup();

 

// Purge the undo cache to work around an issue with changing a layer or undoing after a render

app.purge(PurgeTarget.UNDO_CACHES);

}

 

 

 

 

// main code:

//

 

// Prerequisites check

if (parseFloat(app.version) < 10.0)

alert(rd_RenderLayers_localize(rd_RenderLayersData.strMinAE100), rd_RenderLayersData.scriptName);

else

{

var activeComp = app.project.activeItem;

 

// Don't show the palette if no comp is active

if ((activeComp === null) || !(activeComp instanceof CompItem))

alert(rd_RenderLayers_localize(rd_RenderLayersData.strErrNoCompSel));

else if (activeComp.selectedLayers.length === 0)

alert(rd_RenderLayers_localize(rd_RenderLayersData.strErrNoLayerSel));

else

{

// Build and show the palette

var rdrlPal = rd_RenderLayers_buildUI(thisObj);

if (rdrlPal !== null)

{

// Get the list of render settings and output module templates

rd_RenderLayers_doRefreshTemplates(rdrlPal);

 

if (rdrlPal instanceof Window)

{

// Show the palette

rdrlPal.center();

rdrlPal.show();

}

else

rdrlPal.layout.layout(true);

}

}

}

})(this);

Tabbed Panel Inside of Window, Won't Re-Launch After Close

$
0
0

I'm working on a script that includes a "Settings Window". This settings window contains a tabbed panel.

 

When I launch the "Settings Window" from the docked panel for the first time, the tabbed panel appears and works as desired.

 

If the window is then closed using the red X in the window native UI, the next time I launch the settings window from the docked panel, the tabbed panel no longer appears and I encounter errors.

 

I also have buttons (Save/Cancel/Run) included in the window UI that hide the "Settings Window" - when one of these buttons are used (instead of the native UI close button), the Settings window can be re-launched and the tabbed panel is still in tact. I changed the "panels" to groups just to confirm that this was indeed the issue and sure enough, the groups were still present on relaunch.

 

Anyone encounter this issue before? I can't figure out a way around, aside from dropping the tabbed panel.

 

 

I tried to intercept the onClose event, so I could use .hide() instead of .close(), but I'm unable to stop that event of closing the window with stopPropegation or preventDefault.

 

 

Code:

  //Create Main Settings Window            mainSettingsDlgGroup = "palette {size:[450,500],preferredSize:[450,500],\               tabButtonGroup: Group{orientation:'stack',alignChildren:['left','top'],alignment:['left','top'],preferredSize:[450,-1]\                    updatingButtons: Group{orientation:'row',alignChildren:['left','top'],alignment:['fill','top'],preferredSize:[425,-1],margins:[20,20,20,20],\                         cancelButton: Button{text:'Cancel'},alignment:['left','top'],\                         saveButton: Button{text:'Save'},alignment:['left','top'],\                         saveRunButton: Button{text:'Save & Run'},alignment:['left','top'],\                   },\          },\          tabGroup: Group{orientation:'row',alignChildren:['left','top'],alignment:['fill','top'],margins:[10,5,0,0],\               tabbedPanel: Panel{type:'tabbedpanel',margins:[20,20,20,20],\                    panelOne: Panel{type:'tab',text:'Panel One', orientation:'column',alignChildren:['left', 'top'],margins:[20,20,20,20],\                         checkboxOne: Checkbox{text:'option one'},\                         checkboxTwo: Checkbox{text:'option two'},\                    },\                    panelTwo: Panel{type:'tab',text:'Panel Two', orientation:'column',alignChildren:['left', 'top'],margins:[20,20,20,20],\                         checkboxOne: Checkbox{text:'option one'},\                         checkboxTwo: Checkbox{text:'option two'},\                    },\                    panelThree: Panel{type:'tab',text:'Panel Three', orientation:'column',alignChildren:['left', 'top'],margins:[20,20,20,20],\                         checkboxOne: Checkbox{text:'option one'},\                         checkboxTwo: Checkbox{text:'option two'},\                    },\               },\          },\     }" 
settingsWin = new Window( mainSettingsDlgGroup );

var tabbedPanel = settingsWin.tabGroup.TabbedPanel;

//Close Function
function closeSettings() {
     settingsWin.hide();
}

//Open Function 
function openSettings() {
     try{          if(tabbedPanel == null) {                alert('tabbedPanel is null'); // Alert does not run, is not return NULL            }          settingsWin.center();          settingsWin.show();          //tabbedPanel.show(); // commented out as it does not seem to have any effect (also I'm never hiding the tabbedPanel)          //tabbedPanel.maximumSize = [1000,1000];          settingsWin.layout.layout(true);          //updateUILayout(settingsWin); //commented out as it does not work and throws and error on re-launch          tabbedPanel.selection = tabbedPanel.children[0];      } catch(err){alert('error from openSettings ' + err.line + '\n' + err.message);}
}

 

The Try/Catch throws the following error (on relaunch AFTER AE UI close red X is used):

"Window layout failed

-Group layout failed

-Panel layout failed

-cannot get value of maximumSize property for tab: "

How to change size and color of "staticText"??

$
0
0

Can someone plz share how to change size and color of "staticText" object??

 

 

 

function buildUI(thisObj) {

 

var myPanel = (thisObj instanceof Panel) ? thisObj:new Window('palette', 'Stress Reducers',undefined, {resizable: true});

 

var txt=myPanel.add("staticText",[0,0,100,20],"txt");

 

//txt. newFont, fontSize,color?????

 

 

  return myPanel;

 

}

 

 

var myToolsPanel = buildUI(this);

UI Edittext appearance

$
0
0

If I add an expression control Slider effect to a layer, the value of the slider appears as a link that you can either drag your mouse across to edit, or click to change it to an edittext- type field. When I add an edittext to a UI window, it's just the edittext field. I'm wondering if it's possible to mimic the expression control value behavior. I've looked through the ScriptUI For Dummies and the Javascript Tools Guide and can't figure out if it's possible. Not necessary, but it's a nice UI feature. Anybody have any idea if it can be done?

If/else issue since upgrading to CC19 (v16.0)

$
0
0

I just upgraded from AE 15.1.2, and I'm finding that this expression isn't working in v16.0. Does anyone know if there's a change to the way this needs to be written in v16.0?

 

I've got multiple layers, and I'm controlling which layer's opacity is at 100% by changing values on a slider (named Slider Control" that's on Null 1. Here's the expression that says if Slider Control is set to 1, then the opacity for the layer is 100, and if not, then it is 0:

 

if(thisComp.layer("Null 1").effect("Slider Control")("Slider")==1) 100 else 0

 

Opening a project that was made last week in AE 15.1.2, the expression hasn't changed at all, yet works perfectly. But the same expression used in a new project gives this error:

 

“Undefined value used in expression (could be an out of range array subscript?, an expression was disabled as a result of an error.”

 

I can't find any information on changes to expressions that will allow me to figure out how to get this to work in v16.0. Any help is appreciated!

Close folder using script

$
0
0

Hi all,

 

          I'm new to after effects scripting. I need to close folder using script. Is this possible? if yes, Could somebody send code for that?

 

Before,

before.PNG

after,

after.PNG

I need like this.

 

Regards,

Sasi


AE_CS6 Scripting

$
0
0

Hello everybody, I hope you are all doing great.

In After Effects cs6 scripting guide, it says that the attribute "numProperties" returns the number of indexed properties within a group of properties, and because of so when it is used with layers it will return a value of 3 corresponding to the groups of "effects", "masks", and "motion tracker".

guideshot.png

but whenever i try it with any layer or any group of properties it returns the number of all the children within. this confuses me, makes me work without confidence.

 

[This post moved from After Effects to After Effects Scripting by Moderator]

 

Script Premiere to After Effects slideshow not work

How to add negative leading for a TextBox

$
0
0

It seems that Leading for text cannot be negative.  The Character panel does not allow negative numbers for Leading and negative values set via script generate an exception.  Does anyone know of a way to decrease the space between lines of text in a TextBox (i.e. paragraph text)?

symlink script #include file not work

$
0
0

on macOS

 

ln -s A.jsx

ln -s B.jsxinc

 

to scriptUI folder.

 

symlink ( ln -s ) a  set  of script A which has #include B.jsxinc to scriptUI folder ,

 

when running the script A, it will alert B.jsxinc not exist.

Any way to face track in a script?

$
0
0

I have about 400 ten second clips that I need face tracks for, and I'm trying to script a face track on each. I can access each video as a layer and create the mask programmatically, but when it comes to actually running the track, will I have to do it manually?

 

Thanks for reading!

Viewing all 2143 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>