Show Direction and Curve of a node only where they matter
An animation key shows Direction only for one of the ten curves and the Curve row only for Curve. Lerp and Set sound FX parameters hid them on the node body, but the inspector still offered both rows for every easing, so a linear Lerp had a Direction to pick that did nothing. - A node definition can name `idleParams`: settings that do nothing at the current values. The node body and the inspector both leave them out. - `hiddenParams` stays as it was. It only trims the node body, the inspector keeps those rows (the Order of an event, the mode of Find), so it could not take this job. - Lerp and Set sound FX parameters use `idleEasing` (formerly `hiddenEasing`) for it. - The idle settings are part of the node signature of the inspector. Picking an easing that needs Direction or Curve rebuilds the section, and the row appears. Tests: - easing-curves: 14 tests (+1), node-catalog: 381, green - e2e 06 (149 checks, green) checks that a new linear Lerp has no Direction and no Curve row in the inspector. Picking Cubic brings the Direction row, and Out is picked there as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e7a360db73
commit
297fca3e94
8 files changed
+50
-12
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
} from '../../src/core/commands/animationCommands';
|
||||
import { CreateAssetCommand } from '../../src/core/commands/assetCommands';
|
||||
import { CommandError } from '../../src/core/commands/Command';
|
||||
import { requireNodeDef } from '../../src/core/commands/require';
|
||||
import {
|
||||
EASING_DIRECTIONS,
|
||||
EASING_SHAPES,
|
||||
@@ -25,6 +26,7 @@ import {
|
||||
} from '../../src/core/model/animation';
|
||||
import { previewHolder } from '../../src/core/model/animationPreview';
|
||||
import type { AnimationTrack, KeyInterpolation } from '../../src/core/model/Asset';
|
||||
import { LERP } from '../../src/core/model/curve';
|
||||
import { findAssetOf } from '../../src/core/model/Project';
|
||||
import { AnimationSystem } from '../../src/runtime/systems/AnimationSystem';
|
||||
import { World } from '../../src/runtime/World';
|
||||
@@ -215,3 +217,20 @@ describe('an overshooting curve and the limits of a property', () => {
|
||||
).toThrow(CommandError);
|
||||
});
|
||||
});
|
||||
|
||||
// Like a key, a node shows Direction and Curve only where they ease something – on its body and in
|
||||
// the inspector alike.
|
||||
describe('the easing settings of a node', () => {
|
||||
for (const type of [LERP, 'SetSoundFxParameters']) {
|
||||
it(`${type} leaves out what the easing does not use`, () => {
|
||||
const idle = requireNodeDef(type).idleParams!;
|
||||
expect(idle({})).toEqual(['direction', 'curve']);
|
||||
expect(idle({ ease: 'linear', direction: 'in', curve: 'c' })).toEqual(['direction', 'curve']);
|
||||
expect(idle({ ease: 'step' })).toEqual(['direction', 'curve']);
|
||||
expect(idle({ ease: 'quad', direction: 'out' })).toEqual(['curve']);
|
||||
expect(idle({ ease: 'elastic' })).toEqual(['curve']);
|
||||
expect(idle({ ease: 'curve', direction: 'in' })).toEqual(['direction']);
|
||||
expect(requireNodeDef(type).hiddenParams).toBeUndefined();
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user