Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions New seed for every copy of template

  • New seed for every copy of template

  • Matthew Boutros

    May 20, 2022 at 3:16 am

    This will probably take some creative thinking.

    1. I have an AE template that is copied and uniquely renamed for each animation/video.
    2. I have a procedural paper texture behind each video (all the effect seeds linked to a controller).
    3. Each video needs to have a new paper texture, and I can’t rely on remembering to hand-change the controller each time.
    4. It must be a different paper texture as they will be compiled later and need to change paper texture as a transition.
    5. How can I make sure it’s a different paper texture for every video/file?

    Is there an expression I could link the seed to the filename? That would be the easiest.

    Possible solutions that have problems:

    • Random seed each time: It could work, but then I have to re-render from scratch and have to re-export the whole thing rather than just part if there’s an error. This may be my best bet, but not sure of the expression needed.
    • Date: I could perhaps link it to the date (if that’s even possible) but then I couldn’t export multiple in one day.
    • Layer order: I can’t rely on this, as plenty of the files will have the same number of layers.

    Thanks so much! Not sure what I’d do without this forum.

  • Filip Vandueren

    May 20, 2022 at 8:18 am

    Once a project is saved it has a thisProject.fullPath


    So maybe something like this:

    fp = thisProject.fullPath.toString();
    hashCode = function(str) {
    var hash = 0, i, chr;
    if (str.length === 0) return hash;
    for (i = 0; i < str.length; i++) {
    chr = str.charCodeAt(i);
    hash = ((hash << 5) - hash) + chr;
    hash |= 0; // Convert to 32bit integer
    }
    return hash;
    };
    hashCode(fp)

    That would change if you move the project to a different folder too though, so you might want to extract just the filename first ?

    Hashing function I found here: https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript

  • Matthew Boutros

    May 21, 2022 at 11:15 pm

    Thanks heaps Filip, I’ve never used Javascript before but I’ll have to give it a go!

Viewing 1 - 3 of 3 posts

Log in to reply.

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