mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 12:11:15 -06:00 
			
		
		
		
	FIX: [STUDIO-1193] jump to object in slice object warnings
Change-Id: Ic6445d81a31e3ecaa069c5fd49b177dc454dc1b9
This commit is contained in:
		
							parent
							
								
									ba1cb7820a
								
							
						
					
					
						commit
						0da5585582
					
				
					 4 changed files with 22 additions and 9 deletions
				
			
		|  | @ -583,7 +583,7 @@ void PrintObject::slice() | |||
|     //BBS: send warning message to slicing callback
 | ||||
|     if (!warning.empty()) { | ||||
|         BOOST_LOG_TRIVIAL(info) << warning; | ||||
|         this->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, warning+L(" Object:")+this->m_model_object->name, PrintStateBase::SlicingReplaceInitEmptyLayers); | ||||
|         this->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, warning, PrintStateBase::SlicingReplaceInitEmptyLayers); | ||||
|     } | ||||
|     // Update bounding boxes, back up raw slices of complex models.
 | ||||
|     tbb::parallel_for( | ||||
|  | @ -937,8 +937,7 @@ void PrintObject::slice_volumes() | |||
|             //this->active_step_add_warning(
 | ||||
|             //    PrintStateBase::WarningLevel::CRITICAL,
 | ||||
|             //    L("An object has enabled XY Size compensation which will not be used because it is also multi-material painted.\nXY Size "
 | ||||
|             //      "compensation cannot be combined with multi-material painting.") +
 | ||||
|             //        "\n" + (L("Object")) + ": " + this->model_object()->name);
 | ||||
|             //      "compensation cannot be combined with multi-material painting."));
 | ||||
|             BOOST_LOG_TRIVIAL(info) << "xy compensation will not work for object " << this->model_object()->name << " for multi filament."; | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1598,9 +1598,18 @@ void NotificationManager::push_slicing_error_notification(const std::string& tex | |||
| 	push_notification_data({ NotificationType::SlicingError, NotificationLevel::ErrorNotificationLevel, 0,  _u8L("Error:") + "\n" + text }, 0); | ||||
| 	set_slicing_progress_hidden(); | ||||
| } | ||||
| void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ObjectID oid, int warning_step, int warning_msg_id) | ||||
| void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ModelObject const * obj, ObjectID oid, int warning_step, int warning_msg_id) | ||||
| { | ||||
| 	NotificationData data { NotificationType::SlicingWarning, NotificationLevel::WarningNotificationLevel, 0,  _u8L("Warning:") + "\n" + text }; | ||||
|     auto callback = obj ? [id = obj->id()](wxEvtHandler *) { | ||||
| 		auto & objects = wxGetApp().model().objects; | ||||
| 		auto iter = std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; }); | ||||
|         if (iter != objects.end()) | ||||
| 			wxGetApp().obj_list()->select_items({{*iter, nullptr}}); | ||||
| 		return false; | ||||
| 	} : std::function<bool(wxEvtHandler *)>(); | ||||
|     auto link = callback ? _u8L("Jump to") : ""; | ||||
|     if (obj) link += std::string(" [") + obj->name + "]"; | ||||
| 	NotificationData data { NotificationType::SlicingWarning, NotificationLevel::WarningNotificationLevel, 0,  _u8L("Warning:") + "\n" + text, link, callback }; | ||||
| 
 | ||||
| 	data.sub_msg_id = warning_msg_id; | ||||
| 	data.ori_text = text; | ||||
|  |  | |||
|  | @ -190,7 +190,7 @@ public: | |||
| 	// Creates Slicing Error notification with a custom text and no fade out.
 | ||||
| 	void push_slicing_error_notification(const std::string& text); | ||||
| 	// Creates Slicing Warning notification with a custom text and no fade out.
 | ||||
| 	void push_slicing_warning_notification(const std::string& text, bool gray, ObjectID oid, int warning_step, int warning_msg_id); | ||||
|     void push_slicing_warning_notification(const std::string &text, bool gray, ModelObject const *obj, ObjectID oid, int warning_step, int warning_msg_id); | ||||
| 	// marks slicing errors as gray
 | ||||
| 	void set_all_slicing_errors_gray(bool g); | ||||
| 	// marks slicing warings as gray
 | ||||
|  |  | |||
|  | @ -5330,6 +5330,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) | |||
|         ObjectID object_id = evt.status.warning_object_id; | ||||
|         int warning_step = evt.status.warning_step; | ||||
|         PrintStateBase::StateWithWarnings state; | ||||
|         ModelObject const * model_object = nullptr; | ||||
| 
 | ||||
|         //BBS: add partplate related logic, use the print in background process
 | ||||
|         if (evt.status.flags & PrintBase::SlicingStatus::UPDATE_PRINT_STEP_WARNINGS) { | ||||
|  | @ -5338,17 +5339,21 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) | |||
|                 this->background_process.m_sla_print->step_state_with_warnings(static_cast<SLAPrintStep>(warning_step)); | ||||
|         } else if (this->printer_technology == ptFFF) { | ||||
|             const PrintObject *print_object = this->background_process.m_fff_print->get_object(object_id); | ||||
|             if (print_object) | ||||
|             if (print_object) { | ||||
|                 state = print_object->step_state_with_warnings(static_cast<PrintObjectStep>(warning_step)); | ||||
|                 model_object = print_object->model_object(); | ||||
|             } | ||||
|         } else { | ||||
|             const SLAPrintObject *print_object = this->background_process.m_sla_print->get_object(object_id); | ||||
|             if (print_object) | ||||
|             if (print_object) { | ||||
|                 state = print_object->step_state_with_warnings(static_cast<SLAPrintObjectStep>(warning_step)); | ||||
|                 model_object = print_object->model_object(); | ||||
|             } | ||||
|         } | ||||
|         // Now process state.warnings.
 | ||||
|         for (auto const& warning : state.warnings) { | ||||
|             if (warning.current) { | ||||
|                 notification_manager->push_slicing_warning_notification(warning.message, false, object_id, warning_step, warning.message_id); | ||||
|                 notification_manager->push_slicing_warning_notification(warning.message, false, model_object, object_id, warning_step, warning.message_id); | ||||
|                 add_warning(warning, object_id.id); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 chunmao.guo
						chunmao.guo