3D (Classic): Revolve (Classic) sweeps a profile with Angle, Cap and Offset and the classic surfaces

Effect › 3D and Materials › 3D (Classic) › Revolve (Classic)… sweeps the
profile round a vertical axis, as Revolve does, and draws every face with
the Wireframe, No Shading, Diffuse and Plastic surfaces of Extrude & Bevel
(Classic).

- `effect.apply` with `threeD.classicRevolve`: Angle (0 to 360), Cap,
  Offset (0 to 1000 pt) from the left or right edge of the profile's
  bounds, the Position rotation and Perspective, and the classic lights,
  Ambient Light, highlight, Blend Steps and Shading Color.
- Groups and layers revolve about one shared axis, and the effect also
  goes on a fill or stroke, as Revolve's does.
- `effect.lightingPreset` refuses it, as it refuses Extrude & Bevel
  (Classic).
- Revolve faces carry their view-space normal, and
  `three_d::revolve_facets` hands them to the classic surface code.
- Unknown parameters, numbers out of range and bad flags, edges,
  surfaces and colors are refused with an error.
This commit is contained in:
dotCooCoo
2026-11-11 23:04:22 -08:00
parent 485d4e3fff
commit 5d8065e929
49 changed files with 550 additions and 91 deletions
@@ -115,3 +115,18 @@ fn lighting_presets_refuse_extrude_and_bevel_classic_and_leave_a_mixed_selection
let params = &s.doc().unwrap().doc.node(NodeId(classic)).unwrap().appearance.effects[0].params;
assert_eq!((params["lightRotation"].as_f64(), params["lightHeight"].as_f64()), (Some(135.0), Some(45.0)));
}
#[test]
fn lighting_presets_refuse_revolve_classic() {
let mut s = Session::new();
s.execute("file.new", &json!({})).unwrap();
let id = s.execute("path.create", &json!({"d":"M100 40 L130 60 L130 140 L100 160"})).unwrap()["id"].as_u64().unwrap();
s.execute("paint.setFill", &json!({"color":"#3366cc"})).unwrap();
s.execute("effect.apply", &json!({"effect":"threeD.classicRevolve","item":null,"params":{"surface":"diffuse"}})).unwrap();
s.doc_mut().unwrap().mark_saved();
let before = s.doc().unwrap().doc.clone();
let err = s.execute("effect.lightingPreset", &json!({"ids":[id],"index":0,"item":null,"preset":"topLeft"})).unwrap_err().to_string();
assert!(err.contains(&format!("object {id}: Revolve (Classic) at index 0 has no lighting presets")), "{err}");
assert_eq!(s.doc().unwrap().doc, before);
assert!(!s.doc().unwrap().is_dirty());
}