From 8b735631b1b068b87c46c32243d183e9aec41b60 Mon Sep 17 00:00:00 2001 From: "xun.zhang" Date: Sat, 15 Feb 2025 11:19:06 +0800 Subject: [PATCH] ENH: fix unable to load video 1. also add protect for filament map read jira:NONE Signed-off-by: xun.zhang Change-Id: I321be9f49d7696d02ed7771852713c0cef5d5ebd --- src/libslic3r/Format/bbs_3mf.cpp | 11 +++++++++-- src/slic3r/GUI/MainFrame.cpp | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index 933212534..af6d0f296 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -4173,8 +4173,15 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) } } else if (key == FILAMENT_MAP_ATTR) { - if (m_curr_plater) - m_curr_plater->config.set_key_value("filament_map", new ConfigOptionInts(get_vector_from_string(value))); + if (m_curr_plater){ + auto filament_map = get_vector_from_string(value); + for (size_t idx = 0; idx < filament_map.size(); ++idx) { + if (filament_map[idx] < 1) { + filament_map[idx] = 1; + } + } + m_curr_plater->config.set_key_value("filament_map", new ConfigOptionInts(filament_map)); + } } else if (key == UNPRINTABLE_FILAMENT_MAP_ATTR) { diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 0f2ed99f9..a174551ce 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1665,7 +1665,12 @@ wxBoxSizer* MainFrame::create_side_tools() MessageDialog dlg(this, _L("This is your first time slicing with the H2D machine.\nWould you like to watch a quick tutorial video?"), _L("First Guide"), wxYES_NO); auto res = dlg.ShowModal(); if (res == wxID_YES) { - fs::path video_path = fs::path(resources_dir()) / "videos/dual_extruder_slicing.mp4"; + bool is_zh = wxGetApp().app_config->get("language") == "zh_CN"; + fs::path video_path; + if (is_zh) + video_path = fs::path(resources_dir()) / "videos/dual_extruder_slicing_zh.mp4"; + else + video_path = fs::path(resources_dir()) / "videos/dual_extruder_slicing_en.mp4"; wxString video_path_str = wxString::FromUTF8(video_path.string()); if (wxFileExists(video_path_str)) {