Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_objects_collision

This commit is contained in:
enricoturri1966 2021-10-04 08:30:13 +02:00
commit 2e779d8594
16 changed files with 166 additions and 67 deletions

View file

@ -727,7 +727,7 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
if( bottom_area - top_area > delta_area) {
NotificationManager *notif_mngr = wxGetApp().plater()->get_notification_manager();
notif_mngr->push_notification(
NotificationType::SignDetected, NotificationManager::NotificationLevel::RegularNotificationLevel,
NotificationType::SignDetected, NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("NOTE:") + "\n" + _u8L("Sliced object looks like the sign") + "\n",
_u8L("Apply auto color change to print"),
[this](wxEvtHandler*) {

View file

@ -23,7 +23,7 @@ static inline void show_notification_extruders_limit_exceeded()
wxGetApp()
.plater()
->get_notification_manager()
->push_notification(NotificationType::MmSegmentationExceededExtrudersLimit, NotificationManager::NotificationLevel::RegularNotificationLevel,
->push_notification(NotificationType::MmSegmentationExceededExtrudersLimit, NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
GUI::format(_L("Your printer has more extruders than the multi-material painting gizmo supports. For this reason, only the "
"first %1% extruders will be able to be used for painting."), GLGizmoMmuSegmentation::EXTRUDERS_LIMIT));
}

View file

@ -80,6 +80,10 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
set_its(*m_original_its);
}
// close suggestion notification
auto notification_manager = wxGetApp().plater()->get_notification_manager();
notification_manager->remove_simplify_suggestion_with_id(act_volume->get_object()->id());
m_obj_index = obj_index; // to remember correct object
m_volume = act_volume;
m_original_its = {};
@ -363,7 +367,7 @@ void GLGizmoSimplify::on_set_state()
auto notification_manager = wxGetApp().plater()->get_notification_manager();
notification_manager->push_notification(
NotificationType::CustomNotification,
NotificationManager::NotificationLevel::RegularNotificationLevel,
NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("ERROR: Wait until Simplification ends or Cancel process."));
return;
}

View file

@ -192,7 +192,7 @@ bool GLGizmosManager::check_gizmos_closed_except(EType type) const
if (get_current_type() != type && get_current_type() != Undefined) {
wxGetApp().plater()->get_notification_manager()->push_notification(
NotificationType::CustomSupportsAndSeamRemovedAfterRepair,
NotificationManager::NotificationLevel::RegularNotificationLevel,
NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("ERROR: Please close all manipulators available from "
"the left toolbar first"));
return false;

View file

@ -917,29 +917,14 @@ void NotificationManager::HintNotification::render_right_arrow_button(ImGuiWrapp
}
void NotificationManager::HintNotification::render_logo(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
{
ImVec2 win_size(win_size_x, win_size_y);
ImVec2 win_pos(win_pos_x, win_pos_y);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.0f, .0f, .0f, .0f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(.0f, .0f, .0f, .0f));
push_style_color(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
std::wstring button_text;
button_text = ImGui::ClippyMarker;//LeftArrowButton;
std::string placeholder_text;
placeholder_text = ImGui::EjectButton;
ImVec2 button_pic_size = ImGui::CalcTextSize(placeholder_text.c_str());
ImVec2 button_size(button_pic_size.x * 1.25f * 2.f, button_pic_size.y * 1.25f * 2.f);
ImGui::SetCursorPosY(win_size.y / 2 - button_size.y * 1.1f);
ImGui::SetCursorPosX(0);
// shouldnt it render as text?
if (imgui.button(button_text.c_str(), button_size.x, button_size.y))
{
}
ImGui::PopStyleColor(5);
std::wstring text;
text = ImGui::ClippyMarker;
ImGui::SetCursorPosX(button_pic_size.x / 3);
ImGui::SetCursorPosY(win_size_y / 2 - button_pic_size.y * 2.f);
imgui.text(text.c_str());
}
void NotificationManager::HintNotification::render_documentation_button(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
{
@ -1012,7 +997,7 @@ void NotificationManager::HintNotification::retrieve_data(bool new_hint/* = true
if(hint_data != nullptr)
{
NotificationData nd { NotificationType::DidYouKnowHint,
NotificationLevel::RegularNotificationLevel,
NotificationLevel::HintNotificationLevel,
0,
hint_data->text,
hint_data->hypertext, nullptr,

View file

@ -48,6 +48,7 @@ static const std::map<const wchar_t, std::string> font_icons = {
{ImGui::RightArrowHoverButton , "notification_right_hover" },
{ImGui::PreferencesButton , "notification_preferences" },
{ImGui::PreferencesHoverButton , "notification_preferences_hover"},
};
static const std::map<const wchar_t, std::string> font_icons_large = {
{ImGui::CloseNotifButton , "notification_close" },
@ -65,6 +66,8 @@ static const std::map<const wchar_t, std::string> font_icons_large = {
{ImGui::VarLayerHeightMarker , "layers" },
{ImGui::DocumentationButton , "notification_documentation" },
{ImGui::DocumentationHoverButton, "notification_documentation_hover"},
{ImGui::InfoMarker , "notification_info" },
};
static const std::map<const wchar_t, std::string> font_icons_extra_large = {

View file

@ -153,8 +153,8 @@ void SLAImportJob::process()
break;
}
} catch (MissingProfileError &) {
p->err = _L("The archive doesn't contain any profile data. Try to import after switching "
"to an SLA profile that can be used as fallback.").ToStdString();
p->err = _L("The SLA archive doesn't contain any presets. "
"Please activate some SLA printer preset first before importing that SLA archive.").ToStdString();
} catch (std::exception &ex) {
p->err = ex.what();
}
@ -207,8 +207,8 @@ void SLAImportJob::finalize()
m_plater->get_notification_manager()->push_notification(
NotificationType::CustomNotification,
NotificationManager::NotificationLevel::WarningNotificationLevel,
_L("Loaded archive did not contain any profile data. "
"The current SLA profile was used as fallback.").ToStdString());
_L("The imported SLA archive did not contain any presets. "
"The current SLA presets were used as fallback.").ToStdString());
}
if (p->sel != Sel::modelOnly) {

View file

@ -43,10 +43,10 @@ const NotificationManager::NotificationData NotificationManager::basic_notificat
},
{NotificationType::NewAppAvailable, NotificationLevel::ImportantNotificationLevel, 20, _u8L("New version is available."), _u8L("See Releases page."), [](wxEvtHandler* evnthndlr) {
wxGetApp().open_browser_with_warning_dialog("https://github.com/prusa3d/PrusaSlicer/releases"); return true; }},
{NotificationType::EmptyColorChangeCode, NotificationLevel::ObjectInfoNotificationLevel, 10,
{NotificationType::EmptyColorChangeCode, NotificationLevel::PrintInfoNotificationLevel, 10,
_u8L("You have just added a G-code for color change, but its value is empty.\n"
"To export the G-code correctly, check the \"Color Change G-code\" in \"Printer Settings > Custom G-code\"") },
{NotificationType::EmptyAutoColorChange, NotificationLevel::ObjectInfoNotificationLevel, 10,
{NotificationType::EmptyAutoColorChange, NotificationLevel::PrintInfoNotificationLevel, 10,
_u8L("No color change event was added to the print. The print does not look like a sign.") },
{NotificationType::DesktopIntegrationSuccess, NotificationLevel::RegularNotificationLevel, 10,
_u8L("Desktop integration was successful.") },
@ -276,7 +276,9 @@ void NotificationManager::PopNotification::count_spaces()
m_line_height = ImGui::CalcTextSize("A").y;
m_left_indentation = m_line_height;
if (m_data.level == NotificationLevel::ErrorNotificationLevel || m_data.level == NotificationLevel::WarningNotificationLevel) {
if (m_data.level == NotificationLevel::ErrorNotificationLevel
|| m_data.level == NotificationLevel::WarningNotificationLevel
|| m_data.level == NotificationLevel::PrintInfoNotificationLevel) {
std::string text;
text = (m_data.level == NotificationLevel::ErrorNotificationLevel ? ImGui::ErrorMarker : ImGui::WarningMarker);
float picture_width = ImGui::CalcTextSize(text.c_str()).x;
@ -511,7 +513,13 @@ void NotificationManager::PopNotification::render_left_sign(ImGuiWrapper& imgui)
ImGui::SetCursorPosX(m_line_height / 3);
ImGui::SetCursorPosY(m_window_height / 2 - m_line_height);
imgui.text(text.c_str());
}
} else if (m_data.level == NotificationLevel::PrintInfoNotificationLevel) {
std::wstring text;
text = ImGui::InfoMarker;
ImGui::SetCursorPosX(m_line_height / 3);
ImGui::SetCursorPosY(m_window_height / 2 - m_line_height);
imgui.text(text.c_str());
}
}
void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper& imgui, const float win_pos_x, const float win_pos_y)
{
@ -1604,7 +1612,7 @@ void NotificationManager::close_slicing_error_notification(const std::string& te
}
void NotificationManager::push_simplify_suggestion_notification(const std::string& text, ObjectID object_id, const std::string& hypertext/* = ""*/, std::function<bool(wxEvtHandler*)> callback/* = std::function<bool(wxEvtHandler*)>()*/)
{
NotificationData data{ NotificationType::SimplifySuggestion, NotificationLevel::ObjectInfoNotificationLevel, 10, text, hypertext, callback };
NotificationData data{ NotificationType::SimplifySuggestion, NotificationLevel::PrintInfoNotificationLevel, 10, text, hypertext, callback };
auto notification = std::make_unique<NotificationManager::ObjectIDNotification>(data, m_id_provider, m_evt_handler);
notification->object_id = object_id;
push_notification_data(std::move(notification), 0);
@ -1636,6 +1644,15 @@ void NotificationManager::remove_simplify_suggestion_of_released_objects(const s
}
}
void NotificationManager::remove_simplify_suggestion_with_id(const ObjectID oid)
{
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications)
if (notification->get_type() == NotificationType::SimplifySuggestion) {
if (static_cast<ObjectIDNotification*>(notification.get())->object_id == oid)
notification->close();
}
}
void NotificationManager::push_exporting_finished_notification(const std::string& path, const std::string& dir_path, bool on_removable)
{
close_notification_of_type(NotificationType::ExportFinished);
@ -1914,7 +1931,7 @@ void NotificationManager::push_updated_item_info_notification(InfoItemType type)
}
}
NotificationData data{ NotificationType::UpdatedItemsInfo, NotificationLevel::ObjectInfoNotificationLevel, 10, "" };
NotificationData data{ NotificationType::UpdatedItemsInfo, NotificationLevel::PrintInfoNotificationLevel, 10, "" };
auto notification = std::make_unique<NotificationManager::UpdatedItemsInfoNotification>(data, m_id_provider, m_evt_handler, type);
if (push_notification_data(std::move(notification), 0)) {
(dynamic_cast<UpdatedItemsInfoNotification*>(m_pop_notifications.back().get()))->add_type(type);

View file

@ -122,7 +122,7 @@ public:
// "Good to know" notification, usually but not always with a quick fade-out.
RegularNotificationLevel,
// Regular level notifiaction containing info about objects or print. Has Icon.
ObjectInfoNotificationLevel,
PrintInfoNotificationLevel,
// Information notification without a fade-out or with a longer fade-out.
ImportantNotificationLevel,
// Warning, no fade-out.
@ -174,6 +174,7 @@ public:
// Close object warnings, whose ObjectID is not in the list.
// living_oids is expected to be sorted.
void remove_simplify_suggestion_of_released_objects(const std::vector<ObjectID>& living_oids);
void remove_simplify_suggestion_with_id(const ObjectID oid);
// Called when the side bar changes its visibility, as the "slicing complete" notification supplements
// the "slicing info" normally shown at the side bar.
void set_sidebar_collapsed(bool collapsed);
@ -704,13 +705,14 @@ private:
size_t get_standart_duration(NotificationLevel level)
{
switch (level) {
case NotificationLevel::RegularNotificationLevel: return 20;
case NotificationLevel::ErrorNotificationLevel: return 0;
case NotificationLevel::WarningNotificationLevel: return 0;
case NotificationLevel::ImportantNotificationLevel: return 0;
case NotificationLevel::ProgressBarNotificationLevel: return 2;
case NotificationLevel::RegularNotificationLevel: return 10;
case NotificationLevel::PrintInfoNotificationLevel: return 10;
case NotificationLevel::HintNotificationLevel: return 300;
case NotificationLevel::ObjectInfoNotificationLevel: return 20;
default: return 10;
}
}

View file

@ -2346,7 +2346,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
for (std::string& name : names)
notif_text += "\n - " + name;
notification_manager->push_notification(NotificationType::CustomNotification,
NotificationManager::NotificationLevel::RegularNotificationLevel, notif_text);
NotificationManager::NotificationLevel::PrintInfoNotificationLevel, notif_text);
}
}
@ -2442,7 +2442,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
for (ModelObject* model_object : model.objects) {
if (!type_3mf && !type_zip_amf)
model_object->center_around_origin(false);
model_object->ensure_on_bed(is_project_file || type_3mf || type_zip_amf);
model_object->ensure_on_bed(is_project_file);
}
// check multi-part object adding for the SLA-printing
@ -2459,7 +2459,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
if (one_by_one) {
if (type_3mf && !is_project_file)
model.center_instances_around_point(bed_shape_bb().center());
auto loaded_idxs = load_model_objects(model.objects, is_project_file || type_3mf || type_zip_amf);
auto loaded_idxs = load_model_objects(model.objects, is_project_file);
obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end());
} else {
// This must be an .stl or .obj file, which may contain a maximum of one volume.
@ -2910,7 +2910,7 @@ void Plater::priv::split_object()
// If we splited object which is contain some parts/modifiers then all non-solid parts (modifiers) were deleted
if (current_model_object->volumes.size() > 1 && current_model_object->volumes.size() != new_objects.size())
notification_manager->push_notification(NotificationType::CustomNotification,
NotificationManager::NotificationLevel::RegularNotificationLevel,
NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("All non-solid parts (modifiers) were deleted"));
Plater::TakeSnapshot snapshot(q, _L("Split to Objects"));
@ -6432,7 +6432,7 @@ void Plater::clear_before_change_mesh(int obj_idx)
// snapshot_time is captured by copy so the lambda knows where to undo/redo to.
get_notification_manager()->push_notification(
NotificationType::CustomSupportsAndSeamRemovedAfterRepair,
NotificationManager::NotificationLevel::RegularNotificationLevel,
NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("Custom supports, seams and multimaterial painting were "
"removed after repairing the mesh."));
// _u8L("Undo the repair"),