Fix for SPE-1544 - Dowels come from model during camera moving in edit connectors mode

This commit is contained in:
YuSanka 2023-03-01 12:18:34 +01:00
parent 6f9e3c2425
commit 3985250b87

View File

@ -996,6 +996,8 @@ void GLGizmoCut3D::update_raycasters_for_picking_transform()
const Vec3d& instance_offset = mo->instances[inst_id]->get_offset(); const Vec3d& instance_offset = mo->instances[inst_id]->get_offset();
const double sla_shift = double(m_c->selection_info()->get_sla_shift()); const double sla_shift = double(m_c->selection_info()->get_sla_shift());
const bool looking_forward = is_looking_forward();
for (size_t i = 0; i < connectors.size(); ++i) { for (size_t i = 0; i < connectors.size(); ++i) {
const CutConnector& connector = connectors[i]; const CutConnector& connector = connectors[i];
@ -1004,9 +1006,8 @@ void GLGizmoCut3D::update_raycasters_for_picking_transform()
Vec3d pos = connector.pos + instance_offset; Vec3d pos = connector.pos + instance_offset;
if (connector.attribs.type == CutConnectorType::Dowel && if (connector.attribs.type == CutConnectorType::Dowel &&
connector.attribs.style == CutConnectorStyle::Prism) { connector.attribs.style == CutConnectorStyle::Prism) {
if (is_looking_forward()) height = 0.05f;
pos -= static_cast<double>(height - 0.05f) * m_clp_normal; if (!looking_forward)
else
pos += 0.05 * m_clp_normal; pos += 0.05 * m_clp_normal;
} }
pos[Z] += sla_shift; pos[Z] += sla_shift;
@ -2065,6 +2066,8 @@ void GLGizmoCut3D::render_connectors()
m_has_invalid_connector = false; m_has_invalid_connector = false;
m_info_stats.invalidate(); m_info_stats.invalidate();
const bool looking_forward = is_looking_forward();
for (size_t i = 0; i < connectors.size(); ++i) { for (size_t i = 0; i < connectors.size(); ++i) {
const CutConnector& connector = connectors[i]; const CutConnector& connector = connectors[i];
@ -2093,20 +2096,19 @@ void GLGizmoCut3D::render_connectors()
if (connector.attribs.type == CutConnectorType::Dowel && if (connector.attribs.type == CutConnectorType::Dowel &&
connector.attribs.style == CutConnectorStyle::Prism) { connector.attribs.style == CutConnectorStyle::Prism) {
if (m_connectors_editing) { if (m_connectors_editing) {
if (is_looking_forward()) height = 0.05f;
pos -= static_cast<double>(height-0.05f) * m_clp_normal; if (!looking_forward)
else
pos += 0.05 * m_clp_normal; pos += 0.05 * m_clp_normal;
} }
else { else {
if (is_looking_forward()) if (looking_forward)
pos -= static_cast<double>(height) * m_clp_normal; pos -= static_cast<double>(height) * m_clp_normal;
else else
pos += static_cast<double>(height) * m_clp_normal; pos += static_cast<double>(height) * m_clp_normal;
height *= 2; height *= 2;
} }
} }
else if (!is_looking_forward()) else if (!looking_forward)
pos += 0.05 * m_clp_normal; pos += 0.05 * m_clp_normal;
const Transform3d view_model_matrix = camera.get_view_matrix() * translation_transform(pos) * m_rotation_m * const Transform3d view_model_matrix = camera.get_view_matrix() * translation_transform(pos) * m_rotation_m *