Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Extendscript – is FootageItem a layer in a layered PSD

  • Extendscript – is FootageItem a layer in a layered PSD

    Posted by Spencer Tweed on May 5, 2019 at 10:13 pm

    I’m working on a script that does find/replace for missing items in your project. Unfortunately I’m running into a situation replacing layered image sources (psd, ai, etc.) where the usual avItem.replace() function will just replace the item with the whole image, not the layer within the image.

    For example:
    var item = app.project.item(3); //assuming this is the 'layer' we want to replace
    item.replace(new_path)

    Is there a way to determine if an AvItem is a layer in a layered image, and if so is there a clean way to relink it without losing that relationship?

    Thanks,
    Spencer

    Spencer Tweed replied 7 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Tomas Bumbulevičius

    May 6, 2019 at 5:34 pm

    Hey Spencer, one good way to find out whether the item in project panel (AVItem) is actually a separate layer inside the .psd or .ai – by looking into its file name.

    Layered files are separated by the slash in project panel like [layerName]/[fileName].psd.

    One idea I have in mind, but its not tested though – you shouldn’t need to find all missing layers individually – but instead, only do this for one item / file, and then update the missing items array. Chances are it is reduced accordingly.

    Haven’t tried such import/replacement myself, so it’s interesting whether you will find a way to import it.

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.

  • Spencer Tweed

    May 7, 2019 at 12:39 am

    Thanks Tomas,

    Shame there’s nothing better for this, I wish Adobe would expose more information to scripting developers. I made a similar script for Nuke and it was so simple, it only took a handful of lines of code.

    I did use string parsing as you suggest (looking for the slash) but it isn’t a perfect solution. It will work for most cases though, so that combined with a helpful message box is as good as I’m getting until Adobe revamps extendscript I guess!

    – Spencer

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy