mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Info in ObjectList: Added variable layer height
This commit is contained in:
		
							parent
							
								
									df3fb31268
								
							
						
					
					
						commit
						dfe926ef63
					
				
					 6 changed files with 47 additions and 18 deletions
				
			
		|  | @ -508,6 +508,7 @@ void GLCanvas3D::LayersEditing::reset_layer_height_profile(GLCanvas3D& canvas) | |||
|     m_layer_height_profile.clear(); | ||||
|     m_layers_texture.valid = false; | ||||
|     canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS)); | ||||
|     wxGetApp().obj_list()->update_info_items(last_object_id); | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::LayersEditing::adaptive_layer_height_profile(GLCanvas3D& canvas, float quality_factor) | ||||
|  | @ -517,6 +518,7 @@ void GLCanvas3D::LayersEditing::adaptive_layer_height_profile(GLCanvas3D& canvas | |||
|     const_cast<ModelObject*>(m_model_object)->layer_height_profile.set(m_layer_height_profile); | ||||
|     m_layers_texture.valid = false; | ||||
|     canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS)); | ||||
|     wxGetApp().obj_list()->update_info_items(last_object_id); | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::LayersEditing::smooth_layer_height_profile(GLCanvas3D& canvas, const HeightProfileSmoothingParams& smoothing_params) | ||||
|  | @ -526,6 +528,7 @@ void GLCanvas3D::LayersEditing::smooth_layer_height_profile(GLCanvas3D& canvas, | |||
|     const_cast<ModelObject*>(m_model_object)->layer_height_profile.set(m_layer_height_profile); | ||||
|     m_layers_texture.valid = false; | ||||
|     canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS)); | ||||
|     wxGetApp().obj_list()->update_info_items(last_object_id); | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::LayersEditing::generate_layer_height_texture() | ||||
|  | @ -565,6 +568,7 @@ void GLCanvas3D::LayersEditing::accept_changes(GLCanvas3D& canvas) | |||
|             wxGetApp().plater()->take_snapshot(_(L("Variable layer height - Manual edit"))); | ||||
|             const_cast<ModelObject*>(m_model_object)->layer_height_profile.set(m_layer_height_profile); | ||||
| 			canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS)); | ||||
|             wxGetApp().obj_list()->update_info_items(last_object_id); | ||||
|         } | ||||
|     } | ||||
|     m_layer_height_profile_modified = false; | ||||
|  |  | |||
|  | @ -2138,12 +2138,15 @@ void ObjectList::part_selection_changed() | |||
| 
 | ||||
|                 if (type == itInfo) { | ||||
|                     InfoItemType info_type = m_objects_model->GetInfoItemType(item); | ||||
|                     GLGizmosManager::EType gizmo_type = | ||||
|                         info_type == InfoItemType::CustomSupports ? GLGizmosManager::EType::FdmSupports | ||||
|                                                                   : GLGizmosManager::EType::Seam; | ||||
|                     GLGizmosManager& gizmos_mgr = wxGetApp().plater()->canvas3D()->get_gizmos_manager(); | ||||
|                     if (gizmos_mgr.get_current_type() != gizmo_type) | ||||
|                         gizmos_mgr.open_gizmo(gizmo_type); | ||||
|                     if (info_type != InfoItemType::VariableLayerHeight) { | ||||
|                         GLGizmosManager::EType gizmo_type = | ||||
|                             info_type == InfoItemType::CustomSupports ? GLGizmosManager::EType::FdmSupports | ||||
|                                                                       : GLGizmosManager::EType::Seam; | ||||
|                         GLGizmosManager& gizmos_mgr = wxGetApp().plater()->canvas3D()->get_gizmos_manager(); | ||||
|                         if (gizmos_mgr.get_current_type() != gizmo_type) | ||||
|                             gizmos_mgr.open_gizmo(gizmo_type); | ||||
|                     } else | ||||
|                         wxGetApp().plater()->toggle_layers_editing(true); | ||||
|                 } | ||||
|             } | ||||
|             else { | ||||
|  | @ -2266,16 +2269,30 @@ void ObjectList::update_info_items(size_t obj_idx) | |||
|     wxDataViewItem item_obj = m_objects_model->GetItemById(obj_idx); | ||||
|     assert(item_obj.IsOk()); | ||||
| 
 | ||||
|     for (InfoItemType type : {InfoItemType::CustomSupports, InfoItemType::CustomSeam}) { | ||||
|     for (InfoItemType type : {InfoItemType::CustomSupports, | ||||
|                               InfoItemType::CustomSeam, | ||||
|                               InfoItemType::VariableLayerHeight}) { | ||||
|         wxDataViewItem item = m_objects_model->GetInfoItemByType(item_obj, type); | ||||
|         bool shows = item.IsOk(); | ||||
|         bool should_show = printer_technology() == ptFFF | ||||
|                         && std::any_of(model_object->volumes.begin(), model_object->volumes.end(), | ||||
|                                        [type](const ModelVolume* mv) { | ||||
|                                            return ! (type == InfoItemType::CustomSupports | ||||
|                                                      ? mv->supported_facets.empty() | ||||
|                                                      : mv->seam_facets.empty()); | ||||
|                                        }); | ||||
|         bool should_show = false; | ||||
| 
 | ||||
|         switch (type) { | ||||
|         case InfoItemType::CustomSupports : | ||||
|         case InfoItemType::CustomSeam : | ||||
|             should_show = printer_technology() == ptFFF | ||||
|                        && std::any_of(model_object->volumes.begin(), model_object->volumes.end(), | ||||
|                                       [type](const ModelVolume* mv) { | ||||
|                                           return ! (type == InfoItemType::CustomSupports | ||||
|                                                           ? mv->supported_facets.empty() | ||||
|                                                           : mv->seam_facets.empty()); | ||||
|                                       }); | ||||
|             break; | ||||
| 
 | ||||
|         case InfoItemType::VariableLayerHeight : | ||||
|             should_show = printer_technology() == ptFFF | ||||
|                        && ! model_object->layer_height_profile.empty(); | ||||
|             break; | ||||
|         } | ||||
| 
 | ||||
|         if (! shows && should_show) { | ||||
|             m_objects_model->AddInfoChild(item_obj, type); | ||||
|  |  | |||
|  | @ -54,9 +54,9 @@ ObjectDataViewModelNode::ObjectDataViewModelNode(ObjectDataViewModelNode* parent | |||
|     m_type(itInfo), | ||||
|     m_extruder(wxEmptyString) | ||||
| { | ||||
|     m_name = info_type == InfoItemType::CustomSupports | ||||
|              ? _L("Paint-on supports") | ||||
|              : _L("Paint-on seam"); | ||||
|     m_name = info_type == InfoItemType::CustomSupports ? _L("Paint-on supports") | ||||
|            : info_type == InfoItemType::CustomSeam     ? _L("Paint-on seam") | ||||
|                                                        : _L("Variable layer height"); | ||||
|     m_info_item_type = info_type; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -49,7 +49,8 @@ enum class InfoItemType | |||
| { | ||||
|     Undef, | ||||
|     CustomSupports, | ||||
|     CustomSeam | ||||
|     CustomSeam, | ||||
|     VariableLayerHeight | ||||
| }; | ||||
| 
 | ||||
| class ObjectDataViewModelNode; | ||||
|  |  | |||
|  | @ -4967,6 +4967,12 @@ void Plater::convert_unit(ConversionType conv_type) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void Plater::toggle_layers_editing(bool enable) | ||||
| { | ||||
|     if (canvas3D()->is_layers_editing_enabled() != enable) | ||||
|         wxPostEvent(canvas3D()->get_wxglcanvas(), SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING)); | ||||
| } | ||||
| 
 | ||||
| void Plater::cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_upper, bool keep_lower, bool rotate_lower) | ||||
| { | ||||
|     wxCHECK_RET(obj_idx < p->model.objects.size(), "obj_idx out of bounds"); | ||||
|  |  | |||
|  | @ -191,6 +191,7 @@ public: | |||
|     bool is_selection_empty() const; | ||||
|     void scale_selection_to_fit_print_volume(); | ||||
|     void convert_unit(ConversionType conv_type); | ||||
|     void toggle_layers_editing(bool enable); | ||||
| 
 | ||||
|     void cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_upper = true, bool keep_lower = true, bool rotate_lower = false); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Matena
						Lukas Matena