Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Displaying a specific layer from a nested comp

  • Displaying a specific layer from a nested comp

    Posted by George Henderson on August 15, 2018 at 9:25 pm

    Hi everyone,

    Is there an effect or script that can display a certain layer from a nested comp? For example:
    1. I have two layers in ‘Comp A’ (1. Text & 2. Logo).
    2. I drop ‘Comp A’ into ‘Comp B’
    3. Can I add an effect to the nested ‘Comp A’ to only display (1. Text)?

    Usually, I would duplicate ‘Comp A’ into two parts (‘Comp A – Text’ & ‘Comp A – Logo’) and drop the two into ‘Comp B’.
    Looking forward to your response, thanks!

    Walter Soyka replied 7 years, 8 months ago 3 Members · 5 Replies
  • 5 Replies
  • Andrew Somers

    August 16, 2018 at 7:03 am

    This is easily done with an expression.

    On the CompA layer inside CompB for instance, you can refer to the CompA layers and manipulate them via the expression (and whatever controls you set up for the expression), including visibility, opacity, etc.

    Expressions are easy to write Javascript with some specific functions added for After Effects. And in fact much of the time you need to do very little writing of code, as you can “pickwhip” to create all sorts of custom controls.

    Here’s a “No Writing” version (just pickwhip):

    As an example, you could add a “Slider” control to the CompA layer (inside CompB) and it appears as a slider in effects controls, then pickwhip the Opacity of one of the CompA internal layers to that control. On this slider control in CompB you can add further expressions/keyframes to that same control, allowing you to control the internal layer of CompA while in CompB.

    If this is something you do a lot, you could even save it as an “animation preset”.

    If you would rather use the checkbox to just toggle from 0 to 1 opacity, then you do need just a tiny bit of code:
    if(comp("CompB").layer("CompA").effect("Checkbox Control")("Checkbox").value) 100 else 0;
    This code assumes that CompA is nested inside CompB and the CompA layer has the checkbox added to it. The IF statement sets the return value to 100 if the box is checked, and 0 if not.

    If you’re wondering, the checkbox can’t be pickwhipped to thevisibility (layer enable) button, as expressions can’t access it — however SCRIPTS can access the visibility button, so you could develop a script instead, not sure which is best for you.

    All this said, I’m not sure from your example what you’re really trying to accomplish?

    Andrew Somers
    VFX & Title Supervisor
    https://www.GeneralTitles.com

  • George Henderson

    August 21, 2018 at 6:05 pm

    Hi Andrew,
    Thanks for your thoughtful response. I just tried the checkbox method and it partially works; unfortunately, it’s not doing what I am trying to achieve.
    The problem is… the ‘CompA’ layer within ‘CompB’ will display whatever that’s being displayed within ‘CompA’. My goal is to call up whichever layer from one master comp and only have that layer be displayed no matter the visibility of the rest of the layers within that master comp.
    I have attached a sample project to further explain the problem. ‘CompA – Logo’ should only display the logo, but since the checkbox on ‘Comp A – Hello’ is ticked, it shows both hello and the logo.

    12661_layerdisplay.aep.zip

    Thanks!

  • Walter Soyka

    August 22, 2018 at 9:19 am

    [George Henderson] “Usually, I would duplicate ‘Comp A’ into two parts (‘Comp A – Text’ & ‘Comp A – Logo’) and drop the two into ‘Comp B’. Looking forward to your response, thanks!”

    That’s the way I would handle it, too, but starting with Ae CC v15.1, you do have a new option: Master Properties.

    Master Properties is a new feature that lets you control specific properties of a comp when it’s nested in another comp. I think of it like instancing a comp, with a few tweakable parameters. Here’s the basic workflow:

    1. With the Essential Graphics panel, identify the properties in the master comp that you’d like to be able to change from within other comps.

    2. Use the master comp as a layer in other containing comps. Twirl open its layer properties, and adjust/keyframe the master properties you made available in the first step. Each comp layer will render an instance of the master comp, with the adjustments you’ve made in the timeline.

    Here’s a quick intro to Master Properties:
    https://www.youtube.com/watch?v=ZjAW70_kePI

    Here’s the documentation:
    https://helpx.adobe.com/after-effects/using/creating-motion-graphics-templates.html#main-pars_header_1586269523

    Here’s a screengrab from a setup I’ve done based on your comp. (It uses checkboxes to control layer visibility in the master comp. Note that they exist only in Comp A, and can be freely and independently manipulated in Comp B):

    And here’s the AEP:
    12664_layerdisplaymasterproperties.aep.zip

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • George Henderson

    August 22, 2018 at 6:36 pm

    Oh wow, that’s it! I had no idea ‘Essential Graphics’ existed.
    Just watched several videos and played around a bit, it certainly does the job and so much more.
    Thanks for exposing me to such handy feature. greatly appreciate it Walter!

  • Walter Soyka

    August 22, 2018 at 7:00 pm

    [George Henderson] “Oh wow, that’s it! I had no idea ‘Essential Graphics’ existed. Just watched several videos and played around a bit, it certainly does the job and so much more. Thanks for exposing me to such handy feature.”

    I think Master Properties is the biggest improvement to Ae since CS5 (when Ae went 64-bit).

    It’s a sneaky-powerful feature that can completely change the way we approach our work.

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

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