-
Object FolderItem not correct type error
Hi guys!
I need help with this script, actually is my first script for after effects, so i guess i might me making a noobie mistake but i haven’t found the solution to this yet.
The issue that I’m having is that when i try to import the Comp from the project panel called _BG, that has a footage in it, the script in the line 29: myComp.layers.add(myFootage); says that the object FolderItem is not the correct type. Before in the same Comp I had a solid layer, and the script doesn’t show an error, but doesn’t place the comp, but the solid layer instead.
After that i will try to make that the script works through all the selected comps in the project panel, so it would be very appreciated if you guys can point me in any direction in order to do that.
Everything else is working fine.
{
//CREATE UNDO GROUP
app.beginUndoGroup("Fotos");{
var footageName = "_BG";
var myProject = app.project;
var myFootage = null;
var myComp = app.project.activeItem;
var thisLayer = myComp.layer(1);thisLayer.Effects.property(1).remove();
thisLayer.duplicate();
// script assumes destination comp is selected
// find the footage item
for (var i = 1; i <= myProject.numItems; i++){
myFootage = myProject.item(i);
if (myFootage.name == footageName && myFootage instanceof FootageItem){
break;
}
}if (myFootage == null){
alert ("Can't find " + footageName);
}else{
myComp.layers.add(myFootage);
myComp.layer(1).opacity.setValue([0]);
myComp.layer(1).moveToEnd();
}
}//
var myLayer1 = myComp.layer(1);
var myLayer2 = myComp.layer(2);myLayer1.mask(1).maskMode = MaskMode.ADD;
myLayer1.mask(1).property("maskFeather").setValue([2,2]);
myLayer1.property("Effects").addProperty("Light Wrap").property("Width").setValue(100);
myLayer1.property("Effects").property("Light Wrap").property("Background Layer").setValue(3);
myLayer1.property("Effects").property("Light Wrap").property("Composite Mode").setValue(12);
myLayer1.property("Effects").addProperty("Matte Choker").property("Geometric Softness 1").setValue(10);
myLayer1.property("Effects").property("Matte Choker").property("Gray Level Softness 1").setValue(.25);myLayer2.mask(1).maskMode = MaskMode.SUBTRACT;
myLayer2.mask(1).property("maskFeather").setValue([2,2]);
myLayer2.mask(1).property("maskExpansion").setValue(-8);
myLayer2.property("Effects").addProperty("Brightness & Contrast").property("Contrast").setValue(25);
myLayer2.blendingMode = BlendingMode.MULTIPLY;
//myLayer2.trackMatteType = TrackMatteType.ALPHA_INVERTED;
myLayer2.scale.setValue([99,99]);//UNDO END
app.endUndoGroup();
}
Any help is very much appreciated, thanks in advance!!
And you guys rock! This is a very helpful forum, I’ve been learning a lot from you guys!
Jonny Munévar
Motion Graphics & VFX Artisthttps://vimeo.com/quarkspark