• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Show/hide keyframed properties from an extension

Community Beginner ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

I have an extension that executes function test() on a button click, to show/hide properties with keyframes:

 

function test() {

var res = false;

var msg = 'default';

var comp = _proj.activeItem;

if (!comp || !(comp instanceof CompItem)) {

msg = 'No active item or active item is not a comp';

return toJSON(res, msg);

}

var layer = comp.layer(1);

if (!layer) {

msg = 'No layer selected';

return toJSON(res, msg);

}

layer.selected = true;

var cmdStr = 'Reveal Properties with Keyframes';

var cmdId = executeCommand(cmdStr);

if (cmdId == 0) {

msg = 'Command \'' + cmdStr + '\' id not found';

return toJSON(res, msg);

}

msg = 'Executed \'' + cmdStr + '\' (' + cmdId + ')';

layer.selected = false;

return toJSON(res, msg);

}


function executeCommand(cmdStr) {

var cmdId = 0;

cmdId = app.findMenuCommandId(cmdStr);

if (cmdId == 0) return cmdId;

app.executeCommand(cmdId);

return cmdId;

}

 

When I call test() the first time, it works and opens keyframed props, but when I call it again, it opens all props of the layer. On the other hand, if after the first call I click away from the extension window and focus AE UI, it works and hides keyframed props.

Does anyone here have any experience re this behavior?

TOPICS
How to , Scripting , User interface or workspaces

Views

101

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

try this:

function executeCommand(cmdStr) {
    var cmdId = 0;
    cmdId = app.findMenuCommandId(cmdStr);
    if (cmdId == 0) return cmdId;
    // RevealAllModifiedProperties
    app.executeCommand(2771);
    app.executeCommand(2771);
    app.executeCommand(cmdId);
    return cmdId;
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

This way it opens keyframed props if they are hidden but doesn't hide them if they are shown.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

... which makes sense because running 2771 twice hides everything and then props are shown again, so this code doesn't work as a switch

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

I don't know.

var proj = app.project;
var thisComp = proj.activeItem;

thisComp.layer(1).selected = true;

app.executeCommand(2771);
app.executeCommand(2771);
app.executeCommand(2387);

sergey_1079.gif

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

LATEST

Here is how it works for me:
timeline_manager_code.pngtimeline_manager_animation.gif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines