Skip to content

Commit

Permalink
Apply rotation angle given by style for new text object
Browse files Browse the repository at this point in the history
Turn off feature 'use_surface' for new text object
  • Loading branch information
Jony01 committed Jan 3, 2024
1 parent b82aa37 commit 1cb156c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/slic3r/GUI/Jobs/EmbossJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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));
}

Expand Down

0 comments on commit 1cb156c

Please sign in to comment.