Copy link to clipboard
Copied
We are 3 guys working in AE and I want to set up an independent machine for rendering.
The only drawback is missing fonts breaking the renders.
What I want to achieve is that when any of us wants to render on remote machine:
1. Run a script that convert all text layers to shapes
2. Use watch folders
Part 2 is ok, but I´ve gotten stuck on the script.
I use the AE Beta.
Script search through all comps in project in search for text layers to convert.
Inside a comp it executes:
1. deselect any layer
2. find a text layer that is not locked or hidden
3. create shape of text
4. deselect all layers
5. find next text layer and repeat
Script:
// Loop through all compositions in the project
for (var i = 1; i <= app.project.numItems; i++) {
var currentItem = app.project.item(i);
// Check if the item is a composition
if (currentItem instanceof CompItem) {
var textLayerFound = false;
// Loop through all layers in the composition
for (var j = 1; j <= currentItem.layers.length; j++) {
var currentLayer = currentItem.layers[j];
// Deselect all layers
for (var k = 1; k <= currentItem.layers.length; k++) {
currentItem.layers[k].selected = false;
}
// Check if the layer is a visible, unlocked text layer
if (currentLayer instanceof TextLayer && currentLayer.enabled && !currentLayer.locked && !textLayerFound) {
app.beginUndoGroup("Convert Text to Shape");
// Select the text layer
currentLayer.selected = true;
// Execute the code to duplicate and convert the layer
app.executeCommand(3781); // Convert to Shape
app.endUndoGroup();
textLayerFound = true;
}
}
}
}
So far it´s converting first text layer, but only in the comp that´s active. If the active comp got more thn one text layer, only the first is converted.
All help appreciated!
I'm not sure what you were trying to do with textLayerFound, but of course once you have found one you specifically lock it out from converting any more layers by checking !textLayerFound. You can use .openInViewer() to open a comp, which you will need to do as any executeCommand just mimics a manual user interaction so requires everything to be arranged just like it would be if done manually.
I've also made it so it instead tests if any text layer has been converted in order to start a single u
...Copy link to clipboard
Copied
I'm not sure what you were trying to do with textLayerFound, but of course once you have found one you specifically lock it out from converting any more layers by checking !textLayerFound. You can use .openInViewer() to open a comp, which you will need to do as any executeCommand just mimics a manual user interaction so requires everything to be arranged just like it would be if done manually.
I've also made it so it instead tests if any text layer has been converted in order to start a single undo group then know at the end if that happened and it needs to close the group. And I moved the variable declarations to the start just to avoid you repeatedly declaring j and k on subsequent loops.
var i, j, k;
var startedUndo = false;
// Loop through all compositions in the project
for (i = 1; i <= app.project.numItems; i++) {
var currentItem = app.project.item(i);
// Check if the item is a composition
if (currentItem instanceof CompItem) {
currentItem.openInViewer();
// Loop through all layers in the composition
for (j = 1; j <= currentItem.layers.length; j++) {
var currentLayer = currentItem.layers[j];
// Deselect all layers
for (k = 1; k <= currentItem.layers.length; k++) {
currentItem.layers[k].selected = false;
}
// Check if the layer is a visible, unlocked text layer
if (currentLayer instanceof TextLayer && currentLayer.enabled && !currentLayer.locked) {
if (!startedUndo) {
app.beginUndoGroup("Convert Text to Shape");
startedUndo = true;
}
// Select the text layer
currentLayer.selected = true;
// Execute the code to duplicate and convert the layer
app.executeCommand(3781); // Convert to Shape
}
}
}
}
if (startedUndo) app.endUndoGroup();
Copy link to clipboard
Copied
Thanks so much Paul!!!
Your version made the script do EXACTLY as I wanted 🙂
Copy link to clipboard
Copied
The recently released property now in Beta app.fonts.missingOrSubstitutedFonts may be helpful to at least know that a font is missing.
Douglas Waterfall
After Effects Engineering
Copy link to clipboard
Copied
app.fonts? That's amazing! You've added my entire feature request from a month ago?
Is there some other way I might have found out about that rather than simply your chance post here?
Very excited as I have plans for this!
Paul
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It seems I wasn't subscribed to those particular forums!?! Fixed that. Thanks.