Comp: comp.new / comp.settings no longer advertise an advanced3D key (#177)
Their params docs wrote the renderer as `renderer? classic3D|advanced3D`.
Without a `:`, the doc parser reads `|` as "or another key", so
`advanced3D` became an accepted key in the schemas and the unknown-key
check: `comp.new {"advanced3D": true}` succeeded and made a Classic 3D
comp.
The docs now use the value-list form the other commands use,
`renderer?: classic3D|advanced3D`. The key is removed rather than
implemented: it would only duplicate `renderer` (and could contradict
it). A scan of every command's schema found no other key that came from
a value list.
Test: renderer_values_are_not_parameter_keys (not in the schema, rejected
as unknown, `renderer` still works on both commands).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d416d9a01f
commit
5d2083b64c
@@ -268,7 +268,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
|||||||
"New Composition...",
|
"New Composition...",
|
||||||
["Composition"],
|
["Composition"],
|
||||||
Some("Cmd+N"),
|
Some("Cmd+N"),
|
||||||
"{name?, width?, height?, frameRate?, duration? (s), startTime? (s) | startTimecode?, background? [r,g,b]|#hex, pixelAspect?, shutterAngle?, shutterPhase?, motionBlurSamples?, adaptiveSampleLimit? (16–256), preserveFrameRate?: bool, preserveResolution?: bool, renderer? classic3D|advanced3D, anchor?, open?}",
|
"{name?, width?, height?, frameRate?, duration? (s), startTime? (s) | startTimecode?, background? [r,g,b]|#hex, pixelAspect?, shutterAngle?, shutterPhase?, motionBlurSamples?, adaptiveSampleLimit? (16–256), preserveFrameRate?: bool, preserveResolution?: bool, renderer?: classic3D|advanced3D, anchor?, open?}",
|
||||||
always,
|
always,
|
||||||
new_comp
|
new_comp
|
||||||
),
|
),
|
||||||
@@ -277,7 +277,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
|||||||
"Composition Settings...",
|
"Composition Settings...",
|
||||||
["Composition"],
|
["Composition"],
|
||||||
Some("Cmd+K"),
|
Some("Cmd+K"),
|
||||||
"{comp?, name?, width?, height?, anchor? 0-8 (resize anchor, 4 = center), frameRate?, duration?, startTime? (s) | startTimecode?, background?, shutterAngle?, shutterPhase?, motionBlurSamples?, adaptiveSampleLimit? (16–256), preserveFrameRate?: bool (nested or in the render queue it shows only its own frames), preserveResolution?: bool (nested, it renders at full size), pixelAspect?, renderer? classic3D|advanced3D}",
|
"{comp?, name?, width?, height?, anchor? 0-8 (resize anchor, 4 = center), frameRate?, duration?, startTime? (s) | startTimecode?, background?, shutterAngle?, shutterPhase?, motionBlurSamples?, adaptiveSampleLimit? (16–256), preserveFrameRate?: bool (nested or in the render queue it shows only its own frames), preserveResolution?: bool (nested, it renders at full size), pixelAspect?, renderer?: classic3D|advanced3D}",
|
||||||
has_comp,
|
has_comp,
|
||||||
settings
|
settings
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -371,6 +371,27 @@ fn comp_settings_anchor_start_timecode_renderer() {
|
|||||||
assert_eq!(c.renderer, crate::project::Renderer::Advanced3D);
|
assert_eq!(c.renderer, crate::project::Renderer::Advanced3D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `advanced3D` is a value of `renderer`, not a key: comp.new / comp.settings don't advertise it
|
||||||
|
/// in their schemas and reject it as unknown instead of ignoring it (#177).
|
||||||
|
#[test]
|
||||||
|
fn renderer_values_are_not_parameter_keys() {
|
||||||
|
let mut s = Session::default();
|
||||||
|
for (id, p) in [("comp.new", json!({"name": "A"})), ("comp.settings", json!({}))] {
|
||||||
|
let spec = crate::command_specs().iter().find(|c| c.id == id).unwrap();
|
||||||
|
let keys = crate::commands::accepted_params(spec.params).unwrap();
|
||||||
|
assert!(keys.contains(&"renderer".to_string()) && !keys.contains(&"advanced3D".to_string()), "{id}: {keys:?}");
|
||||||
|
let mut bad = p.clone();
|
||||||
|
bad["advanced3D"] = json!(true);
|
||||||
|
let e = s.execute_checked(id, bad).unwrap_err().to_string();
|
||||||
|
assert!(e.contains("unknown parameter(s) `advanced3D`"), "{id}: {e}");
|
||||||
|
let mut good = p;
|
||||||
|
good["renderer"] = json!("advanced3D");
|
||||||
|
s.execute_checked(id, good).unwrap();
|
||||||
|
assert_eq!(s.active_comp().unwrap().renderer, crate::project::Renderer::Advanced3D, "{id}");
|
||||||
|
s.execute("comp.renderer", json!({"renderer": "classic3d"})).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn comp_rejects_zero_and_negative_frame_rates() {
|
fn comp_rejects_zero_and_negative_frame_rates() {
|
||||||
let mut s = Session::default();
|
let mut s = Session::default();
|
||||||
|
|||||||
Reference in New Issue
Block a user