mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 00:11:57 +08:00
New gcode visualization integration - Fixed top layer only visualization for MMU printers
This commit is contained in:
parent
0feb93206b
commit
9cec7dc3a2
@ -786,8 +786,7 @@ void ViewerImpl::toggle_option_visibility(EOptionType type)
|
|||||||
try {
|
try {
|
||||||
bool& value = m_settings.options_visibility.at(type);
|
bool& value = m_settings.options_visibility.at(type);
|
||||||
value = !value;
|
value = !value;
|
||||||
if (type == EOptionType::Travels)
|
m_settings.update_view_global_range = true;
|
||||||
m_settings.update_view_global_range = true;
|
|
||||||
m_settings.update_enabled_entities = true;
|
m_settings.update_enabled_entities = true;
|
||||||
m_settings.update_colors = true;
|
m_settings.update_colors = true;
|
||||||
}
|
}
|
||||||
@ -811,6 +810,7 @@ void ViewerImpl::toggle_extrusion_role_visibility(EGCodeExtrusionRole role)
|
|||||||
try {
|
try {
|
||||||
bool& value = m_settings.extrusion_roles_visibility.at(role);
|
bool& value = m_settings.extrusion_roles_visibility.at(role);
|
||||||
value = !value;
|
value = !value;
|
||||||
|
m_settings.update_view_global_range = true;
|
||||||
m_settings.update_enabled_entities = true;
|
m_settings.update_enabled_entities = true;
|
||||||
m_settings.update_colors = true;
|
m_settings.update_colors = true;
|
||||||
}
|
}
|
||||||
@ -864,17 +864,14 @@ void ViewerImpl::set_view_current_range(uint32_t min, uint32_t max)
|
|||||||
Range new_range;
|
Range new_range;
|
||||||
new_range.set(min_id, max_id);
|
new_range.set(min_id, max_id);
|
||||||
|
|
||||||
if (m_view_range.get_current() != new_range.get()) {
|
// force update of global range, if required, to avoid clamping the current range with global old values
|
||||||
if (m_settings.update_view_global_range) {
|
// when calling set_current_range()
|
||||||
// force update of global range, if required, to avoid clamping the current range with global old values
|
update_view_global_range();
|
||||||
// when calling set_current_range()
|
m_settings.update_view_global_range = false;
|
||||||
update_view_global_range();
|
|
||||||
m_settings.update_view_global_range = false;
|
m_view_range.set_current(new_range);
|
||||||
}
|
m_settings.update_enabled_entities = true;
|
||||||
m_view_range.set_current(new_range);
|
m_settings.update_colors = true;
|
||||||
m_settings.update_enabled_entities = true;
|
|
||||||
m_settings.update_colors = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ViewerImpl::get_vertices_count() const
|
size_t ViewerImpl::get_vertices_count() const
|
||||||
@ -1085,18 +1082,19 @@ void ViewerImpl::set_tool_marker_alpha(float alpha)
|
|||||||
}
|
}
|
||||||
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
|
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
|
||||||
|
|
||||||
static bool is_visible(EMoveType type, const Settings& settings)
|
static bool is_visible(const PathVertex& v, const Settings& settings)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return ((type == EMoveType::Travel && !settings.options_visibility.at(EOptionType::Travels)) ||
|
return ((v.type == EMoveType::Travel && !settings.options_visibility.at(EOptionType::Travels)) ||
|
||||||
(type == EMoveType::Wipe && !settings.options_visibility.at(EOptionType::Wipes)) ||
|
(v.type == EMoveType::Wipe && !settings.options_visibility.at(EOptionType::Wipes)) ||
|
||||||
(type == EMoveType::Retract && !settings.options_visibility.at(EOptionType::Retractions)) ||
|
(v.type == EMoveType::Retract && !settings.options_visibility.at(EOptionType::Retractions)) ||
|
||||||
(type == EMoveType::Unretract && !settings.options_visibility.at(EOptionType::Unretractions)) ||
|
(v.type == EMoveType::Unretract && !settings.options_visibility.at(EOptionType::Unretractions)) ||
|
||||||
(type == EMoveType::Seam && !settings.options_visibility.at(EOptionType::Seams)) ||
|
(v.type == EMoveType::Seam && !settings.options_visibility.at(EOptionType::Seams)) ||
|
||||||
(type == EMoveType::ToolChange && !settings.options_visibility.at(EOptionType::ToolChanges)) ||
|
(v.type == EMoveType::ToolChange && !settings.options_visibility.at(EOptionType::ToolChanges)) ||
|
||||||
(type == EMoveType::ColorChange && !settings.options_visibility.at(EOptionType::ColorChanges)) ||
|
(v.type == EMoveType::ColorChange && !settings.options_visibility.at(EOptionType::ColorChanges)) ||
|
||||||
(type == EMoveType::PausePrint && !settings.options_visibility.at(EOptionType::PausePrints)) ||
|
(v.type == EMoveType::PausePrint && !settings.options_visibility.at(EOptionType::PausePrints)) ||
|
||||||
(type == EMoveType::CustomGCode && !settings.options_visibility.at(EOptionType::CustomGCodes))) ? false : true;
|
(v.type == EMoveType::CustomGCode && !settings.options_visibility.at(EOptionType::CustomGCodes)) ||
|
||||||
|
(v.type == EMoveType::Extrude && !settings.extrusion_roles_visibility.at(v.role))) ? false : true;
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
return false;
|
return false;
|
||||||
@ -1110,7 +1108,7 @@ void ViewerImpl::update_view_global_range()
|
|||||||
|
|
||||||
auto first_it = m_vertices.begin();
|
auto first_it = m_vertices.begin();
|
||||||
while (first_it != m_vertices.end() &&
|
while (first_it != m_vertices.end() &&
|
||||||
(first_it->layer_id < layers_range[0] || !is_visible(first_it->type, m_settings))) {
|
(first_it->layer_id < layers_range[0] || !is_visible(*first_it, m_settings))) {
|
||||||
++first_it;
|
++first_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1140,7 +1138,7 @@ void ViewerImpl::update_view_global_range()
|
|||||||
--rev_last_it;
|
--rev_last_it;
|
||||||
|
|
||||||
bool reduced = false;
|
bool reduced = false;
|
||||||
while (rev_last_it != rev_first_it && !is_visible(rev_last_it->type, m_settings)) {
|
while (rev_last_it != rev_first_it && !is_visible(*rev_last_it, m_settings)) {
|
||||||
++rev_last_it;
|
++rev_last_it;
|
||||||
reduced = true;
|
reduced = true;
|
||||||
}
|
}
|
||||||
@ -1150,7 +1148,8 @@ void ViewerImpl::update_view_global_range()
|
|||||||
|
|
||||||
if (travels_visible) {
|
if (travels_visible) {
|
||||||
// if the global range ends with a travel move, extend it to the travel end
|
// if the global range ends with a travel move, extend it to the travel end
|
||||||
while (last_it != m_vertices.end() && last_it + 1 != m_vertices.end() && last_it->is_travel()) {
|
while (last_it != m_vertices.end() && last_it + 1 != m_vertices.end() &&
|
||||||
|
last_it->is_travel() && (last_it + 1)->is_travel()) {
|
||||||
++last_it;
|
++last_it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user