mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 12:55:53 +08:00
Reset for up vector
This commit is contained in:
parent
f92be6f697
commit
e23c89315b
@ -561,23 +561,11 @@ bool GLGizmoEmboss::on_mouse_for_translate(const wxMouseEvent &mouse_event)
|
|||||||
// write transformation from UI into model
|
// write transformation from UI into model
|
||||||
m_parent.do_move(L("Surface move"));
|
m_parent.do_move(L("Surface move"));
|
||||||
|
|
||||||
// Update surface by new position
|
// Update surface by new position
|
||||||
bool need_process = m_volume->text_configuration->style.prop.use_surface;
|
if (m_volume->text_configuration->style.prop.use_surface)
|
||||||
|
|
||||||
//if (m_surface_drag->y_scale.has_value()) {
|
|
||||||
// m_style_manager.get_style().prop.size_in_mm *= (*m_surface_drag->y_scale);
|
|
||||||
// need_process |= set_height();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (m_surface_drag->z_scale.has_value()) {
|
|
||||||
// m_style_manager.get_style().prop.emboss *= (*m_surface_drag->z_scale);
|
|
||||||
// need_process |= set_depth();
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (need_process)
|
|
||||||
process();
|
process();
|
||||||
|
|
||||||
// calculate scale
|
// Show correct value of height & depth inside of inputs
|
||||||
calculate_scale();
|
calculate_scale();
|
||||||
|
|
||||||
// allow moving with object again
|
// allow moving with object again
|
||||||
@ -3557,15 +3545,24 @@ void GLGizmoEmboss::draw_advanced()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(_u8L("Reset scale").c_str())) {
|
if (ImGui::Button(_u8L("Reset Up").c_str())) {
|
||||||
GLVolume *gl_volume = priv::get_gl_volume(m_parent);
|
GLVolume *gl_volume = priv::get_gl_volume(m_parent);
|
||||||
if (gl_volume != nullptr) {
|
if (gl_volume != nullptr) {
|
||||||
//Transform3d w = gl_volume->world_matrix();
|
Transform3d world = gl_volume->world_matrix();
|
||||||
//priv::reset_skew_respect_z(w);
|
auto world_linear = world.linear();
|
||||||
//Transform3d i = gl_volume->get_instance_transformation().get_matrix();
|
Vec3d z_world = world_linear.col(2);
|
||||||
//Transform3d v_new = i.inverse() * w;
|
z_world.normalize();
|
||||||
//gl_volume->set_volume_transformation(v_new);
|
Vec3d wanted_up = suggest_up(z_world);
|
||||||
//m_parent.do_move(L("Reset scale"));
|
|
||||||
|
Vec3d y_world = world_linear.col(1);
|
||||||
|
auto z_rotation = Eigen::Quaternion<double, Eigen::DontAlign>::FromTwoVectors(y_world, wanted_up);
|
||||||
|
Transform3d world_new = z_rotation * world;
|
||||||
|
auto world_new_linear = world_new.linear();
|
||||||
|
Transform3d volume_new = gl_volume->get_volume_transformation().get_matrix();
|
||||||
|
Transform3d instance = gl_volume->get_instance_transformation().get_matrix();
|
||||||
|
volume_new.linear() = instance.linear().inverse() * world_new.linear();
|
||||||
|
gl_volume->set_volume_transformation(volume_new);
|
||||||
|
m_parent.do_move(L("Reset up vector"));
|
||||||
}
|
}
|
||||||
} else if (ImGui::IsItemHovered()) {
|
} else if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("%s", _u8L("Reset skew of text to be normal in world").c_str());
|
ImGui::SetTooltip("%s", _u8L("Reset skew of text to be normal in world").c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user