mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	#7076 - Modifiers and similar objects always rendered as transparent
This commit is contained in:
		
							parent
							
								
									ce397a0c5c
								
							
						
					
					
						commit
						b9ac80ccd4
					
				
					 4 changed files with 39 additions and 0 deletions
				
			
		|  | @ -73,4 +73,13 @@ | |||
| #define ENABLE_FIX_SUPERSLICER_GCODE_IMPORT (1 && ENABLE_2_4_0_ALPHA3) | ||||
| 
 | ||||
| 
 | ||||
| //====================
 | ||||
| // 2.4.0.alpha4 techs
 | ||||
| //====================
 | ||||
| #define ENABLE_2_4_0_ALPHA4 1 | ||||
| 
 | ||||
| // Enable rendering modifiers and similar objects always as transparent
 | ||||
| #define ENABLE_MODIFIERS_ALWAYS_TRANSPARENT (1 && ENABLE_2_4_0_ALPHA4) | ||||
| 
 | ||||
| 
 | ||||
| #endif // _prusaslicer_technologies_h_
 | ||||
|  |  | |||
|  | @ -464,9 +464,15 @@ std::array<float, 4> color_from_model_volume(const ModelVolume& model_volume) | |||
|         color[2] = 0.2f; | ||||
|     } | ||||
|     else if (model_volume.is_modifier()) { | ||||
| #if ENABLE_MODIFIERS_ALWAYS_TRANSPARENT | ||||
|         color[0] = 1.0f; | ||||
|         color[1] = 1.0f; | ||||
|         color[2] = 0.2f; | ||||
| #else | ||||
|         color[0] = 0.2f; | ||||
|         color[1] = 1.0f; | ||||
|         color[2] = 0.2f; | ||||
| #endif // ENABLE_MODIFIERS_ALWAYS_TRANSPARENT
 | ||||
|     } | ||||
|     else if (model_volume.is_support_blocker()) { | ||||
|         color[0] = 1.0f; | ||||
|  | @ -836,7 +842,15 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab | |||
|         glsafe(::glDisable(GL_CULL_FACE)); | ||||
| 
 | ||||
|     for (GLVolumeWithIdAndZ& volume : to_render) { | ||||
| #if ENABLE_MODIFIERS_ALWAYS_TRANSPARENT | ||||
|         if (type == ERenderType::Transparent) | ||||
|             volume.first->force_transparent = true; | ||||
| #endif // ENABLE_MODIFIERS_ALWAYS_TRANSPARENT
 | ||||
|         volume.first->set_render_color(); | ||||
| #if ENABLE_MODIFIERS_ALWAYS_TRANSPARENT | ||||
|         if (type == ERenderType::Transparent) | ||||
|             volume.first->force_transparent = false; | ||||
| #endif // ENABLE_MODIFIERS_ALWAYS_TRANSPARENT
 | ||||
| 
 | ||||
|         // render sinking contours of non-hovered volumes
 | ||||
|         if (m_show_sinking_contours) | ||||
|  |  | |||
|  | @ -1286,12 +1286,14 @@ bool GLCanvas3D::is_reload_delayed() const | |||
| void GLCanvas3D::enable_layers_editing(bool enable) | ||||
| { | ||||
|     m_layers_editing.set_enabled(enable); | ||||
| #if !ENABLE_MODIFIERS_ALWAYS_TRANSPARENT | ||||
|     const Selection::IndicesList& idxs = m_selection.get_volume_idxs(); | ||||
|     for (unsigned int idx : idxs) { | ||||
|         GLVolume* v = m_volumes.volumes[idx]; | ||||
|         if (v->is_modifier) | ||||
|             v->force_transparent = enable; | ||||
|     } | ||||
| #endif // !ENABLE_MODIFIERS_ALWAYS_TRANSPARENT
 | ||||
| 
 | ||||
|     set_as_dirty(); | ||||
| } | ||||
|  |  | |||
|  | @ -444,11 +444,25 @@ void Selection::clear() | |||
|     if (m_list.empty()) | ||||
|         return; | ||||
| 
 | ||||
| #if ENABLE_MODIFIERS_ALWAYS_TRANSPARENT | ||||
|     // ensure that the volumes get the proper color before next call to render (expecially needed for transparent volumes)
 | ||||
|     for (unsigned int i : m_list) { | ||||
|         GLVolume& volume = *(*m_volumes)[i]; | ||||
|         volume.selected = false; | ||||
|         bool transparent = volume.color[3] < 1.0f; | ||||
|         if (transparent) | ||||
|             volume.force_transparent = true; | ||||
|         volume.set_render_color(); | ||||
|         if (transparent) | ||||
|             volume.force_transparent = false; | ||||
|     } | ||||
| #else | ||||
|     for (unsigned int i : m_list) { | ||||
|         (*m_volumes)[i]->selected = false; | ||||
|         // ensure the volume gets the proper color before next call to render (expecially needed for transparent volumes)
 | ||||
|         (*m_volumes)[i]->set_render_color(); | ||||
|     } | ||||
| #endif // ENABLE_MODIFIERS_ALWAYS_TRANSPARENT
 | ||||
| 
 | ||||
|     m_list.clear(); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 enricoturri1966
						enricoturri1966