Commit Graph
3 Commits
Author SHA1 Message Date
Lam Wei Lun 7f124c1b0a Pin expat to 2.10.0 and restore its entity-amplification guard (#17290)
A crafted AMF could freeze Orca on Windows and macOS. The bundled expat 2.5.0 was built without XML_DTD, so its entity-amplification guard was compiled out. Expat 2.10.0 is now built from the release tarball with the guard on. Linux uses the system library only if it is already 2.10.0. Files that rely on unbounded entity expansion now fail to import instead of exhausting memory. The vendored 2.5.0 and 2.2.0 copies are removed, and the old expat.lib in existing Windows deps folders is overwritten. Deps need a rebuild on every platform.
2026-11-07 14:24:08 -06:00
Damir Galeevandyw4z fa5f7e3db4 Keep original body names when importing STEP, AMF and 3MF geometry (#17050)
* Keep original body names when importing STEP, AMF and 3MF geometry

STEP, AMF and 3MF bodies keep the names stored in the file. The three formats share one geometry import path with matching dialogs, per-format Preferences and cleanup of unsupported characters. AMF body groups load as one object, nested groups are flattened, and a CAD 3MF is imported as geometry.

* Use the app's widgets in the geometry import dialogs

Check boxes, radio buttons and the name replacement field in the STEP,
AMF/3MF and name cleanup dialogs now use the app's own controls instead
of the native ones; the name cleanup preview uses the dialogs' label font.

* Address review: AMF layout, Open Project cancel, part visibility

- AMF: the import dialog offers "Separate objects (as before)" first and
  uses it by default, so files from PrusaSlicer and Slic3r, which keep a
  whole plate in one constellation, load as separate objects again. The
  assembly modes are opt-in.
- File > Open Project with a CAD 3MF replaces the project only after the
  import dialogs were answered and the file was read with geometry to load.
  A Cancel or an empty file keeps the current project, its unsaved state,
  notifications and preview state; close_with_confirm() can hand back its
  closing steps for this.
- The object list no longer changes the model while it checks whether a
  single-object import hides its parts: ModelObject::hides_imported_parts()
  is used by the list, Split to parts and its menu check, and the painting
  gizmos' list update shows or hides the parts when painting changes.
  Removing the part rows keeps the object a container for its instances.
- Progress: staged reading takes the first part of the bar and never goes
  back within a file; the load loop takes the rest.
- A constellation id equal to an object id is logged as a warning.
- set_import_volume_order() is defined next to sort_objects().

* Address review: part rename on drag, Multi-part check for unplaced AMF

- Dragging a part of an imported object cancels a name editor that is
  still open before the part rows are rebuilt. On GTK the editor opened by
  pressing the selected row outlived the deleted row and wrote its name
  into another part.
- The Multi-part check reads zero for objects the file does not place, as
  min_z() did in Release builds, instead of their mesh height: the meshes
  are already centered by then, so different heights asked the question
  where main does not.
- Non-printable AMF groups skip the Multi-part question only in the
  assembly modes; Separate objects asks as before.
- The first AMF load mode is "Load as separate objects".

---------

Co-authored-by: yw4z <ywsyildiz@gmail.com>
2026-11-03 14:14:17 +08:00
ExPikaPaka d55e32fed4 Stop reading a missing AMF metadata type as a string (#16060)
A `<metadata>` element without a `type` attribute makes
`get_attribute()` return nullptr, which was then assigned to a
`std::string` and read as a C string.

Check it the way the sibling metadata handler already does, and stop the
parse.

Regression test in `tests/libslic3r/test_amf.cpp`, a new file: the suite
had no AMF test at all.
2026-10-09 19:25:53 +08:00