-
Creating a ‘Shy'(hidden) layer through script?
Hey, I’m fairly new to scripting and I’ve scoured the web for this answer and can’t find it, it’s probably something so simple that no-one’s needed to put it out there anywhere, I’ve found in the After Effects Script manual the closest thing being:
“Layer shy attribute
app.project.item(index).layer(index).shy
Description
When true, the layer is “shy,” meaning that it is hidden in the Layer panel if the composition’s “Hide all shy
layers” option is toggled on.”when paired with:
CompItem hideShyLayers attribute
app.project.item(index).hideShyLayers
Description
When true, only layers with shy set to false are shown in the Timeline panel. When false, all layers are visible,
including those whose shy value is true. Corresponds to the value of the Hide All Shy Layers button in the
Composition panel.Which is completely not working for me.
Anyway, here’s the script so far.
Thanks in advance!{
app.beginUndoGroup("Hidden Script");// Selected Composition
var comp = app.project.activeItem;
// Selected Layers
var slctd_layer = comp.selectedLayers;// Create new Solid
var new_layer = comp.layers.addSolid([0,0,0], "Background", comp.width,comp.height,comp.pixelAspect,comp.duration).trackMatteType = TrackMatteType.ALPHA_INVERTED;
;
// Create the letterbox Solid
var hidden_solid= comp.layers.addSolid([0,0,0], "Hidden", 1920, 817, comp.pixelAspect,comp.duration);
// if so move the new Layer on top of the selected one
if ( slctd_layer[0] != null){
//alert (slctd_layer[0].index);
new_layer.moveBefore(slctd_layer[0]);app.endUndoGroup();
}}