Render shot editor: camera and frame controls, aspect presets, guides and frame overlay (#6281) (#7232)
* Render shot editor: camera and frame controls, aspect presets, guides and the frame overlay * Render shot: Shot editor and Scene overview to the approved design * Distinguish Render stage variants from native window frames * fix: restore library inspection after clearing shot selection * test: follow the merged Output Check navigation * test: inspect Check without requiring a preflight result * test: cancel Shot removal through its shared dialog action * fix: remove obsolete Inspector stage form after editor integration * fix: preserve Appearance Advanced when clearing Wear focus * test: expect the dedicated Check editor from Scene overview
This commit is contained in:
@@ -87,6 +87,47 @@ fn environment_editor_command_has_schemas_and_strict_validation() {
|
||||
assert!(s.execute("render.environment.set", &json!({"name":"Studio","intensity":2,"unknown":true})).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shot_frame_edits_are_bounded_atomic_and_one_undo_per_edit() {
|
||||
let mut s = Session::default();
|
||||
save(&mut s, json!({"width":800,"height":600}));
|
||||
for patch in [
|
||||
json!({"width":1920,"height":1080}),
|
||||
json!({"width":1080,"height":1920}),
|
||||
json!({"exposure_ev":-32}),
|
||||
json!({"exposure_ev":32}),
|
||||
json!({"camera":{"target":[0,0,0],"yaw":0,"pitch":0,"distance":1e9,"fov":0}}),
|
||||
] {
|
||||
let before = s.doc.clone();
|
||||
let undo = s.undo.len();
|
||||
let evaluations = s.evaluations;
|
||||
save(&mut s, patch.clone());
|
||||
assert_eq!(s.undo.len(), undo + 1);
|
||||
assert_eq!(s.evaluations, evaluations);
|
||||
save(&mut s, patch);
|
||||
assert_eq!(s.undo.len(), undo + 1);
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(s.doc, before);
|
||||
}
|
||||
let before = s.doc.clone();
|
||||
let undo = s.undo.len();
|
||||
for patch in [
|
||||
json!({"width":0}),
|
||||
json!({"height":0}),
|
||||
json!({"width":u32::MAX}),
|
||||
json!({"width":4096,"height":4096}),
|
||||
json!({"width":1e300}),
|
||||
json!({"exposure_ev":32.1}),
|
||||
json!({"exposure_ev":-32.1}),
|
||||
json!({"exposure_ev":null}),
|
||||
json!({"camera":{"target":[0,0,0],"yaw":0,"pitch":0,"distance":0,"fov":0}}),
|
||||
] {
|
||||
assert!(s.execute("render.settings.set", &json!({"name":"Studio","set":patch})).is_err());
|
||||
assert!(Arc::ptr_eq(&s.doc, &before));
|
||||
assert_eq!(s.undo.len(), undo);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[test]
|
||||
fn embedded_hdr_capture_is_offline_atomic_deduplicated_and_undoable_after_source_removal() {
|
||||
|
||||
@@ -54,6 +54,11 @@ CommandSpec::new("view.render_focus", "Render Focus View", crate::checked!("view
|
||||
.icon("render_scene").noundo().doc_only()
|
||||
.contract(&FOCUS_CONTRACT).output(output_schema_for::<RenderFocus>)
|
||||
.params("on: bool → {on}; per-window UI state, never saved in the design; headless validation only"),
|
||||
CommandSpec::new("view.render_frame", "Render Frame Guides", crate::checked!("view.render_frame", render_frame))
|
||||
.icon("camera").noundo().doc_only()
|
||||
.contract(&RENDER_FRAME_CONTRACT)
|
||||
.output(crate::schema::output_schema_for::<crate::schema::view_navigation::RenderFrame>)
|
||||
.params("aspect?: 16:9|3:2|1:1|4:5|9:16|custom; thirds?, safe_area?, centre_mark?: bool. At least one field. Validated transient overlay request, echoed headlessly; never saves guides, changes output size, evaluates geometry or opens a dialog"),
|
||||
CommandSpec::new("view.render_browser", "Render Browser", crate::checked!("view.render_browser", render_browser))
|
||||
.icon("list").noundo().doc_only()
|
||||
.contract(&BROWSER_CONTRACT).output(output_schema_for::<RenderBrowserRequest>)
|
||||
@@ -298,6 +303,17 @@ fn render_browser(_s: &mut Session, p: &Value) -> Result<Value> {
|
||||
serde_json::to_value(request).map_err(|e| bad("view.render_browser", e.to_string()))
|
||||
}
|
||||
|
||||
static RENDER_FRAME_CONTRACT: crate::schema::TypedContract<crate::schema::view_navigation::RenderFrame> = crate::schema::TypedContract::new();
|
||||
|
||||
fn render_frame(_s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cmd = "view.render_frame";
|
||||
let request: crate::schema::view_navigation::RenderFrame = serde_json::from_value(p.clone()).map_err(|e| bad(cmd, e.to_string()))?;
|
||||
if request.aspect.is_none() && request.thirds.is_none() && request.safe_area.is_none() && request.centre_mark.is_none() {
|
||||
return Err(bad(cmd, "expected at least one frame control"));
|
||||
}
|
||||
serde_json::to_value(request).map_err(|e| bad(cmd, e.to_string()))
|
||||
}
|
||||
|
||||
fn render_stage(_s: &mut Session, p: &Value) -> Result<Value> {
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@@ -1071,6 +1087,43 @@ fn render_workspace_shots_strip_is_a_validated_headless_preference_request() {
|
||||
assert_eq!(before, (session.undo.len(), session.redo.len(), session.revision, session.evaluations, session.is_dirty()));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[test]
|
||||
fn render_frame_validates_hostile_requests_without_saving_guides_or_evaluating() {
|
||||
let mut s = Session::default();
|
||||
let document = s.doc.clone();
|
||||
let before = (s.undo.len(), s.redo.len(), s.revision, s.evaluations, s.is_dirty());
|
||||
for mode in [crate::schema::ParamCheck::Off, crate::schema::ParamCheck::Strict] {
|
||||
s.param_check = mode;
|
||||
for aspect in ["16:9", "3:2", "1:1", "4:5", "9:16", "custom"] {
|
||||
let request = json!({"aspect":aspect,"thirds":true,"safe_area":false,"centre_mark":true});
|
||||
assert_eq!(s.execute("view.render_frame", &request).unwrap(), request);
|
||||
}
|
||||
for request in [json!({"thirds":false}), json!({"safe_area":true}), json!({"centre_mark":false})] {
|
||||
assert_eq!(s.execute("view.render_frame", &request).unwrap(), request);
|
||||
}
|
||||
for request in [
|
||||
Value::Null,
|
||||
json!({}),
|
||||
json!([]),
|
||||
json!({"thirds":null}),
|
||||
json!({"thirds":1e300}),
|
||||
json!({"safe_area":"yes"}),
|
||||
json!({"centre_mark":[]}),
|
||||
json!({"aspect":"4:3"}),
|
||||
json!({"aspect":"x".repeat(1025)}),
|
||||
json!({"aspect":null}),
|
||||
json!({"thirds":true,"extra":1}),
|
||||
] {
|
||||
assert!(s.execute("view.render_frame", &request).is_err(), "{request}");
|
||||
}
|
||||
}
|
||||
assert!(std::sync::Arc::ptr_eq(&document, &s.doc));
|
||||
assert_eq!(before, (s.undo.len(), s.redo.len(), s.revision, s.evaluations, s.is_dirty()));
|
||||
let command = crate::find_command("view.render_frame").unwrap();
|
||||
assert!(command.contract.is_some() && command.output.is_some());
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[test]
|
||||
fn render_workspace_stage_validates_without_document_changes_or_evaluation() {
|
||||
|
||||
@@ -145,6 +145,40 @@ impl JsonSchema for RenderSelect {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize, JsonSchema)]
|
||||
pub enum FrameAspect {
|
||||
#[serde(rename = "16:9")]
|
||||
Wide,
|
||||
#[serde(rename = "3:2")]
|
||||
Photo,
|
||||
#[serde(rename = "1:1")]
|
||||
Square,
|
||||
#[serde(rename = "4:5")]
|
||||
Portrait,
|
||||
#[serde(rename = "9:16")]
|
||||
Tall,
|
||||
#[serde(rename = "custom")]
|
||||
Custom,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct RenderFrame {
|
||||
/// Overlay aspect selection only; output dimensions require render.settings.set.
|
||||
#[serde(default, deserialize_with = "super::types::present", skip_serializing_if = "Option::is_none")]
|
||||
#[schemars(with = "FrameAspect")]
|
||||
pub aspect: Option<FrameAspect>,
|
||||
#[serde(default, deserialize_with = "super::types::present", skip_serializing_if = "Option::is_none")]
|
||||
#[schemars(with = "bool")]
|
||||
pub thirds: Option<bool>,
|
||||
#[serde(default, deserialize_with = "super::types::present", skip_serializing_if = "Option::is_none")]
|
||||
#[schemars(with = "bool")]
|
||||
pub safe_area: Option<bool>,
|
||||
#[serde(default, deserialize_with = "super::types::present", skip_serializing_if = "Option::is_none")]
|
||||
#[schemars(with = "bool")]
|
||||
pub centre_mark: Option<bool>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "view_navigation_tests.rs"]
|
||||
mod tests;
|
||||
|
||||
Reference in New Issue
Block a user