Copy link to clipboard
Copied
If I try to set a keyframe in a color property to rove across time I get an error.
Property setRovingAtKey() method
app.project.item(index).layer(index).proper tySpec.setRovingAtKey(keyIndex, newVal)
Description
Turns roving on or off for the specified keyframe. The first and last keyframe in a property cannot rove; if you
try to set roving for one of these, the operation is ignored, and keyRoving() continues to return false.
If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
However if I select the keyframe with my mouse and right click, I can select Rove across time and it works.
How's that? How can I achieve that by scripting?
The description you supplied gives you the answer. Roving with the setRovingAtKey command works only on SPATIAL (that is, any kind of positional) values. For some reason Adobe does not allow you to rover any other type of value.
The first thing that comes in mind is to use the app.executeCommand with the CommandID 3153 (Rove Across time)
app.executeCommand(3153);
This would have the exact same effect, as right-clicking the keyframe and selecting the "Rove Across Time" option.
The second is a lot mor
...Copy link to clipboard
Copied
The description you supplied gives you the answer. Roving with the setRovingAtKey command works only on SPATIAL (that is, any kind of positional) values. For some reason Adobe does not allow you to rover any other type of value.
The first thing that comes in mind is to use the app.executeCommand with the CommandID 3153 (Rove Across time)
app.executeCommand(3153);
This would have the exact same effect, as right-clicking the keyframe and selecting the "Rove Across Time" option.
The second is a lot more complicated and dirty workaround.
You will have to create a 3D null, and "transfer" the separate R,G,B values of the three keyframes of the color property in question to the X,Y,Z values of a Null's 3D position. Then, Rove the second keyframe of the Null's Position, mark the new frame where AE moved the keyframe in the timeline and finally, move the second Color keyframe to the same frame in time.
In more detail, let's say you already have 3 keyframes set in a color property.
app.project.item(1).layer("Null 1").transform.position.setRovingAtKey(2, true);
This "solution" is far from perfect. As I said, just a dirty work-around.
I would stick with the app.executeCommand
Hope these solutions help.
Copy link to clipboard
Copied
Thank you TheodorosGR, yes!, both solutions make sense and helped.
Regarding this line of code here:
- app.executeCommand(3153);
Is there a database with all the CommandID ? In other words, where did you get this information from?
Copy link to clipboard
Copied
There you go:
After Effects Menu Command ID’s by David Torno:
https://www.provideocoalition.com/after-effects-menu-command-ids/
At the bottom of the page there are links for .PDF files with all the available commands.
Cheers!
Copy link to clipboard
Copied
Oh wow thank you!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now