Browse Source

Merge branch 'fs_fix_SPE-2095' into master_27x

Filip Sykala - NTB T15p 1 year ago
parent
commit
b3beeb9193
1 changed files with 17 additions and 2 deletions
  1. 17 2
      src/slic3r/GUI/Jobs/EmbossJob.cpp

+ 17 - 2
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<float> angle = {};
 };
 
 /// <summary>
@@ -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<float> 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<GLGizmosManager::EType>(input.gizmo);
-    DataCreateObject data{std::move(emboss_data), coor, input.camera, bed_shape, gizmo_type};
-    auto             job = std::make_unique<CreateObjectJob>(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<CreateObjectJob>(std::move(data));
     return queue_job(input.worker, std::move(job));
 }