Script for converting text to shape
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!
