mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	ENH: mark icon if plate bed_type differ from global
Change-Id: I6ae1396b8a3007b61ce85992ebb2aec6c64ec2ff (cherry picked from commit c8dbb583838df20105c0ca4f9d1a5d711d7c0347)
This commit is contained in:
		
							parent
							
								
									f01cf37ead
								
							
						
					
					
						commit
						0dd5057b4d
					
				
					 10 changed files with 207 additions and 344 deletions
				
			
		|  | @ -710,8 +710,12 @@ void PartPlate::render_icons(bool bottom, int hover_id) const | |||
|         if (m_partplate_list->render_bedtype_setting) { | ||||
|             if (hover_id == 5) | ||||
|                 render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_hovered_texture, m_bedtype_vbo_id); | ||||
|             else | ||||
|                 render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_texture, m_bedtype_vbo_id); | ||||
|             else { | ||||
|                 if (render_bedtype_setting_warned) | ||||
|                     render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_warned_texture, m_bedtype_vbo_id); | ||||
|                 else | ||||
|                     render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_texture, m_bedtype_vbo_id); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (m_plate_index >=0 && m_plate_index < MAX_PLATE_COUNT) { | ||||
|  | @ -2020,6 +2024,11 @@ void PartPlate::render(bool bottom, bool only_body, bool force_background_color, | |||
| 	glsafe(::glDisable(GL_DEPTH_TEST)); | ||||
| } | ||||
| 
 | ||||
| void PartPlate::set_plate_render_option(bool bedtype_setting_warned) | ||||
| { | ||||
|     render_bedtype_setting_warned = bedtype_setting_warned; | ||||
| } | ||||
| 
 | ||||
| void PartPlate::set_selected() { | ||||
| 	m_selected = true; | ||||
| } | ||||
|  | @ -2428,6 +2437,14 @@ void PartPlateList::generate_icon_textures() | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if (m_bedtype_warned_texture.get_id() == 0) | ||||
| 	{ | ||||
| 		file_name = path + "plate_set_bedtype_warned.svg"; | ||||
| 		if (!m_bedtype_warned_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) { | ||||
| 			BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if (m_bedtype_hovered_texture.get_id() == 0) | ||||
| 	{ | ||||
| 		file_name = path + "plate_set_bedtype_hover.svg"; | ||||
|  | @ -2493,6 +2510,7 @@ void PartPlateList::release_icon_textures() | |||
| 	m_lockopen_texture.reset(); | ||||
| 	m_lockopen_hovered_texture.reset(); | ||||
| 	m_bedtype_texture.reset(); | ||||
| 	m_bedtype_warned_texture.reset(); | ||||
| 	m_bedtype_hovered_texture.reset(); | ||||
| 
 | ||||
| 	for (int i = 0;i < MAX_PLATE_COUNT; i++) { | ||||
|  |  | |||
|  | @ -138,6 +138,9 @@ private: | |||
|     mutable unsigned int m_plate_idx_vbo_id{ 0 }; | ||||
|     GLTexture m_texture; | ||||
| 
 | ||||
|     // plate render option
 | ||||
|     bool render_bedtype_setting_warned = false; | ||||
| 
 | ||||
|     mutable float m_grabber_color[4]; | ||||
|     float m_scale_factor{ 1.0f }; | ||||
|     GLUquadricObject* m_quadric; | ||||
|  | @ -207,6 +210,7 @@ public: | |||
|     void clear(bool clear_sliced_result = true); | ||||
| 
 | ||||
|     BedType get_bed_type() const; | ||||
|     bool is_bedtype_same_as_global = true; | ||||
|     void set_bed_type(BedType, bool& same_as_global); | ||||
|     void reset_bed_type(); | ||||
|     DynamicPrintConfig* config() { return &m_config; } | ||||
|  | @ -298,6 +302,7 @@ public: | |||
| 
 | ||||
|     void render(bool bottom, bool only_body = false, bool force_background_color = false, HeightLimitMode mode = HEIGHT_LIMIT_NONE, int hover_id = -1); | ||||
|     void render_for_picking() const { on_render_for_picking(); } | ||||
|     void set_plate_render_option(bool bedtype_setting_warned); | ||||
|     void set_selected(); | ||||
|     void set_unselected(); | ||||
|     void set_hover_id(int id) { m_hover_id = id; } | ||||
|  | @ -454,6 +459,7 @@ class PartPlateList : public ObjectBase | |||
|     GLTexture m_lockopen_texture; | ||||
|     GLTexture m_lockopen_hovered_texture; | ||||
|     GLTexture m_bedtype_texture; | ||||
|     GLTexture m_bedtype_warned_texture; | ||||
|     GLTexture m_bedtype_hovered_texture; | ||||
|     GLTexture m_idx_textures[MAX_PLATE_COUNT]; | ||||
|     // set render option
 | ||||
|  | @ -529,6 +535,8 @@ public: | |||
|     int get_curr_plate_index() const { return m_current_plate; } | ||||
|     PartPlate* get_curr_plate() { return m_plate_list[m_current_plate]; } | ||||
| 
 | ||||
|     std::vector<PartPlate*>& get_plate_list() { return m_plate_list; }; | ||||
| 
 | ||||
|     PartPlate* get_selected_plate(); | ||||
| 
 | ||||
|     Vec3d get_current_plate_origin() { return compute_origin(m_current_plate, m_plate_cols); } | ||||
|  |  | |||
|  | @ -5212,6 +5212,10 @@ void Plater::priv::on_select_bed_type(wxCommandEvent &evt) | |||
|             app_config->set("curr_bed_type", std::to_string(int(bed_type))); | ||||
| 
 | ||||
|             // update render
 | ||||
|             auto plate_list = partplate_list.get_plate_list(); | ||||
|             for (auto plate : plate_list) { | ||||
|                 plate->set_plate_render_option(false); | ||||
|             } | ||||
|             view3D->get_canvas3d()->render(); | ||||
|             preview->msw_rescale(); | ||||
|         } | ||||
|  | @ -10588,6 +10592,7 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click) | |||
|                 bool same_as_global = false; | ||||
|                 auto type = (BedType)(e.GetInt()); | ||||
|                 p->partplate_list.get_curr_plate()->set_bed_type(type, same_as_global); | ||||
|                 p->partplate_list.get_curr_plate()->set_plate_render_option(same_as_global?false:true); | ||||
|                 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("select bed type %1% for plate %2% at plate side")%type %plate_index; | ||||
|                 }); | ||||
|             dlg.ShowModal(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao.jin
						tao.jin