How to Duplicate AE Comp that has expressions
First off thanks for taking the time to review my question, all help is immensely appreciated. I've been building my first AE template project, it is a slideshow/opener and I'm running into some problems with expressions. Specifically I have several effect controllers that control various effects like BG color with expressions. All controls work perfectly. BUT if a client buys the template and wants to duplicate comp, to add more slides to the slide show, then the expressions still reference the original comp not the new comp. I'm pretty new to expressions, and have been searching forums for a few days to find a way where a client can duplicate a comp and have the expressions reference the new duplicate comp so they do not run into expression error. In general whats a good way to set up your slideshow template so that the various slides/scenes can be duplicated without causing expression errors.
To be more specific I call my main comp "Render". Inside of Render are my various slide comps, arranged in a modular structure. Inside each slide I have a null layer named "Effects Controller". when pickwhipping attributes to the controllers on the layer "Effects Controller" which is always the first layer, I have updated the expression so that it refers to the index of the layer not name,
thisComp.layer(1).effect("Text 08 Animation Shadow")("Shadow Color") which works just fine, except for nested precomps. I have several nested precomps that have color shapes inside of them, and I have the "fill" of each shape pickwhipped to a color controller on the effects controller layer, but because they reside in a precomp, using thisComp.layer(1) obviously wont work. Thus Ill have to refer to the comp by name, which wont update if the comp is duplicated. I'm sure there is an easy solution I have not thought about, but any ideas regarding this would be greatly appreciated. Thanks
Did you ever find a solution to this? I'm having the exact same problem.
Video & Multimedia Manager
Médecins Sans Frontières
Lower Ground, Chancery Exchange,
10 Furnival Street,
I'm really new to writing expressions (about a month in), but I'm working with the same kind of setup. I'm sure there are better ways to do this, and keep in mind I've only been doing this for a month, but I've set my project up, so:
1. I use master layers that exist outside of the comp you want to duplicate to drive properties that you want to be shared.
2. Any references inside of the comp to be duplicated should be specific to that comp with relative references (thisComp.layer...). See #4 below for a note on this.
3. Any references outside of the comp (like to a master layer) are absolute (comp("Master").layer...)
4. Your comps to be duplicated should use a dynamic variable for references (honestly, I don't even know if that's the correct term). I've been using 'thisComp.name' to append my references. So, comp '0' has a '0' appended to the end, comp '1' has a '1' appended to the end, etc. You can also use index numbers if the slide comps end up as layers in a master comp.
Here's an example of the code I'm using to dynamically change the references to rows in a csv file:
This says: myTextLayer1 has the content of what is in the 'Master' comp, on the layer 'SlideContent2.csv', in the data of the csv, in the column of the csv 'FinalText1' and row 'FinalText1 'the name of this comp'.
So, for comp '0', the data returned from the csv is row '0', for comp '1', the data returned is row '1', etc.
Again, I'm really new at this (and coding), so there may be more efficient ways to do this, but this one is working for me.
In 2016 this was not yet possible.
a pre-comp that was used in multiple places could not change the color of a layer, depending on what master comp it was in.
There was only the one pre-comp in your project, and it needed 1 fixed color, or 1 definite outcome of an expression to say what color is calculated. More colors -> copies were needed.
This is now (since 2018 I think) possible by using Master Properties.
You can now add properties to the "Essential Graphics" palette of a comp.
These are properties that can be changed as parameters on the precomp. A
So in our example: Different instances of a precomp can now have different colors, without having to make extra copies.
Even more powerful when combined with expressions, but often that's not even necessary.