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?
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;
}
Copy link to clipboard
Copied
This way it opens keyframed props if they are hidden but doesn't hide them if they are shown.
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
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);
Copy link to clipboard
Copied
Here is how it works for me: