mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Partial revert of 204714d566 -> Alternate fix for crash on printer presets switching between MM and SM printers
				
					
				
			This commit is contained in:
		
							parent
							
								
									49f7d11940
								
							
						
					
					
						commit
						e1c201e714
					
				
					 2 changed files with 11 additions and 17 deletions
				
			
		|  | @ -1458,6 +1458,8 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) | |||
|     if (m_moves_count == 0) | ||||
|         return; | ||||
| 
 | ||||
|     m_extruders_count = gcode_result.extruders_count; | ||||
| 
 | ||||
|     unsigned int progress_count = 0; | ||||
|     static const unsigned int progress_threshold = 1000; | ||||
|     wxProgressDialog* progress_dialog = wxGetApp().is_gcode_viewer() ? | ||||
|  | @ -4079,15 +4081,12 @@ void GCodeViewer::render_legend() const | |||
|                 } | ||||
|             } | ||||
|         } | ||||
|         else // multi extruder use case
 | ||||
|         { | ||||
|         else { // multi extruder use case
 | ||||
|             // shows only extruders actually used
 | ||||
|             for (unsigned char i : m_extruder_ids) { | ||||
|                 std::vector<std::pair<Color, std::pair<double, double>>> cp_values = color_print_ranges(i, custom_gcode_per_print_z); | ||||
|                 const int items_cnt = static_cast<int>(cp_values.size()); | ||||
|                 if (items_cnt == 0) { // There are no color changes, but there are some pause print or custom Gcode
 | ||||
|                     if (i >= m_tool_colors.size()) | ||||
|                         break; | ||||
|                     append_item(EItemType::Rect, m_tool_colors[i], _u8L("Extruder") + " " + std::to_string(i + 1) + " " + _u8L("default color")); | ||||
|                 } | ||||
|                 else { | ||||
|  | @ -4148,11 +4147,6 @@ void GCodeViewer::render_legend() const | |||
|             for (int i = 0; i < extruders_count; ++i) { | ||||
|                 last_color[i] = m_tool_colors[i]; | ||||
|             } | ||||
|             auto get_last_color = [last_color](int extruder_id) { | ||||
|                 if (extruder_id >= (int)last_color.size()) | ||||
|                     return last_color[0]; | ||||
|                 return last_color[extruder_id - 1]; | ||||
|             }; | ||||
|             int last_extruder_id = 1; | ||||
|             for (const auto& time_rec : times) { | ||||
|                 switch (time_rec.first) | ||||
|  | @ -4160,7 +4154,7 @@ void GCodeViewer::render_legend() const | |||
|                 case CustomGCode::PausePrint: { | ||||
|                     auto it = std::find_if(custom_gcode_per_print_z.begin(), custom_gcode_per_print_z.end(), [time_rec](const CustomGCode::Item& item) { return item.type == time_rec.first; }); | ||||
|                     if (it != custom_gcode_per_print_z.end()) { | ||||
|                         items.push_back({ PartialTime::EType::Print, it->extruder, get_last_color(it->extruder), Color(), time_rec.second }); | ||||
|                         items.push_back({ PartialTime::EType::Print, it->extruder, last_color[it->extruder - 1], Color(), time_rec.second }); | ||||
|                         items.push_back({ PartialTime::EType::Pause, it->extruder, Color(), Color(), time_rec.second }); | ||||
|                         custom_gcode_per_print_z.erase(it); | ||||
|                     } | ||||
|  | @ -4169,14 +4163,14 @@ void GCodeViewer::render_legend() const | |||
|                 case CustomGCode::ColorChange: { | ||||
|                     auto it = std::find_if(custom_gcode_per_print_z.begin(), custom_gcode_per_print_z.end(), [time_rec](const CustomGCode::Item& item) { return item.type == time_rec.first; }); | ||||
|                     if (it != custom_gcode_per_print_z.end()) { | ||||
|                         items.push_back({ PartialTime::EType::Print, it->extruder, get_last_color(it->extruder), Color(), time_rec.second }); | ||||
|                         items.push_back({ PartialTime::EType::ColorChange, it->extruder, get_last_color(it->extruder), decode_color(it->color), time_rec.second }); | ||||
|                         items.push_back({ PartialTime::EType::Print, it->extruder, last_color[it->extruder - 1], Color(), time_rec.second }); | ||||
|                         items.push_back({ PartialTime::EType::ColorChange, it->extruder, last_color[it->extruder - 1], decode_color(it->color), time_rec.second }); | ||||
|                         last_color[it->extruder - 1] = decode_color(it->color); | ||||
|                         last_extruder_id = it->extruder; | ||||
|                         custom_gcode_per_print_z.erase(it); | ||||
|                     } | ||||
|                     else | ||||
|                         items.push_back({ PartialTime::EType::Print, last_extruder_id, get_last_color(last_extruder_id), Color(), time_rec.second }); | ||||
|                         items.push_back({ PartialTime::EType::Print, last_extruder_id, last_color[last_extruder_id - 1], Color(), time_rec.second }); | ||||
| 
 | ||||
|                     break; | ||||
|                 } | ||||
|  |  | |||
|  | @ -5653,8 +5653,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) | |||
|     bool update_scheduled = false; | ||||
|     bool bed_shape_changed = false; | ||||
|     for (auto opt_key : p->config->diff(config)) { | ||||
|         if (opt_key == "filament_colour") | ||||
|         { | ||||
|         if (opt_key == "filament_colour") { | ||||
|             update_scheduled = true; // update should be scheduled (for update 3DScene) #2738
 | ||||
| 
 | ||||
|             if (update_filament_colors_in_full_config()) { | ||||
|  | @ -5689,10 +5688,11 @@ void Plater::on_config_change(const DynamicPrintConfig &config) | |||
|         else if(opt_key == "extruder_colour") { | ||||
|             update_scheduled = true; | ||||
|             p->sidebar->obj_list()->update_extruder_colors(); | ||||
|         } else if(opt_key == "max_print_height") { | ||||
|             update_scheduled = true; | ||||
|         } | ||||
|         else if(opt_key == "max_print_height") | ||||
|             update_scheduled = true; | ||||
|         else if (opt_key == "printer_model") { | ||||
|             p->reset_gcode_toolpaths(); | ||||
|             // update to force bed selection(for texturing)
 | ||||
|             bed_shape_changed = true; | ||||
|             update_scheduled = true; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 enricoturri1966
						enricoturri1966