mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-08 22:35:15 -06:00
Prevent writing empty materials to AMF files. Also add a note about material-id = 0 being reserved by AMF spec. #2871
This commit is contained in:
parent
e26022a2f2
commit
fbea32a81c
2 changed files with 4 additions and 1 deletions
|
@ -36,7 +36,9 @@ sub write_file {
|
|||
printf $fh qq{<amf unit="millimeter">\n};
|
||||
printf $fh qq{ <metadata type="cad">Slic3r %s</metadata>\n}, $Slic3r::VERSION;
|
||||
for my $material_id (sort @{ $model->material_names }) {
|
||||
next if $material_id eq '';
|
||||
my $material = $model->get_material($material_id);
|
||||
# note that material-id must never be 0 since it's reserved by the AMF spec
|
||||
printf $fh qq{ <material id="%s">\n}, $material_id;
|
||||
for (keys %{$material->attributes}) {
|
||||
printf $fh qq{ <metadata type=\"%s\">%s</metadata>\n}, $_, $material->attributes->{$_};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue