Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions AE scripting keyframe bug in lengthy compositions

  • AE scripting keyframe bug in lengthy compositions

    Posted by Tim RK on March 10, 2025 at 6:55 pm

    Hello, wise people of CC forums! I have this script that sets keyframes for Dropdown menu items at a currently selected layer’s in-point based on the layer’s label color. There’s one issue though: Once composition time goes past 8 minutes, the script starts to bug out (rather inconsistently). It sets the keyframe value at the correct time, but in the effects menu and on the timeline it shows and acts as if previous value is set, but when you look at the tooltip of this keyframe it shows the correct value. The only solution I have as of now: I manually drag the keyframe along timeline back and forth and then it updates its value to the correct one.
    Layers do not intersect in any way. I tried writing in-point time into a file and it matches current frame/fps, so no error there as well.
    Is there anything I can do to fix this weird bug?

    Code in question looks like this:

    function createBGCtrl() {
    var activeItem = app.project.activeItem;
    app.beginUndoGroup(“BG_switch”);
    var bgControl=app.project.activeItem.layers.addNull();
    bgControl.name=”BG_control”;
    var dropdownItems = [
    “WIDE”,
    “MEDIUM”,
    “CLOSE”
    ];
    var bgControlDropdown = bgControl.Effects.addProperty(“ADBE Dropdown Control”);
    var temp = bgControlDropdown.property(1).setPropertyParameters(dropdownItems);
    temp.propertyGroup(1).name = “BG”;
    for ( var x = 1; x <= activeItem.layers.length; x++)
    {
    currentLayer = activeItem.layer(x);
    layerLabel = currentLayer.label;
    if (currentLayer.label == 13) {
    bgControl.effect(“BG”)(“Menu”).setValueAtTime(currentLayer.inPoint, 1);
    }
    else if (currentLayer.label == 8) {
    bgControl.effect(“BG”)(“Menu”).setValueAtTime(currentLayer.inPoint, 2);
    }
    else if (currentLayer.label == 10) {
    bgControl.effect(“BG”)(“Menu”).setValueAtTime(currentLayer.inPoint, 3);
    }

    }
    app.endUndoGroup();
    }

    Thanks in advance!

    Tim RK replied 6 days, 1 hour ago 2 Members · 4 Replies
  • 4 Replies
  • Roland R. kahlenberg

    March 17, 2025 at 6:00 am

    I’d look at adding “.value” to the end of this line –

    from this –
    var bgControlDropdown = bgControl.Effects.addProperty(“ADBE Dropdown Control”);

    to this –

    var bgControlDropdown = bgControl.Effects.addProperty(“ADBE Dropdown Control”).value;

    HTH

  • Tim RK

    March 19, 2025 at 9:56 pm

    Thank you for your suggestion but that will not work since that line just adds Dropdown Menu effect itself. I tried it nonetheless and sript failed as expected 🙂

    After further digging into this topic I’m starting to believe this behavior might be the result of some float conversion errors, but still no idea how to fix it. The only workaround I’ve found so far doesn’t help at all. Also, this script works perfectly fine on any comp that is under 7-8 minutes.

  • Roland R. kahlenberg

    March 20, 2025 at 8:49 am

    I’d send in a Bug Report for sure. Bonus Points if you can attach the AEP.

    Hope this works out.

  • Tim RK

    March 20, 2025 at 10:54 am

    Thank you for your reply, I’ll definitely send a report. I’ve attached the basic project here as well so that people can better understand the issue I’m having. I’ve also marked the erroneous keyframes in the project. As you can see in the screenshot, there’s a discrepancy between values set and shown in tooltip, the latter being the actual value for that particular keyframe.

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