Apply rotation angle given by style for new text object

Turn off feature 'use_surface' for new text object
This commit is contained in:
Filip Sykala - NTB T15p 2024-01-03 08:47:11 +01:00
parent b82aa37bf5
commit 1cb156c815

View File

@ -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));
}