Plug-ins: Ease Presets moves out of core into a bundled ScriptUI panel
The Ease Presets panel (#254) is modelled on a third-party panel, so, as with third-party tools in After Effects, it isn't core any more: it is `extensions/scriptui-panels/Ease Presets.jsx`, a ScriptUI panel bundled as an optional extension (Window ▸ Ease Presets.jsx), written only against the public scripting API. Clicking a preset eases every pair of neighbouring selected keyframes in one undo step (per dimension, along the motion path for spatial properties, the keys' other sides as they play); the fields edit the working curve, which the panel draws; From Keys, Save, Rename and Delete as before. The twelve built-in curves are unchanged. Scripting API fixes it needed (After Effects parity): - `app.settings` lasts between runs (`script_settings.json` in the settings folder; `script.settings.get` / `script.settings.save`). - Per-key methods (`setTemporalEaseAtKey`, `setInterpolationTypeAtKey`, `removeKey`, the continuous / auto-Bezier / roving setters) no longer change the user's key selection (they selected the key they edited). - `keyInTemporalEase` / `keyOutTemporalEase` report linear and auto-Bezier sides as they play, `keyIn/OutSpatialTangent` the tangents the motion path plays. - `selectedProperties` includes the properties of selected keyframes. - `isInterpolationTypeValid` is false for Linear / Bezier on values that only hold. Removed from core: Window ▸ Ease Presets, the `keys.easePreset.*` commands, `engine::ease_presets` and the `ease_presets.json` store, `keyframe::EaseCurve` (nothing else used it) and the egui panel. User presets saved by the v0.6.0 panel move into the panel's app.settings section the first time settings load (the old file is left as is). Docs: plugins.md (bundled extensions), parity.md, gaps.md G8, agents.md. Test: app_settings_last_between_runs, per_key_methods_keep_the_key_selection_and_report_eases_as_they_play, spatial_tangents_are_reported_as_the_path_plays (each fails before), the_ease_presets_panel_eases_every_selected_pair_in_one_undo_step, a_typed_curve_scales_to_each_dimension_and_follows_motion_paths, user_presets_save_rename_delete_and_persist, presets_saved_by_the_old_core_panel_carry_over (script, through the panel's controls), ease_presets_panel_eases_the_selected_keys_from_its_list (UI: the panel docks and a click on a preset eases the keys). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9da33c157e
commit
da165724e9
@@ -824,31 +824,30 @@ Property.prototype.property = function () { return null; };
|
||||
};
|
||||
P.keyTime = function (i) { return this.__key(i).time; };
|
||||
P.keyValue = function (i) { return this.__fromEngine(this.__key(i).value, this.__info()); };
|
||||
// Select key `i` (only) so the selection-based keyframe commands act on it.
|
||||
P.__select = function (i) {
|
||||
var k = this.__key(i);
|
||||
__call("keys.select", { comp: this.__layer.__comp, keys: [{ layer: this.__layer.__id, prop: this.__uid, time: k.layerTime }] });
|
||||
return k;
|
||||
};
|
||||
P.removeKey = function (i) {
|
||||
this.__select(i);
|
||||
__call("keys.delete", { comp: this.__layer.__comp });
|
||||
// Run a keyframe command that acts on the selected keys on key `i` only; the user's key
|
||||
// selection stays as it was, as with After Effects' per-key methods.
|
||||
P.__keyCmd = function (i, id, params) {
|
||||
this.__key(i);
|
||||
params = params || {};
|
||||
params.comp = this.__layer.__comp;
|
||||
params.__keys = [{ layer: this.__layer.__id, prop: this.__uid, index: __num(i) - 1 }];
|
||||
return __call(id, params);
|
||||
};
|
||||
P.removeKey = function (i) { this.__keyCmd(i, "keys.delete"); };
|
||||
P.keyInInterpolationType = function (i) { return KeyframeInterpolationType[this.__key(i).inInterp]; };
|
||||
P.keyOutInterpolationType = function (i) { return KeyframeInterpolationType[this.__key(i).outInterp]; };
|
||||
P.isInterpolationTypeValid = function (t) { return t === 6612 || t === 6613 || t === 6614; };
|
||||
// Values that don't interpolate (checkboxes, popups, text) only hold.
|
||||
P.isInterpolationTypeValid = function (t) { return t === 6614 || ((t === 6612 || t === 6613) && this.__info().interpolates !== false); };
|
||||
P.setInterpolationTypeAtKey = function (i, inType, outType) {
|
||||
if (outType === undefined) outType = inType;
|
||||
if (!__interpKey[inType] || !__interpKey[outType]) throw __err("Bad KeyframeInterpolationType");
|
||||
this.__select(i);
|
||||
__call("keys.interpolation", { comp: this.__layer.__comp, "in": __interpKey[inType], out: __interpKey[outType] });
|
||||
this.__keyCmd(i, "keys.interpolation", { "in": __interpKey[inType], out: __interpKey[outType] });
|
||||
};
|
||||
P.keyInTemporalEase = function (i) { return this.__key(i).inEase.map(function (e) { return new KeyframeEase(e.speed, e.influence); }); };
|
||||
P.keyOutTemporalEase = function (i) { return this.__key(i).outEase.map(function (e) { return new KeyframeEase(e.speed, e.influence); }); };
|
||||
P.setTemporalEaseAtKey = function (i, inEase, outEase) {
|
||||
if (outEase === undefined) outEase = inEase;
|
||||
if (!(inEase instanceof Array) || !(outEase instanceof Array)) throw __err("setTemporalEaseAtKey: eases must be arrays of KeyframeEase");
|
||||
this.__select(i);
|
||||
function sp(a) { return a.map(function (e) { return __num(e.speed, "speed"); }); }
|
||||
function inf(a) {
|
||||
return a.map(function (e) {
|
||||
@@ -857,14 +856,14 @@ Property.prototype.property = function () { return null; };
|
||||
return x;
|
||||
});
|
||||
}
|
||||
__call("keys.velocity", { comp: this.__layer.__comp, inSpeed: sp(inEase), inInfluence: inf(inEase), outSpeed: sp(outEase), outInfluence: inf(outEase) });
|
||||
this.__keyCmd(i, "keys.velocity", { inSpeed: sp(inEase), inInfluence: inf(inEase), outSpeed: sp(outEase), outInfluence: inf(outEase) });
|
||||
};
|
||||
P.keyTemporalContinuous = function (i) { return !!this.__key(i).continuous; };
|
||||
P.setTemporalContinuousAtKey = function (i, b) { this.__select(i); __call("keys.interpolation", { comp: this.__layer.__comp, continuous: !!b }); };
|
||||
P.setTemporalContinuousAtKey = function (i, b) { this.__keyCmd(i, "keys.interpolation", { continuous: !!b }); };
|
||||
P.keyTemporalAutoBezier = function (i) { return !!this.__key(i).autoBezier; };
|
||||
P.setTemporalAutoBezierAtKey = function (i, b) { this.__select(i); __call("keys.interpolation", { comp: this.__layer.__comp, autoBezier: !!b }); };
|
||||
P.setTemporalAutoBezierAtKey = function (i, b) { this.__keyCmd(i, "keys.interpolation", { autoBezier: !!b }); };
|
||||
P.keyRoving = function (i) { return !!this.__key(i).roving; };
|
||||
P.setRovingAtKey = function (i, b) { this.__select(i); __call("keys.interpolation", { comp: this.__layer.__comp, roving: !!b }); };
|
||||
P.setRovingAtKey = function (i, b) { this.__keyCmd(i, "keys.interpolation", { roving: !!b }); };
|
||||
P.keyInSpatialTangent = function (i) { return this.__key(i).spatialIn.slice(0, this.__info().dims); };
|
||||
P.keyOutSpatialTangent = function (i) { return this.__key(i).spatialOut.slice(0, this.__info().dims); };
|
||||
P.keySpatialContinuous = function (i) { return !!this.__key(i).spatialContinuous; };
|
||||
@@ -873,8 +872,8 @@ Property.prototype.property = function () { return null; };
|
||||
var k = this.__key(i);
|
||||
__call("keys.setSpatialTangents", this.__ref({ time: k.layerTime, "in": inT, out: outT === undefined ? inT : outT }));
|
||||
};
|
||||
P.setSpatialContinuousAtKey = function (i, b) { this.__select(i); __call("keys.interpolation", { comp: this.__layer.__comp, spatial: b ? "continuousBezier" : "bezier" }); };
|
||||
P.setSpatialAutoBezierAtKey = function (i, b) { this.__select(i); __call("keys.interpolation", { comp: this.__layer.__comp, spatial: b ? "autoBezier" : "bezier" }); };
|
||||
P.setSpatialContinuousAtKey = function (i, b) { this.__keyCmd(i, "keys.interpolation", { spatial: b ? "continuousBezier" : "bezier" }); };
|
||||
P.setSpatialAutoBezierAtKey = function (i, b) { this.__keyCmd(i, "keys.interpolation", { spatial: b ? "autoBezier" : "bezier" }); };
|
||||
P.keySelected = function (i) { return !!this.__key(i).selected; };
|
||||
P.setSelectedAtKey = function (i, b) {
|
||||
var k = this.__key(i);
|
||||
@@ -1743,11 +1742,11 @@ var app = {
|
||||
exitCode: 0,
|
||||
saveProjectOnCrash: true,
|
||||
onError: null,
|
||||
// Kept in the settings folder, so they last between runs (`script.settings.*`).
|
||||
settings: {
|
||||
__s: {},
|
||||
haveSetting: function (sec, key) { return (sec + "/" + key) in this.__s; },
|
||||
getSetting: function (sec, key) { return this.__s[sec + "/" + key] || ""; },
|
||||
saveSetting: function (sec, key, v) { this.__s[sec + "/" + key] = String(v); },
|
||||
haveSetting: function (sec, key) { return __call("script.settings.get", { section: String(sec), key: String(key) }).have; },
|
||||
getSetting: function (sec, key) { return __call("script.settings.get", { section: String(sec), key: String(key) }).value; },
|
||||
saveSetting: function (sec, key, v) { __call("script.settings.save", { section: String(sec), key: String(key), value: String(v) }); },
|
||||
},
|
||||
preferences: {
|
||||
havePref: function () { return false; },
|
||||
|
||||
Reference in New Issue
Block a user