3D: layer.newLight lists the Environment light and how to set its source; parity notes reflections (#261)

The Environment light existed (LightKind::Environment) but layer.newLight's help
and the kind errors of layer.newLight and layer.lightSettings listed only
Parallel|Spot|Point|Ambient, so agents could not find it. The help now lists it
and says how to give it an equirectangular image: prop.set
lightOptions/source to that layer's id, or leave it empty for the comp's
Environment Layer (layer.environment). layer.lightSettings documents its kind
values too.

docs/parity.md (3D) notes that Advanced 3D surfaces reflect only the
Environment light and that Appears in Reflections is stored but has no visible
effect yet. Object-to-object reflections stay tracked in #261.

Test: tests_3d::environment_light_is_listed_and_takes_a_source_layer (help and
both kind errors name every LightKind; an Environment light takes a source
layer by id, with undo).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1RGTt6AE3ysiaMQ7X6Nea
This commit is contained in:
pat-the-wizard
2026-10-08 11:57:55 +00:00
co-authored by Claude Opus 5.5
parent 52ab38fcff
commit 84fba2a434
3 changed files with 36 additions and 7 deletions
+25
View File
@@ -106,6 +106,31 @@ fn new_light_and_change_type() {
assert!(s.execute("layer.newLight", json!({"kind": "Laser"})).is_err());
}
/// The Environment light is listed in `layer.newLight`'s help and in the kind errors, and takes
/// its equirectangular source as a layer id (#261).
#[test]
fn environment_light_is_listed_and_takes_a_source_layer() {
let mut s = session();
let spec = crate::command_specs().iter().find(|c| c.id == "layer.newLight").unwrap();
assert!(spec.params.contains("lightOptions/source"), "{}", spec.params);
let e = s.execute("layer.newLight", json!({"kind": "Laser"})).unwrap_err().to_string();
let point = s.execute("layer.newLight", json!({"kind": "Point"})).unwrap()["layer"].as_u64().unwrap();
let e2 = s.execute("layer.lightSettings", json!({"layer": point, "kind": "Laser"})).unwrap_err().to_string();
for k in LightKind::ALL {
assert!(spec.params.contains(k.label()), "help lists {}: {}", k.label(), spec.params);
assert!(e.contains(k.label()) && e2.contains(k.label()), "{e} / {e2}");
}
let sky = s.execute("layer.newSolid", json!({"width": 256, "height": 128, "name": "Sky"})).unwrap()["layer"].as_u64().unwrap();
let env = s.execute("layer.newLight", json!({"kind": "Environment", "name": "Env"})).unwrap()["layer"].as_u64().unwrap();
let source = s.active_comp().unwrap().layer(effectcraft_project::LayerId(env)).unwrap().source.clone();
assert_eq!(source, LayerSource::Light { kind: LightKind::Environment });
assert_eq!(prop(&s, env, "lightOptions/source").as_layer(), None, "empty: the comp's Environment Layer");
s.execute("prop.set", json!({"layer": env, "path": "lightOptions/source", "value": sky})).unwrap();
assert_eq!(prop(&s, env, "lightOptions/source").as_layer(), Some(sky));
s.undo();
assert_eq!(prop(&s, env, "lightOptions/source").as_layer(), None);
}
#[test]
fn three_d_switch_undo_redo() {
let mut s = session();