Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions containingComp, could it work in expressions?

  • containingComp, could it work in expressions?

    Posted by Jim Huffaker on May 19, 2016 at 3:00 pm

    I know this is a long shot, but can you use the containingComp property in expressions to access the properties of layers in the parent comp? Maybe with an index number to select which parent comp? Something like

    contComp = thisComp.containingComp

    I know it’s probably not accessible in expressions, but maybe it is?

    Jim Huffaker replied 9 years, 12 months ago 3 Members · 4 Replies
  • 4 Replies
  • Miguel De mendoza

    May 19, 2016 at 3:54 pm

    Unfortunately you can`t access comp instances directly by expressions. You can access to any comp by comp(“compName”), so you can can trick it a little bit using the names of the comps and layers and the magic function split(), to make it some kind of “dynamic” reference. Depending on what you want to do it can be more or less complex. In a simple case mainComp_a->childComp_a->someLayer_a you can access mainComp in the layer like this:

    nSplit = name.split("_");
    refCompName = "mainComp_" + nSplit[nSplit.length -1];
    refComp = comp(refCompName);

  • Jim Huffaker

    May 19, 2016 at 4:01 pm

    That’s a good idea, thanks!

    I’m rigging things for a team to use and the simpler it is for them the better. I was using text layers so they could just write the parent comp name in the text layer, but that introduces even more complexity. This might be simple enough though.

  • Filip Vandueren

    May 19, 2016 at 7:55 pm

    I think it’s pretty obvious why it only works one way, ie down the hierarchy:

    a layer in a comp cannot know what it’s parent comp is, because it could be uses in more than 1 pre comp…
    expressions don’ allow for that kind of ambiguity, or context-sensitive values.

  • Jim Huffaker

    May 19, 2016 at 8:47 pm

    I thought that way too, until I figured out that you can do those things in scripting, using item index numbers, etc., to choose which containingComp you want to use.

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