Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions CEP Panel: Event Listener Layer Selection

  • CEP Panel: Event Listener Layer Selection

    Posted by Malte Hillebrand on March 20, 2020 at 2:57 pm

    Hey, I’m fairly new to plugin creation in Adobe products / After Effects and I’m hoping you can help me.

    I’m trying to create an event via CSInterface whenever a layer is selected within a comp.

    I then want to adjust my HTML5 Panel accordingly to the selected layer.

    Is this possible and if so, how?

    I couldn’t find anything about this behaviour.

    Also: If somebody has any link to a good ressource for CSInterface.js and it’s communication with After Effects and my panel I would highly appreciate it.

    Thank you.

    Mahmoud Elsafy replied 4 years, 10 months ago 3 Members · 2 Replies
  • 2 Replies
  • Andrei Popa

    March 24, 2020 at 10:25 am

    If you decide to create Script/Plugins for AE, you should get terminology correct.

    Script = program created in ExtendScript(JavaScript plus some additions to fit Adobe products). EcmaScript 3 standard.
    Extension = a script that works inside a web interface. I think you can use EcmaScript 6 inside the web part and EcmaScript 3 inside the script part.
    Plugin = a whole different league. Programmed in C++. You can access about anything in AE with those. But are much much more complicated than scripts or extensions.

    Now, for your answer.
    I don’t have much experience with Extensions but have a fair bit with scripts.
    And since an Extension is a script with web interface, I’m gonna take a wild guess and say no. I don’t think you can add things like layer.onSelect().

    If you are new to Extensions, this tutorial could help you understand how they work.
    https://www.youtube.com/watch?v=UXOvW659rek

    Andrei
    My Envato portfolio.

    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.

  • Mahmoud Elsafy

    July 28, 2021 at 3:09 pm

    Main .jsx

    function getSelectedLayer() {

    SL = app.project.activeItem.selectedLayers;

    //return selected layer index or any other property

    return SL.length != 0 ? SL[0].index : null

    };

    
    

    main .js in HTML

    var csInterface = new CSInterface();

    setInterval(() => {

    csInterface.evalScript(“getSelectedLayer()”, function (result) {

    if (result !== “null”) {

    //Do something when layer is selected

    $(‘#elemID’).html(‘Selected Layer index: ‘+ result);

    }

    });

    }, 1000); // checks selected layer every one second

    
    
    		
        

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