4

I have a dozen 'main' comps which have a bunch of nested comps. I need to create about 30 versions of each main comp, with different colors. The subcomps are animated shapes, which take their color from a color picker in the main comp. I would love to avoid having to duplicate all the subcomps 30 times, so I don't have hundreds of copies.

Is there ANY way to allow a nested comp to change based on the comp within which it is nested?

I know there is no "thisComp.parent" option -- since a comp can be nested in many different parents -- but is there a way to "push" a property "down" into a subcomp? Or any clever workaround? Does this make sense?

E.g., main comp "M01" has subcomps "S01a", "S01b", etc. The colors of shapes in S01a etc are based on a color picker in M01. I want to duplicate M01 to M02, change the color picker value, and have S01a S01b pick up the new color value, without having to duplicate them to S02a, S02b, etc in order to reference M02.

I'm using True Comp Duplicator, which is a lifesave with its 'update expressions' option ... but my project is over 50MB now, with hundreds of comps, and is unwieldly.

(I cannot use a 'change color' effect in the main comp; there are transparencies & blend modes that would get messed up.)

1

You can link properties in different compositions by using an expression like this one.

comp("Comp Name").layer("Layer Name")("Property e.g. Transform")("SubProperty e.g. Position")

If the property is more nested you just add another ("sub property") until you reach the property you need, just as you would click through the drop down menus.

Also helpful: VideoCopilot recently released a great free script specializing in pre-comping 3D layers in exactly that way. http://www.videocopilot.net/blog/2014/08/free-script-3d-pre-compose-tutorial/

Edit: Regarding the clarification in the comments about using relative selectors for comps. Unfortunately not possible per se. You can do it with layers by specifying the index number but a comp doesn't really have a unique parent which makes this rather hard to have a generic selector for comps. If you have a unique procedural naming based on your comp "depth" this might be possible with some advanced expression or maybe script but if you just named them "my cool comp" and "my other cool" comp you can't really make a script for that.

  • Sorry, I don't see what that has to do with my question. I need a way to 'dynamically' alter properties within a comp based on the comp within which it is nested. – Dan Aug 18 '14 at 16:08
  • 1
    I.e., I cannot use Comp("comp name") because what I really want is Comp.thisComp.parent – Dan Aug 18 '14 at 16:09
  • Ah so you dont mean dynamically in the sense of changing something in the main comp and affecting something in the sub comp but a way to have relative "paths" in your expressions? – PTS Aug 18 '14 at 16:11
  • Yeah, pretty much ... like have a subcomp change depending on the comp where it is nested. Apparently not possible ... forums.creativecow.net/readpost/227/27710 – Dan Aug 18 '14 at 16:13
  • "relative paths" is a good way to put it. – Dan Aug 18 '14 at 16:14
1

If I understand what your asking correctly there is a way of doing it.

On the subcomp layer in the main comp add a colour expression control effect (Effects > Expression Controls > Color, then control it with an expression so that it's linked to the colour of the colour picker (use the pick whip).

Now in the subcomp itself the colour will be available to expressions if you use the value comp("M01").layer(thisComp.name).effect("Color Control")(1).

Obviously this will only work if your comps have unique names. Note that you can use regular javascript string methods to handle text manipulation in expressions, so things like regular expressions and string.split and number.toString all work.

Note that expressions, especially expressions that reference multiple comps can really slow AE down. I've often found that something that is technically possible with a gazillion expressions is practically unworkable because every time you move the time slider you get the beachball for half an hour. So where you can, try converting the expressions into keyframes, or pre-rendering.

  • Yeah, that's not what I mean. Imagine a comp called 'Red," within which is nested a comp called 'Circle.' Red has a color picker set to red, and Circle takes its color from Red. Now I want to duplicate Red, call it Blue, and have Circle -- the same Circle precomp, not a copy of it -- become blue when it's nested within 'Blue.' Does that make sense? Apparently it's not possible. Blue would have to be duplicated in order to reference the new parent comp. There is no way for a comp to discover which comp it is nested in. – Dan Aug 20 '14 at 15:41
  • Oh, I get it. Sounds like a job for scripting. – stib Aug 21 '14 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.