mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	FDM painting gizmos (support/seam) now render object in neutral color
The goal is to ensure enough contrast independent on current filament color
This commit is contained in:
		
							parent
							
								
									2647dd1d5d
								
							
						
					
					
						commit
						f890cd5b9c
					
				
					 4 changed files with 27 additions and 6 deletions
				
			
		|  | @ -306,6 +306,7 @@ const float GLVolume::MODEL_COLOR[4][4] = { | |||
| }; | ||||
| const float GLVolume::SLA_SUPPORT_COLOR[4] = { 0.75f, 0.75f, 0.75f, 1.0f }; | ||||
| const float GLVolume::SLA_PAD_COLOR[4] = { 0.0f, 0.2f, 0.0f, 1.0f }; | ||||
| const float GLVolume::NEUTRAL_COLOR[4] = { 0.9f, 0.9f, 0.9f, 1.0f }; | ||||
| 
 | ||||
| GLVolume::GLVolume(float r, float g, float b, float a) | ||||
|     : m_transformed_bounding_box_dirty(true) | ||||
|  | @ -327,6 +328,7 @@ GLVolume::GLVolume(float r, float g, float b, float a) | |||
|     , is_extrusion_path(false) | ||||
|     , force_transparent(false) | ||||
|     , force_native_color(false) | ||||
|     , force_neutral_color(false) | ||||
|     , tverts_range(0, size_t(-1)) | ||||
|     , qverts_range(0, size_t(-1)) | ||||
| { | ||||
|  | @ -352,12 +354,16 @@ void GLVolume::set_render_color(const float* rgba, unsigned int size) | |||
| 
 | ||||
| void GLVolume::set_render_color() | ||||
| { | ||||
|     if (force_native_color) | ||||
|     if (force_native_color || force_neutral_color) | ||||
|     { | ||||
|         if (is_outside && shader_outside_printer_detection_enabled) | ||||
|             set_render_color(OUTSIDE_COLOR, 4); | ||||
|         else | ||||
|             set_render_color(color, 4); | ||||
|         else { | ||||
|             if (force_native_color) | ||||
|                 set_render_color(color, 4); | ||||
|             else | ||||
|                 set_render_color(NEUTRAL_COLOR, 4); | ||||
|         } | ||||
|     } | ||||
|     else { | ||||
|         if (hover == HS_Select) | ||||
|  |  | |||
|  | @ -251,6 +251,7 @@ public: | |||
|     static const float MODEL_COLOR[4][4]; | ||||
|     static const float SLA_SUPPORT_COLOR[4]; | ||||
|     static const float SLA_PAD_COLOR[4]; | ||||
|     static const float NEUTRAL_COLOR[4]; | ||||
| 
 | ||||
|     enum EHoverState : unsigned char | ||||
|     { | ||||
|  | @ -336,6 +337,8 @@ public: | |||
| 	    bool                force_transparent : 1; | ||||
| 	    // Whether or not always use the volume's own color (not using SELECTED/HOVER/DISABLED/OUTSIDE)
 | ||||
| 	    bool                force_native_color : 1; | ||||
|         // Whether or not render this volume in neutral
 | ||||
|         bool                force_neutral_color : 1; | ||||
| 	}; | ||||
| 
 | ||||
|     // Is mouse or rectangle selection over this object to select/deselect it ?
 | ||||
|  |  | |||
|  | @ -1725,7 +1725,19 @@ void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject | |||
|             if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo) | ||||
|             && (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)) { | ||||
|                 vol->is_active = visible; | ||||
|                 vol->force_native_color = (instance_idx != -1); | ||||
| 
 | ||||
|                 if (instance_idx == -1) { | ||||
|                     vol->force_native_color = false; | ||||
|                     vol->force_neutral_color = false; | ||||
|                 } else { | ||||
|                     const GLGizmosManager& gm = get_gizmos_manager(); | ||||
|                     auto gizmo_type = gm.get_current_type(); | ||||
|                     if (gizmo_type == GLGizmosManager::FdmSupports | ||||
|                      || gizmo_type == GLGizmosManager::Seam) | ||||
|                         vol->force_neutral_color = true; | ||||
|                     else | ||||
|                         vol->force_native_color = true; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -504,13 +504,13 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui) | |||
|     m_iva_blockers.finalize_geometry(true); | ||||
| 
 | ||||
|     if (m_iva_enforcers.has_VBOs()) { | ||||
|         ::glColor4f(0.f, 0.f, 1.f, 0.2f); | ||||
|         ::glColor4f(0.f, 0.f, 1.f, 0.3f); | ||||
|         m_iva_enforcers.render(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     if (m_iva_blockers.has_VBOs()) { | ||||
|         ::glColor4f(1.f, 0.f, 0.f, 0.2f); | ||||
|         ::glColor4f(1.f, 0.f, 0.f, 0.3f); | ||||
|         m_iva_blockers.render(); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Matena
						Lukas Matena