FORUMS: list search recent posts

Object FolderItem not correct type error

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jonny Munévar
Object FolderItem not correct type error
on Sep 29, 2014 at 11:59:43 pm

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 Artist

https://vimeo.com/quarkspark


Return to posts index


Dan Ebberts
Re: Object FolderItem not correct type error
on Sep 30, 2014 at 12:11:17 am

My guess is that there's a problem with your loop because myFootage won't be null, even if the correct footage is not found. It should be more like this so that it doesn't disturb the null value in myFootage unless it actually finds what you're looking for:


for (var i = 1; i <= myProject.numItems; i++){
if (myProject.item(i).name == footageName && myProject.item(i) instanceof FootageItem){
myFootage = myProject.item(i);
break;
}
}



Dan



Return to posts index

Jonny Munévar
Re: Object FolderItem not correct type error
on Sep 30, 2014 at 12:25:43 am

Hi Dan!

Thanks for the quick reply!
I've changed the code, but now it doesn't find the Comp "_BG".

Jonny

Jonny Munévar
Motion Graphics & VFX Artist

https://vimeo.com/quarkspark


Return to posts index



Dan Ebberts
Re: Object FolderItem not correct type error
on Sep 30, 2014 at 12:35:10 am

If it's a comp, you should be looking for a CompItem, not a FootageItem.

Dan



Return to posts index

Jonny Munévar
Re: Object FolderItem not correct type error
on Sep 30, 2014 at 12:40:15 am

Dan you're the man!

It works now, thank you very much!!!

I owe you a lunch haha!

Jonny


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]