-
AE scripting keyframe bug in lengthy compositions
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!