mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Bugfix: first color of the wipe tower preview was incorrect with some models
This commit is contained in:
		
							parent
							
								
									b95a6f2626
								
							
						
					
					
						commit
						db22b2f504
					
				
					 2 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
					@ -1147,7 +1147,8 @@ void WipeTowerPrusaMM::save_on_last_wipe()
 | 
				
			||||||
// Resulting ToolChangeResults are appended into vector "result"
 | 
					// Resulting ToolChangeResults are appended into vector "result"
 | 
				
			||||||
void WipeTowerPrusaMM::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &result)
 | 
					void WipeTowerPrusaMM::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &result)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (m_plan.empty())	return;
 | 
						if (m_plan.empty())
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_extra_spacing = 1.f;
 | 
					    m_extra_spacing = 1.f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1161,8 +1162,9 @@ void WipeTowerPrusaMM::generate(std::vector<std::vector<WipeTower::ToolChangeRes
 | 
				
			||||||
			make_wipe_tower_square();
 | 
								make_wipe_tower_square();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_layer_info = m_plan.begin();
 | 
					    m_layer_info = m_plan.begin();
 | 
				
			||||||
 | 
					    m_current_tool = (unsigned int)(-2); // we don't know which extruder to start with - we'll set it according to the first toolchange
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::vector<WipeTower::ToolChangeResult> layer_result;
 | 
					    std::vector<WipeTower::ToolChangeResult> layer_result;
 | 
				
			||||||
	for (auto layer : m_plan)
 | 
						for (auto layer : m_plan)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		set_layer(layer.z,layer.height,0,layer.z == m_plan.front().z,layer.z == m_plan.back().z);
 | 
							set_layer(layer.z,layer.height,0,layer.z == m_plan.front().z,layer.z == m_plan.back().z);
 | 
				
			||||||
| 
						 | 
					@ -1176,8 +1178,11 @@ void WipeTowerPrusaMM::generate(std::vector<std::vector<WipeTower::ToolChangeRes
 | 
				
			||||||
		if (!m_peters_wipe_tower && m_layer_info->depth < m_wipe_tower_depth - m_perimeter_width)
 | 
							if (!m_peters_wipe_tower && m_layer_info->depth < m_wipe_tower_depth - m_perimeter_width)
 | 
				
			||||||
			m_y_shift = (m_wipe_tower_depth-m_layer_info->depth-m_perimeter_width)/2.f;
 | 
								m_y_shift = (m_wipe_tower_depth-m_layer_info->depth-m_perimeter_width)/2.f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (const auto &toolchange : layer.tool_changes)
 | 
							for (const auto &toolchange : layer.tool_changes) {
 | 
				
			||||||
 | 
					            if (m_current_tool == (unsigned int)(-2))
 | 
				
			||||||
 | 
					                m_current_tool = toolchange.old_tool;
 | 
				
			||||||
			layer_result.emplace_back(tool_change(toolchange.new_tool, false));
 | 
								layer_result.emplace_back(tool_change(toolchange.new_tool, false));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (! layer_finished()) {
 | 
							if (! layer_finished()) {
 | 
				
			||||||
            auto finish_layer_toolchange = finish_layer();
 | 
					            auto finish_layer_toolchange = finish_layer();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -229,7 +229,7 @@ private:
 | 
				
			||||||
	bool m_print_brim = true;
 | 
						bool m_print_brim = true;
 | 
				
			||||||
	// A fill-in direction (positive Y, negative Y) alternates with each layer.
 | 
						// A fill-in direction (positive Y, negative Y) alternates with each layer.
 | 
				
			||||||
	wipe_shape   	m_current_shape = SHAPE_NORMAL;
 | 
						wipe_shape   	m_current_shape = SHAPE_NORMAL;
 | 
				
			||||||
	unsigned int 	m_current_tool  = 0;
 | 
						unsigned int 	m_current_tool;
 | 
				
			||||||
    std::vector<std::vector<float>> wipe_volumes;
 | 
					    std::vector<std::vector<float>> wipe_volumes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	float           m_depth_traversed = 0.f; // Current y position at the wipe tower.
 | 
						float           m_depth_traversed = 0.f; // Current y position at the wipe tower.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue