From 1cb156c815e138d3fb23718bcec75872949fd215 Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Wed, 3 Jan 2024 08:47:11 +0100 Subject: [PATCH] Apply rotation angle given by style for new text object Turn off feature 'use_surface' for new text object --- src/slic3r/GUI/Jobs/EmbossJob.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Jobs/EmbossJob.cpp b/src/slic3r/GUI/Jobs/EmbossJob.cpp index 2bd85054ba..32b0effbd7 100644 --- a/src/slic3r/GUI/Jobs/EmbossJob.cpp +++ b/src/slic3r/GUI/Jobs/EmbossJob.cpp @@ -102,6 +102,9 @@ struct DataCreateObject // Define which gizmo open on the success GLGizmosManager::EType gizmo; + + // additionl rotation around Z axe, given by style settings + std::optional angle = {}; }; /// @@ -330,6 +333,12 @@ void CreateObjectJob::process(Ctl &ctl) offset -= m_result.center(); Transform3d::TranslationType tt(offset.x(), offset.y(), offset.z()); m_transformation = Transform3d(tt); + + // rotate around Z by style settings + if (m_input.angle.has_value()) { + std::optional distance; // new object ignore surface distance from style settings + apply_transformation(m_input.angle, distance, m_transformation); + } } void CreateObjectJob::finalize(bool canceled, std::exception_ptr &eptr) @@ -1485,8 +1494,14 @@ bool start_create_object_job(const CreateVolumeParams &input, DataBasePtr emboss { const Pointfs &bed_shape = input.build_volume.bed_shape(); auto gizmo_type = static_cast(input.gizmo); - DataCreateObject data{std::move(emboss_data), coor, input.camera, bed_shape, gizmo_type}; - auto job = std::make_unique(std::move(data)); + DataCreateObject data{std::move(emboss_data), coor, input.camera, bed_shape, gizmo_type, input.angle}; + + // Fix: adding text on print bed with style containing use_surface + if (data.base->shape.projection.use_surface) + // Til the print bed is flat using surface for Object is useless + data.base->shape.projection.use_surface = false; + + auto job = std::make_unique(std::move(data)); return queue_job(input.worker, std::move(job)); }