3D: a wireframe is not refused for graphics it does not draw

Extrude & Bevel, Inflate and Rotate in wireframe mode draw the faces' edges
with no graphics, but the graphics' art was still checked against its
limits, and Inflate still built its puffed surface with the graphics on
it, so a wireframe could be refused as too complex. Neither check runs in
wireframe mode now, as Revolve already skips them.
This commit is contained in:
dotCooCoo
2026-11-15 09:16:05 -08:00
parent 1c6269421d
commit f725dd8caa
3 changed files with 32 additions and 4 deletions
+5 -3
View File
@@ -309,7 +309,8 @@ pub fn validate_solid_in(doc: Option<&Document>, n: &Node, id: &str, p: &Value)
/// Inflate or Rotate, as drawn, or a new one after its other effects when it has none.
fn validate_solid_for(doc: Option<&Document>, n: &Node, id: &str, p: &Value, at: (Option<usize>, Option<usize>)) -> Result<(), String> {
validate_solid_params(id, p)?;
if let Some(doc) = doc {
// In wireframe mode the edges are drawn with no graphics, and their art is not checked.
if let Some(doc) = doc.filter(|_| !wireframe::wireframe_params(id, p)) {
graphics::validate_symbols(doc, p)?;
}
let label = label_of(id);
@@ -362,10 +363,11 @@ fn check_cast(id: &str, p: &Value, shapes: &[Profile]) -> Result<(), String> {
/// past their limits on the front and puffed back of the solids of `shapes`: their art, or the
/// parts they draw on its pieces ([`graphics::surface_parts`]), or when the solids can't be built
/// with their pieces carrying the graphics. They are built as the art builds them
/// ([`surfaces_with`]). Without `doc` nothing is drawn, and nothing is checked.
/// ([`surfaces_with`]). Without `doc` nothing is drawn, and nothing is checked. In wireframe mode no
/// graphics are drawn, and none are checked.
fn check_membrane_graphics(doc: Option<&Document>, n: &Node, id: &str, p: &Value, shapes: &[Profile]) -> Result<(), String> {
let Some(doc) = doc else { return Ok(()) };
if id != INFLATE || mapped_graphics(p).is_empty() {
if id != INFLATE || wireframe::wireframe_params(id, p) || mapped_graphics(p).is_empty() {
return Ok(());
}
for face in PlanarFace::ALL {
@@ -463,6 +463,31 @@ fn the_symbol_check_counts_what_the_view_draws() {
assert!(validate_three_d_in(Some(&dense_document(true)), &n, EXTRUDE, &flat).is_ok());
}
#[test]
fn a_wireframe_is_not_refused_for_graphics_it_does_not_draw() {
let check = |d: &Document, id: &str, mut p: Value, wire: bool| {
if wire {
p["render"] = json!({"mode": "wireframe"});
}
validate_three_d_in(Some(d), &object(id, p.clone()), id, &p)
};
// The straight 30,000-sided polygon at 1000% fits the symbol limit, but cut into pieces on
// Inflate's puffed front it is too complex.
let straight = dense_document(false);
let big = json!({"perspectiveAngle": 0.0, "graphics": [{"symbol": "Dense", "scale": 1000.0}]});
assert!(validate_symbols(&straight, &big).is_ok());
let e = check(&straight, INFLATE, big.clone(), false).unwrap_err();
assert!(e.contains("too complex"), "{e}");
// Two copies of the curved one under a perspective are past the symbol limit on Extrude & Bevel.
let curved = dense_document(true);
let two = json!({"perspectiveAngle": 60.0, "graphics": [{"symbol": "Dense"}, {"symbol": "Dense", "face": "back"}]});
let e = check(&curved, EXTRUDE, two.clone(), false).unwrap_err();
assert!(e.contains("too complex"), "{e}");
// A wireframe draws the faces' edges and no graphics, so neither is checked.
assert_eq!(check(&straight, INFLATE, big, true), Ok(()));
assert_eq!(check(&curved, EXTRUDE, two, true), Ok(()));
}
#[test]
fn a_plane_and_a_hollow_solid() {
let d = document();
+2 -1
View File
@@ -4244,7 +4244,8 @@ joins the edges, so with such an effect its paths can differ from the drawn ones
draw the edges, and `effect.expandAppearance` keeps them as paths. Past 1,000,000 edges the source path is drawn, as
it is for a solid past its limits. A `render` that is not an object, a key other than `mode`, another mode, and
`render` on Extrude & Bevel (Classic), Revolve (Classic) or Rotate (Classic) are refused before the document
changes. See [three-d.md](three-d.md#3d-and-materials-panel).
changes. In wireframe mode the graphics' art is not checked against the graphics limits, so art too complex for the
shaded surface does not refuse the wireframe. See [three-d.md](three-d.md#3d-and-materials-panel).
```json
{"name":"run_command","arguments":{"command":"effect.setParams","params":{"index":0,"item":null,"params":{"render":{"mode":"wireframe"}}}}}