From 6daaed3b1f7e496d4ef912352e14d7507a67663a Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Wed, 13 Sep 2023 11:57:23 +0200 Subject: [PATCH] Load old align as center --- src/libslic3r/Format/3mf.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index c72256a8fc..e9c7695f7a 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -3652,11 +3652,17 @@ std::optional TextConfigurationSerialization::read(const char int per_glyph = get_attribute_value_int(attributes, num_attributes, PER_GLYPH_ATTR); if (per_glyph == 1) fp.per_glyph = true; - int horizontal = get_attribute_value_int(attributes, num_attributes, HORIZONTAL_ALIGN_ATTR); - int vertical = get_attribute_value_int(attributes, num_attributes, VERTICAL_ALIGN_ATTR); - fp.align = FontProp::Align( - static_cast(horizontal), - static_cast(vertical)); + if (get_attribute_value_string(attributes, num_attributes, HORIZONTAL_ALIGN_ATTR).empty()){ + // align is not set(version without align) --> center is near previous version + fp.align = {FontProp::HorizontalAlign::center, FontProp::VerticalAlign::center}; + } else{ + int horizontal = get_attribute_value_int(attributes, num_attributes, HORIZONTAL_ALIGN_ATTR); + int vertical = get_attribute_value_int(attributes, num_attributes, VERTICAL_ALIGN_ATTR); + fp.align = FontProp::Align( + static_cast(horizontal), + static_cast(vertical)); + } + int collection_number = get_attribute_value_int(attributes, num_attributes, COLLECTION_NUMBER_ATTR); if (collection_number > 0) fp.collection_number = static_cast(collection_number); @@ -3783,6 +3789,9 @@ std::optional read_emboss_shape(const char **attributes, unsigned i EmbossProjection projection; projection.depth = get_attribute_value_float(attributes, num_attributes, DEPTH_ATTR); + if (is_approx(projection.depth, 0.)) + projection.depth = 10.; + int use_surface = get_attribute_value_int(attributes, num_attributes, USE_SURFACE_ATTR); if (use_surface == 1) projection.use_surface = true;